Attached you can find a patch file that shows how to do it. The patch file contains a few more things and is not up-to-date to latest rAthena (it's from May 2024).
What is in the patch:
- Replace all unknown drops with Apple and all unknown MVP drops with Elunium
- Remove random option feature (doesn't work in pre-re)
- Recalculate renewal DEF to pre-renewal DEF if monster ID is 2083 or higher
- Recalculate renewal MDEF to pre-renewal MDEF if monster ID is 2083 or higher
- Recalculate renewal ATK/ATK2 to pre-renewal ATK/ATK2
- Replace all unknown monster skills with NPC_EMOTION
If you are only interested in the DEF/MDEF part, you can only take over those changes:
@@ -4561,6 +4570,12 @@ uint64 MobDatabase::parseBodyNode(const ryml::NodeRef& node) {
if (!this->asUInt16(node, "Defense", def))
return 0;
+#ifndef RENEWAL
+ // Renewal to pre-re conversion
+ if (mob_id >= 2083)
+ def = static_cast<uint16>(100.0 - ((4000.0 + def) / (4000.0 + def * 10.0) * 100.0));
+#endif
+
if (def < DEFTYPE_MIN || def > DEFTYPE_MAX) {
this->invalidWarning(node["Defense"], "Invalid monster defense %d, capping...\n", def);
def = cap_value(def, DEFTYPE_MIN, DEFTYPE_MAX);
@@ -4575,6 +4590,12 @@ uint64 MobDatabase::parseBodyNode(const ryml::NodeRef& node) {
if (!this->asUInt16(node, "MagicDefense", def))
return 0;
+#ifndef RENEWAL
+ // Renewal to pre-re conversion
+ if (mob_id >= 2083)
+ def = static_cast<uint16>(100.0 - ((1000.0 + def) / (1000.0 + def * 10.0) * 100.0));
+#endif
+
if (def < DEFTYPE_MIN || def > DEFTYPE_MAX) {
this->invalidWarning(node["MagicDefense"], "Invalid monster magic defense %d, capping...\n", def);
def = cap_value(def, DEFTYPE_MIN, DEFTYPE_MAX);
Hope this helps!
I mainly wrote this patch so I can use all renewal monsters directly in pre-re by copying them over without having to worry about unsupported features and changes of functionality of stats.
load_re_mobs_in_prere.patch