Today i looked at the distributing and collection of gold and added it to the OnUpdate I posted yesterday.
The ultimate goal for me would be to be able to write a function which handles the distribution of buffmats, water and gold preraid. So one just needs to sitdown spamming the "1"-Key until all mages made n-stacks of Water, after that all the trading takes places (where every manaclass gets a stack of water, gold gets distributed, all buffmats gets distributed evenly among one class...).
FsMB_TradeGoldToLeaderAllBut = {Active = false, Amount = 25, Time = nil}
FsMB_GetMoneyFromLeader = {Active = false, Amount = 25, Time = nil}
SleepTime = GetTime()
function partyup()
if IsControlKeyDown() then
echo("Get Money from Leader Start!")
FsMB_GetMoneyFromLeader.Time = GetTime() + 5
FsMB_GetMoneyFromLeader.Active = true
return
end
if IsAltKeyDown() then
echo("Trade Gold To Leader Start!")
FsMB_TradeGoldToLeaderAllBut.Time = GetTime() + 5
FsMB_TradeGoldToLeaderAllBut.Active = true
return
end
...
function TradeGoldToLeaderAllBut(amt)
if not MB_raidleader then return end
if MB_raidleader==UnitName("player") then
if GetTargetTradeMoney()>0 then
FsMB_TradeGoldToLeaderAllBut.Time = GetTime() + 5
AcceptTrade()
return
end
else
local mymoney=GetMoney()
if mymoney<=amt*10000 then
FsMB_TradeGoldToLeaderAllBut.Time = GetTime()
return
end
if CheckInteractDistance(RaidID(MB_raidleader),2) then
FsMB_TradeGoldToLeaderAllBut.Time = GetTime() + 1
if not MB_tradeopen then InitiateTrade(RaidID(MB_raidleader)) return end
local mytrade=mymoney-amt*10000
if GetPlayerTradeMoney()==0 then
SetTradeMoney(mytrade)
else
AcceptTrade()
end
end
end
end
function GetMoneyFromLeader(amt)
if not MB_raidleader then return end
if MB_raidleader==UnitName("player") then
local mymoney=GetMoney()
if mymoney<=amt*10000 then
Print("I don't have "..amt.." gold.")
return
end
local mytrade=amt*10000
if GetPlayerTradeMoney()==0 then
SetTradeMoney(mytrade)
else
FsMB_GetMoneyFromLeader.Time = GetTime() + 5
AcceptTrade()
end
else
local mymoney=GetMoney()
if mymoney>amt*10000 then
FsMB_GetMoneyFromLeader.Time = GetTime()
return
else
FsMB_GetMoneyFromLeader.Time = GetTime() + 1
end
if GetTargetTradeMoney()>0 then AcceptTrade() return end
if not MB_tradeopen then
InitiateTrade(RaidID(MB_raidleader))
return
end
end
end
local function UpdateHandler()
local CurrentTime = GetTime()
...
if FsMB_TradeGoldToLeaderAllBut.Active == true then
if FsMB_TradeGoldToLeaderAllBut.Time < CurrentTime then
FsMB_TradeGoldToLeaderAllBut.Active = false
echo("Trade Gold to Leader End!")
else
if SleepTime < CurrentTime then
SleepTime = CurrentTime + 0.5
TradeGoldToLeaderAllBut(FsMB_TradeGoldToLeaderAllBut.Amount)
end
end
elseif FsMB_GetMoneyFromLeader.Active == true then
if FsMB_GetMoneyFromLeader.Time < CurrentTime then
FsMB_GetMoneyFromLeader.Active = false
echo("Get Money from Leader End!")
else
if SleepTime < CurrentTime then
SleepTime = CurrentTime + 0.5
GetMoneyFromLeader(FsMB_GetMoneyFromLeader.Amount)
end
end
end
end
Hopefully i didn't make to many mistakes merging your latest SM_Extend.
http://www.mediafire.com/file/55ttiq0rmvc33qy/SM_Extend.lua/file
You know your stuff, sucka!
I just wanted more control over it (and to only do it when I want to do it) So I assigned the gold trading to specific buttons. Ctrl-0 has every toon request 25G if they have less than that. Ctrl-F12 has everyone give their money to the raid leader, keeping 25G for themselves.