summaryrefslogtreecommitdiff
path: root/npc/items
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-05-24 13:47:28 -0300
committerJesusaves <cpntb1@ymail.com>2020-05-24 13:47:28 -0300
commit9c322449ade0d1952f6ca4dd73cc92413f61ca69 (patch)
tree1bff0731c4db0790ef57a2d524d739b1241ffa2c /npc/items
parent9c649056dc45d39e88036bdb2bb373c477f8571f (diff)
parent255cf7c47f76a6e2f12fc809473ce513c294dfa4 (diff)
downloadserverdata-jesusalva/inns.tar.gz
serverdata-jesusalva/inns.tar.bz2
serverdata-jesusalva/inns.tar.xz
serverdata-jesusalva/inns.zip
Merge branch 'master' into jesusalva/innsjesusalva/inns
Diffstat (limited to 'npc/items')
-rw-r--r--npc/items/cookie.txt22
-rw-r--r--npc/items/master_skillbook.txt24
-rw-r--r--npc/items/shovel.txt161
3 files changed, 182 insertions, 25 deletions
diff --git a/npc/items/cookie.txt b/npc/items/cookie.txt
new file mode 100644
index 00000000..e451e844
--- /dev/null
+++ b/npc/items/cookie.txt
@@ -0,0 +1,22 @@
+// Evol script.
+// Author:
+// Jesusalva
+// Reid (?)
+// Description:
+// Prevents cookie from being used for too long
+
+function script UnequipCookie {
+ if (getequipid(EQI_HEAD_MID) == DeliciousCookie)
+ unequip(EQI_HEAD_MID);
+ return;
+}
+
+- script #DeliciousCookie NPC_HIDDEN,{
+ end;
+
+OnUnequip:
+ UnequipCookie();
+ end;
+
+}
+
diff --git a/npc/items/master_skillbook.txt b/npc/items/master_skillbook.txt
index d7e7de14..e00a1abc 100644
--- a/npc/items/master_skillbook.txt
+++ b/npc/items/master_skillbook.txt
@@ -6,7 +6,7 @@
// Contains master skills which can only be learnt after killing boss
// See also: <link to tmw forum topic>
// Notes:
-// Not exactly equal as Elvano proposal. I actually care for restrictions you know...
+// Not exactly as Elvano proposal. I actually care for restrictions you know...
// Variables:
// PERMANENT:
// MASTERBOOK_PAGES - How many pages your Master Book have.
@@ -16,7 +16,7 @@
// TEMPORARY:
// @mb_BossId - Contains the MobID of the boss your party killed.
// @mb_SkillId - Contains the SkillID which can be learnt with the boss.
-// @mb_ItemId - Contains the Ink Id to write (or whatever)
+// @mb_ItemId - Contains the Feather Id to write (or whatever)
// @mb_ItemAm - How many ink is required to write the skill
// Remember: @mb_BossId will be reset to zero after 15 seconds from boss death.
// Or upon logout. Or when changing maps. Temporary variables aren't reliable.
@@ -25,8 +25,8 @@
// Remember: A dialog prevents timer events from happening, but doesn't stops the timer.
// TODO: Currently no way to get skill name from database (add getskillinfo() to server-plugin please)
// TODO: Reset @mb_* when register_skill() finish
-// TODO: Add Magic Ink
-// TODO: When another party/player kills the boss, book should say so.
+// TODO: You cannot get Magic Feather anywhere in the game (yet)
+// TODO: See if the time (15s) is enough.
- script #MasterBook NPC_HIDDEN,{
@@ -35,19 +35,30 @@
setnpcdialogtitle l(.book_name$);
+ // If boss is set, but is negative, this means somebody else defeated it
+ if (@mb_BossId < 0)
+ {
+ mesc l("You did not defeat the boss, you can't learn any skills.");
+ @mb_BossId=0;
+ close;
+ }
+
+ // Report the boss you killed, and the boss level
.@mb_lvl=strmobinfo(3, @mb_BossId);
mesc l("You just defeated the following boss: @@ (Lv. @@)", strmobinfo(1, @mb_BossId), .@mb_lvl);
- // Check if all reqs are met
+
// The boss must have a skill
if (!@mb_SkillId)
{
mesc l("But there is no skill to be learnt from this boss.");
+ @mb_BossId=0;
close;
}
// You must have free pages
if (array_entries(MASTERBOOK_SKILL) >= MASTERBOOK_PAGES)
{
mesc l("But you ran out of empty pages on this book.");
+ @mb_BossId=0;
close;
}
// TODO: Party Level Range
@@ -55,12 +66,14 @@
if (BaseLevel+30 < .@mb_lvl)
{
mesc l("But you are out of the boss level range.");
+ @mb_BossId=0;
close;
}
// You must have enough materials
if (countitem(@mb_ItemId) < @mb_ItemAm)
{
mesc l("But you do not have enough Magic Ink. (You need: @@ @@)", @mb_ItemAm, getitemlink(@mb_ItemId));
+ //@mb_BossId=0;
close;
}
@@ -79,6 +92,7 @@
closeclientdialog;
dispbottom l("You have learnt the skill.");
}
+ @mb_BossId=0;
close;
}
diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt
index 81c0d22e..ac1cd50c 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)
@@ -9,10 +10,12 @@
function CheckDigLocation {
getmapxy(.@map$, .@x, .@y, 0);
- if (getunits(BL_NPC, .@units, 1, .@map$, .@x - 1, .@y, .@x + 1, .@y + 1))
- {
- dispbottom(l("You cannot bury under a NPC!"));
- return false;
+ if (.@map$ != "001-1") {
+ if (getunits(BL_NPC, .@units, 1, .@map$, .@x - 1, .@y, .@x + 1, .@y + 1))
+ {
+ dispbottom(l("You cannot bury under a NPC!"));
+ return false;
+ }
}
// TODO: we should have a way to check for GROUNDTOP collisions too
@@ -36,7 +39,7 @@
function AddDigRect {
if (getargcount() < 5)
{
- debugmes "usage: AddDigRect(map$,x1,y1,x2,y2)";
+ consolemes(CONSOLEMES_ERROR, "usage: AddDigRect(map$,x1,y1,x2,y2)");
return 0;
}
.@map$ = str(getarg(0));
@@ -53,6 +56,13 @@
return 1;
}
+ function AddMapDigRect {
+ .@m$=getarg(0);
+ .@x=getmapinfo(MAPINFO_SIZE_X, .@m$)-20;
+ .@y=getmapinfo(MAPINFO_SIZE_Y, .@m$)-20;
+ return AddDigRect(.@m$, 20, 20, .@x, .@y);
+ }
+
function PlayerIsTired {
if (is_evtc())
return false; // event coordinators are never tired
@@ -96,21 +106,28 @@
}
function Bury {
- narrator(S_FIRST_BLANK_LINE | S_LAST_NEXT,
- l("What would you like to bury?"));
+ narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("What would you like to bury?");
+ .@items$ = "";
+
+ mes "##B" + l("Drag and drop an item from your inventory.") + "##b";
- 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. [JESUS]
- // event coordinators can always bury
- if (!is_evtc() && (.@id < 1 || countitem(.@id) < 1 ||
- compare(getitemname(.@id), "shovel") || checkbound(.@id) ||
- !getiteminfo(.@id, ITEMINFO_MAXCHANCE)))
- {
- mesc(l("You cannot bury this item!"));
- return false;
+ // If ID is invalid, there's not enough items, it is an Iron Shovel, it is bound = Cannot bury
+ // NOBODY bypass notrade check. (ITR_NONE is 0)
+ if (.@id < 1) close;
+ if (.@id < 1 || countitem(.@id) < 1 || .@id == IronShovel || checkbound(.@id) ||
+ (!getiteminfo(.@id, ITEMINFO_TRADE))
+ ) {
+ @ShovelLastUsed = 0;
+ if (.@id == IronShovel || .@id == SteelShovel || checkbound(.@id))
+ mesc l("You cannot bury this item!");
+ else if (!getiteminfo(.@id, ITEMINFO_TRADE))
+ mesc l("This item is too precious, you cannot part with it!");
+ else
+ mesc l("You give up.");
+ close;
+ return;
}
.@amount = 1;
@@ -193,7 +210,17 @@ OnHour00:
OnInit:
.PlayerTiredTime = 20;
- AddDigRect("001-1", 172, 26, 200, 48);
+
+ // Partial maps
+ AddDigRect("001-1", 172, 26, 200, 48);
+ AddDigRect("008-1-1", 32, 42, 46, 88);
+ AddDigRect("008-1-2", 40, 52, 114, 146);
+ AddDigRect("012-1", 44, 21, 139, 47);
+
+ // Whole maps
+ AddMapDigRect("008-1");
+ AddMapDigRect("008-3-5");
+ AddMapDigRect("012-3-1");
end;
}
@@ -201,7 +228,7 @@ OnInit:
function script shovel_addquest {
if (getargcount() < 4)
{
- debugmes "usage: shovel_addquest(map$,x,y,func$)";
+ consolemes(CONSOLEMES_ERROR, "usage: shovel_addquest(map$,x,y,func$)");
return 0;
}
.@map$ = str(getarg(0));
@@ -219,7 +246,7 @@ function script shovel_addquest {
function script shovel_adddigrect {
if (getargcount() < 5)
{
- debugmes "usage: shovel_adddigrect(map$,x1,y1,x2,y2)";
+ consolemes(CONSOLEMES_ERROR, "usage: shovel_adddigrect(map$,x1,y1,x2,y2)");
return 0;
}
.@map$ = str(getarg(0));
@@ -235,3 +262,97 @@ 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");
+ if (.@a$ == "008-1")
+ return l("East Woodlands");
+ if (.@a$ == "008-1-1")
+ return l("West Woodland Beach");
+ if (.@a$ == "008-1-2")
+ return l("Swamps");
+ if (.@a$ == "008-3-5")
+ return l("Hurnscald Bandit Cave");
+ if (.@a$ == "012-1")
+ return l("Candor North");
+ if (.@a$ == "012-3-1")
+ return l("Candor Main Cave");
+
+ 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 || .@id == TreasureKey)
+ .@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("008-1", "008-1-1", "008-1-2", "008-3-5",
+ "012-1", "012-3-1");
+
+ // Prepare good defaults
+ .@x1=.@y1=20;
+ .@x2=getmapinfo(MAPINFO_SIZE_X, .@m$)-20;
+ .@y2=getmapinfo(MAPINFO_SIZE_Y, .@m$)-20;
+
+ // Default overrides
+ if (.@m$ == "008-1-1") {
+ // West Woodland Beach
+ .@x1=32; .@y1=42;
+ .@x2=46; .@y2=88;
+ } else if (.@m$ == "008-1-2") {
+ // Swamps
+ .@x1=40; .@y1=52;
+ .@x2=114; .@y2=146;
+ } else if (.@m$ == "012-1") {
+ // Candor North
+ .@x1=44; .@y1=139;
+ .@x2=21; .@y2=47;
+ }
+
+ // Dangerous, but I never had issues with this
+ do {
+ .@x=rand2(.@x1, .@x2);
+ .@y=rand2(.@y1, .@y2);
+ } 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;
+}
+
+