summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/faction.txt104
-rw-r--r--npc/functions/lockpicks.txt193
-rw-r--r--npc/functions/quest-debug/020-ArtisQuests_LazyBrother.txt (renamed from npc/functions/quest-debug/019-ArtisQuests_LazyBrother.txt)2
-rw-r--r--npc/functions/quest-debug/021-ArtisQuests_Urchin.txt (renamed from npc/functions/quest-debug/020-ArtisQuests_Urchin.txt)2
-rw-r--r--npc/functions/quest-debug/022-ArtisQuests_CatchPiou.txt (renamed from npc/functions/quest-debug/021-ArtisQuests_CatchPiou.txt)2
-rw-r--r--npc/functions/quest-debug/023-ArtisQuests_Fishman.txt (renamed from npc/functions/quest-debug/022-ArtisQuests_Fishman.txt)2
-rw-r--r--npc/functions/quest-debug/024-ArtisQuests_QOnan.txt (renamed from npc/functions/quest-debug/023-ArtisQuests_QOnan.txt)2
-rw-r--r--npc/functions/quest-debug/035-ThiefQuests_Artis.txt38
-rw-r--r--npc/functions/quest-debug/050-HurnscaldQuests_Hinnak.txt (renamed from npc/functions/quest-debug/036-HurnscaldQuests_Hinnak.txt)2
-rw-r--r--npc/functions/quest-debug/051-HurnscaldQuests_Soup.txt (renamed from npc/functions/quest-debug/037-HurnscaldQuests_Soup.txt)2
-rw-r--r--npc/functions/quest-debug/052-HurnscaldQuests_Inspector.txt (renamed from npc/functions/quest-debug/038-HurnscaldQuests_Inspector.txt)2
-rw-r--r--npc/functions/quest-debug/053-HurnscaldQuests_ForestBow.txt (renamed from npc/functions/quest-debug/039-HurnscaldQuests_ForestBow.txt)2
-rw-r--r--npc/functions/quest-debug/054-HurnscaldQuests_WoodenShield.txt (renamed from npc/functions/quest-debug/040-HurnscaldQuests_WoodenShield.txt)2
-rw-r--r--npc/functions/quest-debug/055-General_Cooking.txt (renamed from npc/functions/quest-debug/041-General_Cooking.txt)2
-rw-r--r--npc/functions/quest-debug/056-General_Brotherhood.txt (renamed from npc/functions/quest-debug/042-General_Brotherhood.txt)2
-rw-r--r--npc/functions/quest-debug/100-General_Narrator.txt (renamed from npc/functions/quest-debug/028-General_Narrator.txt)2
-rw-r--r--npc/functions/spotlight.txt2
-rw-r--r--npc/functions/timer.txt7
18 files changed, 356 insertions, 14 deletions
diff --git a/npc/functions/faction.txt b/npc/functions/faction.txt
new file mode 100644
index 00000000..19450df9
--- /dev/null
+++ b/npc/functions/faction.txt
@@ -0,0 +1,104 @@
+// The Mana World: rEvolt functions.
+// Authors:
+// Jesusalva
+// Description:
+// Faction utils
+// Factions:
+// THIEF / MAGE / LEGION / BROTHERHOOD
+// Variables:
+// FACTION_REP
+// Your reputation with the faction (ally, friendly, cordial, enemy, ...)
+// FACTION_EXP
+// Your personal experience (=skill with the faction dealings)
+// FACTION_RANK
+// Your "level" in the faction, a mix of both above.
+
+
+// Returns, based on a 1-5 range, the title for ranking systems (system guilds)
+// legionrank() / brotherrank() / thiefrank() / magerank()
+function script legionrank {
+ switch (LEGION_RANK) {
+ case 5: return l("Constable");
+ case 4: return l("Tengu");
+ case 3: return l("Terranite");
+ case 2: return l("Fluffy");
+ case 1: return l("Maggot");
+ case 0: return l("Citizen");
+ default: return l("Error");
+ }
+}
+function script brotherrank {
+ switch (BROTHERHOOD_RANK) {
+ case 5: return l("Administrator");
+ case 4: return l("Senior Developer");
+ case 3: return l("Game Master");
+ case 2: return l("Developer");
+ case 1: return l("Contributor");
+ case 0: return l("Citizen");
+ default: return l("Error");
+ }
+}
+function script thiefrank {
+ switch (THIEF_RANK) {
+ case 5: return l("Bandit Lord");
+ case 4: return l("Assassin");
+ case 3: return l("Rogue");
+ case 2: return l("Bandit");
+ case 1: return l("Thief");
+ case 0: return l("Citizen");
+ default: return l("Error");
+ }
+}
+function script magerank {
+ switch (MAGE_RANK) {
+ case 5: return l("Elder Mage");
+ case 4: return l("Great Mage");
+ case 3: return l("Arch Mage");
+ case 2: return l("Mage");
+ case 1: return l("Initiate");
+ case 0: return l("Citizen");
+ default: return l("Error");
+ }
+}
+
+// faction_addrep( faction, amount )
+// Returns a dialog which can be used with mesc() or dispbottom()
+function script faction_addrep {
+ .@fac$=strtoupper(getarg(0));
+ .@old=getd(.@fac$+"_REP");
+ setd(.@fac$+"_REP", .@old+getarg(1));
+ if (getarg(1) > 0)
+ return l("Reputation with %s Faction UP (+%d)!", getarg(0), getarg(1));
+ else
+ return l("Reputation with %s Faction DOWN (%d)!", getarg(0), getarg(1));
+
+ return;
+}
+
+// Returns standing with faction (THIEF/MAGE/LEGION/BROTHERHOOD)
+// An integer from 3 (ally) to -3 (enemy). Standings based on Hands of War;
+// faction_standing( faction{, integer=True} )
+function script faction_standing {
+ .@fac$=strtoupper(getarg(0));
+ .@ret=getarg(1, true);
+ .@rep=getd(.@fac$+"_REP");
+ if (.@rep > 1000) {
+ return (.@ret ? 3 : "Ally"); // 1001 ~ inf.
+ } else if (.@rep > 500) {
+ return (.@ret ? 2 : "Friendly"); // 501 ~ 1000
+ } else if (.@rep > 100) {
+ return (.@ret ? 1 : "Cordial"); // 101 ~ 500
+ } else if (.@rep >= -100) {
+ return (.@ret ? 0 : "Neutral"); // -100 ~ +100
+ } else if (.@rep > -500) {
+ return (.@ret ? -1 : "Unfriendly"); // -101 ~ -500
+ } else if (.@rep > -1000) {
+ return (.@ret ? -2 : "Enemy"); // -501 ~ -1000
+ } else {
+ return (.@ret ? -3 : "Nemesis"); // -1001 ~ inf
+ }
+
+}
+// TODO: faction_checklvup()
+
+
diff --git a/npc/functions/lockpicks.txt b/npc/functions/lockpicks.txt
new file mode 100644
index 00000000..6a3c55f7
--- /dev/null
+++ b/npc/functions/lockpicks.txt
@@ -0,0 +1,193 @@
+// TMW2/LoF Script
+// Author:
+// Jesusalva
+// Description:
+// Lockpicking core
+
+// Important variables:
+// THIEF_EXP
+// Experience on Thief Tree
+// THIEF_RANK
+// Position on the Thief Tree
+
+// LockPicking(num_pins, max_pins, min_rank=num_pins)
+// Returns 0 upon failure, 1 upon success
+// Closes script if an error happen or if you give up / cannot try.
+//
+// The 'next' is upon script responsability
+// Maximum pin number is infinite. Maximum Pin Positiors range from 2~5.
+// If you fail, you can end up having to start again. If you fail too much,
+// you'll be caught!
+function script LockPicking {
+ // If you don't have a LockPick, you can't do this (useless)
+ if (!countitem(Lockpicks)) {
+ mesc l("You need a @@ to try this.", getitemlink(Lockpicks)), 1;
+ close;
+ }
+
+ .@d=getarg(0,1);
+ .@m=getarg(1,3);
+ .@minrank=getarg(2, .@d);
+
+ // Invalid Argument (kill script)
+ if (.@d < 1 || .@m < 2 || .@m > 5)
+ end;
+
+ // You must be rank (number of locks - 1) to try
+ if (THIEF_RANK+1 < .@minrank) {
+ mesc l("This lock is beyond your current capacity."), 1;
+ close;
+ }
+
+ // Create @pins array (the answer)
+ for (.@i=0; .@i < .@d;.@i++)
+ @pins[.@i] = rand2(1,.@m);
+
+ // Check if you'll try to open it.
+ mesc l("This lock is simple, maybe with your thief skills you can manage to pry it open. But beware, you can end up in jail!");
+ mesc l("Will you try to unlock it?");
+ if (askyesno() == ASK_NO)
+ close;
+
+ // Setup your attempt
+ delitem Lockpicks, 1;
+ @pos=0;
+ @chance=min(.@d*.@m-1, THIEF_RANK+.@d);
+ mesc l("You insert the hook pick inside the lock, and, without applying any tension, you discover there are only @@ pins to set.", .@d);
+
+ // You have as many attempts as pins and appliable strenghts.
+ // Each thief rank grants you an extra attempt.
+ // Each pin takes one attempt.
+ // It's not multiplied, so 3 pins with 3 positions: 6 chances, 9 possibilities.
+ // There's no penalty, but the attempt is counted working or not!
+ // Remember if you fail, all previous pins will be cleared (@pos)
+ do {
+ mesc l("You are trying to open the @@th pin. What will to do?", @pos+1);
+
+ menuint
+ rif(.@m >= 4, l("Apply no pressure")), 4,
+ rif(.@m >= 2, l("Apply soft pressure")), 2,
+ rif(.@m >= 1, l("Apply normal pressure")), 1,
+ rif(.@m >= 3, l("Apply strong pressure")), 3,
+ rif(.@m >= 5, l("Apply very strong pressure")), 5,
+ l("Give up!"), 0;
+
+ if (!@menuret) {
+ // 50% chance to save the lockpick
+ if (rand2(2) == 1)
+ getitem Lockpicks, 1;
+ else
+ dispbottom l("The lockpick broke.");
+ close;
+ }
+
+ // Is your guess correct?
+ if (@pins[@pos] == @menuret) {
+ mesc l("*click*");
+ @pos+=1;
+ } else {
+ mesc l("This didn't work. All pins are now unset!");
+ @pos=0;
+ @chance-=1;
+ // We don't need to clear console, each successful attempt IS counted.
+ // Therefore, unsetting 3 pins means you must do 3 new attempts!!
+ // The biggie is that you're running against time, here!!!
+ if (@chance < .@d && rand2(0, THIEF_RANK))
+ mesc l("Your thief instincts suggest you to hurry."), 1;
+ }
+
+ if (@chance <= 0)
+ break;
+
+ if (@pos >= .@d) {
+ // 33% chance to save the lockpick
+ if (rand2(3) == 1)
+ getitem Lockpicks, 1;
+ else
+ dispbottom l("The lockpick broke.");
+
+ // Get EXP and inform the success
+ if (THIEF_RANK)
+ THIEF_EXP += max(0, .@d*.@m-THIEF_RANK);
+ return 1;
+ }
+ } while (true);
+
+ // Failed
+ if (THIEF_RANK)
+ THIEF_EXP += 1;
+ return 0;
+}
+
+// Script helper to say if you were arrested or not
+function script ArrestedChances {
+ .@runaway=cap_value(readbattleparam(getcharid(3), UDT_LUK)+readbattleparam(getcharid(3), UDT_AGI), 0, 200); // 20%
+ .@runaway+=125; // 12.5% base chance
+ .@runaway+=cap_value(THIEF_RANK*15, 0, 100); // real max 7.5%
+ // Max runaway chance: 40%
+ if (rand2(1000) < .@runaway)
+ return false;
+ return true;
+}
+
+// Script helper to actually arrest you. TODO: Arrest anyone
+// ArrestPlayer ( time-in-minutes )
+function script ArrestPlayer {
+ .@t=getarg(0);
+
+ // We can't do anything without a player o.o
+ if (!playerattached())
+ return;
+
+ // You're already jailed so we do nothing and fail silently
+ if (getstatus(SC_JAILED)) {
+ return;
+ }
+
+ // Okay, we can arrest you
+ // TODO: Arrest player, preferably without GM commands D:
+ // (would then take an extra argument: map)
+ atcommand("@jailfor "+.@t+"mn "+strcharinfo(0));
+
+ // Notification
+ dispbottom l("You were arrested; Use %s for information about how long you will spend here.", b("@jailtime"));
+ return;
+}
+
+/*
+// Main script from Moubootaur Legends Vaults
+// LootableVault(tier, level, variable)
+function script LootableVault {
+ .@tier=getarg(0)+1;
+ .@level=getarg(1);
+ .@var$=getarg(2);
+ mesn;
+ mesq l("There's a shiny safe here. How much money is inside? Nobody is looking at you, great!");
+ // 2*3 = 6 possibilities, 5 attempts
+ if (LockPicking(.@tier, .@level)) {
+ Zeny=Zeny+getd("$VAULT_"+.@var$);
+ setd("$VAULT_"+.@var$, 40);
+ mesn;
+ mesq l("Booty!");
+ } else {
+ mesn;
+ .@inch=(Zeny/100);
+ Zeny-=.@inch;
+ setd("$VAULT_"+.@var$, getd("$VAULT_"+.@var$)+.@inch);
+ if (ArrestedChances()) {
+ mesc l("Arrested!");
+ atcommand("@jailfor 5mn "+strcharinfo(0));
+ } else {
+ if (is_night())
+ .@p$=l("The darkness of night gives you cover.");
+ else
+ .@p$=l("Your agile legs and sheer luck allows you to outrun the cops.");
+ mesc l("You run as far as you could. %s", .@p$);
+ warp "000-1", 22, 22;
+ }
+ }
+ return;
+}
+*/
+
+
diff --git a/npc/functions/quest-debug/019-ArtisQuests_LazyBrother.txt b/npc/functions/quest-debug/020-ArtisQuests_LazyBrother.txt
index 41733adf..11cf3a44 100644
--- a/npc/functions/quest-debug/019-ArtisQuests_LazyBrother.txt
+++ b/npc/functions/quest-debug/020-ArtisQuests_LazyBrother.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug19 {
+function script QuestDebug20 {
do
{
clear;
diff --git a/npc/functions/quest-debug/020-ArtisQuests_Urchin.txt b/npc/functions/quest-debug/021-ArtisQuests_Urchin.txt
index 3a092e47..486cae18 100644
--- a/npc/functions/quest-debug/020-ArtisQuests_Urchin.txt
+++ b/npc/functions/quest-debug/021-ArtisQuests_Urchin.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug20 {
+function script QuestDebug21 {
do
{
clear;
diff --git a/npc/functions/quest-debug/021-ArtisQuests_CatchPiou.txt b/npc/functions/quest-debug/022-ArtisQuests_CatchPiou.txt
index f9c45339..9d5afc1c 100644
--- a/npc/functions/quest-debug/021-ArtisQuests_CatchPiou.txt
+++ b/npc/functions/quest-debug/022-ArtisQuests_CatchPiou.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug21 {
+function script QuestDebug22 {
do
{
clear;
diff --git a/npc/functions/quest-debug/022-ArtisQuests_Fishman.txt b/npc/functions/quest-debug/023-ArtisQuests_Fishman.txt
index 0a193e6f..e3b5ac2e 100644
--- a/npc/functions/quest-debug/022-ArtisQuests_Fishman.txt
+++ b/npc/functions/quest-debug/023-ArtisQuests_Fishman.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug22 {
+function script QuestDebug23 {
do
{
clear;
diff --git a/npc/functions/quest-debug/023-ArtisQuests_QOnan.txt b/npc/functions/quest-debug/024-ArtisQuests_QOnan.txt
index 02eaa8f6..702ef9be 100644
--- a/npc/functions/quest-debug/023-ArtisQuests_QOnan.txt
+++ b/npc/functions/quest-debug/024-ArtisQuests_QOnan.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug23 {
+function script QuestDebug24 {
do
{
clear;
diff --git a/npc/functions/quest-debug/035-ThiefQuests_Artis.txt b/npc/functions/quest-debug/035-ThiefQuests_Artis.txt
new file mode 100644
index 00000000..83f9fb9c
--- /dev/null
+++ b/npc/functions/quest-debug/035-ThiefQuests_Artis.txt
@@ -0,0 +1,38 @@
+// Artis Thieves quest debug
+// Author:
+// Jesusalva
+// Field 2: Internal use (gearwheels - odd: collected; even: used)
+// Field 3: Internal use (Archive where the file is)
+
+function script QuestDebug35 {
+ do
+ {
+ clear;
+ setnpcdialogtitle l("Quest debug");
+ mes "ThiefQuests_Artis";
+ mes "---";
+ mes l("Quest state: @@", getq(ThiefQuests_Artis));
+ .@q2=getq2(ThiefQuests_Artis);
+ mesf ("Gearwheels: %d (%s)", .@q2/2, (.@q2 % 2 ? "found" : "not found"));
+ mesf ("Henry's file: %d", getq3(ThiefQuests_Artis));
+ next;
+
+ GenericQuestDebug ThiefQuests_Artis,
+ ("Does not have the quest"), 0,
+ ("Accepted Townhall Quest"), 1,
+ ("Townhall arc complete"), 2,
+ ("Reward taken"), 3,
+ ("Accepted Legion Quest"), 4,
+ ("Legion arc comlete"), 5,
+ ("Reward taken (2)"), 6,
+ ("Nunia Quest Accepted"), 7,
+ ("Nunia arc comlete"), 8,
+ ("Reward taken (3)"), 9;
+
+ if (@menuret < 0)
+ {
+ return;
+ }
+
+ } while (1);
+}
diff --git a/npc/functions/quest-debug/036-HurnscaldQuests_Hinnak.txt b/npc/functions/quest-debug/050-HurnscaldQuests_Hinnak.txt
index 61dc294e..31183eb8 100644
--- a/npc/functions/quest-debug/036-HurnscaldQuests_Hinnak.txt
+++ b/npc/functions/quest-debug/050-HurnscaldQuests_Hinnak.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug36 {
+function script QuestDebug50 {
do
{
clear;
diff --git a/npc/functions/quest-debug/037-HurnscaldQuests_Soup.txt b/npc/functions/quest-debug/051-HurnscaldQuests_Soup.txt
index 43eba0d6..44694f06 100644
--- a/npc/functions/quest-debug/037-HurnscaldQuests_Soup.txt
+++ b/npc/functions/quest-debug/051-HurnscaldQuests_Soup.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug37 {
+function script QuestDebug51 {
do
{
clear;
diff --git a/npc/functions/quest-debug/038-HurnscaldQuests_Inspector.txt b/npc/functions/quest-debug/052-HurnscaldQuests_Inspector.txt
index 053f085e..72d99242 100644
--- a/npc/functions/quest-debug/038-HurnscaldQuests_Inspector.txt
+++ b/npc/functions/quest-debug/052-HurnscaldQuests_Inspector.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug38 {
+function script QuestDebug52 {
do
{
clear;
diff --git a/npc/functions/quest-debug/039-HurnscaldQuests_ForestBow.txt b/npc/functions/quest-debug/053-HurnscaldQuests_ForestBow.txt
index c6a61a1b..2a0993e3 100644
--- a/npc/functions/quest-debug/039-HurnscaldQuests_ForestBow.txt
+++ b/npc/functions/quest-debug/053-HurnscaldQuests_ForestBow.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug39 {
+function script QuestDebug53 {
do
{
clear;
diff --git a/npc/functions/quest-debug/040-HurnscaldQuests_WoodenShield.txt b/npc/functions/quest-debug/054-HurnscaldQuests_WoodenShield.txt
index 05d08130..0cb3ee9d 100644
--- a/npc/functions/quest-debug/040-HurnscaldQuests_WoodenShield.txt
+++ b/npc/functions/quest-debug/054-HurnscaldQuests_WoodenShield.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug40 {
+function script QuestDebug54 {
do
{
clear;
diff --git a/npc/functions/quest-debug/041-General_Cooking.txt b/npc/functions/quest-debug/055-General_Cooking.txt
index 592df547..ed9fb685 100644
--- a/npc/functions/quest-debug/041-General_Cooking.txt
+++ b/npc/functions/quest-debug/055-General_Cooking.txt
@@ -2,7 +2,7 @@
// Author:
// Jesusalva
-function script QuestDebug41 {
+function script QuestDebug55 {
do
{
clear;
diff --git a/npc/functions/quest-debug/042-General_Brotherhood.txt b/npc/functions/quest-debug/056-General_Brotherhood.txt
index 3eb3683b..07fe568f 100644
--- a/npc/functions/quest-debug/042-General_Brotherhood.txt
+++ b/npc/functions/quest-debug/056-General_Brotherhood.txt
@@ -4,7 +4,7 @@
// monwarez
// jesusalva
-function script QuestDebug42 {
+function script QuestDebug56 {
do
{
clear;
diff --git a/npc/functions/quest-debug/028-General_Narrator.txt b/npc/functions/quest-debug/100-General_Narrator.txt
index 408668b7..22737c90 100644
--- a/npc/functions/quest-debug/028-General_Narrator.txt
+++ b/npc/functions/quest-debug/100-General_Narrator.txt
@@ -2,7 +2,7 @@
// Author:
// gumi
-function script QuestDebug28 {
+function script QuestDebug100 {
do
{
clear;
diff --git a/npc/functions/spotlight.txt b/npc/functions/spotlight.txt
index fb0c697e..219d3a31 100644
--- a/npc/functions/spotlight.txt
+++ b/npc/functions/spotlight.txt
@@ -76,7 +76,7 @@ OnTouch:
// 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
+//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
diff --git a/npc/functions/timer.txt b/npc/functions/timer.txt
index e79070f3..fbfec3fd 100644
--- a/npc/functions/timer.txt
+++ b/npc/functions/timer.txt
@@ -1,3 +1,10 @@
+// addtimer2(<tick>, "<npc>::<event>")
+function script addtimer2 {
+ deltimer(getarg(1));
+ addtimer(getarg(0), getarg(1));
+ return;
+}
+
// areatimer("<map>", <x1>, <y1>, <x2>, <y2>, <tick>, "<npc>::<event>")
function script areatimer {
.@c = getunits(BL_PC, .@players, false, getarg(0), getarg(1), getarg(2), getarg(3), getarg(4));