Verified Commit 25c9d8e1 authored by Jesusaves's avatar Jesusaves

Update shovel code.

It will use drag'n'drop feature.
It'll also have protection so you don't bury items too difficult to obtain,
items which are bound, and your own shovel (ofc).

PS. Legacy code was NOT updated to meet with @gumi standards, only new one.
The code was tested.
parent 435ace0c
Pipeline #24970685 passed with stages
in 38 minutes and 14 seconds
// Evol scripts.
// Author:
// Jesusalva
// Travolta
// Description:
// NPC to use shovel (dig, bury etc)
......@@ -84,19 +85,30 @@
function Bury {
narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("What would you like to bury?");
.@items$ = "";
getinventorylist;
for (.@i = 0; .@i < @inventorylist_count; .@i++)
mes("##B" + l("Drag and drop an item from your inventory.") + "##b");
.@id = requestitem();
// You cannot bury: Items you don't have, your shovel, Bound Items, and items which are not dropped by any mobs.
// The "item not dropped by any mob" is temporary, and should be replaced by "items with trade restrictions" later.
if (.@id < 1 || countitem(.@id) < 1 || .@id == IronShovel || checkbound(.@id) || !getiteminfo(.@id, ITEMINFO_MAXCHANCE))
{
.@items$ = .@items$ + getitemname(@inventorylist_id[.@i]) + ":";
debugmes getitemname(@inventorylist_id[.@i]);
@ShovelLastUsed = 0;
if (.@id == IronShovel || checkbound(.@id))
mes(col(l("You cannot bury this item!")));
else if (!getiteminfo(.@id, ITEMINFO_MAXCHANCE))
mes(col(l("This item is too precious, you cannot part with it!")));
else
mes(col(l("You give up.")));
return;
}
.@idx = select(.@items$) - 1;
.@id = @inventorylist_id[.@idx];
.@amount = 1;
if (@inventorylist_amount[.@idx] > 1)
if (countitem(.@id) > 1)
{
narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("Amount?");
input .@amount, 1, @inventorylist_amount[.@idx];
input .@amount, 1, countitem(.@id);
}
getmapxy(.@map$, .@x, .@y, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment