Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ https://github.com/nwnxee/unified/compare/build8193.37.13...HEAD
##### New NWScript Functions
- Player: GetOpenStore()
- Creature: GetNumberOfBonusSpells(), ModifyNumberBonusSpells()
- Store: GetBlackMarket(), SetBlackMarket(), GetGold(), SetGold(), GetIdentifyCost(), SetIdentifyCost(), GetMaxBuyPrice(), SetMaxBuyPrice()

### Changed
- Damage: Added bRangedAttack to the NWNX_Damage_AttackEventData struct.
Expand Down
96 changes: 96 additions & 0 deletions Plugins/Store/NWScript/nwnx_store.nss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,46 @@ void NWNX_Store_SetMarkUp(object oStore, int nValue);
/// @return count, or -1 on error
int NWNX_Store_GetCurrentCustomersCount(object oStore);

/// @brief Return the black market status
/// @param oStore The store object.
/// @return status, -1 on error
int NWNX_Store_GetBlackMarket(object oStore);

/// @brief Set the black market status
/// @param oStore The store object.
/// @param nValue TRUE/FALSE.
void NWNX_Store_SetBlackMarket(object oStore, int nValue);

/// @brief Return the gold amount
/// @param oStore The store object.
/// @return status, -1 on error
int NWNX_Store_GetGold(object oStore);

/// @brief Set the gold amount
/// @param oStore The store object.
/// @param nValue Amount
void NWNX_Store_SetGold(object oStore, int nValue);

/// @brief Return the identify cost
/// @param oStore The store object.
/// @return status, -1 on error
int NWNX_Store_GetIdentifyCost(object oStore);

/// @brief Set the identify cost
/// @param oStore The store object.
/// @param nValue Cost
void NWNX_Store_SetIdentifyCost(object oStore, int nValue);

/// @brief Return the MaxBuyPrice amount
/// @param oStore The store object.
/// @return status, -1 on error
int NWNX_Store_GetMaxBuyPrice(object oStore);

/// @brief Set the MaxBuyPrice amount
/// @param oStore The store object.
/// @param nValue Amount
void NWNX_Store_SetMaxBuyPrice(object oStore, int nValue);

/// @}

int NWNX_Store_GetIsRestrictedBuyItem(object oStore, int nBaseItem)
Expand Down Expand Up @@ -104,3 +144,59 @@ int NWNX_Store_GetCurrentCustomersCount(object oStore)
NWNXCall(NWNX_Store, "GetCurrentCustomersCount");
return NWNXPopInt();
}

int NWNX_Store_GetBlackMarket(object oStore)
{
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "GetBlackMarket");
return NWNXPopInt();
}

void NWNX_Store_SetBlackMarket(object oStore, int nValue)
{
NWNXPushInt(nValue);
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "SetBlackMarket");
}

int NWNX_Store_GetGold(object oStore)
{
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "GetGold");
return NWNXPopInt();
}

void NWNX_Store_SetGold(object oStore, int nValue)
{
NWNXPushInt(nValue);
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "SetGold");
}

int NWNX_Store_GetIdentifyCost(object oStore)
{
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "GetIdentifyCost");
return NWNXPopInt();
}

void NWNX_Store_SetIdentifyCost(object oStore, int nValue)
{
NWNXPushInt(nValue);
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "SetIdentifyCost");
}

int NWNX_Store_GetMaxBuyPrice(object oStore)
{
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "GetMaxBuyPrice");
return NWNXPopInt();
}

void NWNX_Store_SetMaxBuyPrice(object oStore, int nValue)
{
NWNXPushInt(nValue);
NWNXPushObject(oStore);
NWNXCall(NWNX_Store, "SetMaxBuyPrice");
}
78 changes: 76 additions & 2 deletions Plugins/Store/Store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ NWNX_EXPORT ArgumentStack SetBlackMarketMarkDown(ArgumentStack&& args)

NWNX_EXPORT ArgumentStack GetMarkDown(ArgumentStack&& args)
{

if (auto *pStore = Utils::PopStore(args))
{
return pStore->m_nMarkDown;
Expand All @@ -60,7 +59,6 @@ NWNX_EXPORT ArgumentStack SetMarkDown(ArgumentStack&& args)

NWNX_EXPORT ArgumentStack GetMarkUp(ArgumentStack&& args)
{

if (auto *pStore = Utils::PopStore(args))
{
return pStore->m_nMarkUp;
Expand Down Expand Up @@ -88,3 +86,79 @@ NWNX_EXPORT ArgumentStack GetCurrentCustomersCount(ArgumentStack&& args)
}
return -1;
}

NWNX_EXPORT ArgumentStack GetBlackMarket(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
return pStore->m_bBlackMarket;
}
return -1;
}

NWNX_EXPORT ArgumentStack SetBlackMarket(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
const auto nValue = args.extract<int32_t>();
pStore->m_bBlackMarket = nValue;
}
return {};
}

NWNX_EXPORT ArgumentStack GetGold(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
return pStore->m_iGold;
}
return -1;
}

NWNX_EXPORT ArgumentStack SetGold(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
const auto nValue = args.extract<int32_t>();
pStore->m_iGold = nValue;
}
return {};
}

NWNX_EXPORT ArgumentStack GetIdentifyCost(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
return pStore->m_iIdentifyCost;
}
return -1;
}

NWNX_EXPORT ArgumentStack SetIdentifyCost(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
const auto nValue = args.extract<int32_t>();
pStore->m_iIdentifyCost = nValue;
}
return {};
}

NWNX_EXPORT ArgumentStack GetMaxBuyPrice(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
return pStore->m_iMaxBuyPrice;
}
return -1;
}

NWNX_EXPORT ArgumentStack SetMaxBuyPrice(ArgumentStack&& args)
{
if (auto *pStore = Utils::PopStore(args))
{
const auto nValue = args.extract<int32_t>();
pStore->m_iMaxBuyPrice = nValue;
}
return {};
}