Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Temporarily used for my button to toggle through categories
- local currentId = 1
- local ROW_TYPE_ID = 1
- local CATEGORY_WAYSHRINES = 1
- local CATEGORY_DUNGEON = 2
- local CATEGORY_DUNGEON_GROUP = 3
- local CATEGORY_OTHER = 4
- local CATEGORY_LOCATIONS = 5
- local tCategoryNames = {
- [CATEGORY_WAYSHRINES] = "WayShrines",
- [CATEGORY_DUNGEON] = "Dungeons",
- [CATEGORY_DUNGEON_GROUP] = "Group Dungeons",
- [CATEGORY_OTHER] = "Other",
- [CATEGORY_LOCATIONS] = "Locations",
- }
- -- Sets a Waypoint
- function TweakIt.SetWaypoint(self)
- local data = self.dataEntry.data
- d("ping")
- PingMap(MAP_PIN_TYPE_PLAYER_WAYPOINT, MAP_TYPE_LOCATION_CENTERED, data.normalizedX, data.normalizedZ)
- end
- -- Gets a table of data about all POI's & Locations on the current map
- local function GetPOIData()
- SetMapToPlayerLocation()
- local iZoneIndex = GetCurrentMapZoneIndex()
- local iNumPOIS = GetNumPOIs(iZoneIndex)
- local tData = {}
- local iNumLocations = GetNumMapLocations()
- for iLoc = 1, iNumLocations do
- local iCurTableIndex = #tData+1
- tData[iCurTableIndex] = {
- categoryId = CATEGORY_LOCATIONS,
- normalizedX = normalizedX,
- normalizedZ = normalizedZ,
- objectiveName = objectiveName,
- objectiveLevel = objectiveLevel,
- startDescript = startDescription,
- finishDescript = finishedDescription,
- iconPath = icon,
- }
- local icon, normalizedX, normalizedZ = GetMapLocationIcon(iLoc)
- local name = GetMapLocationTooltipHeader(iLoc)
- tData[iCurTableIndex].iconPath = icon
- tData[iCurTableIndex].normalizedX = normalizedX
- tData[iCurTableIndex].normalizedZ = normalizedZ
- tData[iCurTableIndex].objectiveName = name
- end
- for iPoiIndex=1, iNumPOIS do
- local iCurTableIndex = #tData+1
- local playerMapName = GetPlayerLocationName()
- local objectiveName, objectiveLevel, startDescription, finishedDescription = GetPOIInfo(iZoneIndex, iPoiIndex)
- local normalizedX, normalizedZ, poiType, icon = GetPOIMapInfo(iZoneIndex, iPoiIndex)
- --d("iZoneIndex: "..tostring(iZoneIndex)..", iPoiIndex: "..tostring(iPoiIndex)..", objectiveName: "..tostring(objectiveName))
- tData[iCurTableIndex] = {
- categoryId = nil,
- normalizedX = normalizedX,
- normalizedZ = normalizedZ,
- objectiveName = objectiveName,
- objectiveLevel = objectiveLevel,
- startDescript = startDescription,
- finishDescript = finishedDescription,
- iconPath = icon,
- zoneIndex = iZoneIndex,
- poiIndex = iPoiIndex,
- }
- if IsPOIWayshrine(iZoneIndex, iPoiIndex) then
- tData[iCurTableIndex].categoryId = CATEGORY_WAYSHRINES
- elseif IsPOIPublicDungeon(iZoneIndex, iPoiIndex) then
- tData[iCurTableIndex].categoryId = CATEGORY_DUNGEON
- elseif IsPOIGroupDungeon(iZoneIndex, iPoiIndex) then
- tData[iCurTableIndex].categoryId = CATEGORY_DUNGEON_GROUP
- else
- tData[iCurTableIndex].categoryId = CATEGORY_OTHER
- end
- end
- -- Sort it alphabetically
- table.sort(tData,
- function(bvalue1, bvalue2)
- if bvalue1.objectiveName < bvalue2.objectiveName then
- return true
- end
- end)
- return tData
- end
- -- Called to update all waypoint POI's & Locations
- function TweakIt.UpdateWaypointWindow()
- local tlw = TweakItScrollList
- local dataList = ZO_ScrollList_GetDataList(tlw)
- local data = GetPOIData()
- ZO_ScrollList_Clear(tlw)
- -- Whenever you clear the scrollList it clears the categories, must re-add them
- ZO_ScrollList_AddCategory(tlw, CATEGORY_WAYSHRINES, nil)
- ZO_ScrollList_AddCategory(tlw, CATEGORY_DUNGEON, nil)
- ZO_ScrollList_AddCategory(tlw, CATEGORY_DUNGEON_GROUP, nil)
- ZO_ScrollList_AddCategory(tlw, CATEGORY_OTHER, nil)
- ZO_ScrollList_AddCategory(tlw, CATEGORY_LOCATIONS, nil)
- for i=1, #data do
- --function ZO_ScrollList_CreateDataEntry(typeId, data, categoryId)
- local entry = ZO_ScrollList_CreateDataEntry(ROW_TYPE_ID, data[i], data[i].categoryId)
- table.insert(dataList, entry)
- --dataList[#dataList+1] = entry
- end
- ZO_ScrollList_Commit(tlw)
- end
- -- This is called by a test button I made to toggle through the categories to test it
- local function ShowCategoryId(_iCategoryId)
- -- toggle through categories, just to test with
- currentId = (currentId+1)%6
- d("showing id: "..currentId)
- ZO_ScrollList_HideAllCategories(TweakItScrollList)
- ZO_ScrollList_ShowCategory(TweakItScrollList, currentId)
- TweakItWaypointLabel:SetText(tCategoryNames[currentId])
- --ZO_ScrollList_RefreshVisible(TweakItScrollList)
- end
- -- Creates the actual waypoint window
- -- ha yah tlw1 & tlw...confusing, I need to rename stuff & clean it up.
- function TweakIt.CreateWaypointsWindow()
- local tlw1 = WINDOW_MANAGER:CreateTopLevelWindow("TweakItTLW")
- tlw1:ClearAnchors()
- tlw1:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, 100,100)
- tlw1:SetDimensions(300, 600)
- tlw1:SetMouseEnabled(true)
- tlw1:SetMovable(true)
- tlw1:SetClampedToScreen(true)
- tlw1.bg = WINDOW_MANAGER:CreateControlFromVirtual("TweakItTLWBg", tlw1, "ZO_DefaultBackdrop")
- tlw1.bg:ClearAnchors()
- tlw1.bg:SetAnchorFill()
- local tlw = WINDOW_MANAGER:CreateControlFromVirtual("TweakItScrollList", tlw1, "ZO_ScrollList")
- tlw:ClearAnchors()
- tlw:SetAnchor(TOPLEFT, tlw1, TOPLEFT, 0, 40)
- tlw:SetDimensions(300, 560)
- tlw:SetClampedToScreen(true)
- local function setupCallback(rowControl, data, scrollList)
- local icon = rowControl:GetNamedChild("Texture")
- local label = rowControl:GetNamedChild("Label")
- rowControl.iconPath = data.iconPath
- icon:SetTexture(data.iconPath)
- label:SetText(data.objectiveName)
- end
- local function dataTypeSelectSound()
- --PlaySound(SOUNDS.ITEM_MONEY_CHANGED)
- end
- --function ZO_ScrollList_AddDataType(self, typeId, templateName, height, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)
- ZO_ScrollList_AddDataType(tlw, ROW_TYPE_ID, "WayPointButton", 70, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)
- btn = WINDOW_MANAGER:CreateControlFromVirtual("TweakItWaypointsBtn1", tlw, "ZO_BladeHeader")
- btn:SetDimensions(300, 25)
- btn:SetDrawLevel(1)
- btn:SetDrawLayer(1)
- btn:SetDrawTier(1)
- btn:SetClickSound("Click")
- btn:ClearAnchors()
- btn:SetAnchor(TOPLEFT, _cAnchorWin, BOTTOMLEFT, 0, 0)
- btn:SetHidden(false)
- btn:SetHandler("OnClicked", function() ShowCategoryId() end)
- local cLabel = WINDOW_MANAGER:CreateControl("TweakItWaypointLabel", tlw1, CT_LABEL)
- cLabel:ClearAnchors()
- cLabel:SetAnchor(TOPLEFT, tlw1, TOPLEFT, 0, -20)
- cLabel:SetAnchor(BOTTOMRIGHT, tlw1, TOPRIGHT, 0, 0)
- cLabel:SetFont("ZoFontWinH4")
- cLabel:SetText("None")
- -- After its created update the current POI's & Locations
- TweakIt.UpdateWaypointWindow()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement