From 46127242f356137c3927cc8d647a61070f4a2e6a Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 24 Sep 2022 16:24:59 -0300 Subject: Add new passive skill: Realm of Drops. --- db/re/skill_db.conf | 14 ++++++++- db/re/skill_tree.conf | 1 + npc/025-1/phoenix.txt | 2 ++ npc/functions/clientversion.txt | 6 ++++ npc/functions/main.txt | 3 ++ npc/functions/mobpoint.txt | 1 + npc/magic/drops.txt | 65 +++++++++++++++++++++++++++++++++++++++++ npc/scripts.conf | 1 + 8 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 npc/magic/drops.txt diff --git a/db/re/skill_db.conf b/db/re/skill_db.conf index 4e59926ee..d29462558 100644 --- a/db/re/skill_db.conf +++ b/db/re/skill_db.conf @@ -38485,7 +38485,19 @@ skill_db: ( Quest: true } }, -// 20005~20009 reserved for TMW/Evol +// 20005~20008 reserved for TMW/Evol +{ + Id: 20009 + Name: "TMW2_DROPS" + Description: "Realm of Drops" + MaxLevel: 10 + SkillType: { + Passive: true + } + SkillInfo: { + Quest: true + } +}, { Id: 20010 Name: "TMW2_SKILLPERMIT" diff --git a/db/re/skill_tree.conf b/db/re/skill_tree.conf index 64a68d45d..02d20488a 100644 --- a/db/re/skill_tree.conf +++ b/db/re/skill_tree.conf @@ -46,6 +46,7 @@ Human: { TMW2_OVERLOAD: 0 TMW2_STUDY: 0 TMW2_OVHFIRE: 0 + TMW2_DROPS: 0 // Transmigration Skills TMW2_PARUM: 0 diff --git a/npc/025-1/phoenix.txt b/npc/025-1/phoenix.txt index 2c8da3271..5e80f4151 100644 --- a/npc/025-1/phoenix.txt +++ b/npc/025-1/phoenix.txt @@ -59,6 +59,7 @@ OnMain: mes l("* 1 %s", getitemlink(SupremeGift)); mes l("* 1 Trait"); mes l("* Healing items improved"); + mes l("* %s Level up", getskillname(TMW2_DROPS)); if (BaseLevel < .@blvl) { setpcblock(PCBLOCK_HARD, false); close; @@ -113,6 +114,7 @@ OnMain: REBIRTH+=1; REBIRTH_OVERLEVEL=max(0, BaseLevel-.@blvl-(REBIRTH_OVERLEVEL/REBIRTH)); resetlvl(3); + sk_lvup(TMW2_DROPS); NewcomerEXPDROPUP(); getvaultexp(20); getitembound SupremeGift, 1, 4; diff --git a/npc/functions/clientversion.txt b/npc/functions/clientversion.txt index 1e7474de4..f506edb0e 100644 --- a/npc/functions/clientversion.txt +++ b/npc/functions/clientversion.txt @@ -1040,6 +1040,12 @@ function script clientupdater { if (getq2(HalinarzoQuest_LifeDelight) >= 21) Mobpt+=((getq2(HalinarzoQuest_LifeDelight) - 1) * (getq2(HalinarzoQuest_LifeDelight) - 20)); // Will work... Sort of } + // Realm of Drops + // sab set 24 15:37:15 BRT 2022 + if (UPDATE < 1664044635) { + UPDATE=1664044635; + skill TMW2_DROPS, REBIRTH+1, 0; + } // :// End of Regular Update System //////////////////////////////////// diff --git a/npc/functions/main.txt b/npc/functions/main.txt index 2c7f62c8d..a099916f6 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -90,6 +90,9 @@ function script adddefaultskills { if (getskilllv(TMW2_FAKESKILL2) < 1) { skill TMW2_FAKESKILL2, 1, 0; } + if (getskilllv(TMW2_DROPS) < REBIRTH+1) { + skill TMW2_DROPS, (REBIRTH+1), 0; + } return; } diff --git a/npc/functions/mobpoint.txt b/npc/functions/mobpoint.txt index 62951e3b0..016177f5b 100644 --- a/npc/functions/mobpoint.txt +++ b/npc/functions/mobpoint.txt @@ -87,6 +87,7 @@ OnNPCKillEvent: callfunc "CadisQuestCheck"; callfunc "GeminiKill"; callfunc "MKAggro"; + callfunc "SK_drops"; // Unset killedrid. This affects multiple calls of this function // But it is in overall more reliable imao diff --git a/npc/magic/drops.txt b/npc/magic/drops.txt new file mode 100644 index 000000000..fcfc57e03 --- /dev/null +++ b/npc/magic/drops.txt @@ -0,0 +1,65 @@ +// TMW2 script +// Author: Jesusalva +// +// Magic Script: TMW2_DROPS +// +// Realm of Drops - A passive skill which drastically improves drop rates + +function script SK_drops { + .@mobId=getarg(0, killedrid); + if (getskilllv(TMW2_DROPS) <= 0) + return; + if (.@mobId <= 0) + return; + if (@skdrop[.@mobId] < 0) + return; + + // Keep in mind that it is reset on logout + @skdrop[.@mobId]+=1; + .@lv=getmonsterinfo(.@mobId, MOB_LV); + .@min=10-getskilllv(TMW2_DROPS)+(.@lv/10); + + // Maybe we are in condition for the bonus drop + if (@skdrop[.@mobId] % .@min == 0) { + // This creates .@item and .@rate with same index + deletearray($@MobDrop_item); + deletearray($@MobDrop_rate); + getmobdrops(.@mobId); + .@count = $@MobDrop_count; + copyarray(.@item[0], $@MobDrop_item[0], .@count); + copyarray(.@rate[0], $@MobDrop_rate[0], .@count); + + // .@total => sum of all drop rates + // .@array => The real array for relative_array_random() + .@total = 0; + .@array = -1; + for (.@i = 0; .@i < .@count; ++.@i) { + .@s = getarraysize(.@array); + array_push(.@array, .@item[.@i]); + array_push(.@array, .@rate[.@i]); + .@total+=.@rate[.@i]; + } + + // Now we determine if you can, or cannot, get a bonus drop + if (.@total < 500) { + if (.@total < 200) { + // Hard limit: 2% of total drop rate (-1 prevents execution) + @skdrop[.@mobId]=-1; + return; + } else { + // Soft limit: Half the efficiency + if (@skdrop[.@mobId] % (.@min*2) != 0) + return; + } + } + + // You can! So give you a random bonus drop with proper ponderation + .@drop = relative_array_random(.@array); + getmapxy(.@m$, .@x, .@y, 0); + makeitem(.@drop, 1, .@m$, .@x, .@y); + if ($@GM_OVERRIDE || debug) + debugmes("Realm of Drops: Created %d as bonus drop in (%d,%d) [TDR %d KL %d]", .@drop, .@x, .@y, .@total, @skdrop[.@mobId]); + } + return; +} + diff --git a/npc/scripts.conf b/npc/scripts.conf index fcf973775..e51c7e472 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -128,6 +128,7 @@ "npc/magic/abizit.txt", "npc/magic/demure.txt", "npc/magic/dragokin.txt", +"npc/magic/drops.txt", "npc/magic/forget.txt", "npc/magic/guild.txt", "npc/magic/mpregen.txt", -- cgit v1.2.3-60-g2f50