30 lines
988 B
Plaintext
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);
|
|
}
|
|
}
|