-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfish_t_equipment.nss
65 lines (51 loc) · 2.21 KB
/
fish_t_equipment.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
/*
Filename: fish_t_equipment.nss
System: SM's Fishing System (tag-based script)
Author: Michael A. Sinclair (Squatting Monk) <squattingmonk@gmail.com>
Date Created: Aug. 9, 2015
Summary:
This script handles tag-based events for fishing equipment. Acquiring fishing
equipment will set up the fishing system automagically. You should not edit this
file. All configurable settings are found in fish_c_config.
If the item is bait or tackle, it will be applied to any fishing equipment the
player has his hand. Otherwise, it will search for the nearest fishing spot. If
one is found within range, this will begin the fishing sequence.
You can create your own types of fishing equipment: simply give your item a
"Cast Spell: OnActivate (Self Only)" item property with unlimited uses and set
its tag to "fish_t_equipment_X", where X is the type of equipment your item is.
This will be the value you should use to refer to your equipment type in the
settings and config functions in fish_c_config.
Revision Info should only be included for post-release revisions.
-----------------
Revision Date:
Revision Author:
Revision Summary:
*/
#include "x2_inc_switches"
#include "fish_c_config"
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
int bActivate = (nEvent == X2_ITEM_EVENT_ACTIVATE);
int bAcquired = (nEvent == X2_ITEM_EVENT_ACQUIRE);
if (!bActivate && !bAcquired)
return;
object oPC = (bActivate ? GetItemActivator() : GetModuleItemAcquiredBy());
object oItem = (bActivate ? GetItemActivated() : GetModuleItemAcquired());
// Make sure the fishing system is set up.
InitializeFishingSystem(oPC, oItem);
// Only run the rest OnActivate
if (!bActivate)
return;
// If this item is tackle, let the system handle it and abort.
if (HandleFishingTackle(GetItemActivatedTarget()))
return;
// If the PC is not using the required tackle, abort.
if (!VerifyFishingTackle())
return;
// If there is no fishing spot nearby, abort.
if (!VerifyFishingSpot())
return;
// We passed all our checks. Now we fish!
AssignCommand(oPC, ActionFish());
}