Rename egs_quests_db:quest and :zone into :quest_nbl and :zone_nbl.

This commit is contained in:
Loïc Hoguin 2011-02-14 13:04:26 +01:00
parent fdfd49179f
commit ffd27bda46
3 changed files with 13 additions and 13 deletions

View File

@ -259,7 +259,7 @@ event({counter_enter, CounterID, FromZoneID, FromMapID, FromEntryID}, State=#sta
FromArea = {element(1, OldUser#users.area), FromZoneID, FromMapID},
User = OldUser#users{areatype=counter, area={16#7fffffff, 0, 0}, entryid=0, prev_area=FromArea, prev_entryid=FromEntryID},
egs_users:write(User),
QuestData = egs_quests_db:quest(0),
QuestData = egs_quests_db:quest_nbl(0),
{ok, ZoneData} = file:read_file("data/lobby/counter.zone.nbl"),
%% broadcast unspawn to other people
{ok, UnspawnList} = egs_users:select({neighbors, OldUser}),

View File

@ -19,7 +19,7 @@
-module(egs_quests_db).
-behavior(gen_server).
-export([start_link/0, stop/0, quest/1, zone/2, area_type/2, reload/0]). %% API.
-export([start_link/0, stop/0, quest_nbl/1, zone_nbl/2, area_type/2, reload/0]). %% API.
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). %% gen_server.
-record(state, {quests=[], quests_bin=[], zones_bin=[]}).
@ -37,13 +37,13 @@ start_link() ->
stop() ->
gen_server:call(?SERVER, stop).
%% @spec quest(QuestID) -> binary()
quest(QuestID) ->
gen_server:call(?SERVER, {quest, QuestID}).
%% @spec quest_nbl(QuestID) -> binary()
quest_nbl(QuestID) ->
gen_server:call(?SERVER, {quest_nbl, QuestID}).
%% @spec zone(QuestID, ZoneID) -> binary()
zone(QuestID, ZoneID) ->
gen_server:call(?SERVER, {zone, QuestID, ZoneID}).
%% @spec zone_nbl(QuestID, ZoneID) -> binary()
zone_nbl(QuestID, ZoneID) ->
gen_server:call(?SERVER, {zone_nbl, QuestID, ZoneID}).
area_type(QuestID, ZoneID) ->
gen_server:call(?SERVER, {area_type, QuestID, ZoneID}).
@ -59,7 +59,7 @@ init([]) ->
%% @doc Return a quest information either from the cache or from the configuration file,
%% in which case it gets added to the cache for subsequent attempts.
handle_call({quest, QuestID}, _From, State=#state{quests=Cache, quests_bin=BinCache}) ->
handle_call({quest_nbl, QuestID}, _From, State=#state{quests=Cache, quests_bin=BinCache}) ->
case proplists:get_value(QuestID, BinCache) of
undefined ->
Dir = io_lib:format("priv/quests/~b/", [QuestID]),
@ -85,7 +85,7 @@ handle_call({quest, QuestID}, _From, State=#state{quests=Cache, quests_bin=BinCa
%% @doc Return a zone information either from the cache or from the configuration files.
%% @todo FilePos, text.bin, other sets, enemies.
handle_call({zone, QuestID, ZoneID}, _From, State=#state{quests=QuestsCache, zones_bin=BinCache}) ->
handle_call({zone_nbl, QuestID, ZoneID}, _From, State=#state{quests=QuestsCache, zones_bin=BinCache}) ->
case proplists:get_value({QuestID, ZoneID}, BinCache) of
undefined ->
Dir = io_lib:format("priv/quests/~b/", [QuestID]),

View File

@ -44,9 +44,9 @@ char_load(User, State) ->
area_load(QuestID, ZoneID, MapID, EntryID, State) ->
{ok, OldUser} = egs_users:read(State#state.gid),
{OldQuestID, OldZoneID, _OldMapID} = OldUser#users.area,
QuestData = egs_quests_db:quest(QuestID),
QuestData = egs_quests_db:quest_nbl(QuestID),
QuestChange = OldQuestID /= QuestID,
ZoneData = egs_quests_db:zone(QuestID, ZoneID),
ZoneData = egs_quests_db:zone_nbl(QuestID, ZoneID),
ZoneChange = if OldQuestID =:= QuestID, OldZoneID =:= ZoneID -> false; true -> true end,
AreaType = egs_quests_db:area_type(QuestID, ZoneID),
AreaShortName = "dammy", %% @todo Load the short name from egs_quests_db.
@ -339,7 +339,7 @@ send_100f(NPCid, PartyPos) ->
%% @doc Send the mission's quest file when starting a new mission.
%% @todo Handle correctly. 0:32 is actually a missing value. Value before that is unknown too.
send_1015(QuestID) ->
QuestData = egs_quests_db:quest(QuestID),
QuestData = egs_quests_db:quest_nbl(QuestID),
Size = byte_size(QuestData),
send(<< (header(16#1015))/binary, QuestID:32/little-unsigned-integer, 16#01010000:32, 0:32, Size:32/little-unsigned-integer, QuestData/binary >>).