Auto-Template manager.

Share files with other Dawn of Light users

Moderator: Support Team

Auto-Template manager.

Postby Stephen » Thu Jan 07, 2016 2:55 pm

Hi everyone,

Stephen here, from Evolution server.

I've recently received some requests about this feature from some users here in DOL forum. So I'm going to share this template manager with DoL community that I coded and used on my last server run of Evolution server. The manager will cache templates from a database table and loads bonuses to a player according to his level. You might have to disable the bonuses loaded from items. It does all the calculations for every single stat and load/unload the correct amount of stat. It's very simple, you have to call this method at the player world init, just after the AddToWorld method is complete:

LoadTemplate(GamePlayer player,byte type, bool updates, bool unload, byte oldlevel)

Where parameters stand for:

player

The player.

type

Template type. It's a byte. In the database table you can add several templates for a same class. For example, in the case for an archer you can add sniper temp as zero and melee temp as one and so on. ( sniper,type=0 - melee,type=1 - caster,type=2)

In addition to this, you must add this field in DBCharacter table to save the template to a specific character for loading.
Code: Select all
[DataElement(AllowDbNull = false)] public byte TemplateType { get { return m_TemplateType; } set { Dirty = true; m_TemplateType = value; } }
updates

Boolean. You can choose if you want to refresh the player or not using True or False.

unload

Boolean. You should use false as default for this, but there are some situation where you might need to load a template without unloading a previous template loaded on a player.

oldlevel

If you set this to 0, the temp manager just use the same level to determinate the value of the stats. Otherwise, this is used to say at the template manager that you are going to load a template for a player who has just changed his level and the method needs this value to unload the correct amount of stat from a player and load the new amount.

I must thank my friend Xaves for helping me years ago to code the base load method which I've improved and extended to a manager with all the necessary calculations.

I hope you will find this helpful.

Kind regards,

Stephen.
Attachments
PlayerTemplate.cs
Database table.
(12.79 KiB) Downloaded 250 times
TemplateMgr.cs
Manager script.
(17.76 KiB) Downloaded 269 times
Last edited by Stephen on Fri Jan 15, 2016 4:50 pm, edited 1 time in total.
Evolution Admin&Developer

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

Re: Auto-Template manager.

Postby Graveen » Fri Jan 08, 2016 1:07 am

Thank you Stephen, an usefull tool i guess.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” User Files

Who is online

Users browsing this forum: No registered users and 1 guest