summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-05-29 14:45:20 -0300
committerJesusaves <cpntb1@ymail.com>2019-05-29 14:45:20 -0300
commit25617bbb7594916506096c2e9bcfeba83fd3e462 (patch)
tree4926424dee6c8f4539d2cf15e06def7c6cc47d99
parent3618ecc48dc775ead1888fa009756c491aeaf701 (diff)
downloadserverdata-25617bbb7594916506096c2e9bcfeba83fd3e462.tar.gz
serverdata-25617bbb7594916506096c2e9bcfeba83fd3e462.tar.bz2
serverdata-25617bbb7594916506096c2e9bcfeba83fd3e462.tar.xz
serverdata-25617bbb7594916506096c2e9bcfeba83fd3e462.zip
Get rid of Shovel quirks
-rw-r--r--db/re/item_db.conf12
-rw-r--r--npc/craft/options.txt31
-rw-r--r--npc/items/shovel.txt176
3 files changed, 121 insertions, 98 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 7cd12ec26..8be472ac1 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -650,7 +650,11 @@ item_db: (
Refine: false
KeepAfterUse: true
Script: <"
- doevent "Shovel::OnUse";
+ if (@useType == 1) {
+ doevent "Shovel::OnBury";
+ } else {
+ doevent "Shovel::OnDig";
+ }
">
},
{
@@ -664,7 +668,11 @@ item_db: (
Refine: false
KeepAfterUse: true
Script: <"
- doevent "Shovel::OnUse";
+ if (@useType == 1) {
+ doevent "Shovel::OnBury";
+ } else {
+ doevent "Shovel::OnDig";
+ }
">
},
{
diff --git a/npc/craft/options.txt b/npc/craft/options.txt
index cf1eeec4a..de392c3ae 100644
--- a/npc/craft/options.txt
+++ b/npc/craft/options.txt
@@ -433,3 +433,34 @@ function script csys_Apply {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+////////////////////////////////////////
+/////////////////
+///////
+// Interface System for Options Craft
+
+
+
+
+
+
diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt
index b0a45b4f1..f8a110f94 100644
--- a/npc/items/shovel.txt
+++ b/npc/items/shovel.txt
@@ -52,69 +52,12 @@ function script shovel_scatter {
}
+// Here we begin
- script Shovel -1,{
+ function CheckDigLocation;
+ function AddDigRect;
+ function PlayerIsTired;
- function CheckDigLocation {
- getmapxy(.@map$, .@x, .@y, 0);
- for (.@i = 0; .@i < getarraysize(.WorldDigRect_Map$); .@i++)
- {
- if (!strcmp(.WorldDigRect_Map$[.@i], .@map$) &&
- .WorldDigRect_x1[.@i] <= .@x &&
- .WorldDigRect_x2[.@i] >= .@x &&
- .WorldDigRect_y1[.@i] <= .@y &&
- .WorldDigRect_y2[.@i] >= .@y)
- {
- return 1;
- }
- }
- return 0;
- }
-
- function AddDigRect {
- if (getargcount() < 5)
- {
- debugmes "usage: AddDigRect(map$,x1,y1,x2,y2)";
- return 0;
- }
- .@map$ = str(getarg(0));
- .@x1 = getarg(1);
- .@y1 = getarg(2);
- .@x2 = getarg(3);
- .@y2 = getarg(4);
- .@size = getarraysize(.WorldDigRect_Map$);
- .WorldDigRect_Map$[.@size] = .@map$;
- .WorldDigRect_x1[.@size] = .@x1;
- .WorldDigRect_y1[.@size] = .@y1;
- .WorldDigRect_x2[.@size] = .@x2;
- .WorldDigRect_y2[.@size] = .@y2;
- return 1;
- }
-
- function PlayerIsTired {
- // GMs can do this in an unrestricted way
- if (is_gm())
- return 0;
-
- .@tick = gettimetick(1);
- .@playertick = .PlayerTiredTime - (readparam(bStr)/5) - (readparam(bVit)/10);
-
- // Dig and Bury more with Steel Shovel
- if (countitem(SteelShovel)) {
- .@playertick-=(.PlayerTiredTime*2)/3;
- }
-
- if (@ShovelLastUsed + max(5, .@playertick) > .@tick) {
- if (!GSET_SHOVEL_AUTODIG) {
- mes "";
- mesc lg("You are exhausted, you should rest a bit.");
- } else {
- dispbottom lg("You are exhausted, you should rest a bit.");
- }
- return 1;
- }
- @ShovelLastUsed = .@tick;
- return 0;
- }
function Dig {
// First check: Did some player burried a TREASURE? O.o
@@ -139,6 +82,8 @@ function script shovel_scatter {
narrator S_FIRST_BLANK_LINE,
l("You found something!"),
l("It's @@ @@.", .@amount, getitemname(.@id));
+ next;
+ closeclientdialog;
return 1;
}
}
@@ -163,10 +108,12 @@ function script shovel_scatter {
narrator S_FIRST_BLANK_LINE,
l("You found something!"),
l("It's @@ @@.", .@amount, getitemname(.@id));
+ next;
+ closeclientdialog;
return 1;
}
}
- narrator S_FIRST_BLANK_LINE, l("Sadly, you found nothing but dirt.");
+ dispbottom l("Sadly, you found nothing but dirt.");
return 0;
}
@@ -191,6 +138,7 @@ function script shovel_scatter {
mesc l("This item is too precious, you cannot part with it!");
else
mesc l("You give up.");
+ close;
return;
}
@@ -199,8 +147,10 @@ function script shovel_scatter {
narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("Amount?");
input .@amount, 0, countitem(.@id);
}
- if (.@amount == 0 || .@amount > countitem(.@id))
+ if (.@amount == 0 || .@amount > countitem(.@id)) {
+ close;
return;
+ }
getmapxy(.@map$, .@x, .@y, 0);
delitem .@id, .@amount;
@@ -211,7 +161,7 @@ function script shovel_scatter {
$WorldBuriedTreasures_x[.@wtc] = .@x;
$WorldBuriedTreasures_y[.@wtc] = .@y;
narrator S_FIRST_BLANK_LINE, l("You buried @@ @@.", .@amount, getitemname(.@id));
-
+ close;
return 0;
}
@@ -235,48 +185,82 @@ function script shovel_scatter {
return 0;
}
-OnUse:
+OnDig:
if (!CheckDigLocation()) {
- message strcharinfo(0), l("I can't use the shovel here.");
- close;
+ dispbottom l("I can't use the shovel here.");
+ end;
}
+ if (PlayerIsTired())
+ end;
+ if (!ShovelQuests())
+ Dig();
+ end;
- // SHOVEL_AUTODIG - Skip menu and outright try to dig
- if (GSET_SHOVEL_AUTODIG) {
- if (PlayerIsTired())
- end;
- if (!ShovelQuests())
- Dig();
+OnBury:
+ if (!CheckDigLocation()) {
+ dispbottom l("I can't use the shovel here.");
end;
}
+ if (PlayerIsTired())
+ end;
+ Bury();
+ end;
- narrator S_LAST_BLANK_LINE,
- l("You hold the shovel in your hands. What are you going to do?");
+function CheckDigLocation {
+ getmapxy(.@map$, .@x, .@y, 0);
+ for (.@i = 0; .@i < getarraysize(.WorldDigRect_Map$); .@i++)
+ {
+ if (!strcmp(.WorldDigRect_Map$[.@i], .@map$) &&
+ .WorldDigRect_x1[.@i] <= .@x &&
+ .WorldDigRect_x2[.@i] >= .@x &&
+ .WorldDigRect_y1[.@i] <= .@y &&
+ .WorldDigRect_y2[.@i] >= .@y)
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
- .@action = select(
- l("Dig."),
- l("Bury."),
- l("Nothing."));
+function AddDigRect {
+ if (getargcount() < 5) {
+ debugmes "usage: AddDigRect(map$,x1,y1,x2,y2)";
+ return 0;
+ }
+ .@map$ = str(getarg(0));
+ .@x1 = getarg(1);
+ .@y1 = getarg(2);
+ .@x2 = getarg(3);
+ .@y2 = getarg(4);
+ .@size = getarraysize(.WorldDigRect_Map$);
+ .WorldDigRect_Map$[.@size] = .@map$;
+ .WorldDigRect_x1[.@size] = .@x1;
+ .WorldDigRect_y1[.@size] = .@y1;
+ .WorldDigRect_x2[.@size] = .@x2;
+ .WorldDigRect_y2[.@size] = .@y2;
+ return 1;
+}
- switch(.@action)
- {
- case 1:
- if (PlayerIsTired())
- close;
- if (!ShovelQuests())
- Dig();
- break;
- case 2:
- if (PlayerIsTired())
- close;
- Bury();
- break;
- case 3:
- narrator S_FIRST_BLANK_LINE, l("You withdraw your shovel.");
- break;
+function PlayerIsTired {
+ // GMs can do this in an unrestricted way
+ if (is_gm())
+ return 0;
+
+ .@tick = gettimetick(1);
+ .@playertick = .PlayerTiredTime - (readparam(bStr)/5) - (readparam(bVit)/10);
+
+ // Dig and Bury more with Steel Shovel
+ if (countitem(SteelShovel)) {
+ .@playertick-=(.PlayerTiredTime*2)/3;
}
- close;
+ if (@ShovelLastUsed + max(5, .@playertick) > .@tick) {
+ dispbottom lg("You are exhausted, you should rest a bit.");
+ return 1;
+ }
+ @ShovelLastUsed = .@tick;
+ return 0;
+}
OnInit:
// Define constants