Page 1 of 1

Auto-Template manager.

PostPosted: Thu Jan 07, 2016 2:55 pm
by Stephen
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.

Re: Auto-Template manager.

PostPosted: Fri Jan 08, 2016 1:07 am
by Graveen
Thank you Stephen, an usefull tool i guess.