Quantcast
WoWInterface - View Single Post - Carbonite Notes import from old version?
View Single Post
01-24-15, 04:57 PM   #21
JimJoBlue
An Onyxian Warder
 
JimJoBlue's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 362
I'm basically using a template from the other notes plugins I have compiled..

Lua Code:
  1. CBwodtreasures = LibStub("AceAddon-3.0"):NewAddon("CBwodtreasures", "AceConsole-3.0", "AceEvent-3.0")
  2.  
  3. local nodes = { }
  4.  
  5. --Shadowmoon valley (947)
  6. nodes[1] = { 947, 35280, 27.1, 2.5, "Stolen Treasure" }
  7. nodes[2] = { 947, 34174, 26.5, 5.7, "Fantastic Fish" }
  8. nodes[3] = { 947, 35279, 28.8, 7.1, "Sunken Treasure" }
  9.  
  10. --
  11.  
  12. function CBwodtreasures:OnInitialize()
  13.  self:RegisterEvent("PLAYER_ENTERING_WORLD", "WorldEnter")
  14.  
  15.  local defaults = {
  16.   profile = {
  17.    alwaysshow = false,
  18.    save = true,
  19.    icon = 6,
  20.   },
  21.  }
  22.  
  23.  self.db = LibStub("AceDB-3.0"):New("CBwodtreasuresDB", defaults, true)
  24. end
  25.  
  26. function CBwodtreasures:WorldEnter()
  27.  self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  28.  
  29.  self:PopulateNotes()
  30. end
  31.  
  32. function CBwodtreasures:PopulateNotes()
  33.  local icon = self.db.profile.icon or 6
  34.  for k, v in pairs(nodes) do
  35.   -- Nodes: MapID, QuestID, X Coord, Y Coord, QuestName, isDaily
  36.   -- AddonNote: folder, name, icon, id, x, y
  37.   if (not self:HasBeenLooted(v)) then
  38.    Nx.Notes:AddonNote("WOD Treasures", v[5], icon, v[1], v[3], v[4])
  39.   end
  40.  end
  41. end
  42.  
  43. function CBwodtreasures:HasBeenLooted(value)
  44.  if (self.db.profile.alwaysshow) then return false end
  45.  
  46.  if (self.db.char[value[2]] and self.db.profile.save) then return true end
  47.  
  48.  if (IsQuestFlaggedCompleted(value[2])) then
  49.   if (self.db.profile.save and not value[6]) then  -- Save the chest but not if it's a daily
  50.    self.db.char[value[2]] = true;
  51.   end
  52.  
  53.   return true
  54.  end
  55.  
  56.  return false
  57. end
__________________
I still say a church steeple with a lightning rod on top shows a lack of confidence. Doug McLeod


  Reply With Quote