| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2018-02-23 11:35:45 +0100 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2018-02-23 11:35:45 +0100 | 
| commit | acf9e9f1eb880ffb8ab918c40724eda566aefcc7 (patch) | |
| tree | efa3dd6c88d7970632fbe44f322d03b983b02768 /src/shim/character_shim.erl | |
| parent | 43e38e5fc54fd58e8230b2b5198b6d8cb625803c (diff) | |
Starting a big refactoring...
Diffstat (limited to 'src/shim/character_shim.erl')
| -rw-r--r-- | src/shim/character_shim.erl | 57 | 
1 files changed, 57 insertions, 0 deletions
| diff --git a/src/shim/character_shim.erl b/src/shim/character_shim.erl new file mode 100644 index 0000000..35a0753 --- /dev/null +++ b/src/shim/character_shim.erl @@ -0,0 +1,57 @@ +-module(character_shim). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-record +( +   character, +   { +      id, +      name, +      icon, +      portrait, +      attributes, +      weapons, +      glyphs, +      armors +   } +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( +   [ +      generate_random/1 +   ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +generate_char (N) -> +   IDAsString = list_to_binary(integer_to_list(N)), +   #character +   { +      id = IDAsString, % ID +      name = IDAsString, % Name +      icon = IDAsString, % Icon +      portrait = IDAsString, % Portrait +      attributes = attributes_shim:rand(), +      weapons = {weapon_shim:rand(), weapon_shim:rand()}, +      glyphs = [], +      armors = [] +   }. + +generate (0, Result) -> +   Result; +generate (N, Prev) -> +   generate((N - 1), [generate_char(N - 1)|Prev]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +generate_random (N) -> +   generate(N, []). | 


