summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcodemaster <codemaster@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-13 02:16:51 +0000
committercodemaster <codemaster@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-13 02:16:51 +0000
commit996a25cabc3c5be0ac8a5c4a46123e076b07af39 (patch)
tree573c407394a6338db6e2083a702386abf8a6a4c1 /src
parentbaff4da7ab8cf41ac0313c7a0e4d2c6685217eb1 (diff)
downloadhercules-996a25cabc3c5be0ac8a5c4a46123e076b07af39.tar.gz
hercules-996a25cabc3c5be0ac8a5c4a46123e076b07af39.tar.bz2
hercules-996a25cabc3c5be0ac8a5c4a46123e076b07af39.tar.xz
hercules-996a25cabc3c5be0ac8a5c4a46123e076b07af39.zip
Fixed Attacking Mobs by using a file from FREYA (thanks MagicalTux and Yor)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@141 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c4240
-rw-r--r--src/map/clif.h20
-rw-r--r--src/map/intif.c14
-rw-r--r--src/map/map.h8
4 files changed, 2399 insertions, 1883 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 9be02b3ac..d0fd96111 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1,4 +1,4 @@
-// $Id: clif.c 164 2004-10-01 16:46:58Z $
+// $Id: clif.c 2200 2004-11-07 11:49:58Z Yor $
#define DUMP_UNKNOWN_PACKET 1
@@ -8,21 +8,22 @@
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
-#include <sys/types.h>
-#include <time.h>
-#ifdef _WIN32
-#include <winsock.h>
+#ifdef __WIN32
+#define __USE_W32_SOCKETS
+#include <windows.h>
#else
+#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
+#include <time.h>
-#include "socket.h"
-#include "timer.h"
-#include "malloc.h"
-#include "version.h"
-#include "nullpo.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/malloc.h"
+#include "../common/version.h"
+#include "../common/nullpo.h"
#include "map.h"
#include "chrif.h"
@@ -43,7 +44,6 @@
#include "guild.h"
#include "vending.h"
#include "pet.h"
-#include "mmo.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -51,8 +51,62 @@
#define STATE_BLIND 0x10
-/* Packet Database */
-struct packet_db packet_db[MAX_PACKET_DB];
+static const int packet_len_table[0x220] = {
+ 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+//#0x0040
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
+#if PACKETVER < 2
+ 3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6,
+#else // 78-7b 亀島以降 lv99エフェクト用
+ 3, 28, 19, 11, 3, -1, 9, 5, 54, 53, 58, 60, 41, 2, 6, 6,
+#endif
+//#0x0080
+ 7, 3, 2, 2, 2, 5, 16, 12, 10, 7, 29, 23, -1, -1, -1, 0, // 0x8b unknown... size 2 or 23?
+ 7, 22, 28, 2, 6, 30, -1, -1, 3, -1, -1, 5, 9, 17, 17, 6,
+ 23, 6, 6, -1, -1, -1, -1, 8, 7, 6, 7, 4, 7, 0, -1, 6,
+ 8, 8, 3, 3, -1, 6, 6, -1, 7, 6, 2, 5, 6, 44, 5, 3,
+//#0x00C0
+ 7, 2, 6, 8, 6, 7, -1, -1, -1, -1, 3, 3, 6, 6, 2, 27,
+ 3, 4, 4, 2, -1, -1, 3, -1, 6, 14, 3, -1, 28, 29, -1, -1,
+ 30, 30, 26, 2, 6, 26, 3, 3, 8, 19, 5, 2, 3, 2, 2, 2,
+ 3, 2, 6, 8, 21, 8, 8, 2, 2, 26, 3, -1, 6, 27, 30, 10,
+
+//#0x0100
+ 2, 6, 6, 30, 79, 31, 10, 10, -1, -1, 4, 6, 6, 2, 11, -1,
+ 10, 39, 4, 10, 31, 35, 10, 18, 2, 13, 15, 20, 68, 2, 3, 16,
+ 6, 14, -1, -1, 21, 8, 8, 8, 8, 8, 2, 2, 3, 4, 2, -1,
+ 6, 86, 6, -1, -1, 7, -1, 6, 3, 16, 4, 4, 4, 6, 24, 26,
+//#0x0140
+ 22, 14, 6, 10, 23, 19, 6, 39, 8, 9, 6, 27, -1, 2, 6, 6,
+ 110, 6, -1, -1, -1, -1, -1, 6, -1, 54, 66, 54, 90, 42, 6, 42,
+ -1, -1, -1, -1, -1, 30, -1, 3, 14, 3, 30, 10, 43, 14,186,182,
+ 14, 30, 10, 3, -1, 6,106, -1, 4, 5, 4, -1, 6, 7, -1, -1,
+//#0x0180
+ 6, 3,106, 10, 10, 34, 0, 6, 8, 4, 4, 4, 29, -1, 10, 6,
+#if PACKETVER < 1
+ 90, 86, 24, 6, 30,102, 8, 4, 8, 4, 14, 10, -1, 6, 2, 6,
+#else // 196 comodo以降 状態表示アイコン用
+ 90, 86, 24, 6, 30,102, 9, 4, 8, 4, 14, 10, -1, 6, 2, 6,
+#endif
+ 3, 3, 35, 5, 11, 26, -1, 4, 4, 6, 10, 12, 6, -1, 4, 4,
+ 11, 7, -1, 67, 12, 18,114, 6, 3, 6, 26, 26, 26, 26, 2, 3,
+//#0x01C0, Set 0x1d5=-1
+ 2, 14, 10, -1, 22, 22, 4, 2, 13, 97, 0, 9, 9, 30, 6, 28,
+ 8, 14, 10, 35, 6, -1, 4, 11, 54, 53, 60, 2, -1, 47, 33, 6,
+ 30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2, -1, -1,
+ -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10,
+//#0x200
+ 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 19, 0, -1, 24, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+// size list for each packet version after packet version 4.
+static int packet_size_table[9][0x220];
// local define
enum {
@@ -93,270 +147,29 @@ int map_fd;
char talkie_mes[80];
/*==========================================
- * Clif Parsing Functions
- *------------------------------------------
- */
-void clif_parse_WantToConnection(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_LoadEndAck(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TickSend(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_WalkToXY(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_QuitGame(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GetCharNameRequest(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GlobalMessage(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_MapMove(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ChangeDir(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_Emotion(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_HowManyConnections(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ActionRequest(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_Restart(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_Wis(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMmessage(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TakeItem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_DropItem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_UseItem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_EquipItem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_UnequipItem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcClicked(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcBuySellSelected(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcBuyListSend(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_CreateChatRoom(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ChatAddMember(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ChatRoomStatusChange(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ChangeChatOwner(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_KickFromChat(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ChatLeave(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TradeRequest(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TradeAck(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TradeAddItem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TradeOk(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TradeCancel(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_TradeCommit(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_StopAttack(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_PutItemToCart(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_RemoveOption(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ChangeCart(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_StatusUp(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_SkillUp(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_UseSkillToId(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_UseSkillToPos(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_UseSkillMap(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_RequestMemo(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ProduceMix(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcStringInput(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ItemIdentify(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_SelectArrow(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_AutoSpell(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_UseCard(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_InsertCard(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_SolveCharName(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ResetChar(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_LGMmessage(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_MoveToKafra(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_MoveToKafraFromCart(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_MoveFromKafraToCart(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_CloseKafra(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_CreateParty(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_CreateParty2(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_PartyInvite(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_LeaveParty(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_RemovePartyMember(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_PartyChangeOption(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_PartyMessage(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_CloseVending(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_VendingListReq(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_PurchaseReq(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_OpenVending(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_CreateGuild(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildCheckMaster(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildRequestInfo(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildChangePositionInfo(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildChangeMemberPosition(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildChangeNotice(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildInvite(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildLeave(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildExplusion(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildMessage(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildRequestAlliance(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildReplyAlliance(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildDelAlliance(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildOpposition(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GuildBreak(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_PetMenu(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_CatchPet(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_SelectEgg(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_SendEmotion(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_ChangePetName(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMKick(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMHide(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMReqNoChatCount(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_sn_doridori(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_sn_explosionspirits(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_wisexin(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_wisall(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_wisexlist(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMkillall(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMsummon(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_GMshift(int fd,struct map_session_data *sd, int cmd);
-void clif_parse_debug(int fd,struct map_session_data *sd, int cmd);
-
-struct {
- void (*func)();
- char *name;
-} clif_parse_func[]={
- {clif_parse_WantToConnection,"wanttoconnection"},
- {clif_parse_LoadEndAck,"loadendack"},
- {clif_parse_TickSend,"ticksend"},
- {clif_parse_WalkToXY,"walktoxy"},
- {clif_parse_QuitGame,"quitgame"},
- {clif_parse_GetCharNameRequest,"getcharnamerequest"},
- {clif_parse_GlobalMessage,"globalmessage"},
- {clif_parse_MapMove,"mapmove"},
- {clif_parse_ChangeDir,"changedir"},
- {clif_parse_Emotion,"emotion"},
- {clif_parse_HowManyConnections,"howmanyconnections"},
- {clif_parse_ActionRequest,"actionrequest"},
- {clif_parse_Restart,"restart"},
- {clif_parse_Wis,"wis"},
- {clif_parse_GMmessage,"gmmessage"},
- {clif_parse_TakeItem,"takeitem"},
- {clif_parse_DropItem,"dropitem"},
- {clif_parse_UseItem,"useitem"},
- {clif_parse_EquipItem,"equipitem"},
- {clif_parse_UnequipItem,"unequipitem"},
- {clif_parse_NpcClicked,"npcclicked"},
- {clif_parse_NpcBuySellSelected,"npcbuysellselected"},
- {clif_parse_NpcBuyListSend,"npcbuylistsend"},
- {clif_parse_NpcSellListSend,"npcselllistsend"},
- {clif_parse_CreateChatRoom,"createchatroom"},
- {clif_parse_ChatAddMember,"chataddmember"},
- {clif_parse_ChatRoomStatusChange,"chatroomstatuschange"},
- {clif_parse_ChangeChatOwner,"changechatowner"},
- {clif_parse_KickFromChat,"kickfromchat"},
- {clif_parse_ChatLeave,"chatleave"},
- {clif_parse_TradeRequest,"traderequest"},
- {clif_parse_TradeAck,"tradeack"},
- {clif_parse_TradeAddItem,"tradeadditem"},
- {clif_parse_TradeOk,"tradeok"},
- {clif_parse_TradeCancel,"tradecancel"},
- {clif_parse_TradeCommit,"tradecommit"},
- {clif_parse_StopAttack,"stopattack"},
- {clif_parse_PutItemToCart,"putitemtocart"},
- {clif_parse_GetItemFromCart,"getitemfromcart"},
- {clif_parse_RemoveOption,"removeoption"},
- {clif_parse_ChangeCart,"changecart"},
- {clif_parse_StatusUp,"statusup"},
- {clif_parse_SkillUp,"skillup"},
- {clif_parse_UseSkillToId,"useskilltoid"},
- {clif_parse_UseSkillToPos,"useskilltopos"},
- {clif_parse_UseSkillMap,"useskillmap"},
- {clif_parse_RequestMemo,"requestmemo"},
- {clif_parse_ProduceMix,"producemix"},
- {clif_parse_NpcSelectMenu,"npcselectmenu"},
- {clif_parse_NpcNextClicked,"npcnextclicked"},
- {clif_parse_NpcAmountInput,"npcamountinput"},
- {clif_parse_NpcStringInput,"npcstringinput"},
- {clif_parse_NpcCloseClicked,"npccloseclicked"},
- {clif_parse_ItemIdentify,"itemidentify"},
- {clif_parse_SelectArrow,"selectarrow"},
- {clif_parse_AutoSpell,"autospell"},
- {clif_parse_UseCard,"usecard"},
- {clif_parse_InsertCard,"insertcard"},
- {clif_parse_SolveCharName,"solvecharname"},
- {clif_parse_ResetChar,"resetchar"},
- {clif_parse_LGMmessage,"lgmmessage"},
- {clif_parse_MoveToKafra,"movetokafra"},
- {clif_parse_MoveFromKafra,"movefromkafra"},
- {clif_parse_MoveToKafraFromCart,"movetokafrafromcart"},
- {clif_parse_MoveFromKafraToCart,"movefromkafratocart"},
- {clif_parse_CloseKafra,"closekafra"},
- {clif_parse_CreateParty,"createparty"},
- {clif_parse_CreateParty2,"createparty2"},
- {clif_parse_PartyInvite,"partyinvite"},
- {clif_parse_ReplyPartyInvite,"replypartyinvite"},
- {clif_parse_LeaveParty,"leaveparty"},
- {clif_parse_RemovePartyMember,"removepartymember"},
- {clif_parse_PartyChangeOption,"partychangeoption"},
- {clif_parse_PartyMessage,"partymessage"},
- {clif_parse_CloseVending,"closevending"},
- {clif_parse_VendingListReq,"vendinglistreq"},
- {clif_parse_PurchaseReq,"purchasereq"},
- {clif_parse_OpenVending,"openvending"},
- {clif_parse_CreateGuild,"createguild"},
- {clif_parse_GuildCheckMaster,"guildcheckmaster"},
- {clif_parse_GuildRequestInfo,"guildrequestinfo"},
- {clif_parse_GuildChangePositionInfo,"guildchangepositioninfo"},
- {clif_parse_GuildChangeMemberPosition,"guildchangememberposition"},
- {clif_parse_GuildRequestEmblem,"guildrequestemblem"},
- {clif_parse_GuildChangeEmblem,"guildchangeemblem"},
- {clif_parse_GuildChangeNotice,"guildchangenotice"},
- {clif_parse_GuildInvite,"guildinvite"},
- {clif_parse_GuildReplyInvite,"guildreplyinvite"},
- {clif_parse_GuildLeave,"guildleave"},
- {clif_parse_GuildExplusion,"guildexplusion"},
- {clif_parse_GuildMessage,"guildmessage"},
- {clif_parse_GuildRequestAlliance,"guildrequestalliance"},
- {clif_parse_GuildReplyAlliance,"guildreplyalliance"},
- {clif_parse_GuildDelAlliance,"guilddelalliance"},
- {clif_parse_GuildOpposition,"guildopposition"},
- {clif_parse_GuildBreak,"guildbreak"},
- {clif_parse_PetMenu,"petmenu"},
- {clif_parse_CatchPet,"catchpet"},
- {clif_parse_SelectEgg,"selectegg"},
- {clif_parse_SendEmotion,"sendemotion"},
- {clif_parse_ChangePetName,"changepetname"},
- {clif_parse_GMKick,"gmkick"},
- {clif_parse_GMHide,"gmhide"},
- {clif_parse_GMReqNoChat,"gmreqnochat"},
- {clif_parse_GMReqNoChatCount,"gmreqnochatcount"},
- {clif_parse_sn_doridori,"sndoridori"},
- {clif_parse_sn_explosionspirits,"snexplosionspirits"},
- {clif_parse_wisexin,"wisexin"},
- {clif_parse_wisexlist,"wisexlist"},
- {clif_parse_wisall,"wisall"},
- {clif_parse_GMkillall,"killall"},
- {clif_parse_GMsummon,"summon"},
- {clif_parse_GMshift,"shift"},
- {clif_parse_debug,"debug"},
-
- {NULL,NULL}
-};
-
-/*==========================================
* map鯖のip設定
*------------------------------------------
*/
-void clif_setip(char *ip)
+void clif_setip(char *ip)
{
- memcpy(map_ip_str,ip,16);
- map_ip=inet_addr(map_ip_str);
+ memcpy(map_ip_str, ip, 16);
+ map_ip = inet_addr(map_ip_str);
}
/*==========================================
* map鯖のport設定
*------------------------------------------
*/
-void clif_setport(int port)
+void clif_setport(int port)
{
- map_port=port;
+ map_port = port;
}
/*==========================================
* map鯖のip読み出し
*------------------------------------------
*/
-in_addr_t clif_getip(void)
+in_addr_t clif_getip(void)
{
return map_ip;
}
@@ -365,7 +178,7 @@ in_addr_t clif_getip(void)
* map鯖のport読み出し
*------------------------------------------
*/
-int clif_getport(void)
+int clif_getport(void)
{
return map_port;
}
@@ -374,14 +187,14 @@ int clif_getport(void)
*
*------------------------------------------
*/
-int clif_countusers(void)
+int clif_countusers(void)
{
- int users=0,i;
+ int users = 0, i;
struct map_session_data *sd;
- for(i=0;i<fd_max;i++){
- if(session[i] && (sd=session[i]->session_data) && sd->state.auth
- && !(battle_config.hide_GM_session && pc_isGM(sd)) )
+ for(i = 0; i < fd_max; i++) {
+ if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth &&
+ !(battle_config.hide_GM_session && pc_isGM(sd)))
users++;
}
return users;
@@ -391,16 +204,16 @@ int clif_countusers(void)
* 全てのclientに対してfunc()実行
*------------------------------------------
*/
-int clif_foreachclient(int (*func)(struct map_session_data*,va_list),...)
+int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...)
{
int i;
va_list ap;
struct map_session_data *sd;
va_start(ap,func);
- for(i=0;i<fd_max;i++){
- if(session[i] && (sd=session[i]->session_data) && sd->state.auth)
- func(sd,ap);
+ for(i = 0; i < fd_max; i++) {
+ if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth)
+ func(sd, ap);
}
va_end(ap);
return 0;
@@ -410,7 +223,7 @@ int clif_foreachclient(int (*func)(struct map_session_data*,va_list),...)
* clif_sendでAREA*指定時用
*------------------------------------------
*/
-int clif_send_sub(struct block_list *bl,va_list ap)
+int clif_send_sub(struct block_list *bl, va_list ap)
{
unsigned char *buf;
int len;
@@ -420,20 +233,20 @@ int clif_send_sub(struct block_list *bl,va_list ap)
nullpo_retr(0, bl);
nullpo_retr(0, ap);
- nullpo_retr(0, sd=(struct map_session_data *)bl);
+ nullpo_retr(0, sd = (struct map_session_data *)bl);
- buf=va_arg(ap,unsigned char*);
- len=va_arg(ap,int);
- nullpo_retr(0, src_bl=va_arg(ap,struct block_list*));
- type=va_arg(ap,int);
+ buf = va_arg(ap,unsigned char*);
+ len = va_arg(ap,int);
+ nullpo_retr(0, src_bl = va_arg(ap,struct block_list*));
+ type = va_arg(ap,int);
- switch(type){
+ switch(type) {
case AREA_WOS:
- if(bl && bl==src_bl)
+ if (bl && bl == src_bl)
return 0;
break;
case AREA_WOC:
- if(sd->chatID || bl==src_bl)
+ if ((sd && sd->chatID) || (bl && bl == src_bl))
return 0;
break;
case AREA_WOSC:
@@ -449,8 +262,10 @@ int clif_send_sub(struct block_list *bl,va_list ap)
printf(" Please correct your code.\n");
// don't send to not move the pointer of the packet for next sessions in the loop
} else {
- memcpy(WFIFOP(sd->fd,0), buf, len);
- WFIFOSET(sd->fd,len);
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+ }
}
}
@@ -461,34 +276,36 @@ int clif_send_sub(struct block_list *bl,va_list ap)
*
*------------------------------------------
*/
-int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
-{
+int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) {
int i;
struct map_session_data *sd;
struct chat_data *cd;
- struct party *p=NULL;
- struct guild *g=NULL;
- int x0=0,x1=0,y0=0,y1=0;
+ struct party *p = NULL;
+ struct guild *g = NULL;
+ int x0 = 0, x1 = 0, y0 = 0, y1 = 0;
- if( type != ALL_CLIENT ){
+ if (type != ALL_CLIENT) {
nullpo_retr(0, bl);
}
- switch(type){
- case ALL_CLIENT: // 全クライアントに送信
- for(i=0;i<fd_max;i++){
- if(session[i] && (sd=session[i]->session_data) && sd->state.auth){
- memcpy(WFIFOP(i,0),buf,len);
- WFIFOSET(i,len);
+ switch(type) {
+ case ALL_CLIENT: // 全クライアントに送信
+ for(i = 0; i < fd_max; i++) {
+ if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth) {
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(i,0), buf, len);
+ WFIFOSET(i,len);
+ }
}
}
break;
- case ALL_SAMEMAP: // 同じマップの全クライアントに送信
- for(i=0;i<fd_max;i++){
- if(session[i] && (sd=session[i]->session_data) && sd->state.auth &&
- sd->bl.m == bl->m){
- memcpy(WFIFOP(i,0),buf,len);
- WFIFOSET(i,len);
+ case ALL_SAMEMAP: // 同じマップの全クライアントに送信
+ for(i = 0; i < fd_max; i++) {
+ if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m) {
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(i,0), buf, len);
+ WFIFOSET(i,len);
+ }
}
}
break;
@@ -496,41 +313,44 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
case AREA_WOS:
case AREA_WOC:
case AREA_WOSC:
- map_foreachinarea(clif_send_sub,bl->m,bl->x-AREA_SIZE,bl->y-AREA_SIZE,bl->x+AREA_SIZE,bl->y+AREA_SIZE,BL_PC,buf,len,bl,type);
+ map_foreachinarea(clif_send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, BL_PC, buf, len, bl, type);
break;
case AREA_CHAT_WOC:
- map_foreachinarea(clif_send_sub,bl->m,bl->x-(AREA_SIZE-5),bl->y-(AREA_SIZE-5),bl->x+(AREA_SIZE-5),bl->y+(AREA_SIZE-5),BL_PC,buf,len,bl,AREA_WOC);
+ map_foreachinarea(clif_send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC);
break;
case CHAT:
case CHAT_WOS:
- cd=(struct chat_data*)bl;
- if(bl->type==BL_PC){
- sd=(struct map_session_data*)bl;
- cd=(struct chat_data*)map_id2bl(sd->chatID);
- } else if(bl->type!=BL_CHAT)
+ cd = (struct chat_data*)bl;
+ if (bl->type == BL_PC) {
+ sd = (struct map_session_data*)bl;
+ cd = (struct chat_data*)map_id2bl(sd->chatID);
+ } else if (bl->type != BL_CHAT)
break;
- if(cd==NULL)
+ if (cd == NULL)
break;
- for(i=0;i<cd->users;i++){
- if(type==CHAT_WOS && cd->usersd[i]==(struct map_session_data*)bl)
+ for(i = 0; i < cd->users; i++) {
+ if (type == CHAT_WOS && cd->usersd[i] == (struct map_session_data*)bl)
continue;
- memcpy(WFIFOP(cd->usersd[i]->fd,0),buf,len);
- WFIFOSET(cd->usersd[i]->fd,len);
+ if (packet_size_table[cd->usersd[i]->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ if (cd->usersd[i]->fd >=0 && session[cd->usersd[i]->fd]) // Added check to see if session exists [PoW]
+ memcpy(WFIFOP(cd->usersd[i]->fd,0), buf, len);
+ WFIFOSET(cd->usersd[i]->fd,len);
+ }
}
break;
case PARTY_AREA: // 同じ画面内の全パーティーメンバに送信
case PARTY_AREA_WOS: // 自分以外の同じ画面内の全パーティーメンバに送信
- x0=bl->x-AREA_SIZE;
- y0=bl->y-AREA_SIZE;
- x1=bl->x+AREA_SIZE;
- y1=bl->y+AREA_SIZE;
+ x0 = bl->x - AREA_SIZE;
+ y0 = bl->y - AREA_SIZE;
+ x1 = bl->x + AREA_SIZE;
+ y1 = bl->y + AREA_SIZE;
case PARTY: // 全パーティーメンバに送信
case PARTY_WOS: // 自分以外の全パーティーメンバに送信
case PARTY_SAMEMAP: // 同じマップの全パーティーメンバに送信
case PARTY_SAMEMAP_WOS: // 自分以外の同じマップの全パーティーメンバに送信
if (bl->type == BL_PC) {
- sd=(struct map_session_data *)bl;
+ sd = (struct map_session_data *)bl;
if (sd->partyspy > 0) {
p = party_search(sd->partyspy);
} else {
@@ -550,8 +370,10 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
(sd->bl.x < x0 || sd->bl.y < y0 ||
sd->bl.x > x1 || sd->bl.y > y1))
continue;
- memcpy(WFIFOP(sd->fd,0), buf, len);
- WFIFOSET(sd->fd,len);
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+ }
// if(battle_config.etc_log)
// printf("send party %d %d %d\n",p->party_id,i,flag)
@@ -560,17 +382,21 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
for (i = 0; i < fd_max; i++){
if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth) {
if (sd->partyspy == p->party_id) {
- memcpy(WFIFOP(sd->fd,0), buf, len);
- WFIFOSET(sd->fd,len);
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+ }
}
}
}
}
break;
case SELF:
- sd=(struct map_session_data *)bl;
- memcpy(WFIFOP(sd->fd,0),buf,len);
- WFIFOSET(sd->fd,len);
+ sd = (struct map_session_data *)bl;
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+ }
break;
/* New definitions for guilds [Valaris] */
@@ -584,7 +410,7 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
case GUILD:
case GUILD_WOS:
if (bl && bl->type == BL_PC) { // guildspy [Syrus22]
- sd=(struct map_session_data *)bl;
+ sd = (struct map_session_data *)bl;
if (sd->guildspy > 0) {
g = guild_search(sd->guildspy);
} else {
@@ -592,20 +418,24 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
g = guild_search(sd->status.guild_id);
}
}
- if(g){
- for(i=0;i<g->max_member;i++){
- if((sd=g->member[i].sd)!=NULL){
- if(type==GUILD_WOS && sd->bl.id==bl->id)
+ if (g) {
+ for(i = 0; i < g->max_member; i++) {
+ if ((sd = g->member[i].sd) != NULL) {
+ if (type == GUILD_WOS && sd->bl.id == bl->id)
continue;
- memcpy(WFIFOP(sd->fd,0),buf,len);
- WFIFOSET(sd->fd,len);
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+ }
}
}
for (i = 0; i < fd_max; i++){
if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth) {
if (sd->guildspy == g->guild_id) {
- memcpy(WFIFOP(sd->fd,0), buf, len);
- WFIFOSET(sd->fd,len);
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+ }
}
}
}
@@ -630,8 +460,10 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
(sd->bl.x < x0 || sd->bl.y < y0 ||
sd->bl.x > x1 || sd->bl.y > y1))
continue;
- memcpy(WFIFOP(sd->fd,0), buf, len);
- WFIFOSET(sd->fd,len);
+ if (packet_size_table[sd->packet_ver-5][RBUFW(buf,0)]) { // packet must exist for the client version
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+ }
}
}
}
@@ -639,7 +471,7 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
/* End [Valaris] */
default:
- if(battle_config.error_log)
+ if (battle_config.error_log)
printf("clif_send まだ作ってないよー\n");
return -1;
}
@@ -654,8 +486,7 @@ int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
*
*------------------------------------------
*/
-int clif_authok(struct map_session_data *sd)
-{
+int clif_authok(struct map_session_data *sd) {
int fd;
nullpo_retr(0, sd);
@@ -673,7 +504,7 @@ int clif_authok(struct map_session_data *sd)
WFIFOPOS(fd, 6, sd->bl.x, sd->bl.y);
WFIFOB(fd, 9) = 5;
WFIFOB(fd,10) = 5;
- WFIFOSET(fd,packet_db[0x73].len);
+ WFIFOSET(fd,packet_len_table[0x73]);
return 0;
}
@@ -688,7 +519,7 @@ int clif_authfail_fd(int fd, int type) {
WFIFOW(fd,0) = 0x81;
WFIFOL(fd,2) = type;
- WFIFOSET(fd,packet_db[0x81].len);
+ WFIFOSET(fd,packet_len_table[0x81]);
clif_setwaitclose(fd);
@@ -699,12 +530,11 @@ int clif_authfail_fd(int fd, int type) {
*
*------------------------------------------
*/
-int clif_charselectok(int id)
-{
+int clif_charselectok(int id) {
struct map_session_data *sd;
int fd;
- if((sd=map_id2sd(id))==NULL)
+ if ((sd = map_id2sd(id)) == NULL)
return 1;
if (!sd->fd)
@@ -713,7 +543,7 @@ int clif_charselectok(int id)
fd = sd->fd;
WFIFOW(fd,0) = 0xb3;
WFIFOB(fd,2) = 1;
- WFIFOSET(fd,packet_db[0xb3].len);
+ WFIFOSET(fd,packet_len_table[0xb3]);
return 0;
}
@@ -722,43 +552,41 @@ int clif_charselectok(int id)
*
*------------------------------------------
*/
-static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf)
-{
+static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf) {
int view;
nullpo_retr(0, fitem);
//009e <ID>.l <name ID>.w <identify flag>.B <X>.w <Y>.w <subX>.B <subY>.B <amount>.w
- WBUFW(buf,0)=0x9e;
- WBUFL(buf,2)=fitem->bl.id;
- if((view = itemdb_viewid(fitem->item_data.nameid)) > 0)
- WBUFW(buf,6)=view;
+ WBUFW(buf, 0) = 0x9e;
+ WBUFL(buf, 2) = fitem->bl.id;
+ if ((view = itemdb_viewid(fitem->item_data.nameid)) > 0)
+ WBUFW(buf, 6) = view;
else
- WBUFW(buf,6)=fitem->item_data.nameid;
- WBUFB(buf,8)=fitem->item_data.identify;
- WBUFW(buf,9)=fitem->bl.x;
- WBUFW(buf,11)=fitem->bl.y;
- WBUFB(buf,13)=fitem->subx;
- WBUFB(buf,14)=fitem->suby;
- WBUFW(buf,15)=fitem->item_data.amount;
+ WBUFW(buf, 6) = fitem->item_data.nameid;
+ WBUFB(buf, 8) = fitem->item_data.identify;
+ WBUFW(buf, 9) = fitem->bl.x;
+ WBUFW(buf,11) = fitem->bl.y;
+ WBUFB(buf,13) = fitem->subx;
+ WBUFB(buf,14) = fitem->suby;
+ WBUFW(buf,15) = fitem->item_data.amount;
- return packet_db[0x9e].len;
+ return packet_len_table[0x9e];
}
/*==========================================
*
*------------------------------------------
*/
-int clif_dropflooritem(struct flooritem_data *fitem)
-{
+int clif_dropflooritem(struct flooritem_data *fitem) {
char buf[64];
nullpo_retr(0, fitem);
- if(fitem->item_data.nameid <= 0)
+ if (fitem->item_data.nameid <= 0)
return 0;
- clif_set009e(fitem,buf);
- clif_send(buf,packet_db[0x9e].len,&fitem->bl,AREA);
+ clif_set009e(fitem, buf);
+ clif_send(buf, packet_len_table[0x9e], &fitem->bl, AREA);
return 0;
}
@@ -767,8 +595,7 @@ int clif_dropflooritem(struct flooritem_data *fitem)
*
*------------------------------------------
*/
-int clif_clearflooritem(struct flooritem_data *fitem,int fd)
-{
+int clif_clearflooritem(struct flooritem_data *fitem, int fd) {
unsigned char buf[16];
nullpo_retr(0, fitem);
@@ -776,11 +603,11 @@ int clif_clearflooritem(struct flooritem_data *fitem,int fd)
WBUFW(buf,0) = 0xa1;
WBUFL(buf,2) = fitem->bl.id;
- if(fd==0){
- clif_send(buf,packet_db[0xa1].len,&fitem->bl,AREA);
+ if (fd == 0) {
+ clif_send(buf, packet_len_table[0xa1], &fitem->bl, AREA);
} else {
- memcpy(WFIFOP(fd,0),buf,6);
- WFIFOSET(fd,packet_db[0xa1].len);
+ memcpy(WFIFOP(fd,0), buf, 6);
+ WFIFOSET(fd,packet_len_table[0xa1]);
}
return 0;
@@ -790,8 +617,7 @@ int clif_clearflooritem(struct flooritem_data *fitem,int fd)
*
*------------------------------------------
*/
-int clif_clearchar(struct block_list *bl,int type)
-{
+int clif_clearchar(struct block_list *bl, int type) {
unsigned char buf[16];
nullpo_retr(0, bl);
@@ -800,17 +626,16 @@ int clif_clearchar(struct block_list *bl,int type)
WBUFL(buf,2) = bl->id;
if (type == 9) {
WBUFB(buf,6) = 0;
- clif_send(buf, packet_db[0x80].len, bl, AREA);
+ clif_send(buf, packet_len_table[0x80], bl, AREA);
} else {
WBUFB(buf,6) = type;
- clif_send(buf, packet_db[0x80].len, bl, type == 1 ? AREA : AREA_WOS);
+ clif_send(buf, packet_len_table[0x80], bl, type == 1 ? AREA : AREA_WOS);
}
return 0;
}
-static int clif_clearchar_delay_sub(int tid,unsigned int tick,int id,int data)
-{
+static int clif_clearchar_delay_sub(int tid, unsigned int tick, int id, int data) {
struct block_list *bl = (struct block_list *)id;
clif_clearchar(bl,data);
@@ -820,11 +645,10 @@ static int clif_clearchar_delay_sub(int tid,unsigned int tick,int id,int data)
}
int clif_clearchar_delay(unsigned int tick, struct block_list *bl, int type) {
- struct block_list *tmpbl=(struct block_list *)aCalloc(1,sizeof(struct block_list));
- if (tmpbl == NULL) {
- printf("clif_clearchar_delay: out of memory !\n");
- exit(1);
- }
+ struct block_list *tmpbl;
+
+ tmpbl = (struct block_list*)aCalloc(1, sizeof(struct block_list));
+
memcpy(tmpbl, bl, sizeof(struct block_list));
add_timer(tick, clif_clearchar_delay_sub, (int)tmpbl, type);
@@ -835,15 +659,14 @@ int clif_clearchar_delay(unsigned int tick, struct block_list *bl, int type) {
*
*------------------------------------------
*/
-int clif_clearchar_id(int id,int type,int fd)
-{
+int clif_clearchar_id(int id, int type, int fd) {
unsigned char buf[16];
WBUFW(buf,0) = 0x80;
WBUFL(buf,2) = id;
WBUFB(buf,6) = type;
- memcpy(WFIFOP(fd,0),buf,7);
- WFIFOSET(fd,packet_db[0x80].len);
+ memcpy(WFIFOP(fd,0), buf, 7);
+ WFIFOSET(fd, packet_len_table[0x80]);
return 0;
}
@@ -853,11 +676,12 @@ int clif_clearchar_id(int id,int type,int fd)
*------------------------------------------
*/
static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
- int level=0;
+ int level;
nullpo_retr(0, sd);
if (sd->disguise > 23 && sd->disguise < 4001) { // mob disguises [Valaris]
+
WBUFW(buf,0) = 0x78;
WBUFL(buf,2) = sd->bl.id;
WBUFW(buf,6) = battle_get_speed(&sd->bl);
@@ -874,20 +698,20 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
WBUFB(buf,51) = 0;
WBUFW(buf,52) = ((level = battle_get_lv(&sd->bl)) > battle_config.max_lv) ? battle_config.max_lv : level;
- return packet_db[0x78].len;
+ return packet_len_table[0x78];
}
#if PACKETVER < 4
- WBUFW(buf,0)=0x78;
- WBUFL(buf,2)=sd->bl.id;
- WBUFW(buf,6)=sd->speed;
- WBUFW(buf,8)=sd->opt1;
- WBUFW(buf,10)=sd->opt2;
- WBUFW(buf,12)=sd->status.option;
- WBUFW(buf,14)=sd->view_class;
- WBUFW(buf,16)=sd->status.hair;
- if(sd->view_class != 22)
- WBUFW(buf,18)=sd->status.weapon;
+ WBUFW(buf,0)= 0x78;
+ WBUFL(buf,2)= sd->bl.id;
+ WBUFW(buf,6)= sd->speed;
+ WBUFW(buf,8)= sd->opt1;
+ WBUFW(buf,10)= sd->opt2;
+ WBUFW(buf,12)= sd->status.option;
+ WBUFW(buf,14)= sd->view_class;
+ WBUFW(buf,16)= sd->status.hair;
+ if (sd->view_class != 22)
+ WBUFW(buf,18) = sd->status.weapon;
else
WBUFW(buf,18)=0;
WBUFW(buf,20)=sd->status.head_bottom;
@@ -909,50 +733,50 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
WBUFB(buf,51)=sd->state.dead_sit;
WBUFW(buf,52)=(sd->status.base_level>battle_config.max_lv)?battle_config.max_lv:sd->status.base_level;
- return packet_db[0x78].len;
+ return packet_len_table[0x78];
#else
- WBUFW(buf,0)=0x1d8;
- WBUFL(buf,2)=sd->bl.id;
- WBUFW(buf,6)=sd->speed;
- WBUFW(buf,8)=sd->opt1;
- WBUFW(buf,10)=sd->opt2;
- WBUFW(buf,12)=sd->status.option;
- WBUFW(buf,14)=sd->view_class;
- WBUFW(buf,16)=sd->status.hair;
- if(sd->equip_index[9] >= 0 && sd->inventory_data[sd->equip_index[9]] && sd->view_class != 22) {
- if(sd->inventory_data[sd->equip_index[9]]->view_id > 0)
- WBUFW(buf,18)=sd->inventory_data[sd->equip_index[9]]->view_id;
+ WBUFW(buf,0) = 0x1d8;
+ WBUFL(buf,2) = sd->bl.id;
+ WBUFW(buf,6) = sd->speed;
+ WBUFW(buf,8) = sd->opt1;
+ WBUFW(buf,10) = sd->opt2;
+ WBUFW(buf,12) = sd->status.option;
+ WBUFW(buf,14) = sd->view_class;
+ WBUFW(buf,16) = sd->status.hair;
+ if (sd->equip_index[9] >= 0 && sd->inventory_data[sd->equip_index[9]] && sd->view_class != 22) {
+ if (sd->inventory_data[sd->equip_index[9]]->view_id > 0)
+ WBUFW(buf,18) = sd->inventory_data[sd->equip_index[9]]->view_id;
else
- WBUFW(buf,18)=sd->status.inventory[sd->equip_index[9]].nameid;
+ WBUFW(buf,18) = sd->status.inventory[sd->equip_index[9]].nameid;
} else
WBUFW(buf,18) = 0;
if (sd->equip_index[8] >= 0 && sd->equip_index[8] != sd->equip_index[9] && sd->inventory_data[sd->equip_index[8]] && sd->view_class != 22) {
if (sd->inventory_data[sd->equip_index[8]]->view_id > 0)
WBUFW(buf,20) = sd->inventory_data[sd->equip_index[8]]->view_id;
else
- WBUFW(buf,20)=sd->status.inventory[sd->equip_index[8]].nameid;
+ WBUFW(buf,20) = sd->status.inventory[sd->equip_index[8]].nameid;
} else
WBUFW(buf,20) = 0;
- WBUFW(buf,22)=sd->status.head_bottom;
- WBUFW(buf,24)=sd->status.head_top;
- WBUFW(buf,26)=sd->status.head_mid;
- WBUFW(buf,28)=sd->status.hair_color;
- WBUFW(buf,30)=sd->status.clothes_color;
- WBUFW(buf,32)=sd->head_dir;
- WBUFL(buf,34)=sd->status.guild_id;
- WBUFW(buf,38)=sd->guild_emblem_id;
- WBUFW(buf,40)=sd->status.manner;
+ WBUFW(buf,22) = sd->status.head_bottom;
+ WBUFW(buf,24) = sd->status.head_top;
+ WBUFW(buf,26) = sd->status.head_mid;
+ WBUFW(buf,28) = sd->status.hair_color;
+ WBUFW(buf,30) = sd->status.clothes_color;
+ WBUFW(buf,32) = sd->head_dir;
+ WBUFL(buf,34) = sd->status.guild_id;
+ WBUFW(buf,38) = sd->guild_emblem_id;
+ WBUFW(buf,40) = sd->status.manner;
WBUFW(buf,42)=sd->opt3;
- WBUFB(buf,44)=sd->status.karma;
- WBUFB(buf,45)=sd->sex;
- WBUFPOS(buf,46,sd->bl.x,sd->bl.y);
- WBUFB(buf,48)|=sd->dir&0x0f;
- WBUFB(buf,49)=5;
- WBUFB(buf,50)=5;
- WBUFB(buf,51)=sd->state.dead_sit;
- WBUFW(buf,52)=((level = battle_get_lv(&sd->bl)) > battle_config.max_lv) ? battle_config.max_lv : level;
-
- return packet_db[0x1d8].len;
+ WBUFB(buf,44) = sd->status.karma;
+ WBUFB(buf,45) = sd->sex;
+ WBUFPOS(buf, 46, sd->bl.x, sd->bl.y);
+ WBUFB(buf,48) |= sd->dir & 0x0f;
+ WBUFB(buf,49) = 5;
+ WBUFB(buf,50) = 5;
+ WBUFB(buf,51) = sd->state.dead_sit;
+ WBUFW(buf,52) = ((level = battle_get_lv(&sd->bl)) > battle_config.max_lv) ? battle_config.max_lv : level;
+
+ return packet_len_table[0x1d8];
#endif
}
@@ -961,11 +785,12 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
*------------------------------------------
*/
static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
- int level=0;
+ int level;
nullpo_retr(0, sd);
if (sd->disguise > 23 && sd->disguise < 4001) { // mob disguises [Valaris]
+
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=battle_get_speed(&sd->bl);
@@ -982,7 +807,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
WBUFB(buf,57)=5;
WBUFW(buf,58)=((level = battle_get_lv(&sd->bl))>battle_config.max_lv)? battle_config.max_lv:level;
- return packet_db[0x7b].len;
+ return packet_len_table[0x7b];
}
#if PACKETVER < 4
@@ -1017,7 +842,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
WBUFB(buf,57)=5;
WBUFW(buf,58)=(sd->status.base_level>battle_config.max_lv)?battle_config.max_lv:sd->status.base_level;
- return packet_db[0x7b].len;
+ return packet_len_table[0x7b];
#else
WBUFW(buf,0)=0x1da;
WBUFL(buf,2)=sd->bl.id;
@@ -1062,7 +887,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
WBUFB(buf,57)=5;
WBUFW(buf,58)=(sd->status.base_level>battle_config.max_lv)?battle_config.max_lv:sd->status.base_level;
- return packet_db[0x1da].len;
+ return packet_len_table[0x1da];
#endif
}
@@ -1082,7 +907,7 @@ int clif_class_change(struct block_list *bl,int class,int type)
WBUFB(buf,6)=type;
WBUFL(buf,7)=class;
- clif_send(buf,packet_db[0x1b0].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x1b0],bl,AREA);
}
return 0;
}
@@ -1102,7 +927,7 @@ int clif_mob_class_change(struct mob_data *md, int class) {
WBUFB(buf,6)=1;
WBUFL(buf,7)=view;
- clif_send(buf,packet_db[0x1b0].len,&md->bl,AREA);
+ clif_send(buf,packet_len_table[0x1b0],&md->bl,AREA);
}
return 0;
}
@@ -1113,14 +938,14 @@ int clif_mob_equip(struct mob_data *md, int nameid) {
nullpo_retr(0, md);
- memset(buf,0,packet_db[0x1a4].len);
+ memset(buf,0,packet_len_table[0x1a4]);
WBUFW(buf,0)=0x1a4;
WBUFB(buf,2)=3;
WBUFL(buf,3)=md->bl.id;
WBUFL(buf,7)=nameid;
- clif_send(buf,packet_db[0x1a4].len,&md->bl,AREA);
+ clif_send(buf,packet_len_table[0x1a4],&md->bl,AREA);
return 0;
}
@@ -1133,7 +958,7 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf)
{
int level;
- memset(buf,0,packet_db[0x78].len);
+ memset(buf,0,packet_len_table[0x78]);
nullpo_retr(0, md);
@@ -1175,18 +1000,17 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf)
WBUFB(buf,50)=5;
WBUFW(buf,52)=((level = battle_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level;
- return packet_db[0x78].len;
+ return packet_len_table[0x78];
}
/*==========================================
* MOB表示2
*------------------------------------------
*/
-static int clif_mob007b(struct mob_data *md,unsigned char *buf)
-{
+static int clif_mob007b(struct mob_data *md, unsigned char *buf) {
int level;
- memset(buf,0,packet_db[0x7b].len);
+ memset(buf,0,packet_len_table[0x7b]);
nullpo_retr(0, md);
@@ -1210,10 +1034,8 @@ static int clif_mob007b(struct mob_data *md,unsigned char *buf)
WBUFW(buf,34)=mob_get_clothes_color(md->class); //Add for player monster dye - Valaris
WBUFB(buf,49)=mob_get_sex(md->class);
} else
-
WBUFL(buf,22)=gettick();
-
if(md->class >= 1285 && md->class <= 1287 && md->guild_id) { // Added guardian emblems [Valaris]
struct guild *g;
struct guild_castle *gc=guild_mapname2gc(map[md->bl.m].name);
@@ -1223,39 +1045,33 @@ static int clif_mob007b(struct mob_data *md,unsigned char *buf)
WBUFL(buf,28)=gc->guild_id;
WBUFL(buf,24)=g->emblem_id;
}
-
}
+ } // End addition
- } // End addition
+ WBUFPOS2(buf,50,md->bl.x,md->bl.y,md->to_x,md->to_y);
+ WBUFB(buf,56)=5;
+ WBUFB(buf,57)=5;
+ WBUFW(buf,58)=((level = battle_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level;
- WBUFB(buf,56)=5;
- WBUFB(buf,57)=5;
- WBUFW(buf,58)=((level = battle_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level;
- return packet_db[0x7b].len;
+ return packet_len_table[0x7b];
}
/*==========================================
*
*------------------------------------------
*/
-static int clif_npc0078(struct npc_data *nd,unsigned char *buf)
-{
+static int clif_npc0078(struct npc_data *nd, unsigned char *buf) {
struct guild *g;
nullpo_retr(0, nd);
- memset(buf,0,packet_db[0x78].len);
+ memset(buf,0,packet_len_table[0x78]);
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=nd->bl.id;
WBUFW(buf,6)=nd->speed;
- WBUFW(buf,12)=nd->option;
WBUFW(buf,14)=nd->class;
- if( (nd->bl.subtype!=WARP) &&
- (nd->class == 722) &&
- (nd->u.scr.guild_id > 0) &&
- ((g=guild_search(nd->u.scr.guild_id))) )
- {
+ if ((nd->class == 722) && (nd->u.scr.guild_id > 0) && ((g=guild_search(nd->u.scr.guild_id)) != NULL)) {
WBUFL(buf,22)=g->emblem_id;
WBUFL(buf,26)=g->guild_id;
}
@@ -1264,7 +1080,7 @@ static int clif_npc0078(struct npc_data *nd,unsigned char *buf)
WBUFB(buf,49)=5;
WBUFB(buf,50)=5;
- return packet_db[0x78].len;
+ return packet_len_table[0x78];
}
// NPC Walking [Valaris]
@@ -1273,17 +1089,13 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) {
nullpo_retr(0, nd);
- memset(buf,0,packet_db[0x7b].len);
+ memset(buf,0,packet_len_table[0x7b]);
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=nd->bl.id;
WBUFW(buf,6)=nd->speed;
- WBUFW(buf,12)=nd->option;
WBUFW(buf,14)=nd->class;
- //if ((nd->class == 722) && (nd->u.scr.guild_id > 0) && ((g=guild_search(nd->u.scr.guild_id)) != NULL))
- if((nd->bl.subtype!=WARP) && (nd->class == 722) && (nd->u.scr.guild_id > 0) &&
-((g=guild_search(nd->u.scr.guild_id))))
- {
+ if ((nd->class == 722) && (nd->u.scr.guild_id > 0) && ((g=guild_search(nd->u.scr.guild_id)) != NULL)) {
WBUFL(buf,22)=g->emblem_id;
WBUFL(buf,26)=g->guild_id;
}
@@ -1293,21 +1105,19 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) {
WBUFB(buf,56)=5;
WBUFB(buf,57)=5;
- return packet_db[0x7b].len;
+ return packet_len_table[0x7b];
}
-
/*==========================================
*
*------------------------------------------
*/
-static int clif_pet0078(struct pet_data *pd,unsigned char *buf)
-{
+static int clif_pet0078(struct pet_data *pd, unsigned char *buf) {
int view,level;
nullpo_retr(0, pd);
- memset(buf,0,packet_db[0x78].len);
+ memset(buf,0,packet_len_table[0x78]);
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=pd->bl.id;
@@ -1337,20 +1147,19 @@ static int clif_pet0078(struct pet_data *pd,unsigned char *buf)
WBUFB(buf,50)=0;
WBUFW(buf,52)=((level = battle_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level;
- return packet_db[0x78].len;
+ return packet_len_table[0x78];
}
/*==========================================
*
*------------------------------------------
*/
-static int clif_pet007b(struct pet_data *pd,unsigned char *buf)
-{
+static int clif_pet007b(struct pet_data *pd, unsigned char *buf) {
int view,level;
nullpo_retr(0, pd);
- memset(buf,0,packet_db[0x7b].len);
+ memset(buf,0,packet_len_table[0x7b]);
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=pd->bl.id;
@@ -1370,7 +1179,7 @@ static int clif_pet007b(struct pet_data *pd,unsigned char *buf)
WBUFB(buf,49)=mob_get_sex(pd->class);
} else {
WBUFW(buf,16)=0x14;
- if((view = itemdb_viewid(pd->equip)) > 0)
+ if ((view = itemdb_viewid(pd->equip)) > 0)
WBUFW(buf,20)=view;
else
WBUFW(buf,20)=pd->equip;
@@ -1381,36 +1190,34 @@ static int clif_pet007b(struct pet_data *pd,unsigned char *buf)
WBUFB(buf,57)=0;
WBUFW(buf,58)=((level = battle_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level;
- return packet_db[0x7b].len;
+ return packet_len_table[0x7b];
}
/*==========================================
*
*------------------------------------------
*/
-static int clif_set01e1(struct map_session_data *sd,unsigned char *buf)
-{
+static int clif_set01e1(struct map_session_data *sd, unsigned char *buf) {
nullpo_retr(0, sd);
WBUFW(buf,0)=0x1e1;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=sd->spiritball;
- return packet_db[0x1e1].len;
+ return packet_len_table[0x1e1];
}
/*==========================================
*
*------------------------------------------
*/
-static int clif_set0192(int fd,int m,int x,int y,int type)
-{
+static int clif_set0192(int fd, int m, int x, int y, int type) {
WFIFOW(fd,0) = 0x192;
WFIFOW(fd,2) = x;
WFIFOW(fd,4) = y;
WFIFOW(fd,6) = type;
memcpy(WFIFOP(fd,8),map[m].name,16);
- WFIFOSET(fd,packet_db[0x192].len);
+ WFIFOSET(fd,packet_len_table[0x192]);
return 0;
}
@@ -1427,7 +1234,7 @@ int clif_spawnpc(struct map_session_data *sd) {
if (sd->disguise > 23 && sd->disguise < 4001) { // mob disguises [Valaris]
clif_clearchar(&sd->bl, 9);
- memset(buf, 0, packet_db[0x119].len);
+ memset(buf, 0, packet_len_table[0x119]);
WBUFW(buf, 0) = 0x119;
WBUFL(buf, 2) = sd->bl.id;
@@ -1436,9 +1243,9 @@ int clif_spawnpc(struct map_session_data *sd) {
WBUFW(buf,10) = 0x40;
WBUFB(buf,12) = 0;
- clif_send(buf, packet_db[0x119].len, &sd->bl, SELF);
+ clif_send(buf, packet_len_table[0x119], &sd->bl, SELF);
- memset(buf, 0, packet_db[0x7c].len);
+ memset(buf, 0, packet_len_table[0x7c]);
WBUFW(buf, 0) = 0x7c;
WBUFL(buf, 2) = sd->bl.id;
@@ -1448,7 +1255,7 @@ int clif_spawnpc(struct map_session_data *sd) {
WBUFW(buf,12) = sd->status.option;
WBUFW(buf,20) = sd->disguise;
WBUFPOS(buf, 36, sd->bl.x, sd->bl.y);
- clif_send(buf, packet_db[0x7c].len, &sd->bl, AREA);
+ clif_send(buf, packet_len_table[0x7c], &sd->bl, AREA);
}
clif_set0078(sd, buf);
@@ -1456,11 +1263,11 @@ int clif_spawnpc(struct map_session_data *sd) {
#if PACKETVER < 4
WBUFW(buf, 0) = 0x79;
WBUFW(buf,51) = (sd->status.base_level > battle_config.max_lv) ? battle_config.max_lv : sd->status.base_level;
- clif_send(buf, packet_db[0x79].len, &sd->bl, AREA_WOS);
+ clif_send(buf, packet_len_table[0x79], &sd->bl, AREA_WOS);
#else
WBUFW(buf, 0) = 0x1d9;
WBUFW(buf,51) = (sd->status.base_level > battle_config.max_lv) ? battle_config.max_lv : sd->status.base_level;
- clif_send(buf, packet_db[0x1d9].len, &sd->bl, AREA_WOS);
+ clif_send(buf, packet_len_table[0x1d9], &sd->bl, AREA_WOS);
#endif
@@ -1506,19 +1313,18 @@ int clif_spawnnpc(struct npc_data *nd)
nullpo_retr(0, nd);
- if(nd->class < 0 || (nd->flag&1 && nd->option != 0x0002) || nd->class == INVISIBLE_CLASS)
+ if(nd->class < 0 || nd->flag&1 || nd->class == INVISIBLE_CLASS)
return 0;
- memset(buf,0,packet_db[0x7c].len);
+ memset(buf,0,packet_len_table[0x7c]);
WBUFW(buf,0)=0x7c;
WBUFL(buf,2)=nd->bl.id;
WBUFW(buf,6)=nd->speed;
- WBUFW(buf,12)=nd->option;
WBUFW(buf,20)=nd->class;
WBUFPOS(buf,36,nd->bl.x,nd->bl.y);
- clif_send(buf,packet_db[0x7c].len,&nd->bl,AREA);
+ clif_send(buf,packet_len_table[0x7c],&nd->bl,AREA);
len = clif_npc0078(nd,buf);
clif_send(buf,len,&nd->bl,AREA);
@@ -1538,7 +1344,7 @@ int clif_spawnmob(struct mob_data *md)
nullpo_retr(0, md);
if (mob_get_viewclass(md->class) > 23 ) {
- memset(buf,0,packet_db[0x7c].len);
+ memset(buf,0,packet_len_table[0x7c]);
WBUFW(buf,0)=0x7c;
WBUFL(buf,2)=md->bl.id;
@@ -1548,7 +1354,7 @@ int clif_spawnmob(struct mob_data *md)
WBUFW(buf,12)=md->option;
WBUFW(buf,20)=mob_get_viewclass(md->class);
WBUFPOS(buf,36,md->bl.x,md->bl.y);
- clif_send(buf,packet_db[0x7c].len,&md->bl,AREA);
+ clif_send(buf,packet_len_table[0x7c],&md->bl,AREA);
}
len = clif_mob0078(md,buf);
@@ -1573,8 +1379,8 @@ int clif_spawnpet(struct pet_data *pd)
nullpo_retr(0, pd);
- if(mob_get_viewclass(pd->class) >= MAX_PC_CLASS) {
- memset(buf,0,packet_db[0x7c].len);
+ if (mob_get_viewclass(pd->class) >= MAX_PC_CLASS) {
+ memset(buf,0,packet_len_table[0x7c]);
WBUFW(buf,0)=0x7c;
WBUFL(buf,2)=pd->bl.id;
@@ -1582,7 +1388,7 @@ int clif_spawnpet(struct pet_data *pd)
WBUFW(buf,20)=mob_get_viewclass(pd->class);
WBUFPOS(buf,36,pd->bl.x,pd->bl.y);
- clif_send(buf,packet_db[0x7c].len,&pd->bl,AREA);
+ clif_send(buf,packet_len_table[0x7c],&pd->bl,AREA);
}
len = clif_pet0078(pd,buf);
@@ -1595,8 +1401,7 @@ int clif_spawnpet(struct pet_data *pd)
*
*------------------------------------------
*/
-int clif_movepet(struct pet_data *pd)
-{
+int clif_movepet(struct pet_data *pd) {
unsigned char buf[256];
int len;
@@ -1637,7 +1442,7 @@ int clif_servertick(struct map_session_data *sd)
fd=sd->fd;
WFIFOW(fd,0)=0x7f;
WFIFOL(fd,2)=sd->server_tick;
- WFIFOSET(fd,packet_db[0x7f].len);
+ WFIFOSET(fd,packet_len_table[0x7f]);
return 0;
}
@@ -1657,7 +1462,7 @@ int clif_walkok(struct map_session_data *sd)
WFIFOL(fd,2)=gettick();;
WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->to_x,sd->to_y);
WFIFOB(fd,11)=0;
- WFIFOSET(fd,packet_db[0x87].len);
+ WFIFOSET(fd,packet_len_table[0x87]);
return 0;
}
@@ -1666,8 +1471,7 @@ int clif_walkok(struct map_session_data *sd)
*
*------------------------------------------
*/
-int clif_movechar(struct map_session_data *sd)
-{
+int clif_movechar(struct map_session_data *sd) {
int fd;
int len;
unsigned char buf[256];
@@ -1697,7 +1501,6 @@ int clif_movechar(struct map_session_data *sd)
void clif_quitsave(int fd,struct map_session_data *sd)
{
map_quit(sd);
- chrif_chardisconnect(sd);
}
/*==========================================
@@ -1707,7 +1510,7 @@ void clif_quitsave(int fd,struct map_session_data *sd)
static int clif_waitclose(int tid, unsigned int tick, int id, int data) {
if (session[id])
session[id]->eof = 1;
- close(id);
+
return 0;
}
@@ -1716,26 +1519,32 @@ static int clif_waitclose(int tid, unsigned int tick, int id, int data) {
*------------------------------------------
*/
void clif_setwaitclose(int fd) {
- add_timer(gettick() + 5000, clif_waitclose, fd, 0);
+ struct map_session_data *sd;
+
+ // if player is not already in the game (double connection probably)
+ if ((sd = session[fd]->session_data) == NULL) {
+ // limited timer, just to send information.
+ add_timer(gettick() + 1000, clif_waitclose, fd, 0);
+ } else
+ add_timer(gettick() + 5000, clif_waitclose, fd, 0);
}
/*==========================================
*
*------------------------------------------
*/
-int clif_changemap(struct map_session_data *sd,char *mapname,int x,int y)
-{
+int clif_changemap(struct map_session_data *sd, char *mapname, int x, int y) {
int fd;
nullpo_retr(0, sd);
- fd=sd->fd;
+ fd = sd->fd;
- WFIFOW(fd,0)=0x91;
- memcpy(WFIFOP(fd,2),mapname,16);
- WFIFOW(fd,18)=x;
- WFIFOW(fd,20)=y;
- WFIFOSET(fd,packet_db[0x91].len);
+ WFIFOW(fd,0) = 0x91;
+ memcpy(WFIFOP(fd,2), mapname, 16);
+ WFIFOW(fd,18) = x;
+ WFIFOW(fd,20) = y;
+ WFIFOSET(fd, packet_len_table[0x91]);
if (sd->disguise > 23 && sd->disguise < 4001) // mob disguises [Valaris]
clif_spawnpc(sd);
@@ -1747,20 +1556,19 @@ int clif_changemap(struct map_session_data *sd,char *mapname,int x,int y)
*
*------------------------------------------
*/
-int clif_changemapserver(struct map_session_data *sd,char *mapname,int x,int y,int ip,int port)
-{
+int clif_changemapserver(struct map_session_data *sd, char *mapname, int x, int y, int ip, int port) {
int fd;
nullpo_retr(0, sd);
- fd=sd->fd;
- WFIFOW(fd,0)=0x92;
- memcpy(WFIFOP(fd,2),mapname,16);
- WFIFOW(fd,18)=x;
- WFIFOW(fd,20)=y;
- WFIFOL(fd,22)=ip;
- WFIFOW(fd,26)=port;
- WFIFOSET(fd,packet_db[0x92].len);
+ fd = sd->fd;
+ WFIFOW(fd,0) = 0x92;
+ memcpy(WFIFOP(fd,2), mapname, 16);
+ WFIFOW(fd,18) = x;
+ WFIFOW(fd,20) = y;
+ WFIFOL(fd,22) = ip;
+ WFIFOW(fd,26) = port;
+ WFIFOSET(fd, packet_len_table[0x92]);
return 0;
}
@@ -1769,8 +1577,7 @@ int clif_changemapserver(struct map_session_data *sd,char *mapname,int x,int y,i
*
*------------------------------------------
*/
-int clif_fixpos(struct block_list *bl)
-{
+int clif_fixpos(struct block_list *bl) {
char buf[16];
nullpo_retr(0, bl);
@@ -1780,7 +1587,7 @@ int clif_fixpos(struct block_list *bl)
WBUFW(buf,6)=bl->x;
WBUFW(buf,8)=bl->y;
- clif_send(buf,packet_db[0x88].len,bl,AREA);
+ clif_send(buf, packet_len_table[0x88], bl, AREA);
return 0;
}
@@ -1789,8 +1596,7 @@ int clif_fixpos(struct block_list *bl)
*
*------------------------------------------
*/
-int clif_npcbuysell(struct map_session_data* sd,int id)
-{
+int clif_npcbuysell(struct map_session_data* sd, int id) {
int fd;
nullpo_retr(0, sd);
@@ -1798,7 +1604,7 @@ int clif_npcbuysell(struct map_session_data* sd,int id)
fd=sd->fd;
WFIFOW(fd,0)=0xc4;
WFIFOL(fd,2)=id;
- WFIFOSET(fd,packet_db[0xc4].len);
+ WFIFOSET(fd,packet_len_table[0xc4]);
return 0;
}
@@ -1807,8 +1613,7 @@ int clif_npcbuysell(struct map_session_data* sd,int id)
*
*------------------------------------------
*/
-int clif_buylist(struct map_session_data *sd,struct npc_data *nd)
-{
+int clif_buylist(struct map_session_data *sd, struct npc_data *nd) {
struct item_data *id;
int fd,i,val;
@@ -1821,11 +1626,11 @@ int clif_buylist(struct map_session_data *sd,struct npc_data *nd)
id = itemdb_search(nd->u.shop_item[i].nameid);
val=nd->u.shop_item[i].value;
WFIFOL(fd,4+i*11)=val;
- if ( ! id->flag.value_notdc)
+ if (!id->flag.value_notdc)
val=pc_modifybuyvalue(sd,val);
WFIFOL(fd,8+i*11)=val;
WFIFOB(fd,12+i*11)=id->type;
- if(id->view_id > 0)
+ if (id->view_id > 0)
WFIFOW(fd,13+i*11)=id->view_id;
else
WFIFOW(fd,13+i*11)=nd->u.shop_item[i].nameid;
@@ -1840,8 +1645,7 @@ int clif_buylist(struct map_session_data *sd,struct npc_data *nd)
*
*------------------------------------------
*/
-int clif_selllist(struct map_session_data *sd)
-{
+int clif_selllist(struct map_session_data *sd) {
int fd,i,c=0,val;
nullpo_retr(0, sd);
@@ -1851,11 +1655,11 @@ int clif_selllist(struct map_session_data *sd)
for(i=0;i<MAX_INVENTORY;i++) {
if(sd->status.inventory[i].nameid > 0 && sd->inventory_data[i]) {
val=sd->inventory_data[i]->value_sell;
- if(val < 0)
+ if (val < 0)
continue;
WFIFOW(fd,4+c*10)=i+2;
WFIFOL(fd,6+c*10)=val;
- if ( !sd->inventory_data[i]->flag.value_notoc)
+ if (!sd->inventory_data[i]->flag.value_notoc)
val=pc_modifysellvalue(sd,val);
WFIFOL(fd,10+c*10)=val;
c++;
@@ -1871,8 +1675,7 @@ int clif_selllist(struct map_session_data *sd)
*
*------------------------------------------
*/
-int clif_scriptmes(struct map_session_data *sd,int npcid,char *mes)
-{
+int clif_scriptmes(struct map_session_data *sd, int npcid, char *mes) {
int fd;
nullpo_retr(0, sd);
@@ -1881,7 +1684,7 @@ int clif_scriptmes(struct map_session_data *sd,int npcid,char *mes)
WFIFOW(fd,0)=0xb4;
WFIFOW(fd,2)=strlen(mes)+9;
WFIFOL(fd,4)=npcid;
- strncpy(WFIFOP(fd,8),mes,strlen(mes)+1);
+ strcpy(WFIFOP(fd,8),mes);
WFIFOSET(fd,WFIFOW(fd,2));
return 0;
@@ -1891,8 +1694,7 @@ int clif_scriptmes(struct map_session_data *sd,int npcid,char *mes)
*
*------------------------------------------
*/
-int clif_scriptnext(struct map_session_data *sd,int npcid)
-{
+int clif_scriptnext(struct map_session_data *sd,int npcid) {
int fd;
nullpo_retr(0, sd);
@@ -1900,7 +1702,7 @@ int clif_scriptnext(struct map_session_data *sd,int npcid)
fd=sd->fd;
WFIFOW(fd,0)=0xb5;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_db[0xb5].len);
+ WFIFOSET(fd,packet_len_table[0xb5]);
return 0;
}
@@ -1909,8 +1711,7 @@ int clif_scriptnext(struct map_session_data *sd,int npcid)
*
*------------------------------------------
*/
-int clif_scriptclose(struct map_session_data *sd,int npcid)
-{
+int clif_scriptclose(struct map_session_data *sd, int npcid) {
int fd;
nullpo_retr(0, sd);
@@ -1918,7 +1719,7 @@ int clif_scriptclose(struct map_session_data *sd,int npcid)
fd=sd->fd;
WFIFOW(fd,0)=0xb6;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_db[0xb6].len);
+ WFIFOSET(fd,packet_len_table[0xb6]);
return 0;
}
@@ -1927,17 +1728,16 @@ int clif_scriptclose(struct map_session_data *sd,int npcid)
*
*------------------------------------------
*/
-int clif_scriptmenu(struct map_session_data *sd,int npcid,char *mes)
-{
+int clif_scriptmenu(struct map_session_data *sd, int npcid, char *mes) {
int fd;
nullpo_retr(0, sd);
fd=sd->fd;
WFIFOW(fd,0)=0xb7;
- WFIFOW(fd,2)=strlen(mes)+9;
+ WFIFOW(fd,2)=strlen(mes)+8;
WFIFOL(fd,4)=npcid;
- strncpy(WFIFOP(fd,8),mes,strlen(mes)+1);
+ strcpy(WFIFOP(fd,8),mes);
WFIFOSET(fd,WFIFOW(fd,2));
return 0;
@@ -1947,8 +1747,7 @@ int clif_scriptmenu(struct map_session_data *sd,int npcid,char *mes)
*
*------------------------------------------
*/
-int clif_scriptinput(struct map_session_data *sd,int npcid)
-{
+int clif_scriptinput(struct map_session_data *sd, int npcid) {
int fd;
nullpo_retr(0, sd);
@@ -1956,7 +1755,7 @@ int clif_scriptinput(struct map_session_data *sd,int npcid)
fd=sd->fd;
WFIFOW(fd,0)=0x142;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_db[0x142].len);
+ WFIFOSET(fd,packet_len_table[0x142]);
return 0;
}
@@ -1965,8 +1764,7 @@ int clif_scriptinput(struct map_session_data *sd,int npcid)
*
*------------------------------------------
*/
-int clif_scriptinputstr(struct map_session_data *sd,int npcid)
-{
+int clif_scriptinputstr(struct map_session_data *sd, int npcid) {
int fd;
nullpo_retr(0, sd);
@@ -1974,7 +1772,7 @@ int clif_scriptinputstr(struct map_session_data *sd,int npcid)
fd=sd->fd;
WFIFOW(fd,0)=0x1d4;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_db[0x1d4].len);
+ WFIFOSET(fd,packet_len_table[0x1d4]);
return 0;
}
@@ -1983,8 +1781,7 @@ int clif_scriptinputstr(struct map_session_data *sd,int npcid)
*
*------------------------------------------
*/
-int clif_viewpoint(struct map_session_data *sd,int npc_id,int type,int x,int y,int id,int color)
-{
+int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) {
int fd;
nullpo_retr(0, sd);
@@ -1997,7 +1794,7 @@ int clif_viewpoint(struct map_session_data *sd,int npc_id,int type,int x,int y,i
WFIFOL(fd,14)=y;
WFIFOB(fd,18)=id;
WFIFOL(fd,19)=color;
- WFIFOSET(fd,packet_db[0x144].len);
+ WFIFOSET(fd,packet_len_table[0x144]);
return 0;
}
@@ -2006,8 +1803,7 @@ int clif_viewpoint(struct map_session_data *sd,int npc_id,int type,int x,int y,i
*
*------------------------------------------
*/
-int clif_cutin(struct map_session_data *sd,char *image,int type)
-{
+int clif_cutin(struct map_session_data *sd, char *image, int type) {
int fd;
nullpo_retr(0, sd);
@@ -2016,7 +1812,7 @@ int clif_cutin(struct map_session_data *sd,char *image,int type)
WFIFOW(fd,0)=0x1b3;
memcpy(WFIFOP(fd,2),image,64);
WFIFOB(fd,66)=type;
- WFIFOSET(fd,packet_db[0x1b3].len);
+ WFIFOSET(fd,packet_len_table[0x1b3]);
return 0;
}
@@ -2025,8 +1821,7 @@ int clif_cutin(struct map_session_data *sd,char *image,int type)
*
*------------------------------------------
*/
-int clif_additem(struct map_session_data *sd,int n,int amount,int fail)
-{
+int clif_additem(struct map_session_data *sd, int n, int amount, int fail) {
int fd,j;
unsigned char *buf;
@@ -2056,7 +1851,7 @@ int clif_additem(struct map_session_data *sd,int n,int amount,int fail)
WBUFW(buf,0)=0xa0;
WBUFW(buf,2)=n+2;
WBUFW(buf,4)=amount;
- if(sd->inventory_data[n]->view_id > 0)
+ if (sd->inventory_data[n]->view_id > 0)
WBUFW(buf,6)=sd->inventory_data[n]->view_id;
else
WBUFW(buf,6)=sd->status.inventory[n].nameid;
@@ -2073,15 +1868,15 @@ int clif_additem(struct map_session_data *sd,int n,int amount,int fail)
WBUFW(buf,11)=j;
else
WBUFW(buf,11)=sd->status.inventory[n].card[0];
- if(sd->status.inventory[n].card[1] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[1])) > 0)
+ if (sd->status.inventory[n].card[1] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[1])) > 0)
WBUFW(buf,13)=j;
else
WBUFW(buf,13)=sd->status.inventory[n].card[1];
- if(sd->status.inventory[n].card[2] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[2])) > 0)
+ if (sd->status.inventory[n].card[2] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[2])) > 0)
WBUFW(buf,15)=j;
else
WBUFW(buf,15)=sd->status.inventory[n].card[2];
- if(sd->status.inventory[n].card[3] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[3])) > 0)
+ if (sd->status.inventory[n].card[3] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[3])) > 0)
WBUFW(buf,17)=j;
else
WBUFW(buf,17)=sd->status.inventory[n].card[3];
@@ -2091,7 +1886,7 @@ int clif_additem(struct map_session_data *sd,int n,int amount,int fail)
WBUFB(buf,22)=fail;
}
- WFIFOSET(fd,packet_db[0xa0].len);
+ WFIFOSET(fd,packet_len_table[0xa0]);
return 0;
}
@@ -2110,7 +1905,7 @@ int clif_delitem(struct map_session_data *sd,int n,int amount)
WFIFOW(fd,2)=n+2;
WFIFOW(fd,4)=amount;
- WFIFOSET(fd,packet_db[0xaf].len);
+ WFIFOSET(fd,packet_len_table[0xaf]);
return 0;
}
@@ -2131,17 +1926,17 @@ int clif_itemlist(struct map_session_data *sd)
#if PACKETVER < 5
WBUFW(buf,0)=0xa3;
for(i=0,n=0;i<MAX_INVENTORY;i++){
- if(sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL || itemdb_isequip2(sd->inventory_data[i]))
+ if (sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL || itemdb_isequip2(sd->inventory_data[i]))
continue;
WBUFW(buf,n*10+4)=i+2;
- if(sd->inventory_data[i]->view_id > 0)
+ if (sd->inventory_data[i]->view_id > 0)
WBUFW(buf,n*10+6)=sd->inventory_data[i]->view_id;
else
WBUFW(buf,n*10+6)=sd->status.inventory[i].nameid;
WBUFB(buf,n*10+8)=sd->inventory_data[i]->type;
WBUFB(buf,n*10+9)=sd->status.inventory[i].identify;
WBUFW(buf,n*10+10)=sd->status.inventory[i].amount;
- if(sd->inventory_data[i]->equip == 0x8000){
+ if (sd->inventory_data[i]->equip == 0x8000) {
WBUFW(buf,n*10+12)=0x8000;
if (sd->status.inventory[i].equip)
arrow=i; // ついでに矢装備チェック
@@ -2149,7 +1944,7 @@ int clif_itemlist(struct map_session_data *sd)
WBUFW(buf,n*10+12)=0;
n++;
}
- if(n){
+ if (n) {
WBUFW(buf,2)=4+n*10;
WFIFOSET(fd,WFIFOW(fd,2));
}
@@ -2166,7 +1961,7 @@ int clif_itemlist(struct map_session_data *sd)
WBUFB(buf,n*18+8)=sd->inventory_data[i]->type;
WBUFB(buf,n*18+9)=sd->status.inventory[i].identify;
WBUFW(buf,n*18+10)=sd->status.inventory[i].amount;
- if(sd->inventory_data[i]->equip == 0x8000){
+ if (sd->inventory_data[i]->equip == 0x8000) {
WBUFW(buf,n*18+12)=0x8000;
if(sd->status.inventory[i].equip)
arrow=i; // ついでに矢装備チェック
@@ -2178,7 +1973,7 @@ int clif_itemlist(struct map_session_data *sd)
WBUFW(buf,n*18+20)=sd->status.inventory[i].card[3];
n++;
}
- if(n){
+ if (n) {
WBUFW(buf,2)=4+n*18;
WFIFOSET(fd,WFIFOW(fd,2));
}
@@ -2618,7 +2413,7 @@ int clif_updatestatus(struct map_session_data *sd,int type)
WFIFOL(fd,4)=sd->matk2;
break;
- // 00b1 終了
+
case SP_ZENY:
WFIFOW(fd,0)=0xb1;
if(sd->status.zeny < 0)
@@ -2747,7 +2542,7 @@ int clif_changestatus(struct block_list *bl,int type,int val)
printf("clif_changestatus : make %d routine\n",type);
return 1;
}
- clif_send(buf,packet_db[0x1ab].len,bl,AREA_WOS);
+ clif_send(buf,packet_len_table[0x1ab],bl,AREA_WOS);
}
return 0;
}
@@ -2776,7 +2571,7 @@ int clif_changelook(struct block_list *bl,int type,int val)
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=type;
WBUFB(buf,7)=val;
- clif_send(buf,packet_db[0xc3].len,bl,AREA);
+ clif_send(buf,packet_len_table[0xc3],bl,AREA);
#else
if(sd && (type == LOOK_WEAPON || type == LOOK_SHIELD || type == LOOK_SHOES)) {
WBUFW(buf,0)=0x1d7;
@@ -2810,7 +2605,7 @@ int clif_changelook(struct block_list *bl,int type,int val)
} else
WBUFW(buf,9)=0;
}
- clif_send(buf,packet_db[0x1d7].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x1d7],bl,AREA);
}
else if(sd && (type == LOOK_BASE) && (val > 255))
{
@@ -2819,13 +2614,13 @@ int clif_changelook(struct block_list *bl,int type,int val)
WBUFB(buf,6)=type;
WBUFW(buf,7)=val;
WBUFW(buf,9)=0;
- clif_send(buf,packet_db[0x1d7].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x1d7],bl,AREA);
} else {
WBUFW(buf,0)=0xc3;
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=type;
WBUFB(buf,7)=val;
- clif_send(buf,packet_db[0xc3].len,bl,AREA);
+ clif_send(buf,packet_len_table[0xc3],bl,AREA);
}
#endif
return 0;
@@ -2875,7 +2670,7 @@ int clif_initialstatus(struct map_session_data *sd)
WBUFW(buf,40) = sd->status.karma;
WBUFW(buf,42) = sd->status.manner;
- WFIFOSET(fd,packet_db[0xbd].len);
+ WFIFOSET(fd,packet_len_table[0xbd]);
clif_updatestatus(sd,SP_STR);
clif_updatestatus(sd,SP_AGI);
@@ -2907,7 +2702,7 @@ int clif_arrowequip(struct map_session_data *sd,int val)
WFIFOW(fd,0)=0x013c;
WFIFOW(fd,2)=val+2;//矢のアイテムID
- WFIFOSET(fd,packet_db[0x013c].len);
+ WFIFOSET(fd,packet_len_table[0x013c]);
return 0;
}
@@ -2926,7 +2721,7 @@ int clif_arrow_fail(struct map_session_data *sd,int type)
WFIFOW(fd,0)=0x013b;
WFIFOW(fd,2)=type;
- WFIFOSET(fd,packet_db[0x013b].len);
+ WFIFOSET(fd,packet_len_table[0x013b]);
return 0;
}
@@ -2976,7 +2771,7 @@ int clif_statusupack(struct map_session_data *sd,int type,int ok,int val)
WFIFOW(fd,2)=type;
WFIFOB(fd,4)=ok;
WFIFOB(fd,5)=val;
- WFIFOSET(fd,packet_db[0xbc].len);
+ WFIFOSET(fd,packet_len_table[0xbc]);
return 0;
}
@@ -2996,7 +2791,7 @@ int clif_equipitemack(struct map_session_data *sd,int n,int pos,int ok)
WFIFOW(fd,2)=n+2;
WFIFOW(fd,4)=pos;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_db[0xaa].len);
+ WFIFOSET(fd,packet_len_table[0xaa]);
return 0;
}
@@ -3016,7 +2811,7 @@ int clif_unequipitemack(struct map_session_data *sd,int n,int pos,int ok)
WFIFOW(fd,2)=n+2;
WFIFOW(fd,4)=pos;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_db[0xac].len);
+ WFIFOSET(fd,packet_len_table[0xac]);
return 0;
}
@@ -3035,22 +2830,22 @@ int clif_misceffect(struct block_list* bl,int type)
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = type;
- clif_send(buf,packet_db[0x19b].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x19b],bl,AREA);
return 0;
}
int clif_misceffect2(struct block_list *bl, int type) {
- char buf[32];
+ unsigned char buf[24];
nullpo_retr(0, bl);
- //memset(buf, 0, packet_db[0x1f3].len);
+ memset(buf, 0, packet_len_table[0x1f3]);
WBUFW(buf,0) = 0x1f3;
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = type;
- clif_send(buf, packet_db[0x1f3].len, bl, AREA);
+ clif_send(buf, packet_len_table[0x1f3], bl, AREA);
return 0;
@@ -3064,7 +2859,6 @@ int clif_changeoption(struct block_list* bl)
char buf[32];
short option;
struct status_change *sc_data;
- struct map_session_data *sd;
static const int omask[]={ 0x10,0x20 };
static const int scnum[]={ SC_FALCON, SC_RIDING };
int i;
@@ -3084,29 +2878,23 @@ int clif_changeoption(struct block_list* bl)
if(bl->type==BL_PC) { // disguises [Valaris]
struct map_session_data *sd=((struct map_session_data *)bl);
if(sd && sd->disguise > 23 && sd->disguise < 4001) {
- clif_send(buf,packet_db[0x119].len,bl,AREA_WOS);
+ clif_send(buf,packet_len_table[0x119],bl,AREA_WOS);
clif_spawnpc(sd);
} else
- clif_send(buf,packet_db[0x119].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x119],bl,AREA);
} else
- clif_send(buf,packet_db[0x119].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x119],bl,AREA);
// アイコンの表示
- if(sc_data)
- {
- for(i=0;i<sizeof(omask)/sizeof(omask[0]);i++){
- if( option&omask[i] ){
- if( sc_data[scnum[i]].timer==-1)
- skill_status_change_start(bl,scnum[i],0,0,0,0,0,0);
- }else{
- skill_status_change_end(bl,scnum[i],-1);
- }
+ for(i=0;i<sizeof(omask)/sizeof(omask[0]);i++){
+ if( option&omask[i] ){
+ if( sc_data[scnum[i]].timer==-1)
+ skill_status_change_start(bl,scnum[i],0,0,0,0,0,0);
+ } else {
+ skill_status_change_end(bl,scnum[i],-1);
}
}
- if(bl->type==BL_PC && (sd=(struct map_session_data *)bl))
- clif_changelook(bl,LOOK_BASE,sd->view_class);
-
return 0;
}
@@ -3124,7 +2912,7 @@ int clif_useitemack(struct map_session_data *sd,int index,int amount,int ok)
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_db[0xa8].len);
+ WFIFOSET(fd,packet_len_table[0xa8]);
}
else {
#if PACKETVER < 3
@@ -3133,7 +2921,7 @@ int clif_useitemack(struct map_session_data *sd,int index,int amount,int ok)
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_db[0xa8].len);
+ WFIFOSET(fd,packet_len_table[0xa8]);
#else
char buf[32];
@@ -3146,7 +2934,7 @@ int clif_useitemack(struct map_session_data *sd,int index,int amount,int ok)
WBUFL(buf,6)=sd->bl.id;
WBUFW(buf,10)=amount;
WBUFB(buf,12)=ok;
- clif_send(buf,packet_db[0x1c8].len,&sd->bl,AREA);
+ clif_send(buf,packet_len_table[0x1c8],&sd->bl,AREA);
#endif
}
@@ -3166,7 +2954,7 @@ int clif_createchat(struct map_session_data *sd,int fail)
fd=sd->fd;
WFIFOW(fd,0)=0xd6;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_db[0xd6].len);
+ WFIFOSET(fd,packet_len_table[0xd6]);
return 0;
}
@@ -3183,13 +2971,13 @@ int clif_dispchat(struct chat_data *cd,int fd)
return 1;
WBUFW(buf,0)=0xd7;
- WBUFW(buf,2)=strlen(cd->title)+18;
+ WBUFW(buf,2)=strlen(cd->title)+17;
WBUFL(buf,4)=(*cd->owner)->id;
WBUFL(buf,8)=cd->bl.id;
WBUFW(buf,12)=cd->limit;
WBUFW(buf,14)=cd->users;
WBUFB(buf,16)=cd->pub;
- strncpy(WBUFP(buf,17),cd->title,strlen(cd->title)+1);
+ strcpy(WBUFP(buf,17),cd->title);
if(fd){
memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2));
WFIFOSET(fd,WBUFW(buf,2));
@@ -3213,13 +3001,13 @@ int clif_changechatstatus(struct chat_data *cd)
return 1;
WBUFW(buf,0)=0xdf;
- WBUFW(buf,2)=strlen(cd->title)+18;
+ WBUFW(buf,2)=strlen(cd->title)+17;
WBUFL(buf,4)=cd->usersd[0]->bl.id;
WBUFL(buf,8)=cd->bl.id;
WBUFW(buf,12)=cd->limit;
WBUFW(buf,14)=cd->users;
WBUFB(buf,16)=cd->pub;
- strncpy(WBUFP(buf,17),cd->title,strlen(cd->title)+1);
+ strcpy(WBUFP(buf,17),cd->title);
clif_send(buf,WBUFW(buf,2),&cd->usersd[0]->bl,CHAT);
return 0;
@@ -3238,10 +3026,10 @@ int clif_clearchat(struct chat_data *cd,int fd)
WBUFW(buf,0)=0xd8;
WBUFL(buf,2)=cd->bl.id;
if(fd){
- memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len);
- WFIFOSET(fd,packet_db[0xd8].len);
+ memcpy(WFIFOP(fd,0),buf,packet_len_table[0xd8]);
+ WFIFOSET(fd,packet_len_table[0xd8]);
} else {
- clif_send(buf,packet_db[0xd8].len,*cd->owner,AREA_WOSC);
+ clif_send(buf,packet_len_table[0xd8],*cd->owner,AREA_WOSC);
}
return 0;
@@ -3261,7 +3049,7 @@ int clif_joinchatfail(struct map_session_data *sd,int fail)
WFIFOW(fd,0)=0xda;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_db[0xda].len);
+ WFIFOSET(fd,packet_len_table[0xda]);
return 0;
}
@@ -3305,7 +3093,7 @@ int clif_addchat(struct chat_data* cd,struct map_session_data *sd)
WBUFW(buf, 0) = 0x0dc;
WBUFW(buf, 2) = cd->users;
memcpy(WBUFP(buf, 4),sd->status.name,24);
- clif_send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS);
+ clif_send(buf,packet_len_table[0xdc],&sd->bl,CHAT_WOS);
return 0;
}
@@ -3328,7 +3116,8 @@ int clif_changechatowner(struct chat_data* cd,struct map_session_data *sd)
WBUFL(buf,32) = 0;
memcpy(WBUFP(buf,36),sd->status.name,24);
- clif_send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT);
+ clif_send(buf,packet_len_table[0xe1]*2,&sd->bl,CHAT);
+
return 0;
}
@@ -3348,7 +3137,7 @@ int clif_leavechat(struct chat_data* cd,struct map_session_data *sd)
memcpy(WBUFP(buf,4),sd->status.name,24);
WBUFB(buf,28) = 0;
- clif_send(buf,packet_db[0xdd].len,&sd->bl,CHAT);
+ clif_send(buf,packet_len_table[0xdd],&sd->bl,CHAT);
return 0;
}
@@ -3360,23 +3149,13 @@ int clif_leavechat(struct chat_data* cd,struct map_session_data *sd)
int clif_traderequest(struct map_session_data *sd,char *name)
{
int fd;
- struct map_session_data *target_sd;
nullpo_retr(0, sd);
- nullpo_retr(0, (target_sd=map_id2sd(sd->trade_partner)));
fd=sd->fd;
-#if PACKETVER < 6
WFIFOW(fd,0)=0xe5;
- strncpy(WFIFOP(fd,2),name,24);
- WFIFOSET(fd,packet_db[0xe5].len);
-#else
- WFIFOW(fd,0)=0x1f4;
- strncpy(WFIFOP(fd,2),name,24);
- WFIFOL(fd,26)=target_sd->status.char_id; //良く分からないからとりあえずchar_id
- WFIFOW(fd,30)=target_sd->status.base_level;
- WFIFOSET(fd,packet_db[0x1f4].len);
-#endif
+ strcpy(WFIFOP(fd,2),name);
+ WFIFOSET(fd,packet_len_table[0xe5]);
return 0;
}
@@ -3388,25 +3167,13 @@ int clif_traderequest(struct map_session_data *sd,char *name)
int clif_tradestart(struct map_session_data *sd,int type)
{
int fd;
- struct map_session_data *target_sd;
nullpo_retr(0, sd);
- if((target_sd=map_id2sd(sd->trade_partner)) == NULL)
- return -1;
-
fd=sd->fd;
-#if PACKETVER < 6
WFIFOW(fd,0)=0xe7;
WFIFOB(fd,2)=type;
- WFIFOSET(fd,packet_db[0xe7].len);
-#else
- WFIFOW(fd,0)=0x1f5;
- WFIFOB(fd,2)=type;
- WFIFOL(fd,3)=target_sd->status.char_id; //良く分からないからとりあえずchar_id
- WFIFOW(fd,7)=target_sd->status.base_level;
- WFIFOSET(fd,packet_db[0x1f5].len);
-#endif
+ WFIFOSET(fd,packet_len_table[0xe7]);
return 0;
}
@@ -3468,7 +3235,7 @@ int clif_tradeadditem(struct map_session_data *sd,struct map_session_data *tsd,i
WFIFOW(fd,17)= sd->status.inventory[index].card[3];
}
}
- WFIFOSET(fd,packet_db[0xe9].len);
+ WFIFOSET(fd,packet_len_table[0xe9]);
return 0;
}
@@ -3487,7 +3254,7 @@ int clif_tradeitemok(struct map_session_data *sd,int index,int fail)
WFIFOW(fd,0)=0xea;
WFIFOW(fd,2)=index;
WFIFOB(fd,4)=fail;
- WFIFOSET(fd,packet_db[0xea].len);
+ WFIFOSET(fd,packet_len_table[0xea]);
return 0;
}
@@ -3505,7 +3272,7 @@ int clif_tradedeal_lock(struct map_session_data *sd,int fail)
fd=sd->fd;
WFIFOW(fd,0)=0xec;
WFIFOB(fd,2)=fail; // 0=you 1=the other person
- WFIFOSET(fd,packet_db[0xec].len);
+ WFIFOSET(fd,packet_len_table[0xec]);
return 0;
}
@@ -3522,7 +3289,7 @@ int clif_tradecancelled(struct map_session_data *sd)
fd=sd->fd;
WFIFOW(fd,0)=0xee;
- WFIFOSET(fd,packet_db[0xee].len);
+ WFIFOSET(fd,packet_len_table[0xee]);
return 0;
}
@@ -3540,7 +3307,7 @@ int clif_tradecompleted(struct map_session_data *sd,int fail)
fd=sd->fd;
WFIFOW(fd,0)=0xf0;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_db[0xf0].len);
+ WFIFOSET(fd,packet_len_table[0xf0]);
return 0;
}
@@ -3560,7 +3327,7 @@ int clif_updatestorageamount(struct map_session_data *sd,struct storage *stor)
WFIFOW(fd,0) = 0xf2; // update storage amount
WFIFOW(fd,2) = stor->storage_amount; //items
WFIFOW(fd,4) = MAX_STORAGE; //items max
- WFIFOSET(fd,packet_db[0xf2].len);
+ WFIFOSET(fd,packet_len_table[0xf2]);
return 0;
}
@@ -3610,7 +3377,7 @@ int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int i
else
WFIFOW(fd,19)= stor->storage[index].card[3];
}
- WFIFOSET(fd,packet_db[0xf4].len);
+ WFIFOSET(fd,packet_len_table[0xf4]);
return 0;
}
@@ -3630,7 +3397,7 @@ int clif_updateguildstorageamount(struct map_session_data *sd,struct guild_stora
WFIFOW(fd,0) = 0xf2; // update storage amount
WFIFOW(fd,2) = stor->storage_amount; //items
WFIFOW(fd,4) = MAX_GUILD_STORAGE; //items max
- WFIFOSET(fd,packet_db[0xf2].len);
+ WFIFOSET(fd,packet_len_table[0xf2]);
return 0;
}
@@ -3680,7 +3447,7 @@ int clif_guildstorageitemadded(struct map_session_data *sd,struct guild_storage
else
WFIFOW(fd,19)= stor->storage[index].card[3];
}
- WFIFOSET(fd,packet_db[0xf4].len);
+ WFIFOSET(fd,packet_len_table[0xf4]);
return 0;
}
@@ -3699,7 +3466,7 @@ int clif_storageitemremoved(struct map_session_data *sd,int index,int amount)
WFIFOW(fd,0)=0xf6; // Storage item removed
WFIFOW(fd,2)=index+1;
WFIFOL(fd,4)=amount;
- WFIFOSET(fd,packet_db[0xf6].len);
+ WFIFOSET(fd,packet_len_table[0xf6]);
return 0;
}
@@ -3716,7 +3483,7 @@ int clif_storageclose(struct map_session_data *sd)
fd=sd->fd;
WFIFOW(fd,0)=0xf8; // Storage Closed
- WFIFOSET(fd,packet_db[0xf8].len);
+ WFIFOSET(fd,packet_len_table[0xf8]);
return 0;
}
@@ -3754,11 +3521,10 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
}
if(dstsd->spiritball > 0) {
clif_set01e1(dstsd,WFIFOP(sd->fd,0));
- WFIFOSET(sd->fd,packet_db[0x1e1].len);
+ WFIFOSET(sd->fd,packet_len_table[0x1e1]);
}
if(battle_config.save_clothcolor==1 && dstsd->status.clothes_color > 0)
clif_changelook(&dstsd->bl,LOOK_CLOTHES_COLOR,dstsd->status.clothes_color);
-
if(sd->status.manner < 0)
clif_changestatus(&sd->bl,SP_MANNER,sd->status.manner);
@@ -3775,7 +3541,7 @@ void clif_getareachar_npc(struct map_session_data* sd,struct npc_data* nd)
nullpo_retv(sd);
nullpo_retv(nd);
- if(nd->class < 0 ||(nd->flag&1 && nd->option != 0x0002) || nd->class == INVISIBLE_CLASS)
+ if(nd->class < 0 || nd->flag&1 || nd->class == INVISIBLE_CLASS)
return;
len = clif_npc0078(nd,WFIFOP(sd->fd,0));
@@ -3929,7 +3695,7 @@ int clif_damage(struct block_list *src,struct block_list *dst,unsigned int tick,
WBUFW(buf,24)=div;
WBUFB(buf,26)=type;
WBUFW(buf,27)=damage2;
- clif_send(buf,packet_db[0x8a].len,src,AREA);
+ clif_send(buf,packet_len_table[0x8a],src,AREA);
return 0;
}
@@ -4002,7 +3768,7 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi
WFIFOB(fd,15)=fitem->subx;
WFIFOB(fd,16)=fitem->suby;
- WFIFOSET(fd,packet_db[0x9d].len);
+ WFIFOSET(fd,packet_len_table[0x9d]);
}
/*==========================================
* 場所スキルエフェクトが視界に入る
@@ -4018,7 +3784,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
fd=sd->fd;
bl=map_id2bl(unit->group->src_id);
#if PACKETVER < 3
- memset(WFIFOP(fd,0),0,packet_db[0x11f].len);
+ memset(WFIFOP(fd,0),0,packet_len_table[0x11f]);
WFIFOW(fd, 0)=0x11f;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4026,9 +3792,9 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
WFIFOW(fd,12)=unit->bl.y;
WFIFOB(fd,14)=unit->group->unit_id;
WFIFOB(fd,15)=0;
- WFIFOSET(fd,packet_db[0x11f].len);
+ WFIFOSET(fd,packet_len_table[0x11f]);
#else
- memset(WFIFOP(fd,0),0,packet_db[0x1c9].len);
+ memset(WFIFOP(fd,0),0,packet_len_table[0x1c9]);
WFIFOW(fd, 0)=0x1c9;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4036,42 +3802,37 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
WFIFOW(fd,12)=unit->bl.y;
WFIFOB(fd,14)=unit->group->unit_id;
WFIFOB(fd,15)=1;
- if(unit->group->unit_id==0xb0){ //グラフィティ
- WFIFOB(fd,15+1)=1;
- memcpy(WFIFOP(fd,15+2),unit->group->valstr,80);
- }else{
- WFIFOL(fd,15+1)=0; //1-4調べた限り固定
- WFIFOL(fd,15+5)=0; //5-8調べた限り固定
- //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
- WFIFOL(fd,15+13)=unit->bl.y - 0x12; //13-16ユニットのY座標-18っぽい(Y:17でFF FF FF FF)
- WFIFOL(fd,15+17)=0x004f37dd; //17-20調べた限り固定
- WFIFOL(fd,15+21)=0x0012f674; //21-24調べた限り固定
- WFIFOL(fd,15+25)=0x0012f664; //25-28調べた限り固定
- WFIFOL(fd,15+29)=0x0012f654; //29-32調べた限り固定
- WFIFOL(fd,15+33)=0x77527bbc; //33-36調べた限り固定
- //37-39
- WFIFOB(fd,15+40)=0x2d; //40調べた限り固定
- WFIFOL(fd,15+41)=0; //41-44調べた限り0固定
- WFIFOL(fd,15+45)=0; //45-48調べた限り0固定
- WFIFOL(fd,15+49)=0; //49-52調べた限り0固定
- WFIFOL(fd,15+53)=0x0048d919; //53-56調べた限り固定
- WFIFOL(fd,15+57)=0x0000003e; //57-60調べた限り固定
- WFIFOL(fd,15+61)=0x0012f66c; //61-64調べた限り固定
- //65-68
- //69-72
- if(bl) WFIFOL(fd,15+73)=bl->y; //73-76術者のY座標
+ WFIFOL(fd,15+1)=0; //1-4調べた限り固定
+ WFIFOL(fd,15+5)=0; //5-8調べた限り固定
+ //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
+ WFIFOL(fd,15+13)=unit->bl.y - 0x12; //13-16ユニットのY座標-18っぽい(Y:17でFF FF FF FF)
+ WFIFOL(fd,15+17)=0x004f37dd; //17-20調べた限り固定
+ WFIFOL(fd,15+21)=0x0012f674; //21-24調べた限り固定
+ WFIFOL(fd,15+25)=0x0012f664; //25-28調べた限り固定
+ WFIFOL(fd,15+29)=0x0012f654; //29-32調べた限り固定
+ WFIFOL(fd,15+33)=0x77527bbc; //33-36調べた限り固定
+ //37-39
+ WFIFOB(fd,15+40)=0x2d; //40調べた限り固定
+ WFIFOL(fd,15+41)=0; //41-44調べた限り0固定
+ WFIFOL(fd,15+45)=0; //45-48調べた限り0固定
+ WFIFOL(fd,15+49)=0; //49-52調べた限り0固定
+ WFIFOL(fd,15+53)=0x0048d919; //53-56調べた限り固定
+ WFIFOL(fd,15+57)=0x0000003e; //57-60調べた限り固定
+ WFIFOL(fd,15+61)=0x0012f66c; //61-64調べた限り固定
+ //65-68
+ //69-72
+ if(bl) WFIFOL(fd,15+73)=bl->y; //73-76術者のY座標
WFIFOL(fd,15+77)=unit->bl.m; //77-80マップIDかなぁ?かなり2バイトで足りそうな数字
- WFIFOB(fd,15+81)=0xaa; //81終端文字0xaa
- }
+ WFIFOB(fd,15+81)=0xaa; //81終端文字0xaa
- /* Graffiti [Valaris] */
- if(unit->group->unit_id==0xb0) {
- WFIFOL(fd,15)=1;
- WFIFOL(fd,16)=1;
- memcpy(WFIFOP(fd,17),unit->group->valstr,80);
- }
+ /* Graffiti [Valaris] */
+ if(unit->group->unit_id==0xb0) {
+ WFIFOL(fd,15)=1;
+ WFIFOL(fd,16)=1;
+ memcpy(WFIFOP(fd,17),unit->group->valstr,80);
+ }
- WFIFOSET(fd,packet_db[0x1c9].len);
+ WFIFOSET(fd,packet_len_table[0x1c9]);
#endif
if(unit->group->skill_id == WZ_ICEWALL)
clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,5);
@@ -4088,7 +3849,7 @@ int clif_clearchar_skillunit(struct skill_unit *unit,int fd)
WFIFOW(fd, 0)=0x120;
WFIFOL(fd, 2)=unit->bl.id;
- WFIFOSET(fd,packet_db[0x120].len);
+ WFIFOSET(fd,packet_len_table[0x120]);
if(unit->group->skill_id == WZ_ICEWALL)
clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2);
@@ -4108,7 +3869,7 @@ int clif_01ac(struct block_list *bl)
WBUFW(buf, 0) = 0x1ac;
WBUFL(buf, 2) = bl->id;
- clif_send(buf,packet_db[0x1ac].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x1ac],bl,AREA);
return 0;
}
@@ -4300,6 +4061,7 @@ int clif_petoutsight(struct block_list *bl,va_list ap)
return 0;
}
+
// npc walking [Valaris]
int clif_npcoutsight(struct block_list *bl,va_list ap)
{
@@ -4336,6 +4098,7 @@ int clif_petinsight(struct block_list *bl,va_list ap)
return 0;
}
+
// npc walking [Valaris]
int clif_npcinsight(struct block_list *bl,va_list ap)
{
@@ -4387,7 +4150,7 @@ int clif_skillinfo(struct map_session_data *sd,int skillid,int type,int range)
WFIFOB(fd,38)= (sd->status.skill[skillid].lv < skill_get_max(id) && sd->status.skill[skillid].flag ==0 )? 1:0;
else
WFIFOB(fd,38) = 0;
- WFIFOSET(fd,packet_db[0x147].len);
+ WFIFOSET(fd,packet_len_table[0x147]);
return 0;
}
@@ -4451,7 +4214,7 @@ int clif_skillup(struct map_session_data *sd,int skill_num)
range = battle_get_range(&sd->bl) - (range + 1);
WFIFOW(fd,8) = range;
WFIFOB(fd,10) = (sd->status.skill[skill_num].lv < skill_get_max(sd->status.skill[skill_num].id)) ? 1 : 0;
- WFIFOSET(fd,packet_db[0x10e].len);
+ WFIFOSET(fd,packet_len_table[0x10e]);
return 0;
}
@@ -4472,7 +4235,7 @@ int clif_skillcasting(struct block_list* bl,
WBUFW(buf,14) = skill_num;//魔法詠唱スキル
WBUFL(buf,16) = skill_get_pl(skill_num);//属性
WBUFL(buf,20) = casttime;//skill詠唱時間
- clif_send(buf,packet_db[0x13e].len, bl, AREA);
+ clif_send(buf,packet_len_table[0x13e], bl, AREA);
return 0;
}
@@ -4489,7 +4252,7 @@ int clif_skillcastcancel(struct block_list* bl)
WBUFW(buf,0) = 0x1b9;
WBUFL(buf,2) = bl->id;
- clif_send(buf,packet_db[0x1b9].len, bl, AREA);
+ clif_send(buf,packet_len_table[0x1b9], bl, AREA);
return 0;
}
@@ -4516,7 +4279,7 @@ int clif_skill_fail(struct map_session_data *sd,int skill_id,int type,int btype)
WFIFOW(fd,6) = 0;
WFIFOB(fd,8) = 0;
WFIFOB(fd,9) = type;
- WFIFOSET(fd,packet_db[0x110].len);
+ WFIFOSET(fd,packet_len_table[0x110]);
return 0;
}
@@ -4557,7 +4320,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
WBUFW(buf,26)=skill_lv;
WBUFW(buf,28)=div;
WBUFB(buf,30)=(type>0)?type:skill_get_hit(skill_id);
- clif_send(buf,packet_db[0x114].len,src,AREA);
+ clif_send(buf,packet_len_table[0x114],src,AREA);
#else
WBUFW(buf,0)=0x1de;
WBUFW(buf,2)=skill_id;
@@ -4570,7 +4333,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
WBUFW(buf,28)=skill_lv;
WBUFW(buf,30)=div;
WBUFB(buf,32)=(type>0)?type:skill_get_hit(skill_id);
- clif_send(buf,packet_db[0x1de].len,src,AREA);
+ clif_send(buf,packet_len_table[0x1de],src,AREA);
#endif
return 0;
@@ -4613,7 +4376,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,
WBUFW(buf,30)=skill_lv;
WBUFW(buf,32)=div;
WBUFB(buf,34)=(type>0)?type:skill_get_hit(skill_id);
- clif_send(buf,packet_db[0x115].len,src,AREA);
+ clif_send(buf,packet_len_table[0x115],src,AREA);
return 0;
}
@@ -4630,16 +4393,13 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst,
nullpo_retr(0, src);
nullpo_retr(0, dst);
- if(heal>0x7fff && skill_id != (NPC_SELFDESTRUCTION || NPC_SELFDESTRUCTION2))
- heal=0x7fff;
-
WBUFW(buf,0)=0x11a;
WBUFW(buf,2)=skill_id;
- WBUFW(buf,4)=heal;
+ WBUFW(buf,4)=(heal > 0x7fff)? 0x7fff:heal;
WBUFL(buf,6)=dst->id;
WBUFL(buf,10)=src->id;
WBUFB(buf,14)=fail;
- clif_send(buf,packet_db[0x11a].len,src,AREA);
+ clif_send(buf,packet_len_table[0x11a],src,AREA);
return 0;
}
@@ -4661,7 +4421,7 @@ int clif_skill_poseffect(struct block_list *src,int skill_id,int val,int x,int y
WBUFW(buf,10)=x;
WBUFW(buf,12)=y;
WBUFL(buf,14)=tick;
- clif_send(buf,packet_db[0x117].len,src,AREA);
+ clif_send(buf,packet_len_table[0x117],src,AREA);
return 0;
}
@@ -4680,7 +4440,7 @@ int clif_skill_setunit(struct skill_unit *unit)
bl=map_id2bl(unit->group->src_id);
#if PACKETVER < 3
- memset(WBUFP(buf, 0),0,packet_db[0x11f].len);
+ memset(WBUFP(buf, 0),0,packet_len_table[0x11f]);
WBUFW(buf, 0)=0x11f;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -4688,31 +4448,26 @@ int clif_skill_setunit(struct skill_unit *unit)
WBUFW(buf,12)=unit->bl.y;
WBUFB(buf,14)=unit->group->unit_id;
WBUFB(buf,15)=0;
- clif_send(buf,packet_db[0x11f].len,&unit->bl,AREA);
+ clif_send(buf,packet_len_table[0x11f],&unit->bl,AREA);
#else
- memset(WBUFP(buf, 0),0,packet_db[0x1c9].len);
- WBUFW(buf, 0)=0x1c9;
- WBUFL(buf, 2)=unit->bl.id;
- WBUFL(buf, 6)=unit->group->src_id;
- WBUFW(buf,10)=unit->bl.x;
- WBUFW(buf,12)=unit->bl.y;
- WBUFB(buf,14)=unit->group->unit_id;
- WBUFB(buf,15)=1;
-
- if(unit->group->unit_id==0xb0){ //グラフィティ
- WBUFB(buf,15+1)=1;
- memcpy(WBUFP(buf,15+2),unit->group->valstr,80);
- }else{
+ memset(WBUFP(buf, 0),0,packet_len_table[0x1c9]);
+ WBUFW(buf, 0)=0x1c9;
+ WBUFL(buf, 2)=unit->bl.id;
+ WBUFL(buf, 6)=unit->group->src_id;
+ WBUFW(buf,10)=unit->bl.x;
+ WBUFW(buf,12)=unit->bl.y;
+ WBUFB(buf,14)=unit->group->unit_id;
+ WBUFB(buf,15)=1;
WBUFL(buf,15+1)=0; //1-4調べた限り固定
WBUFL(buf,15+5)=0; //5-8調べた限り固定
- //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
+ //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
WBUFL(buf,15+13)=unit->bl.y - 0x12; //13-16ユニットのY座標-18っぽい(Y:17でFF FF FF FF)
WBUFL(buf,15+17)=0x004f37dd; //17-20調べた限り固定(0x1b2で0x004fdbddだった)
WBUFL(buf,15+21)=0x0012f674; //21-24調べた限り固定
WBUFL(buf,15+25)=0x0012f664; //25-28調べた限り固定
WBUFL(buf,15+29)=0x0012f654; //29-32調べた限り固定
WBUFL(buf,15+33)=0x77527bbc; //33-36調べた限り固定
- //37-39
+ //37-39
WBUFB(buf,15+40)=0x2d; //40調べた限り固定
WBUFL(buf,15+41)=0; //41-44調べた限り0固定
WBUFL(buf,15+45)=0; //45-48調べた限り0固定
@@ -4720,21 +4475,20 @@ int clif_skill_setunit(struct skill_unit *unit)
WBUFL(buf,15+53)=0x0048d919; //53-56調べた限り固定(0x01b2で0x00495119だった)
WBUFL(buf,15+57)=0x0000003e; //57-60調べた限り固定
WBUFL(buf,15+61)=0x0012f66c; //61-64調べた限り固定
- //65-68
- //69-72
+ //65-68
+ //69-72
if(bl) WBUFL(buf,15+73)=bl->y; //73-76術者のY座標
- WBUFL(buf,15+77)=unit->bl.m; //77-80マップIDかなぁ?かなり2バイトで足りそうな数字
+ WBUFL(buf,15+77)=unit->bl.m; //77-80マップIDかなぁ?かなり2バイトで足りそうな数字
WBUFB(buf,15+81)=0xaa; //81終端文字0xaa
- }
- /* Graffiti [Valaris] */
- if(unit->group->unit_id==0xb0) {
- WBUFL(buf,15)=1;
- WBUFL(buf,16)=1;
- memcpy(WBUFP(buf,17),unit->group->valstr,80);
- }
+ /* Graffiti [Valaris] */
+ if(unit->group->unit_id==0xb0) {
+ WBUFL(buf,15)=1;
+ WBUFL(buf,16)=1;
+ memcpy(WBUFP(buf,17),unit->group->valstr,80);
+ }
- clif_send(buf,packet_db[0x1c9].len,&unit->bl,AREA);
+ clif_send(buf,packet_len_table[0x1c9],&unit->bl,AREA);
#endif
return 0;
}
@@ -4750,7 +4504,7 @@ int clif_skill_delunit(struct skill_unit *unit)
WBUFW(buf, 0)=0x120;
WBUFL(buf, 2)=unit->bl.id;
- clif_send(buf,packet_db[0x120].len,&unit->bl,AREA);
+ clif_send(buf,packet_len_table[0x120],&unit->bl,AREA);
return 0;
}
/*==========================================
@@ -4771,7 +4525,7 @@ int clif_skill_warppoint(struct map_session_data *sd,int skill_num,
memcpy(WFIFOP(fd,20),map2,16);
memcpy(WFIFOP(fd,36),map3,16);
memcpy(WFIFOP(fd,52),map4,16);
- WFIFOSET(fd,packet_db[0x11c].len);
+ WFIFOSET(fd,packet_len_table[0x11c]);
return 0;
}
/*==========================================
@@ -4788,7 +4542,7 @@ int clif_skill_memo(struct map_session_data *sd,int flag)
WFIFOW(fd,0)=0x11e;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x11e].len);
+ WFIFOSET(fd,packet_len_table[0x11e]);
return 0;
}
int clif_skill_teleportmessage(struct map_session_data *sd,int flag)
@@ -4800,7 +4554,7 @@ int clif_skill_teleportmessage(struct map_session_data *sd,int flag)
fd=sd->fd;
WFIFOW(fd,0)=0x189;
WFIFOW(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x189].len);
+ WFIFOSET(fd,packet_len_table[0x189]);
return 0;
}
@@ -4835,10 +4589,10 @@ int clif_skill_estimation(struct map_session_data *sd,struct block_list *dst)
WBUFB(buf,20+i)= battle_attr_fix(100,i+1,md->def_ele);
if(sd->status.party_id>0)
- clif_send(buf,packet_db[0x18c].len,&sd->bl,PARTY_AREA);
+ clif_send(buf,packet_len_table[0x18c],&sd->bl,PARTY_AREA);
else{
- memcpy(WFIFOP(sd->fd,0),buf,packet_db[0x18c].len);
- WFIFOSET(sd->fd,packet_db[0x18c].len);
+ memcpy(WFIFOP(sd->fd,0),buf,packet_len_table[0x18c]);
+ WFIFOSET(sd->fd,packet_len_table[0x18c]);
}
return 0;
}
@@ -4885,7 +4639,7 @@ int clif_status_change(struct block_list *bl,int type,int flag)
WBUFW(buf,2)=type;
WBUFL(buf,4)=bl->id;
WBUFB(buf,8)=flag;
- clif_send(buf,packet_db[0x196].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x196],bl,AREA);
return 0;
}
@@ -4896,18 +4650,18 @@ int clif_status_change(struct block_list *bl,int type,int flag)
int clif_displaymessage(const int fd, char* mes)
{
//Console [Wizputer]
- if ( fd == 0 )
- printf("console: %s\n",mes);
- else {
- int len_mes = strlen(mes);
+ if (fd == 0)
+ printf("\033[0;36mConsole: \033[0m\033[1m%s\033[0m\n", mes);
+ else {
+ int len_mes = strlen(mes);
- if (len_mes > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line.
- WFIFOW(fd,0) = 0x8e;
- WFIFOW(fd,2) = 5 + len_mes; // 4 + len + NULL teminate
- memcpy(WFIFOP(fd,4), mes, len_mes + 1);
- WFIFOSET(fd, 5 + len_mes);
+ if (len_mes > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line.
+ WFIFOW(fd,0) = 0x8e;
+ WFIFOW(fd,2) = 5 + len_mes; // 4 + len + NULL teminate
+ memcpy(WFIFOP(fd,4), mes, len_mes + 1);
+ WFIFOSET(fd, 5 + len_mes);
+ }
}
- }
return 0;
}
@@ -4916,24 +4670,27 @@ int clif_displaymessage(const int fd, char* mes)
* 天の声を送信する
*------------------------------------------
*/
-int clif_GMmessage(struct block_list *bl,char* mes,int len,int flag)
+int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag)
{
- unsigned char buf[len+16];
- //unsigned char *buf = ((len + 16) >= sizeof(lbuf)) ? malloc(len+16) : lbuf;
- int lp = (flag&0x10) ? 8 : 4;
+ unsigned char *buf;
+ int lp;
+
+ lp = (flag & 0x10) ? 8 : 4;
+ buf = (unsigned char*)aCalloc(len + lp, sizeof(unsigned char));
WBUFW(buf,0) = 0x9a;
- WBUFW(buf,2) = len+lp;
+ WBUFW(buf,2) = len + lp;
WBUFL(buf,4) = 0x65756c62;
memcpy(WBUFP(buf,lp), mes, len);
- flag&=0x07;
+ flag &= 0x07;
clif_send(buf, WBUFW(buf,2), bl,
- (flag==1)? ALL_SAMEMAP:
- (flag==2)? AREA:
- (flag==3)? SELF:
- ALL_CLIENT);
- //if (buf != lbuf)
- // free(buf);
+ (flag == 1) ? ALL_SAMEMAP :
+ (flag == 2) ? AREA :
+ (flag == 3) ? SELF :
+ ALL_CLIENT);
+
+ if(buf) free(buf);
+
return 0;
}
@@ -4946,7 +4703,7 @@ int clif_heal(int fd,int type,int val)
WFIFOW(fd,0)=0x13d;
WFIFOW(fd,2)=type;
WFIFOW(fd,4)=val;
- WFIFOSET(fd,packet_db[0x13d].len);
+ WFIFOSET(fd,packet_len_table[0x13d]);
return 0;
}
@@ -4971,7 +4728,7 @@ int clif_resurrection(struct block_list *bl,int type)
WBUFL(buf,2)=bl->id;
WBUFW(buf,6)=type;
- clif_send(buf,packet_db[0x148].len,bl,type==1 ? AREA : AREA_WOS);
+ clif_send(buf,packet_len_table[0x148],bl,type==1 ? AREA : AREA_WOS);
return 0;
}
@@ -4984,7 +4741,7 @@ int clif_set0199(int fd,int type)
{
WFIFOW(fd,0)=0x199;
WFIFOW(fd,2)=type;
- WFIFOSET(fd,packet_db[0x199].len);
+ WFIFOSET(fd,packet_len_table[0x199]);
return 0;
}
@@ -5007,7 +4764,7 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
pc_calc_pvprank(sd);
WFIFOL(sd->fd,6) = pvprank;
WFIFOL(sd->fd,10) = pvpnum;
- WFIFOSET(sd->fd,packet_db[0x19a].len);
+ WFIFOSET(sd->fd,packet_len_table[0x19a]);
} else {
char buf[32];
@@ -5021,9 +4778,9 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
WBUFL(buf,6) = pvprank;
WBUFL(buf,10) = pvpnum;
if(!type)
- clif_send(buf,packet_db[0x19a].len,&sd->bl,AREA);
+ clif_send(buf,packet_len_table[0x19a],&sd->bl,AREA);
else
- clif_send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP);
+ clif_send(buf,packet_len_table[0x19a],&sd->bl,ALL_SAMEMAP);
}
return 0;
@@ -5041,7 +4798,7 @@ int clif_send0199(int map,int type)
bl.m = map;
WBUFW(buf,0)=0x199;
WBUFW(buf,2)=type;
- clif_send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP);
+ clif_send(buf,packet_len_table[0x199],&bl,ALL_SAMEMAP);
return 0;
}
@@ -5056,7 +4813,7 @@ int clif_refine(int fd,struct map_session_data *sd,int fail,int index,int val)
WFIFOW(fd,2)=fail;
WFIFOW(fd,4)=index+2;
WFIFOW(fd,6)=val;
- WFIFOSET(fd,packet_db[0x188].len);
+ WFIFOSET(fd,packet_len_table[0x188]);
return 0;
}
@@ -5067,10 +4824,10 @@ int clif_refine(int fd,struct map_session_data *sd,int fail,int index,int val)
*/
int clif_wis_message(int fd, char *nick, char *mes, int mes_len) // R 0097 <len>.w <nick>.24B <message>.?B
{
- WFIFOW(fd,0)=0x97;
- WFIFOW(fd,2)=mes_len +24+ 4;
- memcpy(WFIFOP(fd,4),nick,24);
- memcpy(WFIFOP(fd,28),mes,mes_len);
+ WFIFOW(fd,0) = 0x97;
+ WFIFOW(fd,2) = mes_len + 24 + 4;
+ memcpy(WFIFOP(fd,4), nick, 24);
+ memcpy(WFIFOP(fd,28), mes, mes_len);
WFIFOSET(fd,WFIFOW(fd,2));
return 0;
}
@@ -5081,9 +4838,9 @@ int clif_wis_message(int fd, char *nick, char *mes, int mes_len) // R 0097 <len>
*/
int clif_wis_end(int fd, int flag) // R 0098 <type>.B: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
{
- WFIFOW(fd,0)=0x98;
- WFIFOW(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x98].len);
+ WFIFOW(fd,0) = 0x98;
+ WFIFOW(fd,2) = flag;
+ WFIFOSET(fd,packet_len_table[0x98]);
return 0;
}
@@ -5103,7 +4860,7 @@ int clif_solved_charname(struct map_session_data *sd,int char_id)
WFIFOW(fd,0)=0x194;
WFIFOL(fd,2)=char_id;
memcpy(WFIFOP(fd,6), p,24 );
- WFIFOSET(fd,packet_db[0x194].len);
+ WFIFOSET(fd,packet_len_table[0x194]);
}else{
map_reqchariddb(sd,char_id);
chrif_searchcharid(char_id);
@@ -5175,7 +4932,7 @@ int clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int
WFIFOW(fd,2)=idx_equip+2;
WFIFOW(fd,4)=idx_card+2;
WFIFOB(fd,6)=flag;
- WFIFOSET(fd,packet_db[0x17d].len);
+ WFIFOSET(fd,packet_len_table[0x17d]);
return 0;
}
@@ -5220,7 +4977,7 @@ int clif_item_identified(struct map_session_data *sd,int idx,int flag)
WFIFOW(fd, 0)=0x179;
WFIFOW(fd, 2)=idx+2;
WFIFOB(fd, 4)=flag;
- WFIFOSET(fd,packet_db[0x179].len);
+ WFIFOSET(fd,packet_len_table[0x179]);
return 0;
}
@@ -5240,7 +4997,7 @@ int clif_item_repair_list(struct map_session_data *sd)
WFIFOW(fd,0)=0x0;
for(i=c=0;i<MAX_INVENTORY;i++){
- if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].attribute!=0){
+ if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].attribute==1){
WFIFOW(fd,c*2+4)=i+2;
c++;
}
@@ -5275,7 +5032,7 @@ int clif_item_skill(struct map_session_data *sd,int skillid,int skilllv,const ch
WFIFOW(fd,12)=range;
memcpy(WFIFOP(fd,14),name,24);
WFIFOB(fd,38)=0;
- WFIFOSET(fd,packet_db[0x147].len);
+ WFIFOSET(fd,packet_len_table[0x147]);
return 0;
}
@@ -5328,7 +5085,7 @@ int clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail)
else
WBUFW(buf,19)= sd->status.cart[n].card[3];
}
- WFIFOSET(fd,packet_db[0x124].len);
+ WFIFOSET(fd,packet_len_table[0x124]);
return 0;
}
@@ -5348,7 +5105,7 @@ int clif_cart_delitem(struct map_session_data *sd,int n,int amount)
WFIFOW(fd,2)=n+2;
WFIFOL(fd,4)=amount;
- WFIFOSET(fd,packet_db[0x125].len);
+ WFIFOSET(fd,packet_len_table[0x125]);
return 0;
}
@@ -5499,7 +5256,7 @@ int clif_openvendingreq(struct map_session_data *sd,int num)
fd=sd->fd;
WFIFOW(fd,0)=0x12d;
WFIFOW(fd,2)=num;
- WFIFOSET(fd,packet_db[0x12d].len);
+ WFIFOSET(fd,packet_len_table[0x12d]);
return 0;
}
@@ -5518,10 +5275,10 @@ int clif_showvendingboard(struct block_list* bl,char *message,int fd)
WBUFL(buf,2)=bl->id;
strncpy(WBUFP(buf,6),message,80);
if(fd){
- memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len);
- WFIFOSET(fd,packet_db[0x131].len);
+ memcpy(WFIFOP(fd,0),buf,packet_len_table[0x131]);
+ WFIFOSET(fd,packet_len_table[0x131]);
}else{
- clif_send(buf,packet_db[0x131].len,bl,AREA_WOS);
+ clif_send(buf,packet_len_table[0x131],bl,AREA_WOS);
}
return 0;
}
@@ -5539,10 +5296,10 @@ int clif_closevendingboard(struct block_list* bl,int fd)
WBUFW(buf,0)=0x132;
WBUFL(buf,2)=bl->id;
if(fd){
- memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len);
- WFIFOSET(fd,packet_db[0x132].len);
+ memcpy(WFIFOP(fd,0),buf,packet_len_table[0x132]);
+ WFIFOSET(fd,packet_len_table[0x132]);
}else{
- clif_send(buf,packet_db[0x132].len,bl,AREA_WOS);
+ clif_send(buf,packet_len_table[0x132],bl,AREA_WOS);
}
return 0;
@@ -5631,7 +5388,7 @@ int clif_buyvending(struct map_session_data *sd,int index,int amount,int fail)
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
WFIFOB(fd,6)=fail;
- WFIFOSET(fd,packet_db[0x135].len);
+ WFIFOSET(fd,packet_len_table[0x135]);
return 0;
}
@@ -5717,7 +5474,7 @@ int clif_vendingreport(struct map_session_data *sd,int index,int amount)
WFIFOW(fd,0)=0x137;
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
- WFIFOSET(fd,packet_db[0x137].len);
+ WFIFOSET(fd,packet_len_table[0x137]);
return 0;
}
@@ -5735,7 +5492,7 @@ int clif_party_created(struct map_session_data *sd,int flag)
fd=sd->fd;
WFIFOW(fd,0)=0xfa;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_db[0xfa].len);
+ WFIFOSET(fd,packet_len_table[0xfa]);
return 0;
}
/*==========================================
@@ -5794,7 +5551,7 @@ int clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd)
WFIFOW(fd,0)=0xfe;
WFIFOL(fd,2)=sd->status.account_id;
memcpy(WFIFOP(fd,6),p->name,24);
- WFIFOSET(fd,packet_db[0xfe].len);
+ WFIFOSET(fd,packet_len_table[0xfe]);
return 0;
}
@@ -5812,7 +5569,7 @@ int clif_party_inviteack(struct map_session_data *sd,char *nick,int flag)
WFIFOW(fd,0)=0xfd;
memcpy(WFIFOP(fd,2),nick,24);
WFIFOB(fd,26)=flag;
- WFIFOSET(fd,packet_db[0xfd].len);
+ WFIFOSET(fd,packet_len_table[0xfd]);
return 0;
}
@@ -5843,10 +5600,10 @@ int clif_party_option(struct party *p,struct map_session_data *sd,int flag)
WBUFW(buf,2)=((flag&0x01)?2:p->exp);
WBUFW(buf,4)=((flag&0x10)?2:p->item);
if(flag==0)
- clif_send(buf,packet_db[0x101].len,&sd->bl,PARTY);
+ clif_send(buf,packet_len_table[0x101],&sd->bl,PARTY);
else {
- memcpy(WFIFOP(sd->fd,0),buf,packet_db[0x101].len);
- WFIFOSET(sd->fd,packet_db[0x101].len);
+ memcpy(WFIFOP(sd->fd,0),buf,packet_len_table[0x101]);
+ WFIFOSET(sd->fd,packet_len_table[0x101]);
}
return 0;
}
@@ -5871,11 +5628,11 @@ int clif_party_leaved(struct party *p,struct map_session_data *sd,int account_id
for(i=0;i<MAX_PARTY;i++)
if((sd=p->member[i].sd)!=NULL)
break;
- if(sd!=NULL)
- clif_send(buf,packet_db[0x105].len,&sd->bl,PARTY);
- }else if(sd!=NULL){
- memcpy(WFIFOP(sd->fd,0),buf,packet_db[0x105].len);
- WFIFOSET(sd->fd,packet_db[0x105].len);
+ if (sd!=NULL)
+ clif_send(buf,packet_len_table[0x105],&sd->bl,PARTY);
+ } else if (sd!=NULL) {
+ memcpy(WFIFOP(sd->fd,0),buf,packet_len_table[0x105]);
+ WFIFOSET(sd->fd,packet_len_table[0x105]);
}
return 0;
}
@@ -5918,7 +5675,7 @@ int clif_party_xy(struct party *p,struct map_session_data *sd)
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);
+ clif_send(buf,packet_len_table[0x107],&sd->bl,PARTY_SAMEMAP_WOS);
// if(battle_config.etc_log)
// printf("clif_party_xy %d\n",sd->status.account_id);
return 0;
@@ -5937,7 +5694,7 @@ int clif_party_hp(struct party *p,struct map_session_data *sd)
WBUFL(buf,2)=sd->status.account_id;
WBUFW(buf,6)=(sd->status.hp > 0x7fff)? 0x7fff:sd->status.hp;
WBUFW(buf,8)=(sd->status.max_hp > 0x7fff)? 0x7fff:sd->status.max_hp;
- clif_send(buf,packet_db[0x106].len,&sd->bl,PARTY_AREA_WOS);
+ clif_send(buf,packet_len_table[0x106],&sd->bl,PARTY_AREA_WOS);
// if(battle_config.etc_log)
// printf("clif_party_hp %d\n",sd->status.account_id);
return 0;
@@ -5962,7 +5719,7 @@ int clif_party_move(struct party *p,struct map_session_data *sd,int online)
memcpy(WBUFP(buf,15),p->name,24);
memcpy(WBUFP(buf,39),sd->status.name,24);
memcpy(WBUFP(buf,63),map[sd->bl.m].name,16);
- clif_send(buf,packet_db[0x104].len,&sd->bl,PARTY);
+ clif_send(buf,packet_len_table[0x104],&sd->bl,PARTY);
return 0;
}
/*==========================================
@@ -5984,7 +5741,7 @@ int clif_movetoattack(struct map_session_data *sd,struct block_list *bl)
WFIFOW(fd,10)=sd->bl.x;
WFIFOW(fd,12)=sd->bl.y;
WFIFOW(fd,14)=sd->attackrange;
- WFIFOSET(fd,packet_db[0x139].len);
+ WFIFOSET(fd,packet_len_table[0x139]);
return 0;
}
/*==========================================
@@ -6009,7 +5766,7 @@ int clif_produceeffect(struct map_session_data *sd,int flag,int nameid)
WFIFOW(fd, 4)=view;
else
WFIFOW(fd, 4)=nameid;
- WFIFOSET(fd,packet_db[0x18f].len);
+ WFIFOSET(fd,packet_len_table[0x18f]);
return 0;
}
@@ -6022,7 +5779,7 @@ int clif_catch_process(struct map_session_data *sd)
fd=sd->fd;
WFIFOW(fd,0)=0x19e;
- WFIFOSET(fd,packet_db[0x19e].len);
+ WFIFOSET(fd,packet_len_table[0x19e]);
return 0;
}
@@ -6036,7 +5793,7 @@ int clif_pet_rulet(struct map_session_data *sd,int data)
fd=sd->fd;
WFIFOW(fd,0)=0x1a0;
WFIFOB(fd,2)=data;
- WFIFOSET(fd,packet_db[0x1a0].len);
+ WFIFOSET(fd,packet_len_table[0x1a0]);
return 0;
}
@@ -6058,7 +5815,7 @@ int clif_sendegg(struct map_session_data *sd)
for(i=0,n=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid<=0 || sd->inventory_data[i] == NULL ||
sd->inventory_data[i]->type!=7 ||
- sd->status.inventory[i].amount<=0)
+ sd->status.inventory[i].amount<=0)
continue;
WFIFOW(fd,n*2+4)=i+2;
n++;
@@ -6081,7 +5838,7 @@ int clif_send_petdata(struct map_session_data *sd,int type,int param)
WFIFOB(fd,2)=type;
WFIFOL(fd,3)=sd->pd->bl.id;
WFIFOL(fd,7)=param;
- WFIFOSET(fd,packet_db[0x1a4].len);
+ WFIFOSET(fd,packet_len_table[0x1a4]);
return 0;
}
@@ -6100,7 +5857,7 @@ int clif_send_petstatus(struct map_session_data *sd)
WFIFOW(fd,29)=sd->pet.hungry;
WFIFOW(fd,31)=sd->pet.intimate;
WFIFOW(fd,33)=sd->pet.equip;
- WFIFOSET(fd,packet_db[0x1a2].len);
+ WFIFOSET(fd,packet_len_table[0x1a2]);
return 0;
}
@@ -6117,7 +5874,7 @@ int clif_pet_emotion(struct pet_data *pd,int param)
nullpo_retr(0, pd);
nullpo_retr(0, sd = pd->msd);
- memset(buf,0,packet_db[0x1aa].len);
+ memset(buf,0,packet_len_table[0x1aa]);
WBUFW(buf,0)=0x1aa;
WBUFL(buf,2)=pd->bl.id;
@@ -6131,7 +5888,7 @@ int clif_pet_emotion(struct pet_data *pd,int param)
}
WBUFL(buf,6)=param;
- clif_send(buf,packet_db[0x1aa].len,&pd->bl,AREA);
+ clif_send(buf,packet_len_table[0x1aa],&pd->bl,AREA);
return 0;
}
@@ -6142,14 +5899,14 @@ int clif_pet_performance(struct block_list *bl,int param)
nullpo_retr(0, bl);
- memset(buf,0,packet_db[0x1a4].len);
+ memset(buf,0,packet_len_table[0x1a4]);
WBUFW(buf,0)=0x1a4;
WBUFB(buf,2)=4;
WBUFL(buf,3)=bl->id;
WBUFL(buf,7)=param;
- clif_send(buf,packet_db[0x1a4].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x1a4],bl,AREA);
return 0;
}
@@ -6161,7 +5918,7 @@ int clif_pet_equip(struct pet_data *pd,int nameid)
nullpo_retr(0, pd);
- memset(buf,0,packet_db[0x1a4].len);
+ memset(buf,0,packet_len_table[0x1a4]);
WBUFW(buf,0)=0x1a4;
WBUFB(buf,2)=3;
@@ -6171,7 +5928,7 @@ int clif_pet_equip(struct pet_data *pd,int nameid)
else
WBUFL(buf,7)=nameid;
- clif_send(buf,packet_db[0x1a4].len,&pd->bl,AREA);
+ clif_send(buf,packet_len_table[0x1a4],&pd->bl,AREA);
return 0;
}
@@ -6186,7 +5943,7 @@ int clif_pet_food(struct map_session_data *sd,int foodid,int fail)
WFIFOW(fd,0)=0x1a3;
WFIFOB(fd,2)=fail;
WFIFOW(fd,3)=foodid;
- WFIFOSET(fd,packet_db[0x1a3].len);
+ WFIFOSET(fd,packet_len_table[0x1a3]);
return 0;
}
@@ -6233,7 +5990,7 @@ int clif_autospell(struct map_session_data *sd,int skilllv)
else
WFIFOL(fd,26)= 0x00000000;
- WFIFOSET(fd,packet_db[0x1cd].len);
+ WFIFOSET(fd,packet_len_table[0x1cd]);
return 0;
}
@@ -6257,7 +6014,7 @@ int clif_devotion(struct map_session_data *sd,int target)
WBUFB(buf,26)=8;
WBUFB(buf,27)=0;
- clif_send(buf,packet_db[0x1cf].len,&sd->bl,AREA);
+ clif_send(buf,packet_len_table[0x1cf],&sd->bl,AREA);
return 0;
}
@@ -6274,7 +6031,7 @@ int clif_spiritball(struct map_session_data *sd)
WBUFW(buf,0)=0x1d0;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=sd->spiritball;
- clif_send(buf,packet_db[0x1d0].len,&sd->bl,AREA);
+ clif_send(buf,packet_len_table[0x1d0],&sd->bl,AREA);
return 0;
}
@@ -6291,7 +6048,7 @@ int clif_combo_delay(struct block_list *bl,int wait)
WBUFW(buf,0)=0x1d2;
WBUFL(buf,2)=bl->id;
WBUFL(buf,6)=wait;
- clif_send(buf,packet_db[0x1d2].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x1d2],bl,AREA);
return 0;
}
@@ -6312,7 +6069,7 @@ int clif_bladestop(struct block_list *src,struct block_list *dst,
WBUFL(buf,6)=dst->id;
WBUFL(buf,10)=bool;
- clif_send(buf,packet_db[0x1d1].len,src,AREA);
+ clif_send(buf,packet_len_table[0x1d1],src,AREA);
return 0;
}
@@ -6335,9 +6092,9 @@ int clif_changemapcell(int m,int x,int y,int cell_type,int type)
WBUFW(buf,6) = cell_type;
memcpy(WBUFP(buf,8),map[m].name,16);
if(!type)
- clif_send(buf,packet_db[0x192].len,&bl,AREA);
+ clif_send(buf,packet_len_table[0x192],&bl,AREA);
else
- clif_send(buf,packet_db[0x192].len,&bl,ALL_SAMEMAP);
+ clif_send(buf,packet_len_table[0x192],&bl,ALL_SAMEMAP);
return 0;
}
@@ -6354,7 +6111,7 @@ int clif_mvp_effect(struct map_session_data *sd)
WBUFW(buf,0)=0x10c;
WBUFL(buf,2)=sd->bl.id;
- clif_send(buf,packet_db[0x10c].len,&sd->bl,AREA);
+ clif_send(buf,packet_len_table[0x10c],&sd->bl,AREA);
return 0;
}
/*==========================================
@@ -6373,7 +6130,7 @@ int clif_mvp_item(struct map_session_data *sd,int nameid)
WFIFOW(fd,2)=view;
else
WFIFOW(fd,2)=nameid;
- WFIFOSET(fd,packet_db[0x10a].len);
+ WFIFOSET(fd,packet_len_table[0x10a]);
return 0;
}
/*==========================================
@@ -6389,7 +6146,7 @@ int clif_mvp_exp(struct map_session_data *sd,int exp)
fd=sd->fd;
WFIFOW(fd,0)=0x10b;
WFIFOL(fd,2)=exp;
- WFIFOSET(fd,packet_db[0x10b].len);
+ WFIFOSET(fd,packet_len_table[0x10b]);
return 0;
}
@@ -6406,7 +6163,7 @@ int clif_guild_created(struct map_session_data *sd,int flag)
fd=sd->fd;
WFIFOW(fd,0)=0x167;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x167].len);
+ WFIFOSET(fd,packet_len_table[0x167]);
return 0;
}
/*==========================================
@@ -6423,13 +6180,13 @@ int clif_guild_belonginfo(struct map_session_data *sd,struct guild *g)
fd=sd->fd;
ps=guild_getposition(sd,g);
- memset(WFIFOP(fd,0),0,packet_db[0x16c].len);
+ memset(WFIFOP(fd,0),0,packet_len_table[0x16c]);
WFIFOW(fd,0)=0x16c;
WFIFOL(fd,2)=g->guild_id;
WFIFOL(fd,6)=g->emblem_id;
WFIFOL(fd,10)=g->position[ps].mode;
memcpy(WFIFOP(fd,19),g->name,24);
- WFIFOSET(fd,packet_db[0x16c].len);
+ WFIFOSET(fd,packet_len_table[0x16c]);
return 0;
}
/*==========================================
@@ -6449,9 +6206,9 @@ int clif_guild_memberlogin_notice(struct guild *g,int idx,int flag)
if(g->member[idx].sd==NULL){
struct map_session_data *sd=guild_getavailablesd(g);
if(sd!=NULL)
- clif_send(buf,packet_db[0x16d].len,&sd->bl,GUILD);
+ clif_send(buf,packet_len_table[0x16d],&sd->bl,GUILD);
}else
- clif_send(buf,packet_db[0x16d].len,&g->member[idx].sd->bl,GUILD_WOS);
+ clif_send(buf,packet_len_table[0x16d],&g->member[idx].sd->bl,GUILD_WOS);
return 0;
}
/*==========================================
@@ -6471,7 +6228,7 @@ int clif_guild_masterormember(struct map_session_data *sd)
type=0xd7;
WFIFOW(fd,0)=0x14e;
WFIFOL(fd,2)=type;
- WFIFOSET(fd,packet_db[0x14e].len);
+ WFIFOSET(fd,packet_len_table[0x14e]);
return 0;
}
/*==========================================
@@ -6505,7 +6262,7 @@ int clif_guild_basicinfo(struct map_session_data *sd)
WFIFOL(fd,42)=0; // 人数?
memcpy(WFIFOP(fd,46),g->name,24);
memcpy(WFIFOP(fd,70),g->master,24);
- memcpy(WFIFOP(fd,94),"",20); // 本拠地
+
for(i=0;i<MAX_GUILDCASTLE;i++){
gc=guild_castle_search(i);
if(!gc) continue;
@@ -6539,7 +6296,7 @@ int clif_guild_basicinfo(struct map_session_data *sd)
else if (t==MAX_GUILDCASTLE) memcpy(WFIFOP(fd,94),"Total Domination",20);
else memcpy(WFIFOP(fd,94),"None Taken",20);
- WFIFOSET(fd,packet_db[WFIFOW(fd,0)].len);
+ WFIFOSET(fd,packet_len_table[WFIFOW(fd,0)]);
clif_guild_emblem(sd,g); // Guild emblem vanish fix [Valaris]
return 0;
}
@@ -6817,7 +6574,7 @@ int clif_guild_notice(struct map_session_data *sd,struct guild *g)
WFIFOW(fd,0)=0x16f;
memcpy(WFIFOP(fd,2),g->mes1,60);
memcpy(WFIFOP(fd,62),g->mes2,120);
- WFIFOSET(fd,packet_db[0x16f].len);
+ WFIFOSET(fd,packet_len_table[0x16f]);
return 0;
}
@@ -6836,7 +6593,7 @@ int clif_guild_invite(struct map_session_data *sd,struct guild *g)
WFIFOW(fd,0)=0x16a;
WFIFOL(fd,2)=g->guild_id;
memcpy(WFIFOP(fd,6),g->name,24);
- WFIFOSET(fd,packet_db[0x16a].len);
+ WFIFOSET(fd,packet_len_table[0x16a]);
return 0;
}
/*==========================================
@@ -6852,7 +6609,7 @@ int clif_guild_inviteack(struct map_session_data *sd,int flag)
fd=sd->fd;
WFIFOW(fd,0)=0x169;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x169].len);
+ WFIFOSET(fd,packet_len_table[0x169]);
return 0;
}
/*==========================================
@@ -6868,7 +6625,7 @@ int clif_guild_leave(struct map_session_data *sd,const char *name,const char *me
WBUFW(buf, 0)=0x15a;
memcpy(WBUFP(buf, 2),name,24);
memcpy(WBUFP(buf,26),mes,40);
- clif_send(buf,packet_db[0x15a].len,&sd->bl,GUILD);
+ clif_send(buf,packet_len_table[0x15a],&sd->bl,GUILD);
return 0;
}
/*==========================================
@@ -6886,7 +6643,7 @@ int clif_guild_explusion(struct map_session_data *sd,const char *name,const char
memcpy(WBUFP(buf, 2),name,24);
memcpy(WBUFP(buf,26),mes,40);
memcpy(WBUFP(buf,66),"dummy",24);
- clif_send(buf,packet_db[0x15c].len,&sd->bl,GUILD);
+ clif_send(buf,packet_len_table[0x15c],&sd->bl,GUILD);
return 0;
}
/*==========================================
@@ -6927,20 +6684,19 @@ int clif_guild_explusionlist(struct map_session_data *sd)
int clif_guild_message(struct guild *g,int account_id,const char *mes,int len)
{
struct map_session_data *sd;
- //unsigned char lbuf[255];
- //unsigned char *buf = lbuf;
- //if (len + 32 >= sizeof(lbuf))
- // buf = malloc(len + 32);
- unsigned char buf[len+32];
+ unsigned char *buf;
- WBUFW(buf, 0)=0x17f;
- WBUFW(buf, 2)=len+4;
- memcpy(WBUFP(buf,4),mes,len);
+ buf = (unsigned char*)aCalloc(len + 4, sizeof(unsigned char));
+
+ WBUFW(buf, 0) = 0x17f;
+ WBUFW(buf, 2) = len + 4;
+ memcpy(WBUFP(buf,4), mes, len);
+
+ if ((sd = guild_getavailablesd(g)) != NULL)
+ clif_send(buf, WBUFW(buf,2), &sd->bl, GUILD);
+
+ if(buf) free(buf);
- if( (sd=guild_getavailablesd(g))!=NULL )
- clif_send(buf,WBUFW(buf,2),&sd->bl,GUILD);
- //if ( buf != lbuf)
- // free(buf);
return 0;
}
/*==========================================
@@ -6977,7 +6733,7 @@ int clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char
WFIFOW(fd,0)=0x171;
WFIFOL(fd,2)=account_id;
memcpy(WFIFOP(fd,6),name,24);
- WFIFOSET(fd,packet_db[0x171].len);
+ WFIFOSET(fd,packet_len_table[0x171]);
return 0;
}
/*==========================================
@@ -6993,7 +6749,7 @@ int clif_guild_allianceack(struct map_session_data *sd,int flag)
fd=sd->fd;
WFIFOW(fd,0)=0x173;
WFIFOL(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x173].len);
+ WFIFOSET(fd,packet_len_table[0x173]);
return 0;
}
/*==========================================
@@ -7010,7 +6766,7 @@ int clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
WFIFOW(fd,0)=0x184;
WFIFOL(fd,2)=guild_id;
WFIFOL(fd,6)=flag;
- WFIFOSET(fd,packet_db[0x184].len);
+ WFIFOSET(fd,packet_len_table[0x184]);
return 0;
}
/*==========================================
@@ -7026,7 +6782,7 @@ int clif_guild_oppositionack(struct map_session_data *sd,int flag)
fd=sd->fd;
WFIFOW(fd,0)=0x181;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x181].len);
+ WFIFOSET(fd,packet_len_table[0x181]);
return 0;
}
/*==========================================
@@ -7040,7 +6796,7 @@ int clif_guild_oppositionack(struct map_session_data *sd,int flag)
WBUFL(fd,2)=g->alliance[idx].opposition;
WBUFL(fd,6)=g->alliance[idx].guild_id;
memcpy(WBUFP(fd,10),g->alliance[idx].name,24);
- clif_send(buf,packet_db[0x185].len,guild_getavailablesd(g),GUILD);
+ clif_send(buf,packet_len_table[0x185],guild_getavailablesd(g),GUILD);
return 0;
}*/
@@ -7057,7 +6813,7 @@ int clif_guild_broken(struct map_session_data *sd,int flag)
fd=sd->fd;
WFIFOW(fd,0)=0x15e;
WFIFOL(fd,2)=flag;
- WFIFOSET(fd,packet_db[0x15e].len);
+ WFIFOSET(fd,packet_len_table[0x15e]);
return 0;
}
@@ -7074,7 +6830,7 @@ void clif_emotion(struct block_list *bl,int type)
WBUFW(buf,0)=0xc0;
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=type;
- clif_send(buf,packet_db[0xc0].len,bl,AREA);
+ clif_send(buf,packet_len_table[0xc0],bl,AREA);
}
/*==========================================
@@ -7090,22 +6846,21 @@ void clif_talkiebox(struct block_list *bl,char* talkie)
WBUFW(buf,0)=0x191;
WBUFL(buf,2)=bl->id;
memcpy(WBUFP(buf,6),talkie,80);
- clif_send(buf,packet_db[0x191].len,bl,AREA);
+ clif_send(buf,packet_len_table[0x191],bl,AREA);
}
/*==========================================
* 結婚エフェクト
*------------------------------------------
*/
-void clif_wedding_effect(struct block_list *bl)
-{
+void clif_wedding_effect(struct block_list *bl) {
unsigned char buf[6];
nullpo_retv(bl);
- WBUFW(buf,0)=0x1ea;
- WBUFL(buf,2)=bl->id;
- clif_send(buf,packet_db[0x1ea].len,bl,AREA);
+ WBUFW(buf,0) = 0x1ea;
+ WBUFL(buf,2) = bl->id;
+ clif_send(buf, packet_len_table[0x1ea], bl, AREA);
}
/*==========================================
* あなたに逢いたい使用時名前叫び
@@ -7128,7 +6883,7 @@ void clif_callpartner(struct map_session_data *sd)
chrif_searchcharid(sd->status.partner_id);
WBUFB(buf,2) = 0;
}
- clif_send(buf,packet_db[0x1e6].len,&sd->bl,AREA);
+ clif_send(buf,packet_len_table[0x1e6]&sd->bl,AREA);
}
return;
}
@@ -7146,30 +6901,28 @@ void clif_sitting(struct map_session_data *sd)
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
WBUFB(buf,26) = 2;
- //clif_send(buf, packet_len_table[0x8a], &sd->bl, AREA);
- clif_send(buf, packet_db[0x8a].len, &sd->bl, AREA);
+ clif_send(buf, packet_len_table[0x8a], &sd->bl, AREA);
}
/*==========================================
*
*------------------------------------------
*/
-int clif_disp_onlyself(struct map_session_data *sd,char *mes,int len)
+int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len)
{
- //unsigned char lbuf[255];
- //unsigned char *buf = (len + 32 >= sizeof(lbuf)) ? malloc(len + 32) : lbuf;
- unsigned char buf[len+32];
+ unsigned char *buf;
nullpo_retr(0, sd);
- WBUFW(buf, 0)=0x17f;
- WBUFW(buf, 2)=len+8;
- memcpy(WBUFP(buf,4),mes,len+4);
+ buf = (unsigned char*)aCalloc(len + 8, sizeof(unsigned char));
+
+ WBUFW(buf, 0) = 0x17f;
+ WBUFW(buf, 2) = len + 8;
+ memcpy(WBUFP(buf,4), mes, len + 4);
- clif_send(buf,WBUFW(buf,2),&sd->bl,SELF);
+ clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
- //if (buf != lbuf)
- // free(buf);
+ if(buf) free(buf);
return 0;
}
@@ -7179,32 +6932,32 @@ int clif_disp_onlyself(struct map_session_data *sd,char *mes,int len)
*------------------------------------------
*/
-int clif_GM_kickack(struct map_session_data *sd,int id)
+int clif_GM_kickack(struct map_session_data *sd, int id)
{
int fd;
nullpo_retr(0, sd);
- fd=sd->fd;
- WFIFOW(fd,0)=0xcd;
- WFIFOL(fd,2)=id;
- WFIFOSET(fd,packet_db[0xcd].len);
+ fd = sd->fd;
+ WFIFOW(fd,0) = 0xcd;
+ WFIFOL(fd,2) = id;
+ WFIFOSET(fd, packet_len_table[0xcd]);
return 0;
}
+void clif_parse_QuitGame(int fd,struct map_session_data *sd);
+
int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int type)
{
- int fd;
nullpo_retr(0, tsd);
if(type)
clif_GM_kickack(sd,tsd->status.account_id);
tsd->opt1 = tsd->opt2 = 0;
- fd = tsd->fd;
- WFIFOW(fd,0)=0x18b;
- WFIFOW(fd,2)=0;
- WFIFOSET(fd,packet_db[0x18b].len);
- clif_setwaitclose(fd);
+ WFIFOW(tsd->fd,0) = 0x18b;
+ WFIFOW(tsd->fd,2) = 0;
+ WFIFOSET(tsd->fd,packet_len_table[0x18b]);
+ clif_setwaitclose(tsd->fd);
return 0;
}
@@ -7222,7 +6975,7 @@ int clif_wisexin(struct map_session_data *sd,int type,int flag)
WFIFOW(fd,0)=0xd1;
WFIFOB(fd,2)=type;
WFIFOB(fd,3)=flag;
- WFIFOSET(fd,packet_db[0xd1].len);
+ WFIFOSET(fd,packet_len_table[0xd1]);
return 0;
}
@@ -7240,7 +6993,7 @@ int clif_wisall(struct map_session_data *sd,int type,int flag)
WFIFOW(fd,0)=0xd2;
WFIFOB(fd,2)=type;
WFIFOB(fd,3)=flag;
- WFIFOSET(fd,packet_db[0xd2].len);
+ WFIFOSET(fd,packet_len_table[0xd2]);
return 0;
}
@@ -7261,7 +7014,7 @@ void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *na
WFIFOB(fd,26)=type;
WFIFOL(fd,27)=0;
WFIFOL(fd,31)=bl->id;
- WFIFOSET(fd,packet_db[0x1d3].len);
+ WFIFOSET(fd,packet_len_table[0x1d3]);
return;
}
@@ -7271,25 +7024,25 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) {
nullpo_retr(0, bl);
- memset(buf, 0, packet_db[0x1f3].len);
+ memset(buf, 0, packet_len_table[0x1f3]);
WBUFW(buf,0) = 0x1f3;
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = type;
- if (flag==2) {
- struct map_session_data *sd=NULL;
+ if (flag == 2) {
+ struct map_session_data *sd;
int i;
- for(i=0; i < fd_max; i++) {
+ for(i = 0; i < fd_max; i++) {
if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m)
- clif_specialeffect(&sd->bl,type,1);
+ clif_specialeffect(&sd->bl, type, 1);
}
}
-
- else if (flag==1)
- clif_send(buf, packet_db[0x1f3].len, bl, SELF);
+
+ else if (flag == 1)
+ clif_send(buf, packet_len_table[0x1f3], bl, SELF);
else if (!flag)
- clif_send(buf, packet_db[0x1f3].len, bl, AREA);
+ clif_send(buf, packet_len_table[0x1f3], bl, AREA);
return 0;
@@ -7302,43 +7055,100 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) {
*
*------------------------------------------
*/
-void clif_parse_WantToConnection(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_WantToConnection(int fd, struct map_session_data *sd)
{
struct map_session_data *old_sd;
- int account_id,char_id,login_id1,sex;
- unsigned int client_tick;
+ int account_id; // account_id in the packet 0x72 or 0x7E
- if(sd){
- if(battle_config.error_log)
+ if (sd) {
+ if (battle_config.error_log)
printf("clif_parse_WantToConnection : invalid request?\n");
return;
}
- sd=session[fd]->session_data=(struct map_session_data *)aCalloc(1,sizeof(struct map_session_data));
- if (sd == NULL) {
- printf("out of memory : clif_parse_WantToConnection\n");
- exit(1);
- }
- sd->fd = fd;
+ // 0x72
+ if (RFIFOW(fd,0) == 0x72) {
+ //printf("Received bytes %d with packet 0x72.\n", RFIFOREST(fd));
+ if (RFIFOREST(fd) >= 39 && (RFIFOB(fd,38) == 0 || RFIFOB(fd,38) == 1)) // 00 = Female, 01 = Male
+ account_id = RFIFOL(fd,12);
+ else if (RFIFOREST(fd) >= 22 && (RFIFOB(fd,21) == 0 || RFIFOB(fd,21) == 1)) // 00 = Female, 01 = Male
+ account_id = RFIFOL(fd,5);
+ else // old packet version
+ account_id = RFIFOL(fd,2);
+ // 0x7E
+ } else if (RFIFOW(fd,0) == 0x7E) {
+ //printf("Received bytes %d with packet 0x7E.\n", RFIFOREST(fd));
+ if (RFIFOREST(fd) >= 37 && (RFIFOB(fd,36) == 0 || RFIFOB(fd,36) == 1)) // 00 = Female, 01 = Male
+ account_id = RFIFOL(fd,9);
+ else
+ account_id = RFIFOL(fd,12);
+ // 0xF5
+ } else {
+ //printf("Received bytes %d with packet 0xF5.\n", RFIFOREST(fd));
+ if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) // 00 = Female, 01 = Male
+ account_id = RFIFOL(fd,7);
+ else if (RFIFOREST(fd) >= 33 && (RFIFOB(fd,32) == 0 || RFIFOB(fd,32) == 1)) // 00 = Female, 01 = Male
+ account_id = RFIFOL(fd,12);
+ else if (RFIFOREST(fd) >= 32 && (RFIFOB(fd,31) == 0 || RFIFOB(fd,31) == 1)) // 00 = Female, 01 = Male
+ account_id = RFIFOL(fd,10);
+ else // 29 28 28
+ account_id = RFIFOL(fd,5);
+ }
+
+ // if same account already connected, we disconnect the 2 sessions
+ if ((old_sd = map_id2sd(account_id)) != NULL) {
+ clif_authfail_fd(fd, 2); // same id
+ clif_authfail_fd(old_sd->fd, 2); // same id
+ printf("clif_parse_WantToConnection: Double connection for account %d (sessions: #%d (new) and #%d (old)).\n", account_id, fd, old_sd->fd);
+ } else {
+ sd = session[fd]->session_data = (struct map_session_data*)aCalloc(1, sizeof(struct map_session_data));
+ sd->fd = fd;
+
+ // 0x72
+ if (RFIFOW(fd,0) == 0x72) {
+ if (RFIFOREST(fd) >= 39 && (RFIFOB(fd,38) == 0 || RFIFOB(fd,38) == 1)) { // 00 = Female, 01 = Male
+ sd->packet_ver = 7; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,22), RFIFOL(fd,30), RFIFOL(fd,34), RFIFOB(fd,38), fd);
+ } else if (RFIFOREST(fd) >= 22 && (RFIFOB(fd,21) == 0 || RFIFOB(fd,21) == 1)) { // 00 = Female, 01 = Male
+ sd->packet_ver = 6; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,9), RFIFOL(fd,13), RFIFOL(fd,17), RFIFOB(fd,21), fd);
+ } else { // old packet version
+ sd->packet_ver = 5; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOB(fd,18), fd);
+ }
+ // 0x7E
+ } else if (RFIFOW(fd,0) == 0x7E) {
+ if (RFIFOREST(fd) >= 37 && (RFIFOB(fd,36) == 0 || RFIFOB(fd,36) == 1)) { // 00 = Female, 01 = Male
+ sd->packet_ver = 9; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,21), RFIFOL(fd,28), RFIFOL(fd,32), RFIFOB(fd,36), fd);
+ } else {
+ sd->packet_ver = 8; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,18), RFIFOL(fd,24), RFIFOL(fd,28), RFIFOB(fd,32), fd);
+ }
+ // 0xF5
+ } else {
+ if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) { // 00 = Female, 01 = Male
+ sd->packet_ver = 10; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,15), RFIFOL(fd,25), RFIFOL(fd,29), RFIFOB(fd,33), fd);
+ } else if (RFIFOREST(fd) >= 33 && (RFIFOB(fd,32) == 0 || RFIFOB(fd,32) == 1)) { // 00 = Female, 01 = Male
+ sd->packet_ver = 12; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,18), RFIFOL(fd,24), RFIFOL(fd,28), RFIFOB(fd,32), fd);
+ } else if (RFIFOREST(fd) >= 32 && (RFIFOB(fd,31) == 0 || RFIFOB(fd,31) == 1)) { // 00 = Female, 01 = Male
+ sd->packet_ver = 11; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,17), RFIFOL(fd,23), RFIFOL(fd,27), RFIFOB(fd,31), fd);
+ } else { // 29
+ sd->packet_ver = 13; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ pc_setnewpc(sd, account_id, RFIFOL(fd,14), RFIFOL(fd,20), RFIFOL(fd,24), RFIFOB(fd,28), fd);
+ }
+ }
- 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]);
+ WFIFOL(fd,0) = sd->bl.id;
+ WFIFOSET(fd,4);
- pc_setnewpc(sd,account_id,char_id,login_id1,client_tick,sex,fd);
- if((old_sd=map_id2sd(account_id)) != NULL){
- // if same account already connected, we disconnect the 2 sessions
- old_sd->new_fd=fd;
- } else {
map_addiddb(&sd->bl);
- }
- chrif_authreq(sd);
-
- WFIFOL(fd,0)=sd->bl.id;
- WFIFOSET(fd,4);
+ chrif_authreq(sd);
+ }
return;
}
@@ -7348,7 +7158,7 @@ void clif_parse_WantToConnection(int fd,struct map_session_data *sd, int cmd)
* map侵入時に必要なデータを全て送りつける
*------------------------------------------
*/
-void clif_parse_LoadEndAck(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
{
// struct item_data* item;
int i;
@@ -7491,12 +7301,33 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_TickSend(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_TickSend(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- sd->client_tick=RFIFOL(fd,packet_db[cmd].pos[0]);
- sd->server_tick=gettick();
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 8:
+ sd->client_tick = RFIFOL(fd,6);
+ break;
+ case 9:
+ sd->client_tick = RFIFOL(fd,9);
+ break;
+ case 10:
+ sd->client_tick = RFIFOL(fd,7);
+ break;
+ case 11:
+ sd->client_tick = RFIFOL(fd,10);
+ break;
+ case 12:
+ sd->client_tick = RFIFOL(fd,6);
+ break;
+ case 13:
+ sd->client_tick = RFIFOL(fd,5);
+ break;
+ default: // old version by default (and version 6 + 7)
+ sd->client_tick = RFIFOL(fd,2);
+ break;
+ }
+ sd->server_tick = gettick();
clif_servertick(sd);
}
@@ -7504,50 +7335,84 @@ void clif_parse_TickSend(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_WalkToXY(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
int x, y;
nullpo_retv(sd);
- if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ if (pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl, 1);
return;
}
if (sd->npc_id != 0 || sd->vender_id != 0)
return;
- if(sd->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) <= 0) // フリーキャスト
+ if (sd->skilltimer != -1 && pc_checkskill(sd, SA_FREECAST) <= 0) // フリーキャスト
return;
- if(sd->chatID)
+ if (sd->chatID)
return;
- if(sd->canmove_tick > gettick())
+ if (sd->canmove_tick > gettick())
return;
// ステータス異常やハイディング中(トンネルドライブ無)で動けない
- if((sd->opt1 > 0 && sd->opt1 != 6) ||
- sd->sc_data[SC_ANKLE].timer !=-1 || //アンクルスネア
- sd->sc_data[SC_AUTOCOUNTER].timer !=-1 || //オートカウンター
- sd->sc_data[SC_TRICKDEAD].timer !=-1 || //死んだふり
- sd->sc_data[SC_BLADESTOP].timer !=-1 || //白刃取り
- sd->sc_data[SC_SPIDERWEB].timer !=-1 || //スパイダーウェッブ
- (sd->sc_data[SC_DANCING].timer !=-1 && sd->sc_data[SC_DANCING].val4) //合奏スキル演奏中は動けない
- ) //
+ if ((sd->opt1 > 0 && sd->opt1 != 6) ||
+ sd->sc_data[SC_ANKLE].timer !=-1 || //アンクルスネア
+ sd->sc_data[SC_AUTOCOUNTER].timer !=-1 || //オートカウンター
+ sd->sc_data[SC_TRICKDEAD].timer !=-1 || //死んだふり
+ sd->sc_data[SC_BLADESTOP].timer !=-1 || //白刃取り
+ sd->sc_data[SC_SPIDERWEB].timer !=-1 || //スパイダーウェッブ
+ (sd->sc_data[SC_DANCING].timer !=-1 && sd->sc_data[SC_DANCING].val4)) //合奏スキル演奏中は動けない
return;
- if( (sd->status.option&2) && pc_checkskill(sd,RG_TUNNELDRIVE) <= 0)
+ if ((sd->status.option & 2) && pc_checkskill(sd, RG_TUNNELDRIVE) <= 0)
return;
- if(sd->invincible_timer != -1)
+ if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
pc_stopattack(sd);
- x = RFIFOB(fd,packet_db[cmd].pos[0])*4+(RFIFOB(fd,packet_db[cmd].pos[0]+1)>>6);
- y = ((RFIFOB(fd,packet_db[cmd].pos[0]+1)&0x3f)<<4)+(RFIFOB(fd,packet_db[cmd].pos[0]+2)>>4);
-
- pc_walktoxy(sd,x,y);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 6:
+ x = RFIFOB(fd,5) * 4 + (RFIFOB(fd,6) >> 6);
+ y = ((RFIFOB(fd,6) & 0x3f) << 4) + (RFIFOB(fd,7) >> 4);
+ break;
+ case 7:
+ x = RFIFOB(fd,6) * 4 + (RFIFOB(fd,7) >> 6);
+ y = ((RFIFOB(fd,7) & 0x3f) << 4) + (RFIFOB(fd,8) >> 4);
+ break;
+ case 8:
+ x = RFIFOB(fd,3) * 4 + (RFIFOB(fd,4) >> 6);
+ y = ((RFIFOB(fd,4) & 0x3f) << 4) + (RFIFOB(fd,5) >> 4);
+ break;
+ case 9:
+ x = RFIFOB(fd,12) * 4 + (RFIFOB(fd,13) >> 6);
+ y = ((RFIFOB(fd,13) & 0x3f) << 4) + (RFIFOB(fd,14) >> 4);
+ break;
+ case 10:
+ x = RFIFOB(fd,6) * 4 + (RFIFOB(fd,7) >> 6);
+ y = ((RFIFOB(fd,7) & 0x3f) << 4) + (RFIFOB(fd,8) >> 4);
+ break;
+ case 11:
+ x = RFIFOB(fd,11) * 4 + (RFIFOB(fd,12) >> 6);
+ y = ((RFIFOB(fd,12) & 0x3f) << 4) + (RFIFOB(fd,13) >> 4);
+ break;
+ case 12:
+ x = RFIFOB(fd,3) * 4 + (RFIFOB(fd,4) >> 6);
+ y = ((RFIFOB(fd,4) & 0x3f) << 4) + (RFIFOB(fd,5) >> 4);
+ break;
+ case 13:
+ x = RFIFOB(fd,3) * 4 + (RFIFOB(fd,4) >> 6);
+ y = ((RFIFOB(fd,4) & 0x3f) << 4) + (RFIFOB(fd,5) >> 4);
+ break;
+ default: // old version by default
+ x = RFIFOB(fd,2) * 4 + (RFIFOB(fd,3) >> 6);
+ y = ((RFIFOB(fd,3) & 0x3f) << 4) + (RFIFOB(fd,4) >> 4);
+ break;
+ }
+ pc_walktoxy(sd, x, y);
}
@@ -7555,20 +7420,19 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd, int cmd) {
*
*------------------------------------------
*/
-void clif_parse_QuitGame(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_QuitGame(int fd, struct map_session_data *sd) {
unsigned int tick=gettick();
struct skill_unit_group* sg;
nullpo_retv(sd);
- WFIFOW(fd,0)=0x18b;
+ WFIFOW(fd,0) = 0x18b;
if ((!pc_isdead(sd) && (sd->opt1 || (sd->opt2 && !(night_flag == 1 && sd->opt2 == STATE_BLIND)))) ||
- sd->skilltimer != -1 ||
- (DIFF_TICK(tick , sd->canact_tick) < 0) ||
+ sd->skilltimer != -1 ||
+ (DIFF_TICK(tick, sd->canact_tick) < 0) ||
(sd->sc_data && sd->sc_data[SC_DANCING].timer!=-1 && sd->sc_data[SC_DANCING].val4 && (sg=(struct skill_unit_group *)sd->sc_data[SC_DANCING].val2) && sg->src_id == sd->bl.id)) {
WFIFOW(fd,2)=1;
- WFIFOSET(fd,packet_db[0x18b].len);
+ WFIFOSET(fd,packet_len_table[0x18b]);
return;
}
@@ -7579,68 +7443,89 @@ void clif_parse_QuitGame(int fd,struct map_session_data *sd, int cmd)
} else {
WFIFOW(fd,2)=1;
}
- WFIFOSET(fd,packet_db[0x18b].len);
- clif_setwaitclose(fd);
+ WFIFOSET(fd,packet_len_table[0x18b]);
+
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_GetCharNameRequest(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
struct block_list *bl;
int account_id;
- account_id = RFIFOL(fd,packet_db[cmd].pos[0]);
- bl=map_id2bl(account_id);
- if(bl==NULL)
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 8:
+ account_id = RFIFOL(fd,11);
+ break;
+ case 9:
+ account_id = RFIFOL(fd,8);
+ break;
+ case 10:
+ account_id = RFIFOL(fd,10);
+ break;
+ case 11:
+ account_id = RFIFOL(fd,6);
+ break;
+ case 12:
+ account_id = RFIFOL(fd,11);
+ break;
+ case 13:
+ account_id = RFIFOL(fd,6);
+ break;
+ default: // old version by default (+ packet version 6 and 7)
+ account_id = RFIFOL(fd,2);
+ break;
+ }
+ bl = map_id2bl(account_id);
+ if (bl == NULL)
return;
- WFIFOW(fd,0)=0x95;
- WFIFOL(fd,2)=account_id;
+ WFIFOW(fd,0) = 0x95;
+ WFIFOL(fd,2) = account_id;
- switch(bl->type){
+ switch(bl->type) {
case BL_PC:
{
- struct map_session_data *ssd=(struct map_session_data *)bl;
- struct party *p=NULL;
- struct guild *g=NULL;
-
- nullpo_retv(ssd);
-
- memcpy(WFIFOP(fd,6),ssd->status.name,24);
- if( ssd->status.guild_id>0 &&(g=guild_search(ssd->status.guild_id))!=NULL &&
- (ssd->status.party_id==0 ||(p=party_search(ssd->status.party_id))!=NULL) ){
- // ギルド所属ならパケット0195を返す
- int i,ps=-1;
- 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 )
- ps=g->member[i].position;
- }
- if(ps>=0 && ps<MAX_GUILDPOSITION){
+ struct map_session_data *ssd = (struct map_session_data *)bl;
+ struct party *p = NULL;
+ struct guild *g = NULL;
- WFIFOW(fd, 0)=0x195;
- if(p)
- memcpy(WFIFOP(fd,30),p->name,24);
- else
- WFIFOB(fd,30)=0;
- memcpy(WFIFOP(fd,54),g->name,24);
- memcpy(WFIFOP(fd,78),g->position[ps].name,24);
- WFIFOSET(fd,packet_db[0x195].len);
- break;
- }
+ nullpo_retv(ssd);
+
+ memcpy(WFIFOP(fd,6), ssd->status.name, 24);
+ if (ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL &&
+ (ssd->status.party_id == 0 || (p = party_search(ssd->status.party_id)) != NULL)) {
+ // ギルド所属ならパケット0195を返す
+ int i, ps = -1;
+ 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 )
+ ps = g->member[i].position;
}
- WFIFOSET(fd,packet_db[0x95].len);
- } break;
+ if (ps >= 0 && ps < MAX_GUILDPOSITION) {
+ WFIFOW(fd, 0) = 0x195;
+ if (p)
+ memcpy(WFIFOP(fd,30), p->name, 24);
+ else
+ WFIFOB(fd,30) = 0;
+ memcpy(WFIFOP(fd,54), g->name,24);
+ memcpy(WFIFOP(fd,78), g->position[ps].name, 24);
+ WFIFOSET(fd,packet_len_table[0x195]);
+ break;
+ }
+ }
+ WFIFOSET(fd,packet_len_table[0x95]);
+ }
+ break;
case BL_PET:
- memcpy(WFIFOP(fd,6),((struct pet_data*)bl)->name,24);
- WFIFOSET(fd,packet_db[0x95].len);
+ memcpy(WFIFOP(fd,6), ((struct pet_data*)bl)->name, 24);
+ WFIFOSET(fd,packet_len_table[0x95]);
break;
case BL_NPC:
- memcpy(WFIFOP(fd,6),((struct npc_data*)bl)->name,24);
- WFIFOSET(fd,packet_db[0x95].len);
+ memcpy(WFIFOP(fd,6), ((struct npc_data*)bl)->name, 24);
+ WFIFOSET(fd,packet_len_table[0x95]);
break;
case BL_MOB:
{
@@ -7657,9 +7542,9 @@ void clif_parse_GetCharNameRequest(int fd,struct map_session_data *sd, int cmd)
WFIFOB(fd,30) = 0;
memcpy(WFIFOP(fd,54), g->name, 24);
memcpy(WFIFOP(fd,78), gc->castle_name, 24);
- WFIFOSET(fd,packet_db[0x195].len);
+ WFIFOSET(fd,packet_len_table[0x195]);
} else {
- WFIFOSET(fd,packet_db[0x95].len);
+ WFIFOSET(fd,packet_len_table[0x95]);
}
} else if (battle_config.show_mob_hp == 1) {
char mobhp[50];
@@ -7668,15 +7553,15 @@ void clif_parse_GetCharNameRequest(int fd,struct map_session_data *sd, int cmd)
memcpy(WFIFOP(fd,30), mobhp, 24);
WFIFOB(fd,54) = 0;
WFIFOB(fd,78) = 0;
- WFIFOSET(fd,packet_db[0x195].len);
+ WFIFOSET(fd,packet_len_table[0x195]);
} else {
- WFIFOSET(fd,packet_db[0x95].len);
+ WFIFOSET(fd,packet_len_table[0x95]);
}
}
break;
default:
- if(battle_config.error_log)
- printf("clif_parse_GetCharNameRequest : bad type %d(%d)\n",bl->type,account_id);
+ if (battle_config.error_log)
+ printf("clif_parse_GetCharNameRequest : bad type %d(%d)\n", bl->type, account_id);
break;
}
}
@@ -7685,36 +7570,32 @@ void clif_parse_GetCharNameRequest(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_GlobalMessage(int fd, struct map_session_data *sd, int cmd) { // S 008c <len>.w <str>.?B
- char *message = (char *) malloc(RFIFOW(fd,2) + 128);
- char *buf = (char *) malloc(RFIFOW(fd,2) + 4);
+void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <len>.w <str>.?B
+ char *message;
+ char *buf;
nullpo_retv(sd);
- memset(message, '\0', RFIFOW(fd,packet_db[cmd].pos[0]) + 128);
- memset(buf, '\0', RFIFOW(fd,packet_db[cmd].pos[0]) + 4);
-
- if((is_atcommand(fd, sd, RFIFOP(fd, packet_db[cmd].pos[1]), 0) != AtCommand_None) ||
- ( sd->sc_data &&
- (sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
- sd->sc_data[SC_NOCHAT].timer!=-1 )) ) //チャット禁止
- {
- free(message);
- free(buf);
+ if ((is_atcommand(fd, sd, RFIFOP(fd,4), 0) != AtCommand_None) ||
+ (sd->sc_data &&
+ (sd->sc_data[SC_BERSERK].timer != -1 || //バーサーク時は会話も不可
+ sd->sc_data[SC_NOCHAT].timer != -1 ))) //チャット禁止
return;
- }
+
+ message = (char*)aCalloc(RFIFOW(fd,2) + 128, sizeof(char));
+ buf = (char*)aCalloc(RFIFOW(fd,2) + 4, sizeof(char));
//printf("clif_parse_GlobalMessage: message: '%s'.\n", RFIFOP(fd,4));
- if(strncmp(RFIFOP(fd, packet_db[cmd].pos[1]), sd->status.name, strlen(sd->status.name)) != 0) {
+ if (strncmp(RFIFOP(fd,4), sd->status.name, strlen(sd->status.name)) != 0) {
printf("Hack on global message: character '%s' (account: %d), use an other name to send a (normal) message.\n", sd->status.name, sd->status.account_id);
// information is sended to all online GM
sprintf(message, "Hack on global message (normal message): character '%s' (account: %d) uses an other name.", sd->status.name, sd->status.account_id);
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message, strlen(message) + 1);
- if (strlen(RFIFOP(fd, packet_db[cmd].pos[1])) == 0)
+ if (strlen(RFIFOP(fd,4)) == 0)
strcpy(message, " This player sends a void name and a void message.");
else
- sprintf(message, " This player sends (name:message): '%s'.", RFIFOP(fd, packet_db[cmd].pos[1]));
+ sprintf(message, " This player sends (name:message): '%s'.", RFIFOP(fd,4));
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message, strlen(message) + 1);
// message about the ban
if (battle_config.ban_spoof_namer > 0)
@@ -7739,12 +7620,12 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd, int cmd) { //
}
// send back message to the speaker
- memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,packet_db[cmd].pos[0]));
+ memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2));
WFIFOW(fd,0) = 0x8e;
WFIFOSET(fd, WFIFOW(fd,2));
- free(message);
- free(buf);
+ if(message) free(message);
+ if(buf) free(buf);
return;
}
@@ -7770,44 +7651,81 @@ int clif_message(struct block_list *bl, char* msg)
*
*------------------------------------------
*/
-void clif_parse_MapMove(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_MapMove(int fd, struct map_session_data *sd) {
// /m /mapmove (as @rura GM command)
- char mapname[32];
- int x,y;
+ char output[100];
+ char map_name[17];
+
+ nullpo_retv(sd);
- if (battle_config.atc_gmonly == 0 ||
- pc_isGM(sd) >= get_atcommand_level(AtCommand_MapMove)) {
- memcpy(mapname,RFIFOP(fd,packet_db[cmd].pos[0]),16);
- mapname[16]=0;
- x=RFIFOW(fd,packet_db[cmd].pos[1]);
- y=RFIFOW(fd,packet_db[cmd].pos[2]);
- pc_setpos(sd,mapname,x,y,2);
+ memset(output, '\0', sizeof(output));
+ memset(map_name, '\0', sizeof(map_name));
+
+ if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
+ (pc_isGM(sd) >= get_atcommand_level(AtCommand_MapMove))) {
+ memcpy(map_name, RFIFOP(fd,2), 16);
+ sprintf(output, "%s %d %d", map_name, RFIFOW(fd,18), RFIFOW(fd,20));
+ atcommand_rura(fd, sd, "@rura", output);
}
+
+ return;
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_ChangeDir(int fd,struct map_session_data *sd, int cmd)
-{
- short headdir,dir;
+void clif_parse_ChangeDir(int fd, struct map_session_data *sd) {
unsigned char buf[64];
+ short headdir, dir;
nullpo_retv(sd);
- headdir=RFIFOW(fd,packet_db[cmd].pos[0]);
- dir=RFIFOB(fd,packet_db[cmd].pos[1]);
- pc_setdir(sd,dir,headdir);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 7:
+ headdir = RFIFOW(fd,5);
+ dir = RFIFOB(fd,12);
+ break;
+ case 8:
+ headdir = RFIFOW(fd,5);
+ dir = RFIFOB(fd,12);
+ break;
+ case 9:
+ headdir = RFIFOW(fd,7);
+ dir = RFIFOB(fd,11);
+ break;
+ case 10:
+ headdir = RFIFOW(fd,4);
+ dir = RFIFOB(fd,9);
+ break;
+ case 11:
+ headdir = RFIFOW(fd,8);
+ dir = RFIFOB(fd,17);
+ break;
+ case 12:
+ headdir = RFIFOW(fd,5);
+ dir = RFIFOB(fd,12);
+ break;
+ case 13:
+ headdir = RFIFOW(fd,6);
+ dir = RFIFOB(fd,14);
+ break;
+ default: // old version by default (and packet version 6)
+ headdir = RFIFOW(fd,2);
+ dir = RFIFOB(fd,4);
+ break;
+ }
+
+ pc_setdir(sd, dir, headdir);
- WFIFOW(fd,0)=0x9c;
- WFIFOL(fd,2)=sd->bl.id;
- WFIFOW(fd,6)=headdir;
- WFIFOB(fd,8)=dir;
+ WBUFW(buf,0) = 0x9c;
+ WBUFL(buf,2) = sd->bl.id;
+ WBUFW(buf,6) = headdir;
+ WBUFB(buf,8) = dir;
if (sd->disguise > 23 && sd->disguise < 4001) // mob disguises [Valaris]
- clif_send(buf, packet_db[0x9c].len, &sd->bl, AREA);
+ clif_send(buf, packet_len_table[0x9c], &sd->bl, AREA);
else
- clif_send(buf, packet_db[0x9c].len, &sd->bl, AREA_WOS);
+ clif_send(buf, packet_len_table[0x9c], &sd->bl, AREA_WOS);
}
@@ -7815,19 +7733,16 @@ void clif_parse_ChangeDir(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_Emotion(int fd,struct map_session_data *sd, int cmd)
-{
- int emotion;
+void clif_parse_Emotion(int fd, struct map_session_data *sd) {
unsigned char buf[64];
nullpo_retv(sd);
- if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 2){
- emotion=RFIFOB(fd,packet_db[cmd].pos[0]);
+ if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 2) {
WBUFW(buf,0) = 0xc0;
WBUFL(buf,2) = sd->bl.id;
- WBUFB(buf,6) = emotion;
- clif_send(buf, packet_db[0xc0].len, &sd->bl, AREA);
+ WBUFB(buf,6) = RFIFOB(fd,2);
+ clif_send(buf, packet_len_table[0xc0], &sd->bl, AREA);
} else
clif_skill_fail(sd, 1, 0, 1);
}
@@ -7836,42 +7751,69 @@ void clif_parse_Emotion(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_HowManyConnections(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) {
WFIFOW(fd,0) = 0xc2;
WFIFOL(fd,2) = map_getusers();
- WFIFOSET(fd,packet_db[0xc2].len);
+ WFIFOSET(fd,packet_len_table[0xc2]);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_ActionRequest(int fd, struct map_session_data *sd, int cmd)
-{
+void clif_parse_ActionRequest(int fd, struct map_session_data *sd) {
unsigned int tick;
unsigned char buf[64];
int action_type, target_id;
nullpo_retv(sd);
- if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ if (pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl, 1);
return;
}
- if( sd->npc_id!=0 || sd->opt1 > 0 || sd->status.option&2 ||
- ( sd->sc_data &&
- ( sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
- sd->sc_data[SC_DANCING].timer!=-1 )) ) //ダンス中
- return;
+ if (sd->npc_id != 0 || sd->opt1 > 0 || sd->status.option & 2 ||
+ (sd->sc_data &&
+ (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
+ sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
+ sd->sc_data[SC_DANCING].timer != -1))) //ダンス中
+ return;
- tick=gettick();
+ tick = gettick();
- pc_stop_walking(sd,0);
+ pc_stop_walking(sd, 0);
pc_stopattack(sd);
- target_id = RFIFOL(fd,packet_db[cmd].pos[0]);
- action_type = RFIFOB(fd,packet_db[cmd].pos[1]);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 8:
+ target_id = RFIFOL(fd,3);
+ action_type = RFIFOB(fd,8);
+ break;
+ case 9:
+ target_id = RFIFOL(fd,7);
+ action_type = RFIFOB(fd,17);
+ break;
+ case 10:
+ target_id = RFIFOL(fd,9);
+ action_type = RFIFOB(fd,22);
+ break;
+ case 11:
+ target_id = RFIFOL(fd,3);
+ action_type = RFIFOB(fd,8);
+ break;
+ case 12:
+ target_id = RFIFOL(fd,3);
+ action_type = RFIFOB(fd,8);
+ break;
+ case 13:
+ target_id = RFIFOL(fd,4);
+ action_type = RFIFOB(fd,14);
+ break;
+ default: // old version by default (and packet version 6 and 7)
+ target_id = RFIFOL(fd,2);
+ action_type = RFIFOB(fd,6);
+ break;
+ }
switch(action_type) {
case 0x00: // once attack
@@ -7892,22 +7834,22 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd, int cmd)
sd->attacktarget = 0;
pc_attack(sd, target_id, action_type != 0);
break;
- case 0x02: // sitdown
- if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 3) {
- pc_stop_walking(sd,1);
- skill_gangsterparadise(sd,1);/* ギャングスターパラダイス設定 */
+ case 0x02: // sitdown
+ if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 3) {
+ pc_stop_walking(sd, 1);
+ skill_gangsterparadise(sd, 1); // ギャングスターパラダイス設定
pc_setsit(sd);
clif_sitting(sd);
} else
clif_skill_fail(sd, 1, 0, 2);
break;
- case 0x03: // standup
- skill_gangsterparadise(sd,0);/* ギャングスターパラダイス解除 */
+ case 0x03: // standup
+ skill_gangsterparadise(sd, 0); // ギャングスターパラダイス解除
pc_setstand(sd);
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
WBUFB(buf,26) = 3;
- clif_send(buf, packet_db[0x8a].len, &sd->bl, AREA);
+ clif_send(buf, packet_len_table[0x8a], &sd->bl, AREA);
break;
}
}
@@ -7916,18 +7858,15 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_Restart(int fd,struct map_session_data *sd, int cmd)
-{
- int restarttype=RFIFOB(fd,packet_db[cmd].pos[0]);
-
+void clif_parse_Restart(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- switch(restarttype){
+ switch(RFIFOB(fd,2)) {
case 0x00:
- if(pc_isdead(sd)){
+ if (pc_isdead(sd)) {
pc_setstand(sd);
- pc_setrestartvalue(sd,3);
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,2);
+ pc_setrestartvalue(sd, 3);
+ pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 2);
}
break;
case 0x01:
@@ -7940,10 +7879,9 @@ void clif_parse_Restart(int fd,struct map_session_data *sd, int cmd)
} else {
WFIFOW(fd,0)=0x18b;
WFIFOW(fd,2)=1;
- WFIFOSET(fd,packet_db[0x18b].len);
- return;
+
+ WFIFOSET(fd,packet_len_table[0x018b]);
}
- chrif_charselectreq(sd);
break;
}
}
@@ -7952,120 +7890,245 @@ void clif_parse_Restart(int fd,struct map_session_data *sd, int cmd)
* Transmission of a wisp (S 0096 <len>.w <nick>.24B <message>.?B)
*------------------------------------------
*/
-void clif_parse_Wis(int fd,struct map_session_data *sd, int cmd)
-{
- int len=RFIFOW(fd,packet_db[cmd].pos[0]);
+void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <nick>.24B <message>.?B // rewritten by [Yor]
+ char *gm_command;
+ struct map_session_data *dstsd;
+ int i;
- if( sd && sd->sc_data &&
- (sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
- sd->sc_data[SC_NOCHAT].timer!=-1 ) ) //チャット禁止
+ //printf("clif_parse_Wis: message: '%s'.\n", RFIFOP(fd,28));
+
+ gm_command = (char*)aCalloc(strlen(RFIFOP(fd,28)) + 28, sizeof(char)); // 24+3+(RFIFOW(fd,2)-28)+1 or 24+3+(strlen(RFIFOP(fd,28))+1 (size can be wrong with hacker)
+
+ sprintf(gm_command, "%s : %s", sd->status.name, RFIFOP(fd,28));
+ if ((is_atcommand(fd, sd, gm_command, 0) != AtCommand_None) ||
+ (sd && sd->sc_data &&
+ (sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
+ sd->sc_data[SC_NOCHAT].timer != -1))) //チャット禁止
+ {
+ if(gm_command) free(gm_command);
return;
+ }
+
+ if(gm_command) free(gm_command);
+
+ // searching destination character
+ dstsd = map_nick2sd(RFIFOP(fd,4));
+ // player is not on this map-server
+ if (dstsd == NULL ||
+ // At this point, don't send wisp/page if it's not exactly the same name, because (example)
+ // if there are 'Test' player on an other map-server and 'test' player on this map-server,
+ // and if we ask for 'Test', we must not contact 'test' player
+ // so, we send information to inter-server, which is the only one which decide (and copy correct name).
+ strcmp(dstsd->status.name, RFIFOP(fd,4)) != 0) // not exactly same name
+ // send message to inter-server
+ intif_wis_message(sd, RFIFOP(fd,4), RFIFOP(fd,28), RFIFOW(fd,2)-28);
+ // player is on this map-server
+ else {
+ // if you send to your self, don't send anything to others
+ if (dstsd->fd == fd) // but, normaly, it's impossible!
+ clif_wis_message(fd, wisp_server_name, "You can not page yourself. Sorry.", strlen("You can not page yourself. Sorry.") + 1);
+ // otherwise, send message and answer immediatly
+ else {
+ if (dstsd->ignoreAll == 1)
+ clif_wis_end(fd, 2); // type: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
+ else {
+ // if player ignore the source character
+ for(i = 0; i < MAX_IGNORE_LIST; i++)
+ if (strcmp(dstsd->ignore[i].name, sd->status.name) == 0) {
+ clif_wis_end(fd, 2); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
+ break;
+ }
+ // if source player not found in ignore list
+ if (i == MAX_IGNORE_LIST) {
+ clif_wis_message(dstsd->fd, sd->status.name, RFIFOP(fd,28), RFIFOW(fd,2) - 28);
+ clif_wis_end(fd, 0); // type: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
+ }
+ }
+ }
+ }
- intif_wis_message(sd,RFIFOP(fd,packet_db[cmd].pos[1]),RFIFOP(fd,packet_db[cmd].pos[2]),len-packet_db[cmd].pos[2]);
+ return;
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_GMmessage(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_GMmessage(int fd, struct map_session_data *sd) {
// /b
- int len;
nullpo_retv(sd);
- len=RFIFOW(fd,packet_db[cmd].pos[0]);
- if (battle_config.atc_gmonly == 0 ||
- pc_isGM(sd) >= get_atcommand_level(AtCommand_Broadcast))
- intif_GMmessage(RFIFOP(fd,packet_db[cmd].pos[1]),len-packet_db[cmd].pos[1],0);
+ if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
+ (pc_isGM(sd) >= get_atcommand_level(AtCommand_Broadcast)))
+ intif_GMmessage(RFIFOP(fd,4), RFIFOW(fd,2)-4, 0);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_TakeItem(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_TakeItem(int fd, struct map_session_data *sd) {
struct flooritem_data *fitem;
int map_object_id;
nullpo_retv(sd);
- map_object_id = RFIFOL(fd,packet_db[cmd].pos[0]);
- fitem=(struct flooritem_data*)map_id2bl(map_object_id);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 7:
+ map_object_id = RFIFOL(fd,6);
+ break;
+ case 8:
+ map_object_id = RFIFOL(fd,6);
+ break;
+ case 9:
+ map_object_id = RFIFOL(fd,9);
+ break;
+ case 10:
+ map_object_id = RFIFOL(fd,7);
+ break;
+ case 11:
+ map_object_id = RFIFOL(fd,10);
+ break;
+ case 12:
+ map_object_id = RFIFOL(fd,6);
+ break;
+ case 13:
+ map_object_id = RFIFOL(fd,5);
+ break;
+ default: // old version by default (and packet version 6)
+ map_object_id = RFIFOL(fd,2);
+ break;
+ }
+ fitem = (struct flooritem_data*)map_id2bl(map_object_id);
- if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ if (pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl, 1);
return;
}
if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
- (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer!=-1 || //オートカウンター
- sd->sc_data[SC_BLADESTOP].timer!=-1 || //白刃取り
+ (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
+ sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク
sd->sc_data[SC_NOCHAT].timer!=-1 )) ) //会話禁止
return;
- if(fitem==NULL || fitem->bl.m != sd->bl.m)
+ if (fitem == NULL || fitem->bl.m != sd->bl.m)
return;
- pc_takeitem(sd,fitem);
+ pc_takeitem(sd, fitem);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_DropItem(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_DropItem(int fd, struct map_session_data *sd) {
int item_index, item_amount;
nullpo_retv(sd);
- if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ if (pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl, 1);
return;
}
- if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
- (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer!=-1 || //オートカウンター
- sd->sc_data[SC_BLADESTOP].timer!=-1 || //白刃取り
- sd->sc_data[SC_BERSERK].timer!=-1)) ) //バーサーク
+ if (sd->npc_id != 0 || sd->vender_id != 0 || sd->opt1 > 0 ||
+ (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
+ sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
+ sd->sc_data[SC_BERSERK].timer != -1)) ) //バーサーク
return;
- item_index = RFIFOW(fd,packet_db[cmd].pos[0])-2;
- item_amount = RFIFOW(fd,packet_db[cmd].pos[1]);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 8:
+ item_index = RFIFOW(fd,5) - 2;
+ item_amount = RFIFOW(fd,12);
+ break;
+ case 9:
+ item_index = RFIFOW(fd,8) - 2;
+ item_amount = RFIFOW(fd,15);
+ break;
+ case 10:
+ item_index = RFIFOW(fd,6) - 2;
+ item_amount = RFIFOW(fd,15);
+ break;
+ case 11:
+ item_index = RFIFOW(fd,12) - 2;
+ item_amount = RFIFOW(fd,17);
+ break;
+ case 12:
+ item_index = RFIFOW(fd,5) - 2;
+ item_amount = RFIFOW(fd,12);
+ break;
+ case 13:
+ item_index = RFIFOW(fd,6) - 2;
+ item_amount = RFIFOW(fd,10);
+ break;
+ default: // old version by default (+ packet version 6 and 7)
+ item_index = RFIFOW(fd,2) - 2;
+ item_amount = RFIFOW(fd,4);
+ break;
+ }
- pc_dropitem(sd,item_index,item_amount);
+ pc_dropitem(sd, item_index, item_amount);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_UseItem(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_UseItem(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ if (pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl, 1);
return;
}
- if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
- (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
- sd->sc_data[SC_BLADESTOP].timer!=-1 || //白刃取り
+ if (sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
+ (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
+ sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク
sd->sc_data[SC_NOCHAT].timer!=-1 )) ) //会話禁止
return;
-
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- pc_useitem(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 6:
+ pc_useitem(sd,RFIFOW(fd,5)-2);
+ break;
+ case 7:
+ pc_useitem(sd,RFIFOW(fd,6)-2);
+ break;
+ case 8:
+ pc_useitem(sd,RFIFOW(fd,6)-2);
+ break;
+ case 9:
+ pc_useitem(sd,RFIFOW(fd,9)-2);
+ break;
+ case 10:
+ pc_useitem(sd,RFIFOW(fd,7)-2);
+ break;
+ case 11:
+ pc_useitem(sd,RFIFOW(fd,10)-2);
+ break;
+ case 12:
+ pc_useitem(sd,RFIFOW(fd,6)-2);
+ break;
+ case 13:
+ pc_useitem(sd,RFIFOW(fd,5)-2);
+ break;
+ default: // old version by default
+ pc_useitem(sd,RFIFOW(fd,2)-2);
+ break;
+ }
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_EquipItem(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_EquipItem(int fd,struct map_session_data *sd)
{
int index;
@@ -8075,7 +8138,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd, int cmd)
clif_clearchar_area(&sd->bl,1);
return;
}
- index = RFIFOW(fd,packet_db[cmd].pos[0])-2;
+ index = RFIFOW(fd,2)-2;
if(sd->npc_id!=0 || sd->vender_id != 0) return;
if(sd->sc_data && ( sd->sc_data[SC_BLADESTOP].timer!=-1 || sd->sc_data[SC_BERSERK].timer!=-1 )) return;
@@ -8083,17 +8146,12 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd, int cmd)
clif_equipitemack(sd,index,0,0); // fail
return;
}
-
- if(sd->status.inventory[index].attribute != 0) { // 破壊されている
- clif_equipitemack(sd,index,0,0); // fail
- return;
- }
//ペット用装備であるかないか
if(sd->inventory_data[index]) {
if(sd->inventory_data[index]->type != 8){
if(sd->inventory_data[index]->type == 10)
- RFIFOW(fd,packet_db[cmd].pos[1])=0x8000; // 矢を無理やり装備できるように(−−;
- pc_equipitem(sd,index,RFIFOW(fd,packet_db[cmd].pos[1]));
+ RFIFOW(fd,4)=0x8000; // 矢を無理やり装備できるように(−−;
+ pc_equipitem(sd,index,RFIFOW(fd,4));
} else
pet_equipitem(sd,index);
}
@@ -8103,7 +8161,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_UnequipItem(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
{
int index;
@@ -8113,8 +8171,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd, int cmd)
clif_clearchar_area(&sd->bl,1);
return;
}
-
- index = packet_db[cmd].pos[0]-2;
+ index = RFIFOW(fd,2)-2;
if(sd->status.inventory[index].attribute == 1 && sd->sc_data && sd->sc_data[SC_BROKNWEAPON].timer!=-1)
skill_status_change_end(&sd->bl,SC_BROKNWEAPON,-1);
if(sd->status.inventory[index].attribute == 1 && sd->sc_data && sd->sc_data[SC_BROKNARMOR].timer!=-1)
@@ -8122,15 +8179,16 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd, int cmd)
if(sd->sc_data && ( sd->sc_data[SC_BLADESTOP].timer!=-1 || sd->sc_data[SC_BERSERK].timer!=-1 ))
return;
- if(sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0) return;
- pc_unequipitem(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2,0);
+ if(sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0)
+ return;
+ pc_unequipitem(sd,index,0);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcClicked(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
@@ -8140,67 +8198,65 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd, int cmd)
}
if(sd->npc_id!=0 || sd->vender_id != 0)
return;
- npc_click(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+ npc_click(sd,RFIFOL(fd,2));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcBuySellSelected(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcBuySellSelected(int fd,struct map_session_data *sd)
{
- npc_buysellsel(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOB(fd,packet_db[cmd].pos[1]));
+ npc_buysellsel(sd,RFIFOL(fd,2),RFIFOB(fd,6));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcBuyListSend(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcBuyListSend(int fd,struct map_session_data *sd)
{
int fail=0,n;
unsigned short *item_list;
- n = (RFIFOW(fd,packet_db[cmd].pos[0])-4) /4;
- item_list = (unsigned short*)RFIFOP(fd,packet_db[cmd].pos[1]);
+ n = (RFIFOW(fd,2)-4) /4;
+ item_list = (unsigned short*)RFIFOP(fd,4);
fail = npc_buylist(sd,n,item_list);
WFIFOW(fd,0)=0xca;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_db[0xca].len);
+ WFIFOSET(fd,packet_len_table[0xca]);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd)
{
int fail=0,n;
unsigned short *item_list;
- n = (RFIFOW(fd,packet_db[cmd].pos[0])-4) /4;
- item_list = (unsigned short*)RFIFOP(fd,packet_db[cmd].pos[1]);
+ n = (RFIFOW(fd,2)-4) /4;
+ item_list = (unsigned short*)RFIFOP(fd,4);
fail = npc_selllist(sd,n,item_list);
WFIFOW(fd,0)=0xcb;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_db[0xcb].len);
+ WFIFOSET(fd,packet_len_table[0xcb]);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_CreateChatRoom(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_CreateChatRoom(int fd,struct map_session_data *sd)
{
if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 4){
- int len = RFIFOW(fd,packet_db[cmd].pos[0]);
- chat_createchat(sd,RFIFOW(fd,packet_db[cmd].pos[1]),RFIFOB(fd,packet_db[cmd].pos[2]),RFIFOP(fd,packet_db[cmd].pos[3]),RFIFOP(fd,packet_db[cmd].pos[4]),len-packet_db[cmd].pos[4]);
- }
- else
+ chat_createchat(sd,RFIFOW(fd,4),RFIFOB(fd,6),RFIFOP(fd,7),RFIFOP(fd,15),RFIFOW(fd,2)-15);
+ } else
clif_skill_fail(sd,1,0,3);
}
@@ -8208,44 +8264,43 @@ void clif_parse_CreateChatRoom(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_ChatAddMember(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_ChatAddMember(int fd,struct map_session_data *sd)
{
- chat_joinchat(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOP(fd,packet_db[cmd].pos[1]));
+ chat_joinchat(sd,RFIFOL(fd,2),RFIFOP(fd,6));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_ChatRoomStatusChange(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_ChatRoomStatusChange(int fd,struct map_session_data *sd)
{
- int len = RFIFOW(fd,packet_db[cmd].pos[0]);
- chat_changechatstatus(sd,RFIFOW(fd,packet_db[cmd].pos[1]),RFIFOB(fd,packet_db[cmd].pos[2]),RFIFOP(fd,packet_db[cmd].pos[3]),RFIFOP(fd,packet_db[cmd].pos[4]),len-packet_db[cmd].pos[4]);
+ chat_changechatstatus(sd,RFIFOW(fd,4),RFIFOB(fd,6),RFIFOP(fd,7),RFIFOP(fd,15),RFIFOW(fd,2)-15);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_ChangeChatOwner(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_ChangeChatOwner(int fd,struct map_session_data *sd)
{
- chat_changechatowner(sd,RFIFOP(fd,packet_db[cmd].pos[0]));
+ chat_changechatowner(sd,RFIFOP(fd,6));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_KickFromChat(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_KickFromChat(int fd,struct map_session_data *sd)
{
- chat_kickchat(sd,RFIFOP(fd,packet_db[cmd].pos[0]));
+ chat_kickchat(sd,RFIFOP(fd,2));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_ChatLeave(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_ChatLeave(int fd,struct map_session_data *sd)
{
chat_leavechat(sd);
}
@@ -8254,16 +8309,13 @@ void clif_parse_ChatLeave(int fd,struct map_session_data *sd, int cmd)
* 取引要請を相手に送る
*------------------------------------------
*/
-void clif_parse_TradeRequest(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
- if(map[sd->bl.m].flag.notrade) return;
-
if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 1){
- trade_traderequest(sd,RFIFOL(sd->fd,packet_db[cmd].pos[0]));
- }
- else
+ trade_traderequest(sd,RFIFOL(sd->fd,2));
+ } else
clif_skill_fail(sd,1,0,0);
}
@@ -8271,31 +8323,29 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd, int cmd)
* 取引要請
*------------------------------------------
*/
-void clif_parse_TradeAck(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_TradeAck(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
- if(map[sd->bl.m].flag.notrade) return;
-
- trade_tradeack(sd,RFIFOB(sd->fd,packet_db[cmd].pos[0]));
+ trade_tradeack(sd,RFIFOB(sd->fd,2));
}
/*==========================================
* アイテム追加
*------------------------------------------
*/
-void clif_parse_TradeAddItem(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_TradeAddItem(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
- trade_tradeadditem(sd,RFIFOW(sd->fd,packet_db[cmd].pos[0]),RFIFOL(sd->fd,packet_db[cmd].pos[1]));
+ trade_tradeadditem(sd,RFIFOW(sd->fd,2),RFIFOL(sd->fd,4));
}
/*==========================================
* アイテム追加完了(ok押し)
*------------------------------------------
*/
-void clif_parse_TradeOk(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_TradeOk(int fd,struct map_session_data *sd)
{
trade_tradeok(sd);
}
@@ -8304,7 +8354,7 @@ void clif_parse_TradeOk(int fd,struct map_session_data *sd, int cmd)
* 取引キャンセル
*------------------------------------------
*/
-void clif_parse_TradeCancel(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_TradeCansel(int fd,struct map_session_data *sd)
{
trade_tradecancel(sd);
}
@@ -8313,7 +8363,7 @@ void clif_parse_TradeCancel(int fd,struct map_session_data *sd, int cmd)
* 取引許諾(trade押し)
*------------------------------------------
*/
-void clif_parse_TradeCommit(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_TradeCommit(int fd,struct map_session_data *sd)
{
trade_tradecommit(sd);
}
@@ -8322,7 +8372,7 @@ void clif_parse_TradeCommit(int fd,struct map_session_data *sd, int cmd)
*
*------------------------------------------
*/
-void clif_parse_StopAttack(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_StopAttack(int fd,struct map_session_data *sd)
{
pc_stopattack(sd);
}
@@ -8331,31 +8381,31 @@ void clif_parse_StopAttack(int fd,struct map_session_data *sd, int cmd)
* カートへアイテムを移す
*------------------------------------------
*/
-void clif_parse_PutItemToCart(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_PutItemToCart(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
if(sd->npc_id!=0 || sd->vender_id != 0)
return;
- pc_putitemtocart(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2,RFIFOL(fd,packet_db[cmd].pos[1]));
+ pc_putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
}
/*==========================================
* カートからアイテムを出す
*------------------------------------------
*/
-void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
if(sd->npc_id!=0 || sd->vender_id != 0) return;
- pc_getitemfromcart(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2,RFIFOL(fd,packet_db[cmd].pos[1]));
+ pc_getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
}
/*==========================================
* 付属品(鷹,ペコ,カート)をはずす
*------------------------------------------
*/
-void clif_parse_RemoveOption(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_RemoveOption(int fd,struct map_session_data *sd)
{
if(pc_isriding(sd)) { // jobchange when removing peco [Valaris]
if(sd->status.class==13)
@@ -8378,55 +8428,93 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd, int cmd)
* チェンジカート
*------------------------------------------
*/
-void clif_parse_ChangeCart(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
{
- pc_setcart(sd,RFIFOW(fd,packet_db[cmd].pos[0]));
+ pc_setcart(sd,RFIFOW(fd,2));
}
/*==========================================
* ステータスアップ
*------------------------------------------
*/
-void clif_parse_StatusUp(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_StatusUp(int fd,struct map_session_data *sd)
{
- pc_statusup(sd,RFIFOW(fd,packet_db[cmd].pos[0]));
+ pc_statusup(sd,RFIFOW(fd,2));
}
/*==========================================
* スキルレベルアップ
*------------------------------------------
*/
-void clif_parse_SkillUp(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_SkillUp(int fd,struct map_session_data *sd)
{
- pc_skillup(sd,RFIFOW(fd,packet_db[cmd].pos[0]));
+ pc_skillup(sd,RFIFOW(fd,2));
}
/*==========================================
* スキル使用(ID指定)
*------------------------------------------
*/
-void clif_parse_UseSkillToId(int fd, struct map_session_data *sd, int cmd) {
- int skillnum, skilllv,lv, target_id;
- unsigned int tick=gettick();
- struct block_list *bl;
+void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) {
+ int skillnum, skilllv, lv, target_id;
+ unsigned int tick = gettick();
nullpo_retv(sd);
- if(map[sd->bl.m].flag.noskill) return;
- if(sd->npc_id!=0 || sd->vender_id != 0) return;
- if(sd->chatID) return;
+ if (sd->chatID || sd->npc_id != 0 || sd->vender_id != 0)
+ return;
- skilllv = RFIFOW(fd,packet_db[cmd].pos[0]);
- skillnum = RFIFOW(fd,packet_db[cmd].pos[1]);
- target_id = RFIFOL(fd,packet_db[cmd].pos[2]);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 6:
+ skilllv = RFIFOW(fd,4);
+ skillnum = RFIFOW(fd,9);
+ target_id = RFIFOL(fd,11);
+ break;
+ case 7:
+ skilllv = RFIFOW(fd,7);
+ skillnum = RFIFOW(fd,9);
+ target_id = RFIFOL(fd,15);
+ break;
+ case 8:
+ skilllv = RFIFOW(fd,7);
+ skillnum = RFIFOW(fd,12);
+ target_id = RFIFOL(fd,16);
+ break;
+ case 9:
+ skilllv = RFIFOW(fd,11);
+ skillnum = RFIFOW(fd,18);
+ target_id = RFIFOL(fd,22);
+ break;
+ case 10:
+ skilllv = RFIFOW(fd,9);
+ skillnum = RFIFOW(fd,15);
+ target_id = RFIFOL(fd,18);
+ break;
+ case 11:
+ skilllv = RFIFOW(fd,4);
+ skillnum = RFIFOW(fd,7);
+ target_id = RFIFOL(fd,10);
+ break;
+ case 12:
+ skilllv = RFIFOW(fd,7);
+ skillnum = RFIFOW(fd,12);
+ target_id = RFIFOL(fd,16);
+ break;
+ case 13:
+ skilllv = RFIFOW(fd,4);
+ skillnum = RFIFOW(fd,10);
+ target_id = RFIFOL(fd,22);
+ break;
+ default: // old version by default
+ skilllv = RFIFOW(fd,2);
+ skillnum = RFIFOW(fd,4);
+ target_id = RFIFOL(fd,6);
+ break;
+ }
- bl=map_id2bl(target_id);
- if(bl && mob_gvmobcheck(sd, bl) == 0)
+ if (skillnotok(skillnum, sd))
return;
- if(skillnotok(skillnum, sd))
- return;
-
if (sd->skilltimer != -1) {
if (skillnum != SA_CASTCANCEL)
return;
@@ -8436,22 +8524,22 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd, int cmd) {
}
if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) ||
- sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer!=-1 ||
- sd->sc_data[SC_WEDDING].timer!=-1 || sd->view_class==22)
+ sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 ||
+ sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == 22)
return;
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- if(sd->skillitem >= 0 && sd->skillitem == skillnum) {
- if(skilllv != sd->skillitemlv)
+ if (sd->skillitem >= 0 && sd->skillitem == skillnum) {
+ if (skilllv != sd->skillitemlv)
skilllv = sd->skillitemlv;
- skill_use_id(sd,target_id,skillnum,skilllv);
+ skill_use_id(sd, target_id, skillnum, skilllv);
} else {
sd->skillitem = sd->skillitemlv = -1;
- if(skillnum == MO_EXTREMITYFIST) {
- if((sd->sc_data[SC_COMBO].timer == -1 || (sd->sc_data[SC_COMBO].val1 != MO_COMBOFINISH && sd->sc_data[SC_COMBO].val1 != CH_CHAINCRUSH))) {
- if(!sd->state.skill_flag ) {
+ if (skillnum == MO_EXTREMITYFIST) {
+ if ((sd->sc_data[SC_COMBO].timer == -1 || (sd->sc_data[SC_COMBO].val1 != MO_COMBOFINISH && sd->sc_data[SC_COMBO].val1 != CH_CHAINCRUSH))) {
+ if (!sd->state.skill_flag ) {
sd->state.skill_flag = 1;
- clif_skillinfo(sd,MO_EXTREMITYFIST,1,-1);
+ clif_skillinfo(sd, MO_EXTREMITYFIST, 1, -1);
return;
} else if (sd->bl.id == target_id) {
clif_skillinfo(sd, MO_EXTREMITYFIST, 1, -1);
@@ -8459,11 +8547,11 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd, int cmd) {
}
}
}
- if( (lv = pc_checkskill(sd,skillnum)) > 0) {
- if(skilllv > lv)
+ if ((lv = pc_checkskill(sd, skillnum)) > 0) {
+ if (skilllv > lv)
skilllv = lv;
- skill_use_id(sd,target_id,skillnum,skilllv);
- if(sd->state.skill_flag)
+ skill_use_id(sd, target_id, skillnum, skilllv);
+ if (sd->state.skill_flag)
sd->state.skill_flag = 0;
}
}
@@ -8473,52 +8561,126 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd, int cmd) {
* スキル使用(場所指定)
*------------------------------------------
*/
-void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) {
int skillnum, skilllv, lv, x, y;
unsigned int tick = gettick();
+ int skillmoreinfo;
nullpo_retv(sd);
- if(map[sd->bl.m].flag.noskill) return;
- if(sd->npc_id!=0 || sd->vender_id != 0) return;
+ if (sd->npc_id != 0 || sd->vender_id != 0) return;
if(sd->chatID) return;
- skilllv = RFIFOW(fd,packet_db[cmd].pos[0]);
- skillnum = RFIFOW(fd,packet_db[cmd].pos[1]);
- x = RFIFOW(fd,packet_db[cmd].pos[2]);
- y = RFIFOW(fd,packet_db[cmd].pos[3]);
+ skillmoreinfo = -1;
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 6:
+ skilllv = RFIFOW(fd,4);
+ skillnum = RFIFOW(fd,9);
+ x = RFIFOW(fd,11);
+ y = RFIFOW(fd,13);
+ if (RFIFOW(fd,0) == 0x190)
+ skillmoreinfo = 15;
+ break;
+ case 7:
+ skilllv = RFIFOW(fd,7);
+ skillnum = RFIFOW(fd,9);
+ x = RFIFOW(fd,15);
+ y = RFIFOW(fd,17);
+ if (RFIFOW(fd,0) == 0x190)
+ skillmoreinfo = 19;
+ break;
+ case 8:
+ skilllv = RFIFOW(fd,3);
+ skillnum = RFIFOW(fd,6);
+ x = RFIFOW(fd,17);
+ y = RFIFOW(fd,21);
+ if (RFIFOW(fd,0) == 0x0a2)
+ skillmoreinfo = 23;
+ break;
+ case 9:
+ skilllv = RFIFOW(fd,5);
+ skillnum = RFIFOW(fd,15);
+ x = RFIFOW(fd,29);
+ y = RFIFOW(fd,38);
+ if (RFIFOW(fd,0) == 0x0a2)
+ skillmoreinfo = 40;
+ break;
+ case 10:
+ skilllv = RFIFOW(fd,10);
+ skillnum = RFIFOW(fd,14);
+ x = RFIFOW(fd,18);
+ y = RFIFOW(fd,23);
+ if (RFIFOW(fd,0) == 0x08c)
+ skillmoreinfo = 25;
+ break;
+ case 11:
+ skilllv = RFIFOW(fd,6); // 16? to check.
+ skillnum = RFIFOW(fd,20);
+ x = RFIFOW(fd,23);
+ y = RFIFOW(fd,27);
+ if (RFIFOW(fd,0) == 0x08c)
+ skillmoreinfo = 29;
+ break;
+ case 12:
+ skilllv = RFIFOW(fd,3); // 2? to check.
+ skillnum = RFIFOW(fd,6);
+ x = RFIFOW(fd,17);
+ y = RFIFOW(fd,21);
+ if (RFIFOW(fd,0) == 0x08c)
+ skillmoreinfo = 23;
+ break;
+ case 13:
+ skilllv = RFIFOW(fd,6);
+ skillnum = RFIFOW(fd,9);
+ x = RFIFOW(fd,23);
+ y = RFIFOW(fd,26);
+ if (RFIFOW(fd,0) == 0x08c)
+ skillmoreinfo = 28;
+ break;
+ default: // old version by default
+ skilllv = RFIFOW(fd,2);
+ skillnum = RFIFOW(fd,4);
+ x = RFIFOW(fd,6);
+ y = RFIFOW(fd,8);
+ if (RFIFOW(fd,0) == 0x190)
+ skillmoreinfo = 10;
+ break;
+ }
+
+ if (skillnotok(skillnum, sd))
+ return;
- if(packet_db[cmd].pos[4]){
- if(pc_issit(sd)){
- clif_skill_fail(sd,skillnum,0,0);
+ if (skillmoreinfo != -1) {
+ if (pc_issit(sd)) {
+ clif_skill_fail(sd, skillnum, 0, 0);
return;
}
- memcpy(sd->message,RFIFOP(fd,packet_db[cmd].pos[4]),80);
+ memcpy(talkie_mes, RFIFOP(fd,skillmoreinfo), 80);
}
- if(sd->skilltimer != -1)
+ if (sd->skilltimer != -1)
return;
- else if(DIFF_TICK(tick , sd->canact_tick) < 0) {
- clif_skill_fail(sd,skillnum,4,0);
+ else if (DIFF_TICK(tick, sd->canact_tick) < 0) {
+ clif_skill_fail(sd, skillnum, 4, 0);
return;
}
- if((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) ||
- sd->sc_data[SC_BERSERK].timer!=-1 || sd->sc_data[SC_NOCHAT].timer!=-1 ||
- sd->sc_data[SC_WEDDING].timer!=-1 || sd->view_class==22)
+ if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) ||
+ sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 ||
+ sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == 22)
return;
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- if(sd->skillitem >= 0 && sd->skillitem == skillnum) {
- if(skilllv != sd->skillitemlv)
+ if (sd->skillitem >= 0 && sd->skillitem == skillnum) {
+ if (skilllv != sd->skillitemlv)
skilllv = sd->skillitemlv;
- skill_use_pos(sd,x,y,skillnum,skilllv);
+ skill_use_pos(sd, x, y, skillnum, skilllv);
} else {
sd->skillitem = sd->skillitemlv = -1;
- if( (lv = pc_checkskill(sd,skillnum)) > 0) {
- if(skilllv > lv)
+ if ((lv = pc_checkskill(sd, skillnum)) > 0) {
+ if (skilllv > lv)
skilllv = lv;
- skill_use_pos(sd,x,y,skillnum,skilllv);
+ skill_use_pos(sd, x, y, skillnum,skilllv);
}
}
}
@@ -8527,14 +8689,13 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd, int cmd) {
* スキル使用(map指定)
*------------------------------------------
*/
-void clif_parse_UseSkillMap(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_UseSkillMap(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
-
- if(map[sd->bl.m].flag.noskill) return;
+
if(sd->chatID) return;
- if(sd->npc_id!=0 || sd->vender_id != 0 || (sd->sc_data &&
+ if (sd->npc_id!=0 || sd->vender_id != 0 || (sd->sc_data &&
(sd->sc_data[SC_TRICKDEAD].timer != -1 ||
sd->sc_data[SC_BERSERK].timer!=-1 ||
sd->sc_data[SC_NOCHAT].timer!=-1 ||
@@ -8545,13 +8706,13 @@ void clif_parse_UseSkillMap(int fd,struct map_session_data *sd, int cmd)
if(sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- skill_castend_map(sd,RFIFOW(fd,packet_db[cmd].pos[0]),RFIFOP(fd,packet_db[cmd].pos[1]));
+ skill_castend_map(sd,RFIFOW(fd,2),RFIFOP(fd,4));
}
/*==========================================
* メモ要求
*------------------------------------------
*/
-void clif_parse_RequestMemo(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_RequestMemo(int fd,struct map_session_data *sd)
{
pc_memo(sd,-1);
}
@@ -8559,149 +8720,171 @@ void clif_parse_RequestMemo(int fd,struct map_session_data *sd, int cmd)
* アイテム合成
*------------------------------------------
*/
-void clif_parse_ProduceMix(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_ProduceMix(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
sd->state.produce_flag = 0;
- skill_produce_mix(sd,RFIFOW(fd,packet_db[cmd].pos[0]),RFIFOW(fd,packet_db[cmd].pos[1]),RFIFOW(fd,packet_db[cmd].pos[2]),RFIFOW(fd,packet_db[cmd].pos[3]));
+ skill_produce_mix(sd,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
- sd->npc_menu=RFIFOB(fd,packet_db[cmd].pos[1]);
- npc_scriptcont(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+ sd->npc_menu=RFIFOB(fd,6);
+ npc_scriptcont(sd,RFIFOL(fd,2));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd)
{
- npc_scriptcont(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+ npc_scriptcont(sd,RFIFOL(fd,2));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
#define RFIFOL_(fd,pos) (*(int*)(session[fd]->rdata+session[fd]->rdata_pos+(pos)))
//Input Value overflow Exploit FIX
- sd->npc_amount=RFIFOL(fd,packet_db[cmd].pos[1]); //fixed by Lupus. npc_amount is (int) but was RFIFOL changing it to (unsigned int)
+ sd->npc_amount=RFIFOL_(fd,6); //fixed by Lupus. npc_amount is (int) but was RFIFOL changing it to (unsigned int)
+
#undef RFIFOL_
- npc_scriptcont(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+ npc_scriptcont(sd,RFIFOL(fd,2));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcStringInput(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcStringInput(int fd,struct map_session_data *sd)
{
- int len = RFIFOW(fd,packet_db[cmd].pos[0]);
-
nullpo_retv(sd);
- if(len-packet_db[cmd].pos[2]+1 >= sizeof(sd->npc_str)){
+ if(RFIFOW(fd,2)-7 >= sizeof(sd->npc_str)){
printf("clif: input string too long !\n");
- memcpy(sd->npc_str,RFIFOP(fd,packet_db[cmd].pos[2]),sizeof(sd->npc_str));
+ memcpy(sd->npc_str,RFIFOP(fd,8),sizeof(sd->npc_str));
sd->npc_str[sizeof(sd->npc_str)-1]=0;
- }else
- strncpy(sd->npc_str,RFIFOP(fd,packet_db[cmd].pos[2]),256);
- npc_scriptcont(sd,RFIFOL(fd,packet_db[cmd].pos[1]));
+ } else
+ strcpy(sd->npc_str,RFIFOP(fd,8));
+ npc_scriptcont(sd,RFIFOL(fd,4));
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd)
{
- npc_scriptcont(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+ npc_scriptcont(sd,RFIFOL(fd,2));
}
/*==========================================
* アイテム鑑定
*------------------------------------------
*/
-void clif_parse_ItemIdentify(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_ItemIdentify(int fd,struct map_session_data *sd)
{
- pc_item_identify(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2);
+ pc_item_identify(sd,RFIFOW(fd,2)-2);
}
/*==========================================
* 矢作成
*------------------------------------------
*/
-void clif_parse_SelectArrow(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_SelectArrow(int fd,struct map_session_data *sd)
{
nullpo_retv(sd);
sd->state.make_arrow_flag = 0;
- skill_arrow_create(sd,RFIFOW(fd,packet_db[cmd].pos[0]));
+ skill_arrow_create(sd,RFIFOW(fd,2));
}
/*==========================================
* オートスペル受信
*------------------------------------------
*/
-void clif_parse_AutoSpell(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_AutoSpell(int fd,struct map_session_data *sd)
{
- skill_autospell(sd,RFIFOW(fd,packet_db[cmd].pos[0]));
+ skill_autospell(sd,RFIFOW(fd,2));
}
/*==========================================
* カード使用
*------------------------------------------
*/
-void clif_parse_UseCard(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_UseCard(int fd,struct map_session_data *sd)
{
- clif_use_card(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2);
+ clif_use_card(sd,RFIFOW(fd,2)-2);
}
/*==========================================
* カード挿入装備選択
*------------------------------------------
*/
-void clif_parse_InsertCard(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_InsertCard(int fd,struct map_session_data *sd)
{
- pc_insert_card(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2,RFIFOW(fd,packet_db[cmd].pos[1])-2);
+ pc_insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2);
}
/*==========================================
* 0193 キャラID名前引き
*------------------------------------------
*/
-void clif_parse_SolveCharName(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_SolveCharName(int fd, struct map_session_data *sd) {
int char_id;
- char_id = RFIFOL(fd,packet_db[cmd].pos[0]);
- clif_solved_charname(sd,char_id);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 8:
+ char_id = RFIFOL(fd,8);
+ break;
+ case 9:
+ char_id = RFIFOL(fd,7);
+ break;
+ case 10:
+ char_id = RFIFOL(fd,10);
+ break;
+ case 11:
+ char_id = RFIFOL(fd,6);
+ break;
+ case 12:
+ char_id = RFIFOL(fd,8);
+ break;
+ case 13:
+ char_id = RFIFOL(fd,12);
+ break;
+ default: // old version by default (+ packet version 6 and 7)
+ char_id = RFIFOL(fd,2);
+ break;
+ }
+ clif_solved_charname(sd, char_id);
}
/*==========================================
* 0197 /resetskill /resetstate
*------------------------------------------
*/
-void clif_parse_ResetChar(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_ResetChar(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- if (battle_config.atc_gmonly == 0 || pc_isGM(sd) >= get_atcommand_level(AtCommand_ResetState)) {
- switch(RFIFOW(fd,packet_db[cmd].pos[0])){
+ if (battle_config.atc_gmonly == 0 || pc_isGM(sd)) {
+ switch(RFIFOW(fd,2)){
case 0:
- pc_resetstate(sd);
+ if (pc_isGM(sd) >= get_atcommand_level(AtCommand_ResetState))
+ pc_resetstate(sd);
break;
case 1:
- pc_resetskill(sd);
+ if (pc_isGM(sd) >= get_atcommand_level(AtCommand_ResetState))
+ pc_resetskill(sd);
break;
}
}
@@ -8711,18 +8894,17 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd, int cmd) {
* 019c /lb等
*------------------------------------------
*/
-void clif_parse_LGMmessage(int fd,struct map_session_data *sd, int cmd)
-{
- int len = RFIFOW(fd,packet_db[cmd].pos[0]);
+void clif_parse_LGMmessage(int fd, struct map_session_data *sd) {
+ unsigned char buf[64];
nullpo_retv(sd);
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_LocalBroadcast))) {
- WFIFOW(fd,0)=0x9a;
- WFIFOW(fd,2)=len;
- memcpy(WBUFP(fd,4), RFIFOP(fd,packet_db[cmd].pos[1]), len-packet_db[cmd].pos[1]);
- clif_send(WFIFOP(fd,0), len, &sd->bl, ALL_SAMEMAP);
+ WBUFW(buf,0) = 0x9a;
+ WBUFW(buf,2) = RFIFOW(fd,2);
+ memcpy(WBUFP(buf,4), RFIFOP(fd,4), RFIFOW(fd,2) - 4);
+ clif_send(buf, RFIFOW(fd,2), &sd->bl, ALL_SAMEMAP);
}
}
@@ -8730,19 +8912,47 @@ void clif_parse_LGMmessage(int fd,struct map_session_data *sd, int cmd)
* カプラ倉庫へ入れる
*------------------------------------------
*/
-void clif_parse_MoveToKafra(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) {
int item_index, item_amount;
nullpo_retv(sd);
if (sd->npc_id != 0 || sd->vender_id != 0)
return;
- item_index = RFIFOW(fd,packet_db[cmd].pos[0])-2;
- item_amount = RFIFOL(fd,packet_db[cmd].pos[1]);
- if(item_index < 0 || item_index > MAX_INVENTORY) return;
- if(item_amount <=0 ) return;
- if(itemdb_isdropable(sd->status.inventory[item_index].nameid) == 0) return;
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 8:
+ item_index = RFIFOW(fd,5) - 2;
+ item_amount = RFIFOL(fd,12);
+ break;
+ case 9:
+ item_index = RFIFOW(fd,5) - 2;
+ item_amount = RFIFOL(fd,19);
+ break;
+ case 10:
+ item_index = RFIFOW(fd,3) - 2;
+ item_amount = RFIFOL(fd,15);
+ break;
+ case 11:
+ item_index = RFIFOW(fd,6) - 2;
+ item_amount = RFIFOL(fd,21);
+ break;
+ case 12:
+ item_index = RFIFOW(fd,5) - 2;
+ item_amount = RFIFOL(fd,12);
+ break;
+ case 13:
+ item_index = RFIFOW(fd,6) - 2;
+ item_amount = RFIFOL(fd,9);
+ break;
+ default: // old version by default (+ packet version 6 and 7)
+ item_index = RFIFOW(fd,2) - 2;
+ item_amount = RFIFOL(fd,4);
+ break;
+ }
+
+ if (item_index < 0 || item_index >= MAX_INVENTORY)
+ return;
if (sd->state.storage_flag)
storage_guild_storageadd(sd, item_index, item_amount);
@@ -8754,62 +8964,89 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd, int cmd) {
* カプラ倉庫から出す
*------------------------------------------
*/
-void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd, int cmd)
-{
- int item_index,item_amount;
+void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) {
+ int item_index, item_amount;
nullpo_retv(sd);
- if(sd->npc_id!=0 || sd->vender_id != 0) return;
- item_index = RFIFOW(fd,packet_db[cmd].pos[0])-1;
- item_amount = RFIFOL(fd,packet_db[cmd].pos[1]);
+ switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ case 8:
+ item_index = RFIFOW(fd,10) - 1;
+ item_amount = RFIFOL(fd,22);
+ break;
+ case 9:
+ item_index = RFIFOW(fd,11) - 1;
+ item_amount = RFIFOL(fd,22);
+ break;
+ case 10:
+ item_index = RFIFOW(fd,3) - 1;
+ item_amount = RFIFOL(fd,13);
+ break;
+ case 11:
+ item_index = RFIFOW(fd,4) - 1;
+ item_amount = RFIFOL(fd,8);
+ break;
+ case 12:
+ item_index = RFIFOW(fd,10) - 1;
+ item_amount = RFIFOL(fd,22);
+ break;
+ case 13:
+ item_index = RFIFOW(fd,12) - 1;
+ item_amount = RFIFOL(fd,18);
+ break;
+ default: // old version by default (+ packet version 6 and 7)
+ item_index = RFIFOW(fd,2) - 1;
+ item_amount = RFIFOL(fd,4);
+ break;
+ }
+
+ if (sd->npc_id != 0 || sd->vender_id != 0)
+ return;
- if(sd->state.storage_flag)
- storage_guild_storageget(sd,item_index,item_amount);
+ if (sd->state.storage_flag)
+ storage_guild_storageget(sd, item_index, item_amount);
else
- storage_storageget(sd,item_index,item_amount);
+ storage_storageget(sd, item_index, item_amount);
}
/*==========================================
* カプラ倉庫へカートから入れる
*------------------------------------------
*/
-void clif_parse_MoveToKafraFromCart(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- if (sd->npc_id != 0 || sd->vender_id != 0 || sd->trade_partner != 0) return;
-
- if(sd->state.storage_flag)
- storage_guild_storageaddfromcart(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2,RFIFOL(fd,packet_db[cmd].pos[1]));
+ if (sd->npc_id != 0 || sd->vender_id != 0 || sd->trade_partner != 0)
+ return;
+ if (sd->state.storage_flag)
+ storage_guild_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
else
- storage_storageaddfromcart(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2,RFIFOL(fd,packet_db[cmd].pos[1]));
+ storage_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
}
/*==========================================
* カプラ倉庫から出す
*------------------------------------------
*/
-void clif_parse_MoveFromKafraToCart(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- if(sd->npc_id!=0 || sd->vender_id != 0) return;
- if(sd->state.storage_flag)
- storage_guild_storagegettocart(sd,RFIFOW(fd,packet_db[cmd].pos[0])-1,RFIFOL(fd,packet_db[cmd].pos[1]));
+ if (sd->npc_id != 0 || sd->vender_id != 0)
+ return;
+ if (sd->state.storage_flag)
+ storage_guild_storagegettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
else
- storage_storagegettocart(sd,RFIFOW(fd,packet_db[cmd].pos[0])-1,RFIFOL(fd,packet_db[cmd].pos[1]));
+ storage_storagegettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
}
/*==========================================
* カプラ倉庫を閉じる
*------------------------------------------
*/
-void clif_parse_CloseKafra(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_CloseKafra(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- if(sd->state.storage_flag)
+ if (sd->state.storage_flag)
storage_guild_storageclose(sd);
else
storage_storageclose(sd);
@@ -8819,11 +9056,10 @@ void clif_parse_CloseKafra(int fd,struct map_session_data *sd, int cmd)
* パーティを作る
*------------------------------------------
*/
-void clif_parse_CreateParty(int fd, struct map_session_data *sd, int cmd) {
- if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7){
- party_create(sd,RFIFOP(fd,packet_db[cmd].pos[0]));
- }
- else
+void clif_parse_CreateParty(int fd, struct map_session_data *sd) {
+ if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7) {
+ party_create(sd,RFIFOP(fd,2));
+ } else
clif_skill_fail(sd,1,0,4);
}
@@ -8831,85 +9067,80 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd, int cmd) {
* パーティを作る
*------------------------------------------
*/
-void clif_parse_CreateParty2(int fd,struct map_session_data *sd, int cmd)
-{
- if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7){
- party_create(sd,RFIFOP(fd,packet_db[cmd].pos[0]));
- }
- else
- clif_skill_fail(sd,1,0,4);
+void clif_parse_CreateParty2(int fd, struct map_session_data *sd) {
+ if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7){
+ party_create(sd, RFIFOP(fd,2));
+ } else
+ clif_skill_fail(sd, 1, 0, 4);
}
/*==========================================
* パーティに勧誘
*------------------------------------------
*/
-void clif_parse_PartyInvite(int fd,struct map_session_data *sd, int cmd)
-{
- party_invite(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+void clif_parse_PartyInvite(int fd, struct map_session_data *sd) {
+ party_invite(sd, RFIFOL(fd,2));
}
+
/*==========================================
* パーティ勧誘返答
*------------------------------------------
*/
-void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) {
if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 5){
- party_reply_invite(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOL(fd,packet_db[cmd].pos[1]));
- }
- else {
- party_reply_invite(sd,RFIFOL(fd,packet_db[cmd].pos[0]),-1);
+ party_reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6));
+ } else {
+ party_reply_invite(sd,RFIFOL(fd,2),-1);
clif_skill_fail(sd,1,0,4);
}
}
+
/*==========================================
* パーティ脱退要求
*------------------------------------------
*/
-void clif_parse_LeaveParty(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_LeaveParty(int fd, struct map_session_data *sd) {
party_leave(sd);
}
+
/*==========================================
* パーティ除名要求
*------------------------------------------
*/
-void clif_parse_RemovePartyMember(int fd,struct map_session_data *sd, int cmd)
-{
- party_removemember(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOP(fd,packet_db[cmd].pos[1]));
+void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) {
+ party_removemember(sd,RFIFOL(fd,2),RFIFOP(fd,6));
}
+
/*==========================================
* パーティ設定変更要求
*------------------------------------------
*/
-void clif_parse_PartyChangeOption(int fd,struct map_session_data *sd, int cmd)
-{
- party_changeoption(sd,RFIFOW(fd,packet_db[cmd].pos[0]),RFIFOW(fd,packet_db[cmd].pos[1]));
+void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) {
+ party_changeoption(sd, RFIFOW(fd,2), RFIFOW(fd,4));
}
+
/*==========================================
* パーティメッセージ送信要求
*------------------------------------------
*/
-void clif_parse_PartyMessage(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_PartyMessage(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- if (is_atcommand(fd, sd, RFIFOP(fd, packet_db[cmd].pos[1]),0) != AtCommand_None)
+ if (is_atcommand(fd, sd, RFIFOP(fd,4), 0) != AtCommand_None)
return;
if(sd->sc_data &&
(sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
sd->sc_data[SC_NOCHAT].timer!=-1)) //チャット禁止
return;
- party_send_message(sd,RFIFOP(fd,packet_db[cmd].pos[1]),RFIFOW(fd,packet_db[cmd].pos[0])-packet_db[cmd].pos[1]);
+ party_send_message(sd, RFIFOP(fd,4), RFIFOW(fd,2)-4);
}
/*==========================================
* 露店閉鎖
*------------------------------------------
*/
-void clif_parse_CloseVending(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_CloseVending(int fd, struct map_session_data *sd) {
vending_closevending(sd);
}
@@ -8917,11 +9148,10 @@ void clif_parse_CloseVending(int fd,struct map_session_data *sd, int cmd)
* 露店アイテムリスト要求
*------------------------------------------
*/
-void clif_parse_VendingListReq(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_VendingListReq(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- vending_vendinglistreq(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+ vending_vendinglistreq(sd,RFIFOL(fd,2));
if(sd->npc_id)
npc_event_dequeue(sd);
}
@@ -8930,43 +9160,65 @@ void clif_parse_VendingListReq(int fd,struct map_session_data *sd, int cmd)
* 露店アイテム購入
*------------------------------------------
*/
-void clif_parse_PurchaseReq(int fd,struct map_session_data *sd, int cmd)
-{
- vending_purchasereq(sd,RFIFOW(fd,packet_db[cmd].pos[0]),RFIFOL(fd,packet_db[cmd].pos[1]),RFIFOP(fd,packet_db[cmd].pos[2]));
+void clif_parse_PurchaseReq(int fd, struct map_session_data *sd) {
+ vending_purchasereq(sd, RFIFOW(fd,2), RFIFOL(fd,4), RFIFOP(fd,8));
}
/*==========================================
* 露店開設
*------------------------------------------
*/
-void clif_parse_OpenVending(int fd,struct map_session_data *sd, int cmd)
-{
- vending_openvending(sd,RFIFOW(fd,packet_db[cmd].pos[0]),RFIFOP(fd,packet_db[cmd].pos[1]),RFIFOB(fd,packet_db[cmd].pos[2]),RFIFOP(fd,packet_db[cmd].pos[3]));
+void clif_parse_OpenVending(int fd,struct map_session_data *sd) {
+ vending_openvending(sd, RFIFOW(fd,2), RFIFOP(fd,4), RFIFOB(fd,84), RFIFOP(fd,85));
+}
+
+/*==========================================
+ * /monster /item rewriten by [Yor]
+ *------------------------------------------
+ */
+void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) {
+ char monster_item_name[25];
+
+ nullpo_retv(sd);
+
+ memset(monster_item_name, '\0', sizeof(monster_item_name));
+
+ if (battle_config.atc_gmonly == 0 || pc_isGM(sd)) {
+ memcpy(monster_item_name, RFIFOP(fd,2), 24);
+
+ if (mobdb_searchname(monster_item_name) != 0) {
+ if (pc_isGM(sd) >= get_atcommand_level(AtCommand_Monster))
+ atcommand_spawn(fd, sd, "@spawn", monster_item_name); // as @spawn
+ } else if (itemdb_searchname(monster_item_name) != NULL) {
+ if (pc_isGM(sd) >= get_atcommand_level(AtCommand_Item))
+ atcommand_item(fd, sd, "@item", monster_item_name); // as @item
+ }
+
+ }
}
/*==========================================
* ギルドを作る
*------------------------------------------
*/
-void clif_parse_CreateGuild(int fd,struct map_session_data *sd, int cmd)
-{
- guild_create(sd,RFIFOP(fd,packet_db[cmd].pos[0]));
+void clif_parse_CreateGuild(int fd,struct map_session_data *sd) {
+ guild_create(sd, RFIFOP(fd,6));
}
+
/*==========================================
* ギルドマスターかどうか確認
*------------------------------------------
*/
-void clif_parse_GuildCheckMaster(int fd,struct map_session_data *sd, int cmd)
-{
+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, int cmd)
-{
- switch(RFIFOL(fd,packet_db[cmd].pos[0])){
+void clif_parse_GuildReqeustInfo(int fd, struct map_session_data *sd) {
+ switch(RFIFOL(fd,2)){
case 0: // ギルド基本情報、同盟敵対情報
clif_guild_basicinfo(sd);
clif_guild_allianceinfo(sd);
@@ -8986,34 +9238,34 @@ void clif_parse_GuildRequestInfo(int fd,struct map_session_data *sd, int cmd)
clif_guild_explusionlist(sd);
break;
default:
- if(battle_config.error_log)
- printf("clif: guild request info: unknown type %d\n",RFIFOL(fd,packet_db[cmd].pos[0]));
+ if (battle_config.error_log)
+ printf("clif: guild request info: unknown type %d\n", RFIFOL(fd,2));
break;
}
}
+
/*==========================================
* ギルド役職変更
*------------------------------------------
*/
-void clif_parse_GuildChangePositionInfo(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) {
int i;
- for(i=4;i<RFIFOW(fd,packet_db[cmd].pos[0]);i+=40){
- guild_change_position(sd,RFIFOL(fd,i),
- RFIFOL(fd,i+4),RFIFOL(fd,i+12),RFIFOP(fd,i+16));
+
+ for(i = 4; i < RFIFOW(fd,2); i += 40 ){
+ guild_change_position(sd, 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, int cmd)
-{
+void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) {
int i;
nullpo_retv(sd);
- for(i=4;i<RFIFOW(fd,packet_db[cmd].pos[0]);i+=12){
+ for(i=4;i<RFIFOW(fd,2);i+=12){
guild_change_memberposition(sd->status.guild_id,
RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8));
}
@@ -9023,9 +9275,8 @@ void clif_parse_GuildChangeMemberPosition(int fd,struct map_session_data *sd, in
* ギルドエンブレム要求
*------------------------------------------
*/
-void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd, int cmd)
-{
- struct guild *g=guild_search(RFIFOL(fd,packet_db[cmd].pos[0]));
+void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) {
+ struct guild *g=guild_search(RFIFOL(fd,2));
if(g!=NULL)
clif_guild_emblem(sd,g);
}
@@ -9034,161 +9285,152 @@ void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd, int cmd)
* ギルドエンブレム変更
*------------------------------------------
*/
-void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd, int cmd)
-{
- guild_change_emblem(sd,RFIFOW(fd,packet_db[cmd].pos[0])-packet_db[cmd].pos[1],RFIFOP(fd,packet_db[cmd].pos[1]));
+void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) {
+ guild_change_emblem(sd,RFIFOW(fd,2)-4,RFIFOP(fd,4));
}
+
/*==========================================
* ギルド告知変更
*------------------------------------------
*/
-void clif_parse_GuildChangeNotice(int fd,struct map_session_data *sd, int cmd)
-{
- guild_change_notice(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOP(fd,packet_db[cmd].pos[1]),RFIFOP(fd,packet_db[cmd].pos[2]));
+void clif_parse_GuildChangeNotice(int fd,struct map_session_data *sd) {
+ guild_change_notice(sd,RFIFOL(fd,2),RFIFOP(fd,6),RFIFOP(fd,66));
}
/*==========================================
* ギルド勧誘
*------------------------------------------
*/
-void clif_parse_GuildInvite(int fd,struct map_session_data *sd, int cmd)
-{
- guild_invite(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+void clif_parse_GuildInvite(int fd,struct map_session_data *sd) {
+ guild_invite(sd,RFIFOL(fd,2));
}
+
/*==========================================
* ギルド勧誘返信
*------------------------------------------
*/
-void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd, int cmd)
-{
- guild_reply_invite(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOB(fd,packet_db[cmd].pos[1]));
+void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) {
+ guild_reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6));
}
+
/*==========================================
* ギルド脱退
*------------------------------------------
*/
-void clif_parse_GuildLeave(int fd,struct map_session_data *sd, int cmd)
-{
- guild_leave(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOL(fd,packet_db[cmd].pos[1]),RFIFOL(fd,packet_db[cmd].pos[2]),RFIFOP(fd,packet_db[cmd].pos[3]));
+void clif_parse_GuildLeave(int fd,struct map_session_data *sd) {
+ guild_leave(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOP(fd,14));
}
+
/*==========================================
* ギルド追放
*------------------------------------------
*/
-void clif_parse_GuildExplusion(int fd,struct map_session_data *sd, int cmd)
-{
- guild_explusion(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOL(fd,packet_db[cmd].pos[1]),RFIFOL(fd,packet_db[cmd].pos[2]),RFIFOP(fd,packet_db[cmd].pos[3]));
+void clif_parse_GuildExplusion(int fd,struct map_session_data *sd) {
+ guild_explusion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOP(fd,14));
}
/*==========================================
* ギルド会話
*------------------------------------------
*/
-void clif_parse_GuildMessage(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
nullpo_retv(sd);
- if (is_atcommand(fd, sd, RFIFOP(fd, packet_db[cmd].pos[1]), 0) != AtCommand_None)
+ if (is_atcommand(fd, sd, RFIFOP(fd, 4), 0) != AtCommand_None)
return;
if(sd->sc_data &&
(sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
sd->sc_data[SC_NOCHAT].timer!=-1)) //チャット禁止
return;
- guild_send_message(sd,RFIFOP(fd,packet_db[cmd].pos[1]),RFIFOW(fd,packet_db[cmd].pos[0])-packet_db[cmd].pos[1]);
+ guild_send_message(sd, RFIFOP(fd,4), RFIFOW(fd,2)-4);
}
/*==========================================
* ギルド同盟要求
*------------------------------------------
*/
-void clif_parse_GuildRequestAlliance(int fd,struct map_session_data *sd, int cmd)
-{
- guild_reqalliance(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) {
+ guild_reqalliance(sd,RFIFOL(fd,2));
}
+
/*==========================================
* ギルド同盟要求返信
*------------------------------------------
*/
-void clif_parse_GuildReplyAlliance(int fd,struct map_session_data *sd, int cmd)
-{
- guild_reply_reqalliance(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOL(fd,packet_db[cmd].pos[1]));
+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, int cmd)
-{
- guild_delalliance(sd,RFIFOL(fd,packet_db[cmd].pos[0]),RFIFOL(fd,packet_db[cmd].pos[1]));
+void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) {
+ guild_delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6));
}
+
/*==========================================
* ギルド敵対
*------------------------------------------
*/
-void clif_parse_GuildOpposition(int fd,struct map_session_data *sd, int cmd)
-{
- guild_opposition(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) {
+ guild_opposition(sd,RFIFOL(fd,2));
}
+
/*==========================================
* ギルド解散
*------------------------------------------
*/
-void clif_parse_GuildBreak(int fd,struct map_session_data *sd, int cmd)
-{
- guild_break(sd,RFIFOP(fd,packet_db[cmd].pos[0]));
+void clif_parse_GuildBreak(int fd, struct map_session_data *sd) {
+ guild_break(sd,RFIFOP(fd,2));
}
// pet
-void clif_parse_PetMenu(int fd,struct map_session_data *sd, int cmd)
-{
- pet_menu(sd,RFIFOB(fd,packet_db[cmd].pos[0]));
+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, int cmd)
-{
- pet_catch_process2(sd,RFIFOL(fd,packet_db[cmd].pos[0]));
+
+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, int cmd)
-{
- pet_select_egg(sd,RFIFOW(fd,packet_db[cmd].pos[0])-2);
+void clif_parse_SelectEgg(int fd, struct map_session_data *sd) {
+ pet_select_egg(sd,RFIFOW(fd,2)-2);
}
-void clif_parse_SendEmotion(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_SendEmotion(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
if(sd->pd)
- clif_pet_emotion(sd->pd,RFIFOL(fd,packet_db[cmd].pos[0]));
+ clif_pet_emotion(sd->pd,RFIFOL(fd,2));
}
-void clif_parse_ChangePetName(int fd,struct map_session_data *sd, int cmd)
-{
- pet_change_name(sd,RFIFOP(fd,packet_db[cmd].pos[0]));
+void clif_parse_ChangePetName(int fd, struct map_session_data *sd) {
+ pet_change_name(sd,RFIFOP(fd,2));
}
// Kick (right click menu for GM "(name) force to quit")
-void clif_parse_GMKick(int fd,struct map_session_data *sd, int cmd)
-{
+void clif_parse_GMKick(int fd, struct map_session_data *sd) {
struct block_list *target;
- int tid = RFIFOL(fd,packet_db[cmd].pos[0]);
+ int tid = RFIFOL(fd,2);
nullpo_retv(sd);
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Kick))) {
target = map_id2bl(tid);
- if(target) {
- if(target->type == BL_PC) {
+ if (target) {
+ if (target->type == BL_PC) {
struct map_session_data *tsd = (struct map_session_data *)target;
- if(pc_isGM(sd) > pc_isGM(tsd))
- clif_GM_kick(sd,tsd,1);
+ if (pc_isGM(sd) > pc_isGM(tsd))
+ clif_GM_kick(sd, tsd, 1);
else
- clif_GM_kickack(sd,0);
+ clif_GM_kickack(sd, 0);
} else if (target->type == BL_MOB) {
struct mob_data *md = (struct mob_data *)target;
sd->state.attack_type = 0;
- mob_damage(&sd->bl,md,md->hp,2);
+ mob_damage(&sd->bl, md, md->hp, 2);
} else
clif_GM_kickack(sd, 0);
} else
@@ -9197,19 +9439,57 @@ void clif_parse_GMKick(int fd,struct map_session_data *sd, int cmd)
}
/*==========================================
- * GM funtions
+ * /shift
*------------------------------------------
*/
-void clif_parse_GMHide(int fd,struct map_session_data *sd, int cmd) {
+void clif_parse_Shift(int fd, struct map_session_data *sd) { // Rewriten by [Yor]
+ char player_name[25];
+
nullpo_retv(sd);
- if(pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide)) {
- if(sd->status.option&0x40){
- sd->status.option&=~0x40;
- clif_displaymessage(fd,"invisible off!");
- }else{
- sd->status.option|=0x40;
- clif_displaymessage(fd,"invisible!");
+ memset(player_name, '\0', sizeof(player_name));
+
+ if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
+ (pc_isGM(sd) >= get_atcommand_level(AtCommand_JumpTo))) {
+ memcpy(player_name, RFIFOP(fd,2), 24);
+ atcommand_jumpto(fd, sd, "@jumpto", player_name); // as @jumpto
+ }
+
+ return;
+}
+
+/*==========================================
+ * /recall
+ *------------------------------------------
+ */
+void clif_parse_Recall(int fd, struct map_session_data *sd) { // Added by RoVeRT
+ char player_name[25];
+
+ nullpo_retv(sd);
+
+ memset(player_name, '\0', sizeof(player_name));
+
+ if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
+ (pc_isGM(sd) >= get_atcommand_level(AtCommand_Recall))) {
+ memcpy(player_name, RFIFOP(fd,2), 24);
+ atcommand_recall(fd, sd, "@recall", player_name); // as @recall
+ }
+
+ return;
+}
+
+void clif_parse_GMHide(int fd, struct map_session_data *sd) { // Modified by [Yor]
+ nullpo_retv(sd);
+
+ //printf("%2x %2x %2x\n", RFIFOW(fd,0), RFIFOW(fd,2), RFIFOW(fd,4)); // R 019d <Option_value>.2B <flag>.2B
+ if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
+ (pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide))) {
+ if (sd->status.option & OPTION_HIDE) { // OPTION_HIDE = 0x40
+ sd->status.option &= ~OPTION_HIDE; // OPTION_HIDE = 0x40
+ clif_displaymessage(fd, "Invisible: Off.");
+ } else {
+ sd->status.option |= OPTION_HIDE; // OPTION_HIDE = 0x40
+ clif_displaymessage(fd, "Invisible: On.");
}
clif_changeoption(&sd->bl);
}
@@ -9219,11 +9499,11 @@ void clif_parse_GMHide(int fd,struct map_session_data *sd, int cmd) {
* GMによるチャット禁止時間付与
*------------------------------------------
*/
-void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
{
- int tid = RFIFOL(fd,packet_db[cmd].pos[0]);
- int type = RFIFOB(fd,packet_db[cmd].pos[1]);
- int limit = RFIFOW(fd,packet_db[cmd].pos[2]);
+ int tid = RFIFOL(fd,2);
+ int type = RFIFOB(fd,6);
+ int limit = RFIFOW(fd,7);
struct block_list *bl = map_id2bl(tid);
struct map_session_data *dstsd;
int dstfd;
@@ -9243,7 +9523,7 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd, int cmd)
WFIFOW(dstfd,0)=0x14b;
WFIFOB(dstfd,2)=(type==2)?1:type;
memcpy(WFIFOP(dstfd,3),sd->status.name,24);
- WFIFOSET(dstfd,packet_db[0x14b].len);
+ WFIFOSET(dstfd,packet_len_table[0x14b]);
dstsd->status.manner -= limit;
if(dstsd->status.manner < 0)
skill_status_change_start(bl,SC_NOCHAT,0,0,0,0,0,0);
@@ -9261,19 +9541,153 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd, int cmd)
* GMによるチャット禁止時間参照(?)
*------------------------------------------
*/
-void clif_parse_GMReqNoChatCount(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_GMReqNoChatCount(int fd, struct map_session_data *sd)
{
- int tid = RFIFOL(fd,packet_db[cmd].pos[0]);
+ int tid = RFIFOL(fd,2);
+
+ WFIFOW(fd,0) = 0x1e0;
+ WFIFOL(fd,2) = tid;
+ sprintf(WFIFOP(fd,6),"%d",tid);
+// memcpy(WFIFOP(fd,6), "TESTNAME", 24);
+ WFIFOSET(fd, packet_len_table[0x1e0]);
+
+ return;
+}
+
+void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by [Yor]
+ char output[512];
+ char *nick; // S 00cf <nick>.24B <type>.B: 00 (/ex nick) deny speech from nick, 01 (/in nick) allow speech from nick
+ int i, pos;
+
+ memset(output, '\0', sizeof(output));
- WFIFOW(fd,0)=0x1e0;
- WFIFOL(fd,2)=tid;
- snprintf(WFIFOP(fd,6),24,"%d",tid);
-// memcpy(WFIFOP(fd,6),"TESTNAME",24);
- WFIFOSET(fd,packet_db[0x1e0].len);
+ nick = RFIFOP(fd,2); // speed up
+ RFIFOB(fd,25) = '\0'; // to be sure that the player name have at maximum 23 characters
+ //printf("Ignore: char '%s' state: %d\n", nick, RFIFOB(fd,26));
+
+ WFIFOW(fd,0) = 0x0d1; // R 00d1 <type>.B <fail>.B: type: 0: deny, 1: allow, fail: 0: success, 1: fail
+ WFIFOB(fd,2) = RFIFOB(fd,26);
+ // do nothing only if nick can not exist
+ if (strlen(nick) < 4) {
+ WFIFOB(fd,3) = 1; // fail
+ WFIFOSET(fd, packet_len_table[0x0d1]);
+ if (RFIFOB(fd,26) == 0) // type
+ clif_wis_message(fd, wisp_server_name, "It's impossible to block this player.", strlen("It's impossible to block this player.") + 1);
+ else
+ clif_wis_message(fd, wisp_server_name, "It's impossible to unblock this player.", strlen("It's impossible to unblock this player.") + 1);
+ return;
+ // name can exist
+ } else {
+ // deny action (we add nick only if it's not already exist
+ if (RFIFOB(fd,26) == 0) { // type
+ pos = -1;
+ for(i = 0; i < MAX_IGNORE_LIST; i++) {
+ if (strcmp(sd->ignore[i].name, nick) == 0) {
+ WFIFOB(fd,3) = 1; // fail
+ WFIFOSET(fd, packet_len_table[0x0d1]);
+ clif_wis_message(fd, wisp_server_name, "This player is already blocked.", strlen("This player is already blocked.") + 1);
+ if (strcmp(wisp_server_name, nick) == 0) { // to found possible bot users who automaticaly ignore people.
+ sprintf(output, "Character '%s' (account: %d) has tried AGAIN to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
+ intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, output, strlen(output) + 1);
+ }
+ return;
+ } else if (pos == -1 && sd->ignore[i].name[0] == '\0')
+ pos = i;
+ }
+ // if a position is found and name not found, we add it in the list
+ if (pos != -1) {
+ memcpy(sd->ignore[pos].name, nick, 24);
+ WFIFOB(fd,3) = 0; // success
+ WFIFOSET(fd, packet_len_table[0x0d1]);
+ if (strcmp(wisp_server_name, nick) == 0) { // to found possible bot users who automaticaly ignore people.
+ sprintf(output, "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
+ intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, output, strlen(output) + 1);
+ // send something to be inform and force bot to ignore twice... If GM receiving block + block again, it's a bot :)
+ clif_wis_message(fd, wisp_server_name, "Add me in your ignore list, doesn't block my wisps.", strlen("Add me in your ignore list, doesn't block my wisps.") + 1);
+ }
+ } else {
+ WFIFOB(fd,3) = 1; // fail
+ WFIFOSET(fd, packet_len_table[0x0d1]);
+ clif_wis_message(fd, wisp_server_name, "You can not block more people.", strlen("You can not block more people.") + 1);
+ if (strcmp(wisp_server_name, nick) == 0) { // to found possible bot users who automaticaly ignore people.
+ sprintf(output, "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
+ intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, output, strlen(output) + 1);
+ }
+ }
+ // allow action (we remove all same nicks if they exist)
+ } else {
+ pos = -1;
+ for(i = 0; i < MAX_IGNORE_LIST; i++)
+ if (strcmp(sd->ignore[i].name, nick) == 0) {
+ memset(sd->ignore[i].name, 0, sizeof(sd->ignore[i].name));
+ if (pos != -1) {
+ WFIFOB(fd,3) = 0; // success
+ WFIFOSET(fd, packet_len_table[0x0d1]);
+ pos = i; // don't break, to remove ALL same nick
+ }
+ }
+ if (pos == -1) {
+ WFIFOB(fd,3) = 1; // fail
+ WFIFOSET(fd, packet_len_table[0x0d1]);
+ clif_wis_message(fd, wisp_server_name, "This player is not blocked by you.", strlen("This player is not blocked by you.") + 1);
+ }
+ }
+ }
+
+// for(i = 0; i < MAX_IGNORE_LIST; i++) // for debug only
+// if (sd->ignore[i].name[0] != '\0')
+// printf("Ignored player: '%s'\n", sd->ignore[i].name);
+
+ return;
+}
+
+void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) { // Rewritten by [Yor]
+ //printf("Ignore all: state: %d\n", RFIFOB(fd,2));
+ if (RFIFOB(fd,2) == 0) {// S 00d0 <type>len.B: 00 (/exall) deny all speech, 01 (/inall) allow all speech
+ WFIFOW(fd,0) = 0x0d2; // R 00d2 <type>.B <fail>.B: type: 0: deny, 1: allow, fail: 0: success, 1: fail
+ WFIFOB(fd,2) = 0;
+ if (sd->ignoreAll == 0) {
+ sd->ignoreAll = 1;
+ WFIFOB(fd,3) = 0; // success
+ WFIFOSET(fd, packet_len_table[0x0d2]);
+ } else {
+ WFIFOB(fd,3) = 1; // fail
+ WFIFOSET(fd, packet_len_table[0x0d2]);
+ clif_wis_message(fd, wisp_server_name, "You already block everyone.", strlen("You already block everyone.") + 1);
+ }
+ } else {
+ WFIFOW(fd,0) = 0x0d2; // R 00d2 <type>.B <fail>.B: type: 0: deny, 1: allow, fail: 0: success, 1: fail
+ WFIFOB(fd,2) = 1;
+ if (sd->ignoreAll == 1) {
+ sd->ignoreAll = 0;
+ WFIFOB(fd,3) = 0; // success
+ WFIFOSET(fd, packet_len_table[0x0d2]);
+ } else {
+ WFIFOB(fd,3) = 1; // fail
+ WFIFOSET(fd, packet_len_table[0x0d2]);
+ clif_wis_message(fd, wisp_server_name, "You already allow everyone.", strlen("You already allow everyone.") + 1);
+ }
+ }
return;
}
+void clif_parse_skillMessage(int fd, struct map_session_data *sd) { // Added by RoVeRT
+ int skillid,skilllv, x, y;
+ char *mes;
+
+ skilllv = RFIFOW(fd,2);
+ skillid = RFIFOW(fd,4);
+
+ y = RFIFOB(fd,6);
+ x = RFIFOB(fd,8);
+
+ mes = RFIFOP(fd,10);
+
+ // skill 220 = graffiti
+// printf("skill: %d %d location: %3d %3d message: %s\n", skillid, skilllv, x, y, (char*)mes);
+}
+
int monk(struct map_session_data *sd, struct block_list *target, int type) {
//R 01d1 <Monk id>L <Target monster id>L <Bool>L
int fd=sd->fd;
@@ -9281,7 +9695,7 @@ int monk(struct map_session_data *sd, struct block_list *target, int type) {
WFIFOL(fd,2)=sd->bl.id;
WFIFOL(fd,6)=target->id;
WFIFOL(fd,10)=type;
- WFIFOSET(fd,packet_db[0x1d1].len);
+ WFIFOSET(fd,packet_len_table[0x1d1]);
return 0;
}
@@ -9290,7 +9704,7 @@ int monk(struct map_session_data *sd, struct block_list *target, int type) {
* スパノビの/doridoriによるSPR2倍
*------------------------------------------
*/
-void clif_parse_sn_doridori(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_sn_doridori(int fd, struct map_session_data *sd) {
if (sd)
sd->doridori_counter = 1;
@@ -9300,7 +9714,7 @@ void clif_parse_sn_doridori(int fd, struct map_session_data *sd, int cmd) {
* スパノビの爆裂波動
*------------------------------------------
*/
-void clif_parse_sn_explosionspirits(int fd, struct map_session_data *sd, int cmd)
+void clif_parse_sn_explosionspirits(int fd, struct map_session_data *sd)
{
if(sd){
int nextbaseexp=pc_nextbaseexp(sd);
@@ -9320,282 +9734,219 @@ void clif_parse_sn_explosionspirits(int fd, struct map_session_data *sd, int cmd
}
/*==========================================
- * Friends List (davidsiaw)
+ * Friends List
*------------------------------------------
*/
-void clif_friends_list_send(struct map_session_data *sd)
-{
- unsigned char buf[1024];
- int i,n=0;
-
- // Packet name
- WBUFW(buf,0)=0x201;
-
- // check all 20 friends. stop at 0
- for (i=0;i<20;i++)
- {
- if (!sd->status.friend_id[i])
- break;
+void clif_friends_list_send(struct map_session_data *sd) {
+ int i, n;
- WBUFL(buf,4 + 32 * n + 1)=sd->status.friend_id[i];
- //WBUFB(buf,4 + 32 * n + 5)=(online[n])?0:1; // <- We don't know this yet. I'd reckon its 5 but... i could be wrong.
-
- memcpy(WBUFP(buf,4 + 32 * n + 8),&sd->status.friend_name[i],23);
-
- n++;
- }
-
- WBUFW(buf,2) = 4 + 32 * n;
-
- memcpy(WFIFOP(sd->fd,0), buf, sizeof(buf));
- WFIFOSET(sd->fd,sizeof(buf));
- //clif_send(buf,WBUFW(buf,2),&sd->bl,SELF);
-
-}
-void clif_parse_friends_list_add(int fd,struct map_session_data *sd)
-{
- struct map_session_data *f_sd = map_nick2sd(RFIFOP(fd,2));
-
- int i=0;
-
- while (sd->status.friend_id[i]) { // Find an empty slot
-
- if (sd->status.friend_id[i] == f_sd->status.char_id) {
- clif_displaymessage(fd,"Friend already exists"); // Friend already exists
- return;
- }
- i++;
- if (i==20) {
- clif_displaymessage(fd,"Friends list is full.");
- return;
+ // Send friends list
+ n = 0;
+ WFIFOW(sd->fd, 0) = 0x201;
+ for(i = 0; i < 20; i++)
+ if (sd->status.friend_id[i]) {
+ WFIFOL(sd->fd,4 + 32 * n + 1) = sd->status.friend_id[i];
+ //WFIFOB(sd->fd,4 + 32 * n + 5) = (online[n]) ? 0 : 1; // <- We don't know this yet. I'd reckon its 5 but... i could be wrong.
+ memcpy(WFIFOP(sd->fd,4 + 32 * n + 8), &sd->status.friend_name[i], 23);
+ n++;
}
-
- }
-
- sd->status.friend_id[i] = f_sd->status.char_id;
- memcpy(sd->status.friend_name[i],f_sd->status.name,23);
- clif_displaymessage(fd,"Friend added.");
-
- for (i=i+1; i<20; i++)
- {
- sd->status.friend_id[i] = 0;
- }
-
- clif_friends_list_send(sd);
-
- //printf("clif_parse_friends_list_add");
-
+ WFIFOW(sd->fd,2) = 4 + 32 * n;
+ WFIFOSET(sd->fd, WFIFOW(sd->fd,2));
}
-void clif_parse_friends_list_remove(int fd,struct map_session_data *sd)
-{
- // 0x203 </o> <ID to be removed W 4B>
-
- int id = RFIFOL(fd,3);
- char mes[80];
- int i=0;
+void clif_parse_friends_list_add(int fd, struct map_session_data *sd) {
+ struct map_session_data *f_sd;
+ int i;
+ f_sd = map_nick2sd(RFIFOP(fd,2));
- while (sd->status.friend_id[i] != id)
- {
- sprintf(mes, "Compare: %d and %d", id, sd->status.friend_id[i]);
- clif_displaymessage(fd,mes);
- i++;
- if (i==20)
- {
- clif_displaymessage (fd,"Name not found in list");
- clif_friends_list_send(sd);
- return;
- }
+ // Friend doesn't exist (no player with this name)
+ if (f_sd == NULL) {
+ clif_displaymessage(fd, "This name (for a friend) doesn't exist.");
+ return;
}
- sd->status.friend_id[i] = 0;
- memcpy(sd->status.friend_name[i],"",23);
-
- // move all chars up
-
- for (i=i+1; i<20; i++)
- {
- if(sd->status.friend_name[i])
- {
- sd->status.friend_id[i] = sd->status.friend_id[i-1];
- memcpy(sd->status.friend_name[i],sd->status.friend_name[i-1],23);
- }
- else
- {
- sd->status.friend_id[i] = 0;
- memcpy(sd->status.friend_name[i],"",23);
+ // Friend already exists
+ for (i = 0; i < 20; i++)
+ if (sd->status.friend_id[i] == f_sd->status.char_id) {
+ clif_displaymessage(fd, "Friend already exists.");
+ return;
}
+ // Find an empty slot
+ for (i = 0; i < 20; i++)
+ if (sd->status.friend_id[i] == 0)
+ break;
+ if (i == 20) {
+ clif_displaymessage(fd, "Friends list is full.");
+ return;
}
+ sd->status.friend_id[i] = f_sd->status.char_id;
+ memset(sd->status.friend_name[i], 0, sizeof(sd->status.friend_name[i]));
+ memcpy(sd->status.friend_name[i], f_sd->status.name, 23);
+ clif_displaymessage(fd, "Friend added.");
+
clif_friends_list_send(sd);
-
-}
-/*==========================================
- * Whisper Ignoring [ /ex /in ]
- *------------------------------------------
- */
-int pstrcmp(const void *a, const void *b)
-{
- return strcmp((char *)a, (char *)b);
-}
-void clif_parse_wisexin(int fd,struct map_session_data *sd, int cmd)
-{
- int type = RFIFOB(fd,packet_db[cmd].pos[1]);
- int i,flag=1;
+ //printf("clif_parse_friends_list_add");
- if(sd){
- qsort(sd->wis_refusal[0], MAX_WIS_REFUSAL, sizeof(sd->wis_refusal[0]), pstrcmp);
- if(type==0){ //ex
- for(i=0;i<MAX_WIS_REFUSAL;i++){ //すでに追加されていれば何もしない
- if(strcmp(sd->wis_refusal[i],RFIFOP(fd,packet_db[cmd].pos[0]))==0){
- flag=0;
- clif_wisexin(sd, type, flag);
- return;
- }
- }
- for(i=0;i<MAX_WIS_REFUSAL;i++){ //空の拒否リストに追加(とりあえず)
- if(sd->wis_refusal[i][0]==0){
- memcpy(sd->wis_refusal[i],RFIFOP(fd,packet_db[cmd].pos[0]),24);
- flag=0;
- break;
- }
- }
- if(flag==1){
- memcpy(sd->wis_refusal[MAX_WIS_REFUSAL-1],RFIFOP(fd,packet_db[cmd].pos[0]),24);
- flag=0;
- }
- }else{ //in
- for(i=0;i<MAX_WIS_REFUSAL;i++){ //一致する拒否リストを空に
- if(strcmp(sd->wis_refusal[i],RFIFOP(fd,packet_db[cmd].pos[0]))==0){
- sd->wis_refusal[i][0]=0;
- flag=0;
- }
- }
- sd->wis_all = 0;
- }
- clif_wisexin(sd, type, flag);
- }
return;
}
-/*==========================================
- * View Whisper List [ /ex ]
- *------------------------------------------
- */
-void clif_parse_wisexlist(int fd,struct map_session_data *sd, int cmd)
-{
- int i,j=0,count=0;
-
- if(sd){
- qsort(sd->wis_refusal[0], MAX_WIS_REFUSAL, sizeof(sd->wis_refusal[0]), pstrcmp);
- for(i=0;i<MAX_WIS_REFUSAL;i++){ //中身があるのを数える
- if(sd->wis_refusal[i][0]!=0)
- count++;
- }
- WFIFOW(fd,0)=0xd4;
- WFIFOW(fd,2)=4+(24*count);
- for(i=0;i<MAX_WIS_REFUSAL;i++){
- if(sd->wis_refusal[i][0]!=0){
- memcpy(WFIFOP(fd,4+j*24),sd->wis_refusal[i],24);
- j++;
+void clif_parse_friends_list_remove(int fd, struct map_session_data *sd) {
+ // 0x203 </o> <ID to be removed W 4B>
+ int id = RFIFOL(fd,3);
+ int i, j;
+
+ // Search friend
+ for (i = 0; i < 20; i ++)
+ if (sd->status.friend_id[i] == id) {
+ // move all chars down
+ for(j = i + 1; j < 20; j++) {
+ sd->status.friend_id[j-1] = sd->status.friend_id[j];
+ memcpy(sd->status.friend_name[j-1], sd->status.friend_name[j], sizeof(sd->status.friend_name[j]));
}
+ sd->status.friend_id[19] = 0;
+ memset(sd->status.friend_name[19], 0, sizeof(sd->status.friend_name[19]));
+ clif_displaymessage(fd, "Friend removed");
+ clif_friends_list_send(sd);
+ break;
}
- WFIFOSET(fd,WFIFOW(fd,2));
- if(count>=MAX_WIS_REFUSAL) //満タンなら最後の1個を消す
- sd->wis_refusal[MAX_WIS_REFUSAL-1][0]=0;
- }
- return;
-}
+ if (i == 20)
+ clif_displaymessage(fd, "Name not found in list.");
-/*==========================================
- * Block and Allow all Whispers /exall /inall
- *------------------------------------------
- */
-void clif_parse_wisall(int fd,struct map_session_data *sd, int cmd)
-{
- int type = RFIFOB(fd,packet_db[cmd].pos[0]);
- int i;
-
- if(sd){
- if(type==0) //exall
- sd->wis_all = 1;
- else{ //inall
- for(i=0;i<MAX_WIS_REFUSAL;i++) //拒否リストを空に
- sd->wis_refusal[i][0]=0;
- sd->wis_all = 0;
- }
- clif_wisall(sd, type, 0);
- }
+ return;
}
/*==========================================
* /killall
*------------------------------------------
*/
-void clif_parse_GMkillall(int fd,struct map_session_data *sd, int cmd)
+void clif_parse_GMkillall(int fd,struct map_session_data *sd)
{
char message[50];
-
- nullpo_retv(sd);
-
- strncpy(message,sd->status.name,24);
- is_atcommand(fd,sd,strcat(message," : @kickall"),0);
- return;
-}
-/*==========================================
- * /summon
- *------------------------------------------
- */
-void clif_parse_GMsummon(int fd,struct map_session_data *sd, int cmd)
-{
- char message[100];
-
nullpo_retv(sd);
-
- strncpy(message,sd->status.name,24);
- strcat(message," : @recall ");
- strncat(message,RFIFOP(fd,packet_db[cmd].pos[0]),24);
- is_atcommand(fd,sd,message,0);
- return;
-}
-/*==========================================
- * /shift
- *------------------------------------------
- */
-void clif_parse_GMshift(int fd,struct map_session_data *sd, int cmd)
-{
- char message[100];
-
- nullpo_retv(sd);
-
- strncpy(message,sd->status.name,24);
- strcat(message," : @jumpto ");
- strncat(message,RFIFOP(fd,packet_db[cmd].pos[0]),24);
- is_atcommand(fd,sd,message,0);
+
+ strncpy(message,sd->status.name, 24);
+ is_atcommand(fd, sd, strcat(message," : @kickall"),0);
+
return;
}
-/*==========================================
- * Debugging
- *------------------------------------------
- */
-void clif_parse_debug(int fd,struct map_session_data *sd, int cmd)
-{
- int i;
- printf("packet debug 0x%4X\n",cmd);
- printf("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
- for(i=0;i<packet_db[cmd].len;i++){
- if((i&15)==0)
- printf("\n%04X ",i);
- printf("%02X ",RFIFOB(fd,i));
- }
- printf("\n");
-}
+// functions list
+static void (*clif_parse_func_table[7][0x220])() = {
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+ // 40
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+ // 70
+ NULL, NULL, clif_parse_WantToConnection, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, clif_parse_LoadEndAck, clif_parse_TickSend, NULL,
+
+ // 80
+ NULL, NULL, NULL, NULL, NULL, clif_parse_WalkToXY, NULL, NULL,
+ NULL, clif_parse_ActionRequest, NULL, NULL, clif_parse_GlobalMessage, NULL, NULL, NULL,
+ // 90
+ clif_parse_NpcClicked, NULL, NULL, NULL, clif_parse_GetCharNameRequest, NULL, clif_parse_Wis, NULL,
+ NULL, clif_parse_GMmessage, NULL, clif_parse_ChangeDir, NULL, NULL, NULL, clif_parse_TakeItem,
+ // a0
+ NULL, NULL, clif_parse_DropItem, NULL, NULL, NULL, NULL, clif_parse_UseItem,
+ NULL, clif_parse_EquipItem, NULL, clif_parse_UnequipItem, NULL, NULL, NULL, NULL,
+ // b0
+ NULL, NULL, clif_parse_Restart, NULL, NULL, NULL, NULL, NULL,
+ clif_parse_NpcSelectMenu, clif_parse_NpcNextClicked, NULL, clif_parse_StatusUp, NULL, NULL, NULL, clif_parse_Emotion,
+
+ // c0
+ NULL, clif_parse_HowManyConnections, NULL, NULL, NULL, clif_parse_NpcBuySellSelected, NULL, NULL,
+ clif_parse_NpcBuyListSend, clif_parse_NpcSellListSend, NULL, NULL, clif_parse_GMKick, NULL, clif_parse_GMkillall, clif_parse_PMIgnore,
+ // d0
+ clif_parse_PMIgnoreAll, NULL, NULL, NULL, NULL, clif_parse_CreateChatRoom, NULL, NULL,
+ NULL, clif_parse_ChatAddMember, NULL, NULL, NULL, NULL, clif_parse_ChatRoomStatusChange, NULL,
+ // e0
+ clif_parse_ChangeChatOwner, NULL, clif_parse_KickFromChat, clif_parse_ChatLeave, clif_parse_TradeRequest, NULL, clif_parse_TradeAck, NULL,
+ clif_parse_TradeAddItem, NULL, NULL, clif_parse_TradeOk, NULL, clif_parse_TradeCansel, NULL, clif_parse_TradeCommit,
+ // f0
+ NULL, NULL, NULL, clif_parse_MoveToKafra, NULL, clif_parse_MoveFromKafra, NULL, clif_parse_CloseKafra,
+ NULL, clif_parse_CreateParty, NULL, NULL, clif_parse_PartyInvite, NULL, NULL, clif_parse_ReplyPartyInvite,
+
+ // 100
+ clif_parse_LeaveParty, NULL, clif_parse_PartyChangeOption, clif_parse_RemovePartyMember, NULL, NULL, NULL, NULL,
+ clif_parse_PartyMessage, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ // 110
+ NULL, NULL, clif_parse_SkillUp, clif_parse_UseSkillToId, NULL, NULL, clif_parse_UseSkillToPos, NULL,
+ clif_parse_StopAttack, NULL, NULL, clif_parse_UseSkillMap, NULL, clif_parse_RequestMemo, NULL, NULL,
+ // 120
+ NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_PutItemToCart, clif_parse_GetItemFromCart,
+ clif_parse_MoveFromKafraToCart, clif_parse_MoveToKafraFromCart, clif_parse_RemoveOption, NULL, NULL, NULL, clif_parse_CloseVending, NULL,
+ // 130
+ clif_parse_VendingListReq, NULL, NULL, NULL, clif_parse_PurchaseReq, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_GM_Monster_Item,
+
+ // 140
+ clif_parse_MapMove, NULL, NULL, clif_parse_NpcAmountInput, NULL, NULL, clif_parse_NpcCloseClicked, NULL,
+ NULL, clif_parse_GMReqNoChat, NULL, NULL, NULL, clif_parse_GuildCheckMaster, NULL, clif_parse_GuildReqeustInfo,
+ // 150
+ NULL, clif_parse_GuildRequestEmblem, NULL, clif_parse_GuildChangeEmblem, NULL, clif_parse_GuildChangeMemberPosition, NULL, NULL,
+ NULL, clif_parse_GuildLeave, NULL, clif_parse_GuildExplusion, NULL, clif_parse_GuildBreak, NULL, NULL,
+ // 160
+ NULL, clif_parse_GuildChangePositionInfo, NULL, NULL, NULL, clif_parse_CreateGuild, NULL, NULL,
+ clif_parse_GuildInvite, NULL, NULL, clif_parse_GuildReplyInvite, NULL, NULL, clif_parse_GuildChangeNotice, NULL,
+ // 170
+ clif_parse_GuildRequestAlliance, NULL, clif_parse_GuildReplyAlliance, NULL, NULL, NULL, NULL, NULL,
+ clif_parse_ItemIdentify, NULL, clif_parse_UseCard, NULL, clif_parse_InsertCard, NULL, clif_parse_GuildMessage, NULL,
+
+ // 180
+ clif_parse_GuildOpposition, NULL, NULL, clif_parse_GuildDelAlliance, NULL, NULL, NULL, NULL,
+ NULL, NULL, clif_parse_QuitGame, NULL, NULL, NULL, clif_parse_ProduceMix, NULL,
+ // 190
+ clif_parse_UseSkillToPos, NULL, NULL, clif_parse_SolveCharName, NULL, NULL, NULL, clif_parse_ResetChar,
+ NULL, NULL, NULL, NULL, clif_parse_LGMmessage, clif_parse_GMHide, NULL, clif_parse_CatchPet,
+ // 1a0
+ NULL, clif_parse_PetMenu, NULL, NULL, NULL, clif_parse_ChangePetName, NULL, clif_parse_SelectEgg,
+ NULL, clif_parse_SendEmotion, NULL, NULL, NULL, NULL, clif_parse_SelectArrow, clif_parse_ChangeCart,
+ // 1b0
+ NULL, NULL, clif_parse_OpenVending, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, clif_parse_Shift, clif_parse_Shift, clif_parse_Recall, clif_parse_Recall, NULL, NULL,
+
+ // 1c0
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_AutoSpell,
+ NULL,
+ // 1d0
+ NULL, NULL, NULL, NULL, NULL, clif_parse_NpcStringInput, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_GMReqNoChatCount,
+ // 1e0
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_sn_doridori,
+ clif_parse_CreateParty2, NULL, NULL, NULL, NULL, clif_parse_sn_explosionspirits, NULL, NULL,
+ // 1f0
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+ // 200
+ NULL, NULL, clif_parse_friends_list_add, clif_parse_friends_list_remove, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ // 210
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+#if 0
+ case 0xd3: clif_parse_IgnoreList
+#endif
+ },
+ {NULL},
+ {NULL},
+ {NULL},
+ {NULL},
+ {NULL},
+ {NULL}
+};
/*==========================================
* クライアントからのパケット解析
@@ -9603,21 +9954,22 @@ void clif_parse_debug(int fd,struct map_session_data *sd, int cmd)
*------------------------------------------
*/
static int clif_parse(int fd) {
- int packet_len = 0, cmd;
+ int packet_len = 0, cmd, packet_ver;
struct map_session_data *sd;
-
+
sd = session[fd]->session_data;
// 接続が切れてるので後始末
- if (!chrif_isconnect())
- session[fd]->eof = 1;
- if(session[fd]->eof) { // char鯖に繋がってない間は接続禁止 (!chrif_isconnect())
+ if (!chrif_isconnect() || session[fd]->eof) { // char鯖に繋がってない間は接続禁止 (!chrif_isconnect())
if (sd && sd->state.auth) {
- clif_quitsave(fd, sd);
- if(sd->status.name!=NULL && battle_config.etc_log)
- printf("Player [%s] Has Logged Off Your Server.\n",sd->status.name); // Player logout display [Valaris]
+ if (chrif_isconnect())
+ clif_quitsave(fd, sd);
+ if (sd->status.name != NULL)
+ printf("Player [%s] has logged off your server.\n", sd->status.name); // Player logout display [Valaris]
+ else
+ printf("Player with account [%d] has logged off your server.\n", sd->bl.id); // Player logout display [Yor]
} else if (sd) { // not authentified! (refused by char-server or disconnect before to be authentified)
-// printf("Player with account [%d] has logged off your server (not auth account).\n", sd->bl.id); // Player logout display [Yor]
+ printf("Player with account [%d] has logged off your server (not auth account).\n", sd->bl.id); // Player logout display [Yor]
map_deliddb(&sd->bl); // account_id has been included in the DB before auth answer
}
close(fd);
@@ -9625,9 +9977,11 @@ static int clif_parse(int fd) {
return 0;
}
- if(RFIFOREST(fd)<2)
+ if (RFIFOREST(fd) < 2)
return 0;
+ //printf("clif_parse: connection #%d, packet: 0x%x (with being read: %d bytes).\n", fd, RFIFOW(fd,0), RFIFOREST(fd));
+
cmd = RFIFOW(fd,0);
// 管理用パケット処理
@@ -9646,35 +10000,88 @@ static int clif_parse(int fd) {
RFIFOSKIP(fd,2);
break;
case 0x7532: // 接続の切断
- close(fd);
session[fd]->eof = 1;
break;
}
return 0;
}
- // ゲーム用以外パケットか、認証を終える前に0072以外が来たら、切断する
- if(cmd>=MAX_PACKET_DB || packet_db[cmd].len==0 ||
- ((!sd || (sd && sd->state.auth==0)) && packet_db[cmd].func!=clif_parse_WantToConnection) ){
+ // get packet version before to parse
+ packet_ver = 0;
+ if (sd)
+ packet_ver = sd->packet_ver;
+ // check authentification packet to know packet version
+ else {
+ // 0x72
+ if (cmd == 0x72) {
+ if (RFIFOREST(fd) >= 39 && (RFIFOB(fd,38) == 0 || RFIFOB(fd,38) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 7; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ else if (RFIFOREST(fd) >= 22 && (RFIFOB(fd,21) == 0 || RFIFOB(fd,21) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 6; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ else if (RFIFOREST(fd) >= 19 && (RFIFOB(fd,18) == 0 || RFIFOB(fd,18) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 5; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ // else probably incomplete packet
+ else if (RFIFOREST(fd) < 19)
+ return 0;
+ // 0x7E
+ } else if (cmd == 0x7E) {
+ if (RFIFOREST(fd) >= 37 && (RFIFOB(fd,36) == 0 || RFIFOB(fd,36) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 9; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ else if (RFIFOREST(fd) >= 33 && (RFIFOB(fd,32) == 0 || RFIFOB(fd,32) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 8; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ // else probably incomplete packet
+ else if (RFIFOREST(fd) < 33)
+ return 0;
+ // 0xF5
+ } else {
+ if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 10; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ else if (RFIFOREST(fd) >= 33 && (RFIFOB(fd,32) == 0 || RFIFOB(fd,32) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 12; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ else if (RFIFOREST(fd) >= 32 && (RFIFOB(fd,31) == 0 || RFIFOB(fd,31) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 11; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ else if (RFIFOREST(fd) >= 29 && (RFIFOB(fd,28) == 0 || RFIFOB(fd,28) == 1)) // 00 = Female, 01 = Male
+ packet_ver = 13; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
+ // else probably incomplete packet
+ else if (RFIFOREST(fd) < 29)
+ return 0;
+ }
+ // check if version is accepted
+ if ((packet_ver == 5 && (battle_config.packet_ver_flag & 1) == 0) ||
+ (packet_ver == 6 && (battle_config.packet_ver_flag & 2) == 0) ||
+ (packet_ver == 7 && (battle_config.packet_ver_flag & 4) == 0) ||
+ (packet_ver == 8 && (battle_config.packet_ver_flag & 8) == 0) ||
+ (packet_ver == 9 && (battle_config.packet_ver_flag & 16) == 0) ||
+ (packet_ver == 10 && (battle_config.packet_ver_flag & 32) == 0) ||
+ (packet_ver == 11 && (battle_config.packet_ver_flag & 64) == 0) ||
+ (packet_ver == 12 && (battle_config.packet_ver_flag & 128) == 0) ||
+ (packet_ver == 13 && (battle_config.packet_ver_flag & 256) == 0)) {
+ WFIFOW(fd,0) = 0x6a;
+ WFIFOB(fd,2) = 5; // 05 = Game's EXE is not the latest version
+ WFIFOSET(fd,23);
+ session[fd]->eof = 1;
+ return 0;
+ }
+ }
- close(fd);
+ // ゲーム用以外パケットか、認証を終える前に0072以外が来たら、切断する
+ if (packet_ver < 5 || packet_ver > 13 || // if packet is not inside these values: session is incorrect?? or auth packet is unknown
+ cmd >= 0x220 || packet_size_table[packet_ver-5][cmd] == 0) {
+ if (!fd)
+ return 0;
session[fd]->eof = 1;
- if(packet_db[cmd].len==0) {
- printf("clif_parse : %d %d %x\n",fd,packet_db[cmd].len,cmd);
- printf("%x length 0 packet disconnect %d\n",cmd,fd);
- }
+ printf("clif_parse: session #%d, packet 0x%x (%d bytes received) -> disconnected.\n", fd, cmd, RFIFOREST(fd));
return 0;
}
// パケット長を計算
- packet_len = packet_db[cmd].len;
- if(packet_len==-1){
- if(RFIFOREST(fd)<4)
- return 0; // 可変長パケットで長さの所までデータが来てない
+ packet_len = packet_size_table[packet_ver-5][cmd];
+ if (packet_len == -1) {
+ if (RFIFOREST(fd) < 4)
+ return 0; // 可変長パケットで長さの所までデータが来てない
packet_len = RFIFOW(fd,2);
- if(packet_len<4 || packet_len>32768){
- close(fd);
- session[fd]->eof =1;
+ if (packet_len < 4 || packet_len > 32768) {
+ session[fd]->eof = 1;
return 0;
}
}
@@ -9683,9 +10090,12 @@ static int clif_parse(int fd) {
if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) { // 切断待ちの場合パケットを処理しない
- }else if(packet_db[cmd].func){
+ } else if (packet_ver < 8 && clif_parse_func_table[0][cmd]) { // packet version 5-6-7 use same functions, but size are different
+ // パケット処理
+ clif_parse_func_table[0][cmd](fd, sd);
+ } else if (packet_ver >= 8 && clif_parse_func_table[packet_ver - 7][cmd]) {
// パケット処理
- packet_db[cmd].func(fd,sd,cmd);
+ clif_parse_func_table[packet_ver - 7][cmd](fd, sd);
} else {
// 不明なパケット
if (battle_config.error_log) {
@@ -9698,10 +10108,10 @@ static int clif_parse(int fd) {
char packet_txt[256] = "save/packet.txt";
time_t now;
printf("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
- for(i=0;i<packet_len;i++){
- if((i&15)==0)
+ for(i = 0; i < packet_len; i++) {
+ if ((i & 15) == 0)
printf("\n%04X ",i);
- printf("%02X ",RFIFOB(fd,i));
+ printf("%02X ", RFIFOB(fd,i));
}
if (sd && sd->state.auth) {
if (sd->status.name != NULL)
@@ -9745,112 +10155,220 @@ static int clif_parse(int fd) {
}
/*==========================================
- * Read the Packet Database file.
- *------------------------------------------
- */
-static int packetdb_readdb(void)
-{
- FILE *fp;
- char line[1024];
- int ln=0;
- int cmd,j;
- char *str[32],*p,*str2[32],*p2;
-
- memset(packet_db,0,sizeof(packet_db));
-
- if( (fp=fopen("db/packet_db.txt","r"))==NULL ){
- printf("can't read db/packet_db.txt\n");
- exit(1);
- }
- while(fgets(line,1020,fp)){
- if(line[0]=='/' && line[1]=='/')
- continue;
- memset(str,0,sizeof(str));
- for(j=0,p=line;j<4 && p;j++){
- str[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
- if(str[0]==NULL)
- continue;
-
- cmd=strtol(str[0],(char **)NULL,0);
- if(cmd<=0 || cmd>=MAX_PACKET_DB)
- continue;
-
- if(str[1]==NULL){
- printf("packet_db: packet len error\n");
- exit(1);
- }
- packet_db[cmd].len = atoi(str[1]);
-
- if(str[2]==NULL){
- ln++;
- continue;
- }
- for(j=0;j<sizeof(clif_parse_func)/sizeof(clif_parse_func[0]);j++){
- if(clif_parse_func[j].name == NULL){
- printf("packet_db: %d 0x%x no func %s\n",ln+1,cmd,str[2]);
- exit(1);
- }
- if( strcmp(str[2],clif_parse_func[j].name)==0){
- packet_db[cmd].func=clif_parse_func[j].func;
- break;
- }
- }
- if(str[3]==NULL){
- printf("packet_db: packet error\n");
- exit(1);
- }
- for(j=0,p2=str[3];p2;j++){
- str2[j]=p2;
- p2=strchr(p2,':');
- if(p2) *p2++=0;
- packet_db[cmd].pos[j]=atoi(str2[j]);
- }
-
- ln++;
-// if(packet_db[cmd].len > 2 && packet_db[cmd].pos[0] == 0)
-// printf("packet_db:? %d 0x%x %d %s %p\n",ln,cmd,packet_db[cmd].len,str[2],packet_db[cmd].func);
- }
- fclose(fp);
- printf("read db/packet_db.txt done (Packets=%d)\n",ln);
- return 0;
-
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-int do_final_clif(void)
-{
- delete_session(map_fd);
- return 0;
-}
-
-/*==========================================
*
*------------------------------------------
*/
int do_init_clif(void) {
+#ifndef __WIN32
int i;
+#endif
+
+ // functions of packet version 5-6-7 are same, but size are different
+ // init packet function calls for packet ver 8
+ memcpy(clif_parse_func_table[1], clif_parse_func_table[0], sizeof(clif_parse_func_table[0]));
+ clif_parse_func_table[1][0x072] = clif_parse_DropItem;
+ clif_parse_func_table[1][0x07e] = clif_parse_WantToConnection;
+ clif_parse_func_table[1][0x085] = clif_parse_UseSkillToId;
+ clif_parse_func_table[1][0x089] = clif_parse_GetCharNameRequest;
+ clif_parse_func_table[1][0x08c] = clif_parse_UseSkillToPos;
+ clif_parse_func_table[1][0x094] = clif_parse_TakeItem;
+ clif_parse_func_table[1][0x09b] = clif_parse_WalkToXY;
+ clif_parse_func_table[1][0x09f] = clif_parse_ChangeDir;
+ clif_parse_func_table[1][0x0a2] = clif_parse_UseSkillToPos;
+ clif_parse_func_table[1][0x0a7] = clif_parse_SolveCharName;
+ clif_parse_func_table[1][0x0f3] = clif_parse_GlobalMessage;
+ clif_parse_func_table[1][0x0f5] = clif_parse_UseItem;
+ clif_parse_func_table[1][0x0f7] = clif_parse_TickSend;
+ clif_parse_func_table[1][0x113] = clif_parse_MoveToKafra;
+ clif_parse_func_table[1][0x116] = clif_parse_CloseKafra;
+ clif_parse_func_table[1][0x190] = clif_parse_MoveFromKafra;
+ clif_parse_func_table[1][0x193] = clif_parse_ActionRequest;
+ // init packet function calls for packet ver 9 (same function of packet version 8, but size are different)
+ memcpy(clif_parse_func_table[2], clif_parse_func_table[1], sizeof(clif_parse_func_table[0]));
+ // init packet function calls for packet ver 10
+ memcpy(clif_parse_func_table[3], clif_parse_func_table[2], sizeof(clif_parse_func_table[0]));
+ clif_parse_func_table[3][0x072] = clif_parse_UseItem;
+ clif_parse_func_table[3][0x07e] = clif_parse_MoveToKafra;
+ clif_parse_func_table[3][0x085] = clif_parse_ActionRequest;
+ clif_parse_func_table[3][0x089] = clif_parse_WalkToXY;
+ clif_parse_func_table[3][0x08c] = clif_parse_UseSkillToPos;
+ clif_parse_func_table[3][0x094] = clif_parse_DropItem;
+ clif_parse_func_table[3][0x09b] = clif_parse_GetCharNameRequest;
+ clif_parse_func_table[3][0x09f] = clif_parse_GlobalMessage;
+ clif_parse_func_table[3][0x0a2] = clif_parse_SolveCharName;
+ clif_parse_func_table[3][0x0a7] = clif_parse_UseSkillToPos;
+ clif_parse_func_table[3][0x0f3] = clif_parse_ChangeDir;
+ clif_parse_func_table[3][0x0f5] = clif_parse_WantToConnection;
+ clif_parse_func_table[3][0x0f7] = clif_parse_CloseKafra;
+ clif_parse_func_table[3][0x113] = clif_parse_TakeItem;
+ clif_parse_func_table[3][0x116] = clif_parse_TickSend;
+ clif_parse_func_table[3][0x190] = clif_parse_UseSkillToId;
+ clif_parse_func_table[3][0x193] = clif_parse_MoveFromKafra;
+ // init packet function calls for packet ver 11 (same function of packet version 10, but size are different)
+ memcpy(clif_parse_func_table[4], clif_parse_func_table[3], sizeof(clif_parse_func_table[0]));
+ // init packet function calls for packet ver 12 (same function of packet version 11, but size are different)
+ memcpy(clif_parse_func_table[5], clif_parse_func_table[4], sizeof(clif_parse_func_table[0]));
+ // init packet function calls for packet ver 13 (same function of packet version 12, but size are different)
+ memcpy(clif_parse_func_table[6], clif_parse_func_table[5], sizeof(clif_parse_func_table[0]));
+
+ // size of packet version 5
+ memcpy(&packet_size_table[0], &packet_len_table, sizeof(packet_len_table));
+ // size of packet version 6
+ memcpy(&packet_size_table[1], &packet_size_table[0], sizeof(packet_len_table));
+ packet_size_table[1][0x072] = 22;
+ packet_size_table[1][0x085] = 8;
+ packet_size_table[1][0x0a7] = 13;
+ packet_size_table[1][0x113] = 15;
+ packet_size_table[1][0x116] = 15;
+ packet_size_table[1][0x190] = 95;
+ // size of packet version 7
+ memcpy(&packet_size_table[2], &packet_size_table[1], sizeof(packet_len_table));
+ packet_size_table[2][0x072] = 39;
+ packet_size_table[2][0x085] = 9;
+ packet_size_table[2][0x09b] = 13;
+ packet_size_table[2][0x09f] = 10;
+ packet_size_table[2][0x0a7] = 17;
+ packet_size_table[2][0x113] = 19;
+ packet_size_table[2][0x116] = 19;
+ packet_size_table[2][0x190] = 99;
+ // size of packet version 8
+ memcpy(&packet_size_table[3], &packet_size_table[2], sizeof(packet_len_table));
+ packet_size_table[3][0x072] = 14;
+ packet_size_table[3][0x07e] = 33;
+ packet_size_table[3][0x085] = 20;
+ packet_size_table[3][0x089] = 15;
+ packet_size_table[3][0x08c] = 23;
+ packet_size_table[3][0x094] = 10;
+ packet_size_table[3][0x09b] = 6;
+ packet_size_table[3][0x09f] = 13;
+ packet_size_table[3][0x0a2] = 103;
+ packet_size_table[3][0x0a7] = 12;
+ packet_size_table[3][0x0f3] = -1;
+ packet_size_table[3][0x0f5] = 17;
+ packet_size_table[3][0x0f7] = 10;
+ packet_size_table[3][0x113] = 16;
+ packet_size_table[3][0x116] = 2;
+ packet_size_table[3][0x190] = 26;
+ packet_size_table[3][0x193] = 9;
+ // size of packet version 9
+ memcpy(&packet_size_table[4], &packet_size_table[3], sizeof(packet_len_table));
+ packet_size_table[4][0x072] = 17;
+ packet_size_table[4][0x07e] = 37;
+ packet_size_table[4][0x085] = 26;
+ packet_size_table[4][0x089] = 12;
+ packet_size_table[4][0x08c] = 40;
+ packet_size_table[4][0x094] = 13;
+ packet_size_table[4][0x09b] = 15;
+ packet_size_table[4][0x09f] = 12;
+ packet_size_table[4][0x0a2] = 120;
+ packet_size_table[4][0x0a7] = 11;
+// packet_size_table[4][0x0f3] = -1;
+ packet_size_table[4][0x0f5] = 24;
+ packet_size_table[4][0x0f7] = 13;
+ packet_size_table[4][0x113] = 23;
+// packet_size_table[4][0x116] = 2;
+ packet_size_table[4][0x190] = 26;
+ packet_size_table[4][0x193] = 18;
+ // new packet
+ packet_size_table[4][0x20f] = 10;
+ packet_size_table[4][0x210] = 22;
+ packet_size_table[4][0x212] = 26;
+ packet_size_table[4][0x213] = 26;
+ packet_size_table[4][0x214] = 42;
+ // size of packet version 10
+ memcpy(&packet_size_table[5], &packet_size_table[4], sizeof(packet_len_table));
+ packet_size_table[5][0x072] = 20;
+ packet_size_table[5][0x07e] = 19;
+ packet_size_table[5][0x085] = 23;
+ packet_size_table[5][0x089] = 9;
+ packet_size_table[5][0x08c] = 105;
+ packet_size_table[5][0x094] = 17;
+ packet_size_table[5][0x09b] = 14;
+ packet_size_table[5][0x09f] = -1;
+ packet_size_table[5][0x0a2] = 14;
+ packet_size_table[5][0x0a7] = 25;
+ packet_size_table[5][0x0f3] = 10;
+ packet_size_table[5][0x0f5] = 34;
+ packet_size_table[5][0x0f7] = 2;
+ packet_size_table[5][0x113] = 11;
+ packet_size_table[5][0x116] = 11;
+ packet_size_table[5][0x190] = 22;
+ packet_size_table[5][0x193] = 17;
+ // size of packet version 11
+ memcpy(&packet_size_table[6], &packet_size_table[5], sizeof(packet_len_table));
+ packet_size_table[6][0x072] = 18;
+ packet_size_table[6][0x07e] = 25;
+ packet_size_table[6][0x085] = 9;
+ packet_size_table[6][0x089] = 14;
+ packet_size_table[6][0x08c] = 109;
+ packet_size_table[6][0x094] = 19;
+ packet_size_table[6][0x09b] = 10;
+// packet_size_table[6][0x09f] = -1;
+ packet_size_table[6][0x0a2] = 10;
+ packet_size_table[6][0x0a7] = 29;
+ packet_size_table[6][0x0f3] = 18;
+ packet_size_table[6][0x0f5] = 32;
+// packet_size_table[6][0x0f7] = 2;
+ packet_size_table[6][0x113] = 14;
+ packet_size_table[6][0x116] = 14;
+ packet_size_table[6][0x190] = 14;
+ packet_size_table[6][0x193] = 12;
+ // size of packet version 12
+ memcpy(&packet_size_table[7], &packet_size_table[6], sizeof(packet_len_table));
+ packet_size_table[7][0x072] = 17;
+ packet_size_table[7][0x07e] = 16;
+// packet_size_table[7][0x085] = 9;
+ packet_size_table[7][0x089] = 6;
+ packet_size_table[7][0x08c] = 103;
+ packet_size_table[7][0x094] = 14;
+ packet_size_table[7][0x09b] = 15;
+// packet_size_table[7][0x09f] = -1;
+ packet_size_table[7][0x0a2] = 12;
+ packet_size_table[7][0x0a7] = 23;
+ packet_size_table[7][0x0f3] = 13;
+ packet_size_table[7][0x0f5] = 33;
+// packet_size_table[7][0x0f7] = 2;
+ packet_size_table[7][0x113] = 10;
+ packet_size_table[7][0x116] = 10;
+ packet_size_table[7][0x190] = 20;
+ packet_size_table[7][0x193] = 26;
+ // size of packet version 13
+ memcpy(&packet_size_table[8], &packet_size_table[7], sizeof(packet_len_table));
+ packet_size_table[8][0x072] = 13;
+ packet_size_table[8][0x07e] = 13;
+ packet_size_table[8][0x085] = 15;
+// packet_size_table[8][0x089] = 6;
+ packet_size_table[8][0x08c] = 108;
+ packet_size_table[8][0x094] = 12;
+ packet_size_table[8][0x09b] = 10;
+// packet_size_table[8][0x09f] = -1;
+ packet_size_table[8][0x0a2] = 16;
+ packet_size_table[8][0x0a7] = 28;
+ packet_size_table[8][0x0f3] = 15;
+ packet_size_table[8][0x0f5] = 29;
+// packet_size_table[8][0x0f7] = 2;
+ packet_size_table[8][0x113] = 9;
+ packet_size_table[8][0x116] = 9;
+ packet_size_table[8][0x190] = 26;
+ packet_size_table[8][0x193] = 22;
- packetdb_readdb();
set_defaultparse(clif_parse);
+#ifdef __WIN32
+ if (!make_listen_port(map_port)) {
+ printf("cant bind game port\n");
+ exit(1);
+ }
+#else
for(i = 0; i < 10; i++) {
if (make_listen_port(map_port))
break;
-#ifdef _WIN32
- Sleep(20000);
-#else
sleep(20);
-#endif
}
- if(i==10){
+ if (i == 10) {
printf("cant bind game port\n");
exit(1);
}
+#endif
add_timer_func_list(clif_waitclose, "clif_waitclose");
add_timer_func_list(clif_clearchar_delay_sub, "clif_clearchar_delay_sub");
diff --git a/src/map/clif.h b/src/map/clif.h
index cf2228e6b..95c982d72 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1,13 +1,11 @@
-// $Id: clif.h,v 1.4 2004/09/25 05:32:18 MouseJstr Exp $
+// $Id: clif.h 1952 2004-10-23 14:05:01Z Yor $
#ifndef _CLIF_H_
#define _CLIF_H_
-#include <sys/types.h>
-
-#ifdef _WIN32
-#include <winsock.h>
+#ifdef __WIN32
typedef unsigned int in_addr_t;
#else
+#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -15,14 +13,6 @@ typedef unsigned int in_addr_t;
#include "map.h"
-#define MAX_PACKET_DB 0x220
-
-struct packet_db {
- short len;
- void (*func)();
- short pos[20];
-};
-
void clif_setip(char*);
void clif_setport(int);
@@ -98,9 +88,9 @@ int clif_changechatstatus(struct chat_data*); // chat
void clif_emotion(struct block_list *bl,int type);
void clif_talkiebox(struct block_list *bl,char* talkie);
void clif_wedding_effect(struct block_list *bl);
-void clif_sitting(struct map_session_data *sd);
+//void clif_sitting(int fd, struct map_session_data *sd);
//void clif_callpartner(struct map_session_data *sd);
-//void clif_sitting(struct map_session_data *sd);
+void clif_sitting(struct map_session_data *sd);
void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *name,int type);
// trade
diff --git a/src/map/intif.c b/src/map/intif.c
index 5b5ddc8d7..67521599b 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -623,20 +623,26 @@ int intif_parse_WisMessage(int fd) { // rewritten by [Yor]
// printf("intif_parse_wismessage: %d %s %s %s\n",id,RFIFOP(fd,6),RFIFOP(fd,30),RFIFOP(fd,54) );
sd=map_nick2sd(RFIFOP(fd,32)); // 送信先を探す
- if(sd!=NULL){
+ if(sd!=NULL && strcmp(sd->status.name, RFIFOP(fd,32)) == 0){
+/*
for(i=0;i<MAX_WIS_REFUSAL;i++){ //拒否リストに名前があるかどうか判定してあれば拒否
if(strcmp(sd->wis_refusal[i],RFIFOP(fd,8))==0){
j++;
break;
}
}
- if(sd->wis_all)
- intif_wis_replay(id,3); // 受信拒否
+*/
+ if(sd->ignoreAll == 1)
+ intif_wis_replay(RFIFOL(fd,4), 2); // 受信拒否
+/*
else if(j>0)
intif_wis_replay(id,2); // 受信拒否
+
else{
+*/
+ if(i == MAX_IGNORE_LIST) {
clif_wis_message(sd->fd,RFIFOP(fd,8),RFIFOP(fd,56),RFIFOW(fd,2)-56);
- intif_wis_replay(id,0); // 送信成功
+ intif_wis_replay(RFIFOL(fd,4),0); // 送信成功
}
}else
intif_wis_replay(id,1); // そんな人いません
diff --git a/src/map/map.h b/src/map/map.h
index 6e7f6c7e5..d622ecd35 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -31,7 +31,7 @@
#define MAX_LEVEL 255
#define MAX_WALKPATH 48
#define MAX_DROP_PER_MAP 48
-#define MAX_WIS_REFUSAL 14
+#define MAX_IGNORE_LIST 80
#define DEFAULT_AUTOSAVE_INTERVAL 60*1000
@@ -179,8 +179,10 @@ struct map_session_data {
char npc_str[256];
unsigned int chatID;
- char wis_refusal[MAX_WIS_REFUSAL][24]; //Refuse Whispers
- int wis_all; //Ignore all Whispers
+ struct{
+ char name[24];
+ } ignore[MAX_IGNORE_LIST];
+ int ignoreAll;
int attacktimer;
int attacktarget;