/*
===QuestUtils v1.4
===By Mckill2009
This is an alternative to GUI Quest creation, very easy to use if you follow the instructions
written in this sample map...
API:
struct QuestUtils extends array
static method create takes boolean required, boolean discovered returns thistype
method operator []= takes string title, string description returns nothing
method operator questIcon= takes string iconPath returns nothing
method operator completed= takes boolean b returns nothing
method operator failed= takes boolean b returns nothing
method operator enable= takes boolean b returns nothing
method operator discover= takes boolean b returns nothing
method operator completed takes nothing returns boolean
method operator discovered takes nothing returns boolean
method operator enabled takes nothing returns boolean
method operator required takes nothing returns boolean
method destroy takes nothing returns nothing
struct QuestItem extends array
static method create takes QuestUtils index, string text returns thistype
method operator text= takes string text returns nothing
method operator completed= takes boolean b returns nothing
method operator completed takes nothing returns boolean
method destroy takes nothing returns nothing
*/
library QuestUtils uses optional QuestSounds
globals
private constant integer QUEST_LIMIT = 100
endglobals
struct QuestUtils extends array
quest q
private static thistype instance = 0
static method create takes boolean required returns thistype
local thistype this
if instance==QUEST_LIMIT then
debug call BJDebugMsg("QuestUtils ERROR: Maximum quest is: "+I2S(QUEST_LIMIT))
else
set instance = instance + 1
set this = instance
set .q = CreateQuest()
call QuestSetRequired(.q, required)
endif
return this
endmethod
method operator []= takes string title, string description returns nothing
call QuestSetTitle(.q, title)
call QuestSetDescription(.q, description)
call FlashQuestDialogButton()
endmethod
method operator questIcon= takes string iconPath returns nothing
call QuestSetIconPath(.q, iconPath)
endmethod
method operator completed= takes boolean b returns nothing
call QuestSetCompleted(.q, b)
endmethod
method operator failed= takes boolean b returns nothing
call QuestSetFailed(.q, b)
endmethod
method operator enable= takes boolean b returns nothing
call QuestSetEnabled(.q, b)
endmethod
method operator discover= takes boolean b returns nothing
call QuestSetDiscovered(.q, b)
endmethod
method operator completed takes nothing returns boolean
return IsQuestCompleted(.q)
endmethod
method operator discovered takes nothing returns boolean
return IsQuestDiscovered(.q)
endmethod
method operator enabled takes nothing returns boolean
return IsQuestEnabled(.q)
endmethod
method operator required takes nothing returns boolean
return IsQuestRequired(.q)
endmethod
method destroy takes nothing returns nothing
call DestroyQuest(.q)
set .q = null
set .q = instance.q
set instance = instance - 1
endmethod
endstruct
struct QuestItem extends array
questitem qi
private static thistype instance = 0
static method create takes QuestUtils index, string text returns thistype
local thistype this
set instance = instance + 1
set this = instance
set .qi = QuestCreateItem(index.q)
call QuestItemSetDescription(.qi, text)
call FlashQuestDialogButton()
return this
endmethod
method operator text= takes string text returns nothing
call QuestItemSetDescription(.qi, text)
call FlashQuestDialogButton()
endmethod
method operator completed= takes boolean b returns nothing
call QuestItemSetCompleted(.qi, b)
call FlashQuestDialogButton()
endmethod
method operator completed takes nothing returns boolean
return IsQuestItemCompleted(.qi)
endmethod
method destroy takes nothing returns nothing
set .qi = null
set .qi = instance.qi
set instance = instance - 1
endmethod
endstruct
endlibrary