diff --git a/include/maps.hrl b/include/maps.hrl index 4933cf1..cbb1e04 100644 --- a/include/maps.hrl +++ b/include/maps.hrl @@ -179,11 +179,9 @@ ]). %% EGS counters settings. +%% Various appearance configuration counters don't have any quest-related data. They use the CounterID 65535. -define(COUNTERS, [ - % Colony mission counters - {0, [{lobby, [1100000, 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, [{lobby, [1100000, 0]}, {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}] } + {0, [{quests, "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, [{quests, "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 >>}]} ]). diff --git a/include/records.hrl b/include/records.hrl index e32c3bc..93c5bd5 100644 --- a/include/records.hrl +++ b/include/records.hrl @@ -19,4 +19,4 @@ %% EGS database schema. -record(ids, {type, id}). --record(users, {gid, pid, socket, auth, time, folder, charnumber, charname, lid, instanceid, questid, zoneid, mapid, entryid, direction, coords}). +-record(users, {gid, pid, socket, auth, time, folder, charnumber, charname, lid, instanceid, questid, zoneid, mapid, entryid, savedquestid, savedzoneid, direction, coords}). diff --git a/src/egs_game.erl b/src/egs_game.erl index 9231272..4acca91 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -206,7 +206,7 @@ char_select_load(CSocket, GID, Version, Number) -> counter_load(CSocket, GID, QuestID, ZoneID, MapID, EntryID) -> OldUser = egs_db:users_select(GID), - User = OldUser#users{questid=QuestID, zoneid=ZoneID, mapid=MapID, entryid=EntryID}, + User = OldUser#users{questid=QuestID, zoneid=ZoneID, mapid=MapID, entryid=EntryID, savedquestid=OldUser#users.questid, savedzoneid=OldUser#users.zoneid}, egs_db:users_insert(User), [{status, 1}, {char, Char}, {options, _}] = char_load(User#users.folder, User#users.charnumber), AreaName = "Mission counter", @@ -631,8 +631,7 @@ handle(16#0811, CSocket, GID, _, Orig) -> handle(16#0812, CSocket, GID, _, _) -> User = egs_db:users_select(GID), - [{lobby, [QuestID, ZoneID]}|_] = proplists:get_value(User#users.entryid, ?COUNTERS), - lobby_load(CSocket, GID, QuestID, ZoneID, User#users.zoneid, User#users.mapid); + lobby_load(CSocket, GID, User#users.savedquestid, User#users.savedzoneid, User#users.zoneid, User#users.mapid); %% @doc Start mission handler. %% @todo Load more than one mission. @@ -652,7 +651,7 @@ handle(16#0c01, CSocket, GID, _, Orig) -> handle(16#0c05, CSocket, GID, _, _) -> User = egs_db:users_select(GID), - [{lobby, _}, {filename, Filename}|_] = proplists:get_value(User#users.entryid, ?COUNTERS), + [{quests, Filename}, {options, _}] = proplists:get_value(User#users.entryid, ?COUNTERS), {ok, << File/bits >>} = file:read_file(Filename), Packet = << 16#0c060300:32, 0:288, 1:32/little-unsigned-integer, File/binary >>, egs_proto:packet_send(CSocket, Packet); @@ -676,7 +675,7 @@ handle(16#0c0e, CSocket, GID, _, _) -> handle(16#0c0f, CSocket, GID, _, _) -> User = egs_db:users_select(GID), - [{lobby, _}, {filename, _}, {options, Options}] = proplists:get_value(User#users.entryid, ?COUNTERS), + [{quests, _}, {options, Options}] = proplists:get_value(User#users.entryid, ?COUNTERS), Packet = << 16#0c100300:32, 0:32, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, Options/binary >>, egs_proto:packet_send(CSocket, Packet);