diff --git a/src/egs_npc_db.erl b/src/egs_npc_db.erl index 9687533..394b4cf 100644 --- a/src/egs_npc_db.erl +++ b/src/egs_npc_db.erl @@ -19,7 +19,7 @@ -module(egs_npc_db). -behavior(gen_server). --export([start_link/0, stop/0, all/0, count/0, create/2, reload/0]). %% API. +-export([start_link/0, stop/0, all/0, create/2, reload/0]). %% API. -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). %% gen_server. %% Use the module name for the server's name. @@ -42,10 +42,6 @@ stop() -> all() -> gen_server:call(?SERVER, all). -%% @spec count() -> integer() -count() -> - gen_server:call(?SERVER, count). - %% @spec read(NPCid, BaseLevel) -> term() create(NPCid, BaseLevel) -> gen_server:call(?SERVER, {create, NPCid, BaseLevel}). @@ -63,9 +59,6 @@ init([]) -> handle_call(all, _From, State) -> {reply, ?NPC, State}; -handle_call(count, _From, State) -> - {reply, length(?NPC), State}; - %% @todo Handle stats, experience, based on level. handle_call({create, NPCid, BaseLevel}, _From, State) -> NPCGID = 16#ff000000 + mnesia:dirty_update_counter(counters, tmpgid, 1), diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index b0ab4bf..457026e 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -632,8 +632,9 @@ send_1601(PartyPos) -> %% @doc Send the player's NPC and PM information. %% @todo The value 4 is the card priority. Find what 3 is. When sending, the first 0 is an unknown value. send_1602() -> - NbNPC = egs_npc_db:count(), - Bin = iolist_to_binary([<< NPCid:8, 0, 4, 0, 3, 0:24 >> || {NPCid, _Data} <- egs_npc_db:all()]), + NPCList = egs_npc_db:all(), + NbNPC = length(NPCList), + Bin = iolist_to_binary([<< NPCid:8, 0, 4, 0, 3, 0:24 >> || {NPCid, _Data} <- NPCList]), MiddlePaddingSize = 8 * (344 - byte_size(Bin)), PMName = "My PM", UCS2PMName = << << X:8, 0:8 >> || X <- PMName >>,