Ancordia_PRC8/_module/nss/fishing_reward.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

132 lines
3.8 KiB
Plaintext

#include "quest_inc"
void main()
{
object oPC = GetPCSpeaker();
//Save fishing skill progress
int nSkill = GetCampaignInt(CharacterDB(oPC), "FISHING_SKILL");
if (nSkill <= 700) SetCampaignInt(CharacterDB(oPC), "FISHING_SKILL", nSkill+1);
string sResRef = GetLocalString(oPC, "FishingRod");
DeleteLocalString(oPC, "FishingRod");
string sItem;
int nRandom;
//if using the best rod
if (sResRef == "fishrod_black")
{
if (Random(2) == 0)
{
nRandom = Random(100)+1;
if (nRandom <= 60) sItem = "fish_e_1";
else if (nRandom <= 90) sItem = "fish_e_2";
else sItem = "fish_e_3";
}
else
{
switch (Random(12))
{
case 0: sItem = "fish_a_1";
case 1: sItem = "fish_a_2";
case 2: sItem = "fish_a_3";
case 3: sItem = "fish_b_1";
case 4: sItem = "fish_b_2";
case 5: sItem = "fish_b_3";
case 6: sItem = "fish_c_1";
case 7: sItem = "fish_c_2";
case 8: sItem = "fish_c_3";
case 9: sItem = "fish_d_1";
case 10: sItem = "fish_d_2";
case 11: sItem = "fish_d_3";
}
}
}
//if using the second best rod
if (sResRef == "fishrod_diamond")
{
if (Random(2) == 0)
{
nRandom = Random(100)+1;
if (nRandom <= 60) sItem = "fish_d_1";
else if (nRandom <= 90) sItem = "fish_d_2";
else sItem = "fish_d_3";
}
else
{
switch (Random(9))
{
case 0: sItem = "fish_a_1";
case 1: sItem = "fish_a_2";
case 2: sItem = "fish_a_3";
case 3: sItem = "fish_b_1";
case 4: sItem = "fish_b_2";
case 5: sItem = "fish_b_3";
case 6: sItem = "fish_c_1";
case 7: sItem = "fish_c_2";
case 8: sItem = "fish_c_3";
}
}
}
//if using medium rod
if (sResRef == "fishrod_glass")
if (sResRef == "fishrod_diamond")
{
if (Random(2) == 0)
{
nRandom = Random(100)+1;
if (nRandom <= 60) sItem = "fish_c_1";
else if (nRandom <= 90) sItem = "fish_c_2";
else sItem = "fish_c_3";
}
else
{
switch (Random(6))
{
case 0: sItem = "fish_a_1";
case 1: sItem = "fish_a_2";
case 2: sItem = "fish_a_3";
case 3: sItem = "fish_b_1";
case 4: sItem = "fish_b_2";
case 5: sItem = "fish_b_3";
}
}
}
//if using second worst rod
if (sResRef == "fishrod_steel")
{
if (Random(2) == 0)
{
nRandom = Random(100)+1;
if (nRandom <= 60) sItem = "fish_b_1";
else if (nRandom <= 90) sItem = "fish_b_2";
else sItem = "fish_b_3";
}
else
{
switch (Random(3))
{
case 0: sItem = "fish_a_1";
case 1: sItem = "fish_a_2";
case 2: sItem = "fish_a_3";
}
}
}
//if using the worst rod or with some weird bug
else
{
nRandom = Random(100)+1;
if (nRandom <= 60) sItem = "fish_a_1";
else if (nRandom <= 90) sItem = "fish_a_2";
else sItem = "fish_a_3";
}
//a snakk cgabce of finding a gem
if (Random(100) == 0) sItem = GenerateRandomGem(oPC);
//an even smaller chance of finding an item
if (Random(600) == 0) sItem = GenerateRandomItem(oPC);
//Create the item in the PC's inventory
CreateItemOnObject(sItem, oPC);
}