Little contribution : Guide NPC for multiple languages

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

Little contribution : Guide NPC for multiple languages

Postby Stephen » Fri Sep 18, 2015 8:18 pm

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
Attachments
guidecommand.cs
(940 Bytes) Downloaded 8 times
guide.cs
(2.34 KiB) Downloaded 6 times
serverguidenpc.cs
(7.76 KiB) Downloaded 6 times
sshot079.jpg
sshot079.jpg (1.26 MiB) Viewed 712 times
Evolution Admin&Developer

http://evolution-daoc.enjin.com/
Stephen
Server Representative
 
Posts: 253
Joined: Sun Oct 14, 2007 8:09 am

Re: Little contribution : Guide NPC for multiple languages

Postby Leodagan » Sat Sep 19, 2015 12:14 pm

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;
}
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Location: Lyon


Return to DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest