game: Add space docks counter. Fix loading of other counters than LL.

This commit is contained in:
Loïc Hoguin 2010-06-06 01:51:18 +02:00
parent 43b4f6b263
commit d4622e29e2
3 changed files with 16 additions and 9 deletions

View File

@ -113,7 +113,8 @@
-define(COUNTERS, [
% Colony mission counters
{ 10497, [{lobby, [1100000, 0]}, {data, [
{0, [{filename, "data/missions/colony.counter.ll.pack"}, {options, << 16#01a92800:32, 3, 3, 0, 3, 3, 3, 3, 0, 0:40, 3, 3, 3, 3, 3, 0:176 >>}]}
{ 0, [{filename, "data/missions/colony.counter.ll.pack"}, {options, << 16#01a92800:32, 3, 3, 0, 3, 3, 3, 3, 0:48, 3, 3, 3, 3, 3, 0:176 >>}]},
{ 1, [{filename, "data/missions/colony.counter.docks.pack"}, {options, << 16#01805400:32, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 0:40, 3, 3, 3, 3, 0:40, 3, 0, 3, 0, 0:448 >>}]}
]}] },
% Lumilass
{ 731394, [{lobby, [1100000,11]}, {data, none}] }

View File

@ -221,7 +221,7 @@ counter_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, 0, 0, 0),
egs_proto:send_location(CSocket, GID, 16#7fffffff, 0, 0, AreaName),
egs_proto:send_location(CSocket, GID, 16#7fffffff, 0, 0, AreaName, MapEntry),
send_packet_0215(CSocket, GID, 0),
send_packet_0215(CSocket, GID, 0),
send_packet_020c(CSocket),
@ -248,7 +248,7 @@ lobby_load(CSocket, GID, Quest, MapType, MapNumber, MapEntry) ->
egs_db:users_insert(User),
[{status, 1}, {char, Char}, {options, _}] = char_load(User#users.folder, User#users.charnumber),
[{type, AreaType}, {name, AreaName}, {quest, QuestFile}, {zone, ZoneFile}, {entries, _}] = proplists:get_value([Quest, MapType, MapNumber], ?MAPS,
[{name, "dammy"}, {quest, "data/lobby/colony.quest.nbl"}, {zone, "data/lobby/colony.zone-0.nbl"}, {entries, []}]),
[{type, lobby}, {name, "dammy"}, {quest, "data/lobby/colony.quest.nbl"}, {zone, "data/lobby/colony.zone-0.nbl"}, {entries, []}]),
try
% broadcast spawn and unspawn to other people
lists:foreach(fun(Other) -> Other#users.pid ! {psu_player_unspawn, User} end, egs_db:users_select_others_in_area(OldUser)),
@ -271,7 +271,7 @@ lobby_load(CSocket, GID, Quest, MapType, MapNumber, MapEntry) ->
egs_proto:send_zone_init(CSocket, GID, lobby),
egs_proto:send_zone(CSocket, ZoneFile),
egs_proto:send_map(CSocket, MapType, MapNumber, MapEntry),
egs_proto:send_location(CSocket, GID, Quest, MapType, MapNumber, AreaName),
egs_proto:send_location(CSocket, GID, Quest, MapType, MapNumber, AreaName, 16#ffffffff),
send_packet_020c(CSocket),
case AreaType of
lobby ->
@ -308,7 +308,7 @@ 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, MapType, MapNumber, MapEntry),
egs_proto:send_location(CSocket, GID, Quest, MapType, MapNumber, AreaName),
egs_proto:send_location(CSocket, GID, Quest, MapType, MapNumber, AreaName, 16#ffffffff),
send_packet_0215(CSocket, GID, 0),
send_packet_0215(CSocket, GID, 0),
egs_proto:send_trial_start(CSocket, GID),
@ -651,7 +651,7 @@ handle(16#0c05, CSocket, GID, _, _) ->
[{lobby, _}, {data, Data}] = proplists:get_value(User#users.quest, ?COUNTERS),
[{filename, Filename}, {options, _}] = proplists:get_value(User#users.mapentry, Data),
{ok, << File/bits >>} = file:read_file(Filename),
Packet = << 16#0c060300:32, 0:288, 1:32/little-unsigned-integer, File/binary, 0:32 >>,
Packet = << 16#0c060300:32, 0:288, 1:32/little-unsigned-integer, File/binary >>,
egs_proto:packet_send(CSocket, Packet);
%% @doc Lobby transport handler? Just ignore the meseta price and send the player where he wanna be!

View File

@ -236,13 +236,19 @@ send_loading_end(CSocket, GID) ->
%% @todo Figure out what the last value is. No counter without it. The value before that is also different for counters.
%% @todo Handle correctly after unifying the area loading code.
send_location(CSocket, GID, Quest, MapType, MapNumber, Location) ->
send_location(CSocket, GID, Quest, MapType, MapNumber, Location, CounterID) ->
UCS2Location = << << X:8, 0:8 >> || X <- Location >>,
Packet = << 16#100e0300:32, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64,
1:32/little-unsigned-integer, MapNumber:16/little-unsigned-integer, MapType:16/little-unsigned-integer,
Quest:32/little-unsigned-integer, UCS2Location/binary >>,
PaddingSize = (128 - byte_size(Packet) - 4) * 8,
packet_send(CSocket, << Packet/binary, 0:PaddingSize, 1:32/little-unsigned-integer >>).
PaddingSize = (128 - byte_size(Packet) - 8) * 8,
case CounterID of
16#ffffffff ->
Footer = << CounterID:32/little-unsigned-integer, 0:32 >>;
_ ->
Footer = << CounterID:32/little-unsigned-integer, 1:32/little-unsigned-integer >>
end,
packet_send(CSocket, << Packet/binary, 0:PaddingSize, Footer/binary >>).
%% @doc Send the map ID to be loaded by the client.
%% @todo Last two values are unknown.