Git Product home page Git Product logo

script-reader's Introduction

MMORPG Script Reader

This repository contains a library to read MMORPG game Script Files.

The file extensions which it can read:

Extension Description
.npc Non-player Character files
.ndb NPC behavior database files
.db Monster Homes files
.evt Monster event files
.mon Monster data files
.pat Patch files
.dat General purpose data files
.usr User files
.srv Object types files

Adding to project

  • simple copy-and-paste the scriptreader folder to your project

OR

  • add to your CMake project as a library:
    add_subdirectory(src/scriptreader)
    target_link_libraries(script-reader PRIVATE scriptreader)
    

Using the library

It is only necessary to include readscriptfile.h

  • open the file by using ReadScriptFile::open("myfile.npc")
  • make a call to ReadScriptFile::nextToken()
  • get the read toke type (Identifier, Number, String, Bytes, Coordinate or Special)
  • read the token data by calling ReadScriptFile::readIdentifier() or ReadScriptFile::readNumber() etc
  • get the read token data by calling ReadScriptFile::getIdentifier() or ReadScriptFile::getNumber() etc
  • store the item data to your code and cycle to ReadScriptFile::nextToken() until it reaches End-of-file
  • close the file by using ReadScriptFile::close()

Example NPC (building and running on Linux)

Building

  • clone the project
$ git clone https://github.com/danilopucci/script-reader.git 
  • navigate to project root directory
$ cd script-reader 
  • prepare cmake
$ cmake .
  • build example-npc
$ cmake --build . --target example-npc 

Running

  • this will read "alice.npc" file
$ ./examples/example-npc $(pwd)
Note

It throws exception in case of error while reading script file, so it may be useful to operate inside a try-catch block

script-reader's People

Contributors

danilopucci avatar

Watchers

 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.