summaryrefslogtreecommitdiff
path: root/npc/other/Global_Functions.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/other/Global_Functions.txt')
-rw-r--r--npc/other/Global_Functions.txt363
1 files changed, 0 insertions, 363 deletions
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt
deleted file mode 100644
index ff5b78b2d..000000000
--- a/npc/other/Global_Functions.txt
+++ /dev/null
@@ -1,363 +0,0 @@
-//===== Hercules Script ======================================
-//= Global Functions
-//===== By: ==================================================
-//= Lupus, kobra_k88
-//===== Current Version: =====================================
-//= 2.18
-//===== Description: =========================================
-//= General script functions.
-//===== Additional Comments: =================================
-//= Added F_ClearJobVar - on getting a new job it clears all Job Quest variables
-//= Removed individual job check functions as they were redundant [kobra_k88]
-//= 1.3 Added Job Change Function for Baby/Normal Classes
-//= 1.3b a fix, due to const.txt change [Lupus]
-//= 1.4 Added Is_Taekwon_Class: Taekwondo, Star Knight(Gladiator),Soul Linker [Lupus]
-//= 1.5 Added clear of Bard Quest variables. 1.5a updated [Lupus]
-//= 1.6 Added F_RandMes, F_SexMes, F_Hi, F_Bye functions [Lupus]
-//= Moved here useful function 'getJobName'
-//= 1.7 Added "F_ItemName" function, added a great sample for "F_ItemName"
-//= 1.8 Added Job Vars clear for Extended classes: TK,SL,SG [Lupus]
-//= 1.9 Added "F_ClearGarbage" func that clears outdated, wasted variables [Lupus]
-//= 1.91 Added "F_SaveQuestSkills","F_Load?Skills" functions [Lupus]
-//= 2.0 Fixed F_Save/LoadQuestSkills functions. Had to split in into 2 vars [Lupus]
-//= 2.01 Added $talk to F_ClearGarbage [Evera]
-//= 2.02 Added $dtsglobalelig and $dts|(1<<6) to F_ClearGarbage [Evera]
-//= 2.03 Added Gunslinger vars to F_ClearJobVar [Lupus]
-//= 2.04 Added dtseligible 2 (becomes MISC_QUEST|128) to F_ClearGarbage [Evera]
-//= 2.05 Book of Devil -> MISC_QUEST|256, clear other Niflheim garbage vars [Lupus]
-//= +more garbage clean
-//= 2.06 Pass to Bio-Lab -> MISC_QUEST|512 [Lupus]
-//= 2.07 Added TK_Q variable clear. 2.08 Added NINJ_Q variable clear [Lupus]
-//= 2.09 Cleared F_ClearGarbage [Lupus]
-//= 2.10 Added F_CheckMaxCount to check count of carrid items. [L0ne_w0lf]
-//= 2.10a Removed function F_CheckMaxCount. Not needed. [L0ne_W0lf]
-//= 2.11 Updated function Job_Change to jobchange based on Upper value. [Paradox924X]
-//= 2.12 Added more unused vars to F_ClearGarbage [Lupus]
-//= 2.13 Added more unused vars to F_ClearGarbage [Lupus]
-//= 2.14 Added old novice variables to F_ClearGarbage. [L0ne_W0lf]
-//= 2.15 Added no unused DTS variables to F_ClearGarbage. [L0ne_W0lf]
-//= 2.16 Added F_GetWeaponType, and F_GetArmorType. [L0ne_W0lf]
-//= 2.17 Renamed 'F_RandMes' to 'F_Rand'. [Euphy]
-//= 2.18 Removed useless 'getJobName' function. [Euphy]
-//= 2.19 Improved 'F_InsertComma' function. [Emistry]
-//============================================================
-
-//////////////////////////////////////////////////////////////////////////////////
-// Returns a number with commas based on precision of digits and custom separator.
-// -- callfunc "F_InsertComma",<number>{,<precision>,<separator>}
-// Examples:
-// callfunc("F_InsertComma",7777777{,<precision>,<separator>}) // returns "7,777,777"
-// callfunc("F_InsertComma",1000000000,3,","}) // returns "1,000,000,000"
-// callfunc("F_InsertComma",1000000000,3,"_"}) // returns "1_000_000_000"
-// callfunc("F_InsertComma",1000000000,4) // returns "10,0000,0000"
-//////////////////////////////////////////////////////////////////////////////////
-function script F_InsertComma {
- .@value = getarg(0);
- .@precision = getarg(1,3);
- .@separator$ = getarg( 2,"," );
-
- .@str$ = ""+.@value;
- .@is_negative = ( .@value < 0 );
-
- .@length = getstrlen( .@str$ ) - .@precision - .@is_negative;
- while ( .@length > 0 ) {
- .@str$ = insertchar( .@str$, .@separator$ , ( .@length + .@is_negative ) );
- .@length -= .@precision;
- }
- return .@str$;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Function that clears job quest variables
-//////////////////////////////////////////////////////////////////////////////////
-
-function script F_ClearJobVar {
- // Misc ---------------------------------
- JBLVL = 0;
- FIRSTAID = 0;
- PLAYDEAD = 0;
- got_bandage = 0;
- got_novnametag = 0;
- // First Class Jobs ---------------------
- job_acolyte_q = 0; job_acolyte_q2 = 0;
- job_archer_q = 0;
- job_magician_q = 0;
- job_merchant_q = 0; job_merchant_q2 = 0; job_merchant_q3 = 0;
- job_sword_q = 0; SWTEST = 0;
- job_thief_q = 0;
- // Super Novice
- SUPNOV_Q = 0;
- // 2-1 Jobs ------------------------------
- ASSIN_Q = 0; ASSIN_Q2 = 0; ASSIN_Q3 = 0;
- BSMITH_Q = 0; BSMITH_Q2 = 0;
- HNTR_Q = 0; HNTR_Q2 = 0;
- KNIGHT_Q = 0; KNIGHT_Q2 = 0;
- PRIEST_Q = 0; PRIEST_Q2 = 0; PRIEST_Q3 = 0;
- WIZ_Q = 0; WIZ_Q2 = 0;
- // 2-2 Jobs ------------------------------
- ROGUE_Q = 0; ROGUE_Q2 = 0;
- ALCH_Q = 0; ALCH_Q2 = 0;
- CRUS_Q = 0;
- MONK_Q = 0; JOB_MONK_C = 0;
- SAGE_Q = 0; SAGE_Q2 = 0;
- DANC_Q = 0;
- BARD_Q = 0;
- // Extended Classes
- TAEK_Q = 0; TK_Q = 0;
- STGL_Q = 0;
- SOUL_Q = 0;
- GUNS_Q = 0;
- NINJ_Q = 0;
- return;
-}
-
-function script F_ClearGarbage {
- // Clear outdated global VARS
- //Clear TURTLE var if the Turtle Islans Quest is already done
- if(TURTLE==20) MISC_QUEST |= 65536;
- if(MISC_QUEST & 65536) TURTLE = 0; //now clear the var if the quest is over
- //Clear previously saved Quest Skills (now it isn't used)
- ADV_QSK = 0;
- ADV_QSK2 = 0;
- //Old Seset Skill Event used to use RES_SKILL var
- RES_SKILL = 0;
- //Here you put outdated variables from your outdated EVENTS
- //e.g. Is XMAS done? Add the EVENT var clearing code here.
-
- //due to bugs in BS quest:
- wizard_m2 = 0;
-
- // Old Novice Ground Variables.
- NEW_MES_FLAG0 = 0;
- NEW_MES_FLAG1 = 0;
- NEW_MES_FLAG2 = 0;
- NEW_MES_FLAG3 = 0;
- NEW_MES_FLAG4 = 0;
- NEW_MES_FLAG5 = 0;
- NEW_LVUP0 = 0;
- NEW_LVUP1 = 0;
- NEW_JOBLVUP = 0;
-
- // Old DTS variables that are no longer used.
- dtseligible = 0;
- MISC_QUEST = MISC_QUEST & ~128;
-
- return;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Used in REBIRTH scripts
-// Class = Internal Class ID
-// BaseJob = Base Job (0..23)
-// Upper : 0 - Default, 1 - Advanced, 2 - Baby
-//////////////////////////////////////////////////////////////////////////////////
-
-function script Job_Change {
- jobchange getarg(0),Upper; //Jobchange based on Upper
- logmes "CLASS CHANGE: " +strcharinfo(0)+ " become a "+jobname(Class);
- return;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// Functions used to spiff up dialoges [Lupus]
-//////////////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Rand"
-//////////////////////////////////////////////////////////////////////////////////
-//returns random argument
-// Example: check F_Bye or F_Hi functions
-// READ AND THINK: You can use it to pick a random number from a list:
-// @itemIDfromList = callfunc("F_Rand",1129,1222,1163,1357,1360,1522,1811,1410);
-
-function script F_Rand {
- return getarg(rand(getargcount()));
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Sex"
-//////////////////////////////////////////////////////////////////////////////////
-//returns 1st argument if female, 2nd argument otherwise
-// Example: mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!");
-
-function script F_SexMes {
- return getarg(Sex);
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Hi"
-//////////////////////////////////////////////////////////////////////////////////
-//returns random HELLO message
-
-function script F_Hi {
- return callfunc("F_Rand","Hi!","Hello!","Good day!","How are you?","Hello there.");
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Bye"
-//////////////////////////////////////////////////////////////////////////////////
-//returns random BYE message
-
-function script F_Bye {
- return callfunc("F_Rand","Bye. See you again.","Later.","Goodbye.","Good luck!","Have a nice day!","Byebye!!!");
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_ItemName"
-//////////////////////////////////////////////////////////////////////////////////
-// Returns expanded item name string
-//Argumentss
-// 0 - Item ID
-// 1 - Element N (0=none,1=Ice,2=Earth,3=Fire,4=Wind)
-// 2 - VVS meter 0...3
-// 3 - Refine
-// Example: mes "Show me your "+callfunc("F_ItemName",1201,1,2,5)+"...";
-// is equal to: mes "Show me your ^000090 +5 VVS Fire Knife ^000000..."
-
-function script F_ItemName {
- if(getarg(3))
- .@t$ += "+"+getarg(3)+" ";
- switch(getarg(2)) {
- case 0: break;
- case 1: .@t$ += "VS "; break;
- case 2: .@t$ += "VVS "; break;
- case 3: .@t$ += "VVVS "; break;
- default: .@t$ += getarg(2)+"xVS "; break;
- }
- switch(getarg(1)) {
- case 1: .@t$ += "Ice "; break;
- case 2: .@t$ += "Earth "; break;
- case 3: .@t$ += "Fire "; break;
- case 4: .@t$ += "Wind "; break;
- default: .@t$ += "Strange "; break;
- }
- return "^000090"+.@t$+getitemname(getarg(0))+"^000000";
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_SaveQuestSkills": Store learnt quest skills
-//////////////////////////////////////////////////////////////////////////////////
-function script F_SaveQuestSkills {
- ADV_QSK = 0; ADV_QSK2 = 0;
- //1st classes quest skills
- for (.@i = 0; .@i < 14; ++.@i) {
- if(getskilllv(144+.@i)) ADV_QSK |= pow(2,.@i);
- }
- //2nd classes quest skills
- for (.@i = 0; .@i < 19; ++.@i) {
- if(getskilllv(1001+.@i)) ADV_QSK2 |= pow(2,.@i);
- }
- return;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Load1Skills": Restore learnt 1st class quest skills
-//////////////////////////////////////////////////////////////////////////////////
-function script F_Load1Skills {
- //1st classes quest skills
- for(.@i = 0; .@i < 14; ++.@i) {
- if(ADV_QSK|pow(2,.@i) == ADV_QSK) skill 144+.@i,1,0;
- }
- ADV_QSK = 0; //Clear var
- return;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Load2Skills": Restore learnt 2nd class quest skills
-//////////////////////////////////////////////////////////////////////////////////
-function script F_Load2Skills {
- //2nd classes quest skills
- for (.@i = 0; .@i < 19; ++.@i) {
- if(ADV_QSK2|pow(2,.@i) == ADV_QSK2) skill 1001+.@i,1,0;
- }
- ADV_QSK2 = 0; //Clear var
- return;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_GetWeaponType": Determine weapon type by view
-//////////////////////////////////////////////////////////////////////////////////
-function script F_GetWeaponType {
- switch(getiteminfo(getarg(0),11)) {
- case 1: return "Dagger"; break;
- case 2: return "One-handed Sword"; break;
- case 3: return "Two-handed Sword"; break;
- case 4: return "One-handed Spear"; break;
- case 5: return "Two-handed Spear"; break;
- case 6: return "One-handed Axe"; break;
- case 7: return "Two-handed Axe"; break;
- case 8: return "Mace"; break;
- //case 9: return "Unused"; break;
- case 10: return "Staff"; break;
- case 11: return "Bow"; break;
- case 12: return "Knuckle"; break;
- case 13: return "Instrument"; break;
- case 14: return "Whip"; break;
- case 15: return "Book"; break;
- case 16: return "Katar"; break;
- case 17: return "Revolver"; break;
- case 18: return "Rifle"; break;
- case 19: return "Gatling gun"; break;
- case 20: return "Shotgun"; break;
- case 21: return "Grenade Launcher"; break;
- case 22: return "Shuriken"; break;
- default: return "Unable to Determine Equip Type"; break;
- }
- end;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_GetArmorType": Determine equipment type by equip location
-//////////////////////////////////////////////////////////////////////////////////
-function script F_GetArmorType {
- switch(getiteminfo(getarg(0),5)) {
- case 001: return "Lower Headgear"; break;
- case 2: return "Weapon"; break;
- case 4: return "Garment"; break;
- case 8: return "Accessory"; break;
- case 16: return "Armor"; break;
- case 32: return "Shield"; break;
- case 64: return "Shoes"; break;
- case 128: return "Accessory"; break;
- case 256: return "Upper Headgear"; break;
- case 512: return "Middle Headgear"; break;
- default: return "Unable to Determine Equip Location"; break;
- }
- end;
-}
-
-// Time calculation Function
-// *********************************************************************
-function script Time2Str {
- .@time_left = getarg(0) - gettimetick(2);
-
- .@Days = .@time_left / 86400;
- .@time_left -= (.@Days * 86400);
- .@Hours = .@time_left / 3600;
- .@time_left -= (.@Hours * 3600);
- .@Minutes = .@time_left / 60;
- .@time_left -= (.@Minutes * 60);
-
- .@Time$ = "";
- if( .@Days > 1 )
- .@Time$ += .@Days + " days, ";
- else if( .@Days > 0 )
- .@Time$ += .@Days + " day, ";
-
- if( .@Hours > 1 )
- .@Time$ += .@Hours + " hours, ";
- else if( .@Hours > 0 )
- .@Time$ += .@Hours + " hour, ";
-
- if( .@Minutes > 1 )
- .@Time$ += .@Minutes + " minutes, ";
- else if( .@Minutes > 0 )
- .@Time$ += .@Minutes + " minute, ";
-
- if( .@time_left > 1 || .@time_left == 0 )
- .@Time$ += .@time_left + " seconds";
- else if( .@time_left == 1 )
- .@Time$ += .@time_left + " second";
-
- return .@Time$;
-}