Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DICE_SCRIPT_PROJECT = {
- -- Payout.
- -- Default: 80%
- PAYOUT_PERCENTAGE = 80,
- -- Minimum amount of cash.
- -- Default: 5k
- MINIMUM_BET = 5000,
- -- Maximum amount of cash.
- -- Default: 300k
- MAXIMUM_BET = 300000,
- -- Main backpack.
- -- Default: Any
- MAIN_BACKPACK = "Purple Backpack",
- -- Backpack for crystal coins.
- -- Default: Orange Backapack
- CRYSTAL_COINS_BACKPACK = "Orange Backpack",
- -- Backpack for platinum coins.
- -- Default: Red Backpack
- PLATINUM_COINS_BACKPACK = "Red Backpack",
- -- Accept abbreviated values.
- -- Possible choices: h or l
- ACCEPT_ABBREVIATIONS = true,
- -- Accept numeric values.
- -- Possible choices: 123 or 456
- ACCEPT_NUMERIC = true,
- -- Ping compensation for slow connections.
- -- Default: 100
- PING_COMPENSATION = 100,
- -- Switch broadcast mode. Displays a broadcasted message.
- -- >> "{operator}'s CASINO: HIGH/LOW - MIN {min}K / MAX {max}K - {payout}% PAYOUT"
- BROADCAST_MESSAGES = true,
- -- Item name to use when player wins bet.
- -- If you do not want any item to be used, type "none".
- -- Default: Lyre
- WON_BET_ITEM = "Lyre",
- -- Item name to use when player loses bet.
- -- If you do not want any item to be used, type "none".
- -- Default: Trough Kit
- LOST_BET_ITEM = "Trough Kit",
- -- Switch use party hat in casino.
- USE_PARTY_HAT = true,
- -- Item name to use as decoration under dice.
- -- If you do not want any item to be decorative, type "none".
- -- Default: "Ectoplasmic Sushi"
- DECORATION_ITEM = "Ectoplasmic Sushi",
- -- Display HUD with statistics.
- SHOW_STATS_HUD = true,
- }
- -----------------------------------------------
- --[[ DO NOT EDIT ANYTHING BELOW THIS LINE ]] --
- -----------------------------------------------
- CONTAINERS = { COUNTER_BROWSE_FIELD = nil, LOCKER_BROWSE_FIELD = nil, MAIN_BACKPACK = nil, CRYSTAL_COINS_BACKPACK = nil, DEPOTLOCK = nil, PLATINUM_COINS_BACKPACK = nil }
- DICE_ID = { 5792, 5793, 5794, 5795, 5796, 5797 }
- CASH = { CRYSTAL_COIN = 3043, PLATINUM_COIN = 3035 }
- CASH_ID = { 3035, 3043 }
- COUNTER_ID = { 2318, 2320, 2321, 2343, 2345 }
- LOCKER = { X = 0, Y = 0, Z = 0 }
- LOCKER_ID = { 3497, 3498, 3499, 3500 }
- GLOWING_SWITCH_ID = { 10145 }
- COUNTER = { X = 0, Y = 0, Z = 0 }
- DUSTBIN = { X = 0, Y = 0, Z = 0 }
- DUSTBIN_ID = { 2526 }
- GAMBLE_OPTION = { HIGH = 1, LOW = 0, NONE = -1 }
- PLAYER = { LAST_SEEN = "", BALANCE = 0, OPTION = GAMBLE_OPTION.NONE, SPOT = { X = 0, Y = 0, Z = 0 } }
- LOADING_COMPLETE = false
- RESTACK_ITEMS = true
- DECORATION_ITEM_ID = Item.GetID(DICE_SCRIPT_PROJECT.DECORATION_ITEM)
- WON_BET_ITEM_ID = Item.GetID(DICE_SCRIPT_PROJECT.WON_BET_ITEM)
- LOST_BET_ITEM_ID = Item.GetID(DICE_SCRIPT_PROJECT.LOST_BET_ITEM)
- if (DICE_SCRIPT_PROJECT.SHOW_STATS_HUD) then
- HEADS_UP_DISPLAY =
- {
- SCRIPT_NAME = "DICE SCRIPT PROJECT",
- SCRIPT_VERSION = "Beta-0.1.0",
- SCRIPT_HEADER = HUD.New(10, 20, "", 30, 144, 255),
- STATS_HEADER = HUD.New(10, 40, "STATISTICS", 255, 165, 0),
- AMOUNT_CASH =
- {
- DISPLAY_CRYSTAL =
- {
- TEXT = HUD.New(10, 60, "Crystal Coins", 255, 255, 255),
- AMOUNT = HUD.New(140, 60, "0k", 255, 255, 255)
- },
- DISPLAY_PLATINUM =
- {
- TEXT = HUD.New(10, 76, "Platinum Coins", 255, 255, 255),
- AMOUNT = HUD.New(140, 76, "0k", 255, 255, 255)
- }
- },
- BETS =
- {
- WON =
- {
- TEXT = HUD.New(10, 92, "Bets Won", 255, 255, 255),
- AMOUNT = HUD.New(140, 92, "0 (0k)", 255, 255, 255),
- AMOUNT_RAW = 0,
- AMOUNT_CASH = 0
- },
- LOST =
- {
- TEXT = HUD.New(10, 108, "Bets Lost", 255, 255, 255),
- AMOUNT = HUD.New(140, 108, "0 (0k)", 255, 255, 255),
- AMOUNT_RAW = 0,
- AMOUNT_CASH = 0
- },
- OUTCOME =
- {
- TEXT = HUD.New(10, 128, "OUTCOME", 255, 255, 255),
- AMOUNT = HUD.New(140, 128, "0 (0k)", 255, 255, 255),
- AMOUNT_RAW = 0,
- AMOUNT_CASH = 0
- }
- },
- SETTINGS_HEADER = HUD.New(10, 148, "SETTINGS", 255, 165, 0),
- PING_COMPENSATION =
- {
- TEXT = HUD.New(10, 168, "Ping Compensation: ", 255, 255, 255),
- VALUE = HUD.New(140, 168, tostring(DICE_SCRIPT_PROJECT.PING_COMPENSATION), 255, 255, 255)
- },
- PAYOUT =
- {
- TEXT = HUD.New(10, 184, "Payout percentage: ", 255, 255, 255),
- VALUE = HUD.New(140, 184, DICE_SCRIPT_PROJECT.PAYOUT_PERCENTAGE.."%", 255, 255, 255)
- },
- MIN_MAX_BET =
- {
- TEXT = HUD.New(10, 200, "Bet: ", 255, 255, 255),
- VALUE = HUD.New(140, 200, math.floor(DICE_SCRIPT_PROJECT.MINIMUM_BET/1000).."k - "..math.floor(DICE_SCRIPT_PROJECT.MAXIMUM_BET/1000).."k", 255, 255, 255)
- },
- ABBREVIATIONS =
- {
- TEXT = HUD.New(10, 216, "Abbreviations: ", 255, 255, 255),
- VALUE = HUD.New(140, 216, tostring(DICE_SCRIPT_PROJECT.ACCEPT_ABBREVIATIONS), 107, 142, 35)
- },
- NUMERIC_BETS =
- {
- TEXT = HUD.New(10, 232, "Numeric bets: ", 255, 255, 255),
- VALUE = HUD.New(140, 232, tostring(DICE_SCRIPT_PROJECT.ACCEPT_NUMERIC), 107, 142, 35)
- },
- BROADCAST_MESSAGES =
- {
- TEXT = HUD.New(10, 248, "Broadcast messages: ", 255, 255, 255),
- VALUE = HUD.New(140, 248, tostring(DICE_SCRIPT_PROJECT.BROADCAST_MESSAGES), 178, 34, 34)
- },
- COLORS =
- {
- BLACK = {R = 10, G = 10, B = 10},
- ORANGE = {R = 255, G = 165, B = 0},
- BLUE = {R = 30, G = 144, B = 255},
- CORNSILK = {R = 205, G = 200, B = 177},
- WHITE = {R = 255, G = 255, B = 255},
- GREEN = {R = 107, G = 142, B = 35},
- RED = {R = 178, G = 34, B = 34},
- }
- }
- HEADS_UP_DISPLAY.SCRIPT_HEADER:SetText(HEADS_UP_DISPLAY.SCRIPT_NAME.." "..HEADS_UP_DISPLAY.SCRIPT_VERSION)
- if (DICE_SCRIPT_PROJECT.ACCEPT_ABBREVIATIONS) then
- HEADS_UP_DISPLAY.ABBREVIATIONS.VALUE:SetTextColor(107, 142, 35)
- else
- HEADS_UP_DISPLAY.ABBREVIATIONS.VALUE:SetTextColor(178, 34, 34)
- end
- if (DICE_SCRIPT_PROJECT.ACCEPT_NUMERIC) then
- HEADS_UP_DISPLAY.NUMERIC_BETS.VALUE:SetTextColor(107, 142, 35)
- else
- HEADS_UP_DISPLAY.NUMERIC_BETS.VALUE:SetTextColor(178, 34, 34)
- end
- if (DICE_SCRIPT_PROJECT.BROADCAST_MESSAGES) then
- HEADS_UP_DISPLAY.BROADCAST_MESSAGES.VALUE:SetTextColor(107, 142, 35)
- else
- HEADS_UP_DISPLAY.BROADCAST_MESSAGES.VALUE:SetTextColor(178, 34, 34)
- end
- end
- function CountItemsOfIDs(container, IDs)
- if (container == nil) then
- return 0
- end
- local tempTotal = 0
- for iterator, itemID in ipairs(IDs) do
- tempTotal = tempTotal + container:CountItemsOfID(itemID)
- end
- return tempTotal
- end
- function CountCash(container, cashID)
- local tempTotalCash = 0
- if (type(cashID) == "string") then
- tempTotalCash = tempTotalCash + (container:CountItemsOfID(CASH.CRYSTAL_COIN) * 10000)
- tempTotalCash = tempTotalCash + (container:CountItemsOfID(CASH.PLATINUM_COIN) * 100)
- else
- if (cashID == CASH.CRYSTAL_COIN) then
- tempTotalCash = tempTotalCash + (container:CountItemsOfID(CASH.CRYSTAL_COIN) * 10000)
- elseif (cashID == CASH.PLATINUM_COIN) then
- tempTotalCash = tempTotalCash + (container:CountItemsOfID(CASH.PLATINUM_COIN) * 100)
- end
- end
- return tempTotalCash
- end
- function MoveCash(fromContainer, toContainer, cashID, amount, delay)
- if (toContainer:Index() == 0 or toContainer:Index() == 1) then
- local tempPositionX, tempPositionY, tempPositionZ = 0, 0, 0
- if (toContainer:Index() == 0) then
- tempPositionX = COUNTER.X
- tempPositionY = COUNTER.Y
- tempPositionZ = COUNTER.Z
- elseif (toContainer:Index() == 1) then
- tempPositionX = LOCKER.X
- tempPositionY = LOCKER.Y
- tempPositionZ = LOCKER.Z
- end
- for itemFromContainer = fromContainer:ItemCount() - 1, 0, -1 do
- tempItemFromContainer = fromContainer:GetItemData(itemFromContainer)
- if (tempItemFromContainer.id == cashID) then
- if (tempItemFromContainer.count >= amount) then
- fromContainer:MoveItemToGround(itemFromContainer, tempPositionX, tempPositionY, tempPositionZ, amount)
- else
- fromContainer:MoveItemToGround(itemFromContainer, tempPositionX, tempPositionY, tempPositionZ, tempItemFromContainer.count)
- amount = amount - tempItemFromContainer.count
- end
- end
- end
- else
- for itemFromContainer = fromContainer:ItemCount() - 1, 0, -1 do
- tempItemFromContainer = fromContainer:GetItemData(itemFromContainer)
- if (tempItemFromContainer.id == cashID) then
- if (tempItemFromContainer.count >= amount) then
- fromContainer:MoveItemToContainer(itemFromContainer, toContainer:Index(), toContainer:ItemCount() + 1, amount)
- else
- fromContainer:MoveItemToContainer(itemFromContainer, toContainer:Index(), toContainer:ItemCount() + 1, tempItemFromContainer.count)
- amount = amount - tempItemFromContainer.count
- end
- end
- end
- end
- wait(delay + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- end
- function Win()
- local jackpot = PLAYER.BALANCE + (DICE_SCRIPT_PROJECT.PAYOUT_PERCENTAGE * PLAYER.BALANCE / 100)
- local payout = jackpot
- if (payout > 0) then
- if (WON_BET_ITEM_ID > 0) then
- for itemMainBackpack = CONTAINERS.DEPOTLOCK:ItemCount()-1, 0, -1 do
- if (CONTAINERS.DEPOTLOCK:GetItemData(itemMainBackpack).id == WON_BET_ITEM_ID) then
- CONTAINERS.DEPOTLOCK:UseItem(itemMainBackpack, true)
- wait(500 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- break
- end
- end
- end
- local cc_amount, plat_amount = 0, 0
- while payout >= 10000 do
- cc_amount = cc_amount + 1
- payout = payout - 10000
- end
- while payout >= 100 do
- plat_amount = plat_amount + 1
- payout = payout - 100
- end
- if (DICE_SCRIPT_PROJECT.SHOW_STATS_HUD) then
- HEADS_UP_DISPLAY.BETS.LOST.AMOUNT_RAW = HEADS_UP_DISPLAY.BETS.LOST.AMOUNT_RAW + 1
- HEADS_UP_DISPLAY.BETS.LOST.AMOUNT_CASH = HEADS_UP_DISPLAY.BETS.LOST.AMOUNT_CASH + (cc_amount * 10000) + (plat_amount * 100)
- HEADS_UP_DISPLAY.BETS.LOST.AMOUNT:SetText(tostring(HEADS_UP_DISPLAY.BETS.LOST.AMOUNT_RAW).." ("..tostring(HEADS_UP_DISPLAY.BETS.LOST.AMOUNT_CASH/1000).."k)")
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_RAW = HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_RAW + 1
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH = HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH - HEADS_UP_DISPLAY.BETS.LOST.AMOUNT_CASH
- if (HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH > 0) then
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetTextColor(107, 142, 35)
- elseif (HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH == 0) then
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetTextColor(255, 255, 255)
- else
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetTextColor(178, 34, 34)
- end
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetText(tostring(HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_RAW).." ("..tostring(math.floor(HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH/1000)).."k)")
- end
- for iterator, value in pairs(GAMBLE_OPTION) do
- if (value == PLAYER.OPTION) then
- print(PLAYER.LAST_SEEN.." won "..(jackpot/1000).."k - High/Low: "..iterator.." - Payout: "..cc_amount.." cc + "..plat_amount.." plats.")
- break
- end
- end
- if (plat_amount > 0) then
- MoveCash(CONTAINERS.PLATINUM_COINS_BACKPACK, CONTAINERS.COUNTER_BROWSE_FIELD, CASH.PLATINUM_COIN, plat_amount, 300)
- end
- if (cc_amount > 0) then
- MoveCash(CONTAINERS.CRYSTAL_COINS_BACKPACK, CONTAINERS.COUNTER_BROWSE_FIELD, CASH.CRYSTAL_COIN, cc_amount, 300)
- end
- if (DICE_SCRIPT_PROJECT.SHOW_STATS_HUD) then
- HEADS_UP_DISPLAY.AMOUNT_CASH.DISPLAY_CRYSTAL.AMOUNT:SetText(tostring(CountCash(CONTAINERS.CRYSTAL_COINS_BACKPACK, CASH.CRYSTAL_COIN)/1000).."k")
- HEADS_UP_DISPLAY.AMOUNT_CASH.DISPLAY_PLATINUM.AMOUNT:SetText(tostring(CountCash(CONTAINERS.PLATINUM_COINS_BACKPACK, CASH.PLATINUM_COIN)/1000).."k")
- end
- end
- end
- function Lose()
- if (DICE_SCRIPT_PROJECT.SHOW_STATS_HUD) then
- HEADS_UP_DISPLAY.BETS.WON.AMOUNT_RAW = HEADS_UP_DISPLAY.BETS.WON.AMOUNT_RAW + 1
- HEADS_UP_DISPLAY.BETS.WON.AMOUNT_CASH = HEADS_UP_DISPLAY.BETS.WON.AMOUNT_CASH + PLAYER.BALANCE
- HEADS_UP_DISPLAY.BETS.WON.AMOUNT:SetText(tostring(HEADS_UP_DISPLAY.BETS.WON.AMOUNT_RAW).." ("..tostring(HEADS_UP_DISPLAY.BETS.WON.AMOUNT_CASH/1000).."k)")
- HEADS_UP_DISPLAY.AMOUNT_CASH.DISPLAY_CRYSTAL.AMOUNT:SetText(tostring(CountCash(CONTAINERS.CRYSTAL_COINS_BACKPACK, CASH.CRYSTAL_COIN)/1000).."k")
- HEADS_UP_DISPLAY.AMOUNT_CASH.DISPLAY_PLATINUM.AMOUNT:SetText(tostring(CountCash(CONTAINERS.PLATINUM_COINS_BACKPACK, CASH.PLATINUM_COIN)/1000).."k")
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_RAW = HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_RAW + 1
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH = HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH + HEADS_UP_DISPLAY.BETS.WON.AMOUNT_CASH
- if (HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH > 0) then
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetTextColor(107, 142, 35)
- elseif (HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH == 0) then
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetTextColor(255, 255, 255)
- else
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetTextColor(178, 34, 34)
- end
- HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT:SetText(tostring(HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_RAW).." ("..tostring(math.floor(HEADS_UP_DISPLAY.BETS.OUTCOME.AMOUNT_CASH/1000)).."k)")
- end
- if (LOST_BET_ITEM_ID > 0) then
- for itemMainBackpack = CONTAINERS.DEPOTLOCK:ItemCount()-1, 0, -1 do
- if (CONTAINERS.DEPOTLOCK:GetItemData(itemMainBackpack).id == LOST_BET_ITEM_ID) then
- CONTAINERS.DEPOTLOCK:UseItem(itemMainBackpack, true)
- wait(200)
- CONTAINERS.DEPOTLOCK:UseItem(itemMainBackpack, true)
- break
- end
- end
- end
- for iterator, value in pairs(GAMBLE_OPTION) do
- if (value == PLAYER.OPTION) then
- print(PLAYER.LAST_SEEN.." lost "..(PLAYER.BALANCE/1000).."k - High/Low: "..iterator)
- break
- end
- end
- end
- function ReachGlowingSwitch()
- local GlowingSwitches = {}
- local AvailablePairsOfSwitches = {}
- local posz = Self.Position().z
- for iterator, switchID in ipairs(GLOWING_SWITCH_ID) do
- for posx = 7, -7, -1 do
- for posy = 5, -5, -1 do
- if (switchID == Map.GetTopUseItem(Self.Position().x + posx, Self.Position().y + posy, posz).id) then
- for posx_pair = -2, 2, 2 do
- for posy_pair = -2, 2, 2 do
- if not (Self.Position().x + posx == Self.Position().x + posx + posx_pair and Self.Position().y + posy == Self.Position().y + posy + posy_pair) then
- if (switchID == Map.GetTopUseItem(Self.Position().x + posx + posx_pair, Self.Position().y + posy + posy_pair, posz).id) then
- local insertSwitch = false
- if(#GlowingSwitches <= 0) then
- insertSwitch = true
- else
- local opx, opy = Self.Position().x + posx, Self.Position().y + posy
- local px, py = Self.Position().x + posx + posx_pair, Self.Position().y + posy + posy_pair
- for iterator, PairsOfSwitches in ipairs(GlowingSwitches) do
- if (PairsOfSwitches.Operator.x == px and PairsOfSwitches.Operator.y == py) and
- (PairsOfSwitches.Player.x == opx and PairsOfSwitches.Player.y == opy) then
- insertSwitch = false
- break
- else
- insertSwitch = true
- end
- end
- end
- if (insertSwitch) then
- table.insert(GlowingSwitches, { Operator = { x = Self.Position().x + posx, y = Self.Position().y + posy },
- Player = { x = Self.Position().x + posx + posx_pair, y = Self.Position().y + posy + posy_pair } } )
- end
- end
- end
- end
- end
- end
- end
- end
- end
- print("Found "..#GlowingSwitches.." pairs of switches.")
- local GlowingSwitchReached = false
- while not GlowingSwitchReached do
- for iterator, PairsOfSwitches in ipairs(GlowingSwitches) do
- Self.UseItemFromGround(PairsOfSwitches.Operator.x, PairsOfSwitches.Operator.y, posz)
- local prevPosition = Self.Position()
- wait(500 + DICE_SCRIPT_PROJECT.PING_COMPENSATION, 1000 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- if Self.DistanceFromPosition(prevPosition.x, prevPosition.y, posz) >= 1 then
- while Self.DistanceFromPosition(PairsOfSwitches.Operator.x, PairsOfSwitches.Operator.y, posz) > 1 do
- Self.UseItemFromGround(PairsOfSwitches.Operator.x, PairsOfSwitches.Operator.y, posz)
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION, 200 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- end
- if(PairsOfSwitches.Operator.x < Self.Position().x) then
- Self.Step(WEST)
- GlowingSwitchReached = true
- break
- elseif(PairsOfSwitches.Operator.x > Self.Position().x) then
- Self.Step(EAST)
- GlowingSwitchReached = true
- break
- elseif(PairsOfSwitches.Operator.y < Self.Position().y) then
- Self.Step(NORTH)
- GlowingSwitchReached = true
- break
- elseif(PairsOfSwitches.Operator.y > Self.Position().y) then
- Self.Step(SOUTH)
- GlowingSwitchReached = true
- break
- else
- GlowingSwitchReached = true
- break
- end
- end
- end
- end
- print("Depot found!")
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION, 400 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- return true
- end
- function UpdateSystemCoordinates()
- local posx = Self.Position().x
- local posy = Self.Position().y
- local posz = Self.Position().z
- LOCKER.Z = posz
- for x = -1, 1 do
- for y = -1, 1 do
- if (table.contains(LOCKER_ID, Map.GetTopUseItem(posx + x, posy + y, Self.Position().z).id)) then
- LOCKER.X = posx + x
- LOCKER.Y = posy + y
- end
- end
- end
- COUNTER.Z = posz
- for x = -1, 1 do
- for y = -1, 1 do
- if (table.contains(COUNTER_ID, Map.GetTopUseItem(posx + x, posy + y, Self.Position().z).id)) then
- COUNTER.X = posx + x
- COUNTER.Y = posy + y
- end
- end
- end
- DUSTBIN.Z = posz
- for x = -7, 7 do
- for y = -5, 5 do
- if (table.contains(DUSTBIN_ID, Map.GetTopUseItem(posx + x, posy + y, Self.Position().z).id)) then
- DUSTBIN.X = posx + x
- DUSTBIN.Y = posy + y
- end
- end
- end
- PLAYER.SPOT.Z = posz
- if (COUNTER.X == posx - 1) then
- if (COUNTER.Y == posy - 1) then
- if (LOCKER.X == posx - 1 and LOCKER.Y == posy) then
- PLAYER.SPOT.X = posx
- PLAYER.SPOT.Y = posy - 2
- elseif (LOCKER.X == posx and LOCKER.Y == posy - 1) then
- PLAYER.SPOT.X = posx - 2
- PLAYER.SPOT.Y = posy
- end
- elseif (COUNTER.Y == posy + 1) then
- if (LOCKER.X == posx - 1 and LOCKER.Y == posy) then
- PLAYER.SPOT.X = posx
- PLAYER.SPOT.Y = posy + 2
- elseif (LOCKER.X == posx and LOCKER.Y == posy + 1) then
- PLAYER.SPOT.X = posx - 2
- PLAYER.SPOT.Y = posy
- end
- end
- elseif (COUNTER.X == posx + 1) then
- if (COUNTER.Y == posy - 1) then
- if (LOCKER.X == posx + 1 and LOCKER.Y == posy) then
- PLAYER.SPOT.X = posx
- PLAYER.SPOT.Y = posy - 2
- elseif (LOCKER.X == posx and LOCKER.Y == posy - 1) then
- PLAYER.SPOT.X = posx + 2
- PLAYER.SPOT.Y = posy
- end
- elseif (COUNTER.Y == posy + 1) then
- if (LOCKER.X == posx + 1 and LOCKER.Y == posy) then
- PLAYER.SPOT.X = posx
- PLAYER.SPOT.Y = posy + 2
- elseif (LOCKER.X == posx and LOCKER.Y == posy + 1) then
- PLAYER.SPOT.X = posx + 2
- PLAYER.SPOT.Y = posy
- end
- end
- end
- end
- function CheckDiceAndDecoration()
- if (DECORATION_ITEM_ID > 0) then
- if (CONTAINERS.LOCKER_BROWSE_FIELD:CountItemsOfID(DECORATION_ITEM_ID) < 1) then
- if (Container.New(2):CountItemsOfID(DECORATION_ITEM_ID) >= 1) then
- for itemMainBackpack = Container.New(2):ItemCount() - 1, 0, -1 do
- local tempItemMainBackpack = Container.New(2):GetItemData(itemMainBackpack)
- if (DECORATION_ITEM_ID == tempItemMainBackpack.id) then
- Container.New(2):MoveItemToGround(itemMainBackpack, LOCKER.X, LOCKER.Y, LOCKER.Z, 1)
- wait(300 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- break
- end
- end
- end
- end
- end
- local DiceInLocker = CountItemsOfIDs(CONTAINERS.LOCKER_BROWSE_FIELD, DICE_ID)
- if (DiceInLocker < 1) then
- local AmountOfDice = CountItemsOfIDs(Container.New(2), DICE_ID)
- if (AmountOfDice >= 1) then
- for itemMainBackpack = Container.New(2):ItemCount() - 1, 0, -1 do
- local tempItemMainBackpack = Container.New(2):GetItemData(itemMainBackpack)
- if table.contains(DICE_ID, tempItemMainBackpack.id) then
- Container.New(2):MoveItemToGround(itemMainBackpack, LOCKER.X, LOCKER.Y, LOCKER.Z, 1)
- wait(300 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- break
- end
- end
- end
- end
- end
- function EffectMessage(proxy, message, x, y, z)
- if (LOADING_COMPLETE) then
- local ROLLED_NUMBER = string.match(message, Self.Name().." rolled a (.+).")
- if(ROLLED_NUMBER) then
- ROLLED_NUMBER = ROLLED_NUMBER + 0
- local PlayerWon = false
- if (PLAYER.OPTION == GAMBLE_OPTION.LOW) then
- if (ROLLED_NUMBER >= 1 and ROLLED_NUMBER <= 3) then
- PlayerWon = true
- end
- elseif (PLAYER.OPTION == GAMBLE_OPTION.HIGH) then
- if (ROLLED_NUMBER >= 4 and ROLLED_NUMBER <= 6) then
- PlayerWon = true
- end
- end
- if (PlayerWon) then
- Win()
- else
- Lose()
- end
- end
- end
- end
- function LocalSpeech(proxy, mtype, speaker, level, text)
- if (LOADING_COMPLETE) then
- if (Creature(speaker):Position().x == PLAYER.SPOT.X and
- Creature(speaker):Position().y == PLAYER.SPOT.Y and
- Creature(speaker):Position().z == PLAYER.SPOT.Z) then
- text = text:trim():lower()
- if (DICE_SCRIPT_PROJECT.ACCEPT_ABBREVIATIONS) then
- if (text == "h") or (text == "l") then
- if (text == "h") then
- PLAYER.OPTION = GAMBLE_OPTION.HIGH
- elseif (text == "l") then
- PLAYER.OPTION = GAMBLE_OPTION.LOW
- end
- else
- PLAYER.OPTION = GAMBLE_OPTION.NONE
- end
- end
- if (DICE_SCRIPT_PROJECT.ACCEPT_NUMERIC) then
- if (text == "456") or (text == "123") then
- if (text == "456") then
- PLAYER.OPTION = GAMBLE_OPTION.HIGH
- elseif (text == "123") then
- PLAYER.OPTION = GAMBLE_OPTION.LOW
- end
- else
- PLAYER.OPTION = GAMBLE_OPTION.NONE
- end
- end
- if (text == "high") or (text == "low") then
- if (text == "high") then
- PLAYER.OPTION = GAMBLE_OPTION.HIGH
- elseif (text == "low") then
- PLAYER.OPTION = GAMBLE_OPTION.LOW
- end
- else
- PLAYER.OPTION = GAMBLE_OPTION.NONE
- end
- if (PLAYER.OPTION ~= GAMBLE_OPTION.NONE) then
- PLAYER.BALANCE = CountCash(CONTAINERS.COUNTER_BROWSE_FIELD, "all")
- if (PLAYER.BALANCE >= DICE_SCRIPT_PROJECT.MINIMUM_BET and PLAYER.BALANCE <= DICE_SCRIPT_PROJECT.MAXIMUM_BET) then
- print(speaker.."'s balance: "..PLAYER.BALANCE)
- MoveCash(CONTAINERS.COUNTER_BROWSE_FIELD, CONTAINERS.MAIN_BACKPACK, CASH.CRYSTAL_COIN, 100, 500)
- MoveCash(CONTAINERS.COUNTER_BROWSE_FIELD, CONTAINERS.MAIN_BACKPACK, CASH.PLATINUM_COIN, 100, 500)
- local authPlayerBalance = CountCash(CONTAINERS.MAIN_BACKPACK, "all")
- print(speaker.."'s balance authentication: "..authPlayerBalance)
- if (PLAYER.BALANCE == authPlayerBalance) then
- PLAYER.LAST_SEEN = speaker
- PLAYER.BALANCE = authPlayerBalance
- MoveCash(CONTAINERS.MAIN_BACKPACK, CONTAINERS.CRYSTAL_COINS_BACKPACK, CASH.CRYSTAL_COIN, 100, 500)
- MoveCash(CONTAINERS.MAIN_BACKPACK, CONTAINERS.PLATINUM_COINS_BACKPACK, CASH.PLATINUM_COIN, 100, 500)
- if (DECORATION_ITEM_ID > 0) then
- CONTAINERS.LOCKER_BROWSE_FIELD:UseItem(2, true)
- else
- CONTAINERS.LOCKER_BROWSE_FIELD:UseItem(1, true)
- end
- else
- MoveCash(CONTAINERS.MAIN_BACKPACK, CONTAINERS.COUNTER_BROWSE_FIELD, CASH.CRYSTAL_COIN, 100, 500)
- MoveCash(CONTAINERS.MAIN_BACKPACK, CONTAINERS.COUNTER_BROWSE_FIELD, CASH.PLATINUM_COIN, 100, 500)
- print("Warning: Player took cash back.")
- end
- end
- end
- end
- end
- end
- if (DICE_SCRIPT_PROJECT.BROADCAST_MESSAGES) then
- Module.New('DICE_SCRIPT_PROJECT: BROADCASTER', function(moduleObject)
- if (LOADING_COMPLETE) then
- local PlayersAround = false
- for name, creature in Creature.iPlayers(2) do
- if (name ~= nil) then
- PlayersAround = true
- break
- end
- end
- if not PlayersAround then
- local broadcast = string.upper(Self.Name()).."'S CASINO: HIGH/LOW"
- if (DICE_SCRIPT_PROJECT.ACCEPT_ABBREVIATIONS) then
- broadcast = broadcast..", H/L"
- end
- if (DICE_SCRIPT_PROJECT.ACCEPT_NUMERIC) then
- broadcast = broadcast..", 123/456"
- end
- broadcast = broadcast.." - MIN "..(DICE_SCRIPT_PROJECT.MINIMUM_BET/1000).."K / MAX "..(DICE_SCRIPT_PROJECT.MAXIMUM_BET/1000).."K - "..DICE_SCRIPT_PROJECT.PAYOUT_PERCENTAGE.."% PAYOUT"
- Self.Say(broadcast)
- end
- moduleObject:Delay(math.random(30 * 1000, 60 * 1000))
- end
- end)
- end
- if (DICE_SCRIPT_PROJECT.USE_PARTY_HAT) then
- Module.New('DICE_SCRIPT_PROJECT: PARTY-HAT', function(moduleObject)
- if (LOADING_COMPLETE) then
- if (Self.Head().id == Item.GetID("party hat")) then
- Self.UseItemFromEquipment("head")
- moduleObject:Delay(1500)
- end
- end
- end)
- end
- Module.New('DICE_SCRIPT_PROJECT: ANTI-TRASHER', function(moduleObject)
- if (LOADING_COMPLETE) then
- for itemCounter = CONTAINERS.COUNTER_BROWSE_FIELD:ItemCount() - 1, 0, -1 do
- local tempItemCounter = CONTAINERS.COUNTER_BROWSE_FIELD:GetItemData(itemCounter)
- if not table.contains(CASH_ID, tempItemCounter.id) then
- print("Throw: "..tempItemCounter.count.." "..Item.GetName(tempItemCounter.id).." - Counter >> Dustbin")
- CONTAINERS.COUNTER_BROWSE_FIELD:MoveItemToGround(itemCounter, DUSTBIN.X, DUSTBIN.Y, DUSTBIN.Z, tempItemCounter.count) -- dustbin
- else
- local CashToExchange = CONTAINERS.COUNTER_BROWSE_FIELD:CountItemsOfID(CASH.PLATINUM_COIN)
- if CashToExchange >= 100 then
- MoveCash(CONTAINERS.COUNTER_BROWSE_FIELD, CONTAINERS.MAIN_BACKPACK, CASH.PLATINUM_COIN, 100, 500)
- local authCashToExchange = CountCash(CONTAINERS.MAIN_BACKPACK, CASH.PLATINUM_COIN)
- if authCashToExchange == 10000 then
- print("Exchange: 100 Platinum coins >> 1 Crystal coin")
- MoveCash(CONTAINERS.MAIN_BACKPACK, CONTAINERS.PLATINUM_COINS_BACKPACK, CASH.PLATINUM_COIN, 100, 200)
- MoveCash(CONTAINERS.CRYSTAL_COINS_BACKPACK, CONTAINERS.COUNTER_BROWSE_FIELD, CASH.CRYSTAL_COIN, 1, 200)
- else
- print("Warning: Player changed cash amount.")
- MoveCash(CONTAINERS.MAIN_BACKPACK, CONTAINERS.COUNTER_BROWSE_FIELD, CASH.PLATINUM_COIN, 100, 200)
- return false
- end
- else
- return false
- end
- end
- end
- end
- if (CONTAINERS.LOCKER_BROWSE_FIELD ~= nil) then
- for itemLocker = 0, CONTAINERS.LOCKER_BROWSE_FIELD:ItemCount() - 1 do
- local tempItemLocker = CONTAINERS.LOCKER_BROWSE_FIELD:GetItemData(itemLocker)
- if not table.contains(LOCKER_ID, tempItemLocker.id) then
- if not table.contains(DICE_ID, tempItemLocker.id) then
- if not table.contains(CASH_ID, tempItemLocker.id) then
- if (DECORATION_ITEM_ID > 0) then
- if not (DECORATION_ITEM_ID == tempItemLocker.id) then
- print("Throw: "..tempItemLocker.count.." "..Item.GetName(tempItemLocker.id).." - Locker >> Dustbin")
- CONTAINERS.LOCKER_BROWSE_FIELD:MoveItemToGround(itemLocker, DUSTBIN.X, DUSTBIN.Y, DUSTBIN.Z, tempItemLocker.count) -- dustbin
- end
- end
- else
- MoveCash(CONTAINERS.LOCKER_BROWSE_FIELD, CONTAINERS.CRYSTAL_COINS_BACKPACK, CASH.CRYSTAL_COIN, 100, 500)
- MoveCash(CONTAINERS.LOCKER_BROWSE_FIELD, CONTAINERS.PLATINUM_COINS_BACKPACK, CASH.PLATINUM_COIN, 100, 500)
- end
- end
- end
- end
- end
- end)
- if (RESTACK_ITEMS) then
- Module.New('DICE_SCRIPT_PROJECT: RE-STACK_ITEMS', function(moduleObject)
- if (LOADING_COMPLETE) then
- if(CONTAINERS.PLATINUM_COINS_BACKPACK:ItemCount() >= 2) then
- for itemPlatinumCoin = CONTAINERS.PLATINUM_COINS_BACKPACK:ItemCount() - 1, 0, -1 do
- if not (itemPlatinumCoin == 0) then
- local item_temp = CONTAINERS.PLATINUM_COINS_BACKPACK:GetItemData(itemPlatinumCoin)
- local item_prev_temp = CONTAINERS.PLATINUM_COINS_BACKPACK:GetItemData(itemPlatinumCoin-1)
- if(item_temp.count < item_prev_temp.count) then
- CONTAINERS.PLATINUM_COINS_BACKPACK:MoveItemToContainer(itemPlatinumCoin, CONTAINERS.PLATINUM_COINS_BACKPACK:Index(), 0)
- print("Restack Items: Moving "..item_temp.count.." platinum coins to beginning of the stack.")
- end
- end
- end
- end
- if(CONTAINERS.CRYSTAL_COINS_BACKPACK:ItemCount() >= 2) then
- for itemCrystalCoin = CONTAINERS.CRYSTAL_COINS_BACKPACK:ItemCount() - 1, 0, -1 do
- if not (itemCrystalCoin == 0) then
- local item_temp = CONTAINERS.CRYSTAL_COINS_BACKPACK:GetItemData(itemCrystalCoin)
- local item_prev_temp = CONTAINERS.CRYSTAL_COINS_BACKPACK:GetItemData(itemCrystalCoin-1)
- if(item_temp.count < item_prev_temp.count) then
- CONTAINERS.CRYSTAL_COINS_BACKPACK:MoveItemToContainer(itemCrystalCoin, CONTAINERS.CRYSTAL_COINS_BACKPACK:Index(), 0)
- print("Restack Items: Moving "..item_temp.count.." crystal coins to beginning of the stack.")
- end
- end
- end
- end
- moduleObject:Delay(200 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- end
- end)
- end
- Module.New('DICE_SCRIPT_PROJECT: TURN-PLAYER', function(moduleObject)
- if (LOADING_COMPLETE) then
- local Potential_Gambler_Detected = false
- local posx = Self.Position().x
- local posy = Self.Position().y
- local lookDirection = Self.LookDirection()
- for name, creature in Creature.iPlayers(2) do
- if (creature:Position().x == PLAYER.SPOT.X and
- creature:Position().y == PLAYER.SPOT.Y and
- creature:Position().z == PLAYER.SPOT.Z) then
- Potential_Gambler_Detected = true
- break
- end
- end
- if (Potential_Gambler_Detected) then
- if (PLAYER.SPOT.X < posx) then
- if (lookDirection ~= WEST) then
- Self.Turn(WEST)
- end
- elseif (PLAYER.SPOT.X > posx) then
- if (lookDirection ~= EAST) then
- Self.Turn(EAST)
- end
- else
- if (PLAYER.SPOT.Y < posy) then
- if (lookDirection ~= NORTH) then
- Self.Turn(NORTH)
- end
- elseif (PLAYER.SPOT.Y > posy) then
- if (lookDirection ~= SOUTH) then
- Self.Turn(SOUTH)
- end
- else
- print("Error: Self character is the potential gambler.")
- end
- end
- else
- if (LOCKER.X < posx) then
- if (lookDirection ~= EAST) then
- Self.Turn(EAST)
- end
- elseif (LOCKER.X > posx) then
- if (lookDirection ~= WEST) then
- Self.Turn(WEST)
- end
- else
- if (LOCKER.Y < posy) then
- if (lookDirection ~= SOUTH) then
- Self.Turn(SOUTH)
- end
- elseif (LOCKER.Y > posy) then
- if (lookDirection ~= NORTH) then
- Self.Turn(NORTH)
- end
- else
- print("Error: Self character is above locker.")
- end
- end
- end
- moduleObject:Delay(1000)
- end
- end)
- Module.New('DICE_SCRIPT_PROJECT: MAIN_MODULE', function(moduleObject)
- local DP_IDS = {3497, 3498, 3499, 3500}
- local DP_POSITIONS = {}
- Client.HideEquipment()
- while #Container.GetAll() ~= 6 do
- LOADING_COMPLETE = false
- if (ReachGlowingSwitch()) then
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION, 300 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- UpdateSystemCoordinates()
- for i = 0, 15 do
- closeContainer(i)
- end
- if Self.BrowseField(COUNTER.X, COUNTER.Y, COUNTER.Z) == 1 then
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- CONTAINERS.COUNTER_BROWSE_FIELD = Container.New(0)
- end
- if Self.BrowseField(LOCKER.X, LOCKER.Y, LOCKER.Z) == 1 then
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- CONTAINERS.LOCKER_BROWSE_FIELD = Container.New(1)
- end
- --Self.OpenMainBackpack(false)
- Self.OpenDepot()
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- Container.New(2):OpenChildren("Purple Backpack")
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- CONTAINERS.MAIN_BACKPACK = Container.New(3)
- Container.New(3):OpenChildren({DICE_SCRIPT_PROJECT.CRYSTAL_COINS_BACKPACK, false})
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- CONTAINERS.CRYSTAL_COINS_BACKPACK = Container.New(4)
- Container.New(3):OpenChildren({DICE_SCRIPT_PROJECT.PLATINUM_COINS_BACKPACK, false})
- wait(100 + DICE_SCRIPT_PROJECT.PING_COMPENSATION)
- CONTAINERS.PLATINUM_COINS_BACKPACK = Container.New(5)
- CheckDiceAndDecoration()
- end
- end
- CONTAINERS.COUNTER_BROWSE_FIELD = Container.New(0)
- CONTAINERS.LOCKER_BROWSE_FIELD = Container.New(1)
- CONTAINERS.DEPOTLOCK = Container.New(2)
- CONTAINERS.MAIN_BACKPACK = Container.New(3)
- CONTAINERS.CRYSTAL_COINS_BACKPACK = Container.New(4)
- CONTAINERS.PLATINUM_COINS_BACKPACK = Container.New(5)
- CheckDiceAndDecoration()
- LOADING_COMPLETE = true
- end)
- LocalSpeechProxy.OnReceive("LocalSpeech", LocalSpeech)
- EffectMessageProxy.OnReceive("EffectMessage", EffectMessage)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement