From 58d39bb066ad21c051d72b4bee577819fdba0381 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 18 Sep 2020 18:51:50 +0000 Subject: Refine prototype +2 atk/matk per refine level +1 weapon exp per killed monster level Roughly based on Monster Point System + ML Refine System. --- db/re/item_db.conf | 85 +++++++++++++++++++++++++--------- npc/config/hairstyle_config.txt | 2 + npc/functions/global_event_handler.txt | 1 + npc/functions/refine.txt | 66 ++++++++++++++++++++++++++ npc/scripts.conf | 1 + 5 files changed, 132 insertions(+), 23 deletions(-) create mode 100644 npc/functions/refine.txt diff --git a/db/re/item_db.conf b/db/re/item_db.conf index 6be57083..da7157c2 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -778,7 +778,6 @@ item_db: ( Sell: 0 Weight: 10 KeepAfterUse: true - Refine: false Script: <" doevent "@rules::OnUseBook"; "> @@ -792,7 +791,6 @@ item_db: ( Sell: 10 Weight: 30 KeepAfterUse: true - Refine: false Script: <" doevent "#001-2-4-Book2::OnUse"; "> @@ -965,7 +963,6 @@ item_db: ( Buy: 75 Sell: 15 Weight: 15 - Refine: false Delay: 450 UseEffect: "EFFECT_HEAL" Script: <" @@ -1227,7 +1224,6 @@ item_db: ( Sell: 300 Weight: 14 KeepAfterUse: true - Refine: false Script: <" // ShovelQuests_Assigned → Coordinates for Treasure Map if (!ShovelQuests_AssignedX) { @@ -1289,7 +1285,6 @@ item_db: ( Sell: 0 Weight: 0 KeepAfterUse: false - Refine: false Trade: { notrade: true nodrop: true @@ -2255,7 +2250,6 @@ item_db: ( Buy: 500 Sell: 110 Weight: 2 - Refine: false }, { Id: 809 @@ -4179,10 +4173,13 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 1 - Refine: false + Refine: true Subtype: "W_DAGGER" ViewSprite: 1 BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3501 @@ -4199,9 +4196,12 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 3 - Refine: false + Refine: true Subtype: "W_DAGGER" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3502 @@ -4218,9 +4218,12 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 5 - Refine: false + Refine: true Subtype: "W_1HSWORD" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3503 @@ -4237,9 +4240,12 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 5 - Refine: false + Refine: true Subtype: "W_1HSWORD" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3504 @@ -4256,9 +4262,12 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 15 - Refine: false + Refine: true Subtype: "W_1HSWORD" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3505 @@ -4275,11 +4284,12 @@ item_db: ( Loc: ["EQP_HAND_R", "EQP_HAND_L"] WeaponLv: 1 EquipLv: 10 - Refine: false + Refine: true Subtype: "W_STAFF" BindOnEquip: false OnEquipScript: <" doevent "#SpotlightMaster::OnTouch"; + callfunc("refinesync"); "> OnUnequipScript: <" doevent "#SpotlightMaster::OnTouch"; @@ -4304,11 +4314,12 @@ item_db: ( Loc: ["EQP_HAND_R", "EQP_HAND_L"] WeaponLv: 1 EquipLv: 10 - Refine: false + Refine: true Subtype: "W_STAFF" BindOnEquip: false OnEquipScript: <" doevent "#SpotlightMaster::OnTouch"; + callfunc("refinesync"); "> OnUnequipScript: <" doevent "#SpotlightMaster::OnTouch"; @@ -4334,9 +4345,12 @@ item_db: ( Loc: ["EQP_HAND_R","EQP_HAND_L"] WeaponLv: 1 EquipLv: 12 - Refine: false + Refine: true Subtype: "W_2HSPEAR" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3508 @@ -4353,10 +4367,13 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 15 - Refine: false + Refine: true Subtype: "W_DAGGER" ViewSprite: 1 BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3509 @@ -4373,10 +4390,13 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 20 - Refine: false + Refine: true Subtype: "W_DAGGER" ViewSprite: 1 BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3510 @@ -4393,9 +4413,12 @@ item_db: ( Loc: ["EQP_HAND_R","EQP_HAND_L"] WeaponLv: 1 EquipLv: 15 - Refine: false + Refine: true Subtype: "W_KATAR" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3511 @@ -4412,11 +4435,12 @@ item_db: ( Loc: ["EQP_HAND_R","EQP_HAND_L"] WeaponLv: 1 EquipLv: 10 - Refine: false + Refine: true Subtype: "W_STAFF" BindOnEquip: false OnEquipScript: <" doevent "#SpotlightMaster::OnTouch"; + callfunc("refinesync"); "> OnUnequipScript: <" doevent "#SpotlightMaster::OnTouch"; @@ -4438,9 +4462,12 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 10 - Refine: false + Refine: true Subtype: "W_1HAXE" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3513 @@ -4458,9 +4485,12 @@ item_db: ( Loc: ["EQP_HAND_R", "EQP_HAND_L"] WeaponLv: 1 EquipLv: 10 - Refine: false + Refine: true Subtype: "W_2HSTAFF" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3514 @@ -4478,9 +4508,12 @@ item_db: ( Loc: ["EQP_HAND_R", "EQP_HAND_L"] WeaponLv: 1 EquipLv: 20 - Refine: false + Refine: true Subtype: "W_2HAXE" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3515 @@ -4494,9 +4527,12 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 1 - Refine: false + Refine: true Subtype: "W_DAGGER" BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, { Id: 3516 @@ -4510,10 +4546,13 @@ item_db: ( Loc: "EQP_HAND_R" WeaponLv: 1 EquipLv: 15 - Refine: false + Refine: true Subtype: "W_DAGGER" ViewSprite: 1 BindOnEquip: false + OnEquipScript: <" + callfunc("refinesync"); + "> }, // Pet Eggs { diff --git a/npc/config/hairstyle_config.txt b/npc/config/hairstyle_config.txt index de2d0467..6a43e4c8 100644 --- a/npc/config/hairstyle_config.txt +++ b/npc/config/hairstyle_config.txt @@ -20,5 +20,7 @@ OnInit: "Fire red", "Light violet", "Purple plum", "Navy blue", "Lagoon blue", "Twisted teal", "Spring Green", "Forest Green", "Silver Grey", "Esperia Blue"; + + setarray $@REFEXP[0], 400, 900, 2250, 6500, 15000; end; } diff --git a/npc/functions/global_event_handler.txt b/npc/functions/global_event_handler.txt index bc469645..91cd12ef 100644 --- a/npc/functions/global_event_handler.txt +++ b/npc/functions/global_event_handler.txt @@ -51,6 +51,7 @@ OnNPCKillEvent: $MONSTERS_KILLED+=1; MONSTERS_KILLED+=1; callfunc("EnoraKills"); + callfunc("refineupdate"); if ($MONSTERS_KILLED % 1000000 == 0) callfunc("GetBeanieCopter"); end; diff --git a/npc/functions/refine.txt b/npc/functions/refine.txt new file mode 100644 index 00000000..23df387c --- /dev/null +++ b/npc/functions/refine.txt @@ -0,0 +1,66 @@ +// The Mana World Script +// Author: +// Jesusalva +// Inspiration: +// Pyndragon (LoF) +// Scall (TMW-BR) +// Saulc (ML) +// Description: +// Handles refinement + +// refineupdate( {killedrid} ) +function script refineupdate { + // Not armed? We do nothing + if (!getequipisequiped(EQI_HAND_R)) + return; + + // Set temporary variables + .@k=getarg(0, killedrid); + .@w=getequipid(EQI_HAND_R); + .@r=getequiprefinerycnt(EQI_HAND_R); + + + // Weapon cannot be refined + if (!getequipisenableref(EQI_HAND_R)) + return; + + // Register the weapon experience + weaponExp[.@w] = weaponExp[.@w] + getmonsterinfo(.@k, MOB_LV); + + // Get exp needed to level up from global array + .@exp=$@REFEXP[.@r]; + + // Cannot level up + if (.@exp < 1) + return; + + // Leveled up! + if (weaponExp[.@w] >= .@exp) { + weaponExp[.@w]-=.@exp; + weaponLvl[.@w] = weaponLvl[.@w] + 1; + successrefitem(EQI_HAND_R); + dispbottom l("Weapon level up!"); + } + return; +} + +// Resyncs weapon level +function script refinesync { + // Not armed? We do nothing + if (!getequipisequiped(EQI_HAND_R)) + return; + + .@w=getequipid(EQI_HAND_R); + .@r=getequiprefinerycnt(EQI_HAND_R); + .@lv=weaponLvl[.@w]; + + if (.@r > .@lv) { + // Refine level overestimated + downrefitem(EQI_HAND_R, max(0, .@r - .@lv)); + } else if (.@lv > .@r) { + // Refine level understimated + successrefitem(EQI_HAND_R, max(0, .@lv - .@r)); + } + return; +} + diff --git a/npc/scripts.conf b/npc/scripts.conf index 601b5b8e..d3598405 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -49,6 +49,7 @@ "npc/functions/generic-text.txt", "npc/functions/asklanguage.txt", "npc/functions/game-rules.txt", +"npc/functions/refine.txt", "npc/functions/riddle.txt", "npc/functions/bank.txt", "npc/functions/confused-tree-dict.txt", -- cgit v1.2.3-60-g2f50