Code:
function On_GossipMenu(unit, event, player)
if (player:IsInCombat() == true) then
player:SendAreaTriggerMessage("Sorry, you have to leave combat first!")
else
unit:GossipCreateMenu(100, player, 0)
unit:GossipMenuAddItem(5, "[Bet 1 Coin]", 1, 0)
unit:GossipMenuAddItem(5, "[Bet 2 Coins]", 2, 0)
unit:GossipSendMenu(player)
end
end
function On_GossipSelect(unit, event, player, id, intid, code)
if (intid == 7) then
unit:GossipCreateMenu(100, player, 0)
unit:GossipMenuAddItem(5, "[Bet 1 Coin]", 1, 0)
unit:GossipMenuAddItem(5, "[Bet 2 Coins]", 2, 0)
unit:GossipSendMenu(player)
end
if (intid == 1) then
if (misc:GetItemCount(32569) < 1) then
player:SendAreaTriggerMessage("You do not have enough coins to bet!")
else
unit:GossipMenuAddItem(5, "[You have a 50% chance of winning, continue?]", 0, 0)
unit:GossipMenuAddItem(4, "[Yes, make haste]", 5, 0)
unit:GossipMenuAddItem(4, "[No, take me back]", 7, 0)
unit:GossipSendMenu(player)
end
end
if (intid == 5) then
Choice=math.random(1, 2)
if Choice==1 then
player:AddItem(32569, 1)
end
if Choice==2 then
player:RemoveItem(32569, 1)
end
end
if (intid == 2) then
if (misc:GetItemCount(32569) < 2) then
player:SendAreaTriggerMessage("You do not have enough coins to bet!")
else
unit:GossipMenuAddItem(5, "[You have a 25% chance of winning, continue?]", 0, 0)
unit:GossipMenuAddItem(4, "[Yes, make haste]", 6, 0)
unit:GossipMenuAddItem(4, "[No, take me back]", 7, 0)
unit:GossipSendMenu(player)
end
end
if (intid == 6) then
Choice=math.random(1, 4)
if Choice==1 then
player:AddItem(32569, 2)
end
if Choice==2 then
player:RemoveItem(32569, 2)
end
if Chocie==3 then
player:RemoveItem(32569, 2)
end
if Choice==4 then
player:RemoveItem(32569, 2)
end
end
RegisterUnitGossipEvent(191881, 1, "On_GossipMenu")
RegisterUnitGossipEvent(191881, 2, "On_GossipSelect")