Loading...   

[Show Table of Contents]


Global Task Information
CREATE TABLE `tasks` (
  `id` int(11) unsigned NOT NULL,
  `duration` int(11) unsigned NOT NULL,
  `title` varchar(100) NOT NULL,
  `description` text NOT NULL,
  `reward` varchar(64) NOT NULL,
  `rewardid` int(11) unsigned NOT NULL default '0',
  `cashreward` int(11) unsigned NOT NULL default '0',
  `xpreward` int(10) unsigned NOT NULL default '0',
  `rewardmethod` tinyint(3) unsigned NOT NULL default '2',
  `startzone` int(11) NOT NULL,
  `minlevel` tinyint(3) unsigned NOT NULL default '0',
  `maxlevel` tinyint(3) unsigned NOT NULL default '0',
  `repeatable` tinyint(1) unsigned NOT NULL default '1',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  • There is one row in this table for each task.

§Fields

id
  • A number between 1 and MAXTASKS-1 uniquely identifying this task. A value of 0 should NOT be used.
  • At the time of writing, the maximum task id is 9999.
duration
  • If 0, the task has no time limit, otherwise the task must be completed within duration seconds.
title
  • A short description of the task
description
  • A longer description of the task. It is possible to have the description change as the player progresses through a task, so it provides information relating to the current activity. To do this, enter the description using the following format:
[<Activty Number>,[<Activity number>],<Description for these activities>]
[<Activty Number>,[<Activity number>],<Description for these activities>]
  • Note that the client counts Activities starting from 1, whereas the server uses a base of 0, so the Activity Number in the description will be ActivityID+1. I may change the code to number activities starting from 1.
For example:
[1, Hello Adventurer, blah, blah, blah]
[2,3, Well Done, now you must ....]
[4,5,6,7, Your goals are to kill ....]
  • This displays one description for ActivityID 0, another for 1 & 2, and a third for 3, 4, 5 and 6.
  • Note that for multi-activity description, all the activities must be unlocked for the description to display. I.e. [2,3, Well Done, now you must...] will only display if activities 2 and 3 are both active. If activity 2 is active, but activity 3 is not, no description will be displayed. This implies a stepped rather than sequential task.
reward
  • A textual description of the task reward
rewardid 
  • Either an item ID number, or a reference to a list of item numbers (See the goallists table).
cashreward
  • This is the amount of cash, expressed in copper pieces, that will be given on task completion, if rewardmethod is set appropriately.
  • It will automatically be converted into the appropriate amount of plat, gold, silver and copper.
xpreward
  • This is the amount of XP that the player will be given on completion of the task.
  • Level-Based Experience Percentages can be awarded from Tasks by setting a negative value. Setting the correct value is simple and the formula is max level * 100 + experience percent.
  • An example of this setting is that a value of -510 would award 10% experience of the character's current level up to a maximum of level 5 - (5 * 100 = 500 and 500 + 10 = 510)
  • Another example is -6005, which would award 5% experience of the character's current level up to a maximum of level 60 - (60 * 100 = 6000 and 6000 + 5 = 6005)
  • Any character above the max level set will only receive the amount of experience that a character at the max level set would have received.
  • Also note that the level-based experience rewards only gives normal experience and will not award AA experience even if AA experience is set to 100%.
rewardmethod
  • If 0, the value in the rewardid field is interpreted as a single item ID. If 1, the rewardid is a reference to a list of
items in the goallist table. In either of these cases, the item(s), cashreward and xpreward will automatically
be given to the player on completion of the task.
  • If rewardmethod is 0 and rewardid contains an item number, then an itemlink will be displayed for the item in the Task window.
  • If rewardmethod is set to 2, this means the reward phase of the task is under quest control and the task system will therefore
not give the rewards to the player. The last activity in the task must therefore be to interact with an NPC via the Perl quest system
and it is up to the Perl quest system to summon any reward items, give cash or XP etc.
 
startzone 
  • This corresponds to the zoneidnumber field in the zone table and is purely for display purposes in the task selector window.
 
minlevel
maxlevel
  • The player must be in this level range for this task to appear in the task selector.
 
repeatable
  • If set to 0, and the player has already completed this task, the task won't appear in the task selector.

§Global Activity Information

CREATE TABLE `activities` (
  `taskid` int(11) unsigned NOT NULL,
  `activityid` int(11) unsigned NOT NULL default '0',
  `step` int(11) unsigned NOT NULL default '0',
  `activitytype` tinyint(3) unsigned NOT NULL default '0',
  `text1` varchar(100) default '',
  `text2` varchar(100) default '',
  `text3` varchar(100) NOT NULL,
  `goalid` int(11) unsigned NOT NULL default '0',
  `goalmethod` int(10) unsigned NOT NULL default '0',
  `goalcount` int(11) default '1',
  `delivertonpc` int(11) unsigned NOT NULL default '0',
  `zoneid` int(11) NOT NULL default '0',
  `optional` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`taskid`,`activityid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  • For each task, there will be one or more rows in this table detailing the activities that make up the task (e.g. kill 5 orcs, loot 3 rusty weapons).

§Fields

taskid
  • This field corresponds to the id field in the tasks table. I.e. if you create a task with id 1000 in the tasks table, all the activities for that task will have a taskid of 1000 in the activity table.
activityid
  • The activities for a task must be numbered consecutively from 0 through to the maximum number of activities per task. There should be no gaps or the server will ignore the task. (i.e. having a task with activities numbered, 1,2,3,7,9 and 10 will not work. If you have a task with 6 activities, the activity records MUST have activityids of 0, 1, 2, 3, 4 and 5.
step
  • If the step column is zero for all activities in a task, then one activity must be completed before the next activity becomes available.
  • If you want a player to be able to work on multiple activities at the same time, then those activities should be assigned the same, none-zero, step number. In these wiki pages, a task where more than one activity can be worked on at the same time is referred to as a 'stepped' task.
activitytype
  • This is the type of activity. The following values are available:
ActivityType
1 Deliver
2 Kill
3 Loot
4 SpeakWith
5 Explore
6 TradeSkill
7 Fish
8 Forage
9 Use
10 Use
11 Touch
100 GiveCash
  • Activity types 9 and 10 are currently not implemented. ActivityTypes starting at 100 are 'internal' types that have no meaning to the client. For these activities, the text3 field must be set to describe the activity. The internal activity types are sent to the client as ActivityType 9.
 
text1 and text2
  • These fields are used in conjunction with the activitytype field. E.g. for activitytype 1, 'Deliver', if you put 'Elven Bottle Of Wine' in the text1 field, 'Whisperdell Targon' in the text2 field, and 1 in the goalcount field, in the task window, this will be displayed as
  • Deliver 1 Elven Bottle Of Wine to Whisperdell Targon.
text3
  • If this field is not empty, it will override the activitytype, text1 and text fields in the task window display. E.g. if you put 'Deliver some wine to Master Targon' in the text3 field then this will be displayed verbatim in the task window.
  • Because of this, coupled with goalmethod 2 (see below), you can effectively make up your own types of activity by describing what the player must do in the text3 field and controlling the completion criteria via Perl quests.
goalid and goalmethod
  • These two fields are used together. goalmethod takes one of three values:
    • 0 indicates that the goalid contains a single value. For kill activities, this is the NPCTypeID. For loot, tradeskill, fish and forage, it contains the itemid of the item the player must loot, create, fish or forage.
    • 1 indicates that the goalid contains a list number which refers to the goallist table. In this way you can provide a list of NPCs to kill that count towards the goal of this activity (e.g. different types of orc), or a list of items, e.g. any rusty weapon.
  • For goalmethod 0 and 1, the task system code will automatically calculate goal progress and activity completion. A goalmethod of 2 indicates that progress on this activity is under control of the Perl quest system. 
goalcount
  • This indicates how many of the things in the goalid field must be killed, looted, foraged, etc, for this activity to be completed.
delivertonpc
  • For use with deliver activities only. Contains the NPCTypeID of the NPC to deliver the items specified in goalid.
zoneid
  • This field serves three purposes. It is used by the client to display which zone the activity takes place in. A value of 0 causes 'ALL' to be displayed by the client, otherwise the name of the corresponding zone will be displayed.
  • For goalmethod 0 and 1, activities will only be counted as complete if they occur in the specified zone (if zoneid is not 0).
  • Finally, the zoneid is used by the touch activity. 'Touch' means enter a zone. For example, you could create an activity 'Find the lair of Cazic Thule' with an activitytype of 11 and specify the zoneid of the Plane Of Fear. On zoning into fearplane, this activity would be marked complete. (by default the server will only check touch activities 5 seconds after zoning in, so you must hope the denizens of Fear don't pummel you to death in between zoning in and the 5 seconds elapsing before you can gate out).
optional
If this field is non-zero, it indicates that this activity does not need to be completed for a task step to be deemed complete. E.g. if step 0 of your task has three activities, one of which is optional, only the two non-optional activities need be completed before step 2 is unlocked. Optional activities should only be used for 'stepped' tasks. Optional activities are prefixed with "(Opt.)" in the client display.
 

§Character Task Information

 
CREATE TABLE `character_tasks` (
  `charid` int(11) unsigned NOT NULL,
  `taskid` int(11) unsigned NOT NULL,
  `slot` int(11) unsigned NOT NULL,
  `acceptedtime` int(11) unsigned default NULL,
  PRIMARY KEY  (`charid`,`taskid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  • This table contains one row for each task a character has been given and has not yet completed. 
charid
  • Reference to the character table.
taskid
  • Reference to the Global Task Table.
slot
  • The client allows a character to have 19 active tasks at anyone time. You can think of this a table with 19 slots in it. This is the slot number in that table that this active task occupies. The slot number is recorded in the database to ensure that active tasks are sent to the client using the same slot number each time a character zones. Prior to implementing this, when an active task was completed and a character zoned, the remaining active tasks would be 'shuffled up' and sent with different slot numbers. This caused display issues.
acceptedtime
  • This is a Unix timestamp of when the player clicked 'Accept' for this task. It is used in determing if tasks that have a set duration have been completed on time.

§Character Activity Table

CREATE TABLE `character_activities` (
  `charid` int(11) unsigned NOT NULL,
  `taskid` int(11) unsigned NOT NULL,
  `activityid` int(11) unsigned NOT NULL default '0',
  `donecount` int(11) unsigned NOT NULL default '0',
  `completed` tinyint(1) default '0',
  PRIMARY KEY  (`charid`,`taskid`,`activityid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  • There is a row in this table for each activity for each task that a character has active. There should be the same number of rows for each task as there are in the Global Task Table. Rows are automatically created when a player accepts a task.
charid
  • References the character table
taskid
  • This is used to associate the record with the character_tasks and global tasks table.
activityid
  • This corresponds to the activityid in the global tasks table.
donecount
  • This is a record of progress towards completion of the activity, e.g. NPCs killed, items looted, etc.
completed
  • If non-zero, this activity is complete.

§Completed Tasks Table

CREATE TABLE `completed_tasks` (
  `charid` int(11) unsigned NOT NULL,
  `completedtime` int(11) unsigned NOT NULL,
  `taskid` int(11) unsigned NOT NULL,
  `activityid` int(11) NOT NULL,
  PRIMARY KEY  (`charid`,`completedtime`,`taskid`,`activityid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  • If the rule TaskSystem:RecordCompletedTasks is set to false, then this table is not used.
  • There is a row in this table for each task that a character has completed. For tasks that are repeatable, there may be several entries for the same task if a character has completed the task multiple times.
charid
  • References the character table.
completedtime
  • A Unix timestamp indicating the date and time the task was completed.
taskid
  • References the global task table.
activityid
  • In the Client, in the completed task window, if you click on a completed task, it will display the activities completed for that task. The possibility of optional activities presents a problem, as it means that a single row per completed task is not sufficient. How optional tasks are handled here are governed by a rule, TaskSystem:RecordCompletedOptionalTasks.
  • If this rule is set to false, then no details of completed optional tasks are kept. Only details of non-optional activities will be displayed by the client. In this case only one row is written to the completed task table and this row has an ActivityID of -1.
  • If the rule is set to true, one additional row is written per completed optional activity. If you have tasks with lots of optional activities which lots of players complete multiple times, then your completed_tasks table could grow quite large.

§Goal Lists Table

 
CREATE TABLE `goallists` (
  `listid` int(10) unsigned NOT NULL,
  `entry` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`listid`,`entry`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  • This table is used by both the activities and tasks table. It simply contains lists of numbers that are interpreted by the Task System as a list of NPCTypeIDs to kill, a list of items to loot, or a list of items to give as a task reward, depending upon the context in which the listid appears.
  • E.g. if you wanted a list with listid 20 to have three entries containing the values 300, 1024 and 7682, you would insert three rows, all with listid set to 20, one row having an entry value of 300, one having an entry value of 1024 and the last row having an entry value of 7682.

§Proximity Table

CREATE TABLE `proximities` (
  `zoneid` int(10) unsigned NOT NULL,
  `exploreid` int(10) unsigned NOT NULL,
  `minx` float(14,6) NOT NULL,
  `maxx` float(14,6) NOT NULL,
  `miny` float(14,6) NOT NULL,
  `maxy` float(14,6) NOT NULL,
  `minz` float(14,6) NOT NULL,
  `maxz` float(14,6) NOT NULL,
  PRIMARY KEY  (`zoneid`,`exploreid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  • This allows the Task System to use proximities for Explore activities without the requirement to use the Perl quest system. It requires this feature to be enabled in the Rules system.
zoneid
  • The zone that this proximity exists in.
exploreid
  • Must match the goalid in the activity table for type 5 (explore) activities.
minx, maxx, miny, maxy, minz, maxz
  • Co-ordinates of the cube defining the proximity.
  • Note that if you have proximities that overlap, a player in the overlapping area will only trigger proximity detection for the proximity with the lowest numbered ExploreID.
  • For details on the final two tables, see TaskSystemTaskSets

§Tasksets Table

CREATE TABLE `tasksets` (
  `id` int(11) unsigned NOT NULL,
  `taskid` int(11) unsigned NOT NULL,
  PRIMARY KEY  (`id`,`taskid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

§Character Enabled Tasks Table

CREATE TABLE `character_enabledtasks` (
  `charid` int(11) unsigned NOT NULL,
  `taskid` int(11) unsigned NOT NULL,
  PRIMARY KEY  (`charid`,`taskid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;