· 10 years ago · Aug 29, 2016, 08:12 AM
1// An includable (main-less) version of gui_hss_pc_tool
2
3#include "x0_i0_position"
4#include "nwnx_sql"
5#include "inc_player"
6
7/* Constants */
8
9const int HSS_PC_TOOLS_DIE_STANDARD = 100;
10const int HSS_PC_TOOLS_DIE_SAVE = 200;
11const int HSS_PC_TOOLS_DIE_ABILITY = 300;
12const int HSS_PC_TOOLS_DIE_SKILL = 400;
13const int HSS_PC_TOOLS_EMOTE = 500;
14
15const string SCREEN_HSS_PC_TOOLS = "SCREEN_HSS_PC_TOOLS";
16const string HSS_PC_TOOLS_XML = "hss_pc_tools.xml";
17const string SCREEN_HSS_PC_TOOLS_CB = "SCREEN_HSS_PC_TOOLS_CB";
18const string HSS_PC_TOOLS_CB_XML = "hss_pc_tools_cb.xml";
19const string SCREEN_HSS_PC_TOOLS_CB_V = "SCREEN_HSS_PC_TOOLS_CB_V";
20const string HSS_PC_TOOLS_CB_V_XML = "hss_pc_tools_cb_v.xml";
21const string SCREEN_HSS_PC_TOOLS_TM_V = "SCREEN_HSS_PC_TOOLS_TM_V";
22const string HSS_PC_TOOLS_TM_V_XML = "hss_pc_tools_tm_v.xml";
23const string SCREEN_HSS_PC_TOOLS_MSG_BOX = "SCREEN_HSS_PC_TOOLS_MSG_BOX";
24const string HSS_PC_TOOLS_MSG_BOX_XML = "hss_pc_tools_msgbox.xml";
25
26const int HSS_PC_TOOLS_INT = 1;
27const int HSS_PC_TOOLS_STRING = 2;
28const int HSS_PC_TOOLS_FLOAT = 3;
29const int HSS_PC_TOOLS_LOC = 4;
30const int HSS_PC_TOOLS_VEC = 5;
31const int HSS_PC_TOOLS_OBJ = 6;
32
33/* Configuration */
34
35//Enter the string tag of the required items here if you want to require
36//the PC to be in possession of a particular item before he/she can create
37//the object (tent or campfire).
38//If empty string (""), then that object can always be created.
39const string HSS_PCTOOLS_CAMPFIRE_ITEM = "";
40const string HSS_PCTOOLS_TENT_ITEM = "";
41
42//Enter the limit to the number of PC Tools items that can be created by
43//the same PC at any one instance. i.e. entering 2 would mean the PC could
44//have 2 items created and could not create a third if the other 2 still
45//exist at that time (have not been destroyed).
46//entering -1 means no limit at all.
47const int HSS_PCTOOLS_CAMPFIRE_ITEM_LIMIT = 1;
48const int HSS_PCTOOLS_TENT_ITEM_LIMIT = 1;
49
50//Set this to 1 if you want to exclude areas marked as above ground,
51//interior and unnatural from object creation permission. Otherwise 0.
52//i.e. a PC will not be able to create a campfire or tent if the area he/she
53//is in is flagged as above ground, interior and unnatural.
54//NOTE! These are the default settings when an area is created using a
55//tileset. Areas such as caves and mines need to have these peoperties
56//set manually to the correct values or they will be excluded from object
57//creation (probably not what you want). Only set this to 1 if you have
58//been setting your area properties maually to the correct values or
59//intend to do so.
60const int HSS_PCTOOLS_OBJECT_CREATE_RESTRICT = 0;
61
62//set a value between 1 and 6 to specify the particular AFK visual effect
63//that will be applied to the PC when using the "Toggle AFK" button.
64//1 = "AFK", 2 = arrow pointing up, 3 = "silhouette" model with sparklies,
65//4 = just sparklies, 5 = alpha model with sparklies, 6 = "silhouette" model
66//without sparklies.
67const int HSS_PCTOOLS_AFK_VFX = 1;
68
69//Enter the string tag of the required items here if you want to require
70//the PC to be in possession of a particular item before he/she can use a
71//VFX prop.
72//If empty string (""), then that VFX prop can always be used.
73const string HSS_PCTOOLS_VFX_DRINKBEER_ITEM = "";
74const string HSS_PCTOOLS_VFX_DRUMA_ITEM = "";
75const string HSS_PCTOOLS_VFX_DRUMB_ITEM = "";
76const string HSS_PCTOOLS_VFX_FLUTEA_ITEM = "";
77const string HSS_PCTOOLS_VFX_FLUTEB_ITEM = "";
78const string HSS_PCTOOLS_VFX_MANDOLINA_ITEM = "";
79const string HSS_PCTOOLS_VFX_MANDOLINB_ITEM = "";
80const string HSS_PCTOOLS_VFX_MANDOLINC_ITEM = "";
81const string HSS_PCTOOLS_VFX_PAN_ITEM = "";
82const string HSS_PCTOOLS_VFX_RAKE_ITEM = "";
83const string HSS_PCTOOLS_VFX_SHOVEL_ITEM = "";
84const string HSS_PCTOOLS_VFX_SMITHYHAMMER_ITEM = "";
85const string HSS_PCTOOLS_VFX_SPOON_ITEM = "";
86const string HSS_PCTOOLS_VFX_WINE_ITEM = "";
87
88//Enter the text that will be displayed for the corresponding custom buttons.
89const string HSS_PCTOOLS_CUSTOM1_TEXT = "Custom 1";
90const string HSS_PCTOOLS_CUSTOM2_TEXT = "Custom 2";
91const string HSS_PCTOOLS_CUSTOM3_TEXT = "Custom 3";
92const string HSS_PCTOOLS_CUSTOM4_TEXT = "Custom 4";
93const string HSS_PCTOOLS_CUSTOM5_TEXT = "Custom 5";
94const string HSS_PCTOOLS_CUSTOM6_TEXT = "Custom 6";
95const string HSS_PCTOOLS_CUSTOM7_TEXT = "Custom 7";
96const string HSS_PCTOOLS_CUSTOM8_TEXT = "Custom 8";
97const string HSS_PCTOOLS_CUSTOM9_TEXT = "Custom 9";
98const string HSS_PCTOOLS_CUSTOM10_TEXT = "Custom 10";
99const string HSS_PCTOOLS_CUSTOM11_TEXT = "Custom 11";
100const string HSS_PCTOOLS_CUSTOM12_TEXT = "Custom 12";
101const string HSS_PCTOOLS_CUSTOM13_TEXT = "Custom 13";
102const string HSS_PCTOOLS_CUSTOM14_TEXT = "Custom 14";
103const string HSS_PCTOOLS_CUSTOM15_TEXT = "Custom 15";
104const string HSS_PCTOOLS_CUSTOM16_TEXT = "Custom 16";
105const string HSS_PCTOOLS_CUSTOM17_TEXT = "Custom 17";
106const string HSS_PCTOOLS_CUSTOM18_TEXT = "Custom 18";
107const string HSS_PCTOOLS_CUSTOM19_TEXT = "Target 1";
108const string HSS_PCTOOLS_CUSTOM20_TEXT = "Target 2";
109const string HSS_PCTOOLS_CUSTOM21_TEXT = "Target 3";
110const string HSS_PCTOOLS_CUSTOM22_TEXT = "Target 4";
111const string HSS_PCTOOLS_CUSTOM23_TEXT = "Target 5";
112const string HSS_PCTOOLS_CUSTOM24_TEXT = "Target 6";
113const string HSS_PCTOOLS_CUSTOM25_TEXT = "Target 7";
114const string HSS_PCTOOLS_CUSTOM26_TEXT = "Target 8";
115const string HSS_PCTOOLS_CUSTOM27_TEXT = "Target 9";
116const string HSS_PCTOOLS_CUSTOM28_TEXT = "Target 10";
117const string HSS_PCTOOLS_CUSTOM29_TEXT = "Target 11";
118const string HSS_PCTOOLS_CUSTOM30_TEXT = "Target 12";
119const string HSS_PCTOOLS_CUSTOM31_TEXT = "Target 13";
120const string HSS_PCTOOLS_CUSTOM32_TEXT = "Target 14";
121const string HSS_PCTOOLS_CUSTOM33_TEXT = "Target 15";
122const string HSS_PCTOOLS_CUSTOM34_TEXT = "Target 16";
123const string HSS_PCTOOLS_CUSTOM35_TEXT = "Target 17";
124const string HSS_PCTOOLS_CUSTOM36_TEXT = "Target 18";
125
126
127//Enable/disable DMFI plugin capability for PC's. 1 = on, 0 = off.
128//DMFI must already be installed for this to function. This just enables
129//the launching of DMFI from the PC Tools plugin tab -- anything that
130//happens after the plugin button is pressed is DMFI functionality and not
131//PC Tools functionality. All configuration for DMFI is handled through
132//your DMFI install and not through PC Tools.
133const int HSS_PCTOOLS_DMFI_PLUGIN_PC = 0;
134
135//Colour strings for feedback messages.
136const string HSS_PCTOOLS_COLOUR1 = "<color=#C1AB89>";
137const string HSS_PCTOOLS_COLOUR2 = "<color=#EFD4AC>";
138const string HSS_PCTOOLS_COLOUR_END = "</c>";
139
140//Default automatic decay time (in seconds) for objects (tent or campfire)
141//created via PC Tools.
142const float HSS_OBJECT_DECAY = 1800.0;
143
144//Save character feedback text.
145const string HSS_SAVE_MESSAGE = "Character saved.";
146
147//Save character feedback text when location save is enabled.
148const string HSS_SAVE_MESSAGE_W_LOC = "Character and location saved.";
149
150//Safe Location feedback text.
151const string HSS_SAFE_LOC_MESSAGE = "Attempting to find safe location.";
152
153//Item/Prop failure text.
154const string HSS_NO_ITEM_MESSAGE = "You need to possess a specific item to do this.";
155
156//Item creation limit exceeded message.
157const string HSS_ITEM_LIMIT_MESSAGE = "You have too many instances of this item currently placed. Destroy one in order to create another.";
158
159//Object creation area restricted message.
160const string HSS_CREATION_RESTRICT_MESSAGE = "You cannot create that object in here.";
161
162//Message sent to the PC when attempting to use the "Safe Location" button
163//and that ability has been disabled either by area or per PC.
164//You can exclude individual PC's by setting a local int value of 1 on them
165//using the following variable name: "HSS_PCTOOLS_NO_MAKESAFE" .
166//You can exclude an area by setting the same local on the area itself.
167const string HSS_NO_MAKESAFE_MESSAGE = "This option is not available for you at this time.";
168
169//0 = NWN database, 1 = NWNX database, 2 = inventory item persistency.
170//NOTE! no vector support if using DB type 2.
171const int HSS_PCTOOLS_DBTYPE = 1;
172
173//table name used by HSS_PCTools_StorePersistentData() when DB type is
174//for a NWNX DB.
175const string HSS_NWNX_TABLE = "pwdata";
176
177//table name used by HSS_PCTools_StorePersistentData() when DB type is
178//for a NWNX DB and an object is being stored.
179const string HSS_NWNX_OBJ_TABLE = "pwobjdata";
180
181//set to 1 to strip colour tags from macros, 0 to allow them.
182const int HSS_PCTOOLS_STRIP_MACROS = 1;
183
184//set the variable name here that will be used when a PC's location is
185//saved to the DB via a "Save Character" button use.
186//Note that to have the PC actually be transported to the saved location
187//upon logging in you must have code in the OnEnter or OnPCLoaded module
188//event to do so -- PC Tools saves the data, but the data must be used
189//by the builder so that it actually does something.
190const string HSS_PCTOOLS_LOC_VAR = "PLAYER_VARLOCATION2";
191
192//set this int to 1 to have the character's location saved when the
193//"Save Character" button is used. Set to 0 to only have the character
194//file saved with no saved.
195const int HSS_PCTOOLS_SAVE_LOC = 1;
196
197
198
199/* End Configuration */
200
201
202/* Function Prototypes */
203
204//removes all local variables on oPC associated with PC Tools functionality
205//nbroadcast = TRUE will clear the broadcast mode int, FALSE will not
206void HSS_PCTools_CleanPCLocals(object oPC, int nBroadcast = TRUE);
207
208//called from the oncreate event -- setup custom buttons, etc.
209//nGUI can be 1 for PC Tools Main, 2 for Custom Buttons Horizontal Floater
210//or 3 for Custom Buttons Vertical Floater, 4 for Text Macro Pad
211void HSS_PCTools_OnGUICreate(object oPC, int nGUI = 1);
212
213//called from the OnAdd event.
214void HSS_PCTools_OnGUIAdd(object oPC, int nGUI = 1);
215
216//save the character oPC
217void HSS_PCTools_SaveCharacter(object oPC, string sPCID);
218
219//displays the date/time for the PC
220void HSS_PCTools_GetTime(object oPC);
221
222//try and move oPC out of a stuck location
223void HSS_PCTools_MakeSafeLocation(object oPC);
224
225//create an item. sItem is parsed by the function ("Tent" and "Campfire" supported)
226void HSS_PCTools_Create(object oPC, string sItem = "Tent");
227
228//toggle AFK vfx on oPC
229void HSS_PCTools_ToggleAFK(object oPC);
230
231//do the die roll and display the result
232void HSS_PCToools_RollDie(object oPC);
233
234//set the GUI locals to disable the other die roll types when one has been chosen.
235void HSS_PCTools_SetGUIDieRollType(object oPC, int nType = HSS_PC_TOOLS_DIE_STANDARD);
236
237//removes all local variables on oPC associated with PC Tools functionality
238void HSS_PCTools_DeleteGUIDieRollType(object oPC);
239
240//Do an emote
241void HSS_PCTools_DoEmote(object oPC);
242
243//applies/removes the vfx props
244void HSS_PCTools_ApplyVFX(object oPC, string sVFX);
245
246//removes (destroys) a placeable created by PC Tools (tent or campfire)
247void HSS_PCTools_Remove(object oPC, int nObject);
248
249//Function handles the execution of code for the 9 custom buttons.
250//See the function implementation to add your own code for the behaviour
251//of these buttons. Set their display name via the constants above.
252void HSS_PCTools_CustomButton(object oPC, int nButton, float fX = 0.0, float fY = 0.0, float fZ = 0.0, int nString1 = -1, int nObject = -1);
253
254//wrapper function for PlayCustomAnimation() so it is a void function
255//can be called via DelayCommand or queued.
256void HSS_PCTools_PlayCustomAnim(object oObject, string sAnimationName, int nLooping, float fSpeed = 1.0);
257
258//destroys all objects in oObject's inventory (not slots)
259void HSS_DestroyAllInventory(object oObject);
260
261//Converts an integer to a string. If the integer is 1-9 it will convert it to
262//a string with a leading zero. i.e. 7 will be returned "07". Otherwise, it
263//just performs a regular Int to String conversion.
264string HSS_IntToLeadingZeroString(int nNumber);
265
266//Returns item possessed by oCreature. If found, it will cache that object
267//as a local on oCreature and any subsequent call by this function will
268//use the local to reference the object instead of doing an inventory
269//iteration search via GetItemPossessedBy().
270object HSS_GetItemPossessedBy_Cached(object oCreature, string sItemTag);
271
272//called from a delaycommand when an object is created. Will only destroy
273//and decrement the count of object instances if the object actually exists.
274void HSS_PCTools_DestroyAndDecrement(object oPC, object oObject, string sObject);
275
276//Stores data to a DB depending upon the value of nStorageType. 0 = NWN DB,
277//1 = NWNX DB, 2 = inventory item persistency. See constant HSS_PCTOOLS_DBTYPE
278//above to switch DB type globally for all of this function's calls.
279//oObject is the object the data is set on, sVarName is the variable name for the data,
280//sDB is the database name (only used for native DB, NWNX uses hardcoded
281//values that are switchable via the constants above).
282//nDataType is the kind of data:
283//Data Constants
284//HSS_PC_TOOLS_INT = 1;
285//HSS_PC_TOOLS_STRING = 2;
286//HSS_PC_TOOLS_FLOAT = 3;
287//HSS_PC_TOOLS_LOC = 4;
288//HSS_PC_TOOLS_VEC = 5;
289//HSS_PC_TOOLS_OBJ = 6;
290//sValue is the actual data to be stored -- ALWAYS passed in as a string.
291//the function will store the data to the type specified by nDataType
292//nExpiration is used for NWNX calls only and sets an expiration value.
293void HSS_PCTools_StorePersistentData(object oObject, string sVarName, string sDB, int nDataType, string sValue, int nExpiration = 0, int nStorageType = HSS_PCTOOLS_DBTYPE);
294
295//retireves the persistent variable -- all return values are STRINGS
296//use string conversion functions to turn them into their proper data type.
297//see the store function of this type of function for more details.
298string HSS_PCTools_RetrievePersistentData(object oObject, string sVarName, string sDB, int nDataType, int nStorageType = HSS_PCTOOLS_DBTYPE);
299
300//converts a string to a vector. string format = "(float, float, float)"
301//format is the same as the output from VectorToString().
302vector HSS_StringToVector(string sVec);
303
304//converts a string to a location.
305//string format = "(AreaTagString) (float, float, float) (float)"
306//format is the same as output from LocationToString().
307location HSS_StringToLocation(string sLoc);
308
309//returns true if sString has a section of text = "<color="
310int HSS_PCTools_IsStringColoured(string sString);
311
312//call on a delaycommand passing in the timer duration as the delay.
313//when run, the function will set off an alarm notifying of timer
314//expiration and the timer's label.
315void HSS_PCTools_StartTimer(object oPC, int nTime, string sLabel, string sAlarm);
316
317//displays a PC Tools message box.
318void HSS_PCTools_DisplayMessageBox(object oPC, string sMsg, int nOkCB, int nCancelCB, int bShowCancel = TRUE, string sOk = "Yes", string sCancel = "No");
319
320void SaveCharacter(object oPC);
321
322void HSS_PCTools_CleanPCLocals(object oPC, int nBroadcast = TRUE)
323{
324 DeleteLocalInt(oPC, "HSS_PCTOOLS_ROLL_TYPE");
325 DeleteLocalInt(oPC, "HSS_PCTOOLS_DIE_NUM");
326 DeleteLocalInt(oPC, "HSS_PCTOOLS_DIE_TYPE");
327 DeleteLocalInt(oPC, "HSS_PCTOOLS_SAVE_TYPE");
328 DeleteLocalInt(oPC, "HSS_PCTOOLS_ABILITY_TYPE");
329 DeleteLocalInt(oPC, "HSS_PCTOOLS_SKILL_TYPE");
330 DeleteLocalString(oPC, "HSS_PC_TOOLS_ANIM_TYPE");
331 DeleteLocalString(oPC, "HSS_PC_TOOLS_ANIM_TYPE_2");
332 DeleteLocalFloat(oPC, "HSS_PC_TOOLS_ANIM_DELAY");
333
334 if (nBroadcast)
335 {
336 DeleteLocalInt(oPC, "HSS_PCTOOLS_BROADCAST_TYPE");
337 DeleteLocalInt(oPC, "HSS_PC_TOOLS_ANIM_LOOP");
338 }
339}
340
341void HSS_PCTools_OnGUICreate(object oPC, int nGUI = 1)
342{
343 string sHelp;
344 int nCount = 1;
345 string sPCID = GetPCPlayerName(oPC) + "_" + GetName(oPC);
346
347 switch (nGUI)
348 {
349 case 1:
350 //big ass string -- help text -- easier to edit if present in script
351 //rather than the xml.
352 sHelp = HSS_PCTOOLS_COLOUR2+"<b><i>Interface:</i></b>" + HSS_PCTOOLS_COLOUR_END +
353 "\n\n" +
354 "You can drag PC Tools by <b>Lclick+hold</b> on "+
355 "the PC Tools icon. <b>Rclick</b> on the icon will minimize the entire menu down to "+
356 "only the icon. <b>Lclick</b> on the icon will restore the menu." +
357 "\n\n"+
358 "The six <b>quick buttons</b> are activated by simply "+
359 "clicking on them. '<b>Save Character</b>' will export your character. '<b>Check Time</b>' "+
360 "will message you the date/time. '<b>Safe Location</b>' will attempt to "+
361 "unstick you if you are trapped in a non-pathable spot. '<b>Build Campfire</b>' "+
362 "will create a campfire object that will destroy its inventory when it "+
363 "is destroyed (server rules on object creation may apply). '<b>Pitch Tent</b>' "+
364 "will create a tent object (server rules on object creation may apply). "+
365 "Created objects can be destroyed by navigating to the '<b>Miscellaneous</b>' "+
366 "tab, using the '<b>Remove</b>' button and then targeting the object. "+
367 "If not removed, then created objects will decay on their own after a period of time. "+
368 "'<b>Toggle AFK</b>' will apply a visual effect to your character "+
369 "to indicate that you are not present. Using the button when the effect is "+
370 "already present will remove the effect."+
371 "\n\n"+
372 HSS_PCTOOLS_COLOUR2+"<b><i>Collapsable Subsections:</i></b>"+ HSS_PCTOOLS_COLOUR_END +
373 "\n\n"+
374 "The '<b>Die Rolls</b>' section "+
375 "is used by selecting the type of roll you want to make and then pressing "+
376 "the '<b>Roll!</b>' button. Only one type of roll can be made at one time: "+
377 "Standard, Saves, Ability and Skill. Standard rolls require a die type "+
378 "and number of dice to roll to be chosen. If no number is selected, then "+
379 "a single dice of the type chosen will be rolled. The other roll types "+
380 "just require a choice to be selected and then use of the '<b>Roll!</b>' button. "+
381 "You can clear any selection made by clicking on the header button text that "+
382 "titles each section. Furthermore, you can choose to '<b>Roll Publically</b>' "+
383 "or '<b>Roll Privately</b>': public rolls are presented as spoken text by "+
384 "your character and private rolls are messaged to you."+
385 "\n\n"+
386 "The '<b>Emotes</b>' section is the most intensive of the subsections. "+
387 "Within this section you can invoke animations for your PC as well as "+
388 "apply visual effects props. The '<b>Postures</b>' pane allows you to "+
389 "choose postures or stances for your character which will always be looping. "+
390 "To cancel a posture cleanly use the corresponding <color=red><i>italic red</i></c> "+
391 "emote option from the pane and hit '<b>Emote</b>'. "+
392 " In all other cases where no <color=red><i>italic red</i></c> "+
393 "option is available the emote is cancelled via the '<b>Cease</b>' button. "+
394 "'<b>Posture Modifications</b>' can be invoked if you have a posture already "+
395 "in use. These are usually called as '<b>One-Shot</b>' animations, but "+
396 "they can be called as '<b>Looping</b>' animations. For instance, you can "+
397 "be in the kneel down posture and then subsequently call the kneel fidget "+
398 "modification. If called as a looping modification you would keep on "+
399 "fidgeting until you call an <color=#2CAE2C><i>italic green</i></c> idle "+
400 "modification to return to the base idle posture. Or, you could simply call "+
401 "the <color=red><i>Kneel Up</i></c> animation to cancel the posture entirely "+
402 "and return to a normal standing posture. Apart from the '<b>VFX Props</b>' "+
403 "section all of the other sections are used by simply selecting your emote, "+
404 "choosing '<b>One-Shot</b>' or '<b>Looping</b>' and then hitting the '<b>Emote!</b>' "+
405 "button. If you are running a looping animation use the '<b>Cease!</b>' "+
406 "button to cancel the animation when you are ready. The '<b>VFX Props</b>' "+
407 "section allows you to equip visual effects props onto your character "+
408 "(server rules on vfx prop application may apply). To use a prop you need "+
409 "only to select it from the list. If you already have a prop applied it will "+
410 "be removed before your new choice is applied. To remove a prop without "+
411 "applying another one click on the header button text that titles the section. "+
412 "Clicking on any other header button text will clear the selection of any "+
413 "emote type buttons for the emote panes."+
414 "\n\n"+
415 "The '<b>Miscellaneous</b>' section holds the rest of PC Tools functionality "+
416 "access. Previously mentioned, the '<b>Object Interaction</b>' tab allows "+
417 "you to remove any object that has been created using PC Tools via the '<b>Remove</b>' button. " +
418 "Also within this section is the '<b>Auto Follow</b>' button which allows your character "+
419 "to follow another PC automatically. Click the button and then the intended PC. "+
420 "The intended PC will then be asked if they will allow your PC to auto follow. "+
421 "If the answer is no, you will be informed and if the answer is yes you will begin auto following. "+
422 "The '<b>Timers</b>' button will open up the timers pane over top of the '<b>Custom Buttons</b>' "+
423 "section. Here you can set alarm clock style timers which will give off a notification "+
424 "upon expiration. You set the duration in (real) minutes, a label for the timer and "+
425 "the type of alarm. Alarms can be a message, a message with a string posted to your screen "+
426 "or a message with a red screen flash. Timers are limited to a maximum duration of 120 minutes "+
427 "and you can only have 3 timers active at any one time. When you have the timer setup press the "+
428 "'<b>Start</b>' button and it will begin. "+
429 "The '<b>Custom Buttons</b>' "+
430 "section allows builders to add in their own customized code to extend PC Tools "+
431 "capabilities to meet the builder's needs. Refer to module or world documentation "+
432 "for description of any custom button functionality that may be available. "+
433 "The '<b>Plugins</b>' section is to allow easier integration of other 3rd party "+
434 "GUI packages and, if enabled, the buttons present will launch their named "+
435 "GUI package. Any functionality offered by another 3rd party package is "+
436 "active after the plugin button is pressed and is not PC Tools functionality "+
437 "-- see the proper package documentation for questions, etc. The '<b>Options</b>' "+
438 "tab launches the options window which allows end-user configuration. "+
439 "The '<b>Help</b>' tab launches this screen and the '<b>About</b>' box contains "+
440 "version information, minimum required game version, current game version "+
441 "and contact information.";
442
443
444 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM1_BUTTON", -1,
445 HSS_PCTOOLS_CUSTOM1_TEXT);
446 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM2_BUTTON", -1,
447 HSS_PCTOOLS_CUSTOM2_TEXT);
448 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM3_BUTTON", -1,
449 HSS_PCTOOLS_CUSTOM3_TEXT);
450 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM4_BUTTON", -1,
451 HSS_PCTOOLS_CUSTOM4_TEXT);
452 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM5_BUTTON", -1,
453 HSS_PCTOOLS_CUSTOM5_TEXT);
454 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM6_BUTTON", -1,
455 HSS_PCTOOLS_CUSTOM6_TEXT);
456 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM7_BUTTON", -1,
457 HSS_PCTOOLS_CUSTOM7_TEXT);
458 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM8_BUTTON", -1,
459 HSS_PCTOOLS_CUSTOM8_TEXT);
460 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM9_BUTTON", -1,
461 HSS_PCTOOLS_CUSTOM9_TEXT);
462 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM10_BUTTON", -1,
463 HSS_PCTOOLS_CUSTOM10_TEXT);
464 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM11_BUTTON", -1,
465 HSS_PCTOOLS_CUSTOM11_TEXT);
466 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM12_BUTTON", -1,
467 HSS_PCTOOLS_CUSTOM12_TEXT);
468 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM13_BUTTON", -1,
469 HSS_PCTOOLS_CUSTOM13_TEXT);
470 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM14_BUTTON", -1,
471 HSS_PCTOOLS_CUSTOM14_TEXT);
472 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM15_BUTTON", -1,
473 HSS_PCTOOLS_CUSTOM15_TEXT);
474 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM16_BUTTON", -1,
475 HSS_PCTOOLS_CUSTOM16_TEXT);
476 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM17_BUTTON", -1,
477 HSS_PCTOOLS_CUSTOM17_TEXT);
478 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM18_BUTTON", -1,
479 HSS_PCTOOLS_CUSTOM18_TEXT);
480 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM19_BUTTON", -1,
481 HSS_PCTOOLS_CUSTOM19_TEXT);
482 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM20_BUTTON", -1,
483 HSS_PCTOOLS_CUSTOM20_TEXT);
484 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM21_BUTTON", -1,
485 HSS_PCTOOLS_CUSTOM21_TEXT);
486 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM22_BUTTON", -1,
487 HSS_PCTOOLS_CUSTOM22_TEXT);
488 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM23_BUTTON", -1,
489 HSS_PCTOOLS_CUSTOM23_TEXT);
490 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM24_BUTTON", -1,
491 HSS_PCTOOLS_CUSTOM24_TEXT);
492 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM25_BUTTON", -1,
493 HSS_PCTOOLS_CUSTOM25_TEXT);
494 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM26_BUTTON", -1,
495 HSS_PCTOOLS_CUSTOM26_TEXT);
496 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM27_BUTTON", -1,
497 HSS_PCTOOLS_CUSTOM27_TEXT);
498 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM28_BUTTON", -1,
499 HSS_PCTOOLS_CUSTOM28_TEXT);
500 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM29_BUTTON", -1,
501 HSS_PCTOOLS_CUSTOM29_TEXT);
502 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM30_BUTTON", -1,
503 HSS_PCTOOLS_CUSTOM30_TEXT);
504 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM31_BUTTON", -1,
505 HSS_PCTOOLS_CUSTOM31_TEXT);
506 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM32_BUTTON", -1,
507 HSS_PCTOOLS_CUSTOM32_TEXT);
508 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM33_BUTTON", -1,
509 HSS_PCTOOLS_CUSTOM33_TEXT);
510 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM34_BUTTON", -1,
511 HSS_PCTOOLS_CUSTOM34_TEXT);
512 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM35_BUTTON", -1,
513 HSS_PCTOOLS_CUSTOM35_TEXT);
514 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CUSTOM36_BUTTON", -1,
515 HSS_PCTOOLS_CUSTOM36_TEXT);
516
517
518 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_HELP_TEXT", -1,
519 sHelp);
520
521 if (HSS_PCTOOLS_DMFI_PLUGIN_PC == 1)
522 {
523 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 600, "true");
524 }
525 else
526 {
527 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 600, "false");
528 }
529
530 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 10,
531 "homepage.ntlworld.com/kbyiers/NWN/");
532
533
534 sHelp = HSS_PCTools_RetrievePersistentData(oPC, "40", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
535
536 if (sHelp != "")
537 {
538 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 40, sHelp);
539 }
540 else
541 {
542 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 40, "no");
543 }
544
545 sHelp = HSS_PCTools_RetrievePersistentData(oPC, "41", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
546
547 if (sHelp != "")
548 {
549 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 41, sHelp);
550 }
551 else
552 {
553 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 41, "notm");
554 }
555
556 sHelp = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
557
558 if (sHelp != "")
559 {
560 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 42, sHelp);
561 }
562 else
563 {
564 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, 42, "nomin");
565 }
566
567 break;
568
569 //Custom Button Floater -- Horizontal
570 case 2:
571 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM1_BUTTON", -1,
572 HSS_PCTOOLS_CUSTOM1_TEXT);
573 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM2_BUTTON", -1,
574 HSS_PCTOOLS_CUSTOM2_TEXT);
575 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM3_BUTTON", -1,
576 HSS_PCTOOLS_CUSTOM3_TEXT);
577 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM4_BUTTON", -1,
578 HSS_PCTOOLS_CUSTOM4_TEXT);
579 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM5_BUTTON", -1,
580 HSS_PCTOOLS_CUSTOM5_TEXT);
581 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM6_BUTTON", -1,
582 HSS_PCTOOLS_CUSTOM6_TEXT);
583 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM7_BUTTON", -1,
584 HSS_PCTOOLS_CUSTOM7_TEXT);
585 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM8_BUTTON", -1,
586 HSS_PCTOOLS_CUSTOM8_TEXT);
587 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM9_BUTTON", -1,
588 HSS_PCTOOLS_CUSTOM9_TEXT);
589 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM10_BUTTON", -1,
590 HSS_PCTOOLS_CUSTOM10_TEXT);
591 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM11_BUTTON", -1,
592 HSS_PCTOOLS_CUSTOM11_TEXT);
593 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM12_BUTTON", -1,
594 HSS_PCTOOLS_CUSTOM12_TEXT);
595 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM13_BUTTON", -1,
596 HSS_PCTOOLS_CUSTOM13_TEXT);
597 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM14_BUTTON", -1,
598 HSS_PCTOOLS_CUSTOM14_TEXT);
599 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM15_BUTTON", -1,
600 HSS_PCTOOLS_CUSTOM15_TEXT);
601 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM16_BUTTON", -1,
602 HSS_PCTOOLS_CUSTOM16_TEXT);
603 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM17_BUTTON", -1,
604 HSS_PCTOOLS_CUSTOM17_TEXT);
605 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM18_BUTTON", -1,
606 HSS_PCTOOLS_CUSTOM18_TEXT);
607 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM19_BUTTON", -1,
608 HSS_PCTOOLS_CUSTOM19_TEXT);
609 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM20_BUTTON", -1,
610 HSS_PCTOOLS_CUSTOM20_TEXT);
611 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM21_BUTTON", -1,
612 HSS_PCTOOLS_CUSTOM21_TEXT);
613 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM22_BUTTON", -1,
614 HSS_PCTOOLS_CUSTOM22_TEXT);
615 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM23_BUTTON", -1,
616 HSS_PCTOOLS_CUSTOM23_TEXT);
617 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM24_BUTTON", -1,
618 HSS_PCTOOLS_CUSTOM24_TEXT);
619 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM25_BUTTON", -1,
620 HSS_PCTOOLS_CUSTOM25_TEXT);
621 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM26_BUTTON", -1,
622 HSS_PCTOOLS_CUSTOM26_TEXT);
623 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM27_BUTTON", -1,
624 HSS_PCTOOLS_CUSTOM27_TEXT);
625 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM28_BUTTON", -1,
626 HSS_PCTOOLS_CUSTOM28_TEXT);
627 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM29_BUTTON", -1,
628 HSS_PCTOOLS_CUSTOM29_TEXT);
629 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM30_BUTTON", -1,
630 HSS_PCTOOLS_CUSTOM30_TEXT);
631 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM31_BUTTON", -1,
632 HSS_PCTOOLS_CUSTOM31_TEXT);
633 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM32_BUTTON", -1,
634 HSS_PCTOOLS_CUSTOM32_TEXT);
635 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM33_BUTTON", -1,
636 HSS_PCTOOLS_CUSTOM33_TEXT);
637 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM34_BUTTON", -1,
638 HSS_PCTOOLS_CUSTOM34_TEXT);
639 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM35_BUTTON", -1,
640 HSS_PCTOOLS_CUSTOM35_TEXT);
641 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CUSTOM36_BUTTON", -1,
642 HSS_PCTOOLS_CUSTOM36_TEXT);
643 break;
644
645 //Custom Button Floater -- Vertical
646 case 3:
647 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM1_BUTTON", -1,
648 HSS_PCTOOLS_CUSTOM1_TEXT);
649 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM2_BUTTON", -1,
650 HSS_PCTOOLS_CUSTOM2_TEXT);
651 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM3_BUTTON", -1,
652 HSS_PCTOOLS_CUSTOM3_TEXT);
653 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM4_BUTTON", -1,
654 HSS_PCTOOLS_CUSTOM4_TEXT);
655 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM5_BUTTON", -1,
656 HSS_PCTOOLS_CUSTOM5_TEXT);
657 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM6_BUTTON", -1,
658 HSS_PCTOOLS_CUSTOM6_TEXT);
659 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM7_BUTTON", -1,
660 HSS_PCTOOLS_CUSTOM7_TEXT);
661 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM8_BUTTON", -1,
662 HSS_PCTOOLS_CUSTOM8_TEXT);
663 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM9_BUTTON", -1,
664 HSS_PCTOOLS_CUSTOM9_TEXT);
665 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM10_BUTTON", -1,
666 HSS_PCTOOLS_CUSTOM10_TEXT);
667 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM11_BUTTON", -1,
668 HSS_PCTOOLS_CUSTOM11_TEXT);
669 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM12_BUTTON", -1,
670 HSS_PCTOOLS_CUSTOM12_TEXT);
671 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM13_BUTTON", -1,
672 HSS_PCTOOLS_CUSTOM13_TEXT);
673 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM14_BUTTON", -1,
674 HSS_PCTOOLS_CUSTOM14_TEXT);
675 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM15_BUTTON", -1,
676 HSS_PCTOOLS_CUSTOM15_TEXT);
677 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM16_BUTTON", -1,
678 HSS_PCTOOLS_CUSTOM16_TEXT);
679 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM17_BUTTON", -1,
680 HSS_PCTOOLS_CUSTOM17_TEXT);
681 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM18_BUTTON", -1,
682 HSS_PCTOOLS_CUSTOM18_TEXT);
683 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM19_BUTTON", -1,
684 HSS_PCTOOLS_CUSTOM19_TEXT);
685 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM20_BUTTON", -1,
686 HSS_PCTOOLS_CUSTOM20_TEXT);
687 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM21_BUTTON", -1,
688 HSS_PCTOOLS_CUSTOM21_TEXT);
689 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM22_BUTTON", -1,
690 HSS_PCTOOLS_CUSTOM22_TEXT);
691 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM23_BUTTON", -1,
692 HSS_PCTOOLS_CUSTOM23_TEXT);
693 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM24_BUTTON", -1,
694 HSS_PCTOOLS_CUSTOM24_TEXT);
695 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM25_BUTTON", -1,
696 HSS_PCTOOLS_CUSTOM25_TEXT);
697 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM26_BUTTON", -1,
698 HSS_PCTOOLS_CUSTOM26_TEXT);
699 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM27_BUTTON", -1,
700 HSS_PCTOOLS_CUSTOM27_TEXT);
701 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM28_BUTTON", -1,
702 HSS_PCTOOLS_CUSTOM28_TEXT);
703 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM29_BUTTON", -1,
704 HSS_PCTOOLS_CUSTOM29_TEXT);
705 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM30_BUTTON", -1,
706 HSS_PCTOOLS_CUSTOM30_TEXT);
707 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM31_BUTTON", -1,
708 HSS_PCTOOLS_CUSTOM31_TEXT);
709 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM32_BUTTON", -1,
710 HSS_PCTOOLS_CUSTOM32_TEXT);
711 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM33_BUTTON", -1,
712 HSS_PCTOOLS_CUSTOM33_TEXT);
713 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM34_BUTTON", -1,
714 HSS_PCTOOLS_CUSTOM34_TEXT);
715 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM35_BUTTON", -1,
716 HSS_PCTOOLS_CUSTOM35_TEXT);
717 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CUSTOM36_BUTTON", -1,
718 HSS_PCTOOLS_CUSTOM36_TEXT);
719 break;
720
721 //text macro vertical
722 case 4:
723
724 //load saved macro data
725 while (nCount <= 45)
726 {
727 sHelp = HSS_PCTools_RetrievePersistentData(oPC, "PC_TOOLS_MACRO_BUTTON_" +
728 HSS_IntToLeadingZeroString(nCount) + "_LABEL", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
729
730 if (sHelp != "")
731 {
732 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_TM_V, "PC_TOOLS_MACRO_BUTTON_" + HSS_IntToLeadingZeroString(nCount),
733 -1, sHelp);
734 }
735
736 sHelp = HSS_PCTools_RetrievePersistentData(oPC, "PC_TOOLS_MACRO_BUTTON_" +
737 HSS_IntToLeadingZeroString(nCount), "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
738 if (sHelp != "")
739 {
740 SetLocalString(oPC, "PC_TOOLS_MACRO_BUTTON_" + HSS_IntToLeadingZeroString(nCount), sHelp);
741 }
742
743 sHelp = HSS_PCTools_RetrievePersistentData(oPC, "PC_TOOLS_MACRO_BUTTON_" +
744 HSS_IntToLeadingZeroString(nCount) + "_VOLUME", "pctools--" + sPCID, HSS_PC_TOOLS_INT);
745 if (sHelp != "")
746 {
747 SetLocalInt(oPC, "PC_TOOLS_MACRO_BUTTON_" + HSS_IntToLeadingZeroString(nCount) + "_VOLUME", StringToInt(sHelp));
748 }
749
750 nCount++;
751 }
752
753 //we're on page 1 -- need a space or single quotes when passing
754 //a pure int -- engine bug
755 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS_TM_V, 55, "'1'");
756
757 break;
758 }
759
760
761}
762
763void HSS_PCTools_OnGUIAdd(object oPC, int nGUI = 1)
764{
765 string sString;
766 int nCount = 1;
767 string sPCID = GetPCPlayerName(oPC) + "_" + GetName(oPC);
768
769 switch (nGUI)
770 {
771 //PC Tools
772 case 1:
773 sString = HSS_PCTools_RetrievePersistentData(oPC, "40", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
774
775 if (sString == "yes")
776 {
777 DisplayGuiScreen(oPC, SCREEN_HSS_PC_TOOLS_CB, FALSE, HSS_PC_TOOLS_CB_XML);
778 CloseGUIScreen(oPC, SCREEN_HSS_PC_TOOLS_CB_V);
779 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_ABOUT_CBUT", TRUE);
780
781 sString = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
782
783 if (sString == "nomin" || sString == "")
784 {
785 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CB_ROOT_PANE", FALSE);
786 }
787 }
788 else
789 if (sString == "yesv")
790 {
791 DisplayGuiScreen(oPC, SCREEN_HSS_PC_TOOLS_CB_V, FALSE, HSS_PC_TOOLS_CB_V_XML);
792 CloseGUIScreen(oPC, SCREEN_HSS_PC_TOOLS_CB);
793 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_ABOUT_CBUT", TRUE);
794
795 sString = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
796
797 if (sString == "nomin" || sString == "")
798 {
799 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CB_V_ROOT_PANE", FALSE);
800 }
801 }
802
803 sString = HSS_PCTools_RetrievePersistentData(oPC, "41", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
804
805 if (sString == "yestm")
806 {
807 DisplayGuiScreen(oPC, SCREEN_HSS_PC_TOOLS_TM_V, FALSE, HSS_PC_TOOLS_TM_V_XML);
808
809 sString = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
810
811 if (sString == "nomin" || sString == "")
812 {
813 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_TM_V, "PC_TOOLS_TM_V_ROOT_PANE", FALSE);
814 }
815 }
816
817 sString = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
818
819 if (sString == "nomin" || sString == "")
820 {
821 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_ROOT_PANE", FALSE);
822 }
823
824 break;
825
826 //Custom Button Floater -- Horizontal
827 case 2:
828 sString = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
829
830 if (sString == "nomin" || sString == "")
831 {
832 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CB_ROOT_PANE", FALSE);
833 }
834 break;
835
836 //Custom Button Floater -- Vertical
837 case 3:
838 sString = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
839
840 if (sString == "nomin" || sString == "")
841 {
842 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CB_V_ROOT_PANE", FALSE);
843 }
844 break;
845
846 //text macro vertical
847 case 4:
848 sString = HSS_PCTools_RetrievePersistentData(oPC, "42", "pctools--" + sPCID, HSS_PC_TOOLS_STRING);
849
850 if (sString == "nomin" || sString == "")
851 {
852 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_TM_V, "PC_TOOLS_TM_V_ROOT_PANE", FALSE);
853 }
854 break;
855 }
856}
857
858void HSS_PCTools_SaveCharacter(object oPC, string sPCID)
859{
860 string sMsg = HSS_SAVE_MESSAGE;
861
862 if (HSS_PCTOOLS_SAVE_LOC)
863 {
864 HSS_PCTools_StorePersistentData(oPC, HSS_PCTOOLS_LOC_VAR, "pctools--" + sPCID,
865 HSS_PC_TOOLS_LOC, LocationToString(GetLocation(oPC)));
866 sMsg = HSS_SAVE_MESSAGE_W_LOC;
867 }
868
869 SaveCharacter(oPC);
870 ExportSingleCharacter(oPC);
871 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + sMsg);
872}
873
874void HSS_PCTools_GetTime(object oPC)
875{
876 int nHour = GetTimeHour();
877 int nMinute = GetTimeMinute();
878 int nDay = GetCalendarDay();
879 int nMonth = GetCalendarMonth();
880 int nYear = GetCalendarYear();
881 string sDay;
882 string sMonth;
883 string sAm;
884 string sMsg;
885
886/* GreyHawk Calendar
887 switch (nDay)
888 {
889 case 1:
890 case 8:
891 case 15:
892 case 22:
893 sDay = "Starday";
894 break;
895
896 case 2:
897 case 9:
898 case 16:
899 case 23:
900 sDay = "Sunday";
901 break;
902
903 case 3:
904 case 10:
905 case 17:
906 case 24:
907 sDay = "Moonday";
908 break;
909
910 case 4:
911 case 11:
912 case 18:
913 case 25:
914 sDay = "Godsday";
915 break;
916
917 case 5:
918 case 12:
919 case 19:
920 case 26:
921 sDay = "Waterday";
922 break;
923
924 case 6:
925 case 13:
926 case 20:
927 case 27:
928 sDay = "Earthday";
929 break;
930
931 case 7:
932 case 14:
933 case 21:
934 case 28:
935 sDay = "Freeday";
936 break;
937 }
938
939 switch (nMonth)
940 {
941 case 1:
942 sMonth = "Fireseek";
943 break;
944
945 case 2:
946 sMonth = "Readying";
947 break;
948
949 case 3:
950 sMonth = "Coldeven";
951 break;
952
953 case 4:
954 sMonth = "Planting";
955 break;
956
957 case 5:
958 sMonth = "Flocktime";
959 break;
960
961 case 6:
962 sMonth = "Wealsun";
963 break;
964
965 case 7:
966 sMonth = "Reaping";
967 break;
968
969 case 8:
970 sMonth = "Goodmonth";
971 break;
972
973 case 9:
974 sMonth = "Harvester";
975 break;
976
977 case 10:
978 sMonth = "Patchwall";
979 break;
980
981 case 11:
982 sMonth = "Ready'reat";
983 break;
984
985 case 12:
986 sMonth = "Sunsebb";
987 break;
988 }
989*/
990 //Gregorian(ish) Calendar
991 switch (nDay)
992 {
993 case 1:
994 case 8:
995 case 15:
996 case 22:
997 sDay = "Sunday";
998 break;
999
1000 case 2:
1001 case 9:
1002 case 16:
1003 case 23:
1004 sDay = "Monday";
1005 break;
1006
1007 case 3:
1008 case 10:
1009 case 17:
1010 case 24:
1011 sDay = "Tuesday";
1012 break;
1013
1014 case 4:
1015 case 11:
1016 case 18:
1017 case 25:
1018 sDay = "Wednesday";
1019 break;
1020
1021 case 5:
1022 case 12:
1023 case 19:
1024 case 26:
1025 sDay = "Thursday";
1026 break;
1027
1028 case 6:
1029 case 13:
1030 case 20:
1031 case 27:
1032 sDay = "Friday";
1033 break;
1034
1035 case 7:
1036 case 14:
1037 case 21:
1038 case 28:
1039 sDay = "Saturday";
1040 break;
1041 }
1042
1043 switch (nMonth)
1044 {
1045 case 1:
1046 sMonth = "January";
1047 break;
1048
1049 case 2:
1050 sMonth = "February";
1051 break;
1052
1053 case 3:
1054 sMonth = "March";
1055 break;
1056
1057 case 4:
1058 sMonth = "April";
1059 break;
1060
1061 case 5:
1062 sMonth = "May";
1063 break;
1064
1065 case 6:
1066 sMonth = "June";
1067 break;
1068
1069 case 7:
1070 sMonth = "July";
1071 break;
1072
1073 case 8:
1074 sMonth = "August";
1075 break;
1076
1077 case 9:
1078 sMonth = "September";
1079 break;
1080
1081 case 10:
1082 sMonth = "October";
1083 break;
1084
1085 case 11:
1086 sMonth = "November";
1087 break;
1088
1089 case 12:
1090 sMonth = "December";
1091 break;
1092 }
1093
1094 if (nHour > 12)
1095 {
1096 nHour = nHour - 12;
1097 sAm = "pm";
1098 }
1099 else
1100 {
1101 sAm = "am";
1102 }
1103
1104 //GetTimeMinute() is whacked -- best we can do is hour level precision.
1105 //Remove if the function ever gets fixed.
1106 nMinute = 0;
1107
1108 sMsg = sDay + ", " + sMonth + " " + HSS_IntToLeadingZeroString(nDay) +
1109 ", " + IntToString(nYear) + "." + " " + IntToString(nHour) +
1110 " : " + HSS_IntToLeadingZeroString(nMinute) + " " + sAm;
1111
1112
1113 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Date/Time is: " + sMsg);
1114
1115}
1116
1117void HSS_PCTools_MakeSafeLocation(object oPC)
1118{
1119 if (GetLocalInt(oPC, "HSS_PCTOOLS_NO_MAKESAFE") ||
1120 GetLocalInt(GetArea(oPC), "HSS_PCTOOLS_NO_MAKESAFE"))
1121 {
1122 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + HSS_NO_MAKESAFE_MESSAGE);
1123 return;
1124 }
1125
1126 JumpToLocation(CalcSafeLocation(oPC, GetLocation(oPC), 3.0, FALSE, FALSE));
1127 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + HSS_SAFE_LOC_MESSAGE);
1128}
1129
1130void HSS_PCTools_Create(object oPC, string sItem = "Tent")
1131{
1132 string sID;
1133 location lLoc;
1134 object oCreate;
1135 object oItem;
1136 string sAnim;
1137 object oArea = GetArea(oPC);
1138 object oMod = GetModule();
1139 string sPCID = GetPCPlayerName(oPC) + "_" + GetName(oPC);
1140 int nTentCount = GetLocalInt(oMod, "HSS_PCTOOLS_TENT_ITEM_COUNT_" + sPCID);
1141 int nFireCount = GetLocalInt(oMod, "HSS_PCTOOLS_CAMPFIRE_ITEM_COUNT_" + sPCID);
1142
1143 if (HSS_PCTOOLS_OBJECT_CREATE_RESTRICT == 1 && !GetIsDM(oPC) && GetIsPC(oPC))
1144 {
1145 if (GetIsAreaAboveGround(oArea) && GetIsAreaInterior(oArea) &&
1146 !GetIsAreaNatural(oArea))
1147 {
1148 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 +
1149 HSS_CREATION_RESTRICT_MESSAGE);
1150 return;
1151 }
1152 }
1153
1154 if (sItem == "Campfire")
1155 {
1156 if (nFireCount >= HSS_PCTOOLS_CAMPFIRE_ITEM_LIMIT &&
1157 HSS_PCTOOLS_CAMPFIRE_ITEM_LIMIT != -1)
1158 {
1159 if (!GetIsDM(oPC) && GetIsPC(oPC))
1160 {
1161 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + HSS_ITEM_LIMIT_MESSAGE);
1162 return;
1163 }
1164 }
1165
1166 if (HSS_PCTOOLS_CAMPFIRE_ITEM != "" && !GetIsDM(oPC) && GetIsPC(oPC))
1167 {
1168 oItem = HSS_GetItemPossessedBy_Cached(oPC, HSS_PCTOOLS_CAMPFIRE_ITEM);
1169
1170 if (!GetIsObjectValid(oItem))
1171 {
1172 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + HSS_NO_ITEM_MESSAGE);
1173 return;
1174 }
1175 }
1176
1177 sAnim = "disableground";
1178 sID = "HSS_PCTOOLS_CAMPFIRE";
1179 lLoc = CalcSafeLocation(oPC, GetAheadLocation(oPC, DISTANCE_TINY),
1180 0.1,FALSE, FALSE);
1181 oCreate = CreateObject(OBJECT_TYPE_PLACEABLE, "hss_campfire_01",
1182 lLoc, FALSE, sID);
1183 SetLocalInt(oMod, "HSS_PCTOOLS_CAMPFIRE_ITEM_COUNT_" + sPCID,
1184 nFireCount + 1);
1185 SetLocalString(oCreate, "HSS_PCTOOLS_CREATOR",
1186 "HSS_PCTOOLS_CAMPFIRE_ITEM_COUNT_" + sPCID);
1187
1188 DelayCommand(HSS_OBJECT_DECAY, HSS_DestroyAllInventory(oCreate));
1189 DelayCommand(HSS_OBJECT_DECAY + 1.0, HSS_PCTools_DestroyAndDecrement(oMod,
1190 oCreate, "HSS_PCTOOLS_CAMPFIRE_ITEM_COUNT_" + sPCID));
1191 }
1192 else
1193 if (sItem == "Tent")
1194 {
1195 if (nTentCount >= HSS_PCTOOLS_TENT_ITEM_LIMIT &&
1196 HSS_PCTOOLS_TENT_ITEM_LIMIT != -1)
1197 {
1198 if (!GetIsDM(oPC) && GetIsPC(oPC))
1199 {
1200 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + HSS_ITEM_LIMIT_MESSAGE);
1201 return;
1202 }
1203 }
1204 if (HSS_PCTOOLS_TENT_ITEM != "" && !GetIsDM(oPC) && GetIsPC(oPC))
1205 {
1206 oItem = HSS_GetItemPossessedBy_Cached(oPC, HSS_PCTOOLS_TENT_ITEM);
1207
1208 if (!GetIsObjectValid(oItem))
1209 {
1210 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + HSS_NO_ITEM_MESSAGE);
1211 return;
1212 }
1213 }
1214
1215 sAnim = "disablefront";
1216 sID = "HSS_PCTOOLS_TENT";
1217 lLoc = CalcSafeLocation(oPC, GetAheadLocation(oPC, DISTANCE_SHORT),
1218 0.1,FALSE, FALSE);
1219 oCreate = CreateObject(OBJECT_TYPE_PLACEABLE, "hss_tent_01",
1220 lLoc, FALSE, sID);
1221 SetLocalInt(oMod, "HSS_PCTOOLS_TENT_ITEM_COUNT_" + sPCID,
1222 nTentCount + 1);
1223 SetLocalString(oCreate, "HSS_PCTOOLS_CREATOR",
1224 "HSS_PCTOOLS_TENT_ITEM_COUNT_" + sPCID);
1225
1226 DelayCommand(HSS_OBJECT_DECAY, HSS_PCTools_DestroyAndDecrement(oMod,
1227 oCreate, "HSS_PCTOOLS_TENT_ITEM_COUNT_" + sPCID));
1228 }
1229
1230 if (sAnim != "")
1231 {
1232 ActionDoCommand(HSS_PCTools_PlayCustomAnim(oPC, sAnim, TRUE));
1233 ActionDoCommand(DelayCommand(4.0, HSS_PCTools_PlayCustomAnim(oPC, "%", FALSE)));
1234 }
1235
1236}
1237
1238void HSS_PCTools_ToggleAFK(object oPC)
1239{
1240 effect eAFK;
1241
1242 switch (HSS_PCTOOLS_AFK_VFX)
1243 {
1244 case 1:
1245 eAFK = SupernaturalEffect(SetEffectSpellId(EffectNWN2SpecialEffectFile("fx_hss_afk_01"), -999));
1246 break;
1247
1248 case 2:
1249 eAFK = SupernaturalEffect(SetEffectSpellId(EffectNWN2SpecialEffectFile("fx_hss_afk_02"), -999));
1250 break;
1251
1252 case 3:
1253 eAFK = SupernaturalEffect(SetEffectSpellId(EffectNWN2SpecialEffectFile("fx_hss_afk_03"), -999));
1254 break;
1255
1256 case 4:
1257 eAFK = SupernaturalEffect(SetEffectSpellId(EffectNWN2SpecialEffectFile("fx_hss_afk_04"), -999));
1258 break;
1259
1260 case 5:
1261 eAFK = SupernaturalEffect(SetEffectSpellId(EffectNWN2SpecialEffectFile("fx_hss_afk_05"), -999));
1262 break;
1263
1264 case 6:
1265 eAFK = SupernaturalEffect(SetEffectSpellId(EffectNWN2SpecialEffectFile("fx_hss_afk_06"), -999));
1266 break;
1267 }
1268
1269
1270 effect eFirst = GetFirstEffect(oPC);
1271
1272 while (GetIsEffectValid(eFirst))
1273 {
1274 if (GetEffectSpellId(eFirst) == -999)
1275 {
1276 RemoveEffect(oPC, eFirst);
1277 return;
1278 }
1279 eFirst = GetNextEffect(oPC);
1280 }
1281
1282 ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAFK, oPC);
1283}
1284
1285void HSS_PCToools_RollDie(object oPC)
1286{
1287 int nRollType = GetLocalInt(oPC, "HSS_PCTOOLS_ROLL_TYPE");
1288
1289 int nDieNum = GetLocalInt(oPC, "HSS_PCTOOLS_DIE_NUM");
1290 int nDieType = GetLocalInt(oPC, "HSS_PCTOOLS_DIE_TYPE");
1291
1292 int nSaveType = GetLocalInt(oPC, "HSS_PCTOOLS_SAVE_TYPE");
1293 int nAbilityType = GetLocalInt(oPC, "HSS_PCTOOLS_ABILITY_TYPE");
1294 int nSkillType = GetLocalInt(oPC, "HSS_PCTOOLS_SKILL_TYPE");
1295
1296 int nBroadcast = GetLocalInt(oPC, "HSS_PCTOOLS_BROADCAST_TYPE");
1297
1298 int nVal1;
1299 int nRoll;
1300 int nRank;
1301 string sMsg;
1302 string sSkill;
1303 float fAnimDelay;
1304
1305 switch (nRollType)
1306 {
1307 //standard die
1308 case HSS_PC_TOOLS_DIE_STANDARD:
1309 if (nDieNum == 0)
1310 {
1311 nDieNum = 1;
1312 }
1313 switch (nDieType)
1314 {
1315 case 2:
1316 nVal1 = d2(nDieNum);
1317 break;
1318
1319 case 4:
1320 nVal1 = d4(nDieNum);
1321 break;
1322
1323 case 6:
1324 nVal1 = d6(nDieNum);
1325 break;
1326
1327 case 8:
1328 nVal1 = d8(nDieNum);
1329 break;
1330
1331 case 10:
1332 nVal1 = d10(nDieNum);
1333 break;
1334
1335 case 12:
1336 nVal1 = d12(nDieNum);
1337 break;
1338
1339 case 20:
1340 nVal1 = d20(nDieNum);
1341 break;
1342
1343 case 100:
1344 nVal1 = d100(nDieNum);
1345 break;
1346 }
1347
1348 sMsg = HSS_PCTOOLS_COLOUR1 + "*Rolled " + HSS_PCTOOLS_COLOUR2 +
1349 IntToString(nVal1) + HSS_PCTOOLS_COLOUR1 + " on " +
1350 HSS_PCTOOLS_COLOUR2 + "("+ IntToString(nDieNum) + ")" +
1351 HSS_PCTOOLS_COLOUR1 + " d" + IntToString(nDieType) + "*";
1352
1353 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_STANDARD, "TRUE");
1354 break;
1355
1356 //saves
1357 case HSS_PC_TOOLS_DIE_SAVE:
1358 switch (nSaveType)
1359 {
1360 case SAVING_THROW_FORT:
1361 nRank = GetFortitudeSavingThrow(oPC);
1362 nRoll = d20();
1363 sSkill = HSS_PCTOOLS_COLOUR2 + "Fortitude" + HSS_PCTOOLS_COLOUR_END;
1364 break;
1365
1366 case SAVING_THROW_REFLEX:
1367 nRank = GetReflexSavingThrow(oPC);
1368 nRoll = d20();
1369 sSkill = HSS_PCTOOLS_COLOUR2 + "Reflex" + HSS_PCTOOLS_COLOUR_END;
1370 break;
1371
1372 case SAVING_THROW_WILL:
1373 nRank = GetWillSavingThrow(oPC);
1374 nRoll = d20();
1375 sSkill = HSS_PCTOOLS_COLOUR2 + "Will" + HSS_PCTOOLS_COLOUR_END;
1376 break;
1377 }
1378
1379 sMsg = sSkill + HSS_PCTOOLS_COLOUR2 + " Save: " + HSS_PCTOOLS_COLOUR1 +
1380 "Rank: " + HSS_PCTOOLS_COLOUR2 + IntToString(nRank) +
1381 HSS_PCTOOLS_COLOUR1 + " + Roll: " + HSS_PCTOOLS_COLOUR2 +
1382 IntToString(nRoll) + HSS_PCTOOLS_COLOUR1 + " = " + HSS_PCTOOLS_COLOUR2 +
1383 IntToString(nRank + nRoll) + HSS_PCTOOLS_COLOUR1 + ".";
1384
1385 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SAVE, "TRUE");
1386 break;
1387
1388 //ability
1389 case HSS_PC_TOOLS_DIE_ABILITY:
1390 switch (nAbilityType)
1391 {
1392 //str
1393 case 1:
1394 nRank = GetAbilityModifier(ABILITY_STRENGTH, oPC);
1395 nRoll = d20();
1396 sSkill = HSS_PCTOOLS_COLOUR2 + "Strength" + HSS_PCTOOLS_COLOUR_END;
1397 break;
1398
1399 //dex
1400 case 2:
1401 nRank = GetAbilityModifier(ABILITY_DEXTERITY, oPC);
1402 nRoll = d20();
1403 sSkill = HSS_PCTOOLS_COLOUR2 + "Dexterity" + HSS_PCTOOLS_COLOUR_END;
1404 break;
1405
1406 //con
1407 case 3:
1408 nRank = GetAbilityModifier(ABILITY_CONSTITUTION, oPC);
1409 nRoll = d20();
1410 sSkill = HSS_PCTOOLS_COLOUR2 + "Constitution" + HSS_PCTOOLS_COLOUR_END;
1411 break;
1412
1413 //int
1414 case 4:
1415 nRank = GetAbilityModifier(ABILITY_INTELLIGENCE, oPC);
1416 nRoll = d20();
1417 sSkill = HSS_PCTOOLS_COLOUR2 + "Intelligence" + HSS_PCTOOLS_COLOUR_END;
1418 break;
1419
1420 //wis
1421 case 5:
1422 nRank = GetAbilityModifier(ABILITY_WISDOM, oPC);
1423 nRoll = d20();
1424 sSkill = HSS_PCTOOLS_COLOUR2 + "Wisdom" + HSS_PCTOOLS_COLOUR_END;
1425 break;
1426
1427 //cha
1428 case 6:
1429 nRank = GetAbilityModifier(ABILITY_CHARISMA, oPC);
1430 nRoll = d20();
1431 sSkill = HSS_PCTOOLS_COLOUR2 + "Charisma" + HSS_PCTOOLS_COLOUR_END;
1432 break;
1433 }
1434
1435 sMsg = sSkill + HSS_PCTOOLS_COLOUR2 + " Check: " + HSS_PCTOOLS_COLOUR1 +
1436 "Bonus: " + HSS_PCTOOLS_COLOUR2 + IntToString(nRank) +
1437 HSS_PCTOOLS_COLOUR1 + " + Roll: " + HSS_PCTOOLS_COLOUR2 +
1438 IntToString(nRoll) + HSS_PCTOOLS_COLOUR1 + " = " + HSS_PCTOOLS_COLOUR2 +
1439 IntToString(nRank + nRoll) + HSS_PCTOOLS_COLOUR1 + ".";
1440
1441 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_ABILITY, "TRUE");
1442 break;
1443
1444 //skill
1445 case HSS_PC_TOOLS_DIE_SKILL:
1446 switch (nSkillType)
1447 {
1448 //appraise
1449 case 1:
1450 nRank = GetSkillRank(SKILL_APPRAISE, oPC);
1451 nRoll = d20();
1452 sSkill = HSS_PCTOOLS_COLOUR2 + "Appraise" + HSS_PCTOOLS_COLOUR_END;
1453 break;
1454 //bluff
1455 case 2:
1456 nRank = GetSkillRank(SKILL_BLUFF, oPC);
1457 nRoll = d20();
1458 sSkill = HSS_PCTOOLS_COLOUR2 + "Bluff" + HSS_PCTOOLS_COLOUR_END;
1459 break;
1460 //concentration
1461 case 3:
1462 nRank = GetSkillRank(SKILL_CONCENTRATION, oPC);
1463 nRoll = d20();
1464 sSkill = HSS_PCTOOLS_COLOUR2 + "Concentration" + HSS_PCTOOLS_COLOUR_END;
1465 break;
1466 //craft alchemy
1467 case 4:
1468 nRank = GetSkillRank(SKILL_CRAFT_ALCHEMY, oPC);
1469 nRoll = d20();
1470 sSkill = HSS_PCTOOLS_COLOUR2 + "Craft Alchemy" + HSS_PCTOOLS_COLOUR_END;
1471 break;
1472 //craft armour
1473 case 5:
1474 nRank = GetSkillRank(SKILL_CRAFT_ARMOR, oPC);
1475 nRoll = d20();
1476 sSkill = HSS_PCTOOLS_COLOUR2 + "Craft Armour" + HSS_PCTOOLS_COLOUR_END;
1477 break;
1478 //craft trap
1479 case 6:
1480 nRank = GetSkillRank(SKILL_CRAFT_TRAP, oPC);
1481 nRoll = d20();
1482 sSkill = HSS_PCTOOLS_COLOUR2 + "Craft Trap" + HSS_PCTOOLS_COLOUR_END;
1483 break;
1484 //craft weapon
1485 case 7:
1486 nRank = GetSkillRank(SKILL_CRAFT_WEAPON, oPC);
1487 nRoll = d20();
1488 sSkill = HSS_PCTOOLS_COLOUR2 + "Craft Weapon" + HSS_PCTOOLS_COLOUR_END;
1489 break;
1490 //diplomacy
1491 case 8:
1492 nRank = GetSkillRank(SKILL_DIPLOMACY, oPC);
1493 nRoll = d20();
1494 sSkill = HSS_PCTOOLS_COLOUR2 + "Diplomacy" + HSS_PCTOOLS_COLOUR_END;
1495 break;
1496 //disable trap
1497 case 9:
1498 nRank = GetSkillRank(SKILL_DISABLE_TRAP, oPC);
1499 nRoll = d20();
1500 sSkill = HSS_PCTOOLS_COLOUR2 + "Disable Trap" + HSS_PCTOOLS_COLOUR_END;
1501 break;
1502 //heal
1503 case 10:
1504 nRank = GetSkillRank(SKILL_HEAL, oPC);
1505 nRoll = d20();
1506 sSkill = HSS_PCTOOLS_COLOUR2 + "Heal" + HSS_PCTOOLS_COLOUR_END;
1507 break;
1508 //hide
1509 case 11:
1510 nRank = GetSkillRank(SKILL_HIDE, oPC);
1511 nRoll = d20();
1512 sSkill = HSS_PCTOOLS_COLOUR2 + "Hide" + HSS_PCTOOLS_COLOUR_END;
1513 break;
1514 //intimidate
1515 case 12:
1516 nRank = GetSkillRank(SKILL_INTIMIDATE, oPC);
1517 nRoll = d20();
1518 sSkill = HSS_PCTOOLS_COLOUR2 + "Intimidate" + HSS_PCTOOLS_COLOUR_END;
1519 break;
1520 //listen
1521 case 13:
1522 nRank = GetSkillRank(SKILL_LISTEN, oPC);
1523 nRoll = d20();
1524 sSkill = HSS_PCTOOLS_COLOUR2 + "Listen" + HSS_PCTOOLS_COLOUR_END;
1525 break;
1526 //lore
1527 case 14:
1528 nRank = GetSkillRank(SKILL_LORE, oPC);
1529 nRoll = d20();
1530 sSkill = HSS_PCTOOLS_COLOUR2 + "Lore" + HSS_PCTOOLS_COLOUR_END;
1531 break;
1532 //move silently
1533 case 15:
1534 nRank = GetSkillRank(SKILL_MOVE_SILENTLY, oPC);
1535 nRoll = d20();
1536 sSkill = HSS_PCTOOLS_COLOUR2 + "Move Silently" + HSS_PCTOOLS_COLOUR_END;
1537 break;
1538 //open lock
1539 case 16:
1540 nRank = GetSkillRank(SKILL_OPEN_LOCK, oPC);
1541 nRoll = d20();
1542 sSkill = HSS_PCTOOLS_COLOUR2 + "Open Lock" + HSS_PCTOOLS_COLOUR_END;
1543 break;
1544 //parry
1545 case 17:
1546 nRank = GetSkillRank(SKILL_PARRY, oPC);
1547 nRoll = d20();
1548 sSkill = HSS_PCTOOLS_COLOUR2 + "Parry" + HSS_PCTOOLS_COLOUR_END;
1549 break;
1550 //perform
1551 case 18:
1552 nRank = GetSkillRank(SKILL_PERFORM, oPC);
1553 nRoll = d20();
1554 sSkill = HSS_PCTOOLS_COLOUR2 + "Perform" + HSS_PCTOOLS_COLOUR_END;
1555 break;
1556 //ride
1557 case 19:
1558 nRank = GetSkillRank(SKILL_RIDE, oPC);
1559 nRoll = d20();
1560 sSkill = HSS_PCTOOLS_COLOUR2 + "Ride" + HSS_PCTOOLS_COLOUR_END;
1561 break;
1562 //search
1563 case 20:
1564 nRank = GetSkillRank(SKILL_SEARCH, oPC);
1565 nRoll = d20();
1566 sSkill = HSS_PCTOOLS_COLOUR2 + "Search" + HSS_PCTOOLS_COLOUR_END;
1567 break;
1568 //set trap
1569 case 21:
1570 nRank = GetSkillRank(SKILL_SET_TRAP, oPC);
1571 nRoll = d20();
1572 sSkill = HSS_PCTOOLS_COLOUR2 + "Set Trap" + HSS_PCTOOLS_COLOUR_END;
1573 break;
1574 //sleight of hand
1575 case 22:
1576 nRank = GetSkillRank(SKILL_SLEIGHT_OF_HAND, oPC);
1577 nRoll = d20();
1578 sSkill = HSS_PCTOOLS_COLOUR2 + "Sleight of Hand" + HSS_PCTOOLS_COLOUR_END;
1579 break;
1580 //spellcraft
1581 case 23:
1582 nRank = GetSkillRank(SKILL_SPELLCRAFT, oPC);
1583 nRoll = d20();
1584 sSkill = HSS_PCTOOLS_COLOUR2 + "Spellcraft" + HSS_PCTOOLS_COLOUR_END;
1585 break;
1586 //spot
1587 case 24:
1588 nRank = GetSkillRank(SKILL_SPOT, oPC);
1589 nRoll = d20();
1590 sSkill = HSS_PCTOOLS_COLOUR2 + "Spot" + HSS_PCTOOLS_COLOUR_END;
1591 break;
1592 //survival
1593 case 25:
1594 nRank = GetSkillRank(SKILL_SURVIVAL, oPC);
1595 nRoll = d20();
1596 sSkill = HSS_PCTOOLS_COLOUR2 + "Survival" + HSS_PCTOOLS_COLOUR_END;
1597 break;
1598 //taunt
1599 case 26:
1600 nRank = GetSkillRank(SKILL_TAUNT, oPC);
1601 nRoll = d20();
1602 sSkill = HSS_PCTOOLS_COLOUR2 + "Taunt" + HSS_PCTOOLS_COLOUR_END;
1603 break;
1604 //tumble
1605 case 27:
1606 nRank = GetSkillRank(SKILL_TUMBLE, oPC);
1607 nRoll = d20();
1608 sSkill = HSS_PCTOOLS_COLOUR2 + "Tumble" + HSS_PCTOOLS_COLOUR_END;
1609 break;
1610 //UMD
1611 case 28:
1612 nRank = GetSkillRank(SKILL_USE_MAGIC_DEVICE, oPC);
1613 nRoll = d20();
1614 sSkill = HSS_PCTOOLS_COLOUR2 + "Use Magic Device" + HSS_PCTOOLS_COLOUR_END;
1615 break;
1616 }
1617
1618 sMsg = sSkill + HSS_PCTOOLS_COLOUR2 + " Check: " + HSS_PCTOOLS_COLOUR1 +
1619 "Rank: " + HSS_PCTOOLS_COLOUR2 + IntToString(nRank) +
1620 HSS_PCTOOLS_COLOUR1 + " + Roll: " + HSS_PCTOOLS_COLOUR2 +
1621 IntToString(nRoll) + HSS_PCTOOLS_COLOUR1 + " = " + HSS_PCTOOLS_COLOUR2 +
1622 IntToString(nRank + nRoll) + HSS_PCTOOLS_COLOUR1 + ".";
1623
1624 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SKILL, "TRUE");
1625 break;
1626 }
1627
1628 if (sMsg == "")
1629 {
1630 sMsg = HSS_PCTOOLS_COLOUR1 + "Select a die roll type before rolling.";
1631 nBroadcast = 1;
1632 }
1633
1634 if (!nDieType && nRollType == HSS_PC_TOOLS_DIE_STANDARD)
1635 {
1636 sMsg = HSS_PCTOOLS_COLOUR1 + "Standard die rolls require a die type.";
1637 nBroadcast = 1;
1638 }
1639
1640 if (nRollType == HSS_PC_TOOLS_DIE_STANDARD && !nBroadcast)
1641 {
1642 HSS_PCTools_PlayCustomAnim(oPC, "gettable", FALSE, 2.0);
1643 DelayCommand(1.0, PlaySound("it_generictiny"));
1644 DelayCommand(1.5, HSS_PCTools_PlayCustomAnim(oPC, "getground", FALSE, 2.0));
1645 fAnimDelay = 2.0;
1646 }
1647
1648 if (nBroadcast)
1649 {
1650 DelayCommand(fAnimDelay, SendMessageToPC(oPC, sMsg));
1651 }
1652 else
1653 {
1654 DelayCommand(fAnimDelay, SpeakString(sMsg));
1655 }
1656
1657 HSS_PCTools_CleanPCLocals(oPC, FALSE);
1658 DelayCommand(0.2, HSS_PCTools_DeleteGUIDieRollType(oPC));
1659}
1660
1661void HSS_PCTools_SetGUIDieRollType(object oPC, int nType = HSS_PC_TOOLS_DIE_STANDARD)
1662{
1663 switch (nType)
1664 {
1665 case HSS_PC_TOOLS_DIE_STANDARD:
1666 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SAVE, "TRUE");
1667 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_ABILITY, "TRUE");
1668 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SKILL, "TRUE");
1669 break;
1670
1671 case HSS_PC_TOOLS_DIE_SAVE:
1672 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_STANDARD, "TRUE");
1673 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_ABILITY, "TRUE");
1674 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SKILL, "TRUE");
1675 break;
1676
1677 case HSS_PC_TOOLS_DIE_ABILITY:
1678 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_STANDARD, "TRUE");
1679 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SAVE, "TRUE");
1680 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SKILL, "TRUE");
1681 break;
1682
1683 case HSS_PC_TOOLS_DIE_SKILL:
1684 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_STANDARD, "TRUE");
1685 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SAVE, "TRUE");
1686 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_ABILITY, "TRUE");
1687 break;
1688 }
1689}
1690
1691void HSS_PCTools_DeleteGUIDieRollType(object oPC)
1692{
1693 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_STANDARD, "FALSE");
1694 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SAVE, "FALSE");
1695 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_ABILITY, "FALSE");
1696 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_DIE_SKILL, "FALSE");
1697}
1698
1699
1700void HSS_PCTools_DoEmote(object oPC)
1701{
1702 string sEmote = GetLocalString(oPC, "HSS_PC_TOOLS_ANIM_TYPE");
1703 string sEmote2 = GetLocalString(oPC, "HSS_PC_TOOLS_ANIM_TYPE_2");
1704 int nLoop = GetLocalInt(oPC, "HSS_PC_TOOLS_ANIM_LOOP");
1705 float fDelay = GetLocalFloat(oPC, "HSS_PC_TOOLS_ANIM_DELAY");
1706
1707
1708 if (sEmote != "")
1709 {
1710 if (sEmote == "%" || sEmote2 != "")
1711 {
1712 //seems empty strings ("") are now passed as "0" -- gah!
1713 //this caused the looping option to fail -- bug fix.
1714 if (sEmote2 != "0")
1715 {
1716 nLoop = 0;
1717 }
1718 }
1719 HSS_PCTools_PlayCustomAnim(oPC, sEmote, nLoop);
1720
1721 if (sEmote2 != "")
1722 {
1723 //seems empty strings ("") are now passed as "0" -- gah!
1724 //this caused the looping option to fail -- bug fix.
1725 if (sEmote2 != "0")
1726 {
1727 nLoop = 1;
1728 DelayCommand(fDelay, HSS_PCTools_PlayCustomAnim(oPC, sEmote2, nLoop));
1729 }
1730 }
1731 }
1732
1733 HSS_PCTools_CleanPCLocals(oPC, FALSE);
1734
1735 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_EMOTE, "TRUE");
1736 DelayCommand(0.2, SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS, HSS_PC_TOOLS_EMOTE, "FALSE"));
1737}
1738
1739void HSS_PCTools_ApplyVFX(object oPC, string sVFX)
1740{
1741 string sEffect = "fx_hss_" + sVFX;
1742 effect eProp = SupernaturalEffect(SetEffectSpellId(EffectNWN2SpecialEffectFile(sEffect), -899));
1743 effect eFirst = GetFirstEffect(oPC);
1744 object oItem;
1745 string sItem;
1746
1747 if (sVFX == "drinkbeer")
1748 {
1749 sItem = HSS_PCTOOLS_VFX_DRINKBEER_ITEM;
1750 }
1751 else
1752 if (sVFX == "druma")
1753 {
1754 sItem = HSS_PCTOOLS_VFX_DRUMA_ITEM;
1755 }
1756 else
1757 if (sVFX == "drumb")
1758 {
1759 sItem = HSS_PCTOOLS_VFX_DRUMB_ITEM;
1760 }
1761 else
1762 if (sVFX == "flutea")
1763 {
1764 sItem = HSS_PCTOOLS_VFX_FLUTEA_ITEM;
1765 }
1766 else
1767 if (sVFX == "fluteb")
1768 {
1769 sItem = HSS_PCTOOLS_VFX_FLUTEB_ITEM;
1770 }
1771 else
1772 if (sVFX == "mandolina")
1773 {
1774 sItem = HSS_PCTOOLS_VFX_MANDOLINA_ITEM;
1775 }
1776 else
1777 if (sVFX == "mandolinb")
1778 {
1779 sItem = HSS_PCTOOLS_VFX_MANDOLINB_ITEM;
1780 }
1781 else
1782 if (sVFX == "mandolinc")
1783 {
1784 sItem = HSS_PCTOOLS_VFX_MANDOLINC_ITEM;
1785 }
1786 else
1787 if (sVFX == "pan")
1788 {
1789 sItem = HSS_PCTOOLS_VFX_PAN_ITEM;
1790 }
1791 else
1792 if (sVFX == "rake")
1793 {
1794 sItem = HSS_PCTOOLS_VFX_RAKE_ITEM;
1795 }
1796 else
1797 if (sVFX == "shovel")
1798 {
1799 sItem = HSS_PCTOOLS_VFX_SHOVEL_ITEM;
1800 }
1801 else
1802 if (sVFX == "smithyhammer")
1803 {
1804 sItem = HSS_PCTOOLS_VFX_SMITHYHAMMER_ITEM;
1805 }
1806 else
1807 if (sVFX == "spoon")
1808 {
1809 sItem = HSS_PCTOOLS_VFX_SPOON_ITEM;
1810 }
1811 else
1812 if (sVFX == "wine")
1813 {
1814 sItem = HSS_PCTOOLS_VFX_WINE_ITEM;
1815 }
1816
1817
1818 if (sItem != "" && GetIsPC(oPC) && !GetIsDM(oPC))
1819 {
1820 oItem = HSS_GetItemPossessedBy_Cached(oPC, sItem);
1821
1822 if (!GetIsObjectValid(oItem))
1823 {
1824 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + HSS_NO_ITEM_MESSAGE);
1825 return;
1826 }
1827 }
1828
1829 while (GetIsEffectValid(eFirst))
1830 {
1831 if (GetEffectSpellId(eFirst) == -899)
1832 {
1833 RemoveEffect(oPC, eFirst);
1834 break;
1835 }
1836 eFirst = GetNextEffect(oPC);
1837 }
1838
1839 if (sVFX == "%")
1840 {
1841 return;
1842 }
1843
1844 ApplyEffectToObject(DURATION_TYPE_PERMANENT, eProp, oPC);
1845
1846}
1847
1848void HSS_PCTools_Remove(object oPC, int nObject)
1849{
1850 object oTarget = IntToObject(nObject);
1851 string sTag = GetTag(oTarget);
1852 object oMod = GetModule();
1853 string sPCID = GetLocalString(oTarget, "HSS_PCTOOLS_CREATOR");
1854 string sMsg;
1855 string sAnim;
1856
1857
1858 if (!GetIsObjectValid(oTarget) || sTag != "HSS_PCTOOLS_TENT" &&
1859 sTag != "HSS_PCTOOLS_CAMPFIRE")
1860 {
1861 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "No valid target chosen " +
1862 "for this action.");
1863 return;
1864 }
1865
1866 if (sTag == "HSS_PCTOOLS_TENT")
1867 {
1868 sMsg = HSS_PCTOOLS_COLOUR1 + "*Packs Up Tent*";
1869 sAnim = "disablefront";
1870 DelayCommand(6.0, HSS_PCTools_DestroyAndDecrement(oMod, oTarget, sPCID));
1871 }
1872 else
1873 {
1874 sMsg = HSS_PCTOOLS_COLOUR1 + "*Puts Out Fire*";
1875 sAnim = "disableground";
1876 DelayCommand(6.0, HSS_PCTools_DestroyAndDecrement(oMod, oTarget, sPCID));
1877 }
1878
1879 ActionMoveToObject(oTarget, FALSE);
1880 if (!GetIsDM(oPC))
1881 {
1882 ActionSpeakString(sMsg);
1883 }
1884 ActionDoCommand(HSS_PCTools_PlayCustomAnim(oPC, sAnim, TRUE));
1885 ActionDoCommand(DelayCommand(4.0, HSS_PCTools_PlayCustomAnim(oPC, "%", FALSE)));
1886 ActionDoCommand(HSS_DestroyAllInventory(oTarget));
1887
1888}
1889
1890void HSS_PCTools_CustomButton(object oPC, int nButton, float fX = 0.0, float fY = 0.0, float fZ = 0.0, int nString1 = -1, int nObject = -1)
1891{
1892 //variables for Target type butons
1893 object oTarget = IntToObject(nObject);
1894 vector vTargetPos = Vector(fX, fY, fZ);
1895 location lTargetLoc = Location(GetAreaFromLocation(GetLocation(oPC)),
1896 vTargetPos, 0.0);
1897
1898 switch (nButton)
1899 {
1900 //custom button 1
1901 case 1:
1902 //your custom button code goes here
1903 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1904 IntToString(nButton) + " has no custom code enabled.");
1905 break;
1906
1907 //custom button 2
1908 case 2:
1909 //your custom button code goes here
1910 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1911 IntToString(nButton) + " has no custom code enabled.");
1912 break;
1913
1914 //custom button 3
1915 case 3:
1916 //your custom button code goes here
1917 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1918 IntToString(nButton) + " has no custom code enabled.");
1919 break;
1920
1921 //custom button 4
1922 case 4:
1923 //your custom button code goes here
1924 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1925 IntToString(nButton) + " has no custom code enabled.");
1926 break;
1927
1928 //custom button 5
1929 case 5:
1930 //your custom button code goes here
1931 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1932 IntToString(nButton) + " has no custom code enabled.");
1933 break;
1934
1935 //custom button 6
1936 case 6:
1937 //your custom button code goes here
1938 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1939 IntToString(nButton) + " has no custom code enabled.");
1940 break;
1941
1942 //custom button 7
1943 case 7:
1944 //your custom button code goes here
1945 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1946 IntToString(nButton) + " has no custom code enabled.");
1947 break;
1948
1949 //custom button 8
1950 case 8:
1951 //your custom button code goes here
1952 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1953 IntToString(nButton) + " has no custom code enabled.");
1954 break;
1955
1956 //custom button 9
1957 case 9:
1958 //your custom button code goes here
1959 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1960 IntToString(nButton) + " has no custom code enabled.");
1961 break;
1962
1963 //custom button 10
1964 case 10:
1965 //your custom button code goes here
1966 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1967 IntToString(nButton) + " has no custom code enabled.");
1968 break;
1969
1970 //custom button 11
1971 case 11:
1972 //your custom button code goes here
1973 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1974 IntToString(nButton) + " has no custom code enabled.");
1975 break;
1976
1977 //custom button 12
1978 case 12:
1979 //your custom button code goes here
1980 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1981 IntToString(nButton) + " has no custom code enabled.");
1982 break;
1983
1984 //custom button 13
1985 case 13:
1986 //your custom button code goes here
1987 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1988 IntToString(nButton) + " has no custom code enabled.");
1989 break;
1990
1991 //custom button 14
1992 case 14:
1993 //your custom button code goes here
1994 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
1995 IntToString(nButton) + " has no custom code enabled.");
1996 break;
1997
1998 //custom button 15
1999 case 15:
2000 //your custom button code goes here
2001 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
2002 IntToString(nButton) + " has no custom code enabled.");
2003 break;
2004
2005 //custom button 16
2006 case 16:
2007 //your custom button code goes here
2008 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
2009 IntToString(nButton) + " has no custom code enabled.");
2010 break;
2011
2012 //custom button 17
2013 case 17:
2014 //your custom button code goes here
2015 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
2016 IntToString(nButton) + " has no custom code enabled.");
2017 break;
2018
2019 //custom button 18
2020 case 18:
2021 //your custom button code goes here
2022 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Button number " +
2023 IntToString(nButton) + " has no custom code enabled.");
2024 break;
2025
2026 //custom target mode button 1
2027 case 19:
2028 //your custom button code goes here
2029 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2030 IntToString(nButton - 18) + " has no custom code enabled.");
2031 break;
2032
2033 //custom target mode button 2
2034 case 20:
2035 //your custom button code goes here
2036 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2037 IntToString(nButton - 18) + " has no custom code enabled.");
2038 break;
2039
2040 //custom target mode button 3
2041 case 21:
2042 //your custom button code goes here
2043 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2044 IntToString(nButton - 18) + " has no custom code enabled.");
2045 break;
2046
2047 //custom target mode button 4
2048 case 22:
2049 //your custom button code goes here
2050 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2051 IntToString(nButton - 18) + " has no custom code enabled.");
2052 break;
2053
2054 //custom target mode button 5
2055 case 23:
2056 //your custom button code goes here
2057 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2058 IntToString(nButton - 18) + " has no custom code enabled.");
2059 break;
2060
2061 //custom target mode button 6
2062 case 24:
2063 //your custom button code goes here
2064 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2065 IntToString(nButton - 18) + " has no custom code enabled.");
2066 break;
2067
2068 //custom target mode button 7
2069 case 25:
2070 //your custom button code goes here
2071 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2072 IntToString(nButton - 18) + " has no custom code enabled.");
2073 break;
2074
2075 //custom target mode button 8
2076 case 26:
2077 //your custom button code goes here
2078 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2079 IntToString(nButton - 18) + " has no custom code enabled.");
2080 break;
2081
2082 //custom target mode button 9
2083 case 27:
2084 //your custom button code goes here
2085 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2086 IntToString(nButton - 18) + " has no custom code enabled.");
2087 break;
2088
2089 //custom target mode button 10
2090 case 28:
2091 //your custom button code goes here
2092 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2093 IntToString(nButton - 18) + " has no custom code enabled.");
2094 break;
2095
2096 //custom target mode button 11
2097 case 29:
2098 //your custom button code goes here
2099 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2100 IntToString(nButton - 18) + " has no custom code enabled.");
2101 break;
2102
2103 //custom target mode button 12
2104 case 30:
2105 //your custom button code goes here
2106 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2107 IntToString(nButton - 18) + " has no custom code enabled.");
2108 break;
2109
2110 //custom target mode button 13
2111 case 31:
2112 //your custom button code goes here
2113 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2114 IntToString(nButton - 18) + " has no custom code enabled.");
2115 break;
2116
2117 //custom target mode button 14
2118 case 32:
2119 //your custom button code goes here
2120 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2121 IntToString(nButton - 18) + " has no custom code enabled.");
2122 break;
2123
2124 //custom target mode button 15
2125 case 33:
2126 //your custom button code goes here
2127 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2128 IntToString(nButton - 18) + " has no custom code enabled.");
2129 break;
2130
2131 //custom target mode button 16
2132 case 34:
2133 //your custom button code goes here
2134 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2135 IntToString(nButton - 18) + " has no custom code enabled.");
2136 break;
2137
2138 //custom target mode button 17
2139 case 35:
2140 //your custom button code goes here
2141 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2142 IntToString(nButton - 18) + " has no custom code enabled.");
2143 break;
2144
2145 //custom target mode button 18
2146 case 36:
2147 //your custom button code goes here
2148 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 + "Target mode button number " +
2149 IntToString(nButton - 18) + " has no custom code enabled.");
2150 break;
2151
2152 //custom buttons page 1
2153 case 96:
2154
2155 switch (nString1)
2156 {
2157 case 1:
2158 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_HEADER_BUTTON",
2159 -1, "Custom Buttons");
2160 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_01", TRUE);
2161 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_02", TRUE);
2162 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_03", TRUE);
2163 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_04", TRUE);
2164
2165 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_01", FALSE);
2166 break;
2167
2168 case 2:
2169 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_01", TRUE);
2170 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_02", TRUE);
2171 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_03", TRUE);
2172 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_04", TRUE);
2173
2174 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_01", FALSE);
2175 break;
2176
2177 case 3:
2178 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_01", TRUE);
2179 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_02", TRUE);
2180 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_03", TRUE);
2181 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_04", TRUE);
2182
2183 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_01", FALSE);
2184 break;
2185 }
2186
2187 break;
2188
2189 //custom buttons page 2
2190 case 97:
2191
2192 switch (nString1)
2193 {
2194 case 1:
2195 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_HEADER_BUTTON",
2196 -1, "Custom Buttons");
2197 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_01", TRUE);
2198 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_02", TRUE);
2199 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_03", TRUE);
2200 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_04", TRUE);
2201
2202 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_02", FALSE);
2203 break;
2204
2205 case 2:
2206 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_01", TRUE);
2207 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_02", TRUE);
2208 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_03", TRUE);
2209 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_04", TRUE);
2210
2211 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_02", FALSE);
2212 break;
2213
2214 case 3:
2215 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_01", TRUE);
2216 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_02", TRUE);
2217 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_03", TRUE);
2218 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_04", TRUE);
2219
2220 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_02", FALSE);
2221 break;
2222 }
2223
2224 break;
2225
2226 //custom buttons page 3
2227 case 98:
2228
2229 switch (nString1)
2230 {
2231 case 1:
2232 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_HEADER_BUTTON",
2233 -1, "Custom Target Mode Buttons ");
2234 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_01", TRUE);
2235 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_02", TRUE);
2236 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_03", TRUE);
2237 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_04", TRUE);
2238
2239 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_03", FALSE);
2240 break;
2241
2242 case 2:
2243 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_01", TRUE);
2244 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_02", TRUE);
2245 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_03", TRUE);
2246 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_04", TRUE);
2247
2248 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_03", FALSE);
2249 break;
2250
2251 case 3:
2252 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_01", TRUE);
2253 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_02", TRUE);
2254 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_03", TRUE);
2255 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_04", TRUE);
2256
2257 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_03", FALSE);
2258 break;
2259 }
2260
2261 break;
2262
2263 //custom buttons page 4
2264 case 99:
2265
2266 switch (nString1)
2267 {
2268 case 1:
2269 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_HEADER_BUTTON",
2270 -1, "Custom Target Mode Buttons ");
2271 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_01", TRUE);
2272 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_02", TRUE);
2273 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_03", TRUE);
2274 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_04", TRUE);
2275
2276 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS, "PC_TOOLS_CBUT_04", FALSE);
2277 break;
2278
2279 case 2:
2280 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_01", TRUE);
2281 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_02", TRUE);
2282 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_03", TRUE);
2283 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_04", TRUE);
2284
2285 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB_V, "PC_TOOLS_CBUT_04", FALSE);
2286 break;
2287
2288 case 3:
2289 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_01", TRUE);
2290 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_02", TRUE);
2291 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_03", TRUE);
2292 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_04", TRUE);
2293
2294 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_CB, "PC_TOOLS_CBUT_04", FALSE);
2295 break;
2296 }
2297
2298 break;
2299
2300
2301 }
2302}
2303
2304void HSS_PCTools_PlayCustomAnim(object oObject, string sAnimationName, int nLooping, float fSpeed = 1.0)
2305{
2306 PlayCustomAnimation(oObject, sAnimationName, nLooping, fSpeed);
2307}
2308
2309void HSS_DestroyAllInventory(object oObject)
2310{
2311 if (!GetHasInventory(oObject))
2312 {
2313 return;
2314 }
2315
2316 object oItem = GetFirstItemInInventory(oObject);
2317
2318 while (GetIsObjectValid(oItem))
2319 {
2320 DestroyObject(oItem);
2321 oItem = GetNextItemInInventory(oObject);
2322 }
2323}
2324
2325string HSS_IntToLeadingZeroString(int nNumber)
2326{
2327string sResult = IntToString(nNumber);
2328
2329 if (nNumber < 10 && nNumber >= 0)
2330 {
2331 sResult = "0"+IntToString(nNumber);
2332 return sResult;
2333 }
2334
2335return sResult;
2336}
2337
2338object HSS_GetItemPossessedBy_Cached(object oCreature, string sItemTag)
2339{
2340 object oItem = GetLocalObject(oCreature, "HSS_CACHED_ITEM_" + sItemTag);
2341
2342 //not sure if GetItemPossessor()is more efficient than GetItemPossessedBy()
2343 if (GetIsObjectValid(oItem) && GetItemPossessor(oItem) == oCreature)
2344 {
2345 return oItem;
2346 }
2347
2348 oItem = GetItemPossessedBy(oCreature, sItemTag);
2349
2350 if (GetIsObjectValid(oItem))
2351 {
2352 SetLocalObject(oCreature, "HSS_CACHED_ITEM_" + sItemTag, oItem);
2353 return oItem;
2354 }
2355
2356 return oItem;
2357}
2358
2359void HSS_PCTools_DestroyAndDecrement(object oPC, object oObject, string sVar)
2360{
2361
2362 //might have been destroyed manually, so check for validity first since
2363 //this can be called via a delay. Only destroy and decrement if the object
2364 //exists first.
2365 if (GetIsObjectValid(oObject))
2366 {
2367 DestroyObject(oObject);
2368 SetLocalInt(oPC, sVar, GetLocalInt(oPC, sVar) - 1);
2369 }
2370}
2371
2372location HSS_StringToLocation(string sLoc)
2373{
2374 int nSpace = FindSubString(sLoc, " ");
2375 string sArea;
2376 string sVec;
2377 string sFace;
2378 location lLoc;//(areatag) (0.0, 0.0, 0.0) (0.0)
2379
2380 sArea = GetSubString(sLoc, 1, nSpace - 2);
2381 //SpeakString(sArea);
2382
2383 sLoc = GetSubString(sLoc, nSpace + 1, GetStringLength(sLoc) - nSpace);
2384 nSpace = FindSubString(sLoc, " (");
2385 sVec = GetSubString(sLoc, 0, nSpace);
2386 //SpeakString(sVec);
2387
2388
2389 sLoc = GetSubString(sLoc, nSpace + 2, GetStringLength(sLoc) - nSpace);
2390 nSpace = FindSubString(sLoc, ")");
2391 sFace = GetSubString(sLoc, 0, nSpace);
2392 //SpeakString(sFace);
2393
2394 lLoc = Location(GetObjectByTag(sArea), HSS_StringToVector(sVec),
2395 StringToFloat(sFace));
2396
2397 return lLoc;
2398}
2399
2400vector HSS_StringToVector(string sVec)
2401{
2402 int nSpace = FindSubString(sVec, " ");
2403 string sX;
2404 string sY;
2405 string sZ;
2406 vector vVec;
2407
2408 sX = GetSubString(sVec, 1, nSpace - 2);
2409 //SpeakString(sX);
2410
2411 sVec = GetSubString(sVec, nSpace + 1, GetStringLength(sVec) - nSpace);
2412 nSpace = FindSubString(sVec, " ");
2413 sY = GetSubString(sVec, 0, nSpace - 1);
2414 //SpeakString(sY);
2415
2416 sVec = GetSubString(sVec, nSpace + 1, GetStringLength(sVec) - nSpace);
2417 nSpace = FindSubString(sVec, ")");
2418 sZ = GetSubString(sVec, 0, nSpace);
2419 //SpeakString(sZ);
2420
2421 vVec = Vector(StringToFloat(sX), StringToFloat(sY), StringToFloat(sZ));
2422
2423 return vVec;
2424}
2425
2426void HSS_PCTools_StorePersistentData(object oObject, string sVarName, string sDB, int nDataType, string sValue, int nExpiration = 0, int nStorageType = HSS_PCTOOLS_DBTYPE)
2427{
2428 switch (nStorageType)
2429 {
2430 //NWNX
2431 case 1:
2432 //uncomment these calls if using NWNX or write your own calls.
2433 switch (nDataType)
2434 {
2435 case HSS_PC_TOOLS_INT:
2436 SetPersistentInt(oObject, sVarName, StringToInt(sValue), nExpiration, HSS_NWNX_TABLE);
2437 break;
2438
2439 case HSS_PC_TOOLS_STRING:
2440 SetPersistentString(oObject, sVarName, sValue, nExpiration, HSS_NWNX_TABLE);
2441 break;
2442
2443 case HSS_PC_TOOLS_FLOAT:
2444 SetPersistentFloat(oObject, sVarName, StringToFloat(sValue), nExpiration, HSS_NWNX_TABLE);
2445 break;
2446
2447 case HSS_PC_TOOLS_LOC:
2448 SetPersistentLocation(oObject, sVarName, HSS_StringToLocation(sValue), nExpiration, HSS_NWNX_TABLE);
2449 break;
2450
2451 case HSS_PC_TOOLS_VEC:
2452 SetPersistentVector(oObject, sVarName, HSS_StringToVector(sValue), nExpiration, HSS_NWNX_TABLE);
2453 break;
2454
2455 case HSS_PC_TOOLS_OBJ:
2456 SetPersistentObject(oObject, sVarName, StringToObject(sValue), nExpiration, HSS_NWNX_OBJ_TABLE);
2457 break;
2458 }
2459
2460 break;
2461
2462 //inventory item persistency
2463 case 2:
2464
2465 switch (nDataType)
2466 {
2467 case HSS_PC_TOOLS_INT:
2468 SetLocalInt(oObject, sVarName, StringToInt(sValue));
2469 break;
2470
2471 case HSS_PC_TOOLS_STRING:
2472 SetLocalString(oObject, sVarName, sValue);
2473 break;
2474
2475 case HSS_PC_TOOLS_FLOAT:
2476 SetLocalFloat(oObject, sVarName, StringToFloat(sValue));
2477 break;
2478
2479 case HSS_PC_TOOLS_LOC:
2480 SetLocalLocation(oObject, sVarName, HSS_StringToLocation(sValue));
2481 break;
2482
2483 case HSS_PC_TOOLS_VEC:
2484 //SetLocalVector(oObject, sVarName, HSS_StringToVector(sValue));
2485 break;
2486
2487 case HSS_PC_TOOLS_OBJ:
2488 SetLocalObject(oObject, sVarName, StringToObject(sValue));
2489 break;
2490 }
2491
2492 break;
2493
2494 //Native DB
2495 default:
2496
2497 switch (nDataType)
2498 {
2499 case HSS_PC_TOOLS_INT:
2500 SetCampaignInt(sDB, sVarName, StringToInt(sValue), oObject);
2501 break;
2502
2503 case HSS_PC_TOOLS_STRING:
2504 SetCampaignString(sDB, sVarName, sValue, oObject);
2505 break;
2506
2507 case HSS_PC_TOOLS_FLOAT:
2508 SetCampaignFloat(sDB, sVarName, StringToFloat(sValue), oObject);
2509 break;
2510
2511 case HSS_PC_TOOLS_LOC:
2512 SetCampaignLocation(sDB, sVarName, HSS_StringToLocation(sValue), oObject);
2513 break;
2514
2515 case HSS_PC_TOOLS_VEC:
2516 SetCampaignVector(sDB, sVarName, HSS_StringToVector(sValue), oObject);
2517 break;
2518
2519 case HSS_PC_TOOLS_OBJ:
2520 StoreCampaignObject(sDB, sVarName, StringToObject(sValue), oObject);
2521 break;
2522 }
2523
2524 break;
2525
2526 }
2527
2528
2529}
2530
2531string HSS_PCTools_RetrievePersistentData(object oObject, string sVarName, string sDB, int nDataType, int nStorageType = HSS_PCTOOLS_DBTYPE)
2532{
2533 string sResult;
2534
2535 switch (nStorageType)
2536 {
2537 //NWNX
2538 case 1:
2539 //uncomment these calls if using NWNX or write your own calls.
2540 switch (nDataType)
2541 {
2542 case HSS_PC_TOOLS_INT:
2543 sResult = IntToString(GetPersistentInt(oObject, sVarName, HSS_NWNX_TABLE));
2544 break;
2545
2546 case HSS_PC_TOOLS_STRING:
2547 sResult = GetPersistentString(oObject, sVarName, HSS_NWNX_TABLE);
2548 break;
2549
2550 case HSS_PC_TOOLS_FLOAT:
2551 sResult = FloatToString(GetPersistentFloat(oObject, sVarName, HSS_NWNX_TABLE));
2552 break;
2553
2554 case HSS_PC_TOOLS_LOC:
2555 sResult = LocationToString(GetPersistentLocation(oObject, sVarName, HSS_NWNX_TABLE));
2556 break;
2557
2558 case HSS_PC_TOOLS_VEC:
2559 sResult = VectorToString(GetPersistentVector(oObject, sVarName, HSS_NWNX_TABLE));
2560 break;
2561
2562 case HSS_PC_TOOLS_OBJ:
2563 sResult = ObjectToString(GetPersistentObject(oObject, sVarName, OBJECT_INVALID, HSS_NWNX_OBJ_TABLE));
2564 break;
2565 }
2566
2567 break;
2568
2569 //inventory item persistency
2570 case 2:
2571
2572 switch (nDataType)
2573 {
2574 case HSS_PC_TOOLS_INT:
2575 sResult = IntToString(GetLocalInt(oObject, sVarName));
2576 break;
2577
2578 case HSS_PC_TOOLS_STRING:
2579 sResult = GetLocalString(oObject, sVarName);
2580 break;
2581
2582 case HSS_PC_TOOLS_FLOAT:
2583 sResult = FloatToString(GetLocalFloat(oObject, sVarName));
2584 break;
2585
2586 case HSS_PC_TOOLS_LOC:
2587 sResult = LocationToString(GetLocalLocation(oObject, sVarName));
2588 break;
2589
2590 case HSS_PC_TOOLS_VEC:
2591 //GetLocalVector(oObject, sVarName);
2592 break;
2593
2594 case HSS_PC_TOOLS_OBJ:
2595 sResult = ObjectToString(GetLocalObject(oObject, sVarName));
2596 break;
2597 }
2598
2599 break;
2600
2601 //Native DB
2602 default:
2603
2604 switch (nDataType)
2605 {
2606 case HSS_PC_TOOLS_INT:
2607 sResult = IntToString(GetCampaignInt(sDB, sVarName, oObject));
2608 break;
2609
2610 case HSS_PC_TOOLS_STRING:
2611 sResult = GetCampaignString(sDB, sVarName, oObject);
2612 break;
2613
2614 case HSS_PC_TOOLS_FLOAT:
2615 sResult = FloatToString(GetCampaignFloat(sDB, sVarName, oObject));
2616 break;
2617
2618 case HSS_PC_TOOLS_LOC:
2619 sResult = LocationToString(GetCampaignLocation(sDB, sVarName, oObject));
2620 break;
2621
2622 case HSS_PC_TOOLS_VEC:
2623 sResult = VectorToString(GetCampaignVector(sDB, sVarName, oObject));
2624 break;
2625
2626 case HSS_PC_TOOLS_OBJ:
2627 sResult = ObjectToString(RetrieveCampaignObject(sDB, sVarName, GetLocation(oObject), OBJECT_INVALID, oObject));
2628 break;
2629 }
2630
2631 break;
2632
2633 }
2634
2635 return sResult;
2636}
2637
2638int HSS_PCTools_IsStringColoured(string sString)
2639{
2640 int nLength = GetStringLength(sString);
2641 int nCount;
2642
2643 while (nCount < nLength)
2644 {
2645 if (GetSubString(sString, nCount, 7) == "<color=")
2646 {
2647 return TRUE;
2648 }
2649
2650 nCount++;
2651 }
2652
2653 return FALSE;
2654}
2655
2656void HSS_PCTools_StartTimer(object oPC, int nTime, string sLabel, string sAlarm)
2657{
2658 SetLocalInt(oPC, "HSS_TIMERS_TOTAL", GetLocalInt(oPC, "HSS_TIMERS_TOTAL") - 1);
2659
2660 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR2 + "######--Timer Notification");
2661
2662 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR1 +
2663 "PC Tools Timer Expired -- Timer " + HSS_PCTOOLS_COLOUR2 +
2664 sLabel + "</c>" + " expired after " + HSS_PCTOOLS_COLOUR2 +
2665 IntToString(nTime) + "</c> minute(s).");
2666
2667 SendMessageToPC(oPC, HSS_PCTOOLS_COLOUR2 + "######--Timer Notification");
2668
2669 if (sAlarm == "P")
2670 {
2671 DisplayGuiScreen(oPC, "SCREEN_HSS_POPUP_MESSAGE", FALSE, "hss_pc_tools_postmsg.xml");
2672 SetGUIObjectText(oPC, "SCREEN_HSS_POPUP_MESSAGE", "HSS_POPUP_MESSAGE", -1, "<color=yellow> TIMER EXPIRED!");
2673 DelayCommand(0.5, SetGUIObjectText(oPC, "SCREEN_HSS_POPUP_MESSAGE", "HSS_POPUP_MESSAGE", -1, "<color=red> TIMER EXPIRED!"));
2674 DelayCommand(1.0, SetGUIObjectText(oPC, "SCREEN_HSS_POPUP_MESSAGE", "HSS_POPUP_MESSAGE", -1, "<color=yellow> TIMER EXPIRED!"));
2675 DelayCommand(1.5, SetGUIObjectText(oPC, "SCREEN_HSS_POPUP_MESSAGE", "HSS_POPUP_MESSAGE", -1, "<color=red> TIMER EXPIRED!"));
2676 DelayCommand(2.0, SetGUIObjectText(oPC, "SCREEN_HSS_POPUP_MESSAGE", "HSS_POPUP_MESSAGE", -1, "<color=yellow> TIMER EXPIRED!"));
2677 }
2678 else
2679 if (sAlarm == "S")
2680 {
2681 FadeToBlack(oPC, FADE_SPEED_FASTEST, 0.2, 16711680);
2682 DelayCommand(1.0, FadeToBlack(oPC, FADE_SPEED_FASTEST, 0.2, 16711680));
2683 }
2684}
2685
2686void HSS_PCTools_DisplayMessageBox(object oPC, string sMsg, int nOkCB, int nCancelCB, int bShowCancel = TRUE, string sOk = "Yes", string sCancel = "No")
2687{
2688 DisplayGuiScreen(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX,
2689 FALSE, HSS_PC_TOOLS_MSG_BOX_XML);
2690 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX, "PC_TOOLS_MSGBOX_TEXT",
2691 -1, sMsg);
2692 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX, 1, "'" + IntToString(nOkCB) + "'");
2693 SetLocalGUIVariable(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX, 2, "'" + IntToString(nCancelCB) + "'");
2694
2695 if (!bShowCancel)
2696 {
2697 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX, "PC_TOOLS_MSGBOX_NO_BUTTON", TRUE);
2698 }
2699 else
2700 {
2701 SetGUIObjectHidden(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX, "PC_TOOLS_MSGBOX_NO_BUTTON", FALSE);
2702 }
2703
2704 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX, "PC_TOOLS_MSGBOX_YES_BUTTON",
2705 -1, sOk);
2706 SetGUIObjectText(oPC, SCREEN_HSS_PC_TOOLS_MSG_BOX, "PC_TOOLS_MSGBOX_No_BUTTON",
2707 -1, sCancel);
2708}