From fd4d031ab5b31763d376c663cc049f62ee389243 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 26 Feb 2018 13:52:29 +0100 Subject: Got it to run, at last. --- src/struct/character.erl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/struct/character.erl') diff --git a/src/struct/character.erl b/src/struct/character.erl index 0459214..90e449c 100644 --- a/src/struct/character.erl +++ b/src/struct/character.erl @@ -41,6 +41,13 @@ ] ). +-export +( + [ + random/2 + ] +). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -71,3 +78,23 @@ set_statistics (Stats, Char) -> { statistics = Stats }. + +random (ID, OwnerID) -> + WeaponIDs = {weapon:random_id(), weapon:random_id()}, + Attributes = attributes:random(), + Statistics = statistics:new(Attributes, WeaponIDs), + IDAsListString = integer_to_list(ID), + IDAsBinaryString = list_to_binary(IDAsListString), + + #character + { + id = ID, + owner_id = OwnerID, + name = list_to_binary("Char" ++ IDAsListString), + icon = IDAsBinaryString, + portrait = IDAsBinaryString, + attributes = Attributes, + weapon_ids = WeaponIDs, + glyphs = [], + statistics = Statistics + }. -- cgit v1.2.3-70-g09d2