From e6063333ca8525b2278757c6b2815d24fdda9ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 31 May 2010 18:50:24 +0200 Subject: [PATCH] game: Initial damage handling. A default inventory is given. --- p/packet0a06.bin | Bin 0 -> 284 bytes p/packet0a0a.bin | Bin 0 -> 9176 bytes src/egs_game.erl | 61 +++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 p/packet0a06.bin create mode 100644 p/packet0a0a.bin diff --git a/p/packet0a06.bin b/p/packet0a06.bin new file mode 100644 index 0000000000000000000000000000000000000000..49cda147a4727f403e2d9906e8f09067ae15c393 GIT binary patch literal 284 zcmZ9{Ne;na7{>9hBu%LrTC(`uIpk4*4F^S(;G&EQs;Hrk z2AXK0jSjl#p^pKE7-5VF-dWFH_3!TMX&XA20rfal#QyGk%ek&=w}s|Dd~f9#nw;fc JKK|`xeF9NqH-!KI literal 0 HcmV?d00001 diff --git a/p/packet0a0a.bin b/p/packet0a0a.bin new file mode 100644 index 0000000000000000000000000000000000000000..c70605905a844faad6d7e9cf5867e144dde2238a GIT binary patch literal 9176 zcmd5>eQ;gHbw7LezWYA(fh5b4jb!^-7RZ)lN3jIP7~-c7BL`!mu^l(1kXW_^RxQgy zmI3o&($oc9yO>EGAOs4broj?U)31T)xN#w2Y-ml~)-y>66W?==%P%+7e>t5`?G z8iU8dlfvWSNy?{yaIKi%VeWa(YUXKiHZsqM{X67|YGXQBPKs>O+?5NgpJALO7%efw zI$bQ+I`U4bh-VU)zfq3dNnGB9de7J<%^lmseqO@6>;>l5DNmul=XfQTGdEtzCg!fK z{A+DbT=t0OMn+S_IgL+12G2N+ceCDey^wweWD^UNAntQ zj>?fRzC51zxeeq?xPIAnn<_Y-=T@P+U%C?=r>2r<-sG*zHL|EBQ*jE!M1Y9-oC(pShLvk0R)*31>5{+T#0_BUx?AC0Dw z7}6Ll4?=WaGmx2#&-0Odgp$Ka8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C(Mp{P4nLJ|4={@#3CbMcfm)ubu-B*9p%Go3(ahx)0?nc@Dfh zzP5GV;$J=cFFLRP3myyZjTndP-M{B{sm1Tmx`zKCKUU=o@ zf8s5c`$>2sr5Dq0LY8QY&(fdgX{c=Z>Duu#N8deFd+d*7;6JEmMpN!hjD4HI!~3jX z>H{x#9DhIJoxE1%NlSaSrS-s@^~d&{dw10tIrj6Z%nJcs89=TSY1m0R(f$dZI56zuy4j)8C zz4PY0)A*XyC=Wr~|n@WAH>a_o z#^k)a5(@(U9l+C=7JmtY6O!@x(+DEQhxP+^Uka6GIGMF~!CnUX8Gt0GG10wXWjb;P z?ma;guf|HHumA73l)rU4{=Opoj5z)o$nk6Nxjwxd8OIoqk3&cT{E&~QBA(|M;U6u= z-$T6d@h{Fof`=Y5dm zAHlzci$>1;`pDhHNA>T{UAW*-<-Z%=P%2~}>_vQch{tENynSgeW9J^KJXBfb5MPNH z>d2SD+|9s_G*Lr*BGi8ZADR{axAF)CNXlP;zY(8togBbO6F3Lt@$P&p_`RD0p+zLWRAuV{{ysij{)u4`8` zrw)Uw0y*MXpihx|PxPlwYW-ZqcUT%t0yyT%ZQWGO;Y>i=3OHX<@@nh)Jw4TK#p`D*5_XP zpR<;i2jk^R15U*J8rBqqWP>#yzUI%}8JM zHBz0p)eGAY7K47y?DGcSn7ltMlPvrB`+(2s?*p&tKJa<0qXC(nis#iqxjH2|`h4;d zE~Zv9H{;{#gZ3~l^e@Ic4o?dXPRLM1HY@mR5SfqDY1^lBlIv>g>T2Uj6|E>pr{lEc zP;ATP+PmA@a2)6m>vp*9uJpKW2aX>op lists:foreach(fun(Other) -> Other#users.pid ! {psu_player_spawn, User} end, egs_db:users_select_others(GID)), % load lobby and character egs_proto:send_character_selected(CSocket, GID, Char, Options), - % 0246 0a0a 1006 + % 0246 + send_packet_0a0a(CSocket, GID), + % 1006 send_packet_1005(CSocket, GID, Char), % 1006 0210 egs_proto:send_universe_info(CSocket, GID), @@ -243,7 +245,7 @@ lobby_load(CSocket, GID, Quest, MapType, MapNumber, MapEntry) -> % 100e 020c egs_proto:send_load_quest(CSocket, GID), send_packet_201(CSocket, GID, User, Char), - % 0a06 + send_packet_0a06(CSocket, GID), Users = egs_db:users_select_others(GID), send_packet_233(CSocket, GID, Users), egs_proto:send_loading_end(CSocket, GID), @@ -270,8 +272,9 @@ mission_load(CSocket, GID, Quest, MapType, MapNumber, MapEntry) -> egs_proto:send_zone_init(CSocket, GID, mission), egs_proto:send_zone(CSocket, ZoneFile), egs_proto:send_map(CSocket, Quest, MapType, MapNumber, MapEntry), - % 100e 0215 0215 0c09 020c + % 100e 0215 0215 egs_proto:send_trial_start(CSocket, GID), + % 020c % mandatory packet to make enemies appear {ok, << _:32, Packet/bits >>} = file:read_file("p/packet1202.bin"), @@ -280,7 +283,7 @@ mission_load(CSocket, GID, Quest, MapType, MapNumber, MapEntry) -> % 1204 1206 1207 egs_proto:send_load_quest(CSocket, GID), send_packet_201(CSocket, GID, User, Char), - % 0a06 + send_packet_0a06(CSocket, GID), egs_proto:send_loading_end(CSocket, GID), egs_proto:send_camera_center(CSocket, GID) catch @@ -474,6 +477,23 @@ broadcast(Command, GID, Packet) handle(16#0102, _, _, _, _) -> ignore; +%% @doc Weapon change handler. Fake it. +%% @todo Others probably want to see that you changed your weapon. + +handle(16#0105, CSocket, GID, _, Orig) -> + log(GID, "weapon change (and more probably)"), + << _:384, Rest/bits >> = Orig, + Packet = << 16#01050300: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, Rest/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. + +handle(16#0110, CSocket, GID, _, _) -> + log(GID, "death (and more probably)"), + lobby_load(CSocket, GID, 1100000, 0, 4, 6); + %% @doc Keepalive handler. Do nothing. handle(16#021c, _, _, _, _) -> @@ -533,6 +553,11 @@ handle(16#0304, _, GID, Version, Packet) -> log(GID, io_lib:format("chat from ~s: ~s", [[re:replace(LogName, "\\0", "", [global, {return, binary}])], [re:replace(LogMessage, "\\0", "", [global, {return, binary}])]])), lists:foreach(fun(User) -> User#users.pid ! {psu_chat, GID, ActualName, ChatModifiers, ChatMessage} end, egs_db:users_select_all()); +%% @todo Handle this packet. Ignore for now. + +handle(16#0402, _, _, _, _) -> + ignore; + %% @doc Map change handler. %% Spaceports and my room are handled differently than normal lobbies. %% @todo Load 'Your room' correctly. @@ -557,7 +582,7 @@ handle(16#0811, CSocket, GID, _, Packet) -> log(GID, io_lib:format("mission counter (~b,~b,~b,~b)", [Quest,MapType, MapNumber, MapEntry])), counter_load(CSocket, GID, Quest, MapType, MapNumber, MapEntry); -%% @doc Mission select handler? +%% @doc Mission select handler? Packet contains the selected mission number. %% @todo Load more than one mission. handle(16#0c01, CSocket, GID, _, _) -> @@ -599,6 +624,20 @@ handle(16#0d07, _, GID, _, Packet) -> User = egs_db:users_select(GID), file:write_file(io_lib:format("save/~s/~b-character.options", [User#users.folder, User#users.charnumber]), Options); +%% @doc Hit handler. +%% @todo Finish the work on it. + +handle(16#0e00, CSocket, GID, _, Orig) -> + << _:448, A:224/bits, B:128/bits, _/bits >> = Orig, + PlayerHP = 4401, + TargetHP = 0, + Damage = 58008, + Packet = << 16#0e070300:32, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, + 1:32/little-unsigned-integer, 16#01050000:32, Damage:32/little-unsigned-integer, + A/binary, 0:64, PlayerHP:32/little-unsigned-integer, 0:32, 16#01000200:32, + 0:32, TargetHP:32, 0:32, B/binary, 16#04320000:32, 16#80000000:32, 16#26030000:32, 16#89068d00:32, 16#0c1c0105:32 >>, + egs_proto:packet_send(CSocket, Packet); + %% @doc Lobby event handler. Handle chairs! %% Apparently used for elevator, sit on chairs, and more? %% @todo Handle more than sit on chair. @@ -685,6 +724,18 @@ build_packet_233_contents(Users) -> Next = build_packet_233_contents(Rest), << Chunk/binary, Next/binary >>. +%% @todo Inventory related. Figure out everything in this packet and handle it correctly. + +send_packet_0a06(CSocket, GID) -> + {ok, << _:32, A:96/bits, _:32, B:96/bits, _:32, C:1440/bits, _:32, D/bits >>} = file:read_file("p/packet0a06.bin"), + egs_proto:packet_send(CSocket, << A/binary, GID:32/little-unsigned-integer, B/binary, GID:32/little-unsigned-integer, C/binary, GID:32/little-unsigned-integer, D/binary >>). + +%% @todo Inventory. Figure out everything in this packet and handle it correctly. + +send_packet_0a0a(CSocket, GID) -> + {ok, << _:32, A:224/bits, _:32, B/bits >>} = file:read_file("p/packet0a0a.bin"), + egs_proto:packet_send(CSocket, << A/binary, GID:32/little-unsigned-integer, B/binary >>). + %% @todo Figure out what the packet is. send_packet_1005(CSocket, GID, Char) ->