Advertisement
Kijan

Achievmentboard

Jul 29th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.45 KB | None | 0 0
  1. flags = {
  2.    {x = -11.12, name = "Ancient Technology", guids = {"75331a", "29d554", "7d2769", "583c5e", "3c7397"}, position = {117.48, 1.835, 20.42}, toBeCleared = {}},
  3.    {x = -10.22, name = "Artifact: Cleansed", guids = {"2e0277"}, position = {95.58, 1.835, 20.40}, toBeCleared = {"a7bc86", "4a36f4"}},
  4.    {x = -9.32, name = "Artifact: Lost", guids = {"a7bc86"}, position = {95.58, 1.835, 20.40}, toBeCleared = {"4a36f4", "2e0277"}},
  5.    {x = -8.45, name = "Artifact: Recovered", guids = {"4a36f4"}, position = {95.58, 1.835, 20.40}, toBeCleared = {"2e0277", "a7bc86"}},
  6.    {x = -7.6, name = "City Rule: Demonic", guids = {"20ac29"}, position = {93.46, 1.835, 20.27}, toBeCleared = {"7df8f7", "b83859"}},
  7.    {x = -6.8, name = "City Rule: Economic", guids = {"7df8f7"}, position = {93.46, 1.835, 20.27}, toBeCleared = {"20ac29", "b83859"}},
  8.    {x = -6, name = "City Rule: Militaristic", guids = {"b83859"}, position = {93.46, 1.835, 20.27}, toBeCleared = {"20ac29", "7df8f7"}},
  9.    {x = -5.09, name = "End of Corruption", guids = {"66e031", "5a6270", "268c1c"}, position = {113.02, 1.835, 20.59}, toBeCleared = {}},
  10.    {x = -4.2, name = "End of Gloom", guids = {"18cd70"}, position = {115.40, 1.835, 20.17}, toBeCleared = {}},
  11.    {x = -3.4, name = "End of the Invasion", guids = {"d5f083"}, position = {110.81, 1.835, 20.40}, toBeCleared = {}},
  12.    {x = -2.55, name = "The Annihilation of the Order", guids = {"1b658f"}, position = {119.81, 1.835, 20.25}, toBeCleared = {}},
  13.    {x = -1.75, name = "The Dead Invade", guids = {"0b3ed8"}, position = {100.14, 1.835, 20.32}, toBeCleared = {}},
  14.    {x = -0.9, name = "The Rift Neutralized", guids = {"a7d764"}, position = {108.77, 1.835, 20.34}, toBeCleared = {"120efa"}}, -- Check
  15.    {x = -0.1, name = "The Drake Aided", guids = {"7c2e92"}, position = {102.27, 1.835, 20.32}, toBeCleared = {"37a8a8"}},
  16.    {x = 0.7, name = "The Drake Slain", guids = {"37a8a8"}, position = {102.27, 1.835, 20.32}, toBeCleared = {"7c2e92"}},
  17.    {x = 1.54, name = "The Edge of Darkness", guids = {"6b8148"}, position = {89.41, 1.835, 20.25}, toBeCleared = {}},
  18.    {x = 2.34, name = "The Merchant Flees", guids = {"e4f8e6"}, position = {97.90, 1.835, 20.30}, toBeCleared = {}},
  19.    {x = 3.14, name = "The Power of Enhancement", guids = {"e28cba"}, position = {104.36, 1.835, 20.36}, toBeCleared = {}},
  20.    -- {x = 5.97, name = "The Rift Closed", guids = {"a7d764"}, position = {108.77, 1.835, 20.34}, toBeCleared = {"120efa"}},
  21.    {x = 4, name = "The Voice Freed", guids = {"20bd86"}, position = {91.39, 1.835, 20.33}, toBeCleared = {"62661c"}},
  22.    {x = 4.85, name = "The Voice Silenced", guids = {"62661c"}, position = {91.39, 1.835, 20.33}, toBeCleared = {"20bd86"}},
  23.    {x = 5.67, name = "Water-Breathing", guids = {"a661c1"}, position = {106.63, 1.835, 20.38}, toBeCleared = {}},
  24.  
  25.    {x = 7.3, name = "Through the Portal", guids = {"aee336"}, position = {122.01, 1.83, 20.46}, toBeCleared = {"bba683"}},
  26.    {x = 8.1, name = "Severed Ties", guids = {"bba683"}, position = {122.01, 1.83, 20.46}, toBeCleared = {"aee336"}},
  27.    {x = 8.95, name = "Knowledge is Power", guids = {"9de60f", "06c3de", "15da44", "9e48c6"}, position = {{123.81, 1.83, 21.27}, {123.76, 1.83, 19.80}, {123.76, 1.83, 19.26}, {123.76, 1.83, 18.74}}, toBeCleared = {}, multipart = true},
  28.    {x = 9.77, name = "Peril Adverted", guids = {"9afaaa", "122ee0", "2ee41d", "87c2c7"}, position = {{125.70, 1.83, 20.49}, {125.70, 1.831, 20.08}, {125.72, 1.831, 19.91}, {125.69, 1.831, 19.14}}, toBeCleared = {}, multipart = true},
  29.    {x = 10.55, name = "Pieces of an Artifact", guids = {"5f377d", "baf7bf", "f1dcf6"}, position = {{127.30, 1.83, 20.79}, {127.20, 1.83, 19.01}, {127.19, 1.83, 18.65}}, toBeCleared = {"4fe058"}, multipart = true},
  30.    {x = 11.33, name = "Mechanical Splendor", guids = {"4fe058"}, position = {127.29, 1.83, 20.45}, toBeCleared = {"5f377d", "baf7bf", "f1dcf6"}}
  31. }
  32.  
  33. function onLoad(save_state)
  34.    button_parameter = {
  35.       click_function = "dud",
  36.       function_owner = self,
  37.       label = "",
  38.       width = 400,
  39.       height = 800,
  40.       color = {0, 0, 0, 0}
  41.    }
  42.  
  43.    for i = 1, #flags do
  44.       self.setVar("button_" .. i, function () clicked(i) end)
  45.       button_parameter.click_function = "button_" .. i
  46.       button_parameter.position = {flags[i].x, 0, 0}
  47.       button_parameter.tooltip = flags[i].name
  48.       self.createButton(button_parameter)
  49.    end
  50. end
  51.  
  52. function clicked(i)
  53.    local aBag = getObjectFromGUID("3ea749")
  54.    for _, j in pairs(flags[i].toBeCleared) do
  55.       local obj = getObjectFromGUID(j)
  56.       if obj ~= nil then aBag.putObject(obj) end
  57.    end
  58.  
  59.    if #flags[i].guids > 1 then
  60.       local lvl = 0
  61.       for u, v in pairs(flags[i].guids) do
  62.          local obj = getObjectFromGUID(v)
  63.          if obj ~= nil then
  64.             if not flags[i].multipart then
  65.                aBag.putObject(obj)
  66.             end
  67.             if u < #flags[i].guids then
  68.                local newPos = flags[i].position
  69.                local nextObj = getObjectFromGUID(flags[i].guids[u + 1])
  70.                if flags[i].multipart then
  71.                   newPos = flags[i].position[u + 1]
  72.                end
  73.                if not flags[i].multipart or (flags[i].multipart and nextObj == nil) then
  74.                   new = aBag.takeObject({
  75.                      position = newPos,
  76.                      rotation = {0, 180, 0},
  77.                      smooth = true,
  78.                      guid = flags[i].guids[u + 1],
  79.                   })
  80.                   new.setLock(true)
  81.                end
  82.             end
  83.             lvl = u + 1
  84.          end
  85.       end
  86.       if lvl == 0 then
  87.          local newPos = flags[i].position
  88.          if flags[i].multipart then
  89.             newPos = flags[i].position[1]
  90.          end
  91.          new = aBag.takeObject({
  92.             position = newPos,
  93.             rotation = {0, 180, 0},
  94.             smooth = true,
  95.             guid = flags[i].guids[1],
  96.          })
  97.          new.setLock(true)
  98.       end
  99.       if lvl > #flags[i].guids and flags[i].multipart then
  100.          for u, v in pairs(flags[i].guids) do
  101.             aBag.putObject(getObjectFromGUID(v))
  102.          end
  103.       end
  104.    else
  105.       local obj = getObjectFromGUID(flags[i].guids[1])
  106.       if obj ~= nil then
  107.          aBag.putObject(obj)
  108.       else
  109.          new = aBag.takeObject({
  110.             position = flags[i].position,
  111.             rotation = {0, 180, 0},
  112.             smooth = true,
  113.             guid = flags[i].guids[1],
  114.          })
  115.          new.setLock(true)
  116.       end
  117.    end
  118.    aBag.putObject(self)
  119. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement