Coder Social home page Coder Social logo

datamodder's Introduction

DataModder

DataModder is a tool to create a modded Mabinogi data folder, based on mod scripts written in Lua. It allows the user to create and update data mods without having to extract and modify the files themselves. It was designed for XML file modding in particular, allowing the modification of attributes of specific XML elements.

How it works

DataModder looks for mods in its mod folder (DataModder/mods/). Each mod needs its own folder and a main.lua, which serves as the entry point. In each of those scripts any number of modifications can be specified, which are then executed by the program.

For all modifications it automatically uses the latest version of the file from the pack files, which it tries to find automatically. If there's a package folder in the same folder as the DataModder.exe is, it uses that one. Otherwise it searches for the folder of the installed Mabinogi client.

Examples

XML files

The most special feature of DataModder is the ability to modify XML files mostly without having to manually write and update XML code. You can modify and remove attributes, remove elements, or add completely new ones.

The selection of elements for whatever purpose utilizes XPath, a standardized query language for selecting nodes in XML documents. For more information check Wikipedia.

Attributes

The following example modifies the attribute "Text_Name0" on a collection of items that match the path to "Just some book".

loadxmlfile('db/itemdb.xml')
setattributes('//Mabi_Item[@ID=1000]', 'Text_Name0', 'Just some book')

The same code can be used to add attributes if they don't exist yet, and if the value is nil the attribute is removed.

Removing elements

The following example removes all Mabi_Item elements in the itemdb.xml that match the given path.

loadxmlfile('db/itemdb.xml')
removeelements('//Mabi_Item[@ID=221066]')

Adding elements

To add a new element you simply specifiy the XML code and where it should be added. In the example below it's added at the end of the Items node, which is the parent of all Mabi_Item elements in the itemdb.xml.

loadxmlfile('db/itemdb.xml')
addelement('/Items', '<Mabi_Item ID="424242" Name="test" />')

Replacing Files

Is XML modification not viable, or the file in question not an XML file, you can replace files either with other files inside the pack files or new ones inside the mod folder.

The first parameter is the path the file will be copied to in the data folder, the second is the path it's copied from. DataModder first checks the mod's folder, and if the file doesn't exist there, it tries to find it in the pack folder.

-- Replace a file with a new file in the mod's folder
replacefile('db/cutscene/cutscene_waterfall.xml', 'my_improved_waterfall.xml')

-- Replace an image with a different one from the packs
replacefile('gfx/image/npc/npcportrait_manus_us.dds', 'gfx/image/npc/npcportrait_manus.dds')

Organization

To organize mods a little you can use include and/or require, which can be used to include scripts from the same mod folder.

-- main.lua

include('item_mods.lua')
include('url_mods.lua')
include('ebil_hack_mods.lua')

More

For more examples, check the examples folder (DataModder/examples/).

Links

datamodder's People

Contributors

exectails avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.