From 1eb5e76a0a37b74e3252cf7f543a4d5bebc428ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 2 Jun 2010 20:05:50 +0200 Subject: [PATCH] game: Initial dialog handling. PP cube, Lumilass, items shops start working. --- p/itemshop.bin | Bin 0 -> 2668 bytes p/lumilassA.bin | Bin 0 -> 1660 bytes p/ppcube.bin | Bin 0 -> 196 bytes src/egs_game.erl | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 p/itemshop.bin create mode 100644 p/lumilassA.bin create mode 100644 p/ppcube.bin diff --git a/p/itemshop.bin b/p/itemshop.bin new file mode 100644 index 0000000000000000000000000000000000000000..4a95d80b5e9ec429cecd900440edf714818964ac GIT binary patch literal 2668 zcmai$%}x|S6opS!b`wTvT58z|Ca)akqb_W84iRUBcHcjmEE zxLQVkR}V@VrG(*Ff0bjUcK{`<@^j14 zdsOv-dixR&t&P$k!?8AiN7R)vL9#Mj9y`nYj|w@a#wde7DOs69&eCML9LuLcdJnsU ztcto8fz+r}7)}>|zZG4NmCy0A$e!y+IA4tJ|g115W@qri-k3p4vh@Qe5g)y{6&~Ug?%mtpaOu`r?AR zpc3&{cw#k9JQ`SweB!pStWmbWy5)6&MjX_wa!grzZG z2G*xh)&idzkL$5-hk3PvHl;21#M8h!9c6WRx*7x4T57(DxdaMenl;Pr>R)4E>vo{bH=g8MTxi8@qVO_ zWYsKpPAAXtWSC>VC*n~%F1vm5ie6E5%bgQ+oeXo#S@9@wo=}#Y_g2}5`|N^hSk;KJ z+`A+0)iz!*kE&k{EE^~@lzTP3+^e1w_g$i_R`?ZIKW0W)@fgpmdN0wI!zVl1={g^< zoF}U1#TA}a^ zM9@=pUQ)BV=JuD=>ttB_v0e?Vs`HY%)&BkHSf_*9JAZXKc{0CchkIVxVM)X4#vn)f zUOb_v#_qy4o@0d>#N5(oTHVA7MTsta9Nk~B2=RpH$$vq|g-zYaEMM3WR=#saPY*eB a?oF`9ebJ+YE{Q!fT2{9lixw;Da;*RPq>j}9 literal 0 HcmV?d00001 diff --git a/p/lumilassA.bin b/p/lumilassA.bin new file mode 100644 index 0000000000000000000000000000000000000000..84763c76f2feadf520f1b493c5cb0106cf440347 GIT binary patch literal 1660 zcmeIyMNbd_7zSVr46xgac`>lNySottH^pExP&eDnK)o1PV0XLOZgy^Viw(9I*xma4 z0xw>Dx99%u`?j}vnt*>uj=+F4q$M5c2_%SMvXGT*WG4@K$wz()P>@0trU*qTMsZ3| zl2Vi=gfdj55|yb!RjN^&I@F~e^=Uv;n$esVw4@d7=|D$1(U~rU5l#;xh@>Y`^r0{P z=ub3*7)%U97|Jk4GK$fRVJzdA$RuK!%oL_Fjp@u_CUMLno&@HzfaR=UC962eDNb{S zvz+5R7r4w761mDXu5*K%B$3P=?sAX&Jm4WIJmD$Ncup!Wc*z^y@{ad>;3J>-Oh`_D zqb%hpPX#JciK|;L% zILIMFbLmSM;q)MaNP5zX-bB%dzVxF%(F|Z9gBVNr literal 0 HcmV?d00001 diff --git a/p/ppcube.bin b/p/ppcube.bin new file mode 100644 index 0000000000000000000000000000000000000000..3229dc5d392ac735f7f0c067060345033b22b5c1 GIT binary patch literal 196 zcmeA_^wq}L*x26Kc(Z+48k++HgM-7YnUz316UaW`ke2ogh}j%x&6IRJdq&3*C=bK| rK%4-?1wh;Y#2r990f=V+@d6-jux9`&Bp!p*6NiEBvIDvcs2+g<5DqE` literal 0 HcmV?d00001 diff --git a/src/egs_game.erl b/src/egs_game.erl index 4d67793..197b4a4 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -514,6 +514,14 @@ handle(16#0105, CSocket, GID, _, Orig) -> ignored end; +handle(16#010a, CSocket, GID, _, Orig) -> + << _:384, A:32/little-unsigned-integer, B:32/little-unsigned-integer, C:32/little-unsigned-integer >> = Orig, + log(GID, io_lib:format("shop listing request (~b, ~b, ~b)", [A, B, C])), + {ok, File} = file:read_file("p/itemshop.bin"), + Packet = << 16#010a0300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, + GID:32/little-unsigned-integer, 0:64, GID:32/little-unsigned-integer, 0:32, File/binary >>, + egs_proto:packet_send(CSocket, Packet); + %% @doc Character death handler. Abort mission and redirect to 4th floor for now. %% @todo Recover from death correctly. @@ -700,6 +708,68 @@ handle(16#1710, CSocket, GID, _, _) -> Packet = << 16#17110300:32, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:96 >>, egs_proto:packet_send(CSocket, Packet); +%% @doc Dialog request handler. Do what we can. +%% @todo Handle correctly. + +handle(16#1a01, CSocket, GID, _, Orig) -> + << _:384, A:8, B:8, _:16, C:8, _/bits >> = Orig, + file:write_file("1a01.bin", Orig), + case B of + 0 -> + case A of + 0 -> + case C of + 2 -> + log(GID, "Lumilass?"), + Command = << 16#1a030300:32 >>, + {ok, File} = file:read_file("p/lumilassA.bin"), + Packet = << 0:32, File/binary >>; + 3 -> + log(GID, "PP cube?"), + Command = << 16#1a040300:32 >>, + {ok, File} = file:read_file("p/ppcube.bin"), + Packet = << 0:32, File/binary >>; + _ -> + Command = << 16#1a020300:32 >>, + Packet = << >>, + log(GID, "unhandled 1a01 B A C") + end; + 80 -> + log(GID, "NPC dialog request?"), + Command = << 16#1a020300:32 >>, + Packet = << 0:32, 16#11001100:32, 16#03000900:32 >>; + 90 -> + log(GID, "unknown 1a01 90"), + Command = << 16#1a020300:32 >>, + Packet = << 0:32, 16#05000100:32, 16#04000500:32 >>; + 91 -> + log(GID, "unknown 1a01 91"), + Command = << 16#1a020300:32 >>, + Packet = << 0:32, 16#05000500:32, 16#04000700:32 >>; + 92 -> + log(GID, "unknown 1a01 92"), + Command = << 16#1a020300:32 >>, + Packet = << 0:32, 16#05000800:32, 16#04000000:32 >>; + 93 -> + log(GID, "unknown 1a01 93"), + Command = << 16#1a020300:32 >>, + Packet = << 0:32, 16#05001200:32, 16#04000000:32 >>; + _ -> + Command = << 16#1a020300:32 >>, + Packet = << >>, + log(GID, "unhandled 1a01 in A case") + end; + 2 -> + log(GID, "unknown 1a01 B"), + Command = << 16#1a020300:32 >>, + Packet = << 0:32, 16#00000100:32, 0:32 >>; + _ -> + Command = << 16#1a020300:32 >>, + Packet = << >>, + log(GID, "unhandled 1a01 in B case") + end, + egs_proto:packet_send(CSocket, << Command/binary, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, Packet/binary >>); + %% @doc Unknown command handler. Do nothing. handle(Command, _, GID, _, _) ->