From 198169a0a301a6583b9deeb6e6817caddae814f7 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 11 May 2019 20:30:45 +0000 Subject: Improvements to Calamity Dungeon and Master Skill Book. Reset defeated boss upon failure/success so you can read the book after (within the 15 seconds time limit). This is not unset by lack of ink, so you can (if you are quick enough) trade inks with friends. Also, requires Magic Feather. Reports if someone else kill the boss. --- db/re/item_db.conf | 10 ++++++++++ npc/008-4-1/boss.txt | 7 +++++-- npc/items/master_skillbook.txt | 24 +++++++++++++++++++----- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/db/re/item_db.conf b/db/re/item_db.conf index 7dec6d2b..f5b7847b 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -2756,6 +2756,16 @@ item_db: ( ViewSprite: 756 BindOnEquip: false }, +{ + Id: 757 + AegisName: "MagicFeather" + Name: "Magic Feather" + Type: "IT_ETC" + Buy: 4000 + Sell: 1000 + Weight: 1 + Refine: false +}, { Id: 800 AegisName: "DiamondShard" diff --git a/npc/008-4-1/boss.txt b/npc/008-4-1/boss.txt index 17b04880..fda71fff 100644 --- a/npc/008-4-1/boss.txt +++ b/npc/008-4-1/boss.txt @@ -34,12 +34,15 @@ OnBossDeath: } else { - addtimer(10, "#BossCtrl_008-4-1::OnBegin"); + $@MB_00841=-2; + areatimer("008-4-1", .@x-15, .@y-15, .@x+15, .@y+15, 10, "#BossCtrl_008-4-1::OnBossCheck"); + addtimer(20, "#BossCtrl_008-4-1::OnBegin"); mapannounce "008-4-1", "Boss deafeated by: " + strcharinfo(0), bc_all; } end; OnBossCheck: + @mb_BossId=-1; // TODO: Check if you really fought or was just lurking // Check if party is correct if (getcharid(1) != $@MB_00841) @@ -47,7 +50,7 @@ OnBossCheck: OnBegin: @mb_BossId=GameBalance; @mb_SkillId=MG_COLDBOLT; - @mb_ItemId=Manana; // Placeholder + @mb_ItemId=MagicFeather; // Placeholder @mb_ItemAm=1; addtimer(15000, "#BossCtrl_008-4-1::OnFinish"); 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: // 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; } -- cgit v1.2.3-60-g2f50