Scriptable Entities Design

From PSwiki
Jump to navigation Jump to search

This desing realize the Scriptable Entities functionality.

Player Use Cases

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Hire NPC

Player can hire a NPC to do work for either the player or his guild.

Activity Diagram

Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Target NPC that hires out NPCs

Player target an NPC that hires out other NPCs.

Select working hours

Through NPC Dialogues the player can start a hiring process. The player will need to select if a night or day assignment is needed.

Choices available:

  • Working day
  • Working night

Example NPC dialogue:

  • Player: I would like to hire a NPC.
  • NPC: Would you like to hire for day or night?
  • Player: For day work.

Select type of NPC to hire

Through NPC Dialogues the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting.

Choices available:

  • Guard
  • Merchant Player
  • Merchant Guild

Example NPC dialogue:

  • NPC: Would you like a guard or a merchant?
  • Player: I would like to have a guard.

Confirm Hiring

Through NPC Dialogues the player should confirm that he would like to hire.


Example NPC dialogue:

  • NPC: You can get one of my guard for 100 trias a day?
  • Player: I accept the conditions.

Activate Hired NPC

After hire is confirmed a NPC is assigned to the hiring player. The hired NPC will than start to follow the player.


Define Locations

Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.

Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.

Activity Diagram

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Script Hired NPC

Hired NPCs can be scripted. User open the Script Hired NPC Dialog to enter new scripts for the NPC.

Activity Diagram

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Identify Item Source

Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.

Select Work Location

From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.

Validate Script

It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See Custom NPC Dialogues for details.

Release NPC

A NPC that is no longer needed can be released. This will be done from the Script Hired NPC Dialog.

Activity Diagram

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Interact with Hired NPC

Using the NPC Dialogues to interact with the NPC. Custom NPC Dialogues created through the Script Hired NPC process provides the input to the NPC Dialogues system to provide custom dialogues.

Activity Diagram

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Buy Items

Using the standard interface to buy stuff from NPCs.

Activity Diagram

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Admin Use Cases

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Define NPCs that hire out NPCs

Define NPCs that can be hired

Hired NPC Use Cases

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Guard

Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

NPC dialogue

Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.

Sell Player Items

NPC can sell items for the hiring player. Using the standard trade front end with the trading character.

Activity Diagram

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Sell Guild Items

NPC can sell guild items. Using the standard trade front end with the trading character.

Activity Diagram

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Detailed Design

This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.

Database

To keep track of hired NPCs and store the scripts a few new elements will be needed in the DB. The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. Scripts has to be stored somewhere. A new hired_npc_scripts record will be created to store the Custom NPC Dialogues.

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

State Diagrams

Hire Session States

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Sequence Diagrams

This section will be started when Use Cases has been agreed.

Message Sequence Hire

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

See also Context Menu Design.

Server Start Hire Sequence

This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Server Confirm Hire Sequence

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.

Classes

Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead. Adobe SVG Viewer plugin (for Internet Explorer) or use Firefox, Opera or Safari instead.