Skip to content

Commit

Permalink
Rename StatGetAttributeInt -> StatGetInt
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbyte committed Nov 22, 2019
1 parent 6749d55 commit 370370f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
27 changes: 23 additions & 4 deletions APIDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ Checks whether the specified stat entry exists. The query succeeds if the stat e
Checks whether the stat entry `_StatsId` has an attribute (data) named `_Attribute`. The query succeeds if the attribute exists, and fails if it does not.
### StatGetAttributeInt
`query NRD_StatGetAttributeInt([in](STRING)_StatsId, [in](STRING)_Attribute, [out](INTEGER)_Value)`
### StatGetInt
`query NRD_StatGetInt([in](STRING)_StatsId, [in](STRING)_Attribute, [out](INTEGER)_Value)`
Returns the specified `_Attribute` of the stat entry.
If the stat entry does not exist, the stat entry doesn't have an attribute named `_Attribute`, or the attribute isn't convertible to integer, the query fails.
**Notes:**
- For enumerations, the function will return the index of the value in the enumeration. eg. for Damage Type `Corrosive`, it will return 3.
### StatGetAttributeString
`query NRD_StatGetAttributeString([in](STRING)_StatsId, [in](STRING)_Attribute, [out](STRING)_Value)`
### StatGetString
`query NRD_StatGetString([in](STRING)_StatsId, [in](STRING)_Attribute, [out](STRING)_Value)`
Returns the specified `_Attribute` of the stat entry.
If the stat entry does not exist, the stat entry doesn't have an attribute named `_Attribute`, or the attribute isn't convertible to string, the query fails.
Expand Down Expand Up @@ -941,6 +941,25 @@ To start cloning an item, call `NRD_ItemCloneBegin()`. Additional modifications
| HasModifiedSkills | Flag | Indicates that the skills of the item were overridden |
| Skills | String | Item skills |
Example usage:
```c
[...]
NRD_ItemCloneBegin(_Item);
NRD_ItemCloneSetInt("Level", 10);
NRD_ItemCloneSetInt("GoldValueOverwrite", 1000);
PROC_XYZ_ItemCloneFinish();
PROC
PROC_XYZ_ItemCloneFinish()
AND
NRD_ItemClone(_NewItem)
AND
CharacterGetHostCharacter(_Character)
THEN
NRD_ItemSetPermanentBoostInt(_NewItem, "PoisonResistance", 20);
ItemToInventory((ITEMGUID)_NewItem, _Character, 1, 1, 0);
```


# Miscellaneous functions

Expand Down
20 changes: 10 additions & 10 deletions OsiInterface/Functions/StatFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace osidbg
return attrInfo != nullptr;
}

bool StatGetAttributeInt(OsiArgumentDesc & args)
bool StatGetInt(OsiArgumentDesc & args)
{
auto statName = args[0].String;
auto attributeName = args[1].String;
Expand All @@ -65,7 +65,7 @@ namespace osidbg
return true;
}

bool StatGetAttributeString(OsiArgumentDesc & args)
bool StatGetString(OsiArgumentDesc & args)
{
auto statName = args[0].String;
auto attributeName = args[1].String;
Expand Down Expand Up @@ -139,27 +139,27 @@ namespace osidbg
);
functionMgr.Register(std::move(statAttributeExists));

auto getStatAttributeInt = std::make_unique<CustomQuery>(
"NRD_StatGetAttributeInt",
auto getStatInt = std::make_unique<CustomQuery>(
"NRD_StatGetInt",
std::vector<CustomFunctionParam>{
{ "StatsId", ValueType::String, FunctionArgumentDirection::In },
{ "Attribute", ValueType::String, FunctionArgumentDirection::In },
{ "Value", ValueType::Integer, FunctionArgumentDirection::Out },
},
&func::StatGetAttributeInt
&func::StatGetInt
);
functionMgr.Register(std::move(getStatAttributeInt));
functionMgr.Register(std::move(getStatInt));

auto getStatAttributeString = std::make_unique<CustomQuery>(
"NRD_StatGetAttributeString",
auto getStatString = std::make_unique<CustomQuery>(
"NRD_StatGetString",
std::vector<CustomFunctionParam>{
{ "StatsId", ValueType::String, FunctionArgumentDirection::In },
{ "Attribute", ValueType::String, FunctionArgumentDirection::In },
{ "Value", ValueType::String, FunctionArgumentDirection::Out },
},
&func::StatGetAttributeString
&func::StatGetString
);
functionMgr.Register(std::move(getStatAttributeString));
functionMgr.Register(std::move(getStatString));

auto getStatType = std::make_unique<CustomQuery>(
"NRD_StatGetType",
Expand Down

0 comments on commit 370370f

Please sign in to comment.