-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathi_sf_gather_bug.nss
83 lines (71 loc) · 2.29 KB
/
i_sf_gather_bug.nss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "inc_fishing"
void DoGenBug(object oPC, object oItem, int iLootX, int iJarSpace, vector vPos, int iLuck = FALSE);
void main()
{
object oActivator = OBJECT_SELF;
object oItem = GetLocalObject(oActivator, "STORED_ITEM");
int iSpaceInJar = 40 - GetTotalBugsInJar(oItem);
int GatherMultiplier = 1;
vector vPlayerPosition = GetPosition(oActivator);
DeleteLocalObject(oActivator, "STORED_ITEM");
// get bonuses
int iClassBonusCheck = GetLevelByClass(CLASS_TYPE_DRUID, oActivator) + GetLevelByClass(CLASS_TYPE_RANGER, oActivator);
if(iClassBonusCheck > 0)
{
GatherMultiplier = GatherMultiplier + 1;
}
if(GetHasFeat(FEAT_SECRET_KNOWLEDGE_OF_GATHERING, oActivator))
{
GatherMultiplier = GatherMultiplier + 1;
}
// generate base number of bugs to find
int bugFindCount = Random(5) + 1;
// roll for luck
int bugFindLuck = d20();
if(bugFindLuck == 1)
{
bugFindLuck = d20();
if(bugFindLuck == 1)
{
SendMessageToPC(oActivator, Colorize("Your attempts at bug hunting have been noticed by something nearby...", COLOR_RED));
DelayCommand(10.0f,SpawnEnemyForActivity());
}
else
{
SendMessageToPC(oActivator, Colorize("You don't find any bugs...", COLOR_RED));
}
}
else if(bugFindLuck == 20)
{
GatherMultiplier = GatherMultiplier + 1;
DoGenBug(oActivator, oItem, GatherMultiplier, iSpaceInJar, vPlayerPosition, TRUE);
}
else
{
DoGenBug(oActivator, oItem, GatherMultiplier, iSpaceInJar, vPlayerPosition);
}
DeleteLocalString(oActivator, "TIMER_EVENT");
}
void DoGenBug(object oPC, object oItem, int iLootX, int iJarSpace, vector vPos, int iLuck)
{
if(vPos == GetPosition(oPC))
{
if(iLuck == TRUE)
{
string sLucky = Colorize("L", COLOR_RED) + Colorize("u", COLOR_ORANGE) + Colorize("c", COLOR_YELLOW) + Colorize("k", COLOR_LIME_GREEN) + Colorize("y", COLOR_SLATE_BLUE);
SendMessageToPC(oPC, sLucky);
}
GenerateBugs(oItem, iLootX, iJarSpace);
SendMessageToPC(oPC,Colorize("You now have " + IntToString(GetTotalBugsInJar(oItem)) + " bugs in the jar.", COLOR_GREEN));
//chance to find some eggs while foraging
if(d10() > 6)
{
SendMessageToPC(oPC, Colorize("While foraging you found a nest of eggs.", COLOR_GREEN));
CreateItemOnObject(HARVEST_EGG, oPC, d3());
}
}
else
{
SendMessageToPC(oPC, Colorize("Collection interrupted!", COLOR_RED));
}
}