diff options
author | Joseph Botosh <rumly111@gmail.com> | 2015-09-24 05:47:54 +0300 |
---|---|---|
committer | Joseph Botosh <rumly111@gmail.com> | 2015-09-24 05:47:54 +0300 |
commit | 9635df8475f479f416d933edb7d473232d794545 (patch) | |
tree | d2e1990567daf7818689e5ec8d9ee0d13d64aa1a /npc | |
parent | 08195da4e4ec4ecdaeb4aac3c8f38fa057f1e563 (diff) | |
download | serverdata-9635df8475f479f416d933edb7d473232d794545.tar.gz serverdata-9635df8475f479f416d933edb7d473232d794545.tar.bz2 serverdata-9635df8475f479f416d933edb7d473232d794545.tar.xz serverdata-9635df8475f479f416d933edb7d473232d794545.zip |
add Dig and Bury actions/functions to Shovel
Diffstat (limited to 'npc')
-rw-r--r-- | npc/items/shovel.txt | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt index e79ead47d..b6302d9fd 100644 --- a/npc/items/shovel.txt +++ b/npc/items/shovel.txt @@ -7,8 +7,62 @@ - script Shovel -1,{ + function Dig { + getmapxy(.@map$, .@x, .@y, 0); + for (.@i = 0; .@i < getarraysize($WorldBuriedTreasures_id); .@i++) + { + if ($WorldBuriedTreasures_x[.@i] == .@x && + $WorldBuriedTreasures_y[.@i] == .@y) + { + .@id = $WorldBuriedTreasures_id[.@i]; + .@amount = $WorldBuriedTreasures_amount[.@i]; + deletearray $WorldBuriedTreasures_id[.@i], 1; + deletearray $WorldBuriedTreasures_amount[.@i], 1; + deletearray $WorldBuriedTreasures_x[.@i], 1; + deletearray $WorldBuriedTreasures_y[.@i], 1; + getitem .@id, .@amount; + narrator + l("You found something!"), + l("It's @@ @@.", .@amount, getitemname(.@id)); + return 1; + } + } + narrator l("Sadly, you found nothing but dirt."); + return 0; + } + + function Bury { + narrator l("What would you like to bury?"); + .@items$ = ""; + getinventorylist; + for (.@i = 0; .@i < @inventorylist_count; .@i++) + { + .@items$ = .@items$ + getitemname(@inventorylist_id[.@i]) + ":"; + debugmes getitemname(@inventorylist_id[.@i]); + } + .@idx = select(.@items$) - 1; + .@id = @inventorylist_id[.@idx]; + .@amount = 1; + if (@inventorylist_amount[.@idx] > 1) + { + narrator l("Amount?"); + input .@amount, 1, @inventorylist_amount[.@idx]; + } + + getmapxy(.@map$, .@x, .@y, 0); + delitem .@id, .@amount; + .@wtc = getarraysize($WorldBuriedTreasures_id); + $WorldBuriedTreasures_id[.@wtc] = .@id; + $WorldBuriedTreasures_amount[.@wtc] = .@amount; + $WorldBuriedTreasures_x[.@wtc] = .@x; + $WorldBuriedTreasures_y[.@wtc] = .@y; + narrator l("You buried @@ @@.", .@amount, getitemname(.@id)); + + return 0; + } + OnUse: - narrator + narrator 0, l("You hold the shovel in your hangs."), l("What are you going to do?"); @@ -17,18 +71,20 @@ OnUse: l("Bury."), l("Nothing.")); - mes ""; switch(.@action) { case 1: - narrator l("DIG Not implemented."); + Dig(); break; case 2: - narrator l("BURY Not implemented."); + Bury(); break; case 3: narrator l("You hide your shovel."); break; } close; + + + } |