-- { H/L-Player } --
PlayerName = Self.Name() -- Ignore this, it's just a defualt value that will change
Settings =
{
Ping = 200, -- Change this to higher if your latency is high (ms)
Backpacks = 1 -- Amount of backpacks inside depot
}
Bet =
{
Maximum = 300000, -- Maximum bet
Minimum = 5000, -- Minimum bet
Payout = 1.8 -- Payout percent
}
Conversation =
{
Welcome = -- What to say to new players
{
"Welcome "..PlayerName.."! Feeling lucky today, aren't we?",
"Hello "..PlayerName..". Welcome to the casino.",
"Greetings "..PlayerName..", how are you today?"
},
Win = -- What to say if player wins
{
"Winner, winner, chicken dinner! Or wait.. that's blackjack.",
"Congratulations!",
"Well played, "..PlayerName.."!"
},
Loss = -- What to say if player loose
{
"I guess your luck just ran out.",
"Next time maybe, sorry.",
"Argh, how about another game?"
},
Payout = -- What to say if player asks about payout
{
"My payout is your bet back + "..((Bet.Payout-1)*100).."%. How does that sound?",
""..((Bet.Payout-1)*100).."%"
},
Maximum = -- What to say if player asks about max bet
{
"My maximum bet is "..(Bet.Maximum/1000).." K.",
""..(Bet.Maximum/1000).." K."
},
Minimum = -- What to say if player asks about min bet
{
"My minimum bet is "..(Bet.Minimum/1000).." K.",
""..(Bet.Minimum/1000).." K."
}
}
Advertisement =
{
Yell = true, -- Advertise your casino through yelling
Say = true, -- Advertise your casino through speaking (only people to people on screen)
Interval = 1, -- Interval betwen advertising messages (minutes)
Text =
{
Yell = -- What to yell out in public
{
"Best payout you can get. Astonishing "..((Bet.Payout-1)*100).."%!",
"Minimum bet is "..(Bet.Minimum/1000).." K.",
"Maximum bet is "..(Bet.Maximum/1000).." K."
},
Say = -- What to say in public
{
"Best payout you can get. Astonishing "..((Bet.Payout-1)*100).."%!",
"Minimum bet is "..(Bet.Minimum/1000).." K.",
"Maximum bet is "..(Bet.Maximum/1000).." K."
}
}
}
Keywords =
{
High = {"h", "high"}, -- Keyword for high
Low = {"l", "low"} -- Keyword for low
}
----------
pos, dPos, cPos, pPos, Gamble, Initialized = nil, nil, nil, nil, nil, nil
AntiSpamTimer = os.time()
function AntiSpam(message, type)
if os.difftime(os.time(), AntiSpamTimer) > 2 then
print("antispam")
Self.Speak(message, type)
AntiSpamTimer = os.time()
end
end
Module.New("LetXenoBotDoTheWork", function(mod)
if not Initialized then -- setups the depot automatically, no need for defining backpacks
while not Initialized do
while not (dPos and cPos and pPos) do
print("Instructions: Walk to any depot.")
wait(5000)
local depot = {3497, 3498, 3499, 3500}
local counter = {2321, 2318, 17385, 17378}
pos = Self.Position()
for x = -1, 1 do
for y = -1, 1 do
if not dPos then
if table.contains(depot, Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id) then
print("Depot found.")
dPos = { x = pos.x + x, y = pos.y + y }
end
end
if not cPos then
if table.contains(counter, Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id) then
print("Counter found.")
cPos = { x = pos.x + x, y = pos.y + y }
end
end
if dPos and cPos and not pPos then
if (pos.x + 1 == dPos.x or pos.x - 1 == dPos.x) and pos.y + 1 == cPos.y then
-- Depot: East/West - Counter: South of Depot - Player: 2 South --
pPos = { x = pos.x, y = pos.y + 2, turn = SOUTH }
print("Player tile found.")
elseif (pos.x + 1 == dPos.x or pos.x - 1 == dPos.x) and pos.y - 1 == cPos.y then
-- Depot: East/West - Counter: North of Depot - Player: 2 North --
pPos = { x = pos.x, y = pos.y - 2, turn = NORTH }
print("Player tile found.")
elseif (pos.y + 1 == dPos.y or pos.y - 1 == dPos.y) and pos.x + 1 == cPos.x then
-- Depot: North/South - Counter: East of Depot - Player: 2 East --
pPos = { x = pos.x + 2, y = pos.y, turn = EAST }
print("Player tile found.")
elseif (pos.y + 1 == dPos.y or pos.y - 1 == dPos.y) and pos.x - 1 == cPos.x then
-- Depot: North/South - Counter: West of Depot - Player: 2 West --
pPos = { x = pos.x - 2, y = pos.y, turn = WEST }
print("Player tile found.")
end
end
end
end
end
Self.CloseContainers()
Self.BrowseField(cPos.x, cPos.y, pos.z)
wait(500 + Settings.Ping, 1000 + Settings.Ping)
Container(0):Minimize()
wait(500 + Settings.Ping)
Self.BrowseField(dPos.x, dPos.y, pos.z)
wait(500 + Settings.Ping)
Container(1):Minimize()
wait(500 + Settings.Ping, 1000 + Settings.Ping)
Container(1):UseItem(0, false)
wait(500 + Settings.Ping, 1000 + Settings.Ping)
Container(2):UseItem(0, true)
wait(500 + Settings.Ping, 1000 + Settings.Ping)
Container(2):Minimize()
wait(500 + Settings.Ping)
if Container("Depot Chest"):isOpen() then
while #Container.GetAll() < Settings.Backpacks + 3 do
for slot, item in Container.GetLast():iItems() do
if Item.isContainer(item.id) then
Container.GetLast():UseItem(slot, false)
wait(500 + Settings.Ping)
Container.GetLast():Minimize()
wait(500 + Settings.Ping, 1000 + Settings.Ping)
end
end
end
end
if #Container.GetAll() == Settings.Backpacks + 3 then
print("Setup done.")
Initialized = true
Idle = true
break
end
end
elseif Gamble then -- Gamble stuff, handling bets etc
print("gambling")
while DoingShit do
local PlayerBet = nil
BetType = nil
local PlayerBet = Container(0):CountItemsOfID(3035)*100+Container(0):CountItemsOfID(3043)*10000
while PlayerBet do -- player placed bet
if PlayerBet >= Settings.Minimum and PlayerBet <= Settings.Maximum then -- make sure the bet is in range
for i = 3, #Container.GetAll() do
for spot in Container(0):iItems() do
if Container(0):GetItemData(spot).id == 3035 or Container(0):GetItemData(spot).id == 3043 then
Container(0):MoveItemToContainer(spot, Container(i):Index(), Container(i):ItemCapacity()-1, 100) -- move to bp with index +3, need to verify amount (if player removes any gold meanwhile)
wait(200 + Settings.Ping)
end
end
end
while not BetType do -- player have not decided l/h
wait(200)
end
-- use dice here and shit
if Result == BetType then -- player has won
-- play instrument
PlayerReward = PlayerBet*Bet.Payout
AntiSpam(Conversation.Win[math.random(1, #Conversation.Win)], SPEAK_SAY)
while Container(3):CountItemsOfID(3035)*100+Container(3):CountItemsOfID(3043)*10000 ~= PlayerReward do
for i = 3, #Container.GetAll() do
for spot in Container(i):iItems() do
if PlayerReward >= 10000 and Self.ItemCount(3043) > 0 then
PlayerCrystal = math.floor(PlayerReward/10000)
Container(i):MoveItemToContainer(spot, Container(3):Index(), Container(3):ItemCapacity()-1, PlayerCrystal)
PlayerReward = PlayerReward - PlayerCrystal*10000
end
if PlayerReward < 10000 and Self.ItemCount(3035) > 0 then
PlayerPlatinum = math.floor(PlayerReward/100)
Container(i):MoveItemToContainer(spot, Container(3):Index(), Container(3):ItemCapacity()-1, PlayerCrystal)
PlayerReward = PlayerReward - PlayerCrystal*100
end
if Container(3):CountItemsOfID(3035)*100+Container(3):CountItemsOfID(3043)*10000 > PlayerReward then
Container(3):MoveItemToContainer(spot, Container(i):Index(), Container(i):ItemCapacity()-1, PlayerCrystal)
end
end
end
Self.DropItem(cPos.x, cPos.y, pos.z, 3043, PlayerReward) -- loop not correct, needs to get fixed
end
elseif Result ~= BetType then -- player lost
-- use package (yellow hit)
AntiSpam(Conversation.Loss[math.random(1, #Conversation.Loss)], SPEAK_SAY)
end
else
if PlayerBet > Settings.Maximum then
AntiSpam(Conversation.Maximum[math.random(1, #Conversation.Maximum)], SPEAK_SAY)
elseif PlayerBet < Settings.Minimum then
AntiSpam(Conversation.Minimum[math.random(1, #Conversation.Minimum)], SPEAK_SAY)
end
Map.MoveItem(cPos.x, cPos.y, cPos.x, cPos.y, 100)
end
end
if Creature(PlayerName):Position().x ~= pPos.x and Creature(PlayerName):Position().y ~= pPos.y then -- player left
Gamble = false -- turn off customer loop
DoingShit = false -- turn off customer loop
Idle = true -- turn on idle loop
break
end
end
elseif Idle then -- Checks if position remains the same, if so then advertise/look the opposite way of depot, else start searching for a new depot
if Self.Position().x ~= pos.x or Self.Position().y ~= pos.y or Self.Position().z ~= pos.z then -- we moved ??????? haow?
pos, dPos, cPos, pPos, Gamble, Initialized = nil, nil, nil, nil, nil, nil
else
while not Gamble do
local creature = Self.GetSpectators()
if dPos.y == pos.y - 1 and not Self.LookDirection() ~= "south" then
Self.Turn(SOUTH)
elseif dPos.y == pos.y + 1 and not Self.LookDirection() ~= "north" then
Self.Turn(NORTH)
elseif dPos.x == pos.x + 1 and not Self.LookDirection() ~= "west" then
Self.Turn(WEST)
elseif dPos.x == pos.x - 1 and not Self.LookDirection() ~= "east" then
Self.Turn(EAST)
end
for i = 1, #creature do
if creature:Position().x == pPos.x and creature:Position().y == pPos.y and not Self.LookDirection() ~= pPos.turn then -- sets new PlayerName if player is on tile +2
Self.Turn(pPos.turn)
PlayerName = creature:Name()
print("say hi")
AntiSpam(Conversation.Welcome[math.random(1, #Conversation.Welcome)], SPEAK_SAY)
print("hi has been said")
Gamble = true -- start handling bets
Idle = false
break
end
end
-- use party hat, yey
if os.difftime(os.time(), timer) > Advertisement.Interval*60 then
if Advertisement.Yell and not Advertisement.Say then
AntiSpam(Advertisement.Text.Yell[math.random(1, #Advertisement.Text.Yell)], SPEAK_YELL)
elseif Advertisement.Say and not Advertisement.Yell then
AntiSpam(Advertisement.Text.Say[math.random(1, #Advertisement.Text.Say)], SPEAK_SAY)
end
timer = os.time()
end
if os.date("%H") == 10 and os.date("%M") >= 50 then
-- pickupItems
assert(false, "Server save bishess")
end
end
end
end
end)
-- { Signals } -- (not 100% sure if right, should be changed, go to line #180 and below)
Signal.OnReceive("Bet", function(signal, data)
if data[1] == PlayerName then
if BetType == "high" or BetType == "low" then
BetType = data[2]
elseif BetType == "payout" then
AntiSpam(message, type)
Self.Speak(Conversation.Payout[math.random(1, #Conversation.Payout)], SPEAK_SAY)
end
end
end)
Signal.OnReceive("Dice", function(signal, data)
if data == "high" then
Result = "high"
elseif data "low" then
Result = "low"
end
end)
se alguem puder ajudar ... o script xenobot era para o depot gostaria que voces me ajuda-se a transformar ele para house igual a imagem acima ... essa house e minha mais nao consigo configurar ele se alguem solber e puder me ajudar ... muito obrigado