LoD_PRC8/_module/nss/cnr_trade_lever.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

30 lines
988 B
Plaintext

#include "cnr_recipe_utils"
void main()
{
int nTrade = 0;
string sTradeName = GetName(OBJECT_SELF);
sTradeName = GetStringRight(sTradeName, GetStringLength(sTradeName)-7);
if (sTradeName == "Smelting") { nTrade = CNR_TRADESKILL_SMELTING; }
else if (sTradeName == "Weapon Crafting") { nTrade = CNR_TRADESKILL_WEAPON_CRAFTING; }
else if (sTradeName == "Armor Crafting") { nTrade = CNR_TRADESKILL_ARMOR_CRAFTING; }
if (nTrade > 0)
{
object oUser = GetLastUsedBy();
int nXP = CnrGetTradeskillXPByType(oUser, nTrade);
int nLevel = CnrDetermineTradeskillLevel(nXP);
int nNextLevelXP = 0;
if (nLevel != 20)
{
nLevel = nLevel + 1;
nNextLevelXP = GetLocalInt(GetModule(), "CnrTradeXPLevel" + IntToString(nLevel));
}
else
{
nLevel = 1;
}
CnrSetTradeskillXPByType(oUser, nTrade, nNextLevelXP);
FloatingTextStringOnCreature("Your " + sTradeName + " skill is now level " + IntToString(nLevel), oUser, FALSE);
}
}