mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 14:56:44 +00:00 
			
		
		
		
	Add script functions for getting attributes and skills by their names
This commit is contained in:
		
							parent
							
								
									41868cc9cc
								
							
						
					
					
						commit
						c94f818478
					
				
					 2 changed files with 20 additions and 6 deletions
				
			
		|  | @ -233,7 +233,7 @@ void ScriptFunctions::SetCurrentFatigue(unsigned short pid, float value) noexcep | |||
|     player->CreatureStats()->mDynamic[2].mCurrent = 0; | ||||
| } | ||||
| 
 | ||||
| int ScriptFunctions::GetAttributeIdByName(const char *name) noexcept | ||||
| int ScriptFunctions::GetAttributeId(const char *name) noexcept | ||||
| { | ||||
|     for (int x = 0; x < 8; x++) | ||||
|     { | ||||
|  | @ -246,7 +246,7 @@ int ScriptFunctions::GetAttributeIdByName(const char *name) noexcept | |||
|     return -1; | ||||
| } | ||||
| 
 | ||||
| int ScriptFunctions::GetSkillIdByName(const char *name) noexcept | ||||
| int ScriptFunctions::GetSkillId(const char *name) noexcept | ||||
| { | ||||
|     for (int x = 0; x < 27; x++) | ||||
|     { | ||||
|  | @ -259,6 +259,16 @@ int ScriptFunctions::GetSkillIdByName(const char *name) noexcept | |||
|     return -1; | ||||
| } | ||||
| 
 | ||||
| const char *ScriptFunctions::GetAttributeName(unsigned short attribute) noexcept | ||||
| { | ||||
|     return Attribute::sAttributeNames[attribute].c_str(); | ||||
| } | ||||
| 
 | ||||
| const char *ScriptFunctions::GetSkillName(unsigned short skill) noexcept | ||||
| { | ||||
|     return Skill::sSkillNames[skill].c_str(); | ||||
| } | ||||
| 
 | ||||
| int ScriptFunctions::GetAttribute(unsigned short pid, unsigned short attribute) noexcept | ||||
| { | ||||
|     Player *player; | ||||
|  |  | |||
|  | @ -87,8 +87,10 @@ public: | |||
|     static float GetCurrentFatigue(unsigned short pid) noexcept; | ||||
|     static void SetCurrentFatigue(unsigned short pid, float fatigue) noexcept; | ||||
| 
 | ||||
|     static int GetAttributeIdByName(const char *name) noexcept; | ||||
|     static int GetSkillIdByName(const char *name) noexcept; | ||||
|     static int GetAttributeId(const char *name) noexcept; | ||||
|     static int GetSkillId(const char *name) noexcept; | ||||
|     static const char *GetAttributeName(unsigned short attribute) noexcept; | ||||
|     static const char *GetSkillName(unsigned short skill) noexcept; | ||||
| 
 | ||||
|     static int GetAttribute(unsigned short pid, unsigned short attribute) noexcept; | ||||
|     static void SetAttribute(unsigned short pid, unsigned short attribute, int value) noexcept; | ||||
|  | @ -197,8 +199,10 @@ public: | |||
|             {"GetBirthsign",        ScriptFunctions::GetBirthsign}, | ||||
|             {"SetBirthsign",        ScriptFunctions::SetBirthsign}, | ||||
| 
 | ||||
|             {"GetAttributeIdByName", ScriptFunctions::GetAttributeIdByName}, | ||||
|             {"GetSkillIdByName",     ScriptFunctions::GetSkillIdByName}, | ||||
|             {"GetAttributeId", ScriptFunctions::GetAttributeId}, | ||||
|             {"GetSkillId",     ScriptFunctions::GetSkillId}, | ||||
|             {"GetAttributeName", ScriptFunctions::GetAttributeName}, | ||||
|             {"GetSkillName",     ScriptFunctions::GetSkillName}, | ||||
| 
 | ||||
|             {"GetAttribute",        ScriptFunctions::GetAttribute}, | ||||
|             {"SetAttribute",        ScriptFunctions::SetAttribute}, | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue