intif.c 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #include <sys/types.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <signal.h>
  7. #include <fcntl.h>
  8. #include <string.h>
  9. #include "../common/showmsg.h"
  10. #include "../common/socket.h"
  11. #include "../common/timer.h"
  12. #include "../common/nullpo.h"
  13. #include "../common/malloc.h"
  14. #include "map.h"
  15. #include "battle.h"
  16. #include "chrif.h"
  17. #include "clif.h"
  18. #include "pc.h"
  19. #include "intif.h"
  20. #include "storage.h"
  21. #include "party.h"
  22. #include "guild.h"
  23. #include "pet.h"
  24. #include "atcommand.h"
  25. #include "mercenary.h" //albator
  26. static const int packet_len_table[]={
  27. -1,-1,27,-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
  28. -1, 7, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810
  29. 39,-1,15,15, 14,19, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820
  30. 10,-1,15, 0, 79,19, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830
  31. 9, 9,-1,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3840
  32. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  33. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  34. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  35. 11,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
  36. -1,-1, 7, 3, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator]
  37. };
  38. extern int char_fd; // inter serverのfdはchar_fdを使う
  39. #define inter_fd (char_fd) // エイリアス
  40. //-----------------------------------------------------------------
  41. // inter serverへの送信
  42. int CheckForCharServer(void) {
  43. return ((char_fd <= 0) || session[char_fd] == NULL || session[char_fd]->wdata == NULL);
  44. }
  45. // pet
  46. int intif_create_pet(int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id,
  47. short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name)
  48. {
  49. if (CheckForCharServer())
  50. return 0;
  51. WFIFOHEAD(inter_fd, 24 + NAME_LENGTH);
  52. WFIFOW(inter_fd,0) = 0x3080;
  53. WFIFOL(inter_fd,2) = account_id;
  54. WFIFOL(inter_fd,6) = char_id;
  55. WFIFOW(inter_fd,10) = pet_class;
  56. WFIFOW(inter_fd,12) = pet_lv;
  57. WFIFOW(inter_fd,14) = pet_egg_id;
  58. WFIFOW(inter_fd,16) = pet_equip;
  59. WFIFOW(inter_fd,18) = intimate;
  60. WFIFOW(inter_fd,20) = hungry;
  61. WFIFOB(inter_fd,22) = rename_flag;
  62. WFIFOB(inter_fd,23) = incuvate;
  63. memcpy(WFIFOP(inter_fd,24),pet_name,NAME_LENGTH);
  64. WFIFOSET(inter_fd,24+NAME_LENGTH);
  65. return 0;
  66. }
  67. int intif_request_petdata(int account_id,int char_id,int pet_id)
  68. {
  69. if (CheckForCharServer())
  70. return 0;
  71. WFIFOHEAD(inter_fd, 14);
  72. WFIFOW(inter_fd,0) = 0x3081;
  73. WFIFOL(inter_fd,2) = account_id;
  74. WFIFOL(inter_fd,6) = char_id;
  75. WFIFOL(inter_fd,10) = pet_id;
  76. WFIFOSET(inter_fd,14);
  77. return 0;
  78. }
  79. int intif_save_petdata(int account_id,struct s_pet *p)
  80. {
  81. if (CheckForCharServer())
  82. return 0;
  83. WFIFOHEAD(inter_fd, sizeof(struct s_pet) + 8);
  84. WFIFOW(inter_fd,0) = 0x3082;
  85. WFIFOW(inter_fd,2) = sizeof(struct s_pet) + 8;
  86. WFIFOL(inter_fd,4) = account_id;
  87. memcpy(WFIFOP(inter_fd,8),p,sizeof(struct s_pet));
  88. WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
  89. return 0;
  90. }
  91. int intif_delete_petdata(int pet_id)
  92. {
  93. if (CheckForCharServer())
  94. return 0;
  95. WFIFOHEAD(inter_fd,6);
  96. WFIFOW(inter_fd,0) = 0x3083;
  97. WFIFOL(inter_fd,2) = pet_id;
  98. WFIFOSET(inter_fd,6);
  99. return 1;
  100. }
  101. int intif_rename_pet(struct map_session_data *sd,char *name)
  102. {
  103. if (CheckForCharServer())
  104. return 1;
  105. WFIFOHEAD(inter_fd,NAME_LENGTH+11);
  106. WFIFOW(inter_fd,0) = 0x3084;
  107. WFIFOL(inter_fd,2) = sd->status.account_id;
  108. WFIFOL(inter_fd,6) = sd->status.char_id;
  109. memcpy(WFIFOP(inter_fd,10),name, NAME_LENGTH);
  110. WFIFOSET(inter_fd,NAME_LENGTH+11);
  111. return 0;
  112. }
  113. // GMメッセージを送信
  114. int intif_GMmessage(char* mes,int len,int flag)
  115. {
  116. int lp = (flag&0x10) ? 8 : 4;
  117. // Send to the local players
  118. clif_GMmessage(NULL, mes, len, flag);
  119. if (CheckForCharServer())
  120. return 0;
  121. if (other_mapserver_count < 1)
  122. return 0; //No need to send.
  123. WFIFOHEAD(inter_fd,lp + len + 4);
  124. WFIFOW(inter_fd,0) = 0x3000;
  125. WFIFOW(inter_fd,2) = lp + len + 4;
  126. WFIFOL(inter_fd,4) = 0xFF000000; //"invalid" color signals standard broadcast.
  127. WFIFOL(inter_fd,8) = 0x65756c62;
  128. memcpy(WFIFOP(inter_fd,4+lp), mes, len);
  129. WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
  130. return 0;
  131. }
  132. int intif_announce(char* mes,int len, unsigned long color, int flag)
  133. {
  134. // Send to the local players
  135. if(color == 0xFE000000) // This is main chat message [LuzZza]
  136. clif_MainChatMessage(mes);
  137. else
  138. clif_announce(NULL, mes, len, color, flag);
  139. if (CheckForCharServer())
  140. return 0;
  141. if (other_mapserver_count < 1)
  142. return 0; //No need to send.
  143. WFIFOHEAD(inter_fd, 8 + len);
  144. WFIFOW(inter_fd,0) = 0x3000;
  145. WFIFOW(inter_fd,2) = 8 + len;
  146. WFIFOL(inter_fd,4) = color;
  147. memcpy(WFIFOP(inter_fd,8), mes, len);
  148. WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
  149. return 0;
  150. }
  151. // The transmission of Wisp/Page to inter-server (player not found on this server)
  152. int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int mes_len) {
  153. nullpo_retr(0, sd);
  154. if (CheckForCharServer())
  155. return 0;
  156. if (other_mapserver_count < 1)
  157. { //Character not found.
  158. clif_wis_end(sd->fd, 1);
  159. return 0;
  160. }
  161. WFIFOHEAD(inter_fd,mes_len + 52);
  162. WFIFOW(inter_fd,0) = 0x3001;
  163. WFIFOW(inter_fd,2) = mes_len + 52;
  164. memcpy(WFIFOP(inter_fd,4), sd->status.name, NAME_LENGTH);
  165. memcpy(WFIFOP(inter_fd,4+NAME_LENGTH), nick, NAME_LENGTH);
  166. memcpy(WFIFOP(inter_fd,4+2*NAME_LENGTH), mes, mes_len);
  167. WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
  168. if (battle_config.etc_log)
  169. ShowInfo("intif_wis_message from %s to %s (message: '%s')\n", sd->status.name, nick, mes);
  170. return 0;
  171. }
  172. // The reply of Wisp/page
  173. int intif_wis_replay(int id, int flag) {
  174. if (CheckForCharServer())
  175. return 0;
  176. WFIFOHEAD(inter_fd,7);
  177. WFIFOW(inter_fd,0) = 0x3002;
  178. WFIFOL(inter_fd,2) = id;
  179. WFIFOB(inter_fd,6) = flag; // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
  180. WFIFOSET(inter_fd,7);
  181. if (battle_config.etc_log)
  182. ShowInfo("intif_wis_replay: id: %d, flag:%d\n", id, flag);
  183. return 0;
  184. }
  185. // The transmission of GM only Wisp/Page from server to inter-server
  186. int intif_wis_message_to_gm(char *Wisp_name, int min_gm_level, char *mes) {
  187. int mes_len;
  188. if (CheckForCharServer())
  189. return 0;
  190. mes_len = strlen(mes) + 1; // + null
  191. WFIFOHEAD(inter_fd, mes_len + 30);
  192. WFIFOW(inter_fd,0) = 0x3003;
  193. WFIFOW(inter_fd,2) = mes_len + 30;
  194. memcpy(WFIFOP(inter_fd,4), Wisp_name, NAME_LENGTH);
  195. WFIFOW(inter_fd,4+NAME_LENGTH) = (short)min_gm_level;
  196. memcpy(WFIFOP(inter_fd,6+NAME_LENGTH), mes, mes_len);
  197. WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
  198. if (battle_config.etc_log)
  199. ShowNotice("intif_wis_message_to_gm: from: '%s', min level: %d, message: '%s'.\n", Wisp_name, min_gm_level, mes);
  200. return 0;
  201. }
  202. int intif_regtostr(char* str, struct global_reg *reg, int qty) {
  203. int len =0, i;
  204. for (i = 0; i < qty; i++) {
  205. len+= sprintf(str+len, "%s", reg[i].str)+1; //We add 1 to consider the '\0' in place.
  206. len+= sprintf(str+len, "%s", reg[i].value)+1;
  207. }
  208. return len;
  209. }
  210. //Request for saving registry values.
  211. int intif_saveregistry(struct map_session_data *sd, int type)
  212. {
  213. struct global_reg *reg;
  214. int count;
  215. if (CheckForCharServer())
  216. return -1;
  217. switch (type) {
  218. case 3: //Character reg
  219. reg = sd->save_reg.global;
  220. count = sd->save_reg.global_num;
  221. sd->state.reg_dirty &= ~0x4;
  222. break;
  223. case 2: //Account reg
  224. reg = sd->save_reg.account;
  225. count = sd->save_reg.account_num;
  226. sd->state.reg_dirty &= ~0x2;
  227. break;
  228. case 1: //Account2 reg
  229. reg = sd->save_reg.account2;
  230. count = sd->save_reg.account2_num;
  231. sd->state.reg_dirty &= ~0x1;
  232. break;
  233. default: //Broken code?
  234. if (battle_config.error_log)
  235. ShowError("intif_saveregistry: Invalid type %d\n", type);
  236. return -1;
  237. }
  238. WFIFOHEAD(inter_fd, 288 * MAX_REG_NUM+13);
  239. WFIFOW(inter_fd,0)=0x3004;
  240. WFIFOL(inter_fd,4)=sd->status.account_id;
  241. WFIFOL(inter_fd,8)=sd->status.char_id;
  242. WFIFOB(inter_fd,12)=type;
  243. if(count ==0){
  244. WFIFOW(inter_fd,2)=13;
  245. }else{
  246. int i,p;
  247. for (p=13,i = 0; i < count; i++) {
  248. if (reg[i].str[0] && reg[i].value != 0) {
  249. p+= sprintf(WFIFOP(inter_fd,p), "%s", reg[i].str)+1; //We add 1 to consider the '\0' in place.
  250. p+= sprintf(WFIFOP(inter_fd,p), "%s", reg[i].value)+1;
  251. }
  252. }
  253. WFIFOW(inter_fd,2)=p;
  254. }
  255. WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
  256. return 0;
  257. }
  258. //Request the registries for this player.
  259. int intif_request_registry(struct map_session_data *sd, int flag)
  260. {
  261. nullpo_retr(0, sd);
  262. sd->save_reg.account2_num = -1;
  263. sd->save_reg.account_num = -1;
  264. sd->save_reg.global_num = -1;
  265. if (CheckForCharServer())
  266. return 0;
  267. WFIFOHEAD(inter_fd,6);
  268. WFIFOW(inter_fd,0) = 0x3005;
  269. WFIFOL(inter_fd,2) = sd->status.account_id;
  270. WFIFOL(inter_fd,6) = sd->status.char_id;
  271. WFIFOB(inter_fd,10) = (flag&1?1:0); //Request Acc Reg 2
  272. WFIFOB(inter_fd,11) = (flag&2?1:0); //Request Acc Reg
  273. WFIFOB(inter_fd,12) = (flag&4?1:0); //Request Char Reg
  274. WFIFOSET(inter_fd,13);
  275. return 0;
  276. }
  277. // 倉庫データ要求
  278. int intif_request_storage(int account_id)
  279. {
  280. if (CheckForCharServer())
  281. return 0;
  282. WFIFOHEAD(inter_fd,6);
  283. WFIFOW(inter_fd,0) = 0x3010;
  284. WFIFOL(inter_fd,2) = account_id;
  285. WFIFOSET(inter_fd,6);
  286. return 0;
  287. }
  288. // 倉庫データ送信
  289. int intif_send_storage(struct storage *stor)
  290. {
  291. if (CheckForCharServer())
  292. return 0;
  293. nullpo_retr(0, stor);
  294. WFIFOHEAD(inter_fd,sizeof(struct storage)+8);
  295. WFIFOW(inter_fd,0) = 0x3011;
  296. WFIFOW(inter_fd,2) = sizeof(struct storage)+8;
  297. WFIFOL(inter_fd,4) = stor->account_id;
  298. memcpy( WFIFOP(inter_fd,8),stor, sizeof(struct storage) );
  299. WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
  300. return 0;
  301. }
  302. int intif_request_guild_storage(int account_id,int guild_id)
  303. {
  304. if (CheckForCharServer())
  305. return 0;
  306. WFIFOHEAD(inter_fd,10);
  307. WFIFOW(inter_fd,0) = 0x3018;
  308. WFIFOL(inter_fd,2) = account_id;
  309. WFIFOL(inter_fd,6) = guild_id;
  310. WFIFOSET(inter_fd,10);
  311. return 0;
  312. }
  313. int intif_send_guild_storage(int account_id,struct guild_storage *gstor)
  314. {
  315. if (CheckForCharServer())
  316. return 0;
  317. WFIFOHEAD(inter_fd,sizeof(struct guild_storage)+12);
  318. WFIFOW(inter_fd,0) = 0x3019;
  319. WFIFOW(inter_fd,2) = sizeof(struct guild_storage)+12;
  320. WFIFOL(inter_fd,4) = account_id;
  321. WFIFOL(inter_fd,8) = gstor->guild_id;
  322. memcpy( WFIFOP(inter_fd,12),gstor, sizeof(struct guild_storage) );
  323. WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
  324. return 0;
  325. }
  326. // パーティ作成要求
  327. int intif_create_party(struct party_member *member,char *name,int item,int item2)
  328. {
  329. if (CheckForCharServer())
  330. return 0;
  331. nullpo_retr(0, member);
  332. WFIFOHEAD(inter_fd,64);
  333. WFIFOW(inter_fd,0) = 0x3020;
  334. WFIFOW(inter_fd,2) = 30+sizeof(struct party_member);
  335. memcpy(WFIFOP(inter_fd,4),name, NAME_LENGTH);
  336. WFIFOB(inter_fd,28)= item;
  337. WFIFOB(inter_fd,29)= item2;
  338. memcpy(WFIFOP(inter_fd,30), member, sizeof(struct party_member));
  339. WFIFOSET(inter_fd,WFIFOW(inter_fd, 2));
  340. return 0;
  341. }
  342. // パーティ情報要求
  343. int intif_request_partyinfo(int party_id)
  344. {
  345. if (CheckForCharServer())
  346. return 0;
  347. WFIFOHEAD(inter_fd,6);
  348. WFIFOW(inter_fd,0) = 0x3021;
  349. WFIFOL(inter_fd,2) = party_id;
  350. WFIFOSET(inter_fd,6);
  351. // if(battle_config.etc_log)
  352. // printf("intif: request party info\n");
  353. return 0;
  354. }
  355. // パーティ追加要求
  356. int intif_party_addmember(int party_id,struct party_member *member)
  357. {
  358. if (CheckForCharServer())
  359. return 0;
  360. WFIFOHEAD(inter_fd,42);
  361. WFIFOW(inter_fd,0)=0x3022;
  362. WFIFOW(inter_fd,2)=8+sizeof(struct party_member);
  363. WFIFOL(inter_fd,4)=party_id;
  364. memcpy(WFIFOP(inter_fd,8),member,sizeof(struct party_member));
  365. WFIFOSET(inter_fd,WFIFOW(inter_fd, 2));
  366. return 1;
  367. }
  368. // パーティ設定変更
  369. int intif_party_changeoption(int party_id,int account_id,int exp,int item)
  370. {
  371. if (CheckForCharServer())
  372. return 0;
  373. WFIFOHEAD(inter_fd,14);
  374. WFIFOW(inter_fd,0)=0x3023;
  375. WFIFOL(inter_fd,2)=party_id;
  376. WFIFOL(inter_fd,6)=account_id;
  377. WFIFOW(inter_fd,10)=exp;
  378. WFIFOW(inter_fd,12)=item;
  379. WFIFOSET(inter_fd,14);
  380. return 0;
  381. }
  382. // パーティ脱退要求
  383. int intif_party_leave(int party_id,int account_id, int char_id)
  384. {
  385. if (CheckForCharServer())
  386. return 0;
  387. WFIFOHEAD(inter_fd,14);
  388. WFIFOW(inter_fd,0)=0x3024;
  389. WFIFOL(inter_fd,2)=party_id;
  390. WFIFOL(inter_fd,6)=account_id;
  391. WFIFOL(inter_fd,10)=char_id;
  392. WFIFOSET(inter_fd,14);
  393. return 0;
  394. }
  395. // パーティ移動要求
  396. int intif_party_changemap(struct map_session_data *sd,int online)
  397. {
  398. if (CheckForCharServer())
  399. return 0;
  400. if(!sd)
  401. return 0;
  402. WFIFOHEAD(inter_fd,19);
  403. WFIFOW(inter_fd,0)=0x3025;
  404. WFIFOL(inter_fd,2)=sd->status.party_id;
  405. WFIFOL(inter_fd,6)=sd->status.account_id;
  406. WFIFOL(inter_fd,10)=sd->status.char_id;
  407. WFIFOW(inter_fd,14)=sd->mapindex;
  408. WFIFOB(inter_fd,16)=online;
  409. WFIFOW(inter_fd,17)=sd->status.base_level;
  410. WFIFOSET(inter_fd,19);
  411. return 1;
  412. }
  413. // パーティー解散要求
  414. int intif_break_party(int party_id)
  415. {
  416. if (CheckForCharServer())
  417. return 0;
  418. WFIFOHEAD(inter_fd,6);
  419. WFIFOW(inter_fd,0)=0x3026;
  420. WFIFOL(inter_fd,2)=party_id;
  421. WFIFOSET(inter_fd,6);
  422. return 0;
  423. }
  424. // パーティ会話送信
  425. int intif_party_message(int party_id,int account_id,char *mes,int len)
  426. {
  427. if (CheckForCharServer())
  428. return 0;
  429. if (other_mapserver_count < 1)
  430. return 0; //No need to send.
  431. WFIFOHEAD(inter_fd,len + 12);
  432. WFIFOW(inter_fd,0)=0x3027;
  433. WFIFOW(inter_fd,2)=len+12;
  434. WFIFOL(inter_fd,4)=party_id;
  435. WFIFOL(inter_fd,8)=account_id;
  436. memcpy(WFIFOP(inter_fd,12),mes,len);
  437. WFIFOSET(inter_fd,len+12);
  438. return 0;
  439. }
  440. // パーティ競合チェック要求
  441. int intif_party_checkconflict(int party_id,int account_id,int char_id)
  442. {
  443. if (CheckForCharServer())
  444. return 0;
  445. WFIFOHEAD(inter_fd,10 + NAME_LENGTH);
  446. WFIFOW(inter_fd,0)=0x3028;
  447. WFIFOL(inter_fd,2)=party_id;
  448. WFIFOL(inter_fd,6)=account_id;
  449. WFIFOL(inter_fd,10)=char_id;
  450. WFIFOSET(inter_fd,14);
  451. return 0;
  452. }
  453. int intif_party_leaderchange(int party_id,int account_id,int char_id)
  454. {
  455. if (CheckForCharServer())
  456. return 0;
  457. WFIFOHEAD(inter_fd,14);
  458. WFIFOW(inter_fd,0)=0x3029;
  459. WFIFOL(inter_fd,2)=party_id;
  460. WFIFOL(inter_fd,6)=account_id;
  461. WFIFOL(inter_fd,10)=char_id;
  462. WFIFOSET(inter_fd,14);
  463. return 0;
  464. }
  465. // ギルド作成要求
  466. int intif_guild_create(const char *name,const struct guild_member *master)
  467. {
  468. if (CheckForCharServer())
  469. return 0;
  470. nullpo_retr(0, master);
  471. WFIFOHEAD(inter_fd,sizeof(struct guild_member)+(8+NAME_LENGTH));
  472. WFIFOW(inter_fd,0)=0x3030;
  473. WFIFOW(inter_fd,2)=sizeof(struct guild_member)+(8+NAME_LENGTH);
  474. WFIFOL(inter_fd,4)=master->account_id;
  475. memcpy(WFIFOP(inter_fd,8),name,NAME_LENGTH);
  476. memcpy(WFIFOP(inter_fd,8+NAME_LENGTH),master,sizeof(struct guild_member));
  477. WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
  478. return 0;
  479. }
  480. // ギルド情報要求
  481. int intif_guild_request_info(int guild_id)
  482. {
  483. if (CheckForCharServer())
  484. return 0;
  485. WFIFOHEAD(inter_fd,6);
  486. WFIFOW(inter_fd,0) = 0x3031;
  487. WFIFOL(inter_fd,2) = guild_id;
  488. WFIFOSET(inter_fd,6);
  489. return 0;
  490. }
  491. // ギルドメンバ追加要求
  492. int intif_guild_addmember(int guild_id,struct guild_member *m)
  493. {
  494. if (CheckForCharServer())
  495. return 0;
  496. WFIFOHEAD(inter_fd,sizeof(struct guild_member)+8);
  497. WFIFOW(inter_fd,0) = 0x3032;
  498. WFIFOW(inter_fd,2) = sizeof(struct guild_member)+8;
  499. WFIFOL(inter_fd,4) = guild_id;
  500. memcpy(WFIFOP(inter_fd,8),m,sizeof(struct guild_member));
  501. WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
  502. return 0;
  503. }
  504. int intif_guild_change_gm(int guild_id, const char* name, int len)
  505. {
  506. if (CheckForCharServer())
  507. return 0;
  508. WFIFOHEAD(inter_fd, len + 8);
  509. WFIFOW(inter_fd, 0)=0x3033;
  510. WFIFOW(inter_fd, 2)=len+8;
  511. WFIFOL(inter_fd, 4)=guild_id;
  512. memcpy(WFIFOP(inter_fd,8),name,len);
  513. WFIFOSET(inter_fd,len+8);
  514. return 0;
  515. }
  516. // ギルドメンバ脱退/追放要求
  517. int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const char *mes)
  518. {
  519. if (CheckForCharServer())
  520. return 0;
  521. WFIFOHEAD(inter_fd, 55);
  522. WFIFOW(inter_fd, 0) = 0x3034;
  523. WFIFOL(inter_fd, 2) = guild_id;
  524. WFIFOL(inter_fd, 6) = account_id;
  525. WFIFOL(inter_fd,10) = char_id;
  526. WFIFOB(inter_fd,14) = flag;
  527. memcpy(WFIFOP(inter_fd,15),mes,40);
  528. WFIFOSET(inter_fd,55);
  529. return 0;
  530. }
  531. // ギルドメンバのオンライン状況/Lv更新要求
  532. int intif_guild_memberinfoshort(int guild_id,
  533. int account_id,int char_id,int online,int lv,int class_)
  534. {
  535. if (CheckForCharServer())
  536. return 0;
  537. WFIFOHEAD(inter_fd, 19);
  538. WFIFOW(inter_fd, 0) = 0x3035;
  539. WFIFOL(inter_fd, 2) = guild_id;
  540. WFIFOL(inter_fd, 6) = account_id;
  541. WFIFOL(inter_fd,10) = char_id;
  542. WFIFOB(inter_fd,14) = online;
  543. WFIFOW(inter_fd,15) = lv;
  544. WFIFOW(inter_fd,17) = class_;
  545. WFIFOSET(inter_fd,19);
  546. return 0;
  547. }
  548. // ギルド解散通知
  549. int intif_guild_break(int guild_id)
  550. {
  551. if (CheckForCharServer())
  552. return 0;
  553. WFIFOHEAD(inter_fd, 6);
  554. WFIFOW(inter_fd, 0) = 0x3036;
  555. WFIFOL(inter_fd, 2) = guild_id;
  556. WFIFOSET(inter_fd,6);
  557. return 0;
  558. }
  559. // ギルド会話送信
  560. int intif_guild_message(int guild_id,int account_id,char *mes,int len)
  561. {
  562. if (CheckForCharServer())
  563. return 0;
  564. if (other_mapserver_count < 1)
  565. return 0; //No need to send.
  566. WFIFOHEAD(inter_fd, len + 12);
  567. WFIFOW(inter_fd,0)=0x3037;
  568. WFIFOW(inter_fd,2)=len+12;
  569. WFIFOL(inter_fd,4)=guild_id;
  570. WFIFOL(inter_fd,8)=account_id;
  571. memcpy(WFIFOP(inter_fd,12),mes,len);
  572. WFIFOSET(inter_fd,len+12);
  573. return 0;
  574. }
  575. // ギルド競合チェック要求
  576. int intif_guild_checkconflict(int guild_id,int account_id,int char_id)
  577. {
  578. if (CheckForCharServer())
  579. return 0;
  580. WFIFOHEAD(inter_fd, 14);
  581. WFIFOW(inter_fd, 0)=0x3038;
  582. WFIFOL(inter_fd, 2)=guild_id;
  583. WFIFOL(inter_fd, 6)=account_id;
  584. WFIFOL(inter_fd,10)=char_id;
  585. WFIFOSET(inter_fd,14);
  586. return 0;
  587. }
  588. // ギルド基本情報変更要求
  589. int intif_guild_change_basicinfo(int guild_id,int type,const void *data,int len)
  590. {
  591. if (CheckForCharServer())
  592. return 0;
  593. WFIFOHEAD(inter_fd, len + 10);
  594. WFIFOW(inter_fd,0)=0x3039;
  595. WFIFOW(inter_fd,2)=len+10;
  596. WFIFOL(inter_fd,4)=guild_id;
  597. WFIFOW(inter_fd,8)=type;
  598. memcpy(WFIFOP(inter_fd,10),data,len);
  599. WFIFOSET(inter_fd,len+10);
  600. return 0;
  601. }
  602. // ギルドメンバ情報変更要求
  603. int intif_guild_change_memberinfo(int guild_id,int account_id,int char_id,
  604. int type,const void *data,int len)
  605. {
  606. if (CheckForCharServer())
  607. return 0;
  608. WFIFOHEAD(inter_fd, len + 18);
  609. WFIFOW(inter_fd, 0)=0x303a;
  610. WFIFOW(inter_fd, 2)=len+18;
  611. WFIFOL(inter_fd, 4)=guild_id;
  612. WFIFOL(inter_fd, 8)=account_id;
  613. WFIFOL(inter_fd,12)=char_id;
  614. WFIFOW(inter_fd,16)=type;
  615. memcpy(WFIFOP(inter_fd,18),data,len);
  616. WFIFOSET(inter_fd,len+18);
  617. return 0;
  618. }
  619. // ギルド役職変更要求
  620. int intif_guild_position(int guild_id,int idx,struct guild_position *p)
  621. {
  622. if (CheckForCharServer())
  623. return 0;
  624. WFIFOHEAD(inter_fd, sizeof(struct guild_position)+12);
  625. WFIFOW(inter_fd,0)=0x303b;
  626. WFIFOW(inter_fd,2)=sizeof(struct guild_position)+12;
  627. WFIFOL(inter_fd,4)=guild_id;
  628. WFIFOL(inter_fd,8)=idx;
  629. memcpy(WFIFOP(inter_fd,12),p,sizeof(struct guild_position));
  630. WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
  631. return 0;
  632. }
  633. // ギルドスキルアップ要求
  634. int intif_guild_skillup(int guild_id,int skill_num,int account_id,int flag)
  635. {
  636. if (CheckForCharServer())
  637. return 0;
  638. WFIFOHEAD(inter_fd,14);
  639. WFIFOW(inter_fd, 0)=0x303c;
  640. WFIFOL(inter_fd, 2)=guild_id;
  641. WFIFOL(inter_fd, 6)=skill_num;
  642. WFIFOL(inter_fd,10)=account_id;
  643. //WFIFOL(inter_fd,14)=flag;
  644. WFIFOSET(inter_fd,14);
  645. return 0;
  646. }
  647. // ギルド同盟/敵対要求
  648. int intif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag)
  649. {
  650. if (CheckForCharServer())
  651. return 0;
  652. WFIFOHEAD(inter_fd,19);
  653. WFIFOW(inter_fd, 0)=0x303d;
  654. WFIFOL(inter_fd, 2)=guild_id1;
  655. WFIFOL(inter_fd, 6)=guild_id2;
  656. WFIFOL(inter_fd,10)=account_id1;
  657. WFIFOL(inter_fd,14)=account_id2;
  658. WFIFOB(inter_fd,18)=flag;
  659. WFIFOSET(inter_fd,19);
  660. return 0;
  661. }
  662. // ギルド告知変更要求
  663. int intif_guild_notice(int guild_id,const char *mes1,const char *mes2)
  664. {
  665. if (CheckForCharServer())
  666. return 0;
  667. WFIFOHEAD(inter_fd,186);
  668. WFIFOW(inter_fd,0)=0x303e;
  669. WFIFOL(inter_fd,2)=guild_id;
  670. memcpy(WFIFOP(inter_fd,6),mes1,60);
  671. memcpy(WFIFOP(inter_fd,66),mes2,120);
  672. WFIFOSET(inter_fd,186);
  673. return 0;
  674. }
  675. // ギルドエンブレム変更要求
  676. int intif_guild_emblem(int guild_id,int len,const char *data)
  677. {
  678. if (CheckForCharServer())
  679. return 0;
  680. if(guild_id<=0 || len<0 || len>2000)
  681. return 0;
  682. WFIFOHEAD(inter_fd,len + 12);
  683. WFIFOW(inter_fd,0)=0x303f;
  684. WFIFOW(inter_fd,2)=len+12;
  685. WFIFOL(inter_fd,4)=guild_id;
  686. WFIFOL(inter_fd,8)=0;
  687. memcpy(WFIFOP(inter_fd,12),data,len);
  688. WFIFOSET(inter_fd,len+12);
  689. return 0;
  690. }
  691. //現在のギルド城占領ギルドを調べる
  692. int intif_guild_castle_dataload(int castle_id,int index)
  693. {
  694. if (CheckForCharServer())
  695. return 0;
  696. WFIFOHEAD(inter_fd,5);
  697. WFIFOW(inter_fd,0)=0x3040;
  698. WFIFOW(inter_fd,2)=castle_id;
  699. WFIFOB(inter_fd,4)=index;
  700. WFIFOSET(inter_fd,5);
  701. return 0;
  702. }
  703. //ギルド城占領ギルド変更要求
  704. int intif_guild_castle_datasave(int castle_id,int index, int value)
  705. {
  706. if (CheckForCharServer())
  707. return 0;
  708. WFIFOHEAD(inter_fd,9);
  709. WFIFOW(inter_fd,0)=0x3041;
  710. WFIFOW(inter_fd,2)=castle_id;
  711. WFIFOB(inter_fd,4)=index;
  712. WFIFOL(inter_fd,5)=value;
  713. WFIFOSET(inter_fd,9);
  714. return 0;
  715. }
  716. //-----------------------------------------------------------------
  717. // Homunculus Packets send to Inter server [albator]
  718. //-----------------------------------------------------------------
  719. int intif_homunculus_create(int account_id, struct s_homunculus *sh)
  720. {
  721. if (CheckForCharServer())
  722. return 0;
  723. WFIFOHEAD(inter_fd, sizeof(struct s_homunculus)+8);
  724. WFIFOW(inter_fd,0) = 0x3090;
  725. WFIFOW(inter_fd,2) = sizeof(struct s_homunculus)+8;
  726. WFIFOL(inter_fd,4) = account_id;
  727. memcpy(WFIFOP(inter_fd,8),sh,sizeof(struct s_homunculus));
  728. WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
  729. return 0;
  730. }
  731. int intif_homunculus_requestload(int account_id, int homun_id)
  732. {
  733. if (CheckForCharServer())
  734. return 0;
  735. WFIFOHEAD(inter_fd, 10);
  736. WFIFOW(inter_fd,0) = 0x3091;
  737. WFIFOL(inter_fd,2) = account_id;
  738. WFIFOL(inter_fd,6) = homun_id;
  739. WFIFOSET(inter_fd, 10);
  740. return 1;
  741. }
  742. int intif_homunculus_requestsave(int account_id, struct s_homunculus* sh)
  743. {
  744. if (CheckForCharServer())
  745. return 0;
  746. WFIFOHEAD(inter_fd, sizeof(struct s_homunculus)+8);
  747. WFIFOW(inter_fd,0) = 0x3092;
  748. WFIFOW(inter_fd,2) = sizeof(struct s_homunculus)+8;
  749. WFIFOL(inter_fd,4) = account_id;
  750. memcpy(WFIFOP(inter_fd,8),sh,sizeof(struct s_homunculus));
  751. WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
  752. return 0;
  753. }
  754. int intif_homunculus_requestdelete(int homun_id)
  755. {
  756. if (CheckForCharServer())
  757. return 0;
  758. WFIFOHEAD(inter_fd, 6);
  759. WFIFOW(inter_fd, 0) = 0x3093;
  760. WFIFOL(inter_fd,2) = homun_id;
  761. WFIFOSET(inter_fd,6);
  762. return 0;
  763. }
  764. //-----------------------------------------------------------------
  765. // Packets receive from inter server
  766. // Wisp/Page reception
  767. int intif_parse_WisMessage(int fd) { // rewritten by [Yor]
  768. struct map_session_data* sd;
  769. char *wisp_source;
  770. char name[NAME_LENGTH];
  771. int id, i;
  772. RFIFOHEAD(fd);
  773. id=RFIFOL(fd,4);
  774. memcpy(name, RFIFOP(fd,32), NAME_LENGTH);
  775. name[NAME_LENGTH-1] = '\0'; //In case name arrived without it's terminator. [Skotlex]
  776. sd = map_nick2sd(name);
  777. if(sd == NULL || strcmp(sd->status.name, name) != 0)
  778. { //Not found
  779. intif_wis_replay(id,1);
  780. return 0;
  781. }
  782. if(sd->state.ignoreAll) {
  783. intif_wis_replay(id, 2);
  784. return 0;
  785. }
  786. wisp_source = (char *) RFIFOP(fd,8); // speed up [Yor]
  787. for(i=0; i < MAX_IGNORE_LIST &&
  788. sd->ignore[i].name[0] != '\0' &&
  789. strcmp(sd->ignore[i].name, wisp_source) != 0
  790. ; i++);
  791. if (i < MAX_IGNORE_LIST && sd->ignore[i].name[0] != '\0')
  792. { //Ignored
  793. intif_wis_replay(id, 2);
  794. return 0;
  795. }
  796. //Success to send whisper.
  797. clif_wis_message(sd->fd, wisp_source, (char*)RFIFOP(fd,56),RFIFOW(fd,2)-56);
  798. intif_wis_replay(id,0); // 送信成功
  799. return 0;
  800. }
  801. // Wisp/page transmission result reception
  802. int intif_parse_WisEnd(int fd) {
  803. struct map_session_data* sd;
  804. RFIFOHEAD(fd);
  805. if (battle_config.etc_log)
  806. ShowInfo("intif_parse_wisend: player: %s, flag: %d\n", RFIFOP(fd,2), RFIFOB(fd,26)); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
  807. sd = (struct map_session_data *)map_nick2sd((char *) RFIFOP(fd,2));
  808. if (sd != NULL)
  809. clif_wis_end(sd->fd, RFIFOB(fd,26));
  810. return 0;
  811. }
  812. static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va) {
  813. int min_gm_level = va_arg(va, int);
  814. char *wisp_name;
  815. char *message;
  816. int len;
  817. if (pc_isGM(sd) < min_gm_level) return 0;
  818. wisp_name = va_arg(va, char*);
  819. message = va_arg(va, char*);
  820. len = va_arg(va, int);
  821. clif_wis_message(sd->fd, wisp_name, message, len);
  822. return 1;
  823. }
  824. // Received wisp message from map-server via char-server for ALL gm
  825. int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
  826. int min_gm_level, mes_len;
  827. char Wisp_name[NAME_LENGTH];
  828. char mbuf[255];
  829. char *message;
  830. RFIFOHEAD(fd);
  831. mes_len = RFIFOW(fd,2) - 30;
  832. message = (char *) (mes_len >= 255 ? (char *) aMallocA(mes_len) : mbuf);
  833. min_gm_level = (int)RFIFOW(fd,28);
  834. memcpy(Wisp_name, RFIFOP(fd,4), NAME_LENGTH);
  835. Wisp_name[NAME_LENGTH-1] = '\0';
  836. memcpy(message, RFIFOP(fd,30), mes_len);
  837. message[mes_len-1] = '\0';
  838. // information is sended to all online GM
  839. clif_foreachclient(mapif_parse_WisToGM_sub, min_gm_level, Wisp_name, message, mes_len);
  840. if (message != mbuf)
  841. aFree(message);
  842. return 0;
  843. }
  844. // アカウント変数通知
  845. int intif_parse_Registers(int fd) {
  846. int j,p,len,max, flag;
  847. struct map_session_data *sd;
  848. struct global_reg *reg;
  849. int *qty;
  850. RFIFOHEAD(fd);
  851. if( (sd=map_id2sd(RFIFOL(fd,4)))==NULL)
  852. return 1;
  853. if (RFIFOB(fd,12) == 3 && sd->status.char_id != RFIFOL(fd,8))
  854. return 1; //Character registry from another character.
  855. flag = (sd->save_reg.global_num == -1 || sd->save_reg.account_num == -1 || sd->save_reg.account2_num == -1);
  856. switch (RFIFOB(fd,12)) {
  857. case 3: //Character Registry
  858. reg = sd->save_reg.global;
  859. qty = &sd->save_reg.global_num;
  860. max = GLOBAL_REG_NUM;
  861. break;
  862. case 2: //Account Registry
  863. reg = sd->save_reg.account;
  864. qty = &sd->save_reg.account_num;
  865. max = ACCOUNT_REG_NUM;
  866. break;
  867. case 1: //Account2 Registry
  868. reg = sd->save_reg.account2;
  869. qty = &sd->save_reg.account2_num;
  870. max = ACCOUNT_REG2_NUM;
  871. break;
  872. default:
  873. if (battle_config.error_log)
  874. ShowError("intif_parse_Registers: Unrecognized type %d\n",RFIFOB(fd,12));
  875. return 0;
  876. }
  877. for(j=0,p=13;j<max && p<RFIFOW(fd,2);j++){
  878. sscanf(RFIFOP(fd,p), "%31c%n", reg[j].str,&len);
  879. reg[j].str[len]='\0';
  880. p += len+1; //+1 to skip the '\0' between strings.
  881. sscanf(RFIFOP(fd,p), "%255c%n", reg[j].value,&len);
  882. reg[j].value[len]='\0';
  883. p += len+1;
  884. }
  885. *qty = j;
  886. if (flag && sd->save_reg.global_num > -1 && sd->save_reg.account_num > -1 && sd->save_reg.account2_num > -1)
  887. pc_reg_received(sd); //Received all registry values, execute init scripts and what-not. [Skotlex]
  888. return 1;
  889. }
  890. // 倉庫データ受信
  891. int intif_parse_LoadStorage(int fd) {
  892. struct storage *stor;
  893. struct map_session_data *sd;
  894. RFIFOHEAD(fd);
  895. sd=map_id2sd( RFIFOL(fd,4) );
  896. if(sd==NULL){
  897. if(battle_config.error_log)
  898. ShowError("intif_parse_LoadStorage: user not found %d\n",RFIFOL(fd,4));
  899. return 1;
  900. }
  901. if (sd->state.finalsave)
  902. return 1; //Player is already scheduled to leave the server.
  903. stor = account2storage( RFIFOL(fd,4));
  904. if (stor->storage_status == 1) { // Already open.. lets ignore this update
  905. if (battle_config.error_log)
  906. ShowWarning("intif_parse_LoadStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id);
  907. return 1;
  908. }
  909. if (stor->dirty) { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex]
  910. if (battle_config.error_log)
  911. ShowWarning("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id);
  912. return 1;
  913. }
  914. if (RFIFOW(fd,2)-8 != sizeof(struct storage)) {
  915. if (battle_config.error_log)
  916. ShowError("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage));
  917. return 1;
  918. }
  919. if(battle_config.save_log)
  920. ShowInfo("intif_openstorage: %d\n",RFIFOL(fd,4) );
  921. memcpy(stor,RFIFOP(fd,8),sizeof(struct storage));
  922. stor->dirty=0;
  923. stor->storage_status=1;
  924. sd->state.storage_flag = 1;
  925. clif_storagelist(sd,stor);
  926. clif_updatestorageamount(sd,stor);
  927. return 0;
  928. }
  929. // 倉庫データ送信成功
  930. int intif_parse_SaveStorage(int fd)
  931. {
  932. RFIFOHEAD(fd);
  933. if(battle_config.save_log)
  934. ShowInfo("intif_savestorage: done %d %d\n",RFIFOL(fd,2),RFIFOB(fd,6) );
  935. storage_storage_saved(RFIFOL(fd,2));
  936. return 0;
  937. }
  938. int intif_parse_LoadGuildStorage(int fd)
  939. {
  940. struct guild_storage *gstor;
  941. struct map_session_data *sd;
  942. int guild_id;
  943. RFIFOHEAD(fd);
  944. guild_id = RFIFOL(fd,8);
  945. if(guild_id <= 0)
  946. return 1;
  947. sd=map_id2sd( RFIFOL(fd,4) );
  948. if(sd==NULL){
  949. if(battle_config.error_log)
  950. ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4));
  951. return 1;
  952. }
  953. gstor=guild2storage(guild_id);
  954. if(!gstor) {
  955. if(battle_config.error_log)
  956. ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id);
  957. return 1;
  958. }
  959. if (gstor->storage_status == 1) { // Already open.. lets ignore this update
  960. if (battle_config.error_log)
  961. ShowWarning("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id);
  962. return 1;
  963. }
  964. if (gstor->dirty) { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex]
  965. if (battle_config.error_log)
  966. ShowWarning("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id);
  967. return 1;
  968. }
  969. if( RFIFOW(fd,2)-12 != sizeof(struct guild_storage) ){
  970. gstor->storage_status = 0;
  971. if(battle_config.error_log)
  972. ShowError("intif_parse_LoadGuildStorage: data size error %d %d\n",RFIFOW(fd,2)-12 , sizeof(struct guild_storage));
  973. return 1;
  974. }
  975. if(battle_config.save_log)
  976. ShowInfo("intif_open_guild_storage: %d\n",RFIFOL(fd,4) );
  977. memcpy(gstor,RFIFOP(fd,12),sizeof(struct guild_storage));
  978. gstor->storage_status = 1;
  979. sd->state.storage_flag = 2;
  980. clif_guildstoragelist(sd,gstor);
  981. clif_updateguildstorageamount(sd,gstor);
  982. return 0;
  983. }
  984. int intif_parse_SaveGuildStorage(int fd)
  985. {
  986. RFIFOHEAD(fd);
  987. if(battle_config.save_log) {
  988. ShowInfo("intif_save_guild_storage: done %d %d %d\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOB(fd,10) );
  989. }
  990. storage_guild_storagesaved(/*RFIFOL(fd,2), */RFIFOL(fd,6));
  991. return 0;
  992. }
  993. // パーティ作成可否
  994. int intif_parse_PartyCreated(int fd)
  995. {
  996. RFIFOHEAD(fd);
  997. if(battle_config.etc_log)
  998. ShowInfo("intif: party created by account %d\n\n", RFIFOL(fd,2));
  999. party_created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15));
  1000. return 0;
  1001. }
  1002. // パーティ情報
  1003. int intif_parse_PartyInfo(int fd)
  1004. {
  1005. RFIFOHEAD(fd);
  1006. if( RFIFOW(fd,2)==8){
  1007. if(battle_config.error_log)
  1008. ShowWarning("intif: party noinfo %d\n",RFIFOL(fd,4));
  1009. party_recv_noinfo(RFIFOL(fd,4));
  1010. return 0;
  1011. }
  1012. // printf("intif: party info %d\n",RFIFOL(fd,4));
  1013. if( RFIFOW(fd,2)!=sizeof(struct party)+4 ){
  1014. if(battle_config.error_log)
  1015. ShowError("intif: party info : data size error %d %d %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct party)+4);
  1016. }
  1017. party_recv_info((struct party *)RFIFOP(fd,4));
  1018. return 0;
  1019. }
  1020. // パーティ追加通知
  1021. int intif_parse_PartyMemberAdded(int fd)
  1022. {
  1023. RFIFOHEAD(fd);
  1024. if(battle_config.etc_log)
  1025. ShowInfo("intif: party member added Party (%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
  1026. party_member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14));
  1027. return 0;
  1028. }
  1029. // パーティ設定変更通知
  1030. int intif_parse_PartyOptionChanged(int fd)
  1031. {
  1032. RFIFOHEAD(fd);
  1033. party_optionchanged(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOB(fd,14));
  1034. return 0;
  1035. }
  1036. // パーティ脱退通知
  1037. int intif_parse_PartyMemberLeaved(int fd)
  1038. {
  1039. RFIFOHEAD(fd);
  1040. if(battle_config.etc_log)
  1041. ShowInfo("intif: party member leaved: Party(%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
  1042. party_member_leaved(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
  1043. return 0;
  1044. }
  1045. // パーティ解散通知
  1046. int intif_parse_PartyBroken(int fd)
  1047. {
  1048. RFIFOHEAD(fd);
  1049. party_broken(RFIFOL(fd,2));
  1050. return 0;
  1051. }
  1052. // パーティ移動通知
  1053. int intif_parse_PartyMove(int fd)
  1054. {
  1055. RFIFOHEAD(fd);
  1056. party_recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17));
  1057. return 0;
  1058. }
  1059. // パーティメッセージ
  1060. int intif_parse_PartyMessage(int fd)
  1061. {
  1062. RFIFOHEAD(fd);
  1063. // if(battle_config.etc_log)
  1064. // printf("intif_parse_PartyMessage: %s\n",RFIFOP(fd,12));
  1065. party_recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
  1066. return 0;
  1067. }
  1068. // ギルド作成可否
  1069. int intif_parse_GuildCreated(int fd)
  1070. {
  1071. RFIFOHEAD(fd);
  1072. guild_created(RFIFOL(fd,2),RFIFOL(fd,6));
  1073. return 0;
  1074. }
  1075. // ギルド情報
  1076. int intif_parse_GuildInfo(int fd)
  1077. {
  1078. RFIFOHEAD(fd);
  1079. if( RFIFOW(fd,2)==8){
  1080. if(battle_config.error_log)
  1081. ShowWarning("intif: guild noinfo %d\n",RFIFOL(fd,4));
  1082. guild_recv_noinfo(RFIFOL(fd,4));
  1083. return 0;
  1084. }
  1085. // if(battle_config.etc_log)
  1086. // printf("intif: guild info %d\n",RFIFOL(fd,4));
  1087. if( RFIFOW(fd,2)!=sizeof(struct guild)+4 ){
  1088. if(battle_config.error_log)
  1089. ShowError("intif: guild info : data size error Gid: %d recv size: %d Expected size: %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4);
  1090. }
  1091. guild_recv_info((struct guild *)RFIFOP(fd,4));
  1092. return 0;
  1093. }
  1094. // ギルドメンバ追加通知
  1095. int intif_parse_GuildMemberAdded(int fd)
  1096. {
  1097. RFIFOHEAD(fd);
  1098. if(battle_config.etc_log)
  1099. ShowInfo("intif: guild member added %d %d %d %d\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14));
  1100. guild_member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14));
  1101. return 0;
  1102. }
  1103. // ギルドメンバ脱退/追放通知
  1104. int intif_parse_GuildMemberLeaved(int fd)
  1105. {
  1106. RFIFOHEAD(fd);
  1107. guild_member_leaved(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),
  1108. (char *) RFIFOP(fd,55), (char *) RFIFOP(fd,15));
  1109. return 0;
  1110. }
  1111. // ギルドメンバオンライン状態/Lv変更通知
  1112. int intif_parse_GuildMemberInfoShort(int fd)
  1113. {
  1114. RFIFOHEAD(fd);
  1115. guild_recv_memberinfoshort(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17));
  1116. return 0;
  1117. }
  1118. // ギルド解散通知
  1119. int intif_parse_GuildBroken(int fd)
  1120. {
  1121. RFIFOHEAD(fd);
  1122. guild_broken(RFIFOL(fd,2),RFIFOB(fd,6));
  1123. return 0;
  1124. }
  1125. // ギルド基本情報変更通知
  1126. int intif_parse_GuildBasicInfoChanged(int fd)
  1127. {
  1128. int type, guild_id;
  1129. unsigned int dd;
  1130. void *data;
  1131. struct guild *g;
  1132. short dw;
  1133. RFIFOHEAD(fd);
  1134. type=RFIFOW(fd,8);
  1135. guild_id=RFIFOL(fd,4);
  1136. data=RFIFOP(fd,10);
  1137. g=guild_search(guild_id);
  1138. dw=*((short *)data);
  1139. dd=*((unsigned int *)data);
  1140. if( g==NULL )
  1141. return 0;
  1142. switch(type){
  1143. case GBI_EXP: g->exp=dd; break;
  1144. case GBI_GUILDLV: g->guild_lv=dw; break;
  1145. case GBI_SKILLPOINT: g->skill_point=dd; break;
  1146. }
  1147. return 0;
  1148. }
  1149. // ギルドメンバ情報変更通知
  1150. int intif_parse_GuildMemberInfoChanged(int fd)
  1151. {
  1152. int type, guild_id, account_id, char_id, idx, dd;
  1153. void* data;
  1154. struct guild *g;
  1155. RFIFOHEAD(fd);
  1156. type=RFIFOW(fd,16);
  1157. guild_id=RFIFOL(fd,4);
  1158. account_id=RFIFOL(fd,8);
  1159. char_id=RFIFOL(fd,12);
  1160. data=RFIFOP(fd,18);
  1161. g=guild_search(guild_id);
  1162. dd=*((int *)data);
  1163. if( g==NULL )
  1164. return 0;
  1165. idx=guild_getindex(g,account_id,char_id);
  1166. switch(type){
  1167. case GMI_POSITION:
  1168. g->member[idx].position=dd;
  1169. guild_memberposition_changed(g,idx,dd);
  1170. break;
  1171. case GMI_EXP:
  1172. g->member[idx].exp=dd;
  1173. break;
  1174. case GMI_HAIR:
  1175. g->member[idx].hair=dd;
  1176. break;
  1177. case GMI_HAIR_COLOR:
  1178. g->member[idx].hair_color=dd;
  1179. break;
  1180. case GMI_GENDER:
  1181. g->member[idx].gender=dd;
  1182. break;
  1183. case GMI_CLASS:
  1184. g->member[idx].class_=dd;
  1185. break;
  1186. case GMI_LEVEL:
  1187. g->member[idx].lv=dd;
  1188. break;
  1189. }
  1190. return 0;
  1191. }
  1192. // ギルド役職変更通知
  1193. int intif_parse_GuildPosition(int fd)
  1194. {
  1195. RFIFOHEAD(fd);
  1196. if( RFIFOW(fd,2)!=sizeof(struct guild_position)+12 ){
  1197. if(battle_config.error_log)
  1198. ShowError("intif: guild info : data size error\n %d %d %d",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12);
  1199. }
  1200. guild_position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12));
  1201. return 0;
  1202. }
  1203. // ギルドスキル割り振り通知
  1204. int intif_parse_GuildSkillUp(int fd)
  1205. {
  1206. RFIFOHEAD(fd);
  1207. guild_skillupack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
  1208. return 0;
  1209. }
  1210. // ギルド同盟/敵対通知
  1211. int intif_parse_GuildAlliance(int fd)
  1212. {
  1213. RFIFOHEAD(fd);
  1214. guild_allianceack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),
  1215. RFIFOB(fd,18),(char *) RFIFOP(fd,19),(char *) RFIFOP(fd,43));
  1216. return 0;
  1217. }
  1218. // ギルド告知変更通知
  1219. int intif_parse_GuildNotice(int fd)
  1220. {
  1221. RFIFOHEAD(fd);
  1222. guild_notice_changed(RFIFOL(fd,2),(char *) RFIFOP(fd,6),(char *) RFIFOP(fd,66));
  1223. return 0;
  1224. }
  1225. // ギルドエンブレム変更通知
  1226. int intif_parse_GuildEmblem(int fd)
  1227. {
  1228. RFIFOHEAD(fd);
  1229. guild_emblem_changed(RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8), (char *)RFIFOP(fd,12));
  1230. return 0;
  1231. }
  1232. // ギルド会話受信
  1233. int intif_parse_GuildMessage(int fd)
  1234. {
  1235. RFIFOHEAD(fd);
  1236. guild_recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
  1237. return 0;
  1238. }
  1239. // ギルド城データ要求返信
  1240. int intif_parse_GuildCastleDataLoad(int fd)
  1241. {
  1242. RFIFOHEAD(fd);
  1243. return guild_castledataloadack(RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5));
  1244. }
  1245. // ギルド城データ変更通知
  1246. int intif_parse_GuildCastleDataSave(int fd)
  1247. {
  1248. RFIFOHEAD(fd);
  1249. return guild_castledatasaveack(RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5));
  1250. }
  1251. // ギルド城データ一括受信(初期化時)
  1252. int intif_parse_GuildCastleAllDataLoad(int fd)
  1253. {
  1254. RFIFOHEAD(fd);
  1255. return guild_castlealldataload(RFIFOW(fd,2),(struct guild_castle *)RFIFOP(fd,4));
  1256. }
  1257. int intif_parse_GuildMasterChanged(int fd)
  1258. {
  1259. RFIFOHEAD(fd);
  1260. return guild_gm_changed(RFIFOL(fd,2),RFIFOL(fd,6));
  1261. }
  1262. // pet
  1263. int intif_parse_CreatePet(int fd)
  1264. {
  1265. RFIFOHEAD(fd);
  1266. pet_get_egg(RFIFOL(fd,2),RFIFOL(fd,7),RFIFOB(fd,6));
  1267. return 0;
  1268. }
  1269. int intif_parse_RecvPetData(int fd)
  1270. {
  1271. struct s_pet p;
  1272. int len;
  1273. RFIFOHEAD(fd);
  1274. len=RFIFOW(fd,2);
  1275. if(sizeof(struct s_pet)!=len-9) {
  1276. if(battle_config.etc_log)
  1277. ShowError("intif: pet data: data size error %d %d\n",sizeof(struct s_pet),len-9);
  1278. }
  1279. else{
  1280. memcpy(&p,RFIFOP(fd,9),sizeof(struct s_pet));
  1281. pet_recv_petdata(RFIFOL(fd,4),&p,RFIFOB(fd,8));
  1282. }
  1283. return 0;
  1284. }
  1285. int intif_parse_SavePetOk(int fd)
  1286. {
  1287. RFIFOHEAD(fd);
  1288. if(RFIFOB(fd,6) == 1) {
  1289. if(battle_config.error_log)
  1290. ShowError("pet data save failure\n");
  1291. }
  1292. return 0;
  1293. }
  1294. int intif_parse_DeletePetOk(int fd)
  1295. {
  1296. RFIFOHEAD(fd);
  1297. if(RFIFOB(fd,2) == 1) {
  1298. if(battle_config.error_log)
  1299. ShowError("pet data delete failure\n");
  1300. }
  1301. return 0;
  1302. }
  1303. int intif_parse_RenamePetOk(int fd)
  1304. {
  1305. struct map_session_data *sd = NULL;
  1306. RFIFOHEAD(fd);
  1307. if((sd=map_id2sd(RFIFOL(fd,2)))==NULL ||
  1308. sd->status.char_id != RFIFOL(fd,6))
  1309. return 0;
  1310. if (RFIFOB(fd,10) == 0) {
  1311. clif_displaymessage(sd->fd, msg_txt(280)); // You cannot use this name for your pet.
  1312. clif_send_petstatus(sd); //Send status so client knows oet name change got rejected.
  1313. return 0;
  1314. }
  1315. pet_change_name(sd, RFIFOP(fd,11),1);
  1316. return 0;
  1317. }
  1318. //----------------------------------------------------------------
  1319. // Homunculus recv packets [albator]
  1320. int intif_parse_CreateHomunculus(int fd)
  1321. {
  1322. int len;
  1323. RFIFOHEAD(fd);
  1324. len=RFIFOW(fd,2)-9;
  1325. if(sizeof(struct s_homunculus)!=len) {
  1326. if(battle_config.etc_log)
  1327. ShowError("intif: create homun data: data size error %d != %d\n",sizeof(struct s_homunculus),len);
  1328. return 0;
  1329. }
  1330. merc_hom_recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8)) ;
  1331. return 0;
  1332. }
  1333. int intif_parse_RecvHomunculusData(int fd)
  1334. {
  1335. int len;
  1336. RFIFOHEAD(fd);
  1337. len=RFIFOW(fd,2)-9;
  1338. if(sizeof(struct s_homunculus)!=len) {
  1339. if(battle_config.etc_log)
  1340. ShowError("intif: homun data: data size error %d %d\n",sizeof(struct s_homunculus),len);
  1341. return 0;
  1342. }
  1343. merc_hom_recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8));
  1344. return 0;
  1345. }
  1346. int intif_parse_SaveHomunculusOk(int fd)
  1347. {
  1348. RFIFOHEAD(fd);
  1349. if(RFIFOB(fd,6) != 1) {
  1350. if(battle_config.error_log)
  1351. ShowError("homunculus data save failure for account %d\n", RFIFOL(fd,2));
  1352. }
  1353. return 0;
  1354. }
  1355. int intif_parse_DeleteHomunculusOk(int fd)
  1356. {
  1357. RFIFOHEAD(fd);
  1358. if(RFIFOB(fd,2) != 1) {
  1359. if(battle_config.error_log)
  1360. ShowError("Homunculus data delete failure\n");
  1361. }
  1362. return 0;
  1363. }
  1364. //-----------------------------------------------------------------
  1365. // inter serverからの通信
  1366. // エラーがあれば0(false)を返すこと
  1367. // パケットが処理できれば1,パケット長が足りなければ2を返すこと
  1368. int intif_parse(int fd)
  1369. {
  1370. int packet_len, cmd;
  1371. RFIFOHEAD(fd);
  1372. cmd = RFIFOW(fd,0);
  1373. // パケットのID確認
  1374. if(cmd<0x3800 || cmd>=0x3800+(sizeof(packet_len_table)/sizeof(packet_len_table[0])) ||
  1375. packet_len_table[cmd-0x3800]==0){
  1376. return 0;
  1377. }
  1378. // パケットの長さ確認
  1379. packet_len = packet_len_table[cmd-0x3800];
  1380. if(packet_len==-1){
  1381. if(RFIFOREST(fd)<4)
  1382. return 2;
  1383. packet_len = RFIFOW(fd,2);
  1384. }
  1385. // if(battle_config.etc_log)
  1386. // printf("intif_parse %d %x %d %d\n",fd,cmd,packet_len,RFIFOREST(fd));
  1387. if((int)RFIFOREST(fd)<packet_len){
  1388. return 2;
  1389. }
  1390. // 処理分岐
  1391. switch(cmd){
  1392. case 0x3800:
  1393. if (RFIFOL(fd,4) == 0xFF000000) //Normal announce.
  1394. clif_GMmessage(NULL,(char *) RFIFOP(fd,8),packet_len-8,0);
  1395. else if (RFIFOL(fd,4) == 0xFE000000) //Main chat message [LuzZza]
  1396. clif_MainChatMessage((char *)RFIFOP(fd,8));
  1397. else //Color announce.
  1398. clif_announce(NULL,(char *) RFIFOP(fd,8),packet_len-8,RFIFOL(fd,4),0);
  1399. break;
  1400. case 0x3801: intif_parse_WisMessage(fd); break;
  1401. case 0x3802: intif_parse_WisEnd(fd); break;
  1402. case 0x3803: mapif_parse_WisToGM(fd); break;
  1403. case 0x3804: intif_parse_Registers(fd); break;
  1404. case 0x3810: intif_parse_LoadStorage(fd); break;
  1405. case 0x3811: intif_parse_SaveStorage(fd); break;
  1406. case 0x3818: intif_parse_LoadGuildStorage(fd); break;
  1407. case 0x3819: intif_parse_SaveGuildStorage(fd); break;
  1408. case 0x3820: intif_parse_PartyCreated(fd); break;
  1409. case 0x3821: intif_parse_PartyInfo(fd); break;
  1410. case 0x3822: intif_parse_PartyMemberAdded(fd); break;
  1411. case 0x3823: intif_parse_PartyOptionChanged(fd); break;
  1412. case 0x3824: intif_parse_PartyMemberLeaved(fd); break;
  1413. case 0x3825: intif_parse_PartyMove(fd); break;
  1414. case 0x3826: intif_parse_PartyBroken(fd); break;
  1415. case 0x3827: intif_parse_PartyMessage(fd); break;
  1416. case 0x3830: intif_parse_GuildCreated(fd); break;
  1417. case 0x3831: intif_parse_GuildInfo(fd); break;
  1418. case 0x3832: intif_parse_GuildMemberAdded(fd); break;
  1419. case 0x3834: intif_parse_GuildMemberLeaved(fd); break;
  1420. case 0x3835: intif_parse_GuildMemberInfoShort(fd); break;
  1421. case 0x3836: intif_parse_GuildBroken(fd); break;
  1422. case 0x3837: intif_parse_GuildMessage(fd); break;
  1423. case 0x3839: intif_parse_GuildBasicInfoChanged(fd); break;
  1424. case 0x383a: intif_parse_GuildMemberInfoChanged(fd); break;
  1425. case 0x383b: intif_parse_GuildPosition(fd); break;
  1426. case 0x383c: intif_parse_GuildSkillUp(fd); break;
  1427. case 0x383d: intif_parse_GuildAlliance(fd); break;
  1428. case 0x383e: intif_parse_GuildNotice(fd); break;
  1429. case 0x383f: intif_parse_GuildEmblem(fd); break;
  1430. case 0x3840: intif_parse_GuildCastleDataLoad(fd); break;
  1431. case 0x3841: intif_parse_GuildCastleDataSave(fd); break;
  1432. case 0x3842: intif_parse_GuildCastleAllDataLoad(fd); break;
  1433. case 0x3843: intif_parse_GuildMasterChanged(fd); break;
  1434. case 0x3880: intif_parse_CreatePet(fd); break;
  1435. case 0x3881: intif_parse_RecvPetData(fd); break;
  1436. case 0x3882: intif_parse_SavePetOk(fd); break;
  1437. case 0x3883: intif_parse_DeletePetOk(fd); break;
  1438. case 0x3884: intif_parse_RenamePetOk(fd); break;
  1439. case 0x3890: intif_parse_CreateHomunculus(fd); break;
  1440. case 0x3891: intif_parse_RecvHomunculusData(fd); break;
  1441. case 0x3892: intif_parse_SaveHomunculusOk(fd); break;
  1442. case 0x3893: intif_parse_DeleteHomunculusOk(fd); break;
  1443. default:
  1444. if(battle_config.error_log)
  1445. ShowError("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0));
  1446. return 0;
  1447. }
  1448. // パケット読み飛ばし
  1449. RFIFOSKIP(fd,packet_len);
  1450. return 1;
  1451. }