From 9efb734c636cc5be79251253c36cf71dda89f76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 17 Nov 2010 02:19:10 +0100 Subject: [PATCH] quests: Convert the zones to a proplist of proplists rather than a list of proplists. --- priv/quests/0/quest.conf | 2 +- priv/quests/1100000/quest.conf | 18 +++++++++--------- priv/quests/1101000/quest.conf | 20 ++++++++++---------- priv/quests/1102000/quest.conf | 18 +++++++++--------- priv/quests/1103000/quest.conf | 20 ++++++++++---------- priv/quests/1104000/quest.conf | 2 +- src/egs_files.erl | 14 ++++++-------- src/egs_quests_db.erl | 3 +-- 8 files changed, 47 insertions(+), 50 deletions(-) diff --git a/priv/quests/0/quest.conf b/priv/quests/0/quest.conf index a59b5c1..e87a9d2 100644 --- a/priv/quests/0/quest.conf +++ b/priv/quests/0/quest.conf @@ -29,7 +29,7 @@ %% @todo Default enemy_level to 1 if unspecified (lobbies). {zones, [ - [{zoneid, 0}, {areaid, 0}, {enemy_level, 1}, {sets, []}, {maps, []}] + {0, [{areaid, 0}, {enemy_level, 1}, {sets, []}, {maps, []}]} ]}. {temp_flags, []}. diff --git a/priv/quests/1100000/quest.conf b/priv/quests/1100000/quest.conf index 6f927d0..28f39a6 100644 --- a/priv/quests/1100000/quest.conf +++ b/priv/quests/1100000/quest.conf @@ -27,15 +27,15 @@ %% @todo Default enemy_level to 1 if unspecified (lobbies). %% @todo Default sets to [100] if unspecified (lobbies). {zones, [ - [{zoneid, 0}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [1, 2, 3, 4]}], - [{zoneid, 1}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9001]}], - [{zoneid, 2}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9000]}], - [{zoneid, 3}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9102]}], - [{zoneid, 4}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}], - [{zoneid, 7}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9200, 9202]}], - [{zoneid, 11}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [5, 100, 101, 102, 103, 110]}], - [{zoneid, 12}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [100, 101, 102]}], - [{zoneid, 13}, {areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [100, 101, 102]}] + { 0, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [1, 2, 3, 4]}]}, + { 1, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9001]}]}, + { 2, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9000]}]}, + { 3, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9102]}]}, + { 4, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}]}, + { 7, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [9200, 9202]}]}, + {11, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [5, 100, 101, 102, 103, 110]}]}, + {12, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [100, 101, 102]}]}, + {13, [{areaid, 2}, {enemy_level, 1}, {sets, [100]}, {maps, [100, 101, 102]}]} ]}. {temp_flags, []}. diff --git a/priv/quests/1101000/quest.conf b/priv/quests/1101000/quest.conf index 5438dff..fa89e58 100644 --- a/priv/quests/1101000/quest.conf +++ b/priv/quests/1101000/quest.conf @@ -28,16 +28,16 @@ %% @todo Default sets to [100] if unspecified (lobbies). {zones, [ - [{zoneid, 0}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [1, 2, 3]}], - [{zoneid, 1}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9000]}], - [{zoneid, 2}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}], - [{zoneid, 3}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9101]}], - [{zoneid, 4}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9100]}], - [{zoneid, 5}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9030]}], - [{zoneid, 7}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9200, 9201, 9203, 9209]}], - [{zoneid, 11}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [4, 100, 200]}], - [{zoneid, 12}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}], - [{zoneid, 13}, {areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}] + { 0, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [1, 2, 3]}]}, + { 1, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9000]}]}, + { 2, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}]}, + { 3, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9101]}]}, + { 4, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9100]}]}, + { 5, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9030]}]}, + { 7, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [9200, 9201, 9203, 9209]}]}, + {11, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [4, 100, 200]}]}, + {12, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}]}, + {13, [{areaid, 3}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}]} ]}. {temp_flags, ["ACC_BIT_FLG_01"]}. diff --git a/priv/quests/1102000/quest.conf b/priv/quests/1102000/quest.conf index 2f33288..6df31bb 100644 --- a/priv/quests/1102000/quest.conf +++ b/priv/quests/1102000/quest.conf @@ -28,15 +28,15 @@ %% @todo Default sets to [100] if unspecified (lobbies). {zones, [ - [{zoneid, 0}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [1]}], - [{zoneid, 1}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9000]}], - [{zoneid, 2}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}], - [{zoneid, 3}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9100]}], - [{zoneid, 4}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9120]}], - [{zoneid, 7}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9300, 9301, 9302, 9305]}], - [{zoneid, 11}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [3, 100, 200]}], - [{zoneid, 12}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}], - [{zoneid, 13}, {areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}] + { 0, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [1]}]}, + { 1, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9000]}]}, + { 2, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}]}, + { 3, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9100]}]}, + { 4, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9120]}]}, + { 7, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [9300, 9301, 9302, 9305]}]}, + {11, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [3, 100, 200]}]}, + {12, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}]}, + {13, [{areaid, 4}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}]} ]}. {temp_flags, []}. diff --git a/priv/quests/1103000/quest.conf b/priv/quests/1103000/quest.conf index 11ab377..319317b 100644 --- a/priv/quests/1103000/quest.conf +++ b/priv/quests/1103000/quest.conf @@ -28,16 +28,16 @@ %% @todo Default sets to [100] if unspecified (lobbies). {zones, [ - [{zoneid, 0}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [1]}], - [{zoneid, 1}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}], - [{zoneid, 3}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9101]}], - [{zoneid, 4}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9202]}], - [{zoneid, 5}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9030]}], - [{zoneid, 6}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9040]}], - [{zoneid, 7}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9300, 9302, 9304]}], - [{zoneid, 11}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [2, 100, 101, 200]}], - [{zoneid, 12}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}], - [{zoneid, 13}, {areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}] + { 0, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [1]}]}, + { 1, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9010]}]}, + { 3, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9101]}]}, + { 4, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9202]}]}, + { 5, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9030]}]}, + { 6, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9040]}]}, + { 7, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [9300, 9302, 9304]}]}, + {11, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [2, 100, 101, 200]}]}, + {12, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}]}, + {13, [{areaid, 5}, {enemy_level, 1}, {sets, [100]}, {maps, [100]}]} ]}. {temp_flags, []}. diff --git a/priv/quests/1104000/quest.conf b/priv/quests/1104000/quest.conf index ae4592d..8a1c5bb 100644 --- a/priv/quests/1104000/quest.conf +++ b/priv/quests/1104000/quest.conf @@ -29,7 +29,7 @@ %% @todo Default enemy_level to 1 if unspecified (lobbies). {zones, [ - [{zoneid, 0}, {areaid, 2}, {enemy_level, 1}, {sets, []}, {maps, [900]}] + {0, [{areaid, 2}, {enemy_level, 1}, {sets, []}, {maps, [900]}]} ]}. {temp_flags, []}. diff --git a/src/egs_files.erl b/src/egs_files.erl index ef26904..eab4c23 100644 --- a/src/egs_files.erl +++ b/src/egs_files.erl @@ -197,11 +197,10 @@ load_quest_xnr_zones([], _BasePos, SetsAcc, SetsPtrsAcc, ZonesAcc) -> SetsPtrsList = lists:flatten(lists:reverse(SetsPtrsAcc)), ZonesBin = iolist_to_binary(lists:reverse(ZonesAcc)), {SetsBin, SetsPtrsList, ZonesBin}; -load_quest_xnr_zones([Zone|Tail], BasePos, SetsAcc, SetsPtrsAcc, ZonesAcc) -> - ZoneID = proplists:get_value(zoneid, Zone), - AreaID = proplists:get_value(areaid, Zone), - EnemyLevel = proplists:get_value(enemy_level, Zone), - SetList = proplists:get_value(sets, Zone), +load_quest_xnr_zones([{ZoneID, ZoneParams}|Tail], BasePos, SetsAcc, SetsPtrsAcc, ZonesAcc) -> + AreaID = proplists:get_value(areaid, ZoneParams), + EnemyLevel = proplists:get_value(enemy_level, ZoneParams), + SetList = proplists:get_value(sets, ZoneParams), NbSets = length(SetList), SetsBin = iolist_to_binary([<< Set:32/little >> || Set <- SetList]), SetsBin2 = << SetsBin/binary, BasePos:32/little, NbSets:32/little >>, @@ -308,9 +307,8 @@ load_unit_title_table_rel_zones(Zones) -> load_unit_title_table_rel_zones(Zones, 0, []). load_unit_title_table_rel_zones([], N, Acc) -> {iolist_to_binary(lists:reverse(Acc)), N}; -load_unit_title_table_rel_zones([Zone|Tail], N, Acc) -> - ZoneID = proplists:get_value(zoneid, Zone), - Maps = proplists:get_value(maps, Zone), +load_unit_title_table_rel_zones([{ZoneID, ZoneParams}|Tail], N, Acc) -> + Maps = proplists:get_value(maps, ZoneParams), {Bin, N2} = load_unit_title_table_rel_maps(ZoneID, Maps), load_unit_title_table_rel_zones(Tail, N + N2, [Bin|Acc]). diff --git a/src/egs_quests_db.erl b/src/egs_quests_db.erl index 2b988be..50e90af 100644 --- a/src/egs_quests_db.erl +++ b/src/egs_quests_db.erl @@ -112,8 +112,7 @@ load_unit_title_bin_files(Dir, ConfFilename) -> [load_unit_title_bin(Dir, Zone) || Zone <- Zones] end. -load_unit_title_bin(Dir, Zone) -> - ZoneID = proplists:get_value(zoneid, Zone), +load_unit_title_bin(Dir, {ZoneID, _ZoneParams}) -> Filename = io_lib:format("unit_title_~2.10.0b.bin", [ZoneID]), TxtFilename = io_lib:format("~s~s.en_US.txt", [Dir, Filename]), {data, Filename, egs_files:load_text_bin(TxtFilename), []}.