summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/re/item_db.conf26
-rw-r--r--npc/012-7/airlia.txt2
-rw-r--r--npc/functions/lockpicks.txt88
-rw-r--r--npc/scripts.conf1
4 files changed, 106 insertions, 11 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 51e032296..0b75486d9 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -2348,6 +2348,20 @@ item_db: (
doevent "rand_sc_heal::OnUse";
">
},
+{
+ Id: 620
+ AegisName: "Lockpicks"
+ Name: "Lockpicks"
+ Type: "IT_USABLE"
+ Buy: 1000
+ Sell: 50
+ Weight: 20
+ Refine: false
+ Script: <"
+ //doevent "#LockPicking::OnUse";
+ dispbottom l("Ops.");
+ ">
+},
// Generic
{
Id: 700
@@ -3450,17 +3464,7 @@ item_db: (
Refine: false
ViewSprite: 801
},
-{
- Id: 802
- AegisName: "Lockpicks"
- Name: "Lockpicks"
- Type: "IT_ETC"
- Buy: 10000
- Sell: 500
- Weight: 20
- Refine: false
- ViewSprite: 802
-},
+// Id 802 free
{
Id: 803
AegisName: "LoveLetter"
diff --git a/npc/012-7/airlia.txt b/npc/012-7/airlia.txt
index a8262ff23..b085a9230 100644
--- a/npc/012-7/airlia.txt
+++ b/npc/012-7/airlia.txt
@@ -1,6 +1,8 @@
// TMW2 Script
// Author:
// Jesusalva
+// Personality Traits:
+// Bitter-sweet, resentful, lovely
// Description:
// Former Town's Mayor Daughter.
// Have a grudge against current mayor.
diff --git a/npc/functions/lockpicks.txt b/npc/functions/lockpicks.txt
new file mode 100644
index 000000000..df17d4c67
--- /dev/null
+++ b/npc/functions/lockpicks.txt
@@ -0,0 +1,88 @@
+// 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, prize)
+// 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);
+ .@p=getarg(2,100);
+
+ // 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 < .@d) {
+ mesc l("This lock is beyond your current capacity."), 1;
+ close;
+ }
+
+ // Create @pins array (the answer)
+ for (.@i=0; .@i < .@d;.@i++)
+ @pins[.@i] = rand(1,.@m);
+
+ // Check if you'll try to open it.
+ mesc l("This lock is simple, maybe with your thief skills can manage. 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;
+ 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.
+ // Remember if you fail, all previous pins will be cleared (@pos)
+ for (.@i=0; .@i < (.@d+.@m+THIEF_RANK) ; .@i++) {
+ mesc l("You are trying to open the @@th pin. What to do?", @pos+1);
+ menuint
+ rif(.@m <= 4, l("Apply no pressure")), 1,
+ rif(.@m <= 2, l("Apply soft pressure")), 2,
+ rif(.@m <= 1, l("Apply normal pressure")), 3,
+ rif(.@m <= 3, l("Apply strong pressure")), 4,
+ rif(.@m <= 5, l("Apply very strong pressure")), 5,
+ l("Give up!"), 0;
+
+ if (!@menuret)
+ close;
+
+ // Is your guess correct?
+ if (@pins[@pos] == @menuret) {
+ mesc l("*click*");
+ @pos+=1;
+ } else {
+ mesc l("This didn't work.");
+ }
+
+ if (@pos > .@d)
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 1294ab7d4..ca94600dd 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -35,6 +35,7 @@
"npc/functions/doors.txt",
"npc/functions/fishing.txt",
"npc/functions/hammocks.txt",
+"npc/functions/lockpicks.txt",
"npc/functions/marriage.txt",
"npc/functions/mobpoint.txt",
"npc/functions/mobhunter.txt",