Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function QuestLister() -- CREATES A LIST OF THE PLAYERS QUESTS
- group.maps.elements.miniMap.isVisible = false
- hideGadgets()
- if sparkler ~= nil then
- for i=1, #mapNotes do
- sparkler[i].isVisible = false
- sparkler[i]:removeEventListener( "touch", readNote )
- end
- end
- group.maps.elements.BtnMapNotes.isVisible = false
- group.maps.elements.Text_Header.text = ( rosetta:getString("Quests") )
- group.maps.elements.Text_Sub1.text = ( " " )
- group.maps.elements.BtnMapReveal.isVisible = false
- group.maps.elements.BtnMapReveal:setEnabled(false, 'up')
- group.maps.groups['Spellbook'].isVisible = false
- group.maps.groups['ScrollHandle1'].isVisible = false
- group.maps.groups['ScrollHandle2'].isVisible = false
- group.maps.groups['ScrollMap'].isVisible = true
- group.maps.groups['AtlasMap'].isVisible = false
- group.maps.groups['Lists'].isVisible = true
- group.maps.elements.btnScroll.isVisible = false
- group.maps.elements.btnScroll:setEnabled(false, 'up')
- group.maps.elements.btnWorld.isVisible = false
- group.maps.elements.btnWorld:setEnabled(false, 'up')
- group.maps.elements.btnQuests.isVisible = false
- group.maps.elements.btnQuests:setEnabled(false, 'up')
- group.maps.elements.btnSpellbook.isVisible = false
- group.maps.elements.btnSpellbook:setEnabled(false, 'up')
- group.maps.elements.btnLeft.onTap = returnToGameFromList
- local questNames = {}
- if #playerData.playerQuests > 0 then -- if the player has any quests complete or active...
- for i= 1, #playerData.playerQuests do
- questLookUp = {}
- local questToInsert = {}
- -- local questLookUp = ( rosetta:getString( QuestLordQuests[ (playerData.playerQuests[i].QuestID) ].QuestName ) )
- local name = QuestLordQuests[ (playerData.playerQuests[i].QuestID) ].QuestName
- local completion = playerData.playerQuests[i].QuestCompletion
- questNames[i] = { name=name, completion=completion }
- end
- --print ("here")
- --atrace (xinspect(questNames))
- --print ("There")
- else -- if the player doesnt have any quest at all
- group.maps.elements.Text_Header.text = ( rosetta:getString("No quests...") )
- group.maps.elements.Text_Sub1.text = ( rosetta:getString("Search for quests.") )
- end
- local tableView = require("tableView")
- --initial values
- local screenOffsetW, screenOffsetH = display.contentWidth - display.viewableContentWidth, display.contentHeight - display.viewableContentHeight
- local myList
- -- you might want to move this to layout
- local backgroundBox = display.newRect(1, 1, 320, 412)
- backgroundBox:setFillColor(tonumber("27", 16), tonumber("27", 16), tonumber("27", 16))
- group.maps.groups['Lists']:insert( backgroundBox )
- --setup functions to execute on touch of the list view items
- function listButtonRelease( event )
- local function returnToList()
- group.maps.elements.btnYes.isVisible = false
- --print "remove self on return to LIST"
- textBox:removeSelf()
- textBox=nil
- scrollView:removeSelf()
- myList.isVisible = true
- group.maps.elements.Text_Header.text = ( rosetta:getString("Quests") )
- group.maps.elements.Text_Sub1.text = ( " " )
- end
- myList.isVisible = false -- get rid of the list
- -- add a description of what the quest is...
- self = event.target
- local id = self.id
- -- TextBoxBackground = false
- textBox = display.newText( ( rosetta:getString ( QuestLordQuests[ (playerData.playerQuests[self.id].QuestID) ].QuestDescription ) ), 4, 9, 320 , 0, "QuadratSerial", 22)
- textBox:setTextColor( 220, 220, 220, 255 )
- local widget = require "widget-V1"
- scrollView = widget.newScrollView{ height=280, maskFile="TextMaskLarge.png", bgColor = {20,20,35,255} } -- 180
- scrollView.isHitTestMasked = true
- scrollView:insert(textBox)
- scrollView.y = 80
- -- --print ("THIS THING:" .. QuestLordQuests[ (playerData.playerQuests[self.id]) ].QuestDescription)
- textBox.hasBackground = false
- group.maps.elements.btnYes.isVisible = true
- group.maps.elements.btnYes.onTap = returnToList
- group.maps.elements.Text_Header.text = ( rosetta:getString(QuestLordQuests[ (playerData.playerQuests[self.id].QuestID) ].QuestName) )
- --print ("*************************************************")
- --print ("QuestIDCOMPLETION=" .. playerData.playerQuests[self.id].QuestCompletion )
- --print ("QuestIDCONDITION=" .. playerData.playerQuests[self.id].QuestCondition )
- --print ("*************************************************")
- if playerData.playerQuests[self.id].QuestCompletion == "true" then
- group.maps.elements.Text_Sub1.text = ( rosetta:getString("Completed!") )
- elseif playerData.playerQuests[self.id].QuestCompletion == "false" then
- group.maps.elements.Text_Sub1.text = ( rosetta:getString("Quest in progress") )
- elseif playerData.playerQuests[self.id].QuestCompletion == "return" and playerData.playerQuests[self.id].QuestCondition == "slay" then
- group.maps.elements.Text_Sub1.text = ( rosetta:getString("Return with news of victory!") )
- elseif playerData.playerQuests[self.id].QuestCompletion == "return" and playerData.playerQuests[self.id].QuestCondition == "retrieve" then
- group.maps.elements.Text_Sub1.text = ( rosetta:getString("Return with Quest Item!") )
- end
- end
- -- setup the data
- local data = questNames
- local topBoundary = display.screenOriginY + 48
- local bottomBoundary = display.screenOriginY +68
- -- Create a list with no backgroundIMG, allowing the backgroundIMG image to show through
- --atrace (xinspect(data))
- myList = tableView.newList{
- data=data,
- default="huge_button_up.png",
- over="huge_button_down.png",
- onRelease=listButtonRelease,
- top=topBoundary,
- bottom=bottomBoundary,
- callback=function(row)
- local t = display.newGroup()
- local obj
- --local obj = display.newImage( "Quest_InProgress.png" )
- if row.completion =="true" then
- obj=display.newImage( "Quest_Complete.png" )
- else
- obj=display.newImage( "Quest_InProgress.png" )
- end
- local txt = display.newText(row.name, 0, 0, native.systemFontBold, 18)
- txt:setTextColor(255, 255, 255)
- txt.x = math.floor(txt.width/2) + 82
- txt.y = 46
- obj.x = 50
- obj.y = 40
- t:insert(txt)
- t:insert(obj)
- return t
- end
- }
- --atrace (xinspect(myList))
- group.maps.groups['Lists']:insert(myList)
- group.maps.groups['ScrollHandle1'].isVisible = false
- group.maps.groups['ScrollHandle2'].isVisible = false
- group.maps.groups['ScrollMap'].isVisible = false
- group.maps.groups['AtlasMap'].isVisible = false
- group.maps.groups['Lists'].isVisible = true
- group.maps.elements.btnQuests.isVisible = false
- group.maps.elements.btnSpellbook.isVisible = false
- group.maps.elements.btnLeft:toFront()
- group.maps.elements.btnQuests.isVisible = false
- group.maps.elements.btnWorld.isVisible = false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement