浏览代码

Converted Elemental Attribute Damage Adjustment Tables to YAML (#6053)

* Converted Elemental Attribute Damage Adjustment Tables to YAML
* Includes CSV2YAML converter

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
Atemo 3 年之前
父节点
当前提交
4d2c5b02d3

+ 40 - 0
db/attr_fix.yml

@@ -0,0 +1,40 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2019 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Elemental Attribute Damage Adjustment Tables
+###########################################################################
+#
+# Elemental Attribute Damage Adjustment Settings
+#
+###########################################################################
+# - Level                        Level of the Attribute.
+#   <element>:                   Attacker's weapon element.
+#       <element>: <value>       Target's defense element. <value> in %, default 100. Value accepted from -100 to 200.
+###########################################################################
+
+Header:
+  Type: ATTRIBUTE_DB
+  Version: 1
+
+Footer:
+  Imports:
+  - Path: db/pre-re/attr_fix.yml
+    Mode: Prerenewal
+  - Path: db/re/attr_fix.yml
+    Mode: Renewal
+  - Path: db/import/attr_fix.yml

+ 0 - 6
db/import-tmpl/attr_fix.txt

@@ -1,6 +0,0 @@
-// Elemental Attribute Damage Adjustment Tables
-//
-// Structure of Database:
-// Columns - attacker's weapon element
-// Rows    - target's defense element
-

+ 32 - 0
db/import-tmpl/attr_fix.yml

@@ -0,0 +1,32 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2019 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Elemental Attribute Damage Adjustment Tables
+###########################################################################
+#
+# Elemental Attribute Damage Adjustment Settings
+#
+###########################################################################
+# - Level                        Level of the Attribute.
+#   <element>:                   Attacker's weapon element.
+#       <element>: <value>       Target's defense element. <value> in %, default 100. Value accepted from -100 to 200.
+###########################################################################
+
+Header:
+  Type: ATTRIBUTE_DB
+  Version: 1

+ 0 - 57
db/pre-re/attr_fix.txt

@@ -1,57 +0,0 @@
-// Elemental Attribute Damage Adjustment Tables
-//
-// Structure of Database:
-// Columns - attacker's weapon element
-// Rows    - target's defense element
-
-1	// lv1 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,  25, 100,  // Neutral
-  100,  25, 100, 150,  50, 100,  75, 100, 100, 100,  // Water
-  100, 100, 100,  50, 150, 100,  75, 100, 100, 100,  // Earth
-  100,  50, 150,  25, 100, 100,  75, 100, 100, 125,  // Fire
-  100, 175,  50, 100,  25, 100,  75, 100, 100, 100,  // Wind
-  100, 100, 125, 125, 125,   0,  75,  50, 100, -25,  // Poison
-  100, 100, 100, 100, 100, 100,   0, 125, 100, 150,  // Holy
-  100, 100, 100, 100, 100,  50, 125,   0, 100, -25,  // Shadow
-   25, 100, 100, 100, 100, 100,  75,  75, 125, 100,  // Ghost
-  100, 100, 100, 100, 100,  50, 100,   0, 100,   0,  // Undead
-
-2	// lv2 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,  25, 100,  // Neutral
-  100,   0, 100, 175,  25, 100,  50,  75, 100, 100,  // Water
-  100, 100,  50,  25, 175, 100,  50,  75, 100, 100,  // Earth
-  100,  25, 175,   0, 100, 100,  50,  75, 100, 150,  // Fire
-  100, 175,  25, 100,   0, 100,  50,  75, 100, 100,  // Wind
-  100,  75, 125, 125, 125,   0,  50,  25,  75, -50,  // Poison
-  100, 100, 100, 100, 100, 100, -25, 150, 100, 175,  // Holy
-  100, 100, 100, 100, 100,  25, 150, -25, 100, -50,  // Shadow
-    0,  75,  75,  75,  75,  75,  50,  50, 150, 125,  // Ghost
-  100,  75,  75,  75,  75,  25, 125,   0, 100,   0,  // Undead
-
-3	// lv3 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,   0, 100,  // Neutral
-  100, -25, 100, 200,   0, 100,  25,  50, 100, 125,  // Water
-  100, 100,   0,   0, 200, 100,  25,  50, 100,  75,  // Earth
-  100,   0, 200, -25, 100, 100,  25,  50, 100, 175,  // Fire
-  100, 200,   0, 100, -25, 100,  25,  50, 100, 100,  // Wind
-  100,  50, 100, 100, 100,   0,  25,   0,  50, -75,  // Poison
-  100, 100, 100, 100, 100, 125, -50, 175, 100, 200,  // Holy
-  100, 100, 100, 100, 100,   0, 175, -50, 100, -75,  // Shadow
-    0,  50,  50,  50,  50,  50,  25,  25, 175, 150,  // Ghost
-  100,  50,  50,  50,  50,   0, 150,   0, 100,   0,  // Undead
-
-4	// lv4 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,   0, 100,  // Neutral
-  100, -50, 100, 200,   0,  75,   0,  25, 100, 150,  // Water
-  100, 100, -25,   0, 200,  75,   0,  25, 100,  50,  // Earth
-  100,   0, 200, -50, 100,  75,   0,  25, 100, 200,  // Fire
-  100, 200,   0, 100, -50,  75,   0,  25, 100, 100,  // Wind
-  100,  25,  75,  75,  75,   0,   0, -25,  25,-100,  // Poison
-  100,  75,  75,  75,  75, 125,-100, 200, 100, 200,  // Holy
-  100,  75,  75,  75,  75, -25, 200,-100, 100,-100,  // Shadow
-    0,  25,  25,  25,  25,  25,   0,   0, 200, 175,  // Ghost
-  100,  25,  25,  25,  25, -25, 175,   0, 100,   0,  // Undead

+ 478 - 0
db/pre-re/attr_fix.yml

@@ -0,0 +1,478 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2021 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Elemental Attribute Damage Adjustment Tables
+###########################################################################
+#
+# Elemental Attribute Damage Adjustment Settings
+#
+###########################################################################
+# - Level                        Level of the Attribute.
+#   <element>:                   Attacker's weapon element.
+#       <element>: <value>       Target's defense element. <value> in %, default 100. Value accepted from -100 to 200.
+###########################################################################
+
+Header:
+  Type: ATTRIBUTE_DB
+  Version: 1
+
+Body:
+  - Level: 1
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 25
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: 25
+      Earth: 100
+      Fire: 150
+      Wind: 50
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 100
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 50
+      Wind: 150
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 100
+    Fire:
+      Neutral: 100
+      Water: 50
+      Earth: 150
+      Fire: 25
+      Wind: 100
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 125
+    Wind:
+      Neutral: 100
+      Water: 175
+      Earth: 50
+      Fire: 100
+      Wind: 25
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 100
+      Earth: 125
+      Fire: 125
+      Wind: 125
+      Poison: 0
+      Holy: 75
+      Dark: 50
+      Ghost: 100
+      Undead: -25
+    Holy:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 0
+      Dark: 125
+      Ghost: 100
+      Undead: 150
+    Dark:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 50
+      Holy: 125
+      Dark: 0
+      Ghost: 100
+      Undead: -25
+    Ghost:
+      Neutral: 25
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 75
+      Dark: 75
+      Ghost: 125
+      Undead: 100
+    Undead:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 50
+      Holy: 100
+      Dark: 0
+      Ghost: 100
+      Undead: 0
+  - Level: 2
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 25
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: 0
+      Earth: 100
+      Fire: 175
+      Wind: 25
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 100
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: 50
+      Fire: 25
+      Wind: 175
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 100
+    Fire:
+      Neutral: 100
+      Water: 25
+      Earth: 175
+      Fire: 0
+      Wind: 100
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 150
+    Wind:
+      Neutral: 100
+      Water: 175
+      Earth: 25
+      Fire: 100
+      Wind: 0
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 75
+      Earth: 125
+      Fire: 125
+      Wind: 125
+      Poison: 0
+      Holy: 50
+      Dark: 25
+      Ghost: 75
+      Undead: -50
+    Holy:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: -25
+      Dark: 150
+      Ghost: 100
+      Undead: 175
+    Dark:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 25
+      Holy: 150
+      Dark: -25
+      Ghost: 100
+      Undead: -50
+    Ghost:
+      Neutral: 0
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 75
+      Holy: 50
+      Dark: 50
+      Ghost: 150
+      Undead: 125
+    Undead:
+      Neutral: 100
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 25
+      Holy: 125
+      Dark: 0
+      Ghost: 100
+      Undead: 0
+  - Level: 3
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 0
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: -25
+      Earth: 100
+      Fire: 200
+      Wind: 0
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 125
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: 0
+      Fire: 0
+      Wind: 200
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 75
+    Fire:
+      Neutral: 100
+      Water: 0
+      Earth: 200
+      Fire: -25
+      Wind: 100
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 175
+    Wind:
+      Neutral: 100
+      Water: 200
+      Earth: 0
+      Fire: 100
+      Wind: -25
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 50
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 0
+      Holy: 25
+      Dark: 0
+      Ghost: 50
+      Undead: -75
+    Holy:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 125
+      Holy: -50
+      Dark: 175
+      Ghost: 100
+      Undead: 200
+    Dark:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 0
+      Holy: 175
+      Dark: -50
+      Ghost: 100
+      Undead: -75
+    Ghost:
+      Neutral: 0
+      Water: 50
+      Earth: 50
+      Fire: 50
+      Wind: 50
+      Poison: 50
+      Holy: 25
+      Dark: 25
+      Ghost: 175
+      Undead: 150
+    Undead:
+      Neutral: 100
+      Water: 50
+      Earth: 50
+      Fire: 50
+      Wind: 50
+      Poison: 0
+      Holy: 150
+      Dark: 0
+      Ghost: 100
+      Undead: 0
+  - Level: 4
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 0
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: -50
+      Earth: 100
+      Fire: 200
+      Wind: 0
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 150
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: -25
+      Fire: 0
+      Wind: 200
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 50
+    Fire:
+      Neutral: 100
+      Water: 0
+      Earth: 200
+      Fire: -50
+      Wind: 100
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 200
+    Wind:
+      Neutral: 100
+      Water: 200
+      Earth: 0
+      Fire: 100
+      Wind: -50
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 25
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 0
+      Holy: 0
+      Dark: -25
+      Ghost: 25
+      Undead: -100
+    Holy:
+      Neutral: 100
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 125
+      Holy: -100
+      Dark: 200
+      Ghost: 100
+      Undead: 200
+    Dark:
+      Neutral: 100
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: -25
+      Holy: 200
+      Dark: -100
+      Ghost: 100
+      Undead: -100
+    Ghost:
+      Neutral: 0
+      Water: 25
+      Earth: 25
+      Fire: 25
+      Wind: 25
+      Poison: 25
+      Holy: 0
+      Dark: 0
+      Ghost: 200
+      Undead: 175
+    Undead:
+      Neutral: 100
+      Water: 25
+      Earth: 25
+      Fire: 25
+      Wind: 25
+      Poison: -25
+      Holy: 175
+      Dark: 0
+      Ghost: 100
+      Undead: 0

+ 0 - 57
db/re/attr_fix.txt

@@ -1,57 +0,0 @@
-// Elemental Attribute Damage Adjustment Tables
-//
-// Structure of Database:
-// Columns - attacker's weapon element
-// Rows    - target's defense element
-
-1	// lv1 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,  70, 100,  // Neutral
-  100,  25, 100, 150,  90, 100,  75, 100, 100, 100,  // Water
-  100, 100,  25,  90, 150, 100,  75, 100, 100, 100,  // Earth
-  100,  90, 150,  25, 100, 100,  75, 100, 100, 125,  // Fire
-  100, 175,  90, 100,  25, 100,  75, 100, 100, 100,  // Wind
-  100, 100, 125, 125, 125,   0,  75,  50, 100, -25,  // Poison
-  100, 100, 100, 100, 100, 100,   0, 125, 100, 150,  // Holy
-  100, 100, 100, 100, 100,  50, 125,   0, 100, -25,  // Shadow
-   70, 100, 100, 100, 100, 100,  75,  75, 125, 100,  // Ghost
-  100, 100, 100, 100, 100,  50, 100,   0, 100,   0,  // Undead
-
-2	// lv2 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,  50, 100,  // Neutral
-  100,   0, 100, 175,  80, 100,  50,  75, 100, 100,  // Water
-  100, 100,   0,  80, 175, 100,  50,  75, 100, 100,  // Earth
-  100,  80, 175,   0, 100, 100,  50,  75, 100, 150,  // Fire
-  100, 175,  80, 100,   0, 100,  50,  75, 100, 100,  // Wind
-  100,  75, 125, 125, 125,   0,  50,  25,  75, -50,  // Poison
-  100, 100, 100, 100, 100, 100, -25, 150, 100, 175,  // Holy
-  100, 100, 100, 100, 100,  25, 150, -25, 100, -50,  // Shadow
-   50,  75,  75,  75,  75,  75,  50,  50, 150, 125,  // Ghost
-  100,  75,  75,  75,  75,  25, 125,   0, 100,   0,  // Undead
-
-3	// lv3 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,   0, 100,  // Neutral
-  100, -25, 100, 200,  70, 100,  25,  50, 100, 125,  // Water
-  100, 100, -25,  70, 200, 100,  25,  50, 100, 100,  // Earth
-  100,  70, 200, -25, 100, 100,  25,  50, 100, 175,  // Fire
-  100, 200,  70, 100, -25, 100,  25,  50, 100, 100,  // Wind
-  100,  50, 100, 100, 100,   0,  25,   0,  50, -75,  // Poison
-  100, 100, 100, 100, 100, 125, -50, 175, 100, 200,  // Holy
-  100, 100, 100, 100, 100,   0, 175, -50, 100, -75,  // Shadow
-    0,  50,  50,  50,  50,  50,  25,  25, 175, 150,  // Ghost
-  100,  50,  50,  50,  50,   0, 150,   0, 100,   0,  // Undead
-
-4	// lv4 Attribute table
-//Neut Watr Erth Fire Wind Pois Holy Shdw Gho  Und
-  100, 100, 100, 100, 100, 100, 100, 100,   0, 100,  // Neutral
-  100, -50, 100, 200,  60,  75,   0,  25, 100, 150,  // Water
-  100, 100, -50,  60, 200,  75,   0,  25, 100,  50,  // Earth
-  100,  60, 200, -50, 100,  75,   0,  25, 100, 200,  // Fire
-  100, 200,  60, 100, -50,  75,   0,  25, 100, 100,  // Wind
-  100,  25,  75,  75,  75,   0,   0, -25,  25,-100,  // Poison
-  100,  75,  75,  75,  75, 125,-100, 200, 100, 200,  // Holy
-  100,  75,  75,  75,  75, -25, 200,-100, 100,-100,  // Shadow
-    0,  25,  25,  25,  25,  25,   0,   0, 200, 175,  // Ghost
-  100,  25,  25,  25,  25, -25, 175,   0, 100,   0,  // Undead

+ 478 - 0
db/re/attr_fix.yml

@@ -0,0 +1,478 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2021 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Elemental Attribute Damage Adjustment Tables
+###########################################################################
+#
+# Elemental Attribute Damage Adjustment Settings
+#
+###########################################################################
+# - Level                        Level of the Attribute.
+#   <element>:                   Attacker's weapon element.
+#       <element>: <value>       Target's defense element. <value> in %, default 100. Value accepted from -100 to 200.
+###########################################################################
+
+Header:
+  Type: ATTRIBUTE_DB
+  Version: 1
+
+Body:
+  - Level: 1
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 70
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: 25
+      Earth: 100
+      Fire: 150
+      Wind: 90
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 100
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: 25
+      Fire: 90
+      Wind: 150
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 100
+    Fire:
+      Neutral: 100
+      Water: 90
+      Earth: 150
+      Fire: 25
+      Wind: 100
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 125
+    Wind:
+      Neutral: 100
+      Water: 175
+      Earth: 90
+      Fire: 100
+      Wind: 25
+      Poison: 100
+      Holy: 75
+      Dark: 100
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 100
+      Earth: 125
+      Fire: 125
+      Wind: 125
+      Poison: 0
+      Holy: 75
+      Dark: 50
+      Ghost: 100
+      Undead: -25
+    Holy:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 0
+      Dark: 125
+      Ghost: 100
+      Undead: 150
+    Dark:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 50
+      Holy: 125
+      Dark: 0
+      Ghost: 100
+      Undead: -25
+    Ghost:
+      Neutral: 70
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 75
+      Dark: 75
+      Ghost: 125
+      Undead: 100
+    Undead:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 50
+      Holy: 100
+      Dark: 0
+      Ghost: 100
+      Undead: 0
+  - Level: 2
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 50
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: 0
+      Earth: 100
+      Fire: 175
+      Wind: 80
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 100
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: 0
+      Fire: 80
+      Wind: 175
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 100
+    Fire:
+      Neutral: 100
+      Water: 80
+      Earth: 175
+      Fire: 0
+      Wind: 100
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 150
+    Wind:
+      Neutral: 100
+      Water: 175
+      Earth: 80
+      Fire: 100
+      Wind: 0
+      Poison: 100
+      Holy: 50
+      Dark: 75
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 75
+      Earth: 125
+      Fire: 125
+      Wind: 125
+      Poison: 0
+      Holy: 50
+      Dark: 25
+      Ghost: 75
+      Undead: -50
+    Holy:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: -25
+      Dark: 150
+      Ghost: 100
+      Undead: 175
+    Dark:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 25
+      Holy: 150
+      Dark: -25
+      Ghost: 100
+      Undead: -50
+    Ghost:
+      Neutral: 50
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 75
+      Holy: 50
+      Dark: 50
+      Ghost: 150
+      Undead: 125
+    Undead:
+      Neutral: 100
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 25
+      Holy: 125
+      Dark: 0
+      Ghost: 100
+      Undead: 0
+  - Level: 3
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 0
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: -25
+      Earth: 100
+      Fire: 200
+      Wind: 70
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 125
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: -25
+      Fire: 70
+      Wind: 200
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 100
+    Fire:
+      Neutral: 100
+      Water: 70
+      Earth: 200
+      Fire: -25
+      Wind: 100
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 175
+    Wind:
+      Neutral: 100
+      Water: 200
+      Earth: 70
+      Fire: 100
+      Wind: -25
+      Poison: 100
+      Holy: 25
+      Dark: 50
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 50
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 0
+      Holy: 25
+      Dark: 0
+      Ghost: 50
+      Undead: -75
+    Holy:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 125
+      Holy: -50
+      Dark: 175
+      Ghost: 100
+      Undead: 200
+    Dark:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 0
+      Holy: 175
+      Dark: -50
+      Ghost: 100
+      Undead: -75
+    Ghost:
+      Neutral: 0
+      Water: 50
+      Earth: 50
+      Fire: 50
+      Wind: 50
+      Poison: 50
+      Holy: 25
+      Dark: 25
+      Ghost: 175
+      Undead: 150
+    Undead:
+      Neutral: 100
+      Water: 50
+      Earth: 50
+      Fire: 50
+      Wind: 50
+      Poison: 0
+      Holy: 150
+      Dark: 0
+      Ghost: 100
+      Undead: 0
+  - Level: 4
+    Neutral:
+      Neutral: 100
+      Water: 100
+      Earth: 100
+      Fire: 100
+      Wind: 100
+      Poison: 100
+      Holy: 100
+      Dark: 100
+      Ghost: 0
+      Undead: 100
+    Water:
+      Neutral: 100
+      Water: -50
+      Earth: 100
+      Fire: 200
+      Wind: 60
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 150
+    Earth:
+      Neutral: 100
+      Water: 100
+      Earth: -50
+      Fire: 60
+      Wind: 200
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 50
+    Fire:
+      Neutral: 100
+      Water: 60
+      Earth: 200
+      Fire: -50
+      Wind: 100
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 200
+    Wind:
+      Neutral: 100
+      Water: 200
+      Earth: 60
+      Fire: 100
+      Wind: -50
+      Poison: 75
+      Holy: 0
+      Dark: 25
+      Ghost: 100
+      Undead: 100
+    Poison:
+      Neutral: 100
+      Water: 25
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 0
+      Holy: 0
+      Dark: -25
+      Ghost: 25
+      Undead: -100
+    Holy:
+      Neutral: 100
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: 125
+      Holy: -100
+      Dark: 200
+      Ghost: 100
+      Undead: 200
+    Dark:
+      Neutral: 100
+      Water: 75
+      Earth: 75
+      Fire: 75
+      Wind: 75
+      Poison: -25
+      Holy: 200
+      Dark: -100
+      Ghost: 100
+      Undead: -100
+    Ghost:
+      Neutral: 0
+      Water: 25
+      Earth: 25
+      Fire: 25
+      Wind: 25
+      Poison: 25
+      Holy: 0
+      Dark: 0
+      Ghost: 200
+      Undead: 175
+    Undead:
+      Neutral: 100
+      Water: 25
+      Earth: 25
+      Fire: 25
+      Wind: 25
+      Poison: -25
+      Holy: 175
+      Dark: 0
+      Ghost: 100
+      Undead: 0

+ 11 - 0
doc/yaml/db/attr_fix.yml

@@ -0,0 +1,11 @@
+###########################################################################
+# Elemental Attribute Damage Adjustment Tables
+###########################################################################
+#
+# Elemental Attribute Damage Adjustment Settings
+#
+###########################################################################
+# - Level                        Level of the Attribute.
+#   <element>:                   Attacker's weapon element.
+#       <element>: <value>       Target's defense element. <value> in %, default 100. Value accepted from -100 to 200.
+###########################################################################

+ 1 - 17
src/map/battle.cpp

@@ -34,8 +34,6 @@
 #include "pc_groups.hpp"
 #include "pet.hpp"
 
-int attr_fix_table[MAX_ELE_LEVEL][ELE_MAX][ELE_MAX];
-
 struct Battle_Config battle_config;
 static struct eri *delay_damage_ers; //For battle delay damage structures.
 
@@ -404,20 +402,6 @@ int battle_delay_damage(t_tick tick, int amotion, struct block_list *src, struct
 	return 0;
 }
 
-/**
- * Get attribute ratio
- * @param atk_elem Attack element enum e_element
- * @param def_type Defense element enum e_element
- * @param def_lv Element level 1 ~ MAX_ELE_LEVEL
- */
-int battle_attr_ratio(int atk_elem, int def_type, int def_lv)
-{
-	if (!CHK_ELEMENT(atk_elem) || !CHK_ELEMENT(def_type) || !CHK_ELEMENT_LEVEL(def_lv))
-		return 100;
-
-	return attr_fix_table[def_lv-1][atk_elem][def_type];
-}
-
 /**
  * Does attribute fix modifiers.
  * Added passing of the chars so that the status changes can affect it. [Skotlex]
@@ -447,7 +431,7 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
 		return damage;
 	}
 
-	ratio = attr_fix_table[def_lv-1][atk_elem][def_type];
+	ratio = elemental_attribute_db.getAttribute(def_lv-1, atk_elem, def_type);
 	if (sc && sc->count) { //increase dmg by src status
 		switch(atk_elem){
 			case ELE_FIRE:

+ 0 - 4
src/map/battle.hpp

@@ -87,9 +87,6 @@ struct Damage {
 	bool isspdamage; /// Display blue damage numbers in clif_damage
 };
 
-//(Used in read pc.cpp) attribute table (battle_attr_fix)
-extern int attr_fix_table[MAX_ELE_LEVEL][ELE_MAX][ELE_MAX];
-
 // Damage Calculation
 
 struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int flag);
@@ -98,7 +95,6 @@ int64 battle_calc_return_damage(struct block_list *bl, struct block_list *src, i
 
 void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int class_);
 
-int battle_attr_ratio(int atk_elem,int def_type, int def_lv);
 int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv);
 int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, std::bitset<NK_MAX> nk, int s_ele, int s_ele_, int64 damage, int left, int flag);
 

+ 1 - 1
src/map/clif.cpp

@@ -6001,7 +6001,7 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst)
 	WBUFW(buf,18)= status->def_ele;
 	for(i=0;i<9;i++)
 //		The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex]
-		WBUFB(buf,20+i)= (unsigned char)((fix=battle_attr_ratio(i+1,status->def_ele, status->ele_lv))<0?0:fix);
+		WBUFB(buf,20+i)= (unsigned char)((fix=elemental_attribute_db.getAttribute(i+1,status->def_ele, status->ele_lv))<0?0:fix);
 
 	clif_send(buf,packet_len(0x18c),&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF);
 }

+ 1 - 1
src/map/map-server.vcxproj

@@ -298,7 +298,7 @@
     <Copy SourceFiles="$(SolutionDir)db\import-tmpl\achievement_db.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\achievement_db.yml')" />
     <Copy SourceFiles="$(SolutionDir)db\import-tmpl\achievement_level_db.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\achievement_level_db.yml')" />
     <Copy SourceFiles="$(SolutionDir)db\import-tmpl\attendance.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\attendance.yml')" />
-    <Copy SourceFiles="$(SolutionDir)db\import-tmpl\attr_fix.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\attr_fix.txt')" />
+    <Copy SourceFiles="$(SolutionDir)db\import-tmpl\attr_fix.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\attr_fix.yml')" />
     <Copy SourceFiles="$(SolutionDir)db\import-tmpl\battleground_db.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\battleground_db.yml')" />
     <Copy SourceFiles="$(SolutionDir)db\import-tmpl\castle_db.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\castle_db.yml')" />
     <Copy SourceFiles="$(SolutionDir)db\import-tmpl\const.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\const.txt')" />

+ 13 - 0
src/map/map.hpp

@@ -344,6 +344,19 @@ enum e_element : int8{
 	ELE_RANDOM,
 };
 
+static std::unordered_map<std::string, e_element> um_eleid2elename {
+	{ "Neutral", ELE_NEUTRAL },
+	{ "Water", ELE_WATER },
+	{ "Earth", ELE_EARTH },
+	{ "Fire", ELE_FIRE },
+	{ "Wind", ELE_WIND },
+	{ "Poison", ELE_POISON },
+	{ "Holy", ELE_HOLY },
+	{ "Dark", ELE_DARK },
+	{ "Ghost", ELE_GHOST },
+	{ "Undead", ELE_UNDEAD },
+};
+
 #define MAX_ELE_LEVEL 4 /// Maximum Element level
 
 /**

+ 1 - 1
src/map/pc.cpp

@@ -12387,7 +12387,7 @@ void PlayerStatPointDatabase::loadingFinished() {
  * pc DB reading.
  * job_exp.txt		- required experience values
  * skill_tree.txt	- skill tree for every class
- * attr_fix.txt		- elemental adjustment table
+ * attr_fix.yml		- elemental adjustment table
  * job_db1.txt		- job,weight,hp_factor,hp_multiplicator,sp_factor,aspds/lvl
  * job_db2.txt		- job,stats bonuses/lvl
  * job_maxhpsp_db.txt	- strtlvl,maxlvl,job,type,values/lvl (values=hp|sp)

+ 53 - 47
src/map/status.cpp

@@ -15943,58 +15943,70 @@ static bool status_readdb_status_disabled(char **str, int columns, int current)
 	return true;
 }
 
+const std::string AttributeDatabase::getDefaultLocation() {
+	return std::string(db_path) + "/attr_fix.yml";
+}
+
 /**
- * Read attribute fix database for attack calculations
- * Function stores information in the attr_fix_table
- * @return True
+ * Reads and parses an entry from the attr_fix.
+ * @param node: YAML node containing the entry.
+ * @return count of successfully parsed rows
  */
-static bool status_readdb_attrfix(const char *basedir,bool silent)
-{
-	FILE *fp;
-	char line[512], path[512];
-	int entries = 0;
+uint64 AttributeDatabase::parseBodyNode(const YAML::Node &node) {
+	uint16 level;
 
+	if (!this->asUInt16(node, "Level", level))
+		return 0;
 
-	sprintf(path, "%s/attr_fix.txt", basedir);
-	fp = fopen(path,"r");
-	if (fp == NULL) {
-		if (silent==0)
-			ShowError("Can't read %s\n", path);
-		return 1;
+	if (!CHK_ELEMENT_LEVEL(level)) {
+		this->invalidWarning(node["Level"], "Invalid element level %hu.\n", level);
+		return 0;
 	}
-	while (fgets(line, sizeof(line), fp)) {
-		int lv, i, j;
-		if (line[0] == '/' && line[1] == '/')
-			continue;
 
-		lv = atoi(line);
-		if (!CHK_ELEMENT_LEVEL(lv))
+	for (const auto &itatk : um_eleid2elename) {
+		if (!this->nodeExists(node, itatk.first))
 			continue;
 
-		for (i = 0; i < ELE_ALL;) {
-			char *p;
-			if (!fgets(line, sizeof(line), fp))
-				break;
-			if (line[0]=='/' && line[1]=='/')
+		const YAML::Node &eleNode = node[itatk.first];
+
+		for (const auto &itdef : um_eleid2elename) {
+			if (!this->nodeExists(eleNode, itdef.first))
 				continue;
 
-			for (j = 0, p = line; j < ELE_ALL && p; j++) {
-				while (*p == 32) //skipping space (32=' ')
-					p++;
-                                //TODO seem unsafe to continue without check
-				attr_fix_table[lv-1][i][j] = atoi(p);
-				p = strchr(p,',');
-				if(p)
-					*p++=0;
+			int16 val;
+
+			if (!this->asInt16(eleNode, itdef.first, val))
+				return 0;
+
+			if (val < -100) {
+				this->invalidWarning(eleNode[itdef.first], "%s %h is out of range %d~%d. Setting to -100.\n", itdef.first.c_str(), val, -100, 200);
+				val = -100;
+			}
+			else if (val > 200) {
+				this->invalidWarning(eleNode[itdef.first], "%s %h is out of range %d~%d. Setting to 200.\n", itdef.first.c_str(), val, -100, 200);
+				val = 200;
 			}
 
-			i++;
+			this->attr_fix_table[level-1][itatk.second][itdef.second] = val;
 		}
-		entries++;
 	}
-	fclose(fp);
-	ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", entries, path);
-	return true;
+
+	return 1;
+}
+
+AttributeDatabase elemental_attribute_db;
+
+/**
+ * Get attribute ratio
+ * @param atk_ele Attack element enum e_element
+ * @param def_ele Defense element enum e_element
+ * @param level Element level 1 ~ MAX_ELE_LEVEL
+ */
+int16 AttributeDatabase::getAttribute(uint16 level, uint16 atk_ele, uint16 def_ele) {
+	if (!CHK_ELEMENT(atk_ele) || !CHK_ELEMENT(def_ele) || !CHK_ELEMENT_LEVEL(level))
+		return 100;
+
+	return this->attr_fix_table[level][atk_ele][def_ele];
 }
 
 /**
@@ -16002,13 +16014,13 @@ static bool status_readdb_attrfix(const char *basedir,bool silent)
  * sv_readdb reads the file, outputting the information line-by-line to
  * previous functions above, separating information by delimiter
  * DBs being read:
- *	attr_fix.txt: Attribute adjustment table for attacks
+ *	attr_fix.yml: Attribute adjustment table for attacks
  *	size_fix.yml: Size adjustment table for weapons
  *	refine.yml: Refining data table
  * @return 0
  */
 int status_readdb( bool reload ){
-	int i, j, k;
+	int i;
 	const char* dbsubpath[] = {
 		"",
 		"/" DBIMPORT,
@@ -16018,12 +16030,6 @@ int status_readdb( bool reload ){
 	// Initialize databases to default
 	memset(SCDisabled, 0, sizeof(SCDisabled));
 
-	// attr_fix.txt
-	for(i=0;i<MAX_ELE_LEVEL;i++)
-		for(j=0;j<ELE_ALL;j++)
-			for(k=0;k<ELE_ALL;k++)
-				attr_fix_table[i][j][k]=100;
-
 	// read databases
 	// path,filename,separator,mincol,maxcol,maxrow,func_parsor
 	for(i=0; i<ARRAYLENGTH(dbsubpath); i++){
@@ -16041,7 +16047,6 @@ int status_readdb( bool reload ){
 			safesnprintf(dbsubpath2,n1,"%s%s",db_path,dbsubpath[i]);
 		}
 
-		status_readdb_attrfix(dbsubpath2,i > 0); // !TODO use sv_readdb ?
 		sv_readdb(dbsubpath1, "status_disabled.txt", ',', 2, 2, -1, &status_readdb_status_disabled, i > 0);
 
 		aFree(dbsubpath1);
@@ -16055,6 +16060,7 @@ int status_readdb( bool reload ){
 		size_fix_db.load();
 		refine_db.load();
 	}
+	elemental_attribute_db.load();
 
 	return 0;
 }

+ 22 - 0
src/map/status.hpp

@@ -10,6 +10,8 @@
 #include "../common/mmo.hpp"
 #include "../common/timer.hpp"
 
+#include "map.hpp"
+
 enum e_race2 : uint8;
 struct block_list;
 struct mob_data;
@@ -116,6 +118,26 @@ public:
 
 extern SizeFixDatabase size_fix_db;
 
+class AttributeDatabase : public YamlDatabase {
+private:
+	int16 attr_fix_table[MAX_ELE_LEVEL][ELE_MAX][ELE_MAX];
+
+public:
+	AttributeDatabase() : YamlDatabase("ATTRIBUTE_DB", 1) {
+		this->clear();
+	}
+
+	void clear() { 
+		std::fill_n(&attr_fix_table[0][0][0], MAX_ELE_LEVEL * ELE_MAX * ELE_MAX, 100);
+	}
+	const std::string getDefaultLocation();
+	uint64 parseBodyNode(const YAML::Node& node);
+
+	int16 getAttribute(uint16 level, uint16 atk_ele, uint16 def_ele);
+};
+
+extern AttributeDatabase elemental_attribute_db;
+
 /// Status changes listing. These code are for use by the server.
 enum sc_type : int16 {
 	SC_NONE = -1,

+ 77 - 0
src/tool/csv2yaml.cpp

@@ -414,6 +414,18 @@ int do_init( int argc, char** argv ){
 		return 0;
 	}
 
+	if (!process("ATTRIBUTE_DB", 1, { path_db_mode }, "attr_fix", [](const std::string &path, const std::string &name_ext) -> bool {
+		return status_readdb_attrfix((path + name_ext).c_str());
+	})) {
+		return 0;
+	}
+
+	if (!process("ATTRIBUTE_DB", 1, { path_db_import }, "attr_fix", [](const std::string &path, const std::string &name_ext) -> bool {
+		return status_readdb_attrfix((path + name_ext).c_str());
+	})) {
+		return 0;
+	}
+
 	// TODO: add implementations ;-)
 
 	return 0;
@@ -3983,3 +3995,68 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current) {
 
 	return true;
 }
+
+// Copied and adjusted from status.cpp
+static bool status_readdb_attrfix(const char* file) {
+	FILE* fp = fopen( file, "r" );
+
+	if( fp == nullptr ){
+		ShowError( "Can't read %s\n", file );
+		return false;
+	}
+
+	uint32 lines = 0, count = 0;
+	char line[1024];
+	int lv, i, j;
+	std::string constant;
+
+	while (fgets(line, sizeof(line), fp)) {
+		lines++;
+
+		if (line[0] == '/' && line[1] == '/')
+			continue;
+
+		lv = strtoul(line, nullptr, 10);
+		if (!CHK_ELEMENT_LEVEL(lv))
+			continue;
+
+		body << YAML::BeginMap;
+		body << YAML::Key << "Level" << YAML::Value << (count+1);
+
+		for (i = 0; i < ELE_ALL; ) {
+			char *p;
+			if (!fgets(line, sizeof(line), fp))
+				break;
+			if (line[0] == '/' && line[1] == '/')
+				continue;
+
+			constant = constant_lookup(i, "Ele_");
+			constant.erase(0, 4);
+			body << YAML::Key << name2Upper(constant);
+			body << YAML::BeginMap;
+
+			for (j = 0, p = line; j < ELE_ALL && p; j++) {
+				while (*p == 32) //skipping space (32=' ')
+					p++;
+
+				constant = constant_lookup(j, "Ele_");
+				constant.erase(0, 4);
+				body << YAML::Key << name2Upper(constant) << YAML::Value << atoi(p);
+	
+				p = strchr(p, ',');
+				if (p)
+					*p++=0;
+			}
+			body << YAML::EndMap;
+
+			i++;
+		}
+		body << YAML::EndMap;
+
+		count++;
+	}
+
+	fclose(fp);
+	ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", count, file);
+	return true;
+}

+ 1 - 0
src/tool/csv2yaml.hpp

@@ -448,5 +448,6 @@ static bool exp_guild_parse_row(char* split[], int column, int current);
 static bool itemdb_read_group(char* fields[], int columns, int current);
 static bool itemdb_read_group_yaml(void);
 static bool mob_readdb_itemratio(char* fields[], int columns, int current);
+static bool status_readdb_attrfix(const char* file);
 
 #endif /* CSV2YAML_HPP */