unit Model;
{$MODE ObjFpc}
{$H+}
{$M+}
interface
uses
Classes, SysUtils, Fgl,
(* project libs *)
EasySqliteOrm;
type
TBaseObject = class(TObject)
private
FId: Integer;
FName: String;
published
property Id: Integer read FId write FId;
property Name: String read FName write FName;
end;
TSetting = class(TObject)
private
FKey: String;
FValue: String;
public
property Key: String read FKey write FKey;
property Value: String read FValue write FValue;
end;
TSettingList = class(specialize TFPGObjectList<TSetting>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TPage = class(TBaseObject)
private
FContent: String;
FContentType: Integer;
FImageId: Integer;
FPageType: Integer;
FTitle: String;
published
property PageType: Integer read FPageType write FPageType;
property Title: String read FTitle write FTitle;
property Content: String read FContent write FContent;
property ContentType: Integer read FContentType write FContentType;
property ImageId: Integer read FImageId write FImageId;
end;
TPageList = class(specialize TFPGObjectList<TPage>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TPageExit = class(TObject)
private
FCaption: String;
FIsCOnditional: Boolean;
FPageId: Integer;
FTargetPageId: Integer;
published
property PageId: Integer read FPageId write FPageId;
property TargetPageId: Integer read FTargetPageId write FTargetPageId;
property Caption: String read FCaption write FCaption;
property IsConditional: Boolean read FIsCOnditional write FIsCOnditional;
end;
TPageExitList = class(specialize TFPGObjectList<TPageExit>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TPageExitCondition = class(TBaseObject)
private
FConditionObjectId: Integer;
FConditionType: Integer;
FConditionValue: Integer;
FPageExitId: Integer;
published
property PageExitId: Integer read FPageExitId write FPageExitId;
property ConditionType: Integer read FConditionType write FConditionType;
property ConditionObjectId: Integer read FConditionObjectId write FConditionObjectId;
property ConditionValue: Integer read FConditionValue write FConditionValue;
end;
TPageExitConditionList = class(specialize TFPGObjectList<TPageExitCondition>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TAction = class(TBaseObject)
private
FActionObjectId: Integer;
FActionType: Integer;
FActionValue: String;
FPageId: Integer;
published
property PageId: Integer read FPageId write FPageId;
property ActionType: Integer read FActionType write FActionType;
property ActionObjectId: Integer read FActionObjectId write FActionObjectId;
property ActionValue: String read FActionValue write FActionValue;
end;
TActionList = class(specialize TFPGObjectList<TAction>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TAttribute = class(TBaseObject)
private
FCaption: String;
FDeathType: Integer;
FDeathValue: Integer;
FImageId: Integer;
FIsVisible: Boolean;
FMaxValue: Integer;
FMinValue: Integer;
published
property Caption: String read FCaption write FCaption;
property ImageId: Integer read FImageId write FImageId;
property IsVisible: Boolean read FIsVisible write FIsVisible;
property MaxValue: Integer read FMaxValue write FMaxValue;
property MinValue: Integer read FMinValue write FMinValue;
property DeathType: Integer read FDeathType write FDeathType;
property DeathValue: Integer read FDeathValue write FDeathValue;
end;
TAttributeList = class(specialize TFPGObjectList<TAttribute>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TItem = class(TBaseObject)
private
FCaption: String;
FImageId: Integer;
FIsVisible: Boolean;
published
property Caption: String read FCaption write FCaption;
property ImageId: Integer read FImageId write FImageId;
property IsVisible: Boolean read FIsVisible write FIsVisible;
end;
TItemList = class(specialize TFPGObjectList<TItem>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TImageFolder = class(TBaseObject);
TImageFolderList = class(specialize TFPGObjectList<TImageFolder>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
TImage = class(TBaseObject)
private
FData: String;
FImageFolderId: Integer;
published
property ImageFolderId: Integer read FImageFolderId write FImageFolderId;
property Data: String read FData write FData;
end;
TImageList = class(specialize TFPGObjectList<TImage>, IObjectContainer)
public
procedure AddObject(AnObject: TObject);
end;
const
ACTIONTYPE_INC_ATTRIBUTE = 0;
ACTIONTYPE_DEC_ATTRIBUTE = 1;
ACTIONTYPE_ENABLE_ITEM = 2;
ACTIONTYPE_DISABLE_ITEM = 3;
ACTIONTYPE_SWITCH_ITEM = 4;
CONDITIONTYPE_ITEM_EXISTANT = 0;
CONDITIONTYPE_ITEM_NONEXISTANT = 1;
CONDITIONTYPE_ATTRIBUTE_HIGHER = 2;
CONDITIONTYPE_ATTRIBUTE_LOWER = 3;
CONDITIONTYPE_ATTRIBUTE_EQUAL = 4;
CONTENTTYPE_PLAINTEXT = 0;
CONTENTTYPE_HTML = 1;
CONTENTTYPE_FIGHT = 2;
DEATHTYPE_NONE = 0;
DEATHTYPE_IF_LOWER = 1;
DEATHTYPE_IF_HIGHER = 2;
PAGETYPE_STANDARD = 0;
PAGETYPE_STARTPAGE = 1;
PAGETYPE_WINPAGE = 2;
PAGETYPE_FAILPAGE =3;
implementation
procedure TActionList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TAction);
end;
procedure TSettingList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TSetting);
end;
procedure TImageList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TImage);
end;
procedure TImageFolderList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TImageFolder);
end;
procedure TItemList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TItem);
end;
procedure TAttributeList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TAttribute);
end;
procedure TPageExitConditionList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TPageExitCondition);
end;
procedure TPageExitList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TPageExit);
end;
procedure TPageList.AddObject(AnObject: TObject);
begin
Self.Add(AnObject as TPage);
end;
end.