From 6ddab0d3236d2fccce62548e15fbf653c582972c Mon Sep 17 00:00:00 2001 From: Koncord Date: Mon, 1 May 2017 21:15:12 +0800 Subject: [PATCH] [Server] Add and implement "look like creature" functions --- apps/openmw-mp/Script/Functions/Stats.cpp | 26 +++++++++++++++++++++++ apps/openmw-mp/Script/Functions/Stats.hpp | 6 ++++++ 2 files changed, 32 insertions(+) diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 7ba6f9860..1f7bbeb56 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -117,6 +117,22 @@ const char *StatsFunctions::GetBirthsign(unsigned short pid) noexcept return player->birthsign.c_str(); } +const char *StatsFunctions::GetCreatureModel(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, 0); + + return player->creatureModel.c_str(); +} + +bool StatsFunctions::IsCreatureName(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, 0); + + return player->useCreatureName; +} + int StatsFunctions::GetLevel(unsigned short pid) noexcept { Player *player; @@ -321,6 +337,16 @@ void StatsFunctions::SetBirthsign(unsigned short pid, const char *sign) noexcept player->birthsign = sign; } +void StatsFunctions::SetCreatureModel(unsigned short pid, const char *name, bool useCreatureName) noexcept +{ + Player *player; + GET_PLAYER(pid, player, ); + + player->creatureModel = name; + player->useCreatureName = useCreatureName; + +} + void StatsFunctions::SetLevel(unsigned short pid, int value) noexcept { Player *player; diff --git a/apps/openmw-mp/Script/Functions/Stats.hpp b/apps/openmw-mp/Script/Functions/Stats.hpp index 502ec8ff6..14d7c3c1f 100644 --- a/apps/openmw-mp/Script/Functions/Stats.hpp +++ b/apps/openmw-mp/Script/Functions/Stats.hpp @@ -19,6 +19,8 @@ {"GetHair", StatsFunctions::GetHairstyle},\ {"GetIsMale", StatsFunctions::GetIsMale},\ {"GetBirthsign", StatsFunctions::GetBirthsign},\ + {"GetCreatureModel", StatsFunctions::GetCreatureModel},\ + {"IsCreatureName", StatsFunctions::IsCreatureName},\ \ {"GetLevel", StatsFunctions::GetLevel},\ {"GetLevelProgress", StatsFunctions::GetLevelProgress},\ @@ -48,6 +50,7 @@ {"SetHair", StatsFunctions::SetHairstyle},\ {"SetIsMale", StatsFunctions::SetIsMale},\ {"SetBirthsign", StatsFunctions::SetBirthsign},\ + {"SetCreatureModel", StatsFunctions::SetCreatureModel},\ \ {"SetLevel", StatsFunctions::SetLevel},\ {"SetLevelProgress", StatsFunctions::SetLevelProgress},\ @@ -95,6 +98,8 @@ public: static const char *GetHairstyle(unsigned short pid) noexcept; static int GetIsMale(unsigned short pid) noexcept; static const char *GetBirthsign(unsigned short pid) noexcept; + static const char *GetCreatureModel(unsigned short pid) noexcept; + static bool IsCreatureName(unsigned short pid) noexcept; static int GetLevel(unsigned short pid) noexcept; static int GetLevelProgress(unsigned short pid) noexcept; @@ -122,6 +127,7 @@ public: static void SetHairstyle(unsigned short pid, const char *style) noexcept; static void SetIsMale(unsigned short pid, int male) noexcept; static void SetBirthsign(unsigned short pid, const char *name) noexcept; + static void SetCreatureModel(unsigned short pid, const char *name, bool useCreatureName) noexcept; static void SetLevel(unsigned short pid, int value) noexcept; static void SetLevelProgress(unsigned short pid, int value) noexcept;