Swapping Great Works with Lua

whoward69

DLL Minion
Joined
May 30, 2011
Messages
8,727
Location
Near Portsmouth, UK
So India (player 4) has a work of art (GW index 12) they are willing to swap.
You (player 0) want to swap it with your spare work of art (GW index 20).

The Lua seems to be

Code:
Network.SendSwapGreatWorks(0, 20, 4, 12)

but you can issue that until you're blue in the face and nothing will happen.

You need to select your work of art into your "swap space" first - blindly obvious!

Code:
Network.SendSetSwappableGreatWork(0, 1, 20)
Network.SendSwapGreatWorks(0, 20, 4, 12)

The magic "1" is "work of art class"

What's really annoying about most of those parameters is that they are unnecessary - as the DLL can figure them out!

Code:
function SwapGreatWorks(iMySwap, iTheirSwap, bForceThem)
  local iGwClass = Game.GetGreatWorkClass(iMySwap)
  
  if (iGwClass == Game.GetGreatWorkClass(iTheirSwap)) then
    local iMe = Game.GetGreatWorkController(iMySwap)
    local iThem = Game.GetGreatWorkController(iTheirSwap)

    if (iMe ~= iThem) then
      if (bForceThem) then
        Network.SendSetSwappableGreatWork(iThem, iGwClass, iTheirSwap)
      end

      Network.SendSetSwappableGreatWork(iMe, iGwClass, iMySwap)
      Network.SendSwapGreatWorks(iMe, iMySwap, iThem, iTheirSwap)
    end
  end
end
 
Back
Top Bottom