Page 1 of 1

Little contribution : Guide NPC for multiple languages

PostPosted: Fri Sep 18, 2015 8:18 pm
by Stephen
Hi everyone,

i'm currently running my new project on the portal , Evolution shard.

I'm posting here today to share with you my current guides npc that i coded recently for my shard and to handle multiple languages.

The npc uses a main list to store the data which is loaded from database. I added also a quick command to reload the data on the list in-game.

Just fill the string and ids into database.

Fields are :

Language StrID GuideType Title Folder Guides_ID

so for example :

English | 0 | npc | "Server Rules" | "It is forbidden : ..." | npc_eng0
English | 1 | npc | "How to connect" | "Download game.dll..." | npc_eng1

and so on for all the languages.

I tested the scripts with the latest dol svn revison and it works for me.

Thats all .

I apologize to senior programmers here but i'm currently coding for fun on my server and maybe my code could be not so elegant but it's doing his job ;)

anyway i hope you enjoy

Regards,

Stephen

Re: Little contribution : Guide NPC for multiple languages

PostPosted: Sat Sep 19, 2015 12:14 pm
by Leodagan
Even if I hope I'm not a "senior developer" yet...

I understand there is some lack of documentation around DOL API's and some early-done work... but as you give me the opportunity to be an old fag :

There is a Refresh Command Attribute Handler :D

You can read "RefreshCommand.cs" file to see how this simple command work, and it will look in all available code for Static Method referenced using the [RefreshCommandAttribute]

This way you can add your "refresh methods" to your game server scripts objects and tag them with attribute to have everything in one file and it's auto detected at runtime ;)

The current limit is that Refresh Method don't handle any arguments, and return value are just for Log Displaying :)

example :
Code: Select all
[RefreshCommandAttribute] public static int MyCustomObjectRefreshMethod() { //Query from database //Refresh Objects return NumberOfObjectRefreshed; }