diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-07 07:09:22 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-07 08:35:30 -0300 |
commit | e7be872b6514807b68e36fcb6d25e9d35217a6d7 (patch) | |
tree | b983c6d71d7f7684ea19612c06796e724f266011 | |
parent | 89d39e32679522a3adda8c78ba4021dc5078fd73 (diff) | |
download | serverdata-e7be872b6514807b68e36fcb6d25e9d35217a6d7.tar.gz serverdata-e7be872b6514807b68e36fcb6d25e9d35217a6d7.tar.bz2 serverdata-e7be872b6514807b68e36fcb6d25e9d35217a6d7.tar.xz serverdata-e7be872b6514807b68e36fcb6d25e9d35217a6d7.zip |
Burried Treasure + Treasure Key
-rw-r--r-- | db/re/item_db.conf | 28 | ||||
-rw-r--r-- | npc/items/shovel.txt | 61 |
2 files changed, 89 insertions, 0 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf index adf5fcec..38963955 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -1184,6 +1184,24 @@ item_db: ( sc_start SC_INCHITRATE, 80000, 300; "> }, +{ + Id: 615 + AegisName: "TreasureMap" + Name: "Treasure Map" + Type: "IT_USABLE" + Buy: 45000 + Sell: 300 + Weight: 14 + KeepAfterUse: true + Refine: false + Script: <" + // ShovelQuests_Assigned<MAP$,X,Y> → Coordinates for Treasure Map + if (!ShovelQuests_AssignedX) { + callfunc "shovel_genrandtreasure"; + } + dispbottom l("A treasure is burried in @@, (@@, @@)", ShovelQuests_AssignedMAP$, ShovelQuests_AssignedX, ShovelQuests_AssignedY); + "> +}, // Generic { @@ -1849,6 +1867,16 @@ item_db: ( nogstorage: true } }, +{ + Id: 808 + AegisName: "TreasureKey" + Name: "Treasure Key" + Type: "IT_ETC" + Buy: 500 + Sell: 110 + Weight: 2 + Refine: false +}, // Necklaces { Id: 1000 diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt index fef4c24f..8fb1975e 100644 --- a/npc/items/shovel.txt +++ b/npc/items/shovel.txt @@ -1,6 +1,7 @@ // Evol scripts. // Author: // Travolta +// Jesusalva // Description: // NPC to use shovel (dig, bury etc) @@ -235,3 +236,63 @@ function script shovel_adddigrect { set getvariableofnpc(.WorldDigRect_y2[.@size], strnpcinfo(3)), .@y2; return 1; } + +// [Treasure Map] functions + +function script shovel_getcity { + .@a$=getarg(0); + + // else is not required (return prevails) + if (.@a$ == "001-1") + return l("Artis Hills"); + + return .@a$; +} + +function script shovel_randomtreasure { + .@id=any(TreasureKey,CoinBag,CoinBag,CoinBag,Coal, + Diamond,Ruby,Emerald,Sapphire,Topaz,Amethyst, + MaggotSlimePotion, LargeMana, LargeHealing); + delitem TreasureMap, 1; + .@amount=any(1,1,2); + // Very Commons + if (.@id == CoinBag || .@id == MaggotSlimePotion) + .@amount+=any(0,1,0,1,2); + // Super commons + if (.@id == LargeMana || .@id == LargeHealing) + .@amount+=rand2(0,8); + // Rares + if (.@id == Coal) + .@amount=1; + getitem .@id, .@amount; + ShovelQuests_AssignedMAP$=""; + ShovelQuests_AssignedX=0; + ShovelQuests_AssignedY=0; + + mesn strcharinfo(0); + mesc l("You found something!"); + mesc l("It's %d %s.", .@amount, getitemlink(.@id)); + next; + closeclientdialog; + return; +} + +function script shovel_genrandtreasure { + .@m$=any("001-1", "001-1"); + // Dangerous, but I never had issues with this + do { + .@x=rand(20, getmapinfo(MAPINFO_SIZE_X, .@m$)-20); + .@y=rand(20, getmapinfo(MAPINFO_SIZE_Y, .@m$)-20); + } while (!checkcell(.@m$, .@x, .@y, cell_chkpass)); + + // Success + if (checkcell(.@m$, .@x, .@y, cell_chkpass)) { + shovel_addquest(.@m$, .@x, .@y, "shovel_randomtreasure"); + ShovelQuests_AssignedMAP$=shovel_getcity(.@m$); + ShovelQuests_AssignedX=.@x; + ShovelQuests_AssignedY=.@y; + } + return; +} + + |