diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-24 13:47:28 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-24 13:47:28 -0300 |
commit | 9c322449ade0d1952f6ca4dd73cc92413f61ca69 (patch) | |
tree | 1bff0731c4db0790ef57a2d524d739b1241ffa2c /npc/functions | |
parent | 9c649056dc45d39e88036bdb2bb373c477f8571f (diff) | |
parent | 255cf7c47f76a6e2f12fc809473ce513c294dfa4 (diff) | |
download | serverdata-jesusalva/inns.tar.gz serverdata-jesusalva/inns.tar.bz2 serverdata-jesusalva/inns.tar.xz serverdata-jesusalva/inns.zip |
Merge branch 'master' into jesusalva/innsjesusalva/inns
Diffstat (limited to 'npc/functions')
24 files changed, 756 insertions, 376 deletions
diff --git a/npc/functions/RNGesus.txt b/npc/functions/RNGesus.txt index 6883f8f1..7224977c 100644 --- a/npc/functions/RNGesus.txt +++ b/npc/functions/RNGesus.txt @@ -1,16 +1,30 @@ // Evol functions. // Authors: // gumi +// jesusalva // Description: // Randomization helper functions. +// pseudo-fix randomness +// rand2( min, max ) +function script rand2 { + if (getargcount() == 2) { + .@min=getarg(0)*100; + .@max=getarg(1)*100+99; + } else { + .@min=0; + .@max=getarg(0)*100-1; + } + return rand(.@min, .@max)/100; +} + // any(<arg>{, ...<arg>}) // returns one argument randomly function script any { - return getarg(rand(getargcount())); + return getarg(rand2(getargcount())); } @@ -19,7 +33,7 @@ function script any { // returns any member of the array function script any_of { - return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand(getarraysize(getarg(0)) - getarrayindex(getarg(0)))); + return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand2(getarraysize(getarg(0)) - getarrayindex(getarg(0)))); } @@ -54,7 +68,7 @@ function script relative_array_random { set(getelementofarray(getarg(0), 0), .@total_prob); } - .@target_sum = rand(0, .@total_prob); + .@target_sum = rand2(0, .@total_prob); for (.@i = .@initial_index; .@sum < .@target_sum; .@i += 2) { if (.@is_str) { diff --git a/npc/functions/barber.txt b/npc/functions/barber.txt index 370285b7..1df0a307 100644 --- a/npc/functions/barber.txt +++ b/npc/functions/barber.txt @@ -108,3 +108,18 @@ function script BarberChangeColor { return; } + +function script BarberChangeGender { + mesn("Warning"); + mes(b(l("Changing your gender will send you back to the character selection screen."))); + next(); + + mes(l("Please select the desired gender:")); + menuint( + l("Female"), GENDER_FEMALE, + l("Male"), GENDER_MALE, + l("Non-binary"), GENDER_HIDDEN); + + Gender = @menuret; + return; +} diff --git a/npc/functions/fishing.txt b/npc/functions/fishing.txt index dcf4ac02..fee0acb7 100644 --- a/npc/functions/fishing.txt +++ b/npc/functions/fishing.txt @@ -44,8 +44,7 @@ OnBite: OnCleanUp: dispbottom l("You waited too long and lost the bait..."); specialeffect(getvariableofnpc(.failure_fx, @fishing_spot$), SELF, playerattached()); // event fail -OnPCLogoutEvent: - fishing_cleanup @fishing_spot$; + fishing_cleanup(@fishing_spot$); @fishing_spot$ = ""; // unbind fishing npc end; } diff --git a/npc/functions/gender.txt b/npc/functions/gender.txt new file mode 100644 index 00000000..0f153c53 --- /dev/null +++ b/npc/functions/gender.txt @@ -0,0 +1,13 @@ +function script stringToGender { + .@short$ = strtolower(charat(getarg(0, ""), 0)); + + return .@short$ == "f" ? GENDER_FEMALE : + .@short$ == "m" ? GENDER_MALE : GENDER_HIDDEN; +} + +function script genderToString { + .@gender = getarg(0, Gender); + + return .@gender == GENDER_FEMALE ? l("female") : + .@gender == GENDER_MALE ? l("male") : l("non-binary"); +} diff --git a/npc/functions/global_event_handler.txt b/npc/functions/global_event_handler.txt new file mode 100644 index 00000000..c66637ef --- /dev/null +++ b/npc/functions/global_event_handler.txt @@ -0,0 +1,65 @@ +// The Mana World scripts. +// Author: +// The Mana World Team +// Description: +// Controls most, if not all, global events on this server. +// Please only use callfunc("") here; This script is loaded +// early on and direct function assignment will cause fails. +// TODO: Move "new quest" notification here. (Or deprecate) + +// Helper function for scripted Monster Kills. +function script fix_mobkill { + killedrid=getarg(0); + doevent "#GlobalHandler::OnNPCKillEvent"; + return; +} + +- script #GlobalHandler NPC_HIDDEN,{ + end; + + +OnPCLoginEvent: + callfunc("updateSpotlight"); + callfunc("ReceiveMOTD"); + callfunc("ReceiveScheduledBroadcast"); + callfunc("FixBankVault"); + callfunc("GrantSuperSkill"); + end; + +OnPCLogoutEvent: + callfunc("UnequipCookie"); + callfunc("MundaneLogout"); + callfunc("fishing_cleanup", @fishing_spot$); + + // Variable cleanup + @fishing_spot$ = ""; + end; + +OnPCDieEvent: + callfunc("ForcedUnmount"); + callfunc("MundaneDeath"); + end; + +OnPCBaseLvUpEvent: + //callfunc("newquestwarning"); + end; + +OnNPCKillEvent: + $MONSTERS_KILLED+=1; + MONSTERS_KILLED+=1; + callfunc("EnoraKills"); + if ($MONSTERS_KILLED % 1000000 == 0) + callfunc("GetBeanieCopter"); + end; + +OnPCKillEvent: + $PLAYERS_KILLED+=1; + PLAYERS_KILLED+=1; + end; + +OnSkillInvoke: + callfunc("SkillInvoked"); + end; + +} + diff --git a/npc/functions/inventoryplace.txt b/npc/functions/inventoryplace.txt index 4a5e08ca..c7eff88b 100644 --- a/npc/functions/inventoryplace.txt +++ b/npc/functions/inventoryplace.txt @@ -13,7 +13,7 @@ function script inventoryplace { if (.@argc % 2 != 0) { - debugmes "inventoryplace: Wrong argument count."; + consolemes(CONSOLEMES_ERROR, "inventoryplace: Wrong argument count."); close; } diff --git a/npc/functions/main.txt b/npc/functions/main.txt index e31b02d0..c8a37b1c 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -146,7 +146,7 @@ function script speech { // Show debug message if .debug variable of NPC is set to 1 function script npcdebug { if (getvariableofnpc(.debug, strnpcinfo(3))) - debugmes strnpcinfo(3) + ": " + getarg(0); + consolemes(CONSOLEMES_DEBUG, strnpcinfo(3) + ": " + getarg(0)); return; } diff --git a/npc/functions/manhole.txt b/npc/functions/manhole.txt index 54449d78..3af18537 100644 --- a/npc/functions/manhole.txt +++ b/npc/functions/manhole.txt @@ -59,7 +59,7 @@ function script manhole_interact { // Would be nice to customize but not needed atm // 1 mob for every 30 levels (level 99 players spawn 4 mobs) // Note that food type is currently disregarded (and it accepts any healing item) - .@monsterId=any(slime, Croc, LittleBlub, CaveMaggot); + .@monsterId=any(Slime, Croc, LittleBlub, CaveMaggot); .@mobGID = monster(.@m$, .@x, .@y, strmobinfo(1, .@monsterId), .@monsterId, (BaseLevel/30)+1); unitattack(.@mobGID, getcharid(CHAR_ID_ACCOUNT)); // "It's not aggressive"? We don't care. } diff --git a/npc/functions/marriage.txt b/npc/functions/marriage.txt deleted file mode 100644 index d9e48bf5..00000000 --- a/npc/functions/marriage.txt +++ /dev/null @@ -1,293 +0,0 @@ -// Evol functions. -// Author: -// 4144 -// Description: -// Functions for marriage - -// check is player is near marriage npc -// args: -// 0 - player name -// returns: -// true if player located near npc. -function script marriagecheckname { - .@name$ = getarg(0); - if (.@name$ == "") - { - // no other registrand - return false; - } - .@id = getcharid(0, .@name$); - .@accoundId = getcharid(3, .@name$); - if (isloggedin(.@accoundId, .@id) == false) - { - // registrant not logged in - return false; - } - getmapxy(.@mapname$, .@x, .@y, 0, .@name$); - if (.@mapname$ != strnpcinfo(4)) - { - // registrant on other map - return false; - } - if (distance(.@x, .@y, .x, .y) > .distance) - { - // registrant too far - return false; - } - return true; -} - -// return player name registered with same gender like attached player -function script getmarriageregistrant { - if (Sex) - { - .@name$ = getvariableofnpc(.maleName$, strnpcinfo(3)); - } - else - { - .@name$ = getvariableofnpc(.femaleName$, strnpcinfo(3)); - } - return .@name$; -} - -// return registered marriage partner name -function script getmarriagepartner { - if (Sex) - { - .@name$ = getvariableofnpc(.femaleName$, strnpcinfo(3)); - } - else - { - .@name$ = getvariableofnpc(.maleName$, strnpcinfo(3)); - } - if (marriagecheckname(.@name$)) - return .@name$; - return ""; -} - -// register attached player as partner for marriage -function script marriageregisterself { - if (Sex) - { - set getvariableofnpc(.maleName$, strnpcinfo(3)), strcharinfo(0); - set getvariableofnpc(.maleName_partner$, strnpcinfo(3)), ""; - } - else - { - set getvariableofnpc(.femaleName$, strnpcinfo(3)), strcharinfo(0); - set getvariableofnpc(.femaleName_partner$, strnpcinfo(3)), ""; - } - return; -} - -// return player name what was accepted by partner -function script getmarriagepartneraccepted { - if (Sex) - { - .@name$ = getvariableofnpc(.femaleName_partner$, strnpcinfo(3)); - } - else - { - .@name$ = getvariableofnpc(.maleName_partner$, strnpcinfo(3)); - } - return .@name$; -} - -// return true if partner present near and partner accepted you -function script ismarriagepartneraccepted { - .@partner$ = getmarriagepartner(); - if (.@partner$ == "") - return false; - .@name$ = getmarriagepartneraccepted(); - if (.@name$ == strcharinfo(0)) - return true; - return false; -} - -// accept for attached player his/her partner -// args: -// 0 - partner name -function script marriageacceptpartner { - .@name$ = getarg(0); - if (Sex) - { - set getvariableofnpc(.maleName_partner$, strnpcinfo(3)), .@name$; - } - else - { - set getvariableofnpc(.femaleName_partner$, strnpcinfo(3)), .@name$; - } - return; -} - -function script askmarry { - speech l("Do you want to marry @@?", getarg(0)); - if (askyesno() == ASK_YES) - return true; - return false; -} - -// start marriage registration process -function script marriageregister { - .@partner$ = getmarriagepartner(); - if (.@partner$ == "") - { // no partner registered - speech l("Ok I add your name... @@...", strcharinfo(0)); - marriageregisterself(); - next; - speech lg("Now wait for your partner, then talk to me again."); - npctalk l("@@ registered for marriage. Waiting for partner...", strcharinfo(0)); - close; - } - else - { // partner already registered - if (askmarry(.@partner$) == true) - { - marriageregisterself(); - marriageacceptpartner(.@partner$); - npctalk l("@@ registered for marriage and accepted partner @@!", strcharinfo(0), .@partner$); - npctalk l("Waiting for @@...", .@partner$); - close; - } - else - { - close; - } - } - return; -} - -// remove all marriage registations -function script marriageclear { - set getvariableofnpc(.maleName$, strnpcinfo(3)), ""; - set getvariableofnpc(.femaleName$, strnpcinfo(3)), ""; - set getvariableofnpc(.maleName_partner$, strnpcinfo(3)), ""; - set getvariableofnpc(.femaleName_partner$, strnpcinfo(3)), ""; - return; -} - -// do actual marriage -function script domarriage { - .@name$ = strcharinfo(0); - .@partner$ = getarg(0); - if (marriage(.@partner$)) - { - speech l("You got married to @@!", .@partner$); - npctalk l("@@ and @@ just got married!", .@name$, .@partner$); - } - else - { - npctalk l("Marriage failed."); - } - marriageclear(); - return; -} - -// marry main code -function script marriagemarry { - .@registrant$ = getmarriageregistrant(); - if (marriagecheckname(.@registrant$) == true) - { - if (.@registrant$ == strcharinfo(0)) - { - if (ismarriagepartneraccepted()) - { - .@partner$ = getmarriagepartner(); - if (marriagecheckname(.@partner$) == false) - { - speech l("Partner not ready."); - } - else if (askmarry(.@partner$) == true) - { - domarriage(.@partner$); - } - } - else - { - speech l("You already registered. Waiting for your partner..."); - } - } - else - { - speech l("Sorry, I'm busy with other registrations."), - l("Come after a little while."); - } - close; - } - - speech l("What can I do for you?"); - switch (select(l("I want to register for marriage."), - l("Nothing"))) - { - case 1: - marriageregister; - break; - case 2: - break; - } - return; -} - -// divorce main code -function script marriagedivorce { - speech l("What can I do for you?"); - switch (select(l("I want to divorce."), - l("Nothing"))) - { - case 1: - speech lg("Are you sure?"); - if (askyesno() == ASK_YES) - { - if (divorce()) - { - speech l("You are now divorced!"), - l("Good look."); - npctalk l("@@ divorced!", strcharinfo(0)); - } - else - { - speech l("Divorce error!"); - } - } - break; - case 2: - break; - } - return; -} - -// main function for marriage -function script marriagemain { - if (Sex > 1) - { - speech l("Sorry i can't help you. Go away!"); - close; - } - - if (getpartnerid() != 0) - { // have partner - marriagedivorce(); - } - else - { // no partner - marriagemarry(); - } - - return; -} - -// check registration list by timer -function script marriagecheck { - .@name$ = getvariableofnpc(.maleName$, strnpcinfo(3)); - if (.@name$ != "" && marriagecheckname(.@name) == false) - { - set getvariableofnpc(.maleName$, strnpcinfo(3)), ""; - set getvariableofnpc(.maleName_partner$, strnpcinfo(3)), ""; - } - .@name$ = getvariableofnpc(.femaleName$, strnpcinfo(3)); - if (.@name$ != "" && marriagecheckname(.@name) == false) - { - set getvariableofnpc(.femaleName$, strnpcinfo(3)), ""; - set getvariableofnpc(.femaleName_partner$, strnpcinfo(3)), ""; - } -} diff --git a/npc/functions/masks.txt b/npc/functions/masks.txt index 9fb54919..4b28bfc7 100644 --- a/npc/functions/masks.txt +++ b/npc/functions/masks.txt @@ -1,68 +1,43 @@ // Evol functions. // Author: // Reid +// Jesusalva // Description: // Triggers functions to add and remove masks. // Variables: -// none +// 4 - Top Mask +// 8 - Bottom Mask +// Default mask: 13 (Top + Bottom + Display mask) // Artis Aemil's Legion -function script artisALRemTopMask { - if ((getareausers("001-2-33", 23, 27, 45, 31) >= 1) || - (getareausers("001-2-33", 23, 32, 26, 38) >= 1) || - (getareausers("001-2-33", 42, 32, 45, 38) >= 1)) - { - removemapmask "001-2-33", 4; - } +function script artisALResetMask { + .@m=getmapmask("001-2-33"); + sendmapmask(.@m); return 0; } -function script artisALAddTopMask { - if ((getareausers("001-2-33", 23, 27, 45, 31) == 0) && - (getareausers("001-2-33", 23, 32, 26, 38) == 0) && - (getareausers("001-2-33", 42, 32, 45, 38) == 0)) - { - addmapmask "001-2-33", 4; - } +function script artisALTopMask { + addtimer 30, "artisALTopMaskDO::OnDoIt"; return 0; } -function script artisALRemBotMask { - if (getareausers("001-2-33", 23, 32, 45, 46) >= 1) - { - removemapmask "001-2-33", 8; - } +function script artisALBottomMask { + addtimer 30, "artisALBottomMaskDO::OnDoIt"; return 0; } -function script artisALAddBotMask { - if (getareausers("001-2-33", 23, 32, 45, 46) == 0) - { - addmapmask "001-2-33", 8; - } - return 0; +// Show bottom mask is the same as hiding top mask +- script artisALBottomMaskDO NPC_HIDDEN,{ +OnDoIt: + .@m=getmapmask("001-2-33"); + sendmapmask(.@m^4); } -function script artisALUpdateMask { - if (getareausers("001-2-33", 23, 32, 45, 46) >= 1) - { - removemapmask "001-2-33", 8; - } - else - { - addmapmask "001-2-33", 8; - } - if ((getareausers("001-2-33", 23, 27, 45, 31) >= 1) || - (getareausers("001-2-33", 23, 32, 26, 38) >= 1) || - (getareausers("001-2-33", 42, 32, 45, 38) >= 1)) - { - removemapmask "001-2-33", 4; - } - else - { - addmapmask "001-2-33", 4; - } - - return 0; +// Show top mask is the same as hiding bottom mask +- script artisALTopMaskDO NPC_HIDDEN,{ +OnDoIt: + .@m=getmapmask("001-2-33"); + sendmapmask(.@m^8); } + diff --git a/npc/functions/math.txt b/npc/functions/math.txt index 004125c7..357407da 100644 --- a/npc/functions/math.txt +++ b/npc/functions/math.txt @@ -2,6 +2,7 @@ // Authors: // 4144 // Reid +// Jesusalva // Description: // Math functions @@ -38,3 +39,12 @@ function script lognbaselvl { return .@ret; } + + +// result is: lower < target <= higher +// is_between ( lower, higher, target) +function script is_between { + .@val=getarg(2); + return (getarg(0) < .@val && getarg(1) >= .@val); +} + diff --git a/npc/functions/npcmovegraph.txt b/npc/functions/npcmovegraph.txt index d03f15c5..54e4e783 100644 --- a/npc/functions/npcmovegraph.txt +++ b/npc/functions/npcmovegraph.txt @@ -35,12 +35,12 @@ function script initmovegraph { function script findmovegraphlabel { if (!getargcount()) { - debugmes "findmovegraphlabel: no argument"; + consolemes(CONSOLEMES_DEBUG, "findmovegraphlabel: no argument"); return -1; } if (!isstr(getarg(0))) { - debugmes "findmovegraphlabel: need string argument"; + consolemes(CONSOLEMES_DEBUG, "findmovegraphlabel: need string argument"); return -1; } @@ -144,7 +144,7 @@ function script execmovecmd { } else { - debugmes "execmovecmd: unknown WARP destination label: " + .@cmd$[1]; + consolemes(CONSOLEMES_DEBUG, "execmovecmd: unknown WARP destination label: " + .@cmd$[1]); } } else if (.@cmd$[0] == "call") @@ -152,7 +152,7 @@ function script execmovecmd { switch (getarraysize(.@cmd$)) { case 1: - debugmes "execmovecmd: CALL command needs some parameters"; + consolemes(CONSOLEMES_DEBUG, "execmovecmd: CALL command needs some parameters"); return 0; case 2: return callfunc(.@cmd$[1]); @@ -176,7 +176,7 @@ function script execmovecmd { else if (.@cmd$[0] == "debugmes") { deletearray .@cmd$[0], 1; - debugmes implode(.@cmd$, " "); + consolemes(CONSOLEMES_DEBUG, implode(.@cmd$, " ")); } else if (.@cmd$[0] == "flags") { @@ -196,7 +196,7 @@ function script execmovecmd { } else { - debugmes "Unknown move graph cmd: " + .@cmd$[0]; + consolemes(CONSOLEMES_DEBUG, "Unknown move graph cmd: " + .@cmd$[0]); } return 0; } @@ -226,7 +226,7 @@ function script getnextmovecmd { function script getrandompoint { if (getargcount() < 4) { - debugmes "error: getrandompoint(x1, y1, x2, y2) takes 4 arguments"; + consolemes(CONSOLEMES_DEBUG, "error: getrandompoint(x1, y1, x2, y2) takes 4 arguments"); return -1; } @@ -264,7 +264,7 @@ function script getrandompoint { goto L_Found; // finally, if we don't find anything - debugmes "error: getrandompoint: cannot find walkable cell in rectangle [(" + .@x1 + "," + .@y1 + ") , (" + .@x2 + "," + .@y2 + ")]"; + consolemes(CONSOLEMES_DEBUG, "error: getrandompoint: cannot find walkable cell in rectangle [(" + .@x1 + "," + .@y1 + ") , (" + .@x2 + "," + .@y2 + ")]"); return -1; L_Found: @@ -282,7 +282,7 @@ L_Found: function script mg_npcwalkto { if (getargcount() < 2) { - debugmes "usage: mg_npcwalkto(x1,y1[,x2,y2])"; + consolemes(CONSOLEMES_DEBUG, "usage: mg_npcwalkto(x1,y1[,x2,y2])"); return -1; } diff --git a/npc/functions/permissions.txt b/npc/functions/permissions.txt index 62e0da6b..96e69fde 100644 --- a/npc/functions/permissions.txt +++ b/npc/functions/permissions.txt @@ -31,5 +31,5 @@ function script is_evtc { // game master function script is_gm { return is_admin(getarg(0, getcharid(CHAR_ID_ACCOUNT))) || - has_permission("send_gm", getarg(0, getcharid(CHAR_ID_ACCOUNT))); + can_use_command("@jail", getarg(0, getcharid(CHAR_ID_ACCOUNT))); } diff --git a/npc/functions/quest-debug/006-ShipQuests_ArpanMoney.txt b/npc/functions/quest-debug/006-ShipQuests_ArpanMoney.txt index 00e2fbea..0f77c1b9 100644 --- a/npc/functions/quest-debug/006-ShipQuests_ArpanMoney.txt +++ b/npc/functions/quest-debug/006-ShipQuests_ArpanMoney.txt @@ -15,7 +15,8 @@ function script QuestDebug6 { GenericQuestDebug ShipQuests_ArpanMoney, l("Does not have the quest"), 0, l("Elmo told about money"), 1, - l("Arpan gave money"), 2; + l("Arpan gave money"), 2, + l("Arpan gave clothes"), 3; if (@menuret < 0) { diff --git a/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt b/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt index 68ba67fe..bda45b90 100644 --- a/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt +++ b/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt @@ -14,7 +14,8 @@ function script QuestDebug32 { GenericQuestDebug ArtisQuests_MonaDad, l("Does not have the quest"), 0, - l("Mona's dad is missing"), 1; + l("Mona's dad is missing"), 1, + l("Mona's dad was rescued"), 3; if (@menuret < 0) { diff --git a/npc/functions/quest-debug/033-Artis_Legion_Progress.txt b/npc/functions/quest-debug/033-Artis_Legion_Progress.txt index c4ea5558..ff6f1d16 100644 --- a/npc/functions/quest-debug/033-Artis_Legion_Progress.txt +++ b/npc/functions/quest-debug/033-Artis_Legion_Progress.txt @@ -19,7 +19,8 @@ function script QuestDebug33 { l("Finished training"), 2, l("Sent to battle"), 3, l("Finished battle"), 4, - l("Sent to Q'Anon"), 5; + l("Sent to Q'Anon"), 5, + l("Indefinite Traning"), 6; if (@menuret < 0) { diff --git a/npc/functions/quest-debug/034-ArtisQuests_TrainingLegion.txt b/npc/functions/quest-debug/034-ArtisQuests_TrainingLegion.txt new file mode 100644 index 00000000..ba72fd07 --- /dev/null +++ b/npc/functions/quest-debug/034-ArtisQuests_TrainingLegion.txt @@ -0,0 +1,28 @@ +// Training Legion quest +// Authors: +// omatt + +function script QuestDebug34 { + do + { + clear; + setnpcdialogtitle l("Quest debug"); + mes "ArtisQuests_TrainingLegion"; + mes "---"; + mes l("Quest state: @@", getq(ArtisQuests_TrainingLegion)); + next; + + GenericQuestDebug ArtisQuests_TrainingLegion, + l("Does not have the quest"), 0, + l("Finished sword training"), 1, + l("Finished bow training"), 2, + l("Both sword and bow training are finished"), 3, + l("Skill training finished, end of quest"), 4; + + if (@menuret < 0) + { + return; + } + + } while (1); +} diff --git a/npc/functions/quest-debug/042-General_Brotherhood.txt b/npc/functions/quest-debug/042-General_Brotherhood.txt new file mode 100644 index 00000000..3eb3683b --- /dev/null +++ b/npc/functions/quest-debug/042-General_Brotherhood.txt @@ -0,0 +1,27 @@ +// Mona quest debug +// Authors: +// gumi +// monwarez +// jesusalva + +function script QuestDebug42 { + do + { + clear; + setnpcdialogtitle l("Quest debug"); + mes "General_Brotherhood"; + mes "---"; + mes l("Quest state: @@", getq(General_Brotherhood)); + next; + + GenericQuestDebug General_Brotherhood, + l("Does not have the quest"), 0, + l("Contacted by Sopiahalla"), 1; + + if (@menuret < 0) + { + return; + } + + } while (1); +} diff --git a/npc/functions/scoreboards.txt b/npc/functions/scoreboards.txt new file mode 100644 index 00000000..0dd54b23 --- /dev/null +++ b/npc/functions/scoreboards.txt @@ -0,0 +1,218 @@ +// Moubootaur Legends Script +// Author: +// Jesusalva +// Description: +// Leaderboards + +// Scoreboard functions +function script HallOfGuild { + mes ""; + mes l("##BHall Of Guild Level: TOP5##b"); + mesf("1. %s (%d)", $@hoguild_name$[0], $@hoguild_value[0]); + mesf("2. %s (%d)", $@hoguild_name$[1], $@hoguild_value[1]); + mesf("3. %s (%d)", $@hoguild_name$[2], $@hoguild_value[2]); + mesf("4. %s (%d)", $@hoguild_name$[3], $@hoguild_value[3]); + mesf("5. %s (%d)", $@hoguild_name$[4], $@hoguild_value[4]); + return; +} + +function script HallOfFortune { + mes ""; + mes l("##BHall Of Fortune: TOP15##b"); + mesf("1. %s (%s E)", $@hofortune_name$[0],format_number($@hofortune_value[0])); + mesf("2. %s (%s E)", $@hofortune_name$[1],format_number($@hofortune_value[1])); + mesf("3. %s (%s E)", $@hofortune_name$[2],format_number($@hofortune_value[2])); + mesf("4. %s (%s E)", $@hofortune_name$[3],format_number($@hofortune_value[3])); + mesf("5. %s (%s E)", $@hofortune_name$[4],format_number($@hofortune_value[4])); + mesf("6. %s (%s E)", $@hofortune_name$[5],format_number($@hofortune_value[5])); + mesf("7. %s (%s E)", $@hofortune_name$[6],format_number($@hofortune_value[6])); + mesf("8. %s (%s E)", $@hofortune_name$[7],format_number($@hofortune_value[7])); + mesf("9. %s (%s E)", $@hofortune_name$[8],format_number($@hofortune_value[8])); + mesf("10. %s (%s E)", $@hofortune_name$[9],format_number($@hofortune_value[9])); + mesf("11. %s (%s E)", $@hofortune_name$[10],format_number($@hofortune_value[10])); + mesf("12. %s (%s E)", $@hofortune_name$[11],format_number($@hofortune_value[11])); + mesf("13. %s (%s E)", $@hofortune_name$[12],format_number($@hofortune_value[12])); + mesf("14. %s (%s E)", $@hofortune_name$[13],format_number($@hofortune_value[13])); + mesf("15. %s (%s E)", $@hofortune_name$[14],format_number($@hofortune_value[14])); + return; +} + +function script HallOfLevel { + mes ""; + mes l("##BHall Of Level: TOP15##b"); + mesf("1. %s (%d)", $@hoblvl_name$[0], $@hoblvl_value[0]); + mesf("2. %s (%d)", $@hoblvl_name$[1], $@hoblvl_value[1]); + mesf("3. %s (%d)", $@hoblvl_name$[2], $@hoblvl_value[2]); + mesf("4. %s (%d)", $@hoblvl_name$[3], $@hoblvl_value[3]); + mesf("5. %s (%d)", $@hoblvl_name$[4], $@hoblvl_value[4]); + mesf("6. %s (%d)", $@hoblvl_name$[5], $@hoblvl_value[5]); + mesf("7. %s (%d)", $@hoblvl_name$[6], $@hoblvl_value[6]); + mesf("8. %s (%d)", $@hoblvl_name$[7], $@hoblvl_value[7]); + mesf("9. %s (%d)", $@hoblvl_name$[8], $@hoblvl_value[8]); + mesf("10. %s (%d)", $@hoblvl_name$[9], $@hoblvl_value[9]); + mesf("11. %s (%d)", $@hoblvl_name$[10], $@hoblvl_value[10]); + mesf("12. %s (%d)", $@hoblvl_name$[11], $@hoblvl_value[11]); + mesf("13. %s (%d)", $@hoblvl_name$[12], $@hoblvl_value[12]); + mesf("14. %s (%d)", $@hoblvl_name$[13], $@hoblvl_value[13]); + mesf("15. %s (%d)", $@hoblvl_name$[14], $@hoblvl_value[14]); + return; +} + +function script HallOfJob { + mes ""; + mes l("##BHall Of Job Level: TOP15##b"); + mesf("1. %s (%d)", $@hojlvl_name$[0], $@hojlvl_value[0]); + mesf("2. %s (%d)", $@hojlvl_name$[1], $@hojlvl_value[1]); + mesf("3. %s (%d)", $@hojlvl_name$[2], $@hojlvl_value[2]); + mesf("4. %s (%d)", $@hojlvl_name$[3], $@hojlvl_value[3]); + mesf("5. %s (%d)", $@hojlvl_name$[4], $@hojlvl_value[4]); + mesf("6. %s (%d)", $@hojlvl_name$[5], $@hojlvl_value[5]); + mesf("7. %s (%d)", $@hojlvl_name$[6], $@hojlvl_value[6]); + mesf("8. %s (%d)", $@hojlvl_name$[7], $@hojlvl_value[7]); + mesf("9. %s (%d)", $@hojlvl_name$[8], $@hojlvl_value[8]); + mesf("10. %s (%d)", $@hojlvl_name$[9], $@hojlvl_value[9]); + mesf("11. %s (%d)", $@hojlvl_name$[10], $@hojlvl_value[10]); + mesf("12. %s (%d)", $@hojlvl_name$[11], $@hojlvl_value[11]); + mesf("13. %s (%d)", $@hojlvl_name$[12], $@hojlvl_value[12]); + mesf("14. %s (%d)", $@hojlvl_name$[13], $@hojlvl_value[13]); + mesf("15. %s (%d)", $@hojlvl_name$[14], $@hojlvl_value[14]); + return; +} + +function script HallOfAcorns { + mes ""; + mes l("##BHall Of Acorns: TOP15##b"); + mesc l("Only %s in storage will be counted.", getitemlink(Acorn)); + mesf("1. %s (%d)", $@hoa_name$[0], $@hoa_value[0]); + mesf("2. %s (%d)", $@hoa_name$[1], $@hoa_value[1]); + mesf("3. %s (%d)", $@hoa_name$[2], $@hoa_value[2]); + mesf("4. %s (%d)", $@hoa_name$[3], $@hoa_value[3]); + mesf("5. %s (%d)", $@hoa_name$[4], $@hoa_value[4]); + mesf("6. %s (%d)", $@hoa_name$[5], $@hoa_value[5]); + mesf("7. %s (%d)", $@hoa_name$[6], $@hoa_value[6]); + mesf("8. %s (%d)", $@hoa_name$[7], $@hoa_value[7]); + mesf("9. %s (%d)", $@hoa_name$[8], $@hoa_value[8]); + mesf("10. %s (%d)", $@hoa_name$[9], $@hoa_value[9]); + mesf("11. %s (%d)", $@hoa_name$[10], $@hoa_value[10]); + mesf("12. %s (%d)", $@hoa_name$[11], $@hoa_value[11]); + mesf("13. %s (%d)", $@hoa_name$[12], $@hoa_value[12]); + mesf("14. %s (%d)", $@hoa_name$[13], $@hoa_value[13]); + mesf("15. %s (%d)", $@hoa_name$[14], $@hoa_value[14]); + return; +} + +// HallOfGame() +function script HallOfGame { + if ($MOST_HEROIC$) + mes l("World hero: %s", $MOST_HEROIC$); + + if ($TREE_PLANTED) + mes l("Planted Trees: %s", format_number($TREE_PLANTED)); // FIXME + + mes l("Players Killed in PvP: %s", format_number($PLAYERS_KILLED)); + mes l("Monsters Killed in PvE: %s", format_number($MONSTERS_KILLED)); + mes ""; + .@s$=(season_direction() == WINTER ? l("Winter") : .@s$); + .@s$=(season_direction() == AUTUMN ? l("Autumn") : .@s$); + .@s$=(season_direction() == SUMMER ? l("Summer") : .@s$); + .@s$=(season_direction() == SPRING ? l("Spring") : .@s$); + mes l("Current Season: %s", .@s$); + // weather ; game time ; world story ; etc. + mes ""; + mes l("Notable mentions and thanks for our [@@https://www.patreon.com/themanaworld|sponsors@@] for their continued support."); + mes ""; + return; +} + + +// Main script handler for scoreboards +- script @scoreboard NPC_HIDDEN,{ + end; +OnHour00: +OnHour01: +OnHour02: +OnHour03: +OnHour04: +OnHour05: +OnHour06: +OnHour07: +OnHour08: +OnHour09: +OnHour10: +OnHour11: +OnHour12: +OnHour13: +OnHour14: +OnHour15: +OnHour16: +OnHour17: +OnHour18: +OnHour19: +OnHour20: +OnHour21: +OnHour22: +OnHour23: +OnInit: + consolemes(CONSOLEMES_DEBUG, "Reloading scoreboards..."); + .@nb = query_sql("select name, zeny from `char` ORDER BY zeny DESC LIMIT 15", $@hofortune_name$, $@hofortune_value); + .@nb = query_sql("select name, base_level from `char` ORDER BY base_level DESC LIMIT 15", $@hoblvl_name$, $@hoblvl_value); + .@nb = query_sql("select name, job_level from `char` ORDER BY job_level DESC LIMIT 15", $@hojlvl_name$, $@hojlvl_value); + .@nb = query_sql("select name, guild_lv from `guild` ORDER BY guild_lv DESC LIMIT 5", $@hoguild_name$, $@hoguild_value); + .@nb = query_sql("SELECT c.name, i.amount FROM `storage` AS i, `char` AS c WHERE i.nameid="+Acorn+" AND i.account_id=c.account_id ORDER BY i.amount DESC LIMIT 15", $@hoa_name$, $@hoa_value); + consolemes(CONSOLEMES_DEBUG, "Scoreboards reloaded"); + if (!$@SCOREBOARD_BIND) { + bindatcmd "scoreboard", "@scoreboard::OnCall", 0, 100, 0; + bindatcmd "scoreboards", "@scoreboard::OnCall", 0, 100, 0; + $@SCOREBOARD_BIND=true; + } + end; + +OnCall: + do { + clear; + //HallOfSponsor(true); + mes l("The Mana World - rEvolt"); + mesc l("All scoreboards are updated hourly."), 1; + mes ""; + select + l("Hall Of Fortune"), + l("Hall Of Base Level"), + l("Hall Of Job Level"), + l("Hall Of Guilds"), + l("Hall Of Acorns"), + l("Game Statistics"), + l("Quit"); + mes ""; + switch (@menu) { + case 1: + HallOfFortune(); + next; + break; + case 2: + HallOfLevel(); + next; + break; + case 3: + HallOfJob(); + next; + break; + case 4: + HallOfGuild(); + next; + break; + case 5: + HallOfAcorns(); + next; + break; + case 6: + HallOfGame(); + next; + break; + default: + close; + } + } while (true); + end; +} + + diff --git a/npc/functions/skills.txt b/npc/functions/skills.txt new file mode 100644 index 00000000..568c97d9 --- /dev/null +++ b/npc/functions/skills.txt @@ -0,0 +1,13 @@ +// The Mana World scripts. +// Author: +// The Mana World Team +// Description: +// Controls script-based skills (which are rare); + +function script SkillInvoked { + // Record to database that you used the skill + skillInvoke[@skillId] = skillInvoke[@skillId] + 1; + + return; +} + diff --git a/npc/functions/spotlight.txt b/npc/functions/spotlight.txt new file mode 100644 index 00000000..fb0c697e --- /dev/null +++ b/npc/functions/spotlight.txt @@ -0,0 +1,92 @@ +// Evol functions. +// Author: +// Jesusalva +// Micksha +// Description: +// Update spotlight on caves +// Variables: +// 2 - the darkest mask +// 4 - the average mask +// 8 - the lightest mask + +// forced_update - if set to true, will ignore if the map is known as valid +// (required for instance maps) +// updateSpotlight ( {forced_update} ) +function script updateSpotlight { + // A small delay of 80 ms in case player is changing map + // It will be cast twice when switching caves. This sleep prevents obscure bugs. + sleep2(80); + + getmapxy(.@m$, .@x, .@y, 0); + + // Is your map valid (or is the check skipped) + if (!getarg(0,false)) + { + if (strpos(getmapname(), "-3-") < 0) + return; + } + + // Retrieve default map masks + .@ms=getmapmask(.@m$); + + // Which equipments provide bonuses? + setarray .@b_head, CandleHelmet; + setarray .@b_weapon, ManaTorch, TrainingWand, Torch; + + // Calc your lighting score (it should NOT start on zero) + .@score=1; + if (array_find(.@b_head, getequipid(EQI_HEAD_TOP)) >= 0) + .@score+=1; + if (array_find(.@b_weapon, getequipid(EQI_HAND_R)) >= 0) + .@score+=1; + // TODO: Lighting scrolls + + //debugmes "Score: %d", .@score; + //debugmes "Equips: %d and %d", getequipid(EQI_HEAD_TOP), getequipid(EQI_HAND_R); + //debugmes "Headvalue: %d", .@b_head[0]; + //debugmes "Weappnvalue: %d, %d, %d", .@b_weapon[0], .@b_weapon[1], .@b_weapon[2]; + // Sanitize score + .@score=min(3, .@score); + + // Calculate and send new map mask + .@ms=.@ms|(2**.@score); + sendmapmask(.@ms); + return; +} + +// MAIN FUNCTION - DO NOT REMOVE +// Every NPC will be duplicating this one +001-3-0,0,0,0 script #SpotlightMaster NPC_HIDDEN,0,0,{ +OnTouch: + updateSpotlight(true); + end; +} + + +// I'm too lazy to do this in different files and in the right spot..... + +// npc/001-3-0/_warps.txt +001-3-0,196,35,0 duplicate(#SpotlightMaster) #SPOT001-3-0_196_35 NPC_HIDDEN,2,2 +001-3-0,172,41,0 duplicate(#SpotlightMaster) #SPOT001-3-0_172_41 NPC_HIDDEN,2,2 +001-3-0,162,40,0 duplicate(#SpotlightMaster) #SPOT001-3-0_162_40 NPC_HIDDEN,2,2 +001-3-0,198,60,0 duplicate(#SpotlightMaster) #SPOT001-3-0_198_60 NPC_HIDDEN,2,2 +001-3-0,152,55,0 duplicate(#SpotlightMaster) #SPOT001-3-0_152_55 NPC_HIDDEN,2,2 +001-3-0,85,130,0 duplicate(#SpotlightMaster) #SPOT001-3-0_85_130 NPC_HIDDEN,2,2 + +// npc/001-3-1/_warps.txt +001-3-1,24,58,0 duplicate(#SpotlightMaster) #SPOT001-3-1_24_58 NPC_HIDDEN,2,2 +001-3-1,35,59,0 duplicate(#SpotlightMaster) #SPOT001-3-1_35_59 NPC_HIDDEN,2,2 +001-3-1,30,19,0 duplicate(#SpotlightMaster) #SPOT001-3-1_30_19 NPC_HIDDEN,2,2 + +// npc/001-3-2/_warps.txt +001-3-2,30,117,0 duplicate(#SpotlightMaster) #SPOT001-3-2_30_117 NPC_HIDDEN,2,2 + +// npc/008-3-0/_warps.txt +008-3-0,130,113,0 duplicate(#SpotlightMaster) #SPOT008-3-0_130_113 NPC_HIDDEN,2,2 + +// npc/008-3-1/_warps.txt +008-3-1,34,34,0 duplicate(#SpotlightMaster) #SPOT008-3-1_34_34 NPC_HIDDEN,2,2 + +// npc/008-3-2/_warps.txt +008-3-2,175,18,0 duplicate(#SpotlightMaster) #SPOT008-3-2_175_18 NPC_HIDDEN,2,2 + diff --git a/npc/functions/treasure.txt b/npc/functions/treasure.txt new file mode 100644 index 00000000..785dd4a0 --- /dev/null +++ b/npc/functions/treasure.txt @@ -0,0 +1,134 @@ +// Moubootaur Legends functions. +// Author: +// Jesusalva +// Description: +// Random Treasure Box Utils + +function script TreasureBox { + .@id=getnpcid(); + if (RNGTREASURE_DATE[.@id] > gettimetick(2)) { + mesc l("The chest is unlocked and empty."); + close; + } + + mesc l("Open the chest?"); + mesc l("Cost: 1 %s", getitemlink(TreasureKey)), 1; + if (!countitem(TreasureKey)) + close; + next; + if (askyesno() == ASK_NO) + close; + + delitem TreasureKey, 1; + mesc l("You open the chest!"); + RNGTREASURE_DATE[.@id]=gettimetick(2)+CHEST_WAITTIME; // Minimum 15 minutes + + .@empty=getvariableofnpc(.empty, strnpcinfo(0)); + if (!.@empty) { + TREASURE_OPEN=TREASURE_OPEN+1; + .@t=TREASURE_OPEN; + .@r=rand(0,10000)-(readbattleparam(getcharid(3), UDT_LUK)*2); + + // Select treasure list + // You're warranted a rare (5%) every 25 open chests + // There's also uncommons (20%) and commons (75%) + if (.@t == 1) + .@loot=WoodenBow; + else if (.@t % 25 == 0 || .@r < 500) // Rare: 5% + .@loot=any(AtroposMixture, ElixirOfLife, BigHealing, BigMana, DeathPotion, MagicFeather); + else if (.@r < 2500) // Uncommon: 20% + .@loot=any(FatesPotion, ClothoLiquor, LachesisBrew, RedPlushWine, TreasureMap, MediumHealing, MediumMana); + else // Common: 75% + .@loot=any(Bread, Fungus, Cheese, Aquada, Croconut, PiberriesInfusion, Carrot, SmallHealing, SmallMana); + + + inventoryplace .@loot, 1; + mesc l("You find %s inside!", getitemlink(.@loot)); + getitem .@loot, 1; + } else { + mesc l("You find %s inside!", l("nothing")); + } + return; +} + +// Animation code by Evol Team +// 4144, gumi, Hal9000, Reid +// (Random) Treasure Chest +// Authored by Jesusalva +// Regenerates every 6 hours +001-3-0,0,0,0 script #chest_001-3-0 NPC_CHEST,{ + /* + // Extract the map name - Seems unused + explode(.@ni$, .name$, "_"); + .@map$=.@ni$[1]; + //if (.@map$ == "") debugmes "Error"; + */ + + // Conditionals + if (!.busy) { + TreasureBox(); + + specialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing + .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing + .busy = true; // lock until available again + initnpctimer; + } else { + mesc l("Someone looted this treasure box already..."); + } + close; + +OnTimer160: + .dir = .dir == 6 ? 0 : 4; // closing ? closed : open + end; + +OnTimer500: + // It's closed: Make available and stop timer + if (.dir == 0) { + .busy = false; + stopnpctimer; + } + end; + +// Autoclose +OnTimer60000: + .dir = 6; // closing + specialeffect(25, AREA, getnpcid()); // closing + setnpctimer 0; + end; + +OnInit: + .busy = false; + .distance = 2; + +OnClock0156: +OnClock0756: +OnClock1356: +OnClock1956: + // Try to warp randomly to a walkable spot, up to 20 attempts + // Otherwise, it'll stay where it already is (but will close and refill). + .@e=0; .@x=0; .@y=0; + while (!checkcell(.map$, .@x, .@y, cell_chkpass)) + { + if (.@e == 20) { + .@x=.x; + .@y=.y; + break; + } + // Remember the +20 -20 margin adjustment + .@x = rand2(20, getmapinfo(MAPINFO_SIZE_X, .map$)-20); + .@y = rand2(20, getmapinfo(MAPINFO_SIZE_X, .map$)-20); + ++.@e; + } + .busy=false; + movenpc .name$, .@x, .@y, 0; + end; +} + +// Lets bring some treasure to The Mana World +008-3-4,0,0,0 duplicate(#chest_001-3-0) #chest_008-3-4 NPC_TREASURE +008-3-5,0,0,0 duplicate(#chest_001-3-0) #chest_008-3-5 NPC_TREASURE +008-3-6,0,0,0 duplicate(#chest_001-3-0) #chest_008-3-6 NPC_TREASURE + +012-3-1,0,0,0 duplicate(#chest_001-3-0) #chest_012-3-1 NPC_TREASURE +012-3-3,0,0,0 duplicate(#chest_001-3-0) #chest_012-3-3 NPC_TREASURE + diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 2cb28573..8e263eb0 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -8,17 +8,19 @@ // season_direction({day, month}) // returns the direction that represents our current season (approximation) -// DOWN: Winter, 21/12 -// DOWNLEFT: Spring, 20/03 -// LEFT: Summer, 21/06 -// UPLEFT: Autumn, 22/09 +// Note: You may also use WINTER/SPRING/SUMMER/AUTUMN constants for scripts +// where the direction is not important, but the season is. (Readability) +// DOWN: Winter, 21/12 WINTER +// DOWNLEFT: Spring, 20/03 SPRING +// LEFT: Summer, 21/06 SUMMER +// UPLEFT: Autumn, 22/09 AUTUMN function script season_direction { - .@current_month = getarg(0, gettime(GETTIME_MONTH)); + .@current_month = getarg(1, gettime(GETTIME_MONTH)); if (.@current_month % 3 == 0) { - .@current_day = getarg(1, gettime(GETTIME_DAYOFMONTH)); + .@current_day = getarg(0, gettime(GETTIME_DAYOFMONTH)); switch (.@current_month) { @@ -36,7 +38,7 @@ function script season_direction { } // This is part of Jesusalva script toolkit to make his life easier when writing -// quests. Many of these are actually redudant functions. +// quests. Many of these are actually redundant functions. // Four different flavours of setq() to quickly preserve old values function script setq1 { @@ -63,14 +65,79 @@ function script setqtime { return; } -// Function to quickly disregard part of getmapxy(). -// If you use this function too much, you'll lose efficiency, and it'll be better -// to use getmapxy() normally to save to temporary variables. -// Can take one optional argument (unittype argument). +// Shortcut for getmapname() function script getmap { - if (getmapxy(.@mapName$, .@xpos, .@ypos, getarg(0,0)) != 0) - return false; - return .@mapName$; + return getmapname(); } +// Returns the player race in plain text +// GETRACE_RACE - returns player race (default) +// GETRACE_SKIN - returns player skin +// GETRACE_FULL - returns player skin + race +// Can take an optional 2nd param with the class +// get_race( {Flag, {Class}} ) +function script get_race { + .@m=getarg(0, GETRACE_RACE); + .@g=getarg(1, Class); + // We also allow this to run without player attached for... science. + if (playerattached()) + { + setarray .@allraces$, l("Human"), l("Ukar"), l("Kralog"), + l("Raijin"), l("Kralog"), l("Raijin"), l("Tritan"), + l("Human"), l("Human"), l("Tritan"), l("Ukar"); + setarray .@allskins$, l("Kaizei"), l("Cave"), l("Fire"), + l("Light"), l("Frost"), l("Dark"), l("Sea"), l("Argaes"), + l("Tonori"), l("Lake"), l("Mountain"); + } + else + { + setarray .@allraces$, "Human", "Ukar", "Kralog", "Raijin", + "Kralog", "Raijin", "Tritan", "Human", "Human", "Tritan", "Ukar"; + setarray .@allskins$, "Kaizei", "Cave", "Fire", "Light", + "Frost", "Dark", "Sea", "Argaes", "Tonori", "Lake", "Mountain"; + } + + if (.@m == GETRACE_RACE) + return .@allraces$[.@g]; + else if (.@m == GETRACE_SKIN) + return .@allskins$[.@g]; + else + return .@allskins$[.@g] + " " + .@allraces$[.@g]; +} + +// gettimeparam(GETTIME_X) +// Returns the number of seconds/minutes/hours/days/months/years since 01/01/1970 +// This is for truly daily quests, which doesn't imposes a timed wait in hours +function script gettimeparam { + .@p=getarg(0, GETTIME_MINUTE); + + // Seconds (same as gettimetick(2) - use that instead) + .@t=gettimetick(2); + if (.@p == GETTIME_SECOND) + return .@t; + + // Minutes (default) + .@t=.@t/60; + if (.@p == GETTIME_MINUTE) + return .@t; + + // Hours + .@t=.@t/60; + if (.@p == GETTIME_HOUR) + return .@t; + + // Days + .@t=.@t/24; + if (.@p == GETTIME_DAYOFMONTH) + return .@t; + + // Months (estimative) + .@t=.@t/30; + if (.@p == GETTIME_MONTH) + return .@t; + + // Years (estimative, unused, fallback) + .@t=.@t/12; + return .@t; +} diff --git a/npc/functions/warp.txt b/npc/functions/warp.txt index df7b76b0..46c390ad 100644 --- a/npc/functions/warp.txt +++ b/npc/functions/warp.txt @@ -38,7 +38,7 @@ function script slide_or_warp { if (!isloggedin(.@aid)) { if ((.@aid = playerattached()) == 0) { - debugmes("slide_or_warp: no player attached!"); + consolemes(CONSOLEMES_DEBUG, "slide_or_warp: no player attached!"); return false; } } |