From 71c2f729208cecb039e2bd753a50b55c2788f2d0 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Wed, 2 Jan 2019 01:46:34 +0100 Subject: Bounties? Somehow, Dialyzer does not see the type issues with src/bounty/bnt_join_battle.erl, but there are btl_character and rst_character mix-ups. --- src/special/spe_player.erl | 191 --------------------------------------------- 1 file changed, 191 deletions(-) delete mode 100644 src/special/spe_player.erl (limited to 'src/special/spe_player.erl') diff --git a/src/special/spe_player.erl b/src/special/spe_player.erl deleted file mode 100644 index 00086fd..0000000 --- a/src/special/spe_player.erl +++ /dev/null @@ -1,191 +0,0 @@ --module(spe_player). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export([generate/3]). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec reserve_login (binary(), binary()) -> 'ok'. -reserve_login (UsernameLC, EmailLC) -> - ok = ataxia_client:reserve(login_db, UsernameLC), - ok = ataxia_client:reserve(login_db, EmailLC), - - ok. - --spec finalize_login (binary(), binary(), binary()) -> 'ok'. -finalize_login (UsernameLC, EmailLC, PlayerID) -> - LoginUpdateQueryOps = - ataxic:sequence_meta - ( - [ - ataxic:update_value(ataxic:constant(PlayerID)), - ataxic:update_read_permission - ( - ataxic:constant - ( - ataxia_security:allow_only - ( - ataxia_security:any() - ) - ) - ), - ataxic:update_write_permission - ( - ataxic:constant - ( - ataxia_security:allow_only - ( - ataxia_security:user_from_id(PlayerID) - ) - ) - ) - ] - ), - - ok = - ataxia_client:update - ( - login_db, - ataxia_security:janitor(), - LoginUpdateQueryOps, - UsernameLC - ), - - ok = - ataxia_client:update - ( - login_db, - ataxia_security:janitor(), - LoginUpdateQueryOps, - EmailLC - ), - - 'ok'. - --spec generate_inventory (ataxia_id:type()) -> ataxia_id:type(). -generate_inventory (PlayerID) -> - Inventory = shr_inventory:new(PlayerID), - - {ok, InventoryID} = - ataxia_client:add - ( - inventory_db, - ataxia_security:allow_only(ataxia_security:any()), - ataxia_security:allow_only(ataxia_security:user_from_id(PlayerID)), - Inventory - ), - - InventoryID. - --spec generate_roster (ataxia_id:type()) -> ataxia_id:type(). -generate_roster (PlayerID) -> - Roster = rst_roster:new(PlayerID), - {ok, RosterID} = - ataxia_client:add - ( - roster_db, - ataxia_security:allow_only(ataxia_security:any()), - ataxia_security:allow_only(ataxia_security:user_from_id(PlayerID)), - Roster - ), - - RosterID. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec generate (binary(), binary(), binary()) -> shr_player:type(). -generate (Username, Password, Email) -> - UsernameLC = string:lowercase(Username), - EmailLC = string:lowercase(Email), - - ok = reserve_login(UsernameLC, EmailLC), - - Player = shr_player:new(<<"">>, Username, Password, Email), - - JanitorOnlyPermission = - ataxia_security:allow_only(ataxia_security:janitor()), - - {ok, PlayerID} = - ataxia_client:add - ( - player_db, - JanitorOnlyPermission, - JanitorOnlyPermission, - Player - ), - - shr_janitor:new(player_db, PlayerID), - - InvID = generate_inventory(PlayerID), - RosterID = generate_roster(PlayerID), - - PlayerUpdateQueryOps = - ataxic:sequence_meta - ( - [ - ataxic:update_value - ( - ataxic:sequence - ( - [ - ataxic:update_field - ( - shr_player:get_id_field(), - ataxic:constant(PlayerID) - ), - ataxic:update_field - ( - shr_player:get_inventory_id_field(), - ataxic:constant(InvID) - ), - ataxic:update_field - ( - shr_player:get_roster_id_field(), - ataxic:constant(RosterID) - ) - ] - ) - ), - ataxic:update_read_permission - ( - ataxic:constant - ( - ataxia_security:allow_only(ataxia_security:any()) - ) - ), - ataxic:update_write_permission - ( - ataxic:constant - ( - ataxia_security:allow_only - ( - ataxia_security:user_from_id(PlayerID) - ) - ) - ) - ] - ), - - ok = finalize_login(UsernameLC, EmailLC, PlayerID), - - ok = - ataxia_client:update - ( - player_db, - ataxia_security:janitor(), - PlayerUpdateQueryOps, - PlayerID - ), - - - Result = shr_player:set_id(PlayerID, Player), - - Result. -- cgit v1.2.3-70-g09d2