diff options
| author | Weicao Mao <1992414357@qq.com> | 2025-06-16 05:00:08 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-16 05:00:08 +0800 |
| commit | f5072499d9241b22e7a259267cc0315841b7589d (patch) | |
| tree | da0ef21a88131b6e495bf6ec0dc03092e2815a76 /core/src/data/player | |
| parent | bb7a31c753df0a7663cdcc89aff840384b16564e (diff) | |
| parent | b44b687c3c90642bbe609593b301cd248745dfc6 (diff) | |
Merge pull request #5 from CatilGrass/c_bindings
Add CBindings of GameData, GameRuntime
Diffstat (limited to 'core/src/data/player')
| -rw-r--r-- | core/src/data/player/player_data.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/data/player/player_data.rs b/core/src/data/player/player_data.rs index 1fe5ff0..9b1ab71 100644 --- a/core/src/data/player/player_data.rs +++ b/core/src/data/player/player_data.rs @@ -65,6 +65,17 @@ impl Player { player } + pub fn register_from_hash(hash: String) -> Player { + let mut player = Player { + customize: None, + account: Account::default() + }; + + player.account.id = "$only_hash$".to_string(); + player.account.player_hash = hash; + player + } + pub fn check(&self, password: String) -> bool { let hash = Self::gen_hash(self.account.id.clone(), password); hash == self.account.player_hash |
