· 6 years ago · Jul 28, 2019, 07:38 AM
1--[[Global variables--]]
2convertingPlayerColor = ''
3lastCollectTime = 0
4quickConvertPlayerChips = false
5quickConvertPlayerTime = nil
6quickConvertPlayersPlayer = nil
7quickConvertPlayersObject = nil
8createSidepotPl = nil
9createSidepotOb = nil
10convertfailcountlimit = 50 -- when bets are converted to pot, the number of failed attempts allowed before it falls back to move bets (it makes one attempt every two frames)
11sidepotfailcountlimit = 50 --
12sidepotfailcount = 0
13splitPotPlayers = 0 -- Numbers of Players where the split pot should be created
14splitPotZone = {} -- Contains the Zone for splitpotaction
15splitPotObject = {}
16
17--[[ Customizable variables --]]
18options = {
19
20 ["dealdelay1"] = 0.1, -- delay (in seconds) used when dealing players their hands
21 ["dealdelay2"] = 0.4, -- delay (in seconds) used when dealing community cards
22 ["blindsskipafk"] = false, -- If false, afk players still pay blindss when it's their time. Change to true if you want blinds to skip afk players.
23 ["actiontoggle"] = true, -- toggle whether the game displays actiontext. set this to false if you want to have it off by default
24 ["playerclickaction"] = true, -- toggle whether action button stays in place (false) or moves from player to player (true)
25 ["gamemode"] = 'texas', -- Game mode (currently supports Texas Hold'em ('texas'), Pineapple ('pineapple'), and Omaha Hold'em ('omaha'))
26 ["collectmethod"] = 'move', -- method used by collect bets. options: 'move': moves bets; 'convert': converts bets up, 'hybrid': starts with move, changes to convert when pot>hybridthreshold
27 ["hybridthreshold"] = 10000, -- used with hybrid collection, the point above which collection switches from move to convert
28 ["convertstackheight"] = 1, -- contains the height of the stacks for the convert method
29 ["enforcedoubleraise"] = true, -- if true, does not let a player pass action if their raise is less than double the current bet and they are not all in.
30 ["enforcepotlimit"] = false, -- if true, does not let a player pass action if they bet too much for pot limit. the bet limit is calculated as: pot + currentbet + (currentbet - action player's bet)
31 ["enforcedfoldinturn"] = false, -- if true, players may not use the fold hand buttons to fold out of turn
32 ["clocktime"] = 30,
33 ["autoclock"] = false,
34 ["autofold"] = false,
35 ["autoclocktime"] = 10,
36 ["clockpausebutton"] = false,
37 ["currencies"] = 'default_10', -- contains the index of different currencies
38 ["stacklayout"] = 'default_10', -- contains the index of different currencies template
39 ["chatoptions"] =
40 {
41 ["actionmessage"] = true, -- print "Action on player" message in chat
42 ["actionbroadcast"] = true, -- broadcast "Action on you!" to the current player
43 ["currentbetmessage"] = true, -- broadcast when the current bet changes
44 ["better"] = true, -- include the player who made or raised in the above message
45 ["potmessage"] = 2, -- 0 = never, 1 = on collect bets only, 2 = any time it changes as well as on collection
46 ["allinbroadcast"] = true, -- broadcast when a player is all in
47 ["stage"] = true -- flop, turn, river broadcasts
48 },
49
50 ["displayplayerbet"] = true, --
51 ["displayplayermoney"] = true,
52 ["playerbuttons"] =
53 {
54 ["sortchips"] = true,
55 ["convert"] = true,
56 ["allin"] = true,
57 ["afk"] = true,
58 ["loadsavebag"] = false,
59 },
60 ["changemachine"] = true,
61}
62--[[starteramount = 10000
63autosaveandload = true
64chips = {} --]]
65--[[ other variables and tables --]]
66onecard = false -- used when dealing one card from options menu (for determining starting dealer, etc)
67handsshown = {} -- table of hands that have been shown and evaluated by the script this round
68handinprogress = false -- used to prevent change of gamemode during a hand
69convertfailcount = 0
70holedealt = false -- whether or not players have been dealt their hole cards
71holecards = {['White'] = {}, ['Red'] = {}, ['Orange'] = {}, ['Yellow'] = {}, ['Green'] = {}, ['Teal'] = {}, ['Blue'] = {}, ['Purple'] = {}} -- table of players' hole cards, used for hand evaluations
72revealedcards = {['White'] = {}, ['Red'] = {}, ['Orange'] = {}, ['Yellow'] = {}, ['Green'] = {}, ['Teal'] = {}, ['Blue'] = {}, ['Purple'] = {}} -- table of players' hole cards which have been revealed
73dealing = false -- set to true while cards are being dealt to prevent double-clicking
74players = {} -- table of seated players used for dealing cards and actions
75actionon = nil -- Player whose turn it is to act
76playerbets = {} -- Table of players' bets
77currentbet = 0 -- highest bet from the playerbets table
78mainpotchips = {} -- table containing information regarding stacks of chips in the main pot(initialized in initializePot() function)
79printstring = '' -- string referenced by printMessages function to know which messages to print.
80pot = 0 -- total amount in pot (including current players' bets)
81cardtint = 1 -- used anti-grouping measure
82sidepotcalculatet = false -- contains information if sidepot was calculated, stops all actions except dealing
83themeindex = 1
84subthemeindex = 1
85chiptints = {['White'] = {1, 1, 0.99}, ['Red'] = {1, 0.99, 0.99}, ['Orange'] = {0.99, 1, 1}, ['Yellow'] = {0.99, 1, 0.99}, ['Green'] = {0.99, 0.99, 1}, ['Teal'] = {0.99, 0.99, 0.99}, ['Blue'] = {1, 1, 0.98}, ['Purple'] = {1, 0.98, 1}, }
86betzonechiptints = {['White'] = {1, 0.98, 0.98}, ['Red'] = {0.98, 0.98, 0.99}, ['Orange'] = {0.98, 0.98, 0.98}, ['Yellow'] = {1, 1, 0.97}, ['Green'] = {1, 0.97, 1}, ['Teal'] = {1, 0.97, 0.99}, ['Blue'] = {1, 0.97, 0.98}, ['Purple'] = {1, 0.97, 0.97}}
87
88
89
90--[[ Object references and GUIDs --]]
91afkClock = {}
92potsplitter = {}
93actionbutton = {}
94actionbuttonGUID = '08f4c2'
95backtablezones = {}
96backtablezoneGUIDs = {'1904be', 'ee0d04', 'b131a2', 'bb2a9a', 'b9938f', '144824', 'b0eda0', 'a17f45'}
97betzones = {} -- scripting zones for the betting areas for each player. Order must correspond to colors table
98betzoneGUIDs = {'420cfb', '7d419f', '332aa4', '0377d5', '8a2729', 'db2d03', 'b93bb7', 'c43aea'}
99boardobject = {} -- 3d model used for the board
100boardobjectGUID = '48721b'
101boardzone = {} -- scripting zone on the board where community cards are dealt
102boardzoneGUID = '5a1d5c'
103collectbutton = {} -- button to collect bets
104collectbuttonGUID = 'e801e4'
105clock = null
106dealbutton = {} -- button to deal cards
107dealbuttonGUID = '1745d7'
108deck = {} -- deck
109deckGUID = '1b1565' -- the deck's GUID which is saved on the table
110muck = {} -- the muck object that is used to determine where burn cards are dealt
111muckGUID = 'be42ca'
112newdeckbutton = {} -- button to spawn a new deck
113newdeckbuttonGUID = 'ea1c95'
114potobject = {}
115potobjectGUID = '6a79c6'
116resetbutton = {} -- button to reset the game
117resetbuttonGUID = 'c3b0f3'
118sidepotbutton = {}
119sidepotbuttonGUID = 'f1421a'
120tablezones = {}
121tablezoneGUIDs = {'fe7624', 'f33c02', 'a96804', '08e7a3', 'e2ff95', '92c6c4', 'd03a42', 'd1cf88'}
122
123infiniteMoneyBag = {}
124
125
126
127colors = {"White", "Red", "Orange", "Yellow", "Green", "Teal", "Blue", "Purple"} --list of all colors, in order
128fontcolors = {}
129
130for i, v in ipairs (colors) do
131 fontcolors[v] = {}
132end
133
134fontcolors.White.r = 1
135fontcolors.White.g = 1
136fontcolors.White.b = 1
137fontcolors.White.bbcode = '[ffffff]'
138
139fontcolors.Red.r = 0.856
140fontcolors.Red.g = 0.1
141fontcolors.Red.b = 0.094
142fontcolors.Red.bbcode = '[da1918]'
143
144fontcolors.Orange.r = 0.956
145fontcolors.Orange.g = 0.392
146fontcolors.Orange.b = 0.113
147fontcolors.Orange.bbcode = '[f4641d]'
148
149fontcolors.Yellow.r = 0.905
150fontcolors.Yellow.g = 0.898
151fontcolors.Yellow.b = 0.172
152fontcolors.Yellow.bbcode = '[e7e52c]'
153
154fontcolors.Green.r = 0.192
155fontcolors.Green.g = 0.701
156fontcolors.Green.b = 0.168
157fontcolors.Green.bbcode = '[31b32b]'
158
159fontcolors.Teal.r = 0.129
160fontcolors.Teal.g = 0.694
161fontcolors.Teal.b = 0.607
162fontcolors.Teal.bbcode = '[21b19b]'
163
164fontcolors.Blue.r = 0.118
165fontcolors.Blue.g = 0.53
166fontcolors.Blue.b = 1
167fontcolors.Blue.bbcode = '[1f87ff]'
168
169fontcolors.Purple.r = 0.627
170fontcolors.Purple.g = 0.125
171fontcolors.Purple.b = 0.941
172fontcolors.Purple.bbcode = '[a020f0]'
173
174potzones = {}
175mainpotzoneGUID = 'a20d35'
176sidepotzoneGUIDs = {'c9aaae'}
177pottext = {}
178pottextGUID = 'a5130f'
179mainpottext = {}
180mainpottextGUID = '476499'
181bettext = {} -- textes for current player bets
182bettextGUIDs = {'8133a5', '433f14', 'b57079', '86e377', '9d612a', 'da0c91', '8a8de0', '121b10', '75e4c3', 'f7f532'}
183tablezonetext = {}
184
185sidepottext = {} -- textes for current player bets
186sidepottextGUIDs = {}
187currenbettext = {}
188currentbettextGUID = 'ed7b0b'
189colorball = null
190overlay = {}
191overlayGUID = '290051'
192actiontext = {}
193actiontextGUID = '20e11d'
194optionspanel = nil
195optionsbutton = {}
196optionsbuttonGUID = '6e1caf'
197scripts = {} -- Scripts copied from objects in onload, used when 'Reset Objects' is clicked.
198activeplayers = {['White'] = nil, ['Red'] = nil, ['Orange'] = nil, ['Yellow'] = nil, ['Green'] = nil, ['Teal'] = nil, ['Blue'] = nil, ['Purple'] = nil}
199
200savebag = {}
201savebagGUID = '6215eb'
202newsavebagbutton = {}
203newsavebagbuttonGUID = '6aa67a'
204
205saves = {['White'] = nil, ['Red'] = nil, ['Orange'] = nil, ['Yellow'] = nil, ['Green'] = nil, ['Teal'] = nil, ['Blue'] = nil, ['Purple'] = nil}
206
207
208-- Currencies
209currenciesSelection = -- Includes all different type of chips, last entry will be used as dummy entry for unknown chips
210{
211 ['default - $100'] =
212 {
213 {
214 ["value"] = 100000, -- Value of the Chip
215 ["name"] = "$100,000", -- Name of the chip
216 ["label"] = "$100k", -- Label used for converting machine
217 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
218 ["height"] = 0.06,
219 ["custom"] =
220 {
221 ["mesh"] = "http://pastebin.com/raw.php?i=ruZEQex3", -- obj file
222 ["diffuse"] = " http://i.imgur.com/hJIzRFn.jpg", -- diffuse image
223 ["type"] = 5, -- 5 is a 'chip'
224 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
225 },
226 ["params"] =
227 {
228 ["rotation"] = {0, 90, 0}, -- rotation of the object (in relation to the machine) when it spawns
229 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
230 },
231 ["stack"] = "10" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
232 },
233 {
234 ["value"] = 50000, -- Value of the Chip
235 ["name"] = "$50,000", -- Name of the chip
236 ["label"] = "$50k", -- Label used for converting machine
237 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
238 ["height"] = 0.06,
239 ["custom"] =
240 {
241 ["mesh"] = "http://pastebin.com/raw.php?i=ruZEQex3", -- obj file
242 ["diffuse"] = "http://i.imgur.com/m4pRnEa.jpg", -- diffuse image
243 ["type"] = 5, -- 5 is a 'chip'
244 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
245 },
246 ["params"] =
247 {
248 ["rotation"] = {0, 90, 0}, -- rotation of the object (in relation to the machine) when it spawns
249 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
250 },
251 ["stack"] = "9" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
252 },
253 {
254 ["value"] = 25000, -- Value of the Chip
255 ["name"] = "$25,000", -- Name of the chip
256 ["label"] = "$25k", -- Label used for converting machine
257 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
258 ["height"] = 0.06,
259 ["custom"] =
260 {
261 ["mesh"] = "http://pastebin.com/raw.php?i=ruZEQex3", -- obj file
262 ["diffuse"] = "http://i.imgur.com/mIZ9NXm.jpg", -- diffuse image
263 ["type"] = 5, -- 5 is a 'chip'
264 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
265 },
266 ["params"] =
267 {
268 ["rotation"] = {0, 90, 0}, -- rotation of the object (in relation to the machine) when it spawns
269 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
270 },
271 ["stack"] = "8" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
272 },
273
274 {
275 ["value"] = 10000, -- Value of the Chip
276 ["name"] = "$10,000", -- Name of the chip
277 ["label"] = "$10k", -- Label used for converting machine
278 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
279 ["height"] = 0.35,
280 ["custom"] =
281 {
282 ["mesh"] = "http://pastebin.com/raw/QqdA0six", -- obj file
283 ["diffuse"] = "http://i.imgur.com/kp8fFK0.jpg", -- diffuse image
284 ["type"] = 5, -- 5 is a 'chip'
285 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
286 },
287 ["params"] =
288 {
289 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
290 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
291 },
292 ["stack"] = "7" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
293 },
294 {
295 ["value"] = 5000, -- Value of the Chip
296 ["name"] = "$5,000", -- Name of the chip
297 ["label"] = "$5k", -- Label used for converting machine
298 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
299 ["height"] = 0.35,
300 ["custom"] =
301 {
302 ["mesh"] = "http://pastebin.com/raw/QqdA0six", -- obj file
303 ["diffuse"] = "http://i.imgur.com/QQhHmVP.jpg", -- diffuse image
304 ["type"] = 5, -- 5 is a 'chip'
305 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
306 },
307 ["params"] =
308 {
309 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
310 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
311 },
312 ["stack"] = "6" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
313
314 },
315 {
316 ["value"] = 1000, -- Value of the Chip
317 ["name"] = "$1000", -- Name of the chip
318 ["label"] = "$1000", -- Label used for converting machine
319 ["standard"] = true, -- Standard tabletop chips true/false
320 ["height"] = 0.15,
321 ["params"] =
322 {
323 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
324 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
325 },
326 ["stack"] = "3" -- stack where the chips are put in
327 },
328 {
329 ["value"] = 500, -- Value of the Chip
330 ["name"] = "$500", -- Name of the chip
331 ["label"] = "$500", -- Label used for converting machine
332 ["standard"] = true, -- Standard tabletop chips true/false
333 ["height"] = 0.15,
334 ["params"] =
335 {
336 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
337 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
338 },
339 ["stack"] = "2" -- stack where the chips are put in
340 },
341 {
342 ["value"] = 100, -- Value of the Chip
343 ["name"] = "$100", -- Name of the chip
344 ["label"] = "$100", -- Label used for converting machine
345 ["standard"] = true, -- Standard tabletop chips true/false
346 ["height"] = 0.15,
347 ["params"] =
348 {
349 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
350 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
351 },
352 ["stack"] = "1" -- stack where the chips are put in
353 }
354 , -- dummy for unknown chips
355 {
356 ["value"] = -1, -- Value of the Chip
357 ["name"] = "unknown", -- Name of the chip
358 ["standard"] = false, -- Standard tabletop chips true/false
359 ["label"] = "dummy", -- Label used for converting machine
360 ["height"] = 0.3,
361 ["params"] =
362 {
363 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
364 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
365 },
366 ["stack"] = "10" -- stack where the chips are put in
367 }
368 },
369
370 ['default - $10'] =
371 {
372 {
373 ["value"] = 100000, -- Value of the Chip
374 ["name"] = "$100,000", -- Name of the chip
375 ["label"] = "$100k", -- Label used for converting machine
376 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
377 ["height"] = 0.05,
378 ["custom"] =
379 {
380 ["mesh"] = "http://pastebin.com/raw.php?i=ruZEQex3", -- obj file
381 ["diffuse"] = "http://i.imgur.com/hJIzRFn.jpg", -- diffuse image
382 ["type"] = 5, -- 5 is a 'chip'
383 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
384 },
385 ["params"] =
386 {
387 ["rotation"] = {0, 90, 0}, -- rotation of the object (in relation to the machine) when it spawns
388 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
389 },
390 ["stack"] = "9" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
391 },
392 {
393 ["value"] = 50000, -- Value of the Chip
394 ["name"] = "$50,000", -- Name of the chip
395 ["label"] = "$50k", -- Label used for converting machine
396 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
397 ["height"] = 0.05,
398 ["custom"] =
399 {
400 ["mesh"] = "http://pastebin.com/raw.php?i=ruZEQex3", -- obj file
401 ["diffuse"] = "http://i.imgur.com/m4pRnEa.jpg", -- diffuse image
402 ["type"] = 5, -- 5 is a 'chip'
403 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
404 },
405 ["params"] =
406 {
407 ["rotation"] = {0, 90, 0}, -- rotation of the object (in relation to the machine) when it spawns
408 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
409 },
410 ["stack"] = "8" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
411 },
412 {
413 ["value"] = 10000, -- Value of the Chip
414 ["name"] = "$10,000", -- Name of the chip
415 ["label"] = "$10k", -- Label used for converting machine
416 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
417 ["height"] = 0.35,
418 ["custom"] =
419 {
420 ["mesh"] = "http://pastebin.com/raw/QqdA0six", -- obj file
421 ["diffuse"] = "http://i.imgur.com/kp8fFK0.jpg", -- diffuse image
422 ["type"] = 5, -- 5 is a 'chip'
423 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
424 },
425 ["params"] =
426 {
427 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
428 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
429 },
430 ["stack"] = "7" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
431 },
432 {
433 ["value"] = 5000, -- Value of the Chip
434 ["name"] = "$5,000", -- Name of the chip
435 ["label"] = "$5k", -- Label used for converting machine
436 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
437 ["height"] = 0.35,
438 ["custom"] =
439 {
440 ["mesh"] = "http://pastebin.com/raw/QqdA0six", -- obj file
441 ["diffuse"] = "http://i.imgur.com/QQhHmVP.jpg", -- diffuse image
442 ["type"] = 5, -- 5 is a 'chip'
443 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
444 },
445 ["params"] =
446 {
447 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
448 ["scale"] = {0.75, 0.75, 0.75} -- the scale at which to spawn the object
449 },
450 ["stack"] = "6" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
451
452 },
453 {
454 ["value"] = 1000, -- Value of the Chip
455 ["name"] = "$1000", -- Name of the chip
456 ["label"] = "$1000", -- Label used for converting machine
457 ["standard"] = true, -- Standard tabletop chips true/false
458 ["height"] = 0.15,
459 ["params"] =
460 {
461 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
462 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
463 },
464 ["stack"] = "5" -- stack where the chips are put in
465 },
466 {
467 ["value"] = 500, -- Value of the Chip
468 ["name"] = "$500", -- Name of the chip
469 ["label"] = "$500", -- Label used for converting machine
470 ["standard"] = true, -- Standard tabletop chips true/false
471 ["height"] = 0.15,
472 ["params"] =
473 {
474 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
475 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
476 },
477 ["stack"] = "4" -- stack where the chips are put in
478 },
479 {
480 ["value"] = 100, -- Value of the Chip
481 ["name"] = "$100", -- Name of the chip
482 ["label"] = "$100", -- Label used for converting machine
483 ["standard"] = true, -- Standard tabletop chips true/false
484 ["height"] = 0.15,
485 ["params"] =
486 {
487 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
488 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
489 },
490 ["stack"] = "3" -- stack where the chips are put in
491 },
492 {
493 ["value"] = 50, -- Value of the Chip
494 ["name"] = "$50", -- Name of the chip
495 ["label"] = "$50", -- Label used for converting machine
496 ["standard"] = true, -- Standard tabletop chips true/false
497 ["height"] = 0.15,
498 ["params"] =
499 {
500 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
501 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
502 },
503 ["stack"] = "2" -- stack where the chips are put in
504 },
505 {
506 ["value"] = 10, -- Value of the Chip
507 ["name"] = "$10", -- Name of the chip
508 ["label"] = "$10", -- Label used for converting machine
509 ["standard"] = true, -- Standard tabletop chips true/false
510 ["height"] = 0.15,
511 ["params"] =
512 {
513 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
514 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
515 },
516 ["stack"] = "1" -- stack where the chips are put in
517 }
518 , -- dummy for unknown chips
519 {
520 ["value"] = -1, -- Value of the Chip
521 ["name"] = "unknown", -- Name of the chip
522 ["standard"] = false, -- Standard tabletop chips true/false
523 ["label"] = "dummy", -- Label used for converting machine
524 ["height"] = 0.3,
525 ["params"] =
526 {
527 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
528 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
529 },
530 ["stack"] = "10" -- stack where the chips are put in
531 }
532 },
533
534 ['World Series Of Poker - $500'] =
535 {
536 {
537 ["value"] = 1000000, -- Value of the Chip
538 ["name"] = "$1,000,000", -- Name of the chip
539 ["label"] = "$1m", -- Label used for converting machine
540 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
541 ["height"] = 0.15,
542 ["custom"] =
543 {
544 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
545 ["diffuse"] = "http://i.imgur.com/CJC9YS9.jpg", -- diffuse image
546 ["type"] = 5, -- 5 is a 'chip'
547 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
548 },
549 ["params"] =
550 {
551 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
552 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
553 },
554 ["stack"] = "11" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
555 },
556 {
557 ["value"] = 500000, -- Value of the Chip
558 ["name"] = "$500,000", -- Name of the chip
559 ["label"] = "$500k", -- Label used for converting machine
560 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
561 ["height"] = 0.15,
562 ["custom"] =
563 {
564 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
565 ["diffuse"] = "http://i.imgur.com/i28Myqn.jpg", -- diffuse image
566 ["type"] = 5, -- 5 is a 'chip'
567 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
568 },
569 ["params"] =
570 {
571 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
572 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
573 },
574 ["stack"] = "10" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
575 },
576 {
577 ["value"] = 250000, -- Value of the Chip
578 ["name"] = "$250,000", -- Name of the chip
579 ["label"] = "$250k", -- Label used for converting machine
580 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
581 ["height"] = 0.15,
582 ["custom"] =
583 {
584 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
585 ["diffuse"] = "http://i.imgur.com/LHrlLDb.jpg", -- diffuse image
586 ["type"] = 5, -- 5 is a 'chip'
587 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
588 },
589 ["params"] =
590 {
591 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
592 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
593 },
594 ["stack"] = "9" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
595 },
596 {
597 ["value"] = 100000, -- Value of the Chip
598 ["name"] = "$100,000", -- Name of the chip
599 ["label"] = "$100k", -- Label used for converting machine
600 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
601 ["height"] = 0.15,
602 ["custom"] =
603 {
604 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
605 ["diffuse"] = "http://i.imgur.com/E9gcjqL.jpg", -- diffuse image
606 ["type"] = 5, -- 5 is a 'chip'
607 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
608 },
609 ["params"] =
610 {
611 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
612 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
613 },
614 ["stack"] = "8" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
615 },
616 {
617 ["value"] = 50000, -- Value of the Chip
618 ["name"] = "$50,000", -- Name of the chip
619 ["label"] = "$50k", -- Label used for converting machine
620 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
621 ["height"] = 0.15,
622 ["custom"] =
623 {
624 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
625 ["diffuse"] = "http://i.imgur.com/kiUBfn5.jpg", -- diffuse image
626 ["type"] = 5, -- 5 is a 'chip'
627 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
628 },
629 ["params"] =
630 {
631 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
632 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
633 },
634 ["stack"] = "7" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
635 }
636 ,
637 {
638 ["value"] = 25000, -- Value of the Chip
639 ["name"] = "$25,000", -- Name of the chip
640 ["label"] = "$25k", -- Label used for converting machine
641 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
642 ["height"] = 0.15,
643 ["custom"] =
644 {
645 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
646 ["diffuse"] = "http://i.imgur.com/4R6mQkk.jpg", -- diffuse image
647 ["type"] = 5, -- 5 is a 'chip'
648 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
649 },
650 ["params"] =
651 {
652 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
653 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
654 },
655 ["stack"] = "6" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
656 },
657 {
658 ["value"] = 10000, -- Value of the Chip
659 ["name"] = "$10,000", -- Name of the chip
660 ["label"] = "$10k", -- Label used for converting machine
661 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
662 ["height"] = 0.15,
663 ["custom"] =
664 {
665 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
666 ["diffuse"] = "http://i.imgur.com/oVDeVyt.jpg", -- diffuse image
667 ["type"] = 5, -- 5 is a 'chip'
668 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
669 },
670 ["params"] =
671 {
672 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
673 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
674 },
675 ["stack"] = "5" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
676 },
677
678 {
679 ["value"] = 5000, -- Value of the Chip
680 ["name"] = "$5,000", -- Name of the chip
681 ["label"] = "$5000", -- Label used for converting machine
682 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
683 ["height"] = 0.15,
684 ["custom"] =
685 {
686 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
687 ["diffuse"] = "http://i.imgur.com/g5ss9fH.jpg", -- diffuse image
688 ["type"] = 5, -- 5 is a 'chip'
689 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
690 },
691 ["params"] =
692 {
693 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
694 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
695 },
696 ["stack"] = "4" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
697 },
698
699 {
700 ["value"] = 2500, -- Value of the Chip
701 ["name"] = "$2,500", -- Name of the chip
702 ["label"] = "$2500", -- Label used for converting machine
703 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
704 ["height"] = 0.15,
705 ["custom"] =
706 {
707 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
708 ["diffuse"] = "http://i.imgur.com/noppTnL.png", -- diffuse image
709 ["type"] = 5, -- 5 is a 'chip'
710 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
711 },
712 ["params"] =
713 {
714 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
715 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
716 },
717 ["stack"] = "3" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
718 },
719 {
720 ["value"] = 1000, -- Value of the Chip
721 ["name"] = "$1,000", -- Name of the chip
722 ["label"] = "$1000", -- Label used for converting machine
723 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
724 ["height"] = 0.15,
725 ["custom"] =
726 {
727 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
728 ["diffuse"] = "http://i.imgur.com/IEAM8Fh.jpg", -- diffuse image
729 ["type"] = 5, -- 5 is a 'chip'
730 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
731 },
732 ["params"] =
733 {
734 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
735 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
736 },
737 ["stack"] = "2" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
738 },
739 {
740 ["value"] = 500, -- Value of the Chip
741 ["name"] = "$500", -- Name of the chip
742 ["label"] = "$500", -- Label used for converting machine
743 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
744 ["height"] = 0.15,
745 ["custom"] =
746 {
747 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
748 ["diffuse"] = "http://i.imgur.com/nOxPst2.jpg", -- diffuse image
749 ["type"] = 5, -- 5 is a 'chip'
750 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
751 },
752 ["params"] =
753 {
754 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
755 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
756 },
757 ["stack"] = "1" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
758 },
759 -- dummy for unknown chips
760 {
761 ["value"] = -1, -- Value of the Chip
762 ["name"] = "unknown", -- Name of the chip
763 ["standard"] = false, -- Standard tabletop chips true/false
764 ["label"] = "dummy", -- Label used for converting machine
765 ["height"] = 0.3,
766 ["params"] =
767 {
768 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
769 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
770 },
771 ["stack"] = "13" -- stack where the chips are put in
772 }
773 },
774
775 ['World Series Of Poker - $100'] =
776 {
777 {
778 ["value"] = 1000000, -- Value of the Chip
779 ["name"] = "$1,000,000", -- Name of the chip
780 ["label"] = "$1m", -- Label used for converting machine
781 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
782 ["height"] = 0.15,
783 ["custom"] =
784 {
785 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
786 ["diffuse"] = "http://i.imgur.com/CJC9YS9.jpg", -- diffuse image
787 ["type"] = 5, -- 5 is a 'chip'
788 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
789 },
790 ["params"] =
791 {
792 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
793 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
794 },
795 ["stack"] = "12" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
796 },
797 {
798 ["value"] = 500000, -- Value of the Chip
799 ["name"] = "$500,000", -- Name of the chip
800 ["label"] = "$500k", -- Label used for converting machine
801 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
802 ["height"] = 0.15,
803 ["custom"] =
804 {
805 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
806 ["diffuse"] = "http://i.imgur.com/i28Myqn.jpg", -- diffuse image
807 ["type"] = 5, -- 5 is a 'chip'
808 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
809 },
810 ["params"] =
811 {
812 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
813 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
814 },
815 ["stack"] = "11" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
816 },
817 {
818 ["value"] = 250000, -- Value of the Chip
819 ["name"] = "$250,000", -- Name of the chip
820 ["label"] = "$250k", -- Label used for converting machine
821 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
822 ["height"] = 0.15,
823 ["custom"] =
824 {
825 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
826 ["diffuse"] = "http://i.imgur.com/LHrlLDb.jpg", -- diffuse image
827 ["type"] = 5, -- 5 is a 'chip'
828 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
829 },
830 ["params"] =
831 {
832 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
833 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
834 },
835 ["stack"] = "10" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
836 },
837 {
838 ["value"] = 100000, -- Value of the Chip
839 ["name"] = "$100,000", -- Name of the chip
840 ["label"] = "$100k", -- Label used for converting machine
841 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
842 ["height"] = 0.15,
843 ["custom"] =
844 {
845 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
846 ["diffuse"] = "http://i.imgur.com/E9gcjqL.jpg", -- diffuse image
847 ["type"] = 5, -- 5 is a 'chip'
848 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
849 },
850 ["params"] =
851 {
852 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
853 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
854 },
855 ["stack"] = "9" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
856 },
857 {
858 ["value"] = 50000, -- Value of the Chip
859 ["name"] = "$50,000", -- Name of the chip
860 ["label"] = "$50k", -- Label used for converting machine
861 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
862 ["height"] = 0.15,
863 ["custom"] =
864 {
865 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
866 ["diffuse"] = "http://i.imgur.com/kiUBfn5.jpg", -- diffuse image
867 ["type"] = 5, -- 5 is a 'chip'
868 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
869 },
870 ["params"] =
871 {
872 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
873 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
874 },
875 ["stack"] = "8" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
876 }
877 ,
878 {
879 ["value"] = 25000, -- Value of the Chip
880 ["name"] = "$25,000", -- Name of the chip
881 ["label"] = "$25k", -- Label used for converting machine
882 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
883 ["height"] = 0.15,
884 ["custom"] =
885 {
886 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
887 ["diffuse"] = "http://i.imgur.com/4R6mQkk.jpg", -- diffuse image
888 ["type"] = 5, -- 5 is a 'chip'
889 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
890 },
891 ["params"] =
892 {
893 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
894 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
895 },
896 ["stack"] = "7" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
897 },
898 {
899 ["value"] = 10000, -- Value of the Chip
900 ["name"] = "$10,000", -- Name of the chip
901 ["label"] = "$10k", -- Label used for converting machine
902 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
903 ["height"] = 0.15,
904 ["custom"] =
905 {
906 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
907 ["diffuse"] = "http://i.imgur.com/oVDeVyt.jpg", -- diffuse image
908 ["type"] = 5, -- 5 is a 'chip'
909 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
910 },
911 ["params"] =
912 {
913 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
914 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
915 },
916 ["stack"] = "6" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
917 },
918
919 {
920 ["value"] = 5000, -- Value of the Chip
921 ["name"] = "$5,000", -- Name of the chip
922 ["label"] = "$5000", -- Label used for converting machine
923 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
924 ["height"] = 0.15,
925 ["custom"] =
926 {
927 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
928 ["diffuse"] = "http://i.imgur.com/g5ss9fH.jpg", -- diffuse image
929 ["type"] = 5, -- 5 is a 'chip'
930 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
931 },
932 ["params"] =
933 {
934 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
935 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
936 },
937 ["stack"] = "5" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
938 },
939
940 {
941 ["value"] = 2500, -- Value of the Chip
942 ["name"] = "$2,500", -- Name of the chip
943 ["label"] = "$2500", -- Label used for converting machine
944 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
945 ["height"] = 0.15,
946 ["custom"] =
947 {
948 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
949 ["diffuse"] = "http://i.imgur.com/noppTnL.png", -- diffuse image
950 ["type"] = 5, -- 5 is a 'chip'
951 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
952 },
953 ["params"] =
954 {
955 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
956 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
957 },
958 ["stack"] = "4" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
959 },
960 {
961 ["value"] = 1000, -- Value of the Chip
962 ["name"] = "$1,000", -- Name of the chip
963 ["label"] = "$1000", -- Label used for converting machine
964 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
965 ["height"] = 0.15,
966 ["custom"] =
967 {
968 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
969 ["diffuse"] = "http://i.imgur.com/IEAM8Fh.jpg", -- diffuse image
970 ["type"] = 5, -- 5 is a 'chip'
971 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
972 },
973 ["params"] =
974 {
975 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
976 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
977 },
978 ["stack"] = "3" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
979 },
980 {
981 ["value"] = 500, -- Value of the Chip
982 ["name"] = "$500", -- Name of the chip
983 ["label"] = "$500", -- Label used for converting machine
984 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
985 ["height"] = 0.15,
986 ["custom"] =
987 {
988 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
989 ["diffuse"] = "http://i.imgur.com/nOxPst2.jpg", -- diffuse image
990 ["type"] = 5, -- 5 is a 'chip'
991 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
992 },
993 ["params"] =
994 {
995 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
996 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
997 },
998 ["stack"] = "2" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
999 },
1000
1001 {
1002 ["value"] = 100, -- Value of the Chip
1003 ["name"] = "$100", -- Name of the chip
1004 ["label"] = "$100", -- Label used for converting machine
1005 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1006 ["height"] = 0.15,
1007 ["custom"] =
1008 {
1009 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1010 ["diffuse"] = "http://i.imgur.com/RHmy71O.jpg", -- diffuse image
1011 ["type"] = 5, -- 5 is a 'chip'
1012 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1013 },
1014 ["params"] =
1015 {
1016 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1017 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1018 },
1019 ["stack"] = "1" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1020 }
1021 , -- dummy for unknown chips
1022 {
1023 ["value"] = -1, -- Value of the Chip
1024 ["name"] = "unknown", -- Name of the chip
1025 ["standard"] = false, -- Standard tabletop chips true/false
1026 ["label"] = "dummy", -- Label used for converting machine
1027 ["height"] = 0.3,
1028 ["params"] =
1029 {
1030 ["rotation"] = {0, 270, 0}, -- rotation of the object (in relation to the machine) when it spawns
1031 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1032 },
1033 ["stack"] = "13" -- stack where the chips are put in
1034 }
1035 },
1036
1037 ['World Series Of Poker - $25'] =
1038 {
1039 {
1040 ["value"] = 1000000, -- Value of the Chip
1041 ["name"] = "$1,000,000", -- Name of the chip
1042 ["label"] = "$1m", -- Label used for converting machine
1043 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1044 ["height"] = 0.15,
1045 ["custom"] =
1046 {
1047 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1048 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251589333/F3948480F24EC395F03137E12A5FCF3F0BAF85B9/", -- diffuse image
1049 ["type"] = 5, -- 5 is a 'chip'
1050 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1051 },
1052 ["params"] =
1053 {
1054 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1055 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1056 },
1057 ["stack"] = "14" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1058 },
1059 {
1060 ["value"] = 500000, -- Value of the Chip
1061 ["name"] = "$500,000", -- Name of the chip
1062 ["label"] = "$500k", -- Label used for converting machine
1063 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1064 ["height"] = 0.15,
1065 ["custom"] =
1066 {
1067 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1068 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251576106/674BFF69A2E9D7B405B24510A9D513EBB7D95FAF/", -- diffuse image
1069 ["type"] = 5, -- 5 is a 'chip'
1070 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1071 },
1072 ["params"] =
1073 {
1074 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1075 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1076 },
1077 ["stack"] = "13" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1078 },
1079 {
1080 ["value"] = 250000, -- Value of the Chip
1081 ["name"] = "$250,000", -- Name of the chip
1082 ["label"] = "$250k", -- Label used for converting machine
1083 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1084 ["height"] = 0.15,
1085 ["custom"] =
1086 {
1087 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1088 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251587547/E91D448FDD860E1ABB6FFBF3766D0316689D1F91/", -- diffuse image
1089 ["type"] = 5, -- 5 is a 'chip'
1090 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1091 },
1092 ["params"] =
1093 {
1094 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1095 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1096 },
1097 ["stack"] = "12" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1098 },
1099 {
1100 ["value"] = 100000, -- Value of the Chip
1101 ["name"] = "$100,000", -- Name of the chip
1102 ["label"] = "$100k", -- Label used for converting machine
1103 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1104 ["height"] = 0.15,
1105 ["custom"] =
1106 {
1107 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1108 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251572445/4CF1C8B1BB1F58CCC28FFB543AD1736278904276/", -- diffuse image
1109 ["type"] = 5, -- 5 is a 'chip'
1110 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1111 },
1112 ["params"] =
1113 {
1114 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1115 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1116 },
1117 ["stack"] = "11" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1118 },
1119 {
1120 ["value"] = 50000, -- Value of the Chip
1121 ["name"] = "$50,000", -- Name of the chip
1122 ["label"] = "$50k", -- Label used for converting machine
1123 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1124 ["height"] = 0.15,
1125 ["custom"] =
1126 {
1127 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1128 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251571049/C02329E16AB2B958761087240E07AAEC6EDC3138/", -- diffuse image
1129 ["type"] = 5, -- 5 is a 'chip'
1130 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1131 },
1132 ["params"] =
1133 {
1134 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1135 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1136 },
1137 ["stack"] = "10" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1138 }
1139 ,
1140 {
1141 ["value"] = 25000, -- Value of the Chip
1142 ["name"] = "$25,000", -- Name of the chip
1143 ["label"] = "$25k", -- Label used for converting machine
1144 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1145 ["height"] = 0.15,
1146 ["custom"] =
1147 {
1148 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1149 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251568935/3327482559710356687AB98ADB39C2192E3BCC7E/", -- diffuse image
1150 ["type"] = 5, -- 5 is a 'chip'
1151 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1152 },
1153 ["params"] =
1154 {
1155 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1156 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1157 },
1158 ["stack"] = "9" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1159 },
1160 {
1161 ["value"] = 10000, -- Value of the Chip
1162 ["name"] = "$10,000", -- Name of the chip
1163 ["label"] = "$10k", -- Label used for converting machine
1164 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1165 ["height"] = 0.15,
1166 ["custom"] =
1167 {
1168 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1169 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251566787/788B1D7B511DE5D0EE842A56FD4F6827C52BC0F3/", -- diffuse image
1170 ["type"] = 5, -- 5 is a 'chip'
1171 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1172 },
1173 ["params"] =
1174 {
1175 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1176 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1177 },
1178 ["stack"] = "8" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1179 },
1180
1181 {
1182 ["value"] = 5000, -- Value of the Chip
1183 ["name"] = "$5,000", -- Name of the chip
1184 ["label"] = "$5000", -- Label used for converting machine
1185 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1186 ["height"] = 0.15,
1187 ["custom"] =
1188 {
1189 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1190 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251565697/37F99F5547E386D08D8E5CEF9F41C583BC82F0E2/", -- diffuse image
1191 ["type"] = 5, -- 5 is a 'chip'
1192 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1193 },
1194 ["params"] =
1195 {
1196 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1197 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1198 },
1199 ["stack"] = "7" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1200 },
1201
1202 {
1203 ["value"] = 2500, -- Value of the Chip
1204 ["name"] = "$2,500", -- Name of the chip
1205 ["label"] = "$2500", -- Label used for converting machine
1206 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1207 ["height"] = 0.15,
1208 ["custom"] =
1209 {
1210 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1211 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251564195/DBDEC6182837943F8BE7D56EA988A9BFBAB0D753/", -- diffuse image
1212 ["type"] = 5, -- 5 is a 'chip'
1213 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1214 },
1215 ["params"] =
1216 {
1217 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1218 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1219 },
1220 ["stack"] = "6" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1221 },
1222 {
1223 ["value"] = 1000, -- Value of the Chip
1224 ["name"] = "$1,000", -- Name of the chip
1225 ["label"] = "$1000", -- Label used for converting machine
1226 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1227 ["height"] = 0.15,
1228 ["custom"] =
1229 {
1230 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1231 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251561748/17844847C51EA05E0145674C0573D721240F21A2/", -- diffuse image
1232 ["type"] = 5, -- 5 is a 'chip'
1233 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1234 },
1235 ["params"] =
1236 {
1237 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1238 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1239 },
1240 ["stack"] = "5" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1241 },
1242 {
1243 ["value"] = 500, -- Value of the Chip
1244 ["name"] = "$500", -- Name of the chip
1245 ["label"] = "$500", -- Label used for converting machine
1246 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1247 ["height"] = 0.15,
1248 ["custom"] =
1249 {
1250 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1251 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241102796536944/B7D5233647A1A9EE37796C556C20F989139B218C/", -- diffuse image
1252 ["type"] = 5, -- 5 is a 'chip'
1253 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1254 },
1255 ["params"] =
1256 {
1257 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1258 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1259 },
1260 ["stack"] = "4" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1261 },
1262
1263 {
1264 ["value"] = 100, -- Value of the Chip
1265 ["name"] = "$100", -- Name of the chip
1266 ["label"] = "$100", -- Label used for converting machine
1267 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1268 ["height"] = 0.15,
1269 ["custom"] =
1270 {
1271 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1272 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251557084/A0067785E5195B9FDF5B91805EB98E9D86BFDC82/", -- diffuse image
1273 ["type"] = 5, -- 5 is a 'chip'
1274 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1275 },
1276 ["params"] =
1277 {
1278 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1279 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1280 },
1281 ["stack"] = "3" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1282 },
1283
1284 {
1285 ["value"] = 50, -- Value of the Chip
1286 ["name"] = "$50", -- Name of the chip
1287 ["label"] = "$50", -- Label used for converting machine
1288 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1289 ["height"] = 0.15,
1290 ["custom"] =
1291 {
1292 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1293 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251553741/5DD49D721A533448CC3B9101B059D14A0C76AB99/", -- diffuse image
1294 ["type"] = 5, -- 5 is a 'chip'
1295 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1296 },
1297 ["params"] =
1298 {
1299 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1300 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1301 },
1302 ["stack"] = "2" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1303 }
1304 ,
1305
1306 {
1307 ["value"] = 25, -- Value of the Chip
1308 ["name"] = "$25", -- Name of the chip
1309 ["label"] = "$25", -- Label used for converting machine
1310 ["standard"] = false, -- Standard tabletop chips (1000, 500, 100, 50, 10)
1311 ["height"] = 0.15,
1312 ["custom"] =
1313 {
1314 ["mesh"] = "https://www.dropbox.com/s/xtrjnjilifnjvsw/Chip.obj?dl=1", -- obj file
1315 ["diffuse"] = "http://cloud-3.steamusercontent.com/ugc/794241183251551729/A2100E2621B410142EC91440D62CF07CEE75A943/", -- diffuse image
1316 ["type"] = 5, -- 5 is a 'chip'
1317 ["material"] = 1 -- 0: plastic, 1: wood, 2: metal, 3: cardboard
1318 },
1319 ["params"] =
1320 {
1321 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1322 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1323 },
1324 ["stack"] = "1" -- spot position for collecting/spawning (potzone and betting zone on sidepot)
1325 }
1326 , -- dummy for unknown chips
1327 {
1328 ["value"] = -1, -- Value of the Chip
1329 ["name"] = "unknown", -- Name of the chip
1330 ["standard"] = false, -- Standard tabletop chips true/false
1331 ["label"] = "dummy", -- Label used for converting machine
1332 ["height"] = 0.3,
1333 ["params"] =
1334 {
1335 ["rotation"] = {0, 0, 0}, -- rotation of the object (in relation to the machine) when it spawns
1336 ["scale"] = {1, 1, 1} -- the scale at which to spawn the object
1337 },
1338 ["stack"] = "15" -- stack where the chips are put in
1339 }
1340 },
1341}
1342
1343
1344
1345
1346stacklayout =
1347{
1348 ['5-5-5'] =
1349 {
1350 ["1"] =
1351 {
1352 ["xoffset"] = 3.75,
1353 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1354 ["zoffset"] = -2,
1355 ["height"] = 0, -- height of current stack
1356 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1357 ["y"] = 0,
1358 ["z"] = 0
1359 },
1360 ["2"] =
1361 {
1362 ["xoffset"] = 2,
1363 ["yoffset"] = 0.0825,
1364 ["zoffset"] = -2,
1365 ["height"] = 0,
1366 ["x"] = 0,
1367 ["y"] = 0,
1368 ["z"] = 0
1369 },
1370 ["3"] =
1371 {
1372 ["xoffset"] = 0.25,
1373 ["yoffset"] = 0.0825,
1374 ["zoffset"] = -2,
1375 ["height"] = 0,
1376 ["x"] = 0,
1377 ["y"] = 0,
1378 ["z"] = 0
1379 },
1380 ["4"] =
1381 {
1382 ["xoffset"] = -1.5,
1383 ["yoffset"] = 0.2,
1384 ["zoffset"] = -2,
1385 ["height"] = 0,
1386 ["x"] = 0,
1387 ["y"] = 0,
1388 ["z"] = 0
1389 },
1390 ["5"] =
1391 {
1392 ["xoffset"] = -3.25,
1393 ["yoffset"] = 0.2,
1394 ["zoffset"] = -2,
1395 ["height"] = 0,
1396 ["x"] = 0,
1397 ["y"] = 0,
1398 ["z"] = 0
1399 }
1400 ,
1401 ["6"] =
1402 {
1403 ["xoffset"] = 3.75,
1404 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1405 ["zoffset"] = 0,
1406 ["height"] = 0, -- height of current stack
1407 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1408 ["y"] = 0,
1409 ["z"] = 0
1410 },
1411 ["7"] =
1412 {
1413 ["xoffset"] = 2,
1414 ["yoffset"] = 0.0825,
1415 ["zoffset"] = 0,
1416 ["height"] = 0,
1417 ["x"] = 0,
1418 ["y"] = 0,
1419 ["z"] = 0
1420 },
1421 ["8"] =
1422 {
1423 ["xoffset"] = 0.25,
1424 ["yoffset"] = 0.0825,
1425 ["zoffset"] = 0,
1426 ["height"] = 0,
1427 ["x"] = 0,
1428 ["y"] = 0,
1429 ["z"] = 0
1430 },
1431 ["9"] =
1432 {
1433 ["xoffset"] = -1.5,
1434 ["yoffset"] = 0.2,
1435 ["zoffset"] = 0,
1436 ["height"] = 0,
1437 ["x"] = 0,
1438 ["y"] = 0,
1439 ["z"] = 0
1440 },
1441 ["10"] =
1442 {
1443 ["xoffset"] = -3.25,
1444 ["yoffset"] = 0.2,
1445 ["zoffset"] = 0,
1446 ["height"] = 0,
1447 ["x"] = 0,
1448 ["y"] = 0,
1449 ["z"] = 0
1450 },
1451
1452 ["11"] =
1453 {
1454 ["xoffset"] = 3.75,
1455 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1456 ["zoffset"] = 2,
1457 ["height"] = 0, -- height of current stack
1458 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1459 ["y"] = 0,
1460 ["z"] = 0
1461 },
1462 ["12"] =
1463 {
1464 ["xoffset"] = 2,
1465 ["yoffset"] = 0.0825,
1466 ["zoffset"] = 2,
1467 ["height"] = 0,
1468 ["x"] = 0,
1469 ["y"] = 0,
1470 ["z"] = 0
1471 },
1472 ["13"] =
1473 {
1474 ["xoffset"] = 0.25,
1475 ["yoffset"] = 0.0825,
1476 ["zoffset"] = 2,
1477 ["height"] = 0,
1478 ["x"] = 0,
1479 ["y"] = 0,
1480 ["z"] = 0
1481 },
1482 ["14"] =
1483 {
1484 ["xoffset"] = -1.5,
1485 ["yoffset"] = 0.2,
1486 ["zoffset"] = 2,
1487 ["height"] = 0,
1488 ["x"] = 0,
1489 ["y"] = 0,
1490 ["z"] = 0
1491 },
1492 ["misc"] =
1493 {
1494 ["xoffset"] = -3.25,
1495 ["yoffset"] = 0.2,
1496 ["zoffset"] = 2,
1497 ["height"] = 0,
1498 ["x"] = 0,
1499 ["y"] = 0,
1500 ["z"] = 0
1501 },
1502 },
1503
1504 ['5-2-3'] =
1505 {
1506 ["1"] =
1507 {
1508 ["xoffset"] = 3.75,
1509 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1510 ["zoffset"] = -2,
1511 ["height"] = 0, -- height of current stack
1512 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1513 ["y"] = 0,
1514 ["z"] = 0
1515 },
1516 ["2"] =
1517 {
1518 ["xoffset"] = 2,
1519 ["yoffset"] = 0.0825,
1520 ["zoffset"] = -2,
1521 ["height"] = 0,
1522 ["x"] = 0,
1523 ["y"] = 0,
1524 ["z"] = 0
1525 },
1526 ["3"] =
1527 {
1528 ["xoffset"] = 0.25,
1529 ["yoffset"] = 0.0825,
1530 ["zoffset"] = -2,
1531 ["height"] = 0,
1532 ["x"] = 0,
1533 ["y"] = 0,
1534 ["z"] = 0
1535 },
1536 ["4"] =
1537 {
1538 ["xoffset"] = -1.5,
1539 ["yoffset"] = 0.2,
1540 ["zoffset"] = -2,
1541 ["height"] = 0,
1542 ["x"] = 0,
1543 ["y"] = 0,
1544 ["z"] = 0
1545 },
1546 ["5"] =
1547 {
1548 ["xoffset"] = -3.25,
1549 ["yoffset"] = 0.2,
1550 ["zoffset"] = -2,
1551 ["height"] = 0,
1552 ["x"] = 0,
1553 ["y"] = 0,
1554 ["z"] = 0
1555 }
1556 ,
1557 ["6"] =
1558 {
1559 ["xoffset"] = 2,
1560 ["yoffset"] = 0.2,
1561 ["zoffset"] = 0,
1562 ["height"] = 0,
1563 ["x"] = 0,
1564 ["y"] = 0,
1565 ["z"] = 0
1566 }
1567 ,
1568 ["7"] =
1569 {
1570 ["xoffset"] = -2.5,
1571 ["yoffset"] = 0.2,
1572 ["zoffset"] = 0,
1573 ["height"] = 0,
1574 ["x"] = 0,
1575 ["y"] = 0,
1576 ["z"] = 0
1577 }
1578 ,
1579
1580 ["8"] =
1581 {
1582 ["xoffset"] = 3,
1583 ["yoffset"] = 0.2,
1584 ["zoffset"] = 2,
1585 ["height"] = 0,
1586 ["x"] = 0,
1587 ["y"] = 0,
1588 ["z"] = 0
1589 }
1590 ,
1591 ["misc"] =
1592 {
1593 ["xoffset"] = -3,
1594 ["yoffset"] = 0.2,
1595 ["zoffset"] = 2,
1596 ["height"] = 0,
1597 ["x"] = 0,
1598 ["y"] = 0,
1599 ["z"] = 0
1600 }
1601 ,
1602 },
1603
1604 ['Half Circle'] =
1605 {
1606 ["1"] =
1607 {
1608 ["xoffset"] = 4,
1609 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1610 ["zoffset"] = -2,
1611 ["height"] = 0, -- height of current stack
1612 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1613 ["y"] = 0,
1614 ["z"] = 0
1615 },
1616 ["2"] =
1617 {
1618 ["xoffset"] = 3.58,
1619 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1620 ["zoffset"] = -0.34,
1621 ["height"] = 0, -- height of current stack
1622 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1623 ["y"] = 0,
1624 ["z"] = 0
1625 },
1626 ["3"] =
1627 {
1628 ["xoffset"] = 2.45,
1629 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1630 ["zoffset"] = 1.15,
1631 ["height"] = 0, -- height of current stack
1632 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1633 ["y"] = 0,
1634 ["z"] = 0
1635 },
1636 ["4"] =
1637 {
1638 ["xoffset"] = 0.81,
1639 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1640 ["zoffset"] = 1.89,
1641 ["height"] = 0, -- height of current stack
1642 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1643 ["y"] = 0,
1644 ["z"] = 0
1645 },
1646 ["5"] =
1647 {
1648 ["xoffset"] = -0.81,
1649 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1650 ["zoffset"] = 1.89,
1651 ["height"] = 0, -- height of current stack
1652 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1653 ["y"] = 0,
1654 ["z"] = 0
1655 },
1656 ["6"] =
1657 {
1658 ["xoffset"] = -2.45,
1659 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1660 ["zoffset"] = 1.15,
1661 ["height"] = 0, -- height of current stack
1662 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1663 ["y"] = 0,
1664 ["z"] = 0
1665 },
1666 ["7"] =
1667 {
1668 ["xoffset"] = -3.58,
1669 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1670 ["zoffset"] = -0.34,
1671 ["height"] = 0, -- height of current stack
1672 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1673 ["y"] = 0,
1674 ["z"] = 0
1675 },
1676 ["misc"] =
1677 {
1678 ["xoffset"] = -4,
1679 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1680 ["zoffset"] = -2,
1681 ["height"] = 0, -- height of current stack
1682 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1683 ["y"] = 0,
1684 ["z"] = 0
1685 },
1686 },
1687
1688 -- For Cash Stacks
1689 ['2-2-2'] =
1690 {
1691 ["1"] =
1692 {
1693 ["xoffset"] = 2,
1694 ["yoffset"] = 0.0825, -- half of the object's height to put its bottom on the surface
1695 ["zoffset"] = -2,
1696 ["height"] = 0, -- height of current stack
1697 ["x"] = 0, -- coordinates of stack relative to the spawned objects
1698 ["y"] = 0,
1699 ["z"] = 0
1700 },
1701 ["2"] =
1702 {
1703 ["xoffset"] = -2.5,
1704 ["yoffset"] = 0.0825,
1705 ["zoffset"] = -2,
1706 ["height"] = 0,
1707 ["x"] = 0,
1708 ["y"] = 0,
1709 ["z"] = 0
1710 },
1711 ["3"] =
1712 {
1713 ["xoffset"] = 2,
1714 ["yoffset"] = 0.2,
1715 ["zoffset"] = 0,
1716 ["height"] = 0,
1717 ["x"] = 0,
1718 ["y"] = 0,
1719 ["z"] = 0
1720 }
1721 ,
1722 ["4"] =
1723 {
1724 ["xoffset"] = -2.5,
1725 ["yoffset"] = 0.2,
1726 ["zoffset"] = 0,
1727 ["height"] = 0,
1728 ["x"] = 0,
1729 ["y"] = 0,
1730 ["z"] = 0
1731 }
1732 ,
1733 ["5"] =
1734 {
1735 ["xoffset"] = 2,
1736 ["yoffset"] = 0.2,
1737 ["zoffset"] = 2,
1738 ["height"] = 0,
1739 ["x"] = 0,
1740 ["y"] = 0,
1741 ["z"] = 0
1742 }
1743 ,
1744
1745 ["misc"] =
1746 {
1747 ["xoffset"] = -2.5,
1748 ["yoffset"] = 0.2,
1749 ["zoffset"] = 2,
1750 ["height"] = 0,
1751 ["x"] = 0,
1752 ["y"] = 0,
1753 ["z"] = 0
1754 }
1755 ,
1756 },
1757
1758}
1759
1760currenciesSelectionStacklayout =
1761{
1762 ["default - $100"] = { "5-2-3" },
1763 ["default - $10"] = { "5-2-3" },
1764 ["World Series Of Poker - $500"] = { "5-5-5", "Honeycomb", "Half Circle" },
1765 ["World Series Of Poker - $100"] = { "5-5-5", "Honeycomb", "Half Circle" },
1766 ["World Series Of Poker - $25"] = { "5-5-5", "Honeycomb", "Half Circle" },
1767
1768}
1769
1770currencies = {}
1771
1772--[[ Overlay images --]]
1773themes =
1774{
1775 { -- themeindex 1
1776 ["label"] = 'Poker',
1777 { -- subthemeindex 1
1778 ["label"] = 'Felt',
1779 {
1780 ["label"] = 'Plain Felt',
1781 ["diffuse"] = 'http://i.imgur.com/jPnTE9e.png'
1782 },
1783 {
1784 ["label"] = 'MGM Grant',
1785 ["diffuse"] = 'http://i.imgur.com/phQrMs9.jpg'
1786 }
1787 }
1788 }
1789}
1790
1791--[[ onLoad function --]]
1792
1793function onload(save_state)
1794 local saveddata = JSON.decode(save_state)
1795
1796 --[[ Get object references --]]
1797 boardzone = getObjectFromGUID(boardzoneGUID)
1798 newdeckbutton = getObjectFromGUID(newdeckbuttonGUID)
1799 newsavebagbutton = getObjectFromGUID(newsavebagbuttonGUID)
1800 dealbutton = getObjectFromGUID(dealbuttonGUID)
1801 resetbutton = getObjectFromGUID(resetbuttonGUID)
1802 sidepotbutton = getObjectFromGUID(sidepotbuttonGUID)
1803 muckzone = getObjectFromGUID(muckzoneGUID)
1804 collectbutton = getObjectFromGUID(collectbuttonGUID)
1805
1806 for i, v in ipairs (colors) do
1807 local playerhand = getPlayerHandPositionAndRotation(v)
1808
1809 betzones[v] = getObjectFromGUID(betzoneGUIDs[i])
1810 tablezones[v] = getObjectFromGUID(tablezoneGUIDs[i])
1811 backtablezones[v] = getObjectFromGUID(backtablezoneGUIDs[i])
1812 bettext[v] = getObjectFromGUID(bettextGUIDs[i])
1813 end
1814 potzones[1] = getObjectFromGUID(mainpotzoneGUID)
1815 for i, v in ipairs (sidepotzoneGUIDs) do
1816 potzones[#potzones + 1] = getObjectFromGUID(v)
1817 end
1818 actionbutton = getObjectFromGUID(actionbuttonGUID)
1819 optionsbutton = getObjectFromGUID(optionsbuttonGUID)
1820 sidepotbutton = getObjectFromGUID(sidepotbuttonGUID)
1821 if saveddata == nil then
1822 --[[ Initialize texts --]]
1823 hideActionText()
1824 pottext.setPosition ({0, 1.33, 0})
1825 pottext.setRotation ({90, 180, 0})
1826 currentbettext.setPosition ({0, 1.33, 1})
1827 currentbettext.setRotation({90, 180, 0})
1828 mainpotchips = initializePot()
1829 else
1830 if saveddata.options ~= nil then options = saveddata.options end
1831
1832 if saveddata.holedealt ~= nil then holedealt = saveddata.holedealt end
1833 if saveddata.dealing ~= nil then dealing = saveddata.dealing end
1834 if saveddata.players ~= nil then players = saveddata.players end
1835 if saveddata.actionon ~= nil then actionon = saveddata.actionon end
1836 if saveddata.playerbets ~= nil then playerbets = saveddata.playerbets end
1837 if saveddata.currentbet ~= nil then currentbet = saveddata.currentbet end
1838 if saveddata.mainpotchips ~= nil then mainpotchips = saveddata.mainpotchips end
1839 if saveddata.pot ~= nil then pot = saveddata.pot end
1840 if saveddata.collecting ~= nil then collecting = saveddata.collecting end
1841 if saveddata.collectmethod ~= nil then collectmethod = saveddata.collectmethod end
1842 if saveddata.convertstackheight ~= nil then convertstackheight = saveddata.convertstackheight end
1843 if saveddata.hybridthreshold ~= nil then hybridthreshold = saveddata.hybridthreshold end
1844 if saveddata.handinprogress ~= nil then handinprogress = saveddata.handinprogress end
1845
1846 if saveddata.savebagGUID ~= nil then savebagGUID = saveddata.savebagGUID end
1847 if saveddata.deckGUID ~= nil then deckGUID = saveddata.deckGUID end
1848 if saveddata.muckGUID ~= nil then muckGUID = saveddata.muckGUID end
1849 if saveddata.potobjectGUID ~= nil then potobjectGUID = saveddata.potobjectGUID end
1850 if saveddata.boardobjectGUID ~= nil then boardobjectGUID = saveddata.boardobjectGUID end
1851 if saveddata.overlayGUID ~= nil then overlayGUID = saveddata.overlayGUID end
1852 if saveddata.pottextGUID ~= nil then pottextGUID = saveddata.pottextGUID end
1853 if saveddata.currentbettextGUID ~= nil then currentbettextGUID = saveddata.currentbettextGUID end
1854 if saveddata.actiontextGUID ~= nil then actiontextGUID = saveddata.actiontextGUID end
1855 if saveddata.revealedcards ~= nil then revealedcards = saveddata.revealedcards end
1856 if saveddata.holecards ~= nil then holecards = saveddata.holecards end
1857 if saveddata.handsshown ~= nil then handsshown = saveddata.handsshown end
1858
1859 if saveddata.bettext ~= nil then
1860 bettext = JSON.decode(saveddata.bettext)
1861 if saveddata.bettext ~= nil then
1862 for i, v in ipairs(colors) do
1863 bettext[v] = getObjectFromGUID(bettext[v])
1864 end
1865 end
1866 end
1867 if saveddata.sidepottext ~= nil then
1868 sidepottext = JSON.decode(saveddata.sidepottext)
1869 for i, v in ipairs(colors) do
1870 sidepottext[v] = getObjectFromGUID(sidepottext[v])
1871 end
1872 end
1873 if saveddata.tablezonetext ~= nil then
1874 tablezonetext = JSON.decode(saveddata.tablezonetext)
1875 for i, v in ipairs(colors) do
1876 tablezonetext[v] = getObjectFromGUID(tablezonetext[v])
1877 end
1878 end
1879
1880 end
1881
1882 deck = getObjectFromGUID(deckGUID)
1883 muck = getObjectFromGUID(muckGUID)
1884 boardobject = getObjectFromGUID(boardobjectGUID)
1885 potobject = getObjectFromGUID(potobjectGUID)
1886 pottext = getObjectFromGUID(pottextGUID)
1887 currentbettext = getObjectFromGUID(currentbettextGUID)
1888 actiontext = getObjectFromGUID(actiontextGUID)
1889 savebag = getObjectFromGUID(savebagGUID)
1890 if options.displayplayerbet == nil then
1891 options.displayplayerbet = true
1892 end
1893 if options.displayplayermoney == nil then
1894 options.displayplayermoney = true
1895 end
1896 if options.playerbuttons == nil then
1897 options["playerbuttons"] =
1898 {
1899 ["sortchips"] = true,
1900 ["convert"] = true,
1901 ["allin"] = true,
1902 ["afk"] = true,
1903 ["loadsavebag"] = false
1904 }
1905 end
1906 if options.playerbuttons == nil then
1907 options.playerbuttons = {}
1908 end
1909 if options.playerbuttons.sortchips == nil then
1910 options.playerbuttons.sortchips = true
1911 end
1912 if options.playerbuttons.convert == nil then
1913 options.playerbuttons.convert = true
1914 end
1915 if options.playerbuttons.allin == nil then
1916 options.playerbuttons.allin = true
1917 end
1918 if options.playerbuttons.afk == nil then
1919 options.playerbuttons.afk = true
1920 end
1921 if options.playerbuttons.loadsavebag == nil then
1922 options.playerbuttons.loadsavebag = false
1923 end
1924
1925 if options.autoclocktime == nil then
1926 options.autoclocktime = 5
1927 options.autoclock = false
1928 options.autofold = false
1929 options.clockpausebutton = true
1930 end
1931 if options.convertstackheight == nil then
1932 options.convertstackheight = 0
1933 end
1934 if options.currencies == nil or options.stacklayout == nil then
1935 options.currencies = "default"
1936 options.stacklayout = "default"
1937 currencies = currenciesSelection[options.currencies]
1938 else
1939 currencies = currenciesSelection[options.currencies]
1940
1941 if currencies == nil then
1942 options.currencies = "default"
1943 options.stacklayout = "default"
1944 currencies = currenciesSelection[options.currencies]
1945 end
1946 end
1947
1948
1949
1950 --[[ Create buttons --]]
1951 local button = {}
1952
1953 --[[ use this button to assign a new deck --]]
1954 button.label = 'New\nDeck'
1955 button.click_function = "newDeck"
1956 button.function_owner = nil
1957 button.position = {0, 0.08, 0}
1958 button.rotation = {0, 180, 0}
1959 button.width = 525
1960 button.height = 525
1961 button.font_size = 150
1962 newdeckbutton.createButton(button)
1963
1964 --[[ This button deals cards for each stage of the hand --]]
1965 button.label = 'Deal'
1966 button.click_function = "deal"
1967 button.font_size = 150
1968 dealbutton.createButton(button)
1969
1970
1971 --[[ Resets deck and variables --]]
1972 button.label = 'Reset'
1973 button.click_function = "resetGame"
1974 button.rotation = {0, 0, 0}
1975 resetbutton.createButton(button)
1976
1977 --[[ Move bets to pot --]]
1978 button.label = 'Collect\nBets'
1979 button.click_function = "collectBets"
1980 button.font_size = 150
1981 collectbutton.createButton(button)
1982
1983 --[[ Move action text --]]
1984 button.label = 'Done'
1985 button.font_size = 150
1986 button.click_function = "action"
1987 actionbutton.createButton(button)
1988
1989 --[[ Open options menu --]]
1990 button.label = 'Options'
1991 button.font_size = 150
1992 button.click_function = "spawnOptionsPanel"
1993 optionsbutton.createButton(button)
1994
1995 --[[ Create Side Pots --]]
1996 button.label = 'Create\nSidepot'
1997 button.font_size = 150
1998 button.click_function = "createSidepot"
1999 sidepotbutton.createButton(button)
2000
2001
2002 --[[ assign new savebag --]]
2003 button.label = 'New\nSavebag'
2004 button.font_size = 150
2005 button.click_function = "newSavebag"
2006 newsavebagbutton.createButton(button)
2007
2008 createPlayerButtons()
2009
2010
2011 for i, v in ipairs(getAllObjects()) do
2012 if v.getName() == 'Pot Splitter' then
2013 button.rotation = {0, 0, 0}
2014 button.width = 45
2015 button.height = 45
2016 button.font_size = 42
2017 potsplitter[#potsplitter + 1] = v
2018 p = v.getPosition()
2019 button.position = { - 0.40, 0.3, - 0.95}
2020 i = 2
2021 while i < 11 do
2022 button.click_function = "splitPot" .. i
2023 button.label = tostring(i)
2024 button.position[1] = button.position[1] + 0.08
2025 v.createButton(button)
2026 i = i + 1
2027 end
2028 end
2029
2030 if v.getName() == 'Back Table' and options.changemachine then
2031 local offsetx = 2 / #currencies
2032 local button = {}
2033 v.clearButtons()
2034 local offsetx = 2 / #currencies
2035 local button = {}
2036
2037 if #currencies <= 10 then
2038 offsetx = 1.65 / (#currencies - 2)
2039 else
2040 offsetx = 1.65 / 8
2041 end
2042 local offsety = 2 / #currencies
2043 button.font_size = 150
2044 button.width = 450
2045 button.height = 250
2046 button.scale = {1 / 5, 1 / 5, 1 / 7.5}
2047 button.position = {0.83, - 0.1, - 0.9}
2048 button.rotation = {180, 0, 0}
2049
2050 for j, w in ipairs(currencies) do
2051 if w.value ~= -1 then
2052 button.label = w.label
2053 button.click_function = 'changeMachineButton' .. j
2054 v.createButton(button)
2055 button.position[1] = button.position[1] - offsetx
2056 end
2057 if j == 9 then
2058 if #currencies - 11 > 0 then
2059 offsetx = 1.65 / (#currencies - 11)
2060 button.position = {0.83, - 0.1, - 0.8} -- spawn 1 button in the center
2061 else
2062 button.position = {0, - 0.1, - 0.8} -- spawn 1 button in the center
2063 end
2064 end
2065 end
2066 end
2067 end
2068 --[[ Make non-interactable parts to non-interactable --]]
2069 local custom = {}
2070
2071
2072
2073 for i, v in ipairs (getAllObjects()) do
2074 if v.getName() == 'Bet Square' or v.getName() == 'Front Table' or v.getName() == 'Back Table' or v.getName() == 'Dealer Table' or v.getName() == 'Change Box' then
2075 v.interactable = false
2076 elseif v.getName() == 'Table Overlay' then
2077 overlay = v
2078 v.interactable = false
2079 end
2080 end
2081
2082 muck.setColorTint(pottext.TextTool.getFontColor())
2083 boardobject.setColorTint(pottext.TextTool.getFontColor())
2084
2085 --[[ Copy scripts from objects. These are used when objects are respawned with 'Reset Objects' button on the options menu --]]
2086 scripts[1] = muck.getLuaScript()
2087 scripts[2] = boardobject.getLuaScript()
2088 scripts[3] = potobject.getLuaScript()
2089 scripts[4] = actiontext.getLuaScript()
2090
2091
2092end
2093
2094function onSave()
2095 --print ('saved')
2096 local savebettext = {}
2097 local savesidepottext = {}
2098 local savetablezonetext = {}
2099 for i, v in pairs (colors) do
2100 savebettext[v] = bettext[v].getGUID()
2101 savesidepottext[v] = sidepottext[v].getGUID()
2102 savetablezonetext[v] = tablezonetext[v].getGUID()
2103 end
2104
2105 if savebag ~= nil then
2106 savebagGUID = savebag.getGUID()
2107 end
2108
2109 local tosave = {
2110 options = options,
2111
2112 holedealt = holedealt,
2113 dealing = false,
2114 players = players,
2115 actionon = actionon,
2116 playerbets = playerbets,
2117 currentbet = currentbet,
2118 mainpotchips = mainpotchips,
2119 pot = pot,
2120 collecting = false,
2121 handinprogress = handinprogress,
2122
2123 deckGUID = deck.getGUID(),
2124 muckGUID = muck.getGUID(),
2125 potobjectGUID = potobject.getGUID(),
2126 boardobjectGUID = boardobject.getGUID(),
2127 overlayGUID = overlay.getGUID(),
2128 pottextGUID = pottext.getGUID(),
2129 currentbettextGUID = currentbettext.getGUID(),
2130 actiontextGUID = actiontext.getGUID(),
2131 holecards = holecards,
2132 revealedcards = revealedcards,
2133 handsshown = handsshown,
2134 savebagGUID = savebagGUID,
2135 bettext = JSON.encode(savebettext),
2136 sidepottext = JSON.encode(savesidepottext),
2137 tablezonetext = JSON.encode(savetablezonetext)
2138
2139 }
2140 return JSON.encode(tosave)
2141
2142end
2143
2144function createPlayerButtons()
2145 --[[ Create sort Chips onPlayers --]]
2146
2147 button = {}
2148
2149 button.rotation = {0, 180, 180}
2150 button.width = 250
2151 button.height = 15
2152 button.font_size = 50
2153
2154 for i, v in ipairs(getAllObjects()) do
2155
2156 posy = 0.75
2157 if v.getName() == 'Front Table' then
2158 v.clearButtons()
2159
2160 if options.playerbuttons.sortchips then
2161 posy = posy - 0.3
2162 button.font_size = 50
2163 button.height = 25
2164 p = v.getPosition()
2165 button.label = 'SortChips'
2166 button.position = {0.75, - 0.1, posy}
2167 button.click_function = 'sortPlayerChips'
2168 v.createButton(button)
2169 end
2170
2171 if options.playerbuttons.convert then
2172 posy = posy - 0.3
2173 p = v.getPosition()
2174 button.label = 'Convert'
2175 button.position = {0.75, - 0.1, posy}
2176 button.font_size = 50
2177 button.height = 25
2178 button.click_function = 'quickConvertPlayerChips10_5'
2179 v.createButton(button)
2180 end
2181
2182
2183 if options.playerbuttons.allin then
2184 posy = posy - 0.3
2185 p = v.getPosition()
2186 button.height = 15
2187 button.font_size = 50
2188 button.label = 'All In'
2189 button.position = {0.75, - 0.1, posy}
2190 button.click_function = 'goAllIn'
2191 v.createButton(button)
2192 end
2193
2194 if options.playerbuttons.afk then
2195 posy = posy - 0.3
2196 button.height = 15
2197 button.font_size = 50
2198 button.label = 'AFK'
2199 button.position = {0.75, - 0.1, posy}
2200 button.click_function = 'goAFK'
2201 v.createButton(button)
2202 end
2203
2204 if options.playerbuttons.loadsavebag then
2205 posy = posy - 0.3
2206 button.height = 15
2207 button.font_size = 50
2208 button.label = 'load save'
2209 button.position = {0.75, - 0.1, posy}
2210 button.click_function = 'loadSaveBag'
2211 v.createButton(button)
2212 end
2213 end
2214 end
2215end
2216--[[ deal function: determines whether to deal players' hands, flop, turn, or river --]]
2217
2218function deal(ob, pl)
2219 if not Player[pl].admin then
2220 return 1
2221 end
2222
2223 sidepotcalculated = false;
2224
2225 if deck == nil or deck == null then
2226 for i, v in ipairs (getSeatedPlayers()) do
2227 if Player[v].admin then
2228 broadcastToColor('No deck assigned. Please assign a deck with the \'New Deck\' button.', v, {1, 0.3, 0.3})
2229 end
2230 end
2231 return 1
2232 end
2233
2234 if boardobject == nil or boardobject == null then
2235 print ('The board object has been lost. Please click the \'Reset Objects\' button on the options panel to reassign.')
2236 --return 1
2237 checkAndRespawnObjects()
2238 end
2239
2240 if muck == nil or muck == null then
2241 print ('The muck object has been lost. Please click the \'Reset Objects\' button on the options panel to reassign.')
2242 --return 1
2243 checkAndRespawnObjects()
2244 end
2245
2246 if pottext == nil or pottext == null then
2247 print ('The pot text has been deleted. Please click the \'Reset Objects\' button on the options panel to respawn.')
2248 --return 1
2249 checkAndRespawnObjects()
2250 end
2251
2252 if currentbettext == nil or currentbettext == null then
2253 print ('The current bet text has been deleted. Please click the \'Reset Objects\' button on the options panel to respawn.')
2254 --return 1
2255 checkAndRespawnObjects()
2256 end
2257
2258 if actiontext == nil or actiontext == null then
2259 print ('The action text has been deleted. Please click the \'Reset Objects\' button on the options panel to respawn.')
2260 --return 1
2261 checkAndRespawnObjects()
2262 end
2263
2264 for i, v in ipairs(colors) do
2265 if bettext[v] == nil or bettext[v] == null then
2266 print ('bettext of color ' .. v .. ' has been deleted')
2267 checkAndRespawnObjects()
2268 end
2269 if sidepottext[v] == nil or sidepottext[v] == null then
2270 print ('sidepottext of color ' .. v .. ' has been deleted')
2271 checkAndRespawnObjects()
2272 end
2273 if tablezonetext[v] == nil or tablezonetext[v] == null then
2274 print ('tablezonetext of color ' .. v .. ' has been deleted')
2275 checkAndRespawnObjects()
2276 end
2277
2278
2279
2280
2281 end
2282
2283 if not dealing then
2284 if not holedealt then
2285 hole(pl)
2286 else
2287 local cards = boardzone.getObjects()
2288 local x = 0
2289 for i, v in ipairs (cards) do
2290 if v.tag == "Card" then
2291 x = x + 1
2292 end
2293 end
2294
2295 if x == 0 then
2296 flop ()
2297 elseif x == 3 then
2298 turn ()
2299 elseif x == 4 then
2300 river ()
2301 elseif x == 5 then
2302 broadcastToAll('Showtime!', {1, 1, 1})
2303 else
2304 broadcastToColor("[ff0000]Error:[ffffff] Invalid board", pl, {1, 1, 1})
2305 end
2306 end
2307 end
2308
2309end
2310
2311--[[ This function returns an ordered list of seated players who do not have an afk button or busted token.
2312 The first entry will be the player to the dealers left, and the dealer will be the last entry.
2313 If the dealer button is not found, returns nil. --]]
2314
2315function getOrderedListOfPlayers(pl)
2316
2317 local dealer = nil
2318 local afk = {} -- list of afk players
2319 local busted = {} -- list of busted players determined by busted tokens in their bet zones (when a player busts out, I usually make them sit out for a few hands before giving them more money)
2320 local objects = {} -- list of objects found in the dealerzones
2321 local dealerafk = false
2322 local bustedbombs = {}
2323
2324 -- First, look for the dealer button. Also, make list of afk players.
2325 for i, v in ipairs (colors) do
2326 objects = betzones[v].getObjects()
2327 for j, w in ipairs (objects) do
2328 if w.getName() == "Dealer" then
2329 dealer = v
2330 elseif w.getName() == "suffering" or w.getName() == "Busted" then
2331 if not objectExistsInList (busted, v) then
2332 busted[#busted + 1] = v
2333 bustedbombs[#bustedbombs + 1] = w
2334 end
2335 elseif w.getName() == 'AFK' then
2336 afk[#afk + 1] = v
2337 end
2338 end
2339 end
2340
2341 -- return nil if dealer button not found
2342 if not dealer then
2343 broadcastToColor ('[ff0000]Error: [ffffff]Dealer button not found.', pl, {1, 1, 1})
2344 return nil
2345 end
2346
2347 for i, v in ipairs(bustedbombs) do
2348 v.destruct()
2349 end
2350
2351 local seatedplayers = getSeatedPlayers() -- list of seated players, in some random order
2352
2353 -- make sure dealer button is in front of a seated player
2354 for i, v in ipairs (seatedplayers) do
2355 if v == dealer then
2356 --print ('Dealer: '..dealer)
2357 break
2358 end
2359
2360 if i == #seatedplayers then
2361 broadcastToColor('[ff0000]Error:[ffffff] Dealer button not in front of a seated player.', pl, {1, 1, 1})
2362 return nil
2363 end
2364 end
2365
2366
2367 local playersx = {}
2368
2369 --sort the seatedplayers into playersx list
2370 for i, v in ipairs (colors) do
2371 for j, w in ipairs (seatedplayers) do
2372 if v == w then
2373 playersx[#playersx + 1] = w
2374 break
2375 end
2376 end
2377 end
2378
2379
2380 --rotate the list so the dealer is the last entry
2381 while playersx[#playersx] != dealer do
2382 playersx[#playersx + 1] = playersx[1] -- copy first entry to end of table
2383 table.remove(playersx, 1) -- then remove first entry
2384 end
2385
2386 -- remove busted players from the table
2387 for i, v in ipairs (busted) do
2388 for j, w in ipairs (playersx) do
2389 if w == v then
2390 table.remove(playersx, j)
2391 end
2392 end
2393 end
2394
2395 -- lastly, remove afk players from the table
2396
2397 local actionoffset = 0
2398
2399 for i, v in ipairs(afk) do
2400 for j, w in ipairs (playersx) do
2401 if w == v then
2402 if actionoffset == 0 and j <= 2 then
2403 actionoffset = actionoffset + 1
2404 elseif actionoffset == 1 and j == 1 then
2405 actionoffset = actionoffset + 1
2406 end
2407 --print ('Removing afk player: '..playersx[j])
2408 table.remove(playersx, j)
2409 if w == dealer then
2410 dealerafk = true
2411 end
2412 break
2413 end
2414 end
2415 end
2416
2417 for i, v in ipairs (playersx) do
2418 playerbets[i] = 0
2419 end
2420
2421 if options.blindsskipafk then
2422 actionoffset = 0
2423 end
2424
2425 if actionoffset < 2 then
2426 actionon = playersx[2 - actionoffset]
2427 else
2428 actionon = playersx[#playersx]
2429 end
2430
2431 -- set action on the dealer in a heads-up match
2432 if #playersx == 2 and not dealerafk then
2433 actionon = playersx[1]
2434 end
2435
2436 --return the final table
2437 return playersx
2438
2439end
2440
2441
2442--[[ deal hole --]]
2443
2444function hole (pl)
2445
2446 players = getOrderedListOfPlayers(pl)
2447
2448 if not players then
2449 return 1 -- abort if dealer button is not in front of a seat
2450 else
2451 dealing = true
2452 handinprogress = true
2453 hideActionText()
2454 calculatePots()
2455 startLuaCoroutine(nil, 'holeCoroutine')
2456 end
2457
2458end
2459
2460function holeCoroutine()
2461
2462 local deckpos = deck.getPosition()
2463 local cards = 0
2464
2465 if options.gamemode == 'fivestud' or onecard then
2466 cards = 1
2467 elseif options.gamemode == 'texas' or options.gamemode == 'sevenstud' then
2468 cards = 2
2469 elseif options.gamemode == 'pineapple' then
2470 cards = 3
2471 elseif options.gamemode == 'omaha' then
2472 cards = 4
2473 elseif options.gamemode == 'fivedraw' then
2474 cards = 5
2475 end
2476
2477 deck.setPosition({ - 0.05, 1.4, - 1.97}) -- set the deck to the center of the table so dealt cards don't get intercepted by unintended hands
2478 for i = 1, cards do
2479 for i, v in ipairs (players) do
2480 local t = os.clock()
2481 deck.dealToColor(1, players[i])
2482 while os.clock() < (t + options.dealdelay1) do
2483 coroutine.yield(0)
2484 end
2485 end
2486 end
2487
2488 deck.setPosition(deckpos)
2489
2490 if onecard then
2491 onecard = false
2492 dealing = false
2493 if not handinprogress then
2494 players = {}
2495 end
2496 return 1
2497 end
2498
2499 --[[ This loop exists to delay the call of the function action()
2500 I was having problems with a player (the dealer) being folded due to the cards not reaching the hand
2501 before the function was called. --]]
2502 t = os.clock()
2503 while os.clock() < (t + 1) do
2504 coroutine.yield(0)
2505 end
2506
2507 holedealt = true
2508 dealing = false
2509
2510 action()
2511
2512 for i, v in ipairs (players) do
2513 local cards = Player[v].getHandObjects()
2514 for j, w in ipairs (cards) do
2515 if w.tag == 'Card' then
2516 w.setColorTint({1, 1, cardtint})
2517 cardtint = cardtint - 0.01
2518 end
2519 end
2520 end
2521 getPlayersHoleCards()
2522
2523 return 1
2524
2525end
2526
2527
2528--[[ deal flop --]]
2529
2530function flop ()
2531
2532 dealing = true
2533 actionon = nil
2534 resetBets()
2535 hideActionText()
2536
2537 if options.chatoptions.stage then
2538 broadcastToAll('Flop', {0, 1, 1})
2539 end
2540
2541 startLuaCoroutine(nil, 'flopCoroutine')
2542
2543end
2544
2545function flopCoroutine ()
2546
2547 local muckpos = muck.getPosition()
2548 local muckrot = muck.getRotation()
2549
2550 muckpos.y = muckpos.y + 0.5
2551 muckrot.x = muckrot.x + 180
2552
2553 local params = {}
2554
2555 params.position = muckpos
2556 params.rotation = muckrot
2557 deck.takeObject(params)
2558
2559 for i = 1, 3 do
2560 local t = os.clock()
2561 while os.clock () < t + options.dealdelay2 do
2562 coroutine.yield(0)
2563 end
2564 params.position = getCardPosition(i)
2565 params.rotation = boardobject.getRotation()
2566 local card = deck.takeObject(params)
2567 card.setColorTint({1, 1, cardtint})
2568 cardtint = cardtint - 0.01
2569 end
2570
2571 t = os.clock()
2572 while os.clock() < (t + 1) do
2573 coroutine.yield(0)
2574 end
2575
2576 dealing = false
2577
2578 action()
2579
2580 return (1)
2581
2582end
2583
2584--[[ deal turn --]]
2585
2586function turn ()
2587
2588 dealing = true
2589 actionon = nil
2590 resetBets()
2591 calculatePots()
2592 hideActionText()
2593
2594 if options.chatoptions.stage then
2595 broadcastToAll('Turn', {0, 1, 1})
2596 end
2597
2598 startLuaCoroutine(nil, 'turnCoroutine')
2599
2600end
2601
2602function turnCoroutine ()
2603
2604 local muckpos = muck.getPosition()
2605 local muckrot = muck.getRotation()
2606
2607 muckpos.y = muckpos.y + 0.5
2608 muckrot.x = muckrot.x + 180
2609
2610 local params = {}
2611
2612 params.position = muckpos
2613 params.rotation = muckrot
2614 deck.takeObject(params)
2615
2616 local t = os.clock()
2617 while os.clock() < (t + options.dealdelay2) do
2618 coroutine.yield(0)
2619 end
2620
2621 params.position = getCardPosition(4)
2622 params.rotation = boardobject.getRotation()
2623 local card = deck.takeObject(params)
2624 card.setColorTint({1, 1, cardtint})
2625 cardtint = cardtint - 0.01
2626
2627 t = os.clock()
2628 while os.clock() < (t + 1) do
2629 coroutine.yield(0)
2630 end
2631
2632 dealing = false
2633
2634 action()
2635
2636 return (1)
2637
2638end
2639
2640--[[ deal river --]]
2641
2642function river ()
2643
2644 dealing = true
2645 actionon = nil
2646 resetBets()
2647 calculatePots()
2648 hideActionText()
2649
2650 if options.chatoptions.stage then
2651 broadcastToAll('River', {0, 1, 1})
2652 end
2653
2654 startLuaCoroutine(nil, 'riverCoroutine')
2655
2656end
2657
2658function riverCoroutine ()
2659
2660 local muckpos = muck.getPosition()
2661 local muckrot = muck.getRotation()
2662
2663 muckpos.y = muckpos.y + 0.5
2664 muckrot.x = muckrot.x + 180
2665
2666 local params = {}
2667
2668 params.position = muckpos
2669 params.rotation = muckrot
2670 deck.takeObject(params)
2671
2672 local t = os.clock()
2673 while os.clock() < (t + options.dealdelay2) do
2674 coroutine.yield(0)
2675 end
2676
2677 params.position = getCardPosition(5)
2678 params.rotation = boardobject.getRotation()
2679 local card = deck.takeObject(params)
2680 card.setColorTint({1, 1, cardtint})
2681 cardtint = cardtint - 0.01
2682
2683 t = os.clock()
2684 while os.clock() < (t + 1) do
2685 coroutine.yield(0)
2686 end
2687
2688 dealing = false
2689
2690 action()
2691
2692 return (1)
2693
2694end
2695
2696--[[ returns the card position based on the position and rotation of the boardobject model--]]
2697
2698function getCardPosition(n)
2699 local p = boardobject.getPosition()
2700 local r = boardobject.getRotation()
2701 local s = boardobject.getScale()
2702 n = 3 - n
2703
2704 p.x = p.x - ((math.cos(math.rad(r.y)) * 2.75) * n) * s.x
2705 p.z = p.z + ((math.sin(math.rad(r.y)) * 2.75) * n) * s.z
2706 p.y = p.y + 0.5
2707
2708 return p
2709end
2710--[[ looks for a deck of 52 cards in the specified scripting zone (I used the white player's bet zone) and makes it the new deck object --]]
2711function newDeck (ob, pl)
2712
2713 if not Player[pl].admin then
2714 return 1
2715 end
2716
2717 obj = betzones.White.getObjects()
2718 for i, v in ipairs (obj) do
2719 if v.tag == "Deck" then
2720 if v.getQuantity() <= 52 then
2721 deck = {}
2722 deck = getObjectFromGUID(v.getGUID())
2723 print ("New deck assigned.")
2724 return 1
2725 end
2726 end
2727 end
2728
2729 broadcastToColor ("Valid deck not found. Please place a 52-card poker deck inside the white player's bet square try again.", pl, {1, 0.3, 0.3}) -- it only gets to this line if a deck isn't found in the above loop
2730
2731
2732end
2733
2734
2735function newSavebag (ob, pl)
2736
2737 if not Player[pl].admin then
2738 return 1
2739 end
2740
2741 obj = betzones.White.getObjects()
2742 for i, v in ipairs (obj) do
2743 if v.tag == "Bag" then
2744 savebag = {}
2745 savebag = getObjectFromGUID(v.getGUID())
2746 print ("New savebag assigned.")
2747 return 1
2748 end
2749 end
2750
2751 broadcastToColor ("No savebag found. Please put a bag inside the white player's bet square try again.", pl, {1, 0.3, 0.3}) -- it only gets to this line if a deck isn't found in the above loop
2752
2753
2754end
2755
2756--[[ reset the deck and variables --]]
2757
2758function resetGame (ob, pl)
2759
2760 if not Player[pl].admin then
2761 return 1
2762 end
2763
2764 sidepotcalculated = false
2765
2766 if deck == nil or deck == null then
2767 broadcastToColor('No deck is currently assigned. Please assign a new deck and try again.', pl, {1, 0.3, 0.3})
2768 return 0
2769 end
2770 if pottext == nil or pottext == null then
2771 checkAndRespawnObjects()
2772 end
2773
2774 if currentbettext == nil or currentbettext == null then
2775 checkAndRespawnObjects()
2776 end
2777
2778 if actiontext == nil or actiontext == null then
2779 checkAndRespawnObjects()
2780 end
2781
2782 mainpotchips = initializePot()
2783 afk = {}
2784 dealing = true
2785 for i, v in ipairs (colors) do
2786 for j, w in ipairs (Player[v].getHandObjects()) do
2787 w.setRotation({180, 0, 0})
2788 w.setColorTint({1, 1, 1})
2789 end
2790 bettext[v].setValue(" ")
2791 sidepottext[v].setValue(" ")
2792 if options.displayplayermoney then
2793 local chips = {}
2794 money = getChipValues(tablezones[v], chips)
2795 tablezonetext[v].setValue("$" .. money)
2796 end
2797 end
2798
2799
2800 cardtint = 1
2801 holedealt = false
2802 handinprogress = false
2803 players = {}
2804 actionon = nil
2805 currentbet = 0
2806 pot = 0
2807 pottext.setValue('Pot: $'.. tostring(pot))
2808 currentbettext.setValue('Current bet: $'..tostring(currentbet))
2809 handsshown = {}
2810 playerbets = {}
2811 hideActionText()
2812 holecards = {['White'] = {}, ['Red'] = {}, ['Orange'] = {}, ['Yellow'] = {}, ['Green'] = {}, ['Teal'] = {}, ['Blue'] = {}, ['Purple'] = {}}
2813 revealedcards = {['White'] = {}, ['Red'] = {}, ['Orange'] = {}, ['Yellow'] = {}, ['Green'] = {}, ['Teal'] = {}, ['Blue'] = {}, ['Purple'] = {}}
2814 if clock ~= nil and clock ~= null then
2815 clock.destruct()
2816 end
2817
2818 -- destroy Sidepotmarke
2819 for i, v in ipairs(getAllObjects()) do
2820 if v.getName() == "Sidepotmarker" then
2821 v.destruct()
2822 end
2823 end
2824 startLuaCoroutine(nil, 'resetGameCoroutine')
2825
2826end
2827
2828function resetMuck(zone)
2829
2830 if not deck then
2831 return 1
2832 end
2833
2834 local obj = zone.getObjects()
2835 local deck_pos = deck.getPosition()
2836 local deck_rot = deck.getRotation()
2837
2838 deck_pos.y = deck_pos.y + 0.5
2839
2840 for i, v in ipairs (obj) do
2841 if v.tag == "Card" or v.tag == "Deck" then
2842 if v ~= deck then
2843 v.setColorTint({1, 1, 1})
2844 v.setPositionSmooth(deck_pos)
2845 v.setRotation(deck_rot)
2846 deck_pos.y = deck_pos.y + 0.1
2847 end
2848 end
2849 end
2850
2851 for i, v in ipairs(colors) do
2852 for j, w in ipairs (Player[v].getHandObjects()) do
2853 if w.tag == 'Card' then
2854 deck.putObject(w)
2855 end
2856 end
2857 end
2858 zone.destruct()
2859end
2860
2861function resetGameCoroutine()
2862
2863 local params = {}
2864 params.position = {0, 1, 0}
2865 params.rotation = {0, 0, 0}
2866 params.scale = {70, 1, 27}
2867 params.type = "ScriptingTrigger"
2868 params.callback = "resetMuck"
2869 params.params = {zone}
2870
2871 local zone = spawnObject(params)
2872
2873 local t = os.clock()
2874
2875
2876 --[[ Print an error and unassign deck if it doesn't have 52 cards after 3 seconds --]]
2877 while deck.getQuantity() < 52 do
2878 if os.clock() > (t + 3) then
2879 for i, v in ipairs (getSeatedPlayers()) do
2880 if Player[v].admin then
2881 broadcastToColor('Error: Deck missing cards. Unassigned current deck. Please assign new deck', v, {1, 0.3, 0.3})
2882 end
2883 end
2884 deck = nil
2885 dealing = false
2886 return 1
2887 end
2888 coroutine.yield(0)
2889 end
2890
2891 --[[ Print an error and unassign deck if it has more than 52 cards --]]
2892 if deck.getQuantity() > 52 then
2893 for i, v in ipairs (getSeatedPlayers()) do
2894 if Player[v].admin then
2895 broadcastToColor('Error: Too many cards in deck. Unassigned current deck. Please assign new deck.', v, {1, 0.3, 0.3})
2896 end
2897 end
2898
2899 deck = nil
2900 dealing = false
2901 return 1
2902 end
2903
2904 deck.shuffle()
2905
2906 t = os.clock()
2907 while os.clock() < (t + 1) do
2908 coroutine.yield(0)
2909 end
2910
2911 dealing = false
2912
2913 return (1)
2914
2915end
2916
2917--[[ move all chips in bet zones into the main pot --]]
2918
2919function collectBets(ob, pl)
2920
2921 --[[ Only host and promoted players can click this button --]]
2922 if not Player[pl].admin then
2923 return 1
2924 end
2925
2926 sidepotcalculated = false
2927 --[[ Make sure the potobject exists before running function --]]
2928 if potobject == nil or potobject == null then
2929 --print ('The pot object has been lost. Please click the \'Reset Objects\' button on the options panel to reassign.')
2930 checkAndRespawnObjects()
2931 --return 1
2932 end
2933
2934 printstring = printstring..'collect'
2935
2936 if clock ~= nil and clock ~= null then
2937 clock.destruct()
2938 end
2939
2940 -- prevents button spamming
2941 if (os.time() - lastCollectTime) < 2 then
2942 printToColor("You cant collect bets multiple times within 2 seconds", pl, {1, 1, 0} )
2943 return 1
2944 else
2945 lastCollectTime = os.time()
2946 end
2947
2948 if options.collectmethod == 'move' then
2949 startLuaCoroutine(nil, 'moveBetsToPot')
2950 elseif options.collectmethod == 'convert' then
2951 startLuaCoroutine(nil, 'convertBetsToPot')
2952 elseif options.collectmethod == 'hybrid' then
2953 if pot <= options.hybridthreshold then
2954 startLuaCoroutine(nil, 'moveBetsToPot')
2955 else
2956 startLuaCoroutine(nil, 'convertBetsToPot')
2957 end
2958 end
2959end
2960
2961function moveBetsToPot()
2962
2963 local objects = {} -- table of all objects
2964 local stacks = {}
2965 local chips = {}
2966 local h = {}
2967 bets = getChipValues(potzones[1], chips)
2968 for i, v in pairs (betzones) do
2969 bets = bets + getChipValues(v, chips)
2970 end
2971
2972 for i, v in ipairs (chips) do
2973 v.setColorTint({1, 1, 1})
2974 end
2975
2976 moveChips(chips, potobject.getPosition(), potobject.getRotation())
2977 for i = 1, 5 do
2978 coroutine.yield(0)
2979 end
2980 calculatePots()
2981 return 1
2982end
2983
2984
2985function convertBetsToPot()
2986
2987 if convertfailcount > convertfailcountlimit then
2988 convertfailcount = 0
2989 startLuaCoroutine (nil, 'moveBetsToPot')
2990 return 1
2991 end
2992
2993 --[[ Get chip values in bet zones --]]
2994
2995 local objects = {}
2996 local chips1 = {}
2997 local positions1 = {}
2998 local rotations1 = {}
2999
3000 objects = {}
3001 objects = potzones[1].getObjects()
3002 for j, w in ipairs (objects) do
3003 if w.tag == 'Chip' then
3004 if w.getValue() or currencyToNumber(w.getName()) != nil then
3005 chips1[#chips1 + 1] = w
3006 end
3007 end
3008 end
3009
3010
3011 for i, v in pairs (betzones) do
3012 objects = {}
3013 objects = v.getObjects()
3014 for j, w in ipairs (objects) do
3015 if w.tag == 'Chip' then
3016 if w.getValue() or currencyToNumber(w.getName()) != nil then
3017 chips1[#chips1 + 1] = w
3018 end
3019 end
3020 end
3021 end
3022
3023 for i, v in ipairs (chips1) do
3024 positions1[#positions1 + 1] = v.getPosition()
3025 rotations1[#rotations1 + 1] = v.getRotation()
3026 end
3027
3028 for i = 1, 2 do
3029 coroutine.yield(0)
3030 end
3031
3032 objects = {}
3033 local chips2 = {}
3034 local positions2 = {}
3035 local rotations2 = {}
3036
3037 objects = {}
3038 objects = potzones[1].getObjects()
3039 for j, w in ipairs (objects) do
3040 if w.tag == 'Chip' then
3041 if w.getValue() or currencyToNumber(w.getName()) != nil then
3042 chips2[#chips2 + 1] = w
3043 end
3044 end
3045 end
3046
3047
3048 for i, v in pairs (betzones) do
3049 objects = {}
3050 objects = v.getObjects()
3051 for j, w in ipairs (objects) do
3052 if w.tag == 'Chip' then
3053 if w.getValue() or currencyToNumber(w.getName()) != nil then
3054 chips2[#chips2 + 1] = w
3055 end
3056 end
3057 end
3058 end
3059
3060 if #chips2 ~= #chips1 then
3061 convertfailcount = convertfailcount + 1
3062 startLuaCoroutine(nil, 'convertBetsToPot')
3063 return 1
3064 end
3065
3066 for i, v in ipairs (chips2) do
3067 positions2[#positions2 + 1] = v.getPosition()
3068 rotations2[#rotations2 + 1] = v.getRotation()
3069 end
3070
3071 --[[ Check chip positions --]]
3072 for i, v in ipairs(positions1) do
3073 if v.x ~= positions2[i].x or v.y ~= positions2[i].y or v.z ~= positions2[i].z then
3074 convertfailcount = convertfailcount + 1
3075 startLuaCoroutine(nil, 'convertBetsToPot')
3076 return 1
3077 end
3078 end
3079
3080 --[[ Check chip rotations --]]
3081 for i, v in pairs(rotations1) do
3082 if v.x ~= rotations2[i].x or v.y ~= rotations2[i].y or v.z ~= rotations2[i].z then
3083 convertfailcount = convertfailcount + 1
3084 startLuaCoroutine(nil, 'convertBetsToPot')
3085 return 1
3086 end
3087 end
3088
3089 local chips = {}
3090 local bets = 0
3091
3092 for i, v in pairs (betzones) do
3093 bets = bets + getChipValues(v, chips)
3094 end
3095
3096 bets = bets + getChipValues(potzones[1], chips)
3097
3098 --[[ Spawn new chips in pot --]]
3099
3100
3101 --[[ Destroy old chips --]]
3102 for i, v in ipairs (chips) do
3103 v.destruct()
3104 end
3105
3106 --[[ Wait five frames to allow chips to spawn destruct themself --]]
3107 for i = 1, 10 do
3108 coroutine.yield(0)
3109 end
3110
3111
3112 spawnChips(bets, potobject.getPosition(), potobject.getRotation(), options.convertstackheight)
3113
3114
3115 --[[ Wait five frames to allow chips to spawn before updating pot values --]]
3116 for i = 1, 5 do
3117 coroutine.yield(0)
3118 end
3119
3120 calculatePots()
3121
3122 convertfailcount = 0
3123
3124 return 1
3125end
3126
3127function objectExistsInList(list, object)
3128 if list != nil then
3129 for i, v in ipairs(list) do
3130 if v == object then
3131 return true
3132 end
3133 end
3134 return false
3135 end
3136 return false
3137end
3138
3139function action (ob, pl)
3140
3141 if pl then
3142 if not Player[pl].admin and pl ~= actionon then
3143 return 1
3144 end
3145 end
3146
3147 if sidepotcalculated then
3148 return 1
3149 end
3150
3151 if actiontext == nil or actiontext == null then
3152 checkAndRespawnObjects()
3153 --print ('The action text has been deleted. Please click the \'Reset Objects\' button on the options panel to respawn.')
3154 --return 0
3155 end
3156
3157 calculatePots()
3158
3159 -- abort function if action toggled off
3160 if not options.actiontoggle then
3161 return 1
3162 end
3163
3164 --[[ Check action player's bet to make sure it's greater than or equal to current bet --]]
3165 if actionon and actionon == pl then
3166 if getChipValues(betzones[actionon], {}) < currentbet and getChipValues(tablezones[actionon], {}) > 0 and Player[actionon].getHandObjects()[1] then
3167 broadcastToColor('You must match or raise the current bet of $'..currentbet, actionon, {1, 1, 1})
3168 if not Player[pl].admin then
3169 return 1
3170 end
3171 end
3172 end
3173
3174 --[[ Destroy the clock if it exists --]]
3175
3176 if clock ~= nil and clock ~= null then
3177 clock.destruct()
3178 clock = null
3179 end
3180
3181 --[[ abort function and hide text if no players --]]
3182
3183 if #players == 0 then
3184 hideActionText()
3185 return 1
3186 end
3187
3188 local cb = currentbet
3189
3190 --[[ Remove player from list if they don't have cards --]]
3191
3192 if actionon then
3193 if not Player[actionon].getHandObjects()[1] then
3194 for i, v in ipairs (players) do
3195 if v == actionon then
3196 table.remove(players, i)
3197 if i > 1 then
3198 actionon = players[i - 1]
3199 else
3200 actionon = players[#players]
3201 end
3202 break
3203 end
3204 end
3205 end
3206
3207 --[[ or if they have no money (all in) --]]
3208 if actionon then
3209 if getChipValues(tablezones[actionon], {}) == 0 then
3210 printstring = printstring..'allin'..actionon
3211 if getChipValues(betzones[actionon], {}) > cb then
3212 cb = getChipValues(betzones[actionon], {})
3213 end
3214 for i, v in ipairs (players) do
3215 if v == actionon then
3216 table.remove(players, i)
3217 if i > 1 then
3218 actionon = players[i - 1]
3219 else
3220 actionon = players[#players]
3221 end
3222 break
3223 end
3224 end
3225 end
3226 if not actionon then
3227 hideActionText()
3228 return 1
3229 end
3230 end
3231 if #players == 0 then
3232 return 1
3233 end
3234 end
3235
3236 -- set actionon to next player
3237 if not actionon then
3238 actionon = players[1]
3239 else
3240 for i, v in ipairs (players) do
3241 if actionon == v then
3242 if players[i + 1] then
3243 actionon = players[i + 1]
3244 else
3245 actionon = players[1]
3246 end
3247 break
3248 end
3249 end
3250 end
3251
3252 -- check new player's hand for cards. remove from list if none and run function again.
3253
3254 if actionon then
3255 if not Player[actionon].getHandObjects()[1] then
3256 for i, v in ipairs (players) do
3257 if v == actionon then
3258 table.remove(players, i)
3259 if i > 1 then
3260 actionon = players[i - 1]
3261 else
3262 actionon = players[#players]
3263 end
3264 action()
3265 return 1
3266 end
3267 end
3268 end
3269 end
3270
3271 --[[ Hide text and abort if there is one player and no bet to call --]]
3272
3273 if #players == 1 and getChipValues(betzones[actionon], {}) >= cb then
3274 hideActionText()
3275 return 1
3276 end
3277
3278 printstring = printstring..'action'
3279
3280 -- move actiontext to front of player
3281
3282 local playerhand = getPlayerHandPositionAndRotation(actionon)
3283 actiontext.setValue('Action') -- set action text to say "Action" in case it gets changed (sometimes it changes to "Type here" for some reason)
3284 actiontext.TextTool.setFontColor(fontcolors[actionon]) -- change color of "Action" to player's color
3285
3286 actiontext.setPosition({playerhand['pos_x'] + playerhand['trigger_forward_x'] * 10, 1.33, playerhand['pos_z'] + playerhand['trigger_forward_z'] * 10})
3287 actiontext.setRotation({90, playerhand['rot_y'], 0})
3288
3289 -- move action button to player if playerclickaction is toggled
3290 if options.playerclickaction then
3291 actionbutton.setPosition({playerhand['pos_x'] + playerhand['trigger_forward_x'] * 12, 1.55, playerhand['pos_z'] + playerhand['trigger_forward_z'] * 12})
3292 actionbutton.setRotation({0, playerhand['rot_y'] + 180, 0})
3293 end
3294
3295 -- spawn clock if autoclock
3296 if options.autoclock then
3297 spawnClock()
3298 end
3299end
3300
3301function actionToggle(ob, pl)
3302 if not Player[pl].admin then
3303 return 1
3304 end
3305
3306 if options.actiontoggle then
3307 options.actiontoggle = false
3308 hideActionText()
3309 print ('Action text toggled off. The button can still be used to update pot and current bet values.')
3310 else
3311 options.actiontoggle = true
3312 print ('Action text toggled on. It will reappear next time action is passed.')
3313 end
3314
3315 optionsHost()
3316end
3317
3318function hideActionText()
3319 actiontext.setPosition({0, - 2, 0})
3320end
3321
3322function calculatePots()
3323 if pottext == nil or pottext == null then
3324 checkAndRespawnObjects()
3325 return 0
3326 end
3327 if sidepotcalculated then
3328 return 0
3329 end
3330 if currentbettext == nil or currentbettext == null then
3331 checkAndRespawnObjects()
3332 return 0
3333 end
3334 startLuaCoroutine(nil, 'calculatePotsCoroutine')
3335end
3336
3337function calculatePotsCoroutine ()
3338
3339 local p = potobject.getPosition()
3340 local r = potobject.getRotation()
3341
3342 p.y = p.y + 10
3343
3344 potzones[1].setPosition (p)
3345 potzones[1].setRotation (r)
3346 potzones[1].setScale({9.5, 20, 6})
3347
3348 for i = 1, 3 do
3349 coroutine.yield(0)
3350 end
3351
3352 local bets = 0
3353 local mainpot = 0
3354 local prevpot = pot
3355 local prevbet = currentbet
3356 currentbet = 0
3357 local chips = {}
3358 local better = ''
3359 for i, v in ipairs (colors) do
3360 playerbets[i] = getChipValues(betzones[v], chips)
3361
3362 if playerbets[i] > currentbet then
3363 currentbet = playerbets[i]
3364 better = v
3365 end
3366 if options.displayplayerbet then
3367 if playerbets[i] > 0 then
3368 bettext[v].setValue('$' .. tostring(playerbets[i]))
3369 else
3370 bettext[v].setValue(' ')
3371 end
3372 else
3373 bettext[v].setValue(' ')
3374 end
3375 sidepottext[v].setValue(" ")
3376 if options.displayplayermoney then
3377 money = getChipValues(tablezones[v], chips)
3378 tablezonetext[v].setValue("$" .. money)
3379 bets = bets + playerbets[i]
3380 end
3381 end
3382
3383 for i, v in ipairs (potzones) do
3384 mainpot = mainpot + getChipValues(v, chips)
3385 end
3386 --mainpot = getChipValues(potzones[1], chips)
3387
3388 pot = bets + mainpot
3389
3390 -- print the pot value in chat
3391 if pot > prevpot then
3392 printstring = printstring..'pot'
3393 end
3394
3395 -- print the current bet in chat
3396 if currentbet > prevbet then
3397
3398 if prevbet == 0 then
3399 printstring = printstring..'bet'..better
3400 else
3401 printstring = printstring..'raise'..better
3402 end
3403
3404 end
3405
3406 -- display pot value on 3dtexts
3407
3408 pottext.setValue('Pot: $'..tostring(pot))
3409 currentbettext.setValue('Current bet: $'..tostring(currentbet))
3410
3411 printMessages()
3412
3413 return 1
3414
3415end
3416
3417function getChipValues(zone, chips)
3418
3419 local objects = zone.getObjects()
3420 local x = 0
3421
3422 for j, w in ipairs (objects) do
3423 if w.tag == 'Chip' and not objectExistsInList(chips, w) then
3424 if w.getQuantity() < 0 then
3425 if w.getValue() then
3426 x = x + w.getValue()
3427 chips[#chips + 1] = w
3428 elseif currencyToNumber(w.getName()) then
3429 x = x + currencyToNumber(w.getName())
3430 chips[#chips + 1] = w
3431 end
3432 else
3433 if w.getValue() then
3434 x = x + (w.getValue() * w.getQuantity())
3435 chips[#chips + 1] = w
3436 elseif currencyToNumber(w.getName()) then
3437 x = x + (currencyToNumber(w.getName()) * w.getQuantity())
3438 chips[#chips + 1] = w
3439 end
3440 end
3441 end
3442 end
3443
3444 return x
3445
3446end
3447
3448function resetBets()
3449 playerbets = {}
3450 for i, v in ipairs (players) do
3451 playerbets[i] = 0
3452 end
3453 currentbet = 0
3454end
3455
3456--[[ Spawn panel with host options buttons --]]
3457function spawnOptionsPanel(ob, pl)
3458
3459 if not Player[pl].admin then
3460 return 1
3461 end
3462
3463 if optionspanel then
3464 destroyOptionsPanel()
3465 return 1
3466 end
3467
3468 local params = {}
3469 params.type = 'Custom_Model'
3470 params.callback = 'optionsMain'
3471 params.position = { - 4.5, 4.45, - 25}
3472 params.scale = {2, 1, 2}
3473 params.rotation = {0, 180, 0}
3474
3475 optionspanel = spawnObject(params)
3476
3477 local custom = {}
3478 custom.mesh = 'http://pastebin.com/raw/avCFwn0Y'
3479 custom.collider = 'http://pastebin.com/raw/avCFwn0Y'
3480 custom.specular_intensity = 0
3481 custom.type = 4
3482
3483 optionspanel.setCustomObject(custom)
3484
3485 optionspanel.lock()
3486 optionspanel.interactable = false
3487 optionspanel.setColorTint({0, 0, 0})
3488
3489 startLuaCoroutine(nil, 'addSelfDestruct')
3490
3491end
3492
3493--[[ Add buttons to panel --]]
3494
3495function optionsMain(ob, pl)
3496
3497 if pl then
3498 if not Player[pl].admin then
3499 return 1
3500 end
3501 end
3502
3503 optionspanel.clearButtons()
3504
3505 if colorball ~= nil and colorball ~= null then
3506 colorball.destruct()
3507 end
3508
3509 local button = {}
3510
3511 button.width = 150
3512 button.height = 150
3513 button.label = '☒'
3514 button.font_size = 125
3515 button.click_function = 'destroyOptionsPanel'
3516 button.position = {1.75, 0.05, - 1.8}
3517 optionspanel.createButton(button)
3518
3519 button.width = 1000
3520 button.height = 200
3521 button.label = 'Host Settings'
3522 button.click_function = 'optionsHost'
3523 button.font_size = 150
3524 button.position = {0, 0.05, - 1.5}
3525
3526 optionspanel.createButton(button)
3527
3528 button.width = 1000
3529 button.height = 200
3530 button.label = 'Chat Settings'
3531 button.click_function = 'optionsChat'
3532 button.font_size = 150
3533 button.position = {0, 0.05, - 1}
3534 optionspanel.createButton(button)
3535
3536 button.width = 1000
3537 button.height = 200
3538 button.label = 'Themes'
3539 button.click_function = 'optionsThemes'
3540 button.font_size = 150
3541 button.position = {0, 0.05, - 0.5}
3542 optionspanel.createButton(button)
3543
3544 button.width = 1000
3545 button.height = 200
3546 button.label = 'Currencies'
3547 button.click_function = 'optionsCurrencies'
3548 button.font_size = 150
3549 button.position = {0, 0.05, 0}
3550 optionspanel.createButton(button)
3551
3552
3553
3554 button.label = 'Deal one card'
3555 button.width = 800
3556 button.font_size = 100
3557 button.position = { - 1, 0.05, 0.5}
3558 button.click_function = 'dealOneCard'
3559 optionspanel.createButton(button)
3560
3561 button.label = 'Clock'
3562 button.width = 800
3563 button.font_size = 150
3564 button.position = {1, 0.05, 0.5}
3565 button.click_function = 'spawnClock'
3566 optionspanel.createButton(button)
3567
3568 button.label = '«'
3569 button.width = 100
3570 button.height = 100
3571 button.font_size = 100
3572 button.click_function = 'decreaseClockTime5'
3573 button.position = {0.4, 0.05, 0.85}
3574 optionspanel.createButton(button)
3575
3576 button.label = '‹'
3577 button.click_function = 'decreaseClockTime1'
3578 button.position = {0.6, 0.05, 0.85}
3579 optionspanel.createButton(button)
3580
3581 button.label = tostring(options.clocktime)
3582 button.width = 300
3583 button.click_function = 'doNothing'
3584 button.position = {1, 0.05, 0.85}
3585 optionspanel.createButton(button)
3586
3587 button.label = '›'
3588 button.width = 100
3589 button.click_function = 'increaseClockTime1'
3590 button.position = {1.4, 0.05, 0.85}
3591 optionspanel.createButton(button)
3592
3593 button.label = '»'
3594 button.click_function = 'increaseClockTime5'
3595 button.position = {1.6, 0.05, 0.85}
3596 optionspanel.createButton(button)
3597
3598 button.label = 'Fold Player'
3599 button.width = 800
3600 button.height = 200
3601 button.font_size = 150
3602 button.position = {1, 0.05, 1.5}
3603 button.click_function = 'foldPlayer'
3604 optionspanel.createButton(button)
3605
3606 button.label = 'Set player Afk'
3607 button.width = 800
3608 button.font_size = 100
3609 button.position = { - 1, 0.05, 1}
3610 button.click_function = 'setPlayerAfk'
3611 optionspanel.createButton(button)
3612
3613 button.label = 'Reset Objects'
3614 button.font_size = 100
3615 button.click_function = 'checkAndRespawnObjects'
3616 button.position = { - 1.0, 0.05, 1.5}
3617 optionspanel.createButton(button)
3618
3619
3620
3621
3622
3623end
3624
3625function dealOneCard(ob, pl)
3626 if pl then
3627 if not Player[pl].admin and pl ~= actionon then
3628 return 1
3629 end
3630 end
3631
3632 if deck == nil or deck == null then
3633 for i, v in ipairs (getSeatedPlayers()) do
3634 if Player[v].admin then
3635 broadcastToColor('No deck assigned. Please assign a deck with the \'New Deck\' button.', v, {1, 0.3, 0.3})
3636 end
3637 end
3638 return 1
3639 end
3640
3641 if not dealing then
3642 if not handinprogress then
3643 players = getOrderedListOfPlayers()
3644 end
3645
3646 if not players then
3647 return 1
3648 end
3649
3650 onecard = true
3651 dealing = true
3652 startLuaCoroutine(nil, 'holeCoroutine')
3653 end
3654end
3655
3656--[[ If the rewind button is used while the options menu is open, the black square will remain and be non-interactable. This script is added to it so it self-destructs in that event. --]]
3657function addSelfDestruct()
3658 for i = 1, 5 do
3659 coroutine.yield(0)
3660 end
3661 if optionspanel ~= nil and optionspanel ~= null then
3662 optionspanel.setLuaScript('function onload() self.destruct() end')
3663 end
3664 return 1
3665end
3666
3667function optionsHost(ob, pl)
3668 if pl then
3669 if not Player[pl].admin then
3670 return 1
3671 end
3672 end
3673
3674 optionspanel.clearButtons()
3675
3676 local button = {}
3677 local s = ''
3678
3679 button.width = 150
3680 button.height = 150
3681 button.label = '☒'
3682 button.font_size = 125
3683 button.click_function = 'destroyOptionsPanel'
3684 button.position = {1.75, 0.05, - 1.8}
3685 optionspanel.createButton(button)
3686
3687 button.width = 150
3688 button.height = 150
3689 button.label = '◄'
3690 button.font_size = 125
3691 button.click_function = 'optionsMain'
3692 button.position = { - 1.75, 0.05, - 1.8}
3693 optionspanel.createButton(button)
3694
3695 if options.actiontoggle then
3696 button.label = '☑ Action'
3697 else
3698 button.label = '□ Action'
3699 end
3700 button.font_size = 75
3701 button.width = 350
3702 button.height = 100
3703 button.click_function = 'actionToggle'
3704 button.position = { - 1.5, 0.05, - 1.5}
3705 optionspanel.createButton(button)
3706
3707 if options.actiontoggle then
3708 if options.playerclickaction then
3709 button.label = '+Players'
3710 else
3711 button.label = '+Host'
3712 end
3713 button.width = 350
3714 button.font_size = 75
3715 button.click_function = 'togglePlayerClickAction'
3716 button.position = { - 1.5, 0.05, - 1.25}
3717 optionspanel.createButton(button)
3718
3719 if options.autoclock then
3720 button.label = '☑ Autoclock'
3721 else
3722 button.label = '□ Autoclock'
3723 end
3724 button.position = { - 1.35, 0.05, - 1.0}
3725 button.width = 500
3726 button.click_function = 'toggleAutoclock'
3727 optionspanel.createButton(button)
3728
3729 if options.autoclock then
3730 button.label = '‹'
3731 button.width = 100
3732 button.click_function = 'decreaseAutoclockTime'
3733 button.position = { - 1.7, 0.05, - 0.75}
3734 optionspanel.createButton(button)
3735
3736 button.label = tostring(options.autoclocktime)
3737 button.width = 200
3738 button.position = { - 1.35, 0.05, - 0.75}
3739 button.click_function = 'doNothing'
3740 optionspanel.createButton(button)
3741
3742 button.label = '›'
3743 button.width = 100
3744 button.click_function = 'increaseAutoclockTime'
3745 button.position = { - 1.0, 0.05, - 0.75}
3746 optionspanel.createButton(button)
3747
3748 if options.clockpausebutton then
3749 button.label = '☑ Pause button'
3750 else
3751 button.label = '□ Pause button'
3752 end
3753 button.width = 600
3754 button.position = { - 1.35, 0.05, - 0.5}
3755 button.click_function = 'toggleAutoclockPauseButton'
3756 optionspanel.createButton(button)
3757 end
3758
3759 if options.autofold then
3760 button.label = '☑ Autofold'
3761 else
3762 button.label = '□ Autofold'
3763 end
3764 button.width = 500
3765 button.position = { - 0.35, 0.05, - 1.0}
3766 button.click_function = 'toggleAutofold'
3767 optionspanel.createButton(button)
3768 end
3769
3770 if options.collectmethod == 'move' then
3771 button.label = 'Collect method: Move'
3772 button.width = 800
3773 elseif options.collectmethod == 'convert' then
3774 button.label = 'Collect method: Convert'
3775 button.width = 850
3776 elseif options.collectmethod == 'hybrid' then
3777 button.label = 'Collect method: Hybrid:'
3778 button.width = 850
3779 else
3780 button.label = options.collectmethod
3781 button.width = 800
3782 end
3783 button.click_function = 'changeCollectMethod'
3784 button.position = { - 1, 0.05, 0}
3785 optionspanel.createButton(button)
3786
3787 if options.collectmethod == 'hybrid' then
3788 button.label = '«'
3789 button.width = 100
3790 button.click_function = 'decreaseHybridThreshold1000'
3791 button.position = {0.0, 0.05, 0}
3792 optionspanel.createButton(button)
3793
3794 button.label = '‹'
3795 button.click_function = 'decreaseHybridThreshold100'
3796 button.position = {0.2, 0.05, 0}
3797 optionspanel.createButton(button)
3798
3799 button.label = '$'..tostring(options.hybridthreshold)
3800 button.width = 350
3801 button.click_function = 'doNothing'
3802 button.position = {0.65, 0.05, 0}
3803 optionspanel.createButton(button)
3804
3805 button.label = '›'
3806 button.width = 100
3807 button.click_function = 'increaseHybridThreshold100'
3808 button.position = {1.1, 0.05, 0}
3809 optionspanel.createButton(button)
3810
3811 button.label = '»'
3812 button.click_function = 'increaseHybridThreshold1000'
3813 button.position = {1.3, 0.05, 0}
3814 optionspanel.createButton(button)
3815 end
3816
3817 if options.collectmethod == 'convert' or options.collectmethod == 'hybrid' then
3818
3819 button.label = 'Minimum Stack Height:'
3820 button.width = 850
3821 button.click_function = 'doNothing'
3822 button.position = { - 1, 0.05, 0.25}
3823 optionspanel.createButton(button)
3824
3825 button.width = 100
3826 button.label = '‹'
3827 button.click_function = 'decreaseConvertStackHeight1'
3828 button.position = {0.2, 0.05, 0.25}
3829 optionspanel.createButton(button)
3830
3831 button.label = tostring(options.convertstackheight)
3832 button.width = 350
3833 button.click_function = 'doNothing'
3834 button.position = {0.65, 0.05, 0.25}
3835 optionspanel.createButton(button)
3836
3837 button.label = '›'
3838 button.width = 100
3839 button.click_function = 'increaseConvertStackHeight1'
3840 button.position = {1.1, 0.05, 0.25}
3841 optionspanel.createButton(button)
3842 end
3843
3844
3845 if options.blindsskipafk then
3846 button.label = '☑ Blinds Skip AFK'
3847 else
3848 button.label = '□ Blinds Skip AFK'
3849 end
3850 button.width = 650
3851 button.click_function = 'toggleBlindsSkipAFK'
3852 button.position = { - 0.375, 0.05, - 1.5}
3853 optionspanel.createButton(button)
3854
3855 if options.gamemode == 'omaha' then
3856 s = '►'
3857 else
3858 s = ''
3859 end
3860 button.label = s..'Omaha Hold\'em'
3861 button.width = 650
3862 button.click_function = 'setGameModeOmaha'
3863 button.position = {1.0, 0.05, - 1.0}
3864 optionspanel.createButton(button)
3865
3866 if options.gamemode == 'pineapple' then
3867 s = '►'
3868 else
3869 s = ''
3870 end
3871 button.label = s..'Pineapple'
3872 button.width = 700
3873 button.click_function = 'setGameModePineapple'
3874 button.position = {1.0, 0.05, - 1.25}
3875 optionspanel.createButton(button)
3876
3877 if options.gamemode == 'texas' then
3878 s = '►'
3879 else
3880 s = ''
3881 end
3882 button.label = s..'Texas Hold\'em'
3883 button.width = 600
3884 button.click_function = 'setGameModeTexas'
3885 button.position = {1.0, 0.05, - 1.5}
3886 optionspanel.createButton(button)
3887
3888 if options.displayplayerbet then
3889 button.label = '☑ Display Player Bets'
3890 else
3891 button.label = '□ Display Player Bet'
3892 end
3893 button.width = 1000
3894 button.click_function = 'toggleDisplayPlayerBet'
3895 button.position = { - 1, 0.05, 0.6}
3896 optionspanel.createButton(button)
3897
3898 if options.displayplayermoney then
3899 button.label = '☑ Display Player Money'
3900 else
3901 button.label = '□ Display Player Money'
3902 end
3903 button.width = 1000
3904 button.click_function = 'toggleDisplayPlayerMoney'
3905 button.position = { - 1, 0.05, 0.8}
3906 optionspanel.createButton(button)
3907
3908 if options.changemachine then
3909 button.label = '☑ change Machine'
3910 else
3911 button.label = '□ change Machine'
3912 end
3913 button.width = 1000
3914 button.click_function = 'togglechangeMachine'
3915 button.position = { - 1, 0.05, 1}
3916 optionspanel.createButton(button)
3917
3918
3919 if options.playerbuttons.sortchips then
3920 button.label = '☑ Display Sort Chips Button'
3921 else
3922 button.label = '□ Display Sort Chips Button'
3923 end
3924 button.width = 1000
3925 button.click_function = 'toggleDisplaySortChips'
3926 button.position = {1, 0.05, 0.6}
3927 optionspanel.createButton(button)
3928
3929
3930 if options.playerbuttons.convert then
3931 button.label = '☑ Display Convert Button'
3932 else
3933 button.label = '□ Display Convert Button'
3934 end
3935 button.width = 1000
3936 button.click_function = 'toggleDisplayConvert'
3937 button.position = {1, 0.05, 0.8}
3938 optionspanel.createButton(button)
3939
3940 if options.playerbuttons.allin then
3941 button.label = '☑ Display AllIn Button'
3942 else
3943 button.label = '□ Display AllIn Button'
3944 end
3945 button.width = 1000
3946 button.click_function = 'toggleDisplayAllIn'
3947 button.position = {1, 0.05, 1}
3948 optionspanel.createButton(button)
3949
3950 if options.playerbuttons.afk then
3951 button.label = '☑ Display AFK Button'
3952 else
3953 button.label = '□ Display AFK Button'
3954 end
3955 button.width = 1000
3956 button.click_function = 'toggleDisplayAFK'
3957 button.position = {1, 0.05, 1.2}
3958 optionspanel.createButton(button)
3959
3960
3961 if options.playerbuttons.loadsavebag then
3962 button.label = '☑ Display Load Save Button'
3963 else
3964 button.label = '□ Display Load Save Button'
3965 end
3966 button.width = 1000
3967 button.click_function = 'toggleLoadSaves'
3968 button.position = {1, 0.05, 1.4}
3969 optionspanel.createButton(button)
3970
3971end
3972
3973
3974
3975function optionsChat(ob, pl)
3976
3977 if pl then
3978 if not Player[pl].admin then
3979 return 1
3980 end
3981 end
3982
3983 optionspanel.clearButtons()
3984
3985 local button = {}
3986
3987 button.width = 150
3988 button.height = 150
3989 button.label = '☒'
3990 button.font_size = 125
3991 button.click_function = 'destroyOptionsPanel'
3992 button.position = {1.75, 0.05, - 1.8}
3993 optionspanel.createButton(button)
3994
3995 button.width = 150
3996 button.height = 150
3997 button.label = '◄'
3998 button.font_size = 125
3999 button.click_function = 'optionsMain'
4000 button.position = { - 1.75, 0.05, - 1.8}
4001 optionspanel.createButton(button)
4002
4003 button.width = 650
4004 button.height = 150
4005 button.font_size = 75
4006 if options.chatoptions.actionmessage then
4007 button.label = '☑ Action message'
4008 else
4009 button.label = '□ Action message'
4010 end
4011 button.click_function = 'toggleActionMessage'
4012 button.position = { - 1.0, 0.05, - 1.5}
4013 optionspanel.createButton(button)
4014
4015 button.width = 700
4016 button.height = 150
4017 button.font_size = 75
4018 if options.chatoptions.actionbroadcast then
4019 button.label = '☑ Action broadcast'
4020 else
4021 button.label = '□ Action broadcast'
4022 end
4023 button.click_function = 'toggleActionBroadcast'
4024 button.position = { - 1.0, 0.05, - 1.25}
4025 optionspanel.createButton(button)
4026
4027 button.width = 600
4028 button.height = 150
4029 button.font_size = 75
4030 if options.chatoptions.currentbetmessage then
4031 button.label = '☑ Current bet'
4032 else
4033 button.label = '□ Current bet'
4034 end
4035 button.click_function = 'toggleCurrentBetMessage'
4036 button.position = {1.0, 0.05, - 1.5}
4037 optionspanel.createButton(button)
4038
4039 button.width = 600
4040 button.height = 150
4041 button.font_size = 75
4042 if options.chatoptions.better then
4043 button.label = '☑ └Better/raiser'
4044 else
4045 button.label = '□ └Better/raiser'
4046 end
4047 button.click_function = 'toggleBetter'
4048 button.position = {1.0, 0.05, - 1.25}
4049 if options.chatoptions.currentbetmessage then
4050 optionspanel.createButton(button)
4051 end
4052
4053 button.width = 700
4054 button.height = 150
4055 button.font_size = 75
4056 if options.chatoptions.allinbroadcast then
4057 button.label = '☑ All-in broadcast'
4058 else
4059 button.label = '□ All-in broadcast'
4060 end
4061 button.click_function = 'toggleAllinBroadcast'
4062 button.position = {1.0, 0.05, - 1.0}
4063 optionspanel.createButton(button)
4064
4065 button.height = 150
4066 button.font_size = 75
4067 if options.chatoptions.potmessage == 0 then
4068 button.width = 700
4069 button.label = 'Pot message: Off'
4070 elseif options.chatoptions.potmessage == 1 then
4071 button.width = 1000
4072 button.label = 'Pot message: On collect only'
4073 elseif options.chatoptions.potmessage == 2 then
4074 button.width = 900
4075 button.label = 'Pot message: On change'
4076 end
4077 button.click_function = 'togglePotMessage'
4078 button.position = {1.0, 0.05, - 0.75}
4079 optionspanel.createButton(button)
4080
4081 button.width = 850
4082 button.height = 150
4083 button.font_size = 75
4084 if options.chatoptions.stage then
4085 button.label = '☑ Game stage broadcast'
4086 else
4087 button.label = '□ Game stage broadcast'
4088 end
4089 button.click_function = 'toggleStageBroadcast'
4090 button.position = { - 1.0, 0.05, - 1.0}
4091 optionspanel.createButton(button)
4092
4093end
4094
4095function optionsThemes(ob, pl)
4096 if pl then
4097 if not Player[pl].admin then
4098 return 1
4099 end
4100 end
4101 optionspanel.clearButtons()
4102
4103 local button = {}
4104
4105 button.width = 150
4106 button.height = 150
4107 button.label = '☒'
4108 button.font_size = 125
4109 button.click_function = 'destroyOptionsPanel'
4110 button.position = {1.75, 0.05, - 1.8}
4111 optionspanel.createButton(button)
4112
4113 button.width = 150
4114 button.height = 150
4115 button.label = '◄'
4116 button.font_size = 125
4117 button.click_function = 'optionsMain'
4118 button.position = { - 1.75, 0.05, - 1.8}
4119 optionspanel.createButton(button)
4120
4121 button.label = 'Set Font Color'
4122 button.width = 600
4123 button.font_size = 75
4124 button.click_function = 'changeFontColor'
4125 button.position = { - 0.75, 0.05, - 1.75}
4126 optionspanel.createButton(button)
4127
4128 button.label = 'Set Overlay Color'
4129 button.width = 600
4130 button.click_function = 'changeTableColor'
4131 button.position = {0.75, 0.05, - 1.75}
4132 optionspanel.createButton(button)
4133
4134 button.label = 'Darken Overlay'
4135 button.width = 600
4136 button.click_function = 'darkenOverlay'
4137 button.position = { - 0.75, 0.05, - 1.5}
4138 optionspanel.createButton(button)
4139
4140 button.label = 'Lighten Overlay'
4141 button.width = 600
4142 button.click_function = 'lightenOverlay'
4143 button.position = {0.75, 0.05, - 1.5}
4144 optionspanel.createButton(button)
4145
4146
4147
4148 --[[ spawn theme buttons --]]
4149 for i, v in ipairs (themes) do
4150 local s = ''
4151 if i == themeindex then
4152 s = '►'
4153 end
4154 button.width = (((string.len(themes[i].label) + string.len(s)) * 40) + 0 )
4155 button.height = 100
4156 button.font_size = 65
4157 button.label = themes[i].label..s
4158 button.click_function = 'setTheme'..tostring(i)
4159 button.position = { - 1.75, 0.05, (-1 + ((i - 1) * 0.25))}
4160 optionspanel.createButton(button)
4161 end
4162
4163 --[[ spawn subtheme buttons --]]
4164 for i, v in ipairs (themes[themeindex]) do
4165 local s = ''
4166 if i == subthemeindex then
4167 s = '►'
4168 end
4169 button.width = (((string.len(themes[themeindex][i].label) + string.len(s)) * 40) + 0)
4170 button.height = 100
4171 button.label = themes[themeindex][i].label..s
4172 button.click_function = 'setSubtheme'..tostring(i)
4173 button.position = { - 0.75, 0.05, (-1 + ((i - 1) * 0.25))}
4174 optionspanel.createButton(button)
4175 end
4176
4177 --[[ spawn diffuse buttons --]]
4178 for i, v in ipairs (themes[themeindex][subthemeindex]) do
4179 button.width = ((string.len(themes[themeindex][subthemeindex][i].label) * 35) + 0)
4180 button.height = 100
4181 button.label = themes[themeindex][subthemeindex][i].label
4182 button.click_function = 'overlay'..tostring(i)
4183 button.position = {1, 0.05, (-1 + ((i - 1) * 0.25))}
4184 optionspanel.createButton(button)
4185 end
4186
4187 if colorball == nil or colorball == null then
4188 local params = {}
4189 local p = optionspanel.getPosition()
4190 params.position = {p.x, p.y, p.z + 3.5}
4191 params.type = 'go_game_piece_white'
4192 params.scale = {0.5, 0.5, 0.5}
4193
4194 colorball = spawnObject(params)
4195 local color = pottext.TextTool.getFontColor()
4196 colorball.lock()
4197 colorball.setColorTint(color)
4198 colorball.setDescription('Change my color tint, then click \'Font Color\' button to change color of text fonts.')
4199 end
4200
4201end
4202
4203function toggleDisplayConvert(ob, pl)
4204 if pl then
4205 if not Player[pl].admin then
4206 return 1
4207 end
4208 end
4209 options.playerbuttons.convert = not options.playerbuttons.convert
4210 createPlayerButtons()
4211 optionsHost()
4212end
4213
4214function toggleDisplaySortChips(ob, pl)
4215 if pl then
4216 if not Player[pl].admin then
4217 return 1
4218 end
4219 end
4220 options.playerbuttons.sortchips = not options.playerbuttons.sortchips
4221 createPlayerButtons()
4222 optionsHost()
4223end
4224
4225function toggleDisplayAllIn(ob, pl)
4226 if pl then
4227 if not Player[pl].admin then
4228 return 1
4229 end
4230 end
4231 options.playerbuttons.allin = not options.playerbuttons.allin
4232 createPlayerButtons()
4233 optionsHost()
4234end
4235
4236function toggleDisplayAFK(ob, pl)
4237 if pl then
4238 if not Player[pl].admin then
4239 return 1
4240 end
4241 end
4242 options.playerbuttons.afk = not options.playerbuttons.afk
4243 createPlayerButtons()
4244 optionsHost()
4245end
4246
4247function toggleDisplayPlayerBet(ob, pl)
4248 if pl then
4249 if not Player[pl].admin then
4250 return 1
4251 end
4252 end
4253 options.displayplayerbet = not options.displayplayerbet
4254 calculatePots()
4255 optionsHost()
4256end
4257
4258function toggleLoadSaves(ob, pl)
4259 if pl then
4260 if not Player[pl].admin then
4261 return 1
4262 end
4263 end
4264 options.playerbuttons.loadsavebag = not options.playerbuttons.loadsavebag
4265 createPlayerButtons()
4266 optionsHost()
4267end
4268
4269function togglechangeMachine(ob, pl)
4270 if pl then
4271 if not Player[pl].admin then
4272 return 1
4273 end
4274 end
4275 options.changemachine = not options.changemachine
4276
4277 for i, v in ipairs(getAllObjects()) do
4278 if v.getName() == 'Back Table' then
4279 v.clearButtons()
4280 if options.changemachine then
4281 local offsetx = 2 / #currencies
4282 local button = {}
4283
4284 if #currencies <= 10 then
4285 offsetx = 1.65 / (#currencies - 2)
4286 else
4287 offsetx = 1.65 / 8
4288 end
4289 local offsety = 2 / #currencies
4290 button.font_size = 150
4291 button.width = 450
4292 button.height = 250
4293 button.scale = {1 / 5, 1 / 5, 1 / 7.5}
4294 button.position = {0.83, - 0.1, - 0.9}
4295 button.rotation = {180, 0, 0}
4296
4297 for j, w in ipairs(currencies) do
4298 if w.value ~= -1 then
4299 button.label = w.label
4300 button.click_function = 'changeMachineButton' .. j
4301 v.createButton(button)
4302 button.position[1] = button.position[1] - offsetx
4303 end
4304 if j == 9 then
4305 if #currencies - 11 > 0 then
4306 offsetx = 1.65 / (#currencies - 11)
4307 button.position = {0.83, - 0.1, - 0.8} -- spawn 1 button in the center
4308 else
4309 button.position = {0, - 0.1, - 0.8} -- spawn 1 button in the center
4310 end
4311 end
4312 end
4313 end
4314 end
4315 end
4316
4317
4318 optionsHost()
4319end
4320
4321function toggleDisplayPlayerMoney(ob, pl)
4322 if pl then
4323 if not Player[pl].admin then
4324 return 1
4325 end
4326 end
4327 options.displayplayermoney = not options.displayplayermoney
4328
4329 if options.displayplayermoney then
4330 for i, v in ipairs (colors) do
4331 money = getChipValues(tablezones[v], chips)
4332 tablezonetext[v].setValue("$" .. money)
4333
4334 end
4335 else
4336 for i, v in ipairs (colors) do
4337 tablezonetext[v].setValue(" ")
4338 end
4339 end
4340 optionsHost()
4341end
4342
4343
4344
4345function optionsCurrencies(ob, pl)
4346 if pl then
4347 if not Player[pl].admin then
4348 return 1
4349 end
4350 end
4351 optionspanel.clearButtons()
4352
4353 local button = {}
4354
4355 button.width = 150
4356 button.height = 150
4357 button.label = '☒'
4358 button.font_size = 125
4359 button.click_function = 'destroyOptionsPanel'
4360 button.position = {1.75, 0.05, - 1.8}
4361 optionspanel.createButton(button)
4362
4363 button.width = 150
4364 button.height = 150
4365 button.label = '◄'
4366 button.font_size = 125
4367 button.click_function = 'optionsMain'
4368 button.position = { - 1.75, 0.05, - 1.8}
4369 optionspanel.createButton(button)
4370
4371 --[[ spawn currencies buttons --]]
4372
4373 button.width = 500
4374 button.height = 100
4375 button.font_size = 100
4376 button.label = "Currency"
4377 button.click_function = 'doNothing'
4378 button.position = { - 1.25, 0.05, - 1.55 }
4379 optionspanel.createButton(button)
4380
4381 button.width = 500
4382 button.height = 100
4383 button.font_size = 100
4384 button.label = "Layout"
4385 button.click_function = 'doNothing'
4386 button.position = {1, 0.05, - 1.55 }
4387 optionspanel.createButton(button)
4388
4389
4390 button.position = { - 1.25, 0.05, - 1.25 }
4391 local c = 0
4392 for i, v in pairs (currenciesSelectionStacklayout ) do
4393 c = c + 1
4394 local s = ''
4395 if i == options.currencies then
4396 s = '►'
4397 end
4398 button.width = (((string.len(i) + string.len(s)) * 30) + 40 )
4399 button.height = 100
4400 button.font_size = 65
4401 button.label = i..s
4402 button.click_function = 'changeCurrencies' .. c
4403 button.position[3] = button.position[3] + 0.25
4404 optionspanel.createButton(button)
4405 if i == options.currencies then
4406 for j, w in ipairs (v) do
4407 local s = ''
4408 if w == options.stacklayout then
4409 s = '►'
4410 end
4411 local button2 = {}
4412 button2.width = (((string.len(w) + string.len(s)) * 30) + 40)
4413 button2.font_size = 65
4414 button2.height = 100
4415 button2.label = w..s
4416 button2.click_function = 'setStacklayout' .. j
4417 button2.position = {1, 0.05, (-1 + ((j - 1) * 0.25))}
4418 optionspanel.createButton(button2)
4419 end
4420 end
4421 end
4422end
4423
4424
4425
4426function setStacklayout1(ob, pl)
4427 if pl then
4428 if not Player[pl].admin then
4429 return 1
4430 end
4431 end
4432 options.stacklayout = currenciesSelectionStacklayout[options.currencies][1]
4433 optionsCurrencies()
4434end
4435
4436function setStacklayout2(ob, pl)
4437 if pl then
4438 if not Player[pl].admin then
4439 return 1
4440 end
4441 end
4442 options.stacklayout = currenciesSelectionStacklayout[options.currencies][2]
4443 optionsCurrencies()
4444end
4445
4446function setStacklayout3(ob, pl)
4447 if pl then
4448 if not Player[pl].admin then
4449 return 1
4450 end
4451 end
4452 options.stacklayout = currenciesSelectionStacklayout[options.currencies][3]
4453 optionsCurrencies()
4454end
4455
4456function setStacklayout4(ob, pl)
4457 if pl then
4458 if not Player[pl].admin then
4459 return 1
4460 end
4461 end
4462 options.stacklayout = currenciesSelectionStacklayout[options.currencies][4]
4463 optionsCurrencies()
4464end
4465function setStacklayout5(ob, pl)
4466 if pl then
4467 if not Player[pl].admin then
4468 return 1
4469 end
4470 end
4471 options.stacklayout = currenciesSelectionStacklayout[options.currencies][5]
4472 optionsCurrencies()
4473end
4474function setStacklayout6(ob, pl)
4475 if pl then
4476 if not Player[pl].admin then
4477 return 1
4478 end
4479 end
4480 options.stacklayout = currenciesSelectionStacklayout[options.currencies][6]
4481 optionsCurrencies()
4482end
4483function setStacklayout7(ob, pl)
4484 if pl then
4485 if not Player[pl].admin then
4486 return 1
4487 end
4488 end
4489 options.stacklayout = currenciesSelectionStacklayout[options.currencies][7]
4490 optionsCurrencies()
4491end
4492function setStacklayout8(ob, pl)
4493 if pl then
4494 if not Player[pl].admin then
4495 return 1
4496 end
4497 end
4498 options.stacklayout = currenciesSelectionStacklayout[options.currencies][8]
4499 optionsCurrencies()
4500end
4501
4502function setStacklayout9(ob, pl)
4503 if pl then
4504 if not Player[pl].admin then
4505 return 1
4506 end
4507 end
4508 options.stacklayout = currenciesSelectionStacklayout[options.currencies][9]
4509 optionsCurrencies()
4510end
4511
4512function setStacklayout10(ob, pl)
4513 if pl then
4514 if not Player[pl].admin then
4515 return 1
4516 end
4517 end
4518 options.stacklayout = currenciesSelectionStacklayout[options.currencies][10]
4519 optionsCurrencies()
4520end
4521
4522
4523function changeCurrencies1(ob, pl)
4524 if pl then
4525 if not Player[pl].admin then
4526 return 1
4527 end
4528 end
4529 changeCurrenciesCo(1)
4530end
4531
4532function changeCurrencies2(ob, pl)
4533 if pl then
4534 if not Player[pl].admin then
4535 return 1
4536 end
4537 end
4538
4539 changeCurrenciesCo(2)
4540end
4541
4542
4543function changeCurrencies3(ob, pl)
4544 if pl then
4545 if not Player[pl].admin then
4546 return 1
4547 end
4548 end
4549
4550 changeCurrenciesCo(3)
4551end
4552
4553function changeCurrencies4(ob, pl)
4554 if pl then
4555 if not Player[pl].admin then
4556 return 1
4557 end
4558 end
4559
4560 changeCurrenciesCo(4)
4561end
4562
4563function changeCurrencies5(ob, pl)
4564 if pl then
4565 if not Player[pl].admin then
4566 return 1
4567 end
4568 end
4569
4570 changeCurrenciesCo(5)
4571end
4572
4573function changeCurrencies6(ob, pl)
4574 if pl then
4575 if not Player[pl].admin then
4576 return 1
4577 end
4578 end
4579
4580 changeCurrenciesCo(6)
4581end
4582
4583function changeCurrencies7(ob, pl)
4584 if pl then
4585 if not Player[pl].admin then
4586 return 1
4587 end
4588 end
4589
4590 changeCurrenciesCo(7)
4591end
4592
4593function changeCurrencies8(ob, pl)
4594 if pl then
4595 if not Player[pl].admin then
4596 return 1
4597 end
4598 end
4599
4600 changeCurrenciesCo(8)
4601end
4602
4603function changeCurrencies9(ob, pl)
4604 if pl then
4605 if not Player[pl].admin then
4606 return 1
4607 end
4608 end
4609
4610 changeCurrenciesCo(9)
4611end
4612
4613
4614
4615function changeCurrencies10(ob, pl)
4616 if pl then
4617 if not Player[pl].admin then
4618 return 1
4619 end
4620 end
4621
4622 changeCurrenciesCo(10)
4623end
4624
4625function changeCurrencies11(ob, pl)
4626 if pl then
4627 if not Player[pl].admin then
4628 return 1
4629 end
4630 end
4631
4632 changeCurrenciesCo(11)
4633end
4634
4635function changeCurrencies12(ob, pl)
4636 if pl then
4637 if not Player[pl].admin then
4638 return 1
4639 end
4640 end
4641
4642 changeCurrenciesCo(12)
4643end
4644
4645function changeCurrencies13(ob, pl)
4646 if pl then
4647 if not Player[pl].admin then
4648 return 1
4649 end
4650 end
4651
4652 changeCurrenciesCo(13)
4653end
4654
4655function changeCurrencies14(ob, pl)
4656 if pl then
4657 if not Player[pl].admin then
4658 return 1
4659 end
4660 end
4661
4662 changeCurrenciesCo(14)
4663end
4664
4665function changeCurrencies15(ob, pl)
4666 if pl then
4667 if not Player[pl].admin then
4668 return 1
4669 end
4670 end
4671
4672 changeCurrenciesCo(15)
4673end
4674
4675function changeCurrencies16(ob, pl)
4676 if pl then
4677 if not Player[pl].admin then
4678 return 1
4679 end
4680 end
4681
4682 changeCurrenciesCo(16)
4683end
4684
4685
4686function changeCurrencies16(ob, pl)
4687 if pl then
4688 if not Player[pl].admin then
4689 return 1
4690 end
4691 end
4692
4693 changeCurrenciesCo(16)
4694end
4695
4696
4697function changeCurrencies17(ob, pl)
4698 if pl then
4699 if not Player[pl].admin then
4700 return 1
4701 end
4702 end
4703
4704 changeCurrenciesCo(17)
4705end
4706
4707
4708function changeCurrencies18(ob, pl)
4709 if pl then
4710 if not Player[pl].admin then
4711 return 1
4712 end
4713 end
4714
4715 changeCurrenciesCo(18)
4716end
4717
4718
4719function changeCurrencies19(ob, pl)
4720 if pl then
4721 if not Player[pl].admin then
4722 return 1
4723 end
4724 end
4725
4726 changeCurrenciesCo(19)
4727end
4728
4729function changeCurrenciesCo(number)
4730 c = 0
4731 for i, v in pairs (currenciesSelectionStacklayout ) do
4732 c = c + 1
4733 if(c == number) then
4734 options.currencies = i
4735 options.stacklayout = v[1]
4736 currencies = currenciesSelection[i]
4737 end
4738 end
4739
4740 for i, v in ipairs(getAllObjects()) do
4741 -- Update Buttons
4742 if v.getName() == 'Back Table' then
4743 v.clearButtons()
4744 if options.changemachine then
4745 local offsetx = 2 / #currencies
4746 local button = {}
4747
4748 if #currencies <= 10 then
4749 offsetx = 1.65 / (#currencies - 2)
4750 else
4751 offsetx = 1.65 / 8
4752 end
4753 local offsety = 2 / #currencies
4754 button.font_size = 150
4755 button.width = 450
4756 button.height = 250
4757 button.scale = {1 / 5, 1 / 5, 1 / 7.5}
4758 button.position = {0.83, - 0.1, - 0.9}
4759 button.rotation = {180, 0, 0}
4760
4761 for j, w in ipairs(currencies) do
4762 if w.value ~= -1 then
4763 button.label = w.label
4764 button.click_function = 'changeMachineButton' .. j
4765 v.createButton(button)
4766 button.position[1] = button.position[1] - offsetx
4767 end
4768 if j == 9 then
4769 if #currencies - 11 > 0 then
4770 offsetx = 1.65 / (#currencies - 11)
4771 button.position = {0.83, - 0.1, - 0.8} -- spawn 1 button in the center
4772 else
4773 button.position = {0, - 0.1, - 0.8} -- spawn 1 button in the center
4774 end
4775 end
4776 end
4777 end
4778
4779 end
4780 -- Delete Old Infinite Money Bags
4781 if v.getDescription() == 'Infinite Money Bag' then
4782 v.destruct()
4783 end
4784 end
4785
4786
4787 -- spawn infinite Bags
4788 local params = {}
4789 local posx = 2
4790 local posy = 2.2
4791 local posz = -23
4792
4793 local offsetx = 4
4794 local offsetz = -1.7
4795
4796
4797 for i, v in ipairs (currencies) do
4798 if v.value == -1 then
4799 break -- no dummy chips spawn
4800 end
4801 if not v.standard then
4802 params.position = {}
4803 params.position.x = posx + offsetx * ((i - 1) % 2)
4804 params.position.y = posy
4805 params.position.z = posz + offsetz * math.floor((i - 1) / 2)
4806 --rPrint(params.position,100,i .. ": ")
4807 params.position[1] = params.position.x
4808 params.position[2] = params.position.y
4809 params.position[3] = params.position.z
4810
4811
4812 params.rotation = v.params.rotation
4813 params.rotation[2] = (params.rotation[2] + 180) % 360
4814 params.scale = v.params.scale
4815 params.params = {v.name}
4816 params.type = 'Custom_Model'
4817 params.callback = ''
4818 params.callback_owner = Global
4819 custom = {}
4820 custom.mesh = v.custom.mesh
4821 custom.diffuse = v.custom.diffuse
4822 custom.type = 7 -- infinite
4823 custom.material = 1
4824
4825 obj = spawnObject(params)
4826 obj.setCustomObject(custom)
4827 obj.setName(v.name)
4828 obj.setDescription("Infinite Money Bag")
4829
4830
4831 -- let chip fall into bag
4832 params.position.y = posy + 3
4833 params.position[2] = posy + 3
4834 custom.type = 5 -- chip
4835 obj = spawnObject(params)
4836 obj.setCustomObject(custom)
4837 obj.setName(v.name)
4838 end
4839 end
4840
4841
4842
4843
4844
4845 optionsCurrencies()
4846end
4847
4848
4849function spawnClock(ob, pl)
4850 if pl then
4851 if not Player[pl].admin then
4852 return 1
4853 end
4854 end
4855
4856 if clock ~= nil and clock ~= null then
4857 if pl then
4858 clock.Clock.setValue(options.clocktime + 1)
4859 clock.Clock.pauseStart()
4860 clock.clearButtons()
4861 end
4862 return 1
4863 end
4864
4865 local params = {}
4866 if actionon then
4867 local playerhand = getPlayerHandPositionAndRotation(actionon)
4868
4869 params.position = {playerhand['pos_x'] + playerhand['trigger_forward_x'] * 8, 0.5, playerhand['pos_z'] + playerhand['trigger_forward_z'] * 8}
4870 params.rotation = {90, playerhand['rot_y'], 0}
4871 else
4872 params.position = {0, 0.5, - 4}
4873 params.rotation = {90, 180, 0}
4874 end
4875
4876 params.type = 'Digital_Clock'
4877 params.callback = 'setClockTimer'
4878 if pl then
4879 params.params = {pl}
4880 else
4881 params.params = nil
4882 end
4883
4884 clock = spawnObject(params)
4885
4886end
4887
4888function setClockTimer(ob, pl)
4889 clock.lock()
4890
4891 if pl then
4892 clock.Clock.setValue(options.clocktime + 1)
4893 else
4894 clock.Clock.setValue(options.autoclocktime + 1)
4895 end
4896
4897 clock.Clock.pauseStart()
4898
4899 if options.autoclock and options.clockpausebutton and not pl then
4900 local button = {}
4901 button.rotation = {90, 180, 0}
4902 button.position = { - 0.3, 0.5, - 0.15}
4903 button.font_size = 60
4904 button.width = 200
4905 button.height = 50
4906 button.label = 'Pause'
4907 button.click_function = 'pauseClock'
4908 clock.createButton(button)
4909 end
4910 startLuaCoroutine(nil, 'setClockTimerCoroutine')
4911end
4912
4913function setClockTimerCoroutine()
4914
4915 local clockGUID = clock.getGUID()
4916
4917 while clock ~= nil and clock ~= null and clock.Clock.getValue() > 0 do
4918 coroutine.yield(0)
4919 end
4920
4921 local t = os.clock()
4922
4923 while os.clock() < t + 1 do
4924 coroutine.yield(0)
4925 end
4926
4927 if clock ~= nil and clock ~= null then
4928 if clockGUID ~= clock.getGUID() then
4929 return 1
4930 end
4931 else
4932 return 1
4933 end
4934
4935 if options.autofold then
4936 foldPlayer()
4937 end
4938
4939 clock.destruct()
4940
4941 return 1
4942end
4943
4944function toggleAutoclock(ob, pl)
4945 if not Player[pl].admin then
4946 return 1
4947 end
4948
4949 options.autoclock = not options.autoclock
4950 optionsHost()
4951end
4952
4953function toggleAutofold(ob, pl)
4954 if not Player[pl].admin then
4955 return 1
4956 end
4957
4958 options.autofold = not options.autofold
4959 optionsHost()
4960end
4961
4962function decreaseAutoclockTime(ob, pl)
4963 if not Player[pl].admin then
4964 return 1
4965 end
4966
4967 if options.autoclocktime > 1 then
4968 options.autoclocktime = options.autoclocktime - 1
4969 end
4970 optionsHost()
4971end
4972
4973function increaseAutoclockTime(ob, pl)
4974 if not Player[pl].admin then
4975 return 1
4976 end
4977
4978 options.autoclocktime = options.autoclocktime + 1
4979 optionsHost()
4980end
4981
4982function toggleAutoclockPauseButton(ob, pl)
4983 if not Player[pl].admin then
4984 return 1
4985 end
4986
4987 options.clockpausebutton = not options.clockpausebutton
4988 optionsHost()
4989end
4990
4991function pauseClock(ob, pl)
4992 if not Player[pl].admin and pl ~= actionon then
4993 return 1
4994 end
4995
4996 clock.Clock.pauseStart()
4997end
4998
4999function decreaseClockTime5(ob, pl)
5000 if not Player[pl].admin then
5001 return 1
5002 end
5003
5004 if options.clocktime > 5 then
5005 options.clocktime = options.clocktime - 5
5006 else
5007 return 1
5008 end
5009
5010 optionsMain()
5011end
5012function decreaseClockTime1(ob, pl)
5013 if not Player[pl].admin then
5014 return 1
5015 end
5016
5017 if options.clocktime > 1 then
5018 options.clocktime = options.clocktime - 1
5019 else
5020 return 1
5021 end
5022
5023 optionsMain()
5024end
5025function increaseClockTime1(ob, pl)
5026 if not Player[pl].admin then
5027 return 1
5028 end
5029
5030 options.clocktime = options.clocktime + 1
5031
5032 optionsMain()
5033end
5034function increaseClockTime5(ob, pl)
5035 if not Player[pl].admin then
5036 return 1
5037 end
5038
5039 options.clocktime = options.clocktime + 5
5040
5041 optionsMain()
5042end
5043
5044function foldPlayer(ob, pl)
5045
5046 if pl then
5047 if not Player[pl].admin then
5048 return 1
5049 end
5050 end
5051
5052 if muck == nil or muck == null then
5053 checkAndRespawnObjects()
5054 --print ('The muck object has been lost. Please click the \'Reset Objects\' button on the options panel to reassign.')
5055 --return 1
5056 end
5057
5058 if actionon then
5059 local cards = Player[actionon].getHandObjects()
5060 local p = muck.getPosition()
5061 local r = muck.getRotation()
5062 p.y = p.y + 0.25
5063 r.x = 180
5064 r.z = 0
5065
5066 for i, v in ipairs (cards) do
5067 v.setRotation(r)
5068 v.setPosition(p)
5069 v.translate({0, 0.1, 0})
5070 p.y = p.y + 0.01
5071 end
5072 end
5073
5074 startLuaCoroutine(nil, 'delayedAction')
5075end
5076
5077function delayedAction()
5078 for i = 1, 2 do
5079 coroutine.yield(0)
5080 end
5081
5082 action()
5083 return 1
5084end
5085
5086function decreaseHybridThreshold1000(ob, pl)
5087 if not Player[pl].admin then
5088 return 1
5089 end
5090
5091 if options.hybridthreshold > 1000 then
5092 options.hybridthreshold = options.hybridthreshold - 1000
5093 end
5094
5095 optionsHost()
5096end
5097
5098function decreaseHybridThreshold100(ob, pl)
5099 if not Player[pl].admin then
5100 return 1
5101 end
5102
5103 if options.hybridthreshold > 100 then
5104 options.hybridthreshold = options.hybridthreshold - 100
5105 end
5106
5107 optionsHost()
5108end
5109
5110function increaseHybridThreshold100(ob, pl)
5111 if not Player[pl].admin then
5112 return 1
5113 end
5114
5115 options.hybridthreshold = options.hybridthreshold + 100
5116
5117 optionsHost()
5118end
5119
5120function increaseHybridThreshold1000(ob, pl)
5121 if not Player[pl].admin then
5122 return 1
5123 end
5124
5125 options.hybridthreshold = options.hybridthreshold + 1000
5126
5127 optionsHost()
5128end
5129
5130
5131function decreaseConvertStackHeight1(ob, pl)
5132 if not Player[pl].admin then
5133 return 1
5134 end
5135
5136 if options.convertstackheight > 1 then
5137 options.convertstackheight = options.convertstackheight - 1
5138 else
5139 options.convertstackheight = 0
5140 end
5141
5142 optionsHost()
5143end
5144
5145function increaseConvertStackHeight1(ob, pl)
5146 if not Player[pl].admin then
5147 return 1
5148 end
5149 options.convertstackheight = options.convertstackheight + 1
5150
5151 if options.convertstackheight >= 10 then
5152 options.convertstackheight = 10
5153 end
5154 optionsHost()
5155end
5156
5157
5158
5159
5160
5161
5162
5163function doNothing()
5164end
5165
5166function changeFontColor(ob, pl)
5167
5168 if not Player[pl].admin then
5169 return 1
5170 end
5171
5172 local color = colorball.getColorTint()
5173 pottext.TextTool.setFontColor(color)
5174 currentbettext.TextTool.setFontColor(color)
5175 muck.setColorTint(color)
5176 boardobject.setColorTint(color)
5177end
5178
5179function changeTableColor(ob, pl)
5180
5181 if not Player[pl].admin then
5182 return 1
5183 end
5184
5185 local color = colorball.getColorTint()
5186 overlay.setColorTint(color)
5187end
5188
5189function setGameModeTexas(ob, pl)
5190
5191 if not Player[pl].admin or options.gamemode == 'texas' then
5192 return 1
5193 end
5194
5195 options.gamemode = 'texas'
5196 printToAll('Game mode set to Texas Hold\'em. See rules in the notebook if you don\'t know how to play.', {1, 1, 1})
5197
5198 optionsHost()
5199end
5200function setGameModeOmaha(ob, pl)
5201
5202 if not Player[pl].admin or options.gamemode == 'omaha' then
5203 return 1
5204 end
5205
5206 options.gamemode = 'omaha'
5207 printToAll('Game mode set to Omaha Hold\'em. See rules in the notebook if you don\'t know how to play.', {1, 1, 1})
5208
5209 optionsHost()
5210end
5211function setGameModePineapple(ob, pl)
5212
5213 if not Player[pl].admin or options.gamemode == 'pineapple' then
5214 return 1
5215 end
5216
5217 options.gamemode = 'pineapple'
5218 printToAll('Game mode set to Pineapple. See rules in the notebook if you don\'t know how to play.', {1, 1, 1})
5219
5220 optionsHost()
5221end
5222function setGameModeFiveCard(ob, pl)
5223
5224 if not Player[pl].admin or options.gamemode == 'fivecard' then
5225 return 1
5226 end
5227
5228 options.gamemode = 'fivedraw'
5229 printToAll('Game mode set to Five Card Draw. See rules in the notebook if you don\'t know how to play.', {1, 1, 1})
5230
5231 optionsHost()
5232end
5233
5234function getParams(obj)
5235 local params = {}
5236 params.position = obj.getPosition()
5237 params.scale = obj.getScale()
5238 params.rotation = obj.getRotation()
5239
5240 return params
5241end
5242
5243function setTheme1(ob, pl)
5244
5245 if not Player[pl].admin then
5246 return 1
5247 end
5248
5249 themeindex = 1
5250 subthemeindex = 1
5251 optionsThemes()
5252end
5253
5254function setTheme2(ob, pl)
5255
5256 if not Player[pl].admin then
5257 return 1
5258 end
5259
5260 themeindex = 2
5261 subthemeindex = 1
5262 optionsThemes()
5263end
5264
5265function setTheme3(ob, pl)
5266
5267 if not Player[pl].admin then
5268 return 1
5269 end
5270
5271 themeindex = 3
5272 subthemeindex = 1
5273 optionsThemes()
5274end
5275
5276function setTheme4(ob, pl)
5277
5278 if not Player[pl].admin then
5279 return 1
5280 end
5281
5282 themeindex = 4
5283 subthemeindex = 1
5284 optionsThemes()
5285end
5286
5287function setTheme5(ob, pl)
5288
5289 if not Player[pl].admin then
5290 return 1
5291 end
5292
5293 themeindex = 5
5294 subthemeindex = 1
5295 optionsThemes()
5296end
5297
5298function setTheme6(ob, pl)
5299
5300 if not Player[pl].admin then
5301 return 1
5302 end
5303
5304 themeindex = 6
5305 subthemeindex = 1
5306 optionsThemes()
5307end
5308
5309function setTheme7(ob, pl)
5310
5311 if not Player[pl].admin then
5312 return 1
5313 end
5314
5315 themeindex = 7
5316 subthemeindex = 1
5317 optionsThemes()
5318end
5319
5320function setTheme8(ob, pl)
5321
5322 if not Player[pl].admin then
5323 return 1
5324 end
5325
5326 themeindex = 8
5327 subthemeindex = 1
5328 optionsThemes()
5329end
5330
5331function setTheme9(ob, pl)
5332
5333 if not Player[pl].admin then
5334 return 1
5335 end
5336
5337 themeindex = 9
5338 subthemeindex = 1
5339 optionsThemes()
5340end
5341
5342function setTheme10(ob, pl)
5343
5344 if not Player[pl].admin then
5345 return 1
5346 end
5347
5348 themeindex = 10
5349 subthemeindex = 1
5350 optionsThemes()
5351end
5352
5353function setTheme11(ob, pl)
5354
5355 if not Player[pl].admin then
5356 return 1
5357 end
5358
5359 themeindex = 11
5360 subthemeindex = 1
5361 optionsThemes()
5362end
5363
5364function setTheme12(ob, pl)
5365
5366 if not Player[pl].admin then
5367 return 1
5368 end
5369
5370 themeindex = 12
5371 subthemeindex = 1
5372 optionsThemes()
5373end
5374
5375function setSubtheme1(ob, pl)
5376
5377 if not Player[pl].admin then
5378 return 1
5379 end
5380
5381 subthemeindex = 1
5382 optionsThemes()
5383end
5384function setSubtheme2(ob, pl)
5385
5386 if not Player[pl].admin then
5387 return 1
5388 end
5389
5390 subthemeindex = 2
5391 optionsThemes()
5392end
5393function setSubtheme3(ob, pl)
5394
5395 if not Player[pl].admin then
5396 return 1
5397 end
5398
5399 subthemeindex = 3
5400 optionsThemes()
5401end
5402function setSubtheme4(ob, pl)
5403
5404 if not Player[pl].admin then
5405 return 1
5406 end
5407
5408 subthemeindex = 4
5409 optionsThemes()
5410end
5411function setSubtheme5(ob, pl)
5412
5413 if not Player[pl].admin then
5414 return 1
5415 end
5416
5417 subthemeindex = 5
5418 optionsThemes()
5419end
5420function setSubtheme6(ob, pl)
5421
5422 if not Player[pl].admin then
5423 return 1
5424 end
5425
5426 subthemeindex = 6
5427 optionsThemes()
5428end
5429function setSubtheme7(ob, pl)
5430
5431 if not Player[pl].admin then
5432 return 1
5433 end
5434
5435 subthemeindex = 7
5436 optionsThemes()
5437end
5438function setSubtheme8(ob, pl)
5439
5440 if not Player[pl].admin then
5441 return 1
5442 end
5443
5444 subthemeindex = 8
5445 optionsThemes()
5446end
5447function setSubtheme9(ob, pl)
5448
5449 if not Player[pl].admin then
5450 return 1
5451 end
5452
5453 subthemeindex = 9
5454 optionsThemes()
5455end
5456function setSubtheme10(ob, pl)
5457
5458 if not Player[pl].admin then
5459 return 1
5460 end
5461
5462 subthemeindex = 10
5463 optionsThemes()
5464end
5465function setSubtheme11(ob, pl)
5466
5467 if not Player[pl].admin then
5468 return 1
5469 end
5470
5471 subthemeindex = 11
5472 optionsThemes()
5473end
5474function setSubtheme12(ob, pl)
5475
5476 if not Player[pl].admin then
5477 return 1
5478 end
5479
5480 subthemeindex = 12
5481 optionsThemes()
5482end
5483
5484function overlay1 (ob, pl)
5485
5486 if not Player[pl].admin then
5487 return 1
5488 end
5489
5490 changeOverlay(themes[themeindex][subthemeindex][1].diffuse)
5491
5492end
5493function overlay2 (ob, pl)
5494
5495 if not Player[pl].admin then
5496 return 1
5497 end
5498
5499 changeOverlay(themes[themeindex][subthemeindex][2].diffuse)
5500
5501end
5502function overlay3 (ob, pl)
5503
5504 if not Player[pl].admin then
5505 return 1
5506 end
5507
5508 changeOverlay(themes[themeindex][subthemeindex][3].diffuse)
5509
5510end
5511function overlay4 (ob, pl)
5512
5513 if not Player[pl].admin then
5514 return 1
5515 end
5516
5517 changeOverlay(themes[themeindex][subthemeindex][4].diffuse)
5518
5519end
5520function overlay5 (ob, pl)
5521
5522 if not Player[pl].admin then
5523 return 1
5524 end
5525
5526 changeOverlay(themes[themeindex][subthemeindex][5].diffuse)
5527
5528end
5529function overlay6 (ob, pl)
5530
5531 if not Player[pl].admin then
5532 return 1
5533 end
5534
5535 changeOverlay(themes[themeindex][subthemeindex][6].diffuse)
5536
5537end
5538function overlay7 (ob, pl)
5539
5540 if not Player[pl].admin then
5541 return 1
5542 end
5543
5544 changeOverlay(themes[themeindex][subthemeindex][7].diffuse)
5545
5546end
5547function overlay8 (ob, pl)
5548
5549 if not Player[pl].admin then
5550 return 1
5551 end
5552
5553 changeOverlay(themes[themeindex][subthemeindex][8].diffuse)
5554
5555end
5556function overlay9 (ob, pl)
5557
5558 if not Player[pl].admin then
5559 return 1
5560 end
5561
5562 changeOverlay(themes[themeindex][subthemeindex][9].diffuse)
5563
5564end
5565function overlay10 (ob, pl)
5566
5567 if not Player[pl].admin then
5568 return 1
5569 end
5570
5571 changeOverlay(themes[themeindex][subthemeindex][10].diffuse)
5572
5573end
5574function overlay11 (ob, pl)
5575
5576 if not Player[pl].admin then
5577 return 1
5578 end
5579
5580 changeOverlay(themes[themeindex][subthemeindex][11].diffuse)
5581
5582end
5583function overlay12 (ob, pl)
5584
5585 if not Player[pl].admin then
5586 return 1
5587 end
5588
5589 changeOverlay(themes[themeindex][subthemeindex][12].diffuse)
5590
5591end
5592
5593function changeOverlay(diffuse)
5594
5595 local custom = overlay.getCustomObject()
5596 custom.diffuse = diffuse
5597
5598 overlay.setCustomObject(custom)
5599 overlay = overlay.reload()
5600 overlay.interactable = false
5601 overlay.setColorTint({1, 1, 1})
5602
5603end
5604
5605--[[ Destroy options panel --]]
5606function destroyOptionsPanel(ob, pl)
5607
5608 if pl and not Player[pl].admin then
5609 return 1
5610 end
5611
5612 optionspanel.clearButtons()
5613 optionspanel.destruct()
5614 optionspanel = nil
5615 if colorball ~= nil and colorball ~= null then
5616 colorball.destruct()
5617 end
5618end
5619
5620function toggleBlindsSkipAFK(ob, pl)
5621
5622 if not Player[pl].admin then
5623 return 1
5624 end
5625
5626 options.blindsskipafk = not options.blindsskipafk
5627
5628 optionsHost()
5629end
5630
5631function darkenOverlay(ob, pl)
5632
5633 if not Player[pl].admin then
5634 return 1
5635 end
5636
5637 local color = overlay.getColorTint()
5638 for i, v in pairs (color) do
5639 if v >= 0.05 then
5640 color[i] = v - 0.05
5641 else
5642 color[i] = 0
5643 end
5644 end
5645
5646 overlay.setColorTint(color)
5647end
5648
5649function lightenOverlay(ob, pl)
5650
5651 if not Player[pl].admin then
5652 return 1
5653 end
5654
5655 local color = overlay.getColorTint()
5656 for i, v in pairs (color) do
5657 if v <= 1.95 then
5658 color[i] = v + 0.05
5659 else
5660 color[i] = 2
5661 end
5662 end
5663
5664 overlay.setColorTint(color)
5665end
5666
5667function changeCollectMethod(ob, pl)
5668 if not Player[pl].admin then
5669 return 1
5670 end
5671
5672 if options.collectmethod == 'move' then
5673 options.collectmethod = 'convert'
5674 print('Collect method set to: Convert. Bets will now be converted up when collected. Bets will be convert with at least a height of ' .. options.convertstackheight)
5675 elseif options.collectmethod == 'convert' then
5676 options.collectmethod = 'hybrid'
5677 print('Collect method set to: Hybrid. Bets will be converted up once the pot is over $'..options.hybridthreshold..'.')
5678 elseif options.collectmethod == 'hybrid' then
5679 options.collectmethod = 'move'
5680 print('Collect method set to: Move. Bets will be moved into the pot.')
5681 else
5682 options.collectmethod = 'move'
5683 print('Unknown collect method found: Collect method set to: Move. Bets will be moved into the pot.')
5684 end
5685
5686 optionsHost()
5687end
5688
5689function checkAndRespawnObjects(ob, pl)
5690 if pl then
5691 if not Player[pl].admin then
5692 return 1
5693 end
5694 end
5695
5696 sidepotcalculated = false
5697
5698
5699 local meshes = {'http://pastebin.com/raw/133e1Z0L', 'http://pastebin.com/raw/U9rtcyua', 'http://pastebin.com/raw/uvvaV5Np', 'https://raw.githubusercontent.com/johnpenny/tts-poker-table-coverings/master/poker-table-boards.obj'}
5700 local diffuses = {'http://i.imgur.com/QinS8Hc.png', 'http://i.imgur.com/hIKi7Mq.png', 'http://i.imgur.com/novIseH.png', 'http://i.imgur.com/jPnTE9e.png'}
5701 local allobjects = getAllObjects()
5702 local objects = {'muck', 'boardobject', 'potobject', 'overlay'}
5703 local objectnames = {'Muck', 'Board', 'Pot', 'Overlay'}
5704 local objectexists = {false, false, false, false} -- muck, board, pot, overlay
5705 local positions = {{ - 9.175, 1.35, - 1.9}, {0, 1.35, - 2}, {0, 1.35, - 7.5}, {0, 0.7, 0}}
5706 local custom = {}
5707 local params = {}
5708 local textparams = {}
5709 textparams.type = '3DText'
5710
5711 -- mark unlost objects as existing
5712 for i, v in ipairs (objects) do
5713 if Global.getVar(v) ~= nil and Global.getVar(v) ~= null then
5714 objectexists[i] = true
5715 --print (objectnames[i]..' exists.')
5716 end
5717 end
5718
5719 -- search for objects and reassign any that are found
5720 for i, v in ipairs (allobjects) do
5721 custom = v.getCustomObject()
5722 for j, w in ipairs (meshes) do
5723 if custom.mesh == w then
5724 if not objectexists[j] then
5725 Global.setVar(objects[j], v)
5726 objectexists[j] = true
5727 print(objectnames[j]..' reassigned.')
5728 end
5729 end
5730 end
5731 end
5732
5733 -- respawn nonexistent objects
5734 for i, v in ipairs (objectexists) do
5735 if not v then
5736 params.type = 'Custom_Model'
5737 params.position = positions[i]
5738 params.rotation = {0, 0, 0}
5739
5740 custom.mesh = meshes[i]
5741 custom.diffuse = diffuses[i]
5742 custom.type = 4
5743
5744 local o = spawnObject(params)
5745 o.setCustomObject(custom)
5746
5747 if i ~= 4 then
5748 o.setLuaScript(scripts[i])
5749 else
5750 o.lock()
5751 o.interactable = false
5752 o.setName('Table Overlay')
5753 end
5754
5755 Global.setVar(objects[i], o)
5756
5757 print (objectnames[i]..' respawned.')
5758 end
5759 end
5760 local actionscript = "blubb"
5761
5762 --[[ Check and respawn texts --]]
5763 if actiontext == nil or actiontext == null then
5764 textparams.position = {0, 0, 0}
5765 textparams.rotation = {0, 0, 0}
5766 actiontext = spawnObject(textparams)
5767 actiontext.TextTool.setValue('Action')
5768 actiontext.TextTool.setFontSize(68)
5769 actiontext.setLuaScript(scripts[4])
5770 end
5771 if pottext == nil or pottext == null then
5772 textparams.position = {0, 1.33, 0}
5773 textparams.callback = 'spawnTextCallback'
5774 pottext = spawnObject(textparams)
5775 pottext.TextTool.setFontSize(64)
5776 end
5777 if currentbettext == nil or currentbettext == null then
5778 textparams.position = {0, 1.33, 1}
5779 textparams.callback = 'spawnTextCallback'
5780 currentbettext = spawnObject(textparams)
5781 currentbettext.TextTool.setFontSize(64)
5782 end
5783 for i, v in ipairs(colors) do
5784 if bettext[v] == nil or bettext[v] == null then
5785 local playerhand = Player[v].getHandTransform(1)
5786 textparams.position = {playerhand.position.x + playerhand.forward.x * 10 + playerhand.right.x * 4, 1.4, playerhand.position.z + playerhand.forward.z * 10 + playerhand.right.z * 4}
5787 textparams.callback = 'spawnTextCallback'
5788 bettext[v] = spawnObject(textparams)
5789 bettext[v].TextTool.setFontSize(64)
5790 bettext[v].TextTool.setFontColor(fontcolors[v])
5791 end
5792 if sidepottext[v] == nil or sidepottext[v] == null then
5793
5794 local playerhand = Player[v].getHandTransform(1)
5795 textparams.position = {playerhand.position.x + playerhand.forward.x * 10.8, 1.33, playerhand.position.z + playerhand.forward.z * 10.8}
5796 textparams.callback = 'spawnTextCallback'
5797 sidepottext[v] = spawnObject(textparams)
5798 sidepottext[v].TextTool.setFontSize(64)
5799 sidepottext[v].TextTool.setFontColor(fontcolors[v])
5800 sidepottext[v].setValue("spawned")
5801 end
5802 if tablezonetext[v] == nil or tablezonetext[v] == null then
5803 local chips = {}
5804 local playerhand = Player[v].getHandTransform(1)
5805 textparams.position = {playerhand.position.x + playerhand.forward.x * - 2.5 + playerhand.right.x * 4, 1.4, playerhand.position.z + playerhand.forward.z * - 2.5 + playerhand.right.z * 4}
5806 textparams.callback = 'spawnTextCallback'
5807 tablezonetext[v] = spawnObject(textparams)
5808 tablezonetext[v].TextTool.setFontSize(64)
5809 tablezonetext[v].TextTool.setFontColor({1, 1, 1}) -- Black
5810
5811 if options.displayplayermoney then
5812 money = getChipValues(tablezones[v], chips)
5813 tablezonetext[v].setValue("$" .. money)
5814 else
5815 tablezonetext[v].setValue(" ")
5816 end
5817
5818 end
5819
5820 end
5821
5822end
5823
5824function spawnTextCallback()
5825 check = true
5826 if not (pottext == nil or pottext == null) then
5827 pottext.setRotation({90, 180, 0})
5828 else
5829 check = false
5830 end
5831 if not (currentbettext == nil or currentbettext == null) then
5832 currentbettext.setRotation({90, 180, 0})
5833 else
5834 check = false
5835 end
5836 for i, v in ipairs(colors) do
5837 local playerhand = getPlayerHandPositionAndRotation(v)
5838 if not (bettext[v] == nil or bettext[v] == null) then
5839 bettext[v].setRotation({90, playerhand['rot_y'], 0})
5840 else
5841 check = false
5842 end
5843 if not (sidepottext[v] == nil or sidepottext[v] == null or type(sidepottext[v]) == "string") then
5844 sidepottext[v].setRotation({90, playerhand['rot_y'], 0})
5845 else
5846 check = false
5847 end
5848 if not (tablezonetext[v] == nil or tablezonetext[v] == null) then
5849 tablezonetext[v].setRotation({90, playerhand['rot_y'], 0})
5850 else
5851 check = false
5852 end
5853 end
5854 if check then
5855 calculatePots()
5856 end
5857end
5858
5859function togglePlayerClickAction(ob, pl)
5860 if not Player[pl].admin then
5861 return 1
5862 end
5863
5864 if options.playerclickaction then
5865 options.playerclickaction = false
5866 print ('The Action button will now remain in a static position for the host to click.')
5867
5868 local buttons = actionbutton.getButtons()
5869
5870 buttons[1].label = 'Action'
5871
5872 actionbutton.editButton(buttons[1])
5873 else
5874 options.playerclickaction = true
5875 print ('The action button will now be moved in front of the player whose turn it is to act.')
5876
5877 local buttons = actionbutton.getButtons()
5878
5879 buttons[1].label = 'Done'
5880
5881 actionbutton.editButton(buttons[1])
5882 end
5883
5884 optionsHost()
5885end
5886
5887function toggleEnforcePotLimit(ob, pl)
5888 if not Player[pl].admin then
5889 return 1
5890 end
5891
5892 options.enforcepotlimit = not options.enforcepotlimit
5893
5894 optionsHost()
5895end
5896
5897function toggleEnforceFoldInTurn(ob, pl)
5898 if not Player[pl].admin then
5899 return 1
5900 end
5901
5902 options.enforcefoldinturn = not options.enforcefoldinturn
5903
5904 optionsHost()
5905end
5906
5907function toggleEnforceDoubleRaise(ob, pl)
5908 if not Player[pl].admin then
5909 return 1
5910 end
5911
5912 options.enforcedoubleraise = not options.enforcedoubleraise
5913
5914 optionsHost()
5915end
5916
5917function toggleActionMessage(ob, pl)
5918 if not Player[pl].admin then
5919 return 1
5920 end
5921
5922 options.chatoptions.actionmessage = not options.chatoptions.actionmessage
5923
5924 optionsChat()
5925end
5926
5927function toggleActionBroadcast(ob, pl)
5928 if not Player[pl].admin then
5929 return 1
5930 end
5931
5932 options.chatoptions.actionbroadcast = not options.chatoptions.actionbroadcast
5933
5934 optionsChat()
5935end
5936
5937function toggleStageBroadcast(ob, pl)
5938 if not Player[pl].admin then
5939 return 1
5940 end
5941
5942 options.chatoptions.stage = not options.chatoptions.stage
5943
5944 optionsChat()
5945end
5946
5947function toggleCurrentBetMessage(ob, pl)
5948 if not Player[pl].admin then
5949 return 1
5950 end
5951
5952 options.chatoptions.currentbetmessage = not options.chatoptions.currentbetmessage
5953
5954 optionsChat()
5955end
5956
5957function toggleBetter(ob, pl)
5958 if not Player[pl].admin then
5959 return 1
5960 end
5961
5962 options.chatoptions.better = not options.chatoptions.better
5963
5964 optionsChat()
5965end
5966
5967function toggleAllinBroadcast(ob, pl)
5968 if not Player[pl].admin then
5969 return 1
5970 end
5971
5972 options.chatoptions.allinbroadcast = not options.chatoptions.allinbroadcast
5973
5974 optionsChat()
5975end
5976
5977function togglePotMessage(ob, pl)
5978 if not Player[pl].admin then
5979 return 1
5980 end
5981
5982 if options.chatoptions.potmessage >= 2 then
5983 options.chatoptions.potmessage = 0
5984 else
5985 options.chatoptions.potmessage = options.chatoptions.potmessage + 1
5986 end
5987
5988 optionsChat()
5989end
5990
5991function printMessages()
5992
5993 local p = ''
5994
5995 for i, v in ipairs(colors) do
5996 if string.find(printstring, v) then
5997 p = v
5998 break
5999 end
6000 end
6001
6002 if string.find(printstring, 'bet') or string.find(printstring, 'raise') then
6003 if options.chatoptions.currentbetmessage then
6004 local s = 'Current bet: $'..currentbet
6005 if options.chatoptions.better then
6006 if string.find(printstring, 'bet') then
6007 if Player[p].steam_name then
6008 s = s..', made by '..fontcolors[p].bbcode..Player[p].steam_name..'[ffffff].'
6009 else
6010 s = s..', made by '..fontcolors[p].bbcode..p..'[ffffff].'
6011 end
6012 else
6013 if Player[p].steam_name then
6014 s = s..', raised by '..fontcolors[p].bbcode..Player[p].steam_name..'[ffffff].'
6015 else
6016 s = s..', raised by '..fontcolors[p].bbcode..p..'[ffffff].'
6017 end
6018 end
6019 else
6020 s = s..'.'
6021 end
6022
6023 printToAll(s, {1, 1, 1})
6024 end
6025 end
6026
6027
6028 if options.chatoptions.allinbroadcast and string.find(printstring, 'allin') then
6029 if string.find(printstring, p) then
6030 if Player[p].steam_name then
6031 broadcastToAll (fontcolors[p].bbcode..Player[p].steam_name..'[ffffff] is all in!', {1, 1, 1})
6032 else
6033 broadcastToAll (fontcolors[p].bbcode..p..'[ffffff] is all in!.', {1, 1, 1})
6034 end
6035 end
6036 end
6037
6038 if string.find(printstring, 'action') and actionon then
6039
6040 if options.chatoptions.actionmessage then
6041 if Player[actionon].steam_name then
6042 printToAll ("Action on "..fontcolors[actionon].bbcode..Player[actionon].steam_name..'[ffffff].', {1, 1, 1})
6043 else
6044 printToAll ("Action on "..fontcolors[actionon].bbcode..actionon..'[ffffff].', {1, 1, 1})
6045 end
6046 end
6047
6048 if options.chatoptions.actionbroadcast and Player[actionon].seated then
6049 broadcastToColor("Action on you!", actionon, {1, 0, 0})
6050 end
6051 end
6052
6053 if options.chatoptions.potmessage > 0 then
6054 if (options.chatoptions.potmessage >= 1 and string.find(printstring, 'collect')) or (options.chatoptions.potmessage > 1 and string.find(printstring, 'pot')) then
6055 printToAll('Pot: $'..pot..'.', {1, 1, 1})
6056 end
6057 end
6058
6059 printstring = ''
6060end
6061
6062function onObjectDropped(player, object)
6063 if handinprogress and object.tag == 'Card' then
6064
6065 if handsshown[player] then return 0 end -- if the player already revealed their hand, then abort function. this is to prevent players from spamming chat by repeatedly picking up and dropping their cards
6066 for i, v in ipairs (colors) do
6067 for j, w in ipairs (Player[v].getHandObjects()) do
6068 if w == object then return 0 end -- they dropped it into their hand, so abort function
6069 end
6070 end
6071 local r = object.getRotation()
6072 if (r.x < 80 or r.x > 280) and (r.z < 80 or r.z > 280) then -- it's face-up
6073 for i, v in ipairs (holecards[player]) do
6074 if v == object.getGUID() then
6075 table.insert(revealedcards[player], table.remove(holecards[player], i))
6076 break
6077 end
6078 end
6079 if #holecards[player] == 0 then
6080 handsshown[player] = true
6081 evaluateHand(player)
6082 end
6083 end
6084 end
6085
6086 if isCurrency(object) then
6087 for i, v in ipairs (colors) do
6088 local chips = {}
6089 local value = "$" .. getChipValues(tablezones[v], chips)
6090
6091
6092 if options.displayplayermoney then
6093 tablezonetext[v].setValue(value)
6094 end
6095 for j, w in ipairs (chips) do
6096 if w == object then
6097 object.setColorTint(chiptints[v])
6098 return 1
6099 end
6100 end
6101 for j, w in ipairs (backtablezones[v].getObjects()) do
6102 if w == object then
6103 object.setColorTint(chiptints[v])
6104 return 1
6105 end
6106 end
6107 for j, w in ipairs (betzones[v].getObjects()) do
6108 if w == object then
6109 object.setColorTint(chiptints[v])
6110 return 1
6111 end
6112 end
6113 end
6114 object.setColorTint({1, 1, 1})
6115 end
6116end
6117
6118function onObjectSpawn(object)
6119 if isCurrency(object) then
6120 for i, v in ipairs (colors) do
6121 for j, w in ipairs (tablezones[v].getObjects()) do
6122 if w == object then
6123 object.setColorTint(chiptints[v])
6124 return 1
6125 end
6126 end
6127 for j, w in ipairs (backtablezones[v].getObjects()) do
6128 if w == object then
6129 object.setColorTint(chiptints[v])
6130 return 1
6131 end
6132 end
6133 for j, w in ipairs (betzones[v].getObjects()) do
6134 if w == object then
6135 object.setColorTint(chiptints[v])
6136 return 1
6137 end
6138 end
6139 end
6140 object.setColorTint({1, 1, 1})
6141 end
6142end
6143
6144function isCurrency(object)
6145 if object.tag == 'Chip' then
6146 if object.getValue() then
6147 return true
6148 elseif currencyToNumber(object.getName()) ~= nil then
6149 if currencyToNumber(object.getName()) > 0 then
6150 return true
6151 end
6152 else
6153 return false
6154 end
6155 end
6156end
6157function getPlayersHoleCards()
6158 for i, v in ipairs (players) do
6159 for j, w in ipairs (Player[v].getHandObjects()) do
6160 table.insert(holecards[v], w.getGUID())
6161 end
6162 end
6163end
6164
6165function evaluateHand(player)
6166
6167 if options.gamemode == 'omaha' then return 0 end -- doesn't work for omaha since it doesn't consider which cards are in the player's hand and which are on the board.
6168
6169 local sevencards = getSevenCards(player)
6170
6171 if not sevencards then return 0 end
6172
6173 local cards = {['Spades'] = {}, ['Hearts'] = {}, ['Clubs'] = {}, ['Diamonds'] = {}}
6174 local suits = {'Spades', 'Hearts', 'Clubs', 'Diamonds'}
6175 local ranks = {'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace'}
6176 local handranks = {'Royal Flush', 'Straight Flush', 'Four of a Kind', 'Full House', 'Flush', 'Straight', 'Three of a Kind', 'Two Pairs', 'One Pair', 'High Card'}
6177
6178 -- Populate cards table
6179 for i, v in ipairs (sevencards) do
6180 for j, w in ipairs (ranks) do
6181 if getConvertedName(v.getName()) == w then
6182 table.insert(cards[v.getDescription()], nameToValue(w))
6183 break
6184 end
6185 end
6186 end
6187
6188 -- Sort tables
6189 for i, v in ipairs (suits) do
6190 table.sort(cards[v])
6191 end
6192
6193 -- Check for each type of hand until a hand is found
6194
6195 -- Royal flush
6196
6197 local flushexists = false
6198 local flushsuit = ''
6199
6200 for i, v in ipairs (suits) do
6201 if #cards[v] >= 5 then -- a flush exists at least
6202 flushexists = true
6203 flushsuit = v
6204 local value = 0
6205 for j = 1, 5 do
6206 value = value + cards[v][#cards[v] - (j - 1)]
6207 end
6208 if value == 60 then -- it's a royal flush!
6209 broadcastToAll(player..' shows a '..flushsuit..' Royal Flush!', {0, 1, 0})
6210 return 0
6211 end
6212 end
6213 end
6214
6215 -- Straight Flush
6216
6217 if flushexists then
6218 local consecutives = 0
6219 local highcard = 0
6220 local lowconsecutives = false
6221 local ace = false
6222 for i, v in ipairs (cards[flushsuit]) do
6223 if i == 1 then
6224 consecutives = 1
6225 else
6226 if v == (cards[flushsuit][i - 1] + 1) then
6227 consecutives = consecutives + 1
6228 if consecutives >= 5 then
6229 highcard = v
6230 elseif consecutives == 4 and v == 5 then
6231 lowconsecutives = true
6232 end
6233 else
6234 consecutives = 1
6235 end
6236 if v == 14 then
6237 ace = true
6238 end
6239 end
6240 end
6241
6242 -- check for straight flush to the 5
6243 if highcard == 0 and ace and lowconsecutives then highcard = 5 end
6244
6245 if highcard > 0 then
6246 broadcastToAll (fontcolors[player].bbcode..player..' shows a '..flushsuit..' Straight Flush to the '..valueToName(highcard), {1, 1, 1})
6247 return 0
6248 end
6249 end
6250
6251 -- Create list of all cards based on rank to use in finding pairs, etc.
6252
6253 local cards2 = {}
6254
6255 for i, v in ipairs (suits) do
6256 for j, w in ipairs (cards[v]) do
6257 table.insert(cards2, w)
6258 end
6259 end
6260
6261 table.sort(cards2)
6262
6263 local quantities = {}
6264
6265 for i, v in ipairs (cards2) do
6266 if not quantities[valueToName(v)] then
6267 quantities[valueToName(v)] = 1
6268 else
6269 quantities[valueToName(v)] = quantities[valueToName(v)] + 1
6270 end
6271 end
6272
6273 local quads = {}
6274 local trips = {}
6275 local pairs = {}
6276 local singles = {}
6277 for i, v in ipairs (ranks) do
6278 if quantities[v] == 4 then table.insert(quads, v) end
6279 if quantities[v] == 3 then table.insert(trips, v) end
6280 if quantities[v] == 2 then table.insert(pairs, v) end
6281 if quantities[v] == 1 then table.insert(singles, v) end
6282 end
6283
6284 -- Check for quads
6285 if #quads > 0 then
6286 broadcastToAll(fontcolors[player].bbcode..player..' shows Four of a Kind: '..quads[#quads]..'s!', {1, 1, 1})
6287 return 0
6288 end
6289
6290 -- Check for full house
6291 if #trips > 0 and #trips + #pairs >= 2 then
6292 if #pairs > 0 then
6293 printToAll (fontcolors[player].bbcode..player..' shows a Full House: '..trips[#trips]..'s full of '..pairs[#pairs]..'s!', {1, 1, 1})
6294 else
6295 printToAll (fontcolors[player].bbcode..player..' shows a Full House: '..trips[#trips]..'s full of '..trips[#trips - 1]..'s!', {1, 1, 1})
6296 end
6297 return 0
6298 end
6299
6300 -- Flush
6301 if flushexists then
6302 printToAll (fontcolors[player].bbcode..player..' shows a '..flushsuit..' Flush, '..valueToName(cards[flushsuit][#cards[flushsuit]])..' high!', {1, 1, 1})
6303 return 0
6304 end
6305
6306 -- Check for Straight
6307 local consecutives = 0
6308 local highcard = 0
6309 local lowconsecutives = false
6310 local ace = false
6311 for i, v in ipairs (cards2) do
6312 if i == 1 then
6313 consecutives = 1
6314 else
6315 if v == (cards2[i - 1] + 1) then
6316 consecutives = consecutives + 1
6317 if consecutives >= 5 then
6318 highcard = v
6319 elseif consecutives == 4 and v == 5 then
6320 lowconsecutives = true
6321 end
6322 elseif v ~= cards2[i - 1] then
6323 consecutives = 1
6324 end
6325 if v == 14 then
6326 ace = true
6327 end
6328 end
6329 end
6330
6331 -- check for straight flush to the 5
6332 if highcard == 0 and ace and lowconsecutives then highcard = 5 end
6333
6334 if highcard > 0 then
6335 printToAll (fontcolors[player].bbcode..player..' shows a Straight to the '..valueToName(highcard)..'!', {1, 1, 1})
6336 return 0
6337 end
6338
6339 -- Check for trips
6340 if #trips > 0 then
6341 printToAll (fontcolors[player].bbcode..player..' shows Three of a Kind: '..trips[#trips]..'s.', {1, 1, 1})
6342 return 0
6343 end
6344
6345 -- Check for two pair
6346 if #pairs >= 2 then
6347 printToAll (fontcolors[player].bbcode..player..' shows Two Pair: '..pairs[#pairs]..'s and '..pairs[#pairs - 1]..'s.', {1, 1, 1})
6348 return 0
6349 end
6350
6351 -- Check for one pair
6352 if #pairs == 1 then
6353 printToAll (fontcolors[player].bbcode..player..' shows One Pair: '..pairs[#pairs]..'s.', {1, 1, 1})
6354 return 0
6355 end
6356
6357 -- High card
6358 printToAll (fontcolors[player].bbcode..player..' shows '..singles[#singles]..' High.', {1, 1, 1})
6359
6360end
6361
6362function getSevenCards(player)
6363 local sevencards = {}
6364
6365 for i, v in ipairs (boardzone.getObjects()) do
6366 if v.tag == 'Card' then
6367 if v.getName() == '' or v.getDescription() == '' then return nil end
6368 sevencards[#sevencards + 1] = v
6369 end
6370 end
6371 for i, v in ipairs (revealedcards[player]) do
6372 local card = getObjectFromGUID(v)
6373 if card.tag == 'Card' then
6374 if card.getName() == '' or card.getDescription() == '' then return nil end
6375 sevencards[#sevencards + 1] = card
6376 end
6377 end
6378
6379 return sevencards
6380end
6381
6382function getConvertedName(name)
6383 if name == '2' then return 'Two' end
6384 if name == '3' then return 'Three' end
6385 if name == '4' then return 'Four' end
6386 if name == '5' then return 'Five' end
6387 if name == '6' then return 'Six' end
6388 if name == '7' then return 'Seven' end
6389 if name == '8' then return 'Eight' end
6390 if name == '9' then return 'Nine' end
6391 if name == '10' then return 'Ten' end
6392 return name
6393end
6394
6395function nameToValue(name)
6396 if name == 'Two' then return 2 end
6397 if name == 'Three' then return 3 end
6398 if name == 'Four' then return 4 end
6399 if name == 'Five' then return 5 end
6400 if name == 'Six' then return 6 end
6401 if name == 'Seven' then return 7 end
6402 if name == 'Eight' then return 8 end
6403 if name == 'Nine' then return 9 end
6404 if name == 'Ten' then return 10 end
6405 if name == 'Jack' then return 11 end
6406 if name == 'Queen' then return 12 end
6407 if name == 'King' then return 13 end
6408 if name == 'Ace' then return 14 end
6409end
6410
6411function valueToName(value)
6412 if value == 2 then return 'Two' end
6413 if value == 3 then return 'Three' end
6414 if value == 4 then return 'Four' end
6415 if value == 5 then return 'Five' end
6416 if value == 6 then return 'Six' end
6417 if value == 7 then return 'Seven' end
6418 if value == 8 then return 'Eight' end
6419 if value == 9 then return 'Nine' end
6420 if value == 10 then return 'Ten' end
6421 if value == 11 then return 'Jack' end
6422 if value == 12 then return 'Queen' end
6423 if value == 13 then return 'King' end
6424 if value == 14 then return 'Ace' end
6425end
6426
6427function onObjectPickedUp(player, object)
6428
6429 if Player[player].admin then return 0 end
6430
6431 local r = object.getPosition()
6432 local description = ''
6433
6434 if object.getName() ~= '' then
6435 description = object.getName()
6436 elseif object.getValue() then
6437 description = object.getValue()
6438 else
6439 description = object.tag
6440 end
6441
6442 --[[ Check if the object is inside the dealer's area --]]
6443 if r.x < 8.5 and r.x > - 8.5 and r.z < - 16.5 and r.z > - 52 then
6444 object.translate({0, 1, 0})
6445 print (player..' has attempted to pick up an object ('..description..') in the dealer\'s area.')
6446 return 0
6447 end
6448
6449 --[[ Check if the object is on another player's table or bet zone, and not in player's own table or betzone --]]
6450
6451 if not objectExistsInList(tablezones[player].getObjects(), object) and not objectExistsInList(betzones[player].getObjects(), object) then
6452 for i, v in ipairs (colors) do
6453 if v ~= player then
6454 if objectExistsInList(tablezones[v].getObjects(), object) or objectExistsInList(betzones[v].getObjects(), object) or objectExistsInList(backtablezones[v].getObjects(), object) then
6455 object.translate({0, 1, 0})
6456 print (player..' has attempted to pick up an object ('..description..') on player '..v..'\'s table or bet square.')
6457 return 0
6458 end
6459 end
6460 end
6461 end
6462
6463 --[[ If the object is a card and not in the player's own hand, then drop it. Only works with named cards. --]]
6464
6465 local ranks = {['Ace'] = true, ['Two'] = true, ['Three'] = true, ['Four'] = true, ['Five'] = true, ['Six'] = true, ['Seven'] = true, ['Eight'] = true, ['Nine'] = true, ['Ten'] = true, ['Jack'] = true, ['Queen'] = true, ['King'] = true}
6466 if object.tag == 'Card' and ranks[getConvertedName(object.getName())] then
6467 for i, v in ipairs (Player[player].getHandObjects()) do
6468 if object == v then return 0 end
6469 end
6470 for i, v in ipairs (holecards[player]) do
6471 if object.getGUID() == v then return 0 end
6472 end
6473 for i, v in ipairs (revealedcards[player]) do
6474 if object.getGUID() == v then return 0 end
6475 end
6476 object.translate({0, 1, 0})
6477 print (player..' has attempted to pick up a card that does not belong to them.')
6478 end
6479end
6480
6481function initializePot()
6482 local p = {}
6483 p = stacklayout[options.stacklayout]
6484
6485 -- reset height
6486 for i, v in pairs (p) do
6487 v.height = 0
6488 v.x = 0
6489 v.y = 0
6490 v.z = 0
6491 end
6492 return p
6493end
6494
6495function createSidepot(ob, pl)
6496 createSidepotPl = pl
6497 createSidepotOb = ob
6498 startLuaCoroutine(nil, "coCreateSidepot")
6499end
6500
6501function coCreateSidepot()
6502
6503 pl = createSidepotPl
6504 ob = createSidepotOb
6505
6506 if sidepotfailcount > sidepotfailcountlimit then
6507 convertfailcount = 0
6508 print("Error in Sidepotcreations, chips were moved");
6509 return 1
6510 end
6511
6512 if pl then
6513 if not Player[pl].admin then
6514 return 1
6515 end
6516 end
6517 -- cant build sidepots twice
6518 if sidepotcalculated then
6519 return 1
6520 end
6521
6522 local chips1 = {}
6523 local positions1 = {}
6524 local rotations1 = {}
6525 for i, v in pairs (betzones) do
6526 objects = {}
6527 objects = v.getObjects()
6528 for j, w in ipairs (objects) do
6529 if w.tag == 'Chip' then
6530 if w.getValue() or currencyToNumber(w.getName()) != nil then
6531 chips1[#chips1 + 1] = w
6532 end
6533 end
6534 end
6535 end
6536 for i, v in ipairs (chips1) do
6537 positions1[#positions1 + 1] = v.getPosition()
6538 rotations1[#rotations1 + 1] = v.getRotation()
6539 end
6540 for i = 1, 2 do
6541 coroutine.yield(0)
6542 end
6543 local chips2 = {}
6544 local playerbets = {}
6545 local positions2 = {}
6546 local rotations2 = {}
6547 for i, v in ipairs (colors) do
6548 playerbets[i] = { getChipValues(betzones[v], chips2), betzones[v], v, 0}
6549 end
6550 for i, v in ipairs (chips2) do
6551 positions2[#positions2 + 1] = v.getPosition()
6552 rotations2[#rotations2 + 1] = v.getRotation()
6553 end
6554 --[[ Check chip positions --]]
6555 for i, v in ipairs(positions1) do
6556 if v.x ~= positions2[i].x or v.y ~= positions2[i].y or v.z ~= positions2[i].z then
6557 sidepotfailcount = sidepotfailcount + 1
6558 --startLuaCoroutine(nil, 'convertBetsToPot')
6559 print("error in convert")
6560
6561 return 1
6562 end
6563 end
6564 table.sort(playerbets, compare)
6565 for i, v in ipairs (playerbets) do
6566 if i == #playerbets then
6567 v[4] = v[1] * i
6568 else
6569 v[4] = ( v[1] - playerbets[i + 1][1]) * i
6570 end
6571 end
6572 for i, v in ipairs (chips2) do
6573 v.destruct()
6574 end
6575
6576 if clock ~= nil then
6577 clock.destruct()
6578 end
6579
6580 local spawnedcolors = {}
6581 local params = {}
6582 params.type = "backgammon_piece_white"
6583 params.position = {5, 2, 1}
6584 params.rotation = {0, 180, 0}
6585 params.scale = {0.4, 0.2, 0.4}
6586
6587 for i, v in ipairs (playerbets) do
6588 if v[1] > 0 then
6589 bettext[v[3]].setValue("Bet: $" .. tostring(v[1]))
6590 sidepottext[v[3]].setValue("Sidepot: $" .. tostring(v[4]))
6591 local p = {}
6592 local r = {}
6593 p = v[2].getPosition()
6594 r = v[2].getRotation()
6595 r.y = (r.y + 180) % 360
6596 spawnChips(v[4], p, r)
6597 local zoffset = -3
6598 local xoffset = -3
6599 p.x = p.x + (math.cos(math.rad(r.y)) * xoffset) + (math.sin(math.rad(r.y)) * zoffset)
6600 p.z = p.z - (math.sin(math.rad(r.y)) * xoffset) + (math.cos(math.rad(r.y)) * zoffset)
6601 local zoffset = 0
6602 local xoffset = 0.5
6603 spawnedcolors[#spawnedcolors + 1] = v[3]
6604 for k, w in ipairs(spawnedcolors) do
6605
6606 p.x = p.x + (math.cos(math.rad(r.y)) * xoffset) + (math.sin(math.rad(r.y)) * zoffset)
6607 p.z = p.z - (math.sin(math.rad(r.y)) * xoffset) + (math.cos(math.rad(r.y)) * zoffset)
6608 params.position = p
6609 ob = spawnObject(params)
6610 ob.setColorTint(fontcolors[w])
6611 ob.setName("Sidepotmarker")
6612 end
6613
6614 end
6615 end
6616
6617
6618
6619
6620
6621
6622 for j, v in ipairs (playerbets) do
6623
6624
6625 end
6626 sidepotcalculated = true
6627 return 1
6628end
6629
6630
6631-- chips should correspond to the chipstable, position, rotation is where the chips should move to
6632function moveChips(chips, p, r)
6633 local chipstack = initializePot()
6634 local h = {}
6635 local chips2 = {}
6636 for i, v in pairs (chipstack) do
6637 chips2[i] = {}
6638 h[i] = {}
6639 end
6640 for i, v in pairs(chipstack) do
6641 v.x = p.x + (math.cos(math.rad(r.y)) * v.xoffset) + (math.sin(math.rad(r.y)) * v.zoffset)
6642 v.z = p.z - (math.sin(math.rad(r.y)) * v.xoffset) + (math.cos(math.rad(r.y)) * v.zoffset)
6643 v.y = p.y + v.yoffset + v.height
6644 end
6645
6646 -- move also chips within the potzone
6647 for j, w in ipairs (chips) do
6648 if w.tag == "Chip" and not w.held_by_color then
6649 local hit = false
6650 for k, x in pairs (currencies) do
6651 local stack
6652 if h[x.stack] == nil then
6653 stack = "misc"
6654 else
6655 stack = x.stack
6656 end
6657 if w.getValue() == x.value or w.getName() == x.name then
6658 hit = true
6659 chips2[stack][#chips2[stack] + 1] = w
6660 if w.getQuantity() > 0 then
6661 h[stack][#h[stack] + 1] = w.getQuantity() * x.height
6662 else
6663 h[stack][#h[stack] + 1] = x.height
6664 end
6665 break -- next object
6666 end
6667 end
6668 -- unknown chips
6669 if not hit then
6670
6671 local x = currencies[#currencies] -- should be dummy value
6672 local stack = "misc"
6673 chips2[stack][#chips2[stack] + 1] = w
6674 if w.getQuantity() > 0 then
6675 h[stack][#h[stack] + 1] = w.getQuantity() * x.height
6676 else
6677 h[stack][#h[stack] + 1] = x.height
6678 end
6679 end
6680 end
6681 end
6682
6683 for i, v in pairs (chips2) do
6684 for j, w in ipairs (v) do
6685
6686 local rot = {0, 0, 0}
6687 for k, x in pairs (currencies) do
6688 if (w.getValue() == x.value) or (w.getName() == x.name) then
6689 rot.x = (r.x + x.params.rotation[1]) % 360
6690 rot.y = (r.y + x.params.rotation[2]) % 360
6691 rot.z = (r.z + x.params.rotation[3]) % 360
6692 rot[1] = rot.x
6693 rot[2] = rot.y
6694 rot[3] = rot.z
6695 end
6696 end
6697 w.setRotation(rot)
6698 w.setPosition(chipstack[i])
6699 w.translate({0, 0.1, 0})
6700 chipstack[i].y = chipstack[i].y + h[i][j]
6701 chipstack[i].height = chipstack[i].height + h[i][j]
6702 end
6703 end
6704
6705
6706 return 1
6707end
6708
6709-- spawnChips(money, position, rotation)
6710function spawnChips(money, p, r, minheight)
6711 if minheight == nil or minheight == null then
6712 minheight = 0
6713 end
6714 money = money + 0.001 -- prevents rounding error
6715 money = comma_value(money) + 0
6716
6717 local chipstack = {}
6718
6719 local params = {}
6720 local custom = {}
6721
6722 -- prevent spawning to much Chips
6723 if money > currencies[1].value * 50 then
6724
6725
6726 money = math.floor(money)
6727 params.position = p
6728 params.rotation = r
6729 params.scale = {1.12, 1.12, 1.12}
6730 params.params = {"$" .. string.format("%.0f", money) }
6731 params.type = 'Custom_Model'
6732 params.callback = nil
6733 custom.mesh = "http://cloud-3.steamusercontent.com/ugc/841461304086373873/9925B4E8ECFC5BBB13AB9FD1BB93E768C2DD3151/"
6734 custom.diffuse = "http://cloud-3.steamusercontent.com/ugc/841461304094020976/22277301EF8ACDDD4649BD6F382CF950967A8D50/"
6735
6736 custom.type = 5
6737 custom.material = 1
6738
6739 local obj = spawnObject(params)
6740 obj.setCustomObject(custom)
6741 obj.setName("$" .. comma_value(money) )
6742 printToAll('Conversion Limit reached, alternate Bar with the money value spawned', {1, 1, 0})
6743 return 1
6744 end
6745
6746
6747
6748 chipstack = initializePot()
6749
6750
6751 for i, v in pairs(chipstack) do
6752 v.x = p.x + (math.cos(math.rad(r.y)) * v.xoffset) + (math.sin(math.rad(r.y)) * v.zoffset)
6753 v.z = p.z - (math.sin(math.rad(r.y)) * v.xoffset) + (math.cos(math.rad(r.y)) * v.zoffset)
6754 v.y = p.y + v.yoffset + v.height
6755 end
6756
6757 params.rotation = r
6758 params.callback_owner = Global
6759
6760 local i = #currencies
6761 while i > 0 do
6762
6763
6764 v = currencies[i]
6765 if not (v.value == -1) then
6766 params.rotation = v.params.rotation
6767 params.scale = v.params.scale
6768 params.params = {v.name}
6769 local rot = {}
6770 rot.x = (r.x + v.params.rotation[1]) % 360
6771 rot.y = (r.y + v.params.rotation[2]) % 360
6772 rot.z = (r.z + v.params.rotation[3]) % 360
6773 rot[1] = rot.x
6774 rot[2] = rot.y
6775 rot[3] = rot.z
6776 params.rotation = rot
6777 local stack = ''
6778 if chipstack[v.stack] == nil then
6779 stack = "misc"
6780 else
6781 stack = v.stack
6782 end
6783 if not v.standard then
6784
6785 params.type = 'Custom_Model'
6786 params.callback_owner = Global
6787 custom.mesh = v.custom.mesh
6788 custom.diffuse = v.custom.diffuse
6789 custom.type = 5
6790 custom.material = 1
6791
6792
6793 local j = 0
6794 while (j < minheight) and (money >= v.value) do
6795 params.position = {}
6796 params.position.x = chipstack[stack].x
6797 params.position.y = chipstack[stack].y + chipstack[stack].height
6798 params.position.z = chipstack[stack].z
6799 local obj = spawnObject(params)
6800 obj.setCustomObject(custom)
6801 obj.setName(v.name)
6802 money = money - v.value
6803 chipstack[stack].height = chipstack[stack].height + v.height
6804 j = j + 1
6805 end
6806 else
6807 params.type = 'Chip_'.. v.value
6808 params.callback = nil
6809 params.callback_owner = Global
6810 params.params = nil
6811 local j = 0
6812 while (j < minheight) and (money >= v.value) do
6813 params.position = {}
6814 params.position.x = chipstack[stack].x
6815 params.position.y = chipstack[stack].y + chipstack[stack].height
6816 params.position.z = chipstack[stack].z
6817 spawnObject(params)
6818 money = money - v.value
6819 chipstack[stack].height = chipstack[stack].height + v.height
6820 j = j + 1
6821 end
6822 end
6823 end
6824 i = i - 1
6825 end
6826
6827
6828 for i, v in ipairs (currencies) do
6829
6830 if v.value == -1 then
6831 break -- no dummy chips spawn
6832 end
6833 params.rotation = v.params.rotation
6834 params.scale = v.params.scale
6835 params.params = {v.name}
6836 if chipstack[v.stack] == nil then
6837 stack = "misc"
6838 else
6839 stack = v.stack
6840 end
6841
6842 if not v.standard then
6843 params.type = 'Custom_Model'
6844 params.callback_owner = Global
6845 custom.mesh = v.custom.mesh
6846 custom.diffuse = v.custom.diffuse
6847 custom.type = 5
6848 custom.material = 1
6849 local rot = {}
6850 rot.x = (r.x + v.params.rotation[1]) % 360
6851 rot.y = (r.y + v.params.rotation[2]) % 360
6852 rot.z = (r.z + v.params.rotation[3]) % 360
6853 rot[1] = rot.x
6854 rot[2] = rot.y
6855 rot[3] = rot.z
6856 params.rotation = rot
6857 while money >= tonumber(v.value) do
6858 params.position = {}
6859 params.position.x = chipstack[stack].x
6860 params.position.y = chipstack[stack].y + chipstack[stack].height
6861 params.position.z = chipstack[stack].z
6862 local obj = spawnObject(params)
6863 obj.setCustomObject(custom)
6864 obj.setName(v.name)
6865 money = money - v.value
6866 chipstack[stack].height = chipstack[stack].height + v.height
6867 end
6868 else
6869 params.type = 'Chip_'.. v.value
6870 params.callback = nil
6871 params.callback_owner = Global
6872 params.params = nil
6873 while money >= v.value do
6874 params.position = {}
6875 params.position.x = chipstack[stack].x
6876 params.position.y = chipstack[stack].y + chipstack[stack].height
6877 params.position.z = chipstack[stack].z
6878 spawnObject(params)
6879 money = money - v.value
6880 chipstack[stack].height = chipstack[stack].height + v.height
6881 end
6882 end
6883 end
6884 return money -- returns the leftover money
6885end
6886
6887function sortPlayerChips(ob, pl)
6888 if Player[pl].admin then
6889 pl = ob.getDescription()
6890 elseif ob.getDescription() ~= pl then
6891 return 1
6892 end
6893
6894 local chips = {}
6895 local value
6896 value = "$" .. getChipValues(tablezones[pl], chips)
6897 if options.displayplayermoney then
6898 tablezonetext[pl].setValue(value)
6899 end
6900
6901 p = tablezones[pl].getPosition()
6902 r = tablezones[pl].getRotation()
6903
6904 xoffset = -1.15
6905 zoffset = 1
6906 x = p.x + (math.cos(math.rad(r.y)) * xoffset) + (math.sin(math.rad(r.y)) * zoffset)
6907 z = p.z - (math.sin(math.rad(r.y)) * xoffset) + (math.cos(math.rad(r.y)) * zoffset)
6908 y = p.y - 10
6909
6910 pos = {x, y, z}
6911 pos.x = x
6912 pos.y = y
6913 pos.z = z
6914
6915 r.y = (r.y + 180) % 360
6916 moveChips(chips, pos, r)
6917
6918
6919end
6920
6921function quickConvertPlayerChips10(ob, pl)
6922 if Player[pl].admin then
6923 pl = ob.getDescription()
6924 elseif ob.getDescription() ~= pl then
6925 return 1
6926 end
6927
6928
6929 if quickConvertPlayerChips == true then
6930 -- if 15 seconds are over after the last convertion then start another one (function broke before)
6931 if (os.time() - quickConvertPlayerTime) < 15 then
6932 return
6933 else
6934 quickConvertPlayerTime = os.time()
6935 end
6936 else
6937 quickConvertPlayerChips = true
6938 quickConvertPlayerTime = os.time()
6939 end
6940
6941
6942
6943
6944 quickConvertPlayersPlayer = pl
6945 quickConvertPlayersObject = ob
6946
6947 startLuaCoroutine(nil, 'quickConvertPlayerChips10Co')
6948
6949end
6950
6951function quickConvertPlayerChips10Co()
6952
6953
6954 local pl = quickConvertPlayersPlayer
6955 local ob = quickConvertPlayersObject
6956
6957
6958
6959
6960 local objects = {}
6961 local chips1 = {}
6962 local positions1 = {}
6963 local rotations1 = {}
6964
6965 v = tablezones[pl]
6966 objects = {}
6967 objects = v.getObjects()
6968 for j, w in ipairs (objects) do
6969 if w.tag == 'Chip' then
6970 if w.getValue() or currencyToNumber(w.getName()) != nil then
6971 chips1[#chips1 + 1] = w
6972 end
6973 end
6974 end
6975
6976
6977 for i, v in ipairs (chips1) do
6978 positions1[#positions1 + 1] = v.getPosition()
6979 rotations1[#rotations1 + 1] = v.getRotation()
6980 end
6981
6982 for i = 0, 2 do
6983 coroutine.yield(0)
6984 end
6985
6986
6987 objects = {}
6988 local chips2 = {}
6989 local positions2 = {}
6990 local rotations2 = {}
6991
6992 v = tablezones[pl]
6993 objects = {}
6994 objects = v.getObjects()
6995 for j, w in ipairs (objects) do
6996 if w.tag == 'Chip' then
6997 if w.getValue() or currencyToNumber(w.getName()) != nil then
6998 chips2[#chips2 + 1] = w
6999 end
7000 end
7001 end
7002
7003
7004 if #chips2 ~= #chips1 then
7005 quickConvertPlayerChips = false
7006 return 1
7007 end
7008
7009 for i = 0, 2 do
7010 coroutine.yield(0)
7011 end
7012
7013
7014 for i, v in ipairs (chips2) do
7015 positions2[#positions2 + 1] = v.getPosition()
7016 rotations2[#rotations2 + 1] = v.getRotation()
7017 end
7018
7019 --[[ Check chip positions --]]
7020 for i, v in ipairs(positions1) do
7021 if v.x ~= positions2[i].x or v.y ~= positions2[i].y or v.z ~= positions2[i].z then
7022 quickConvertPlayerChips = false
7023 return 1
7024 end
7025 end
7026
7027 --[[ Check chip rotations --]]
7028 for i, v in pairs(rotations1) do
7029 if v.x ~= rotations2[i].x or v.y ~= rotations2[i].y or v.z ~= rotations2[i].z then
7030 quickConvertPlayerChips = false
7031 return 1
7032 end
7033 end
7034
7035 local chips = {}
7036 local money = 0
7037
7038
7039 money = getChipValues(tablezones[pl], chips)
7040 --[[ Destroy old chips --]]
7041 for i, v in ipairs (chips) do
7042 v.destruct()
7043 end
7044
7045 for i = 0, 10 do
7046 coroutine.yield(0)
7047 end
7048
7049 local p = tablezones[pl].getPosition()
7050 local r = tablezones[pl].getRotation()
7051
7052 xoffset = -1.15
7053 zoffset = 1
7054 x = p.x + (math.cos(math.rad(r.y)) * xoffset) + (math.sin(math.rad(r.y)) * zoffset)
7055 z = p.z - (math.sin(math.rad(r.y)) * xoffset) + (math.cos(math.rad(r.y)) * zoffset)
7056 y = p.y - 10
7057
7058 pos = {x, y, z}
7059 pos.x = x
7060 pos.y = y
7061 pos.z = z
7062
7063 r.y = (r.y + 180) % 360
7064
7065 spawnChips(money, pos, r, 10)
7066
7067
7068 --[[ Wait five frames to allow chips to spawn before updating pot values --]]
7069
7070 quickConvertPlayerChips = false
7071 return 1
7072end
7073
7074function quickConvertPlayerChips10_5(ob, pl)
7075 if Player[pl].admin then
7076 pl = ob.getDescription()
7077 elseif ob.getDescription() ~= pl then
7078 return 1
7079 end
7080
7081 if quickConvertPlayerChips == true then
7082 -- if 30 seconds are over after the last convertion then start another one (function broke before)
7083 if (os.time() - quickConvertPlayerTime) < 30 then
7084 return
7085 else
7086 quickConvertPlayerTime = os.time()
7087 end
7088 else
7089 quickConvertPlayerChips = true
7090 quickConvertPlayerTime = os.time()
7091 end
7092
7093 quickConvertPlayersPlayer = pl
7094 quickConvertPlayersObject = ob
7095
7096 startLuaCoroutine(nil, 'quickConvertPlayerChips10_5Co')
7097
7098end
7099
7100
7101
7102
7103function quickConvertPlayerChips10_5Co()
7104 local pl = quickConvertPlayersPlayer
7105 local ob = quickConvertPlayersObject
7106
7107
7108
7109
7110 local objects = {}
7111 local chips1 = {}
7112 local positions1 = {}
7113 local rotations1 = {}
7114
7115 v = tablezones[pl]
7116 objects = {}
7117 objects = v.getObjects()
7118 for j, w in ipairs (objects) do
7119 if w.tag == 'Chip' then
7120 if w.getValue() or currencyToNumber(w.getName()) != nil then
7121 chips1[#chips1 + 1] = w
7122 end
7123 end
7124 end
7125
7126
7127 for i, v in ipairs (chips1) do
7128 positions1[#positions1 + 1] = v.getPosition()
7129 rotations1[#rotations1 + 1] = v.getRotation()
7130 end
7131
7132 for i = 0, 2 do
7133 coroutine.yield(0)
7134 end
7135
7136
7137 objects = {}
7138 local chips2 = {}
7139 local positions2 = {}
7140 local rotations2 = {}
7141
7142 v = tablezones[pl]
7143 objects = {}
7144 objects = v.getObjects()
7145 for j, w in ipairs (objects) do
7146 if w.tag == 'Chip' then
7147 if w.getValue() or currencyToNumber(w.getName()) != nil then
7148 chips2[#chips2 + 1] = w
7149 end
7150 end
7151 end
7152
7153
7154 if #chips2 ~= #chips1 then
7155 quickConvertPlayerChips = false
7156 return 1
7157 end
7158
7159 for i = 0, 2 do
7160 coroutine.yield(0)
7161 end
7162
7163
7164 for i, v in ipairs (chips2) do
7165 positions2[#positions2 + 1] = v.getPosition()
7166 rotations2[#rotations2 + 1] = v.getRotation()
7167 end
7168
7169 --[[ Check chip positions --]]
7170 for i, v in ipairs(positions1) do
7171 if v.x ~= positions2[i].x or v.y ~= positions2[i].y or v.z ~= positions2[i].z then
7172 quickConvertPlayerChips = false
7173 return 1
7174 end
7175 end
7176
7177 --[[ Check chip rotations --]]
7178 for i, v in pairs(rotations1) do
7179 if v.x ~= rotations2[i].x or v.y ~= rotations2[i].y or v.z ~= rotations2[i].z then
7180 quickConvertPlayerChips = false
7181 return 1
7182 end
7183 end
7184
7185 local chips = {}
7186 local money = 0
7187
7188
7189 money = getChipValues(tablezones[pl], chips)
7190 --[[ Destroy old chips --]]
7191 for i, v in ipairs (chips) do
7192 v.destruct()
7193 end
7194
7195 for i = 0, 10 do
7196 coroutine.yield(0)
7197 end
7198
7199 local p = tablezones[pl].getPosition()
7200 local r = tablezones[pl].getRotation()
7201
7202 xoffset = -1.15
7203 zoffset = 1
7204 x = p.x + (math.cos(math.rad(r.y)) * xoffset) + (math.sin(math.rad(r.y)) * zoffset)
7205 z = p.z - (math.sin(math.rad(r.y)) * xoffset) + (math.cos(math.rad(r.y)) * zoffset)
7206 y = p.y - 10
7207
7208 pos = {x, y, z}
7209 pos.x = x
7210 pos.y = y
7211 pos.z = z
7212
7213 r.y = (r.y + 180) % 360
7214
7215 local lowStackValue = 0
7216 lowStackValue = currencies[#currencies - 1].value * 5 + currencies[#currencies - 2].value * 5
7217 if money <= lowStackValue then
7218 spawnChips(money, pos, r, 10)
7219 else
7220
7221 money = money - lowStackValue
7222 spawnChips(money, pos, r, 5)
7223 pos["y"] = pos["y"] + 5
7224 spawnChips(lowStackValue, pos, r, 5)
7225
7226
7227 end
7228
7229
7230 for i = 0, 10 do
7231 coroutine.yield(0)
7232 end
7233 -- update money display
7234 if options.displayplayermoney then
7235 local chips = {}
7236 tablezonetext[pl].setValue("$" .. getChipValues(tablezones[pl], chips))
7237 --[[ Wait five frames to allow chips to spawn before updating pot values --]]
7238 quickConvertPlayerChips = false
7239 end
7240 return 1
7241end
7242
7243
7244
7245function splitPot2(ob, pl)
7246 if pl then
7247 if not Player[pl].admin then
7248 return 1
7249 end
7250 end
7251
7252 splitPotObject = ob;
7253 splitPotPlayers = 2;
7254
7255 local p = ob.getPosition()
7256 local r = ob.getRotation()
7257 local s = ob.getScale()
7258 params = {}
7259 params.type = 'ScriptingTrigger'
7260 params.callback = 'splitPot'
7261 params.scale = {s.x, 20, s.z * 1.9}
7262 params.position = {p.x, p.y + 10, p.z}
7263 params.rotation = r
7264
7265 splitPotZone = spawnObject(params)
7266end
7267
7268function splitPot3(ob, pl)
7269 if pl then
7270 if not Player[pl].admin then
7271 return 1
7272 end
7273 end
7274
7275 splitPotObject = ob;
7276 splitPotPlayers = 3;
7277
7278 local p = ob.getPosition()
7279 local r = ob.getRotation()
7280 local s = ob.getScale()
7281 params = {}
7282 params.type = 'ScriptingTrigger'
7283 params.callback = 'splitPot'
7284 params.scale = {s.x, 20, s.z * 1.9}
7285 params.position = {p.x, p.y + 10, p.z}
7286 params.rotation = r
7287
7288 splitPotZone = spawnObject(params)
7289end
7290
7291function splitPot4(ob, pl)
7292 if pl then
7293 if not Player[pl].admin then
7294 return 1
7295 end
7296 end
7297
7298 splitPotObject = ob;
7299 splitPotPlayers = 4 ;
7300
7301 local p = ob.getPosition()
7302 local r = ob.getRotation()
7303 local s = ob.getScale()
7304 params = {}
7305 params.type = 'ScriptingTrigger'
7306 params.callback = 'splitPot'
7307 params.scale = {s.x, 20, s.z * 1.9}
7308 params.position = {p.x, p.y + 10, p.z}
7309 params.rotation = r
7310
7311 splitPotZone = spawnObject(params)
7312end
7313
7314function splitPot5(ob, pl)
7315 if pl then
7316 if not Player[pl].admin then
7317 return 1
7318 end
7319 end
7320
7321 splitPotObject = ob;
7322 splitPotPlayers = 5;
7323
7324 local p = ob.getPosition()
7325 local r = ob.getRotation()
7326 local s = ob.getScale()
7327 params = {}
7328 params.type = 'ScriptingTrigger'
7329 params.callback = 'splitPot'
7330 params.scale = {s.x, 20, s.z * 1.9}
7331 params.position = {p.x, p.y + 10, p.z}
7332 params.rotation = r
7333
7334 splitPotZone = spawnObject(params)
7335end
7336
7337function splitPot6(ob, pl)
7338 if pl then
7339 if not Player[pl].admin then
7340 return 1
7341 end
7342 end
7343
7344 splitPotObject = ob;
7345 splitPotPlayers = 6;
7346
7347 local p = ob.getPosition()
7348 local r = ob.getRotation()
7349 local s = ob.getScale()
7350 params = {}
7351 params.type = 'ScriptingTrigger'
7352 params.callback = 'splitPot'
7353 params.scale = {s.x, 20, s.z * 1.9}
7354 params.position = {p.x, p.y + 10, p.z}
7355 params.rotation = r
7356
7357 splitPotZone = spawnObject(params)
7358end
7359
7360function splitPot7(ob, pl)
7361 if pl then
7362 if not Player[pl].admin then
7363 return 1
7364 end
7365 end
7366
7367 splitPotObject = ob;
7368 splitPotPlayers = 7;
7369
7370 local p = ob.getPosition()
7371 local r = ob.getRotation()
7372 local s = ob.getScale()
7373 params = {}
7374 params.type = 'ScriptingTrigger'
7375 params.callback = 'splitPot'
7376 params.scale = {s.x, 20, s.z * 1.9}
7377 params.position = {p.x, p.y + 10, p.z}
7378 params.rotation = r
7379
7380 splitPotZone = spawnObject(params)
7381end
7382
7383function splitPot8(ob, pl)
7384 if pl then
7385 if not Player[pl].admin then
7386 return 1
7387 end
7388 end
7389
7390 splitPotObject = ob;
7391 splitPotPlayers = 8;
7392
7393 local p = ob.getPosition()
7394 local r = ob.getRotation()
7395 local s = ob.getScale()
7396 params = {}
7397 params.type = 'ScriptingTrigger'
7398 params.callback = 'splitPot'
7399 params.scale = {s.x, 20, s.z * 1.9}
7400 params.position = {p.x, p.y + 10, p.z}
7401 params.rotation = r
7402
7403 splitPotZone = spawnObject(params)
7404end
7405
7406function splitPot9(ob, pl)
7407 if pl then
7408 if not Player[pl].admin then
7409 return 1
7410 end
7411 end
7412
7413 splitPotObject = ob;
7414 splitPotPlayers = 9;
7415
7416 local p = ob.getPosition()
7417 local r = ob.getRotation()
7418 local s = ob.getScale()
7419 params = {}
7420 params.type = 'ScriptingTrigger'
7421 params.callback = 'splitPot'
7422 params.scale = {s.x, 20, s.z * 1.9}
7423 params.position = {p.x, p.y + 10, p.z}
7424 params.rotation = r
7425
7426 splitPotZone = spawnObject(params)
7427end
7428
7429
7430function splitPot10(ob, pl)
7431 if pl then
7432 if not Player[pl].admin then
7433 return 1
7434 end
7435 end
7436
7437 splitPotObject = ob;
7438 splitPotPlayers = 10;
7439
7440 local p = ob.getPosition()
7441 local r = ob.getRotation()
7442 local s = ob.getScale()
7443 params = {}
7444 params.type = 'ScriptingTrigger'
7445 params.callback = 'splitPot'
7446 params.scale = {s.x, 20, s.z * 1.9}
7447 params.position = {p.x, p.y + 10, p.z}
7448 params.rotation = r
7449
7450 splitPotZone = spawnObject(params)
7451end
7452
7453
7454function splitPot()
7455 local chips = {}
7456 local value = 0;
7457
7458 value = getChipValues(splitPotZone, chips)
7459 leftover = 0;
7460 local spawnvalue = value / splitPotPlayers
7461
7462 for i, v in ipairs (chips) do
7463 v.destruct()
7464 end
7465
7466 local p = splitPotObject.getPosition()
7467 local r = splitPotObject.getRotation()
7468
7469
7470
7471
7472
7473
7474 local xoffset = 5.5
7475 local zoffset = -9.8
7476 local pos = {}
7477 pos.x = p.x + (math.cos(math.rad(r.y)) * xoffset) + (math.sin(math.rad(r.y)) * zoffset)
7478 pos.z = p.z - (math.sin(math.rad(r.y)) * xoffset) + (math.cos(math.rad(r.y)) * zoffset)
7479 pos.y = p.y + 0.2
7480 r[2] = r.y
7481
7482 local i = 0
7483
7484 xoffset = 12
7485 zoffset = 6.5
7486 while i < splitPotPlayers do
7487 leftover = leftover + spawnChips(spawnvalue, pos, r)
7488 pos.x = pos.x + (math.sin(math.rad(r.y)) * zoffset)
7489 pos.z = pos.z + (math.cos(math.rad(r.y)) * zoffset)
7490
7491 if i == 4 then
7492 pos.x = pos.x - (math.cos(math.rad(r.y)) * xoffset + (math.sin(math.rad(r.y)) * zoffset) * 5)
7493 pos.z = pos.z + (math.sin(math.rad(r.y)) * xoffset - (math.cos(math.rad(r.y)) * zoffset) * 5 )
7494 end
7495
7496
7497 i = i + 1
7498 end
7499
7500
7501 r = splitPotObject.getRotation()
7502 leftover = leftover + 0.1 -- avoid rounding errors for double number
7503 xoffset = -6.5
7504 zoffset = -14.8
7505 pos = {}
7506 pos.x = p.x + (math.cos(math.rad(r.y)) * xoffset) + (math.sin(math.rad(r.y)) * zoffset)
7507 pos.z = p.z - (math.sin(math.rad(r.y)) * xoffset) + (math.cos(math.rad(r.y)) * zoffset)
7508 pos.y = p.y + 0.2
7509 spawnChips(leftover, pos, r)
7510
7511
7512 splitPotZone.destruct()
7513end
7514
7515function goAllIn(ob, pl)
7516 if ob.getDescription() ~= pl then
7517 return 1
7518 end
7519
7520 if pl ~= actionon then
7521 return 0
7522 end
7523
7524 local chips = {}
7525 getChipValues(betzones[pl], chips)
7526 getChipValues(tablezones[pl], chips)
7527 p = betzones[pl].getPosition()
7528 r = betzones[pl].getRotation()
7529 p.y = p.y - 10
7530
7531 moveChips(chips, p, r)
7532
7533
7534end
7535
7536function compare(a, b)
7537 return a[1] > b[1]
7538end
7539
7540function goAFK(ob, pl)
7541 if Player[pl].admin then
7542 pl = ob.getDescription()
7543 elseif ob.getDescription() ~= pl then
7544 return 1
7545 end
7546
7547 local objects = betzones[pl].getObjects()
7548 local x = 0
7549 local found = false
7550
7551 for i, v in ipairs(objects) do
7552 if v.getName() == "AFK" then
7553 found = true
7554 v.destruct()
7555 end
7556 end
7557 if afkClock[pl] ~= nil then
7558 found = true
7559 afkClock[pl].destruct()
7560 afkClock[pl] = nil
7561 end
7562
7563 if not found then
7564 local params = {}
7565 params.type = 'Custom_Model'
7566 params.position = betzones[pl].getPosition()
7567 params.scale = {1, 1, 1}
7568 params.rotation = betzones[pl].getPosition()
7569
7570 local playerhand = getPlayerHandPositionAndRotation(pl)
7571 params.position = {playerhand['pos_x'] + playerhand['trigger_forward_x'] * 5, 1.4, playerhand['pos_z'] + playerhand['trigger_forward_z'] * 5}
7572 params.rotation = {0, playerhand['rot_y'], 0}
7573 params.callback = 'setAfkButton'
7574 afkButton = spawnObject(params)
7575
7576 local custom = {}
7577 custom.mesh = 'pastebin.com/raw.php?i=qv6mnq65'
7578 custom.diffuse = 'http://cloud-3.steamusercontent.com/ugc/922552872558391998/0518FECF3F4FD1D5BEA34B793FE1C194EEF08483/'
7579 custom.type = 0
7580
7581 afkButton.setCustomObject(custom)
7582 afkButton.setName('AFK')
7583
7584 params = {}
7585 params.type = 'Digital_Clock'
7586
7587 params.position = {playerhand['pos_x'] + playerhand['trigger_forward_x'] * 8, 0.5, playerhand['pos_z'] + playerhand['trigger_forward_z'] * 8}
7588 params.rotation = {90, playerhand['rot_y'], 0}
7589
7590 params.callback = 'setAfkClockTimer'
7591 afkClock[pl] = spawnObject(params)
7592
7593 end
7594
7595end
7596
7597function setAfkButton(ob, pl)
7598 ob.lock()
7599end
7600
7601function setPlayerAfk(ob, pl)
7602 if pl then
7603 if not Player[pl].admin then
7604 return 1
7605 end
7606 end
7607 if actionon ~= nil then
7608 goAFK(ob, actionon)
7609 end
7610end
7611
7612
7613function setAfkClockTimer(ob, pl)
7614 ob.lock()
7615 ob.Clock.startStopwatch()
7616 ob.setColorTint({0.1, 0.1, 0.1})
7617 ob.setName("AFK")
7618 --afkClock[pl].lock()
7619 --afkClock[pl].Clock.startStopwatch()
7620end
7621
7622function changeMachineButton1(ob, pl)
7623 if not converting then
7624 convertingPlayerColor = pl
7625 convertingPlayer = true
7626 conversionPlayerValue = 1
7627 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7628 end
7629end
7630
7631function changeMachineButton2(ob, pl)
7632 if not converting then
7633 convertingPlayerColor = pl
7634 convertingPlayer = true
7635 conversionPlayerValue = 2
7636 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7637 end
7638end
7639
7640function changeMachineButton3(ob, pl)
7641 if not converting then
7642 convertingPlayerColor = pl
7643 convertingPlayer = true
7644 conversionPlayerValue = 3
7645 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7646 end
7647end
7648
7649function changeMachineButton4(ob, pl)
7650 if not converting then
7651 convertingPlayerColor = pl
7652 convertingPlayer = true
7653 conversionPlayerValue = 4
7654 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7655 end
7656end
7657
7658function changeMachineButton5(ob, pl)
7659 if not converting then
7660 convertingPlayerColor = pl
7661 convertingPlayer = true
7662 conversionPlayerValue = 5
7663 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7664 end
7665end
7666
7667
7668function changeMachineButton6(ob, pl)
7669 if not converting then
7670 convertingPlayerColor = pl
7671 convertingPlayer = true
7672 conversionPlayerValue = 6
7673 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7674 end
7675end
7676
7677function changeMachineButton7(ob, pl)
7678 if not convertingPlayer then
7679 convertingPlayerColor = pl
7680 convertingPlayer = true
7681 conversionPlayerValue = 7
7682 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7683
7684 end
7685end
7686
7687function changeMachineButton8(ob, pl)
7688 if not convertingPlayer then
7689 convertingPlayerColor = pl
7690 convertingPlayer = true
7691 conversionPlayerValue = 8
7692 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7693
7694 end
7695end
7696
7697function changeMachineButton9(ob, pl)
7698 if not convertingPlayer then
7699 convertingPlayerColor = pl
7700 convertingPlayer = true
7701 conversionPlayerValue = 9
7702 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7703
7704 end
7705end
7706
7707function changeMachineButton10(ob, pl)
7708 if not convertingPlayer then
7709 convertingPlayerColor = pl
7710 convertingPlayer = true
7711 conversionPlayerValue = 10
7712 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7713 end
7714end
7715
7716
7717function changeMachineButton11(ob, pl)
7718 if not converting then
7719 clicker = player
7720 convertingPlayer = true
7721 conversionPlayerValue = 11
7722 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7723 end
7724end
7725
7726function changeMachineButton12(ob, pl)
7727 if not converting then
7728 clicker = player
7729 convertingPlayer = true
7730 conversionPlayerValue = 12
7731 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7732 end
7733end
7734
7735function changeMachineButton13(ob, pl)
7736 if not converting then
7737 clicker = player
7738 convertingPlayer = true
7739 conversionPlayerValue = 13
7740 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7741 end
7742end
7743
7744function changeMachineButton14(ob, pl)
7745 if not converting then
7746 clicker = player
7747 convertingPlayer = true
7748 conversionPlayerValue = 14
7749 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7750 end
7751end
7752
7753function changeMachineButton15(ob, pl)
7754 if not converting then
7755 clicker = player
7756 convertingPlayer = true
7757 conversionPlayerValue = 15
7758 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7759 end
7760end
7761
7762
7763function changeMachineButton16(ob, pl)
7764 if not converting then
7765 clicker = player
7766 convertingPlayer = true
7767 conversionPlayerValue = 16
7768 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7769 end
7770end
7771
7772function changeMachineButton17(ob, pl)
7773 if not convertingPlayer then
7774 convertingPlayerColor = pl
7775 convertingPlayer = true
7776 conversionPlayerValue = 17
7777 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7778
7779 end
7780end
7781
7782function changeMachineButton18(ob, pl)
7783 if not convertingPlayer then
7784 convertingPlayerColor = pl
7785 convertingPlayer = true
7786 conversionPlayerValue = 18
7787 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7788
7789 end
7790end
7791
7792function changeMachineButton19(ob, pl)
7793 if not convertingPlayer then
7794 convertingPlayerColor = pl
7795 convertingPlayer = true
7796 conversionPlayerValue = 19
7797 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7798
7799 end
7800end
7801
7802function changeMachineButton20(ob, pl)
7803 if not convertingPlayer then
7804 convertingPlayerColor = pl
7805 convertingPlayer = true
7806 conversionPlayerValue = 20
7807 ChangeMachineZone = spawnChangeMachineZone(ob, pl)
7808 end
7809end
7810
7811
7812
7813
7814
7815
7816function spawnChangeMachineZone(ob, pl)
7817 --[[spawn scripting zone on in surface--]]
7818 local p = ob.getPosition()
7819 local r = ob.getRotation()
7820 local s = ob.getScale()
7821
7822 params = {}
7823
7824 params.type = 'ScriptingTrigger'
7825 params.callback = 'checkChangeMachineZone'
7826 params.scale = {s.x * 2, 20, s.z}
7827 params.position = {p.x - ((s.z / 2) * math.sin(math.rad(r.y))), p.y + 9, p.z - ((s.z / 2) * math.cos(math.rad(r.y)))}
7828 params.rotation = ob.getRotation()
7829
7830 changeMachineZone = spawnObject(params)
7831end
7832
7833function checkChangeMachineZone()
7834 startLuaCoroutine(nil, 'checkChangeMachineZoneCoroutine')
7835end
7836
7837function checkChangeMachineZoneCoroutine()
7838 local objects1 = changeMachineZone.getObjects()
7839 local positions1 = {}
7840 local rotations1 = {}
7841
7842 for i, v in ipairs(objects1) do
7843 positions1[#positions1 + 1] = v.getPosition()
7844 rotations1[#rotations1 + 1] = v.getRotation()
7845 end
7846
7847 for i = 1, 2 do
7848 coroutine.yield(0)
7849 end
7850
7851 local objects2 = changeMachineZone.getObjects()
7852 local positions2 = {}
7853 local rotations2 = {}
7854
7855 --[[ Abort if the amount of chips/stacks changed --]]
7856 if #objects1 ~= #objects2 then
7857 broadcastToColor('Conversion aborted. Please wait for chips to be at rest on the platform and try again.', convertingPlayerColor, {1, 0, 0})
7858 changeMachineZone.destruct()
7859 converting = false
7860 return 1
7861 end
7862
7863 for i, v in ipairs(objects1) do
7864 positions2[#positions2 + 1] = v.getPosition()
7865 rotations2[#rotations2 + 1] = v.getRotation()
7866 end
7867
7868 --[[ Abort if any chips/stacks are moving --]]
7869 for i, v in ipairs (positions1) do
7870 if v.x ~= positions2[i].x or v.y ~= positions2[i].y or v.z ~= positions2[i].z then
7871 broadcastToColor ('Conversion aborted. Please wait for chips to be at rest on the platform and try again.', convertingPlayerColor, {1, 0, 0})
7872 changeMachineZone.destruct()
7873 convertingPlayer = false
7874 return 1
7875 end
7876
7877 if rotations1[i].x ~= rotations2[i].x or rotations1[i].y ~= rotations2[i].y or rotations1[i].z ~= rotations2[i].z then
7878 broadcastToColor ('Conversion aborted. Please wait for chips to be at rest on the platform and try again.', convertingPlayerColor, {1, 0, 0})
7879 changeMachineZone.destruct()
7880 convertingPlayer = false
7881 return 1
7882 end
7883 end
7884
7885 local pos = changeMachineZone.getPosition()
7886 pos["y"] = 2
7887 local rot = changeMachineZone.getRotation()
7888 rot["y"] = (rot["y"] + 180) % 360
7889 local chips = {}
7890 money = getChipValues(changeMachineZone, chips)
7891
7892 for i, v in ipairs(chips) do
7893 v.destruct()
7894 end
7895
7896 convertchangeMachine(money, pos, rot, 25)
7897
7898 changeMachineZone.destruct()
7899 convertingPlayer = false
7900 --calculateAndConvert()
7901 return 1
7902end
7903
7904
7905
7906function convertchangeMachine(money, p, r, height)
7907
7908
7909 local chipstack = {}
7910 chipstack = initializePot()
7911 for i, v in pairs(chipstack) do
7912 v.x = p.x + (math.cos(math.rad(r.y)) * v.xoffset) + (math.sin(math.rad(r.y)) * v.zoffset)
7913 v.z = p.z - (math.sin(math.rad(r.y)) * v.xoffset) + (math.cos(math.rad(r.y)) * v.zoffset)
7914 v.y = p.y + v.yoffset + v.height
7915 end
7916
7917 local v = {}
7918 v = currencies[conversionPlayerValue]
7919 local custom = {}
7920 if v.value > 0 then
7921 params.rotation = v.params.rotation
7922 params.scale = v.params.scale
7923 params.params = {v.name}
7924 local rot = {}
7925 rot.x = (r.x + v.params.rotation[1]) % 360
7926 rot.y = (r.y + v.params.rotation[2]) % 360
7927 rot.z = (r.z + v.params.rotation[3]) % 360
7928 rot[1] = rot.x
7929 rot[2] = rot.y
7930 rot[3] = rot.z
7931 params.rotation = rot
7932 if chipstack[v.stack] == nil then
7933 stack = "misc"
7934 else
7935 stack = v.stack
7936 end
7937 if not v.standard then
7938 params.type = 'Custom_Model'
7939 params.callback_owner = Global
7940 custom.mesh = v.custom.mesh
7941 custom.diffuse = v.custom.diffuse
7942 custom.type = 5
7943 custom.material = 1
7944 local i = 0
7945 while money >= tonumber(v.value) and i < height do
7946 params.position = {}
7947 params.position.x = chipstack[stack].x
7948 params.position.y = chipstack[stack].y + chipstack[stack].height
7949 params.position.z = chipstack[stack].z
7950 local obj = spawnObject(params)
7951 obj.setCustomObject(custom)
7952 obj.setName(v.name)
7953 money = money - v.value
7954 chipstack[stack].height = chipstack[stack].height + v.height
7955 i = i + 1
7956 if i >= height then
7957 broadcastToColor("Conversion limit reached. The difference is spawned with the least amount of chips as possible", convertingPlayerColor, {1, 1, 0})
7958 end
7959 end
7960 else
7961 params.type = 'Chip_'.. v.value
7962 params.callback = nil
7963 params.callback_owner = Global
7964 params.params = nil
7965 local i = 0
7966 while money >= v.value and i < height do
7967 params.position = {}
7968 params.position.x = chipstack[stack].x
7969 params.position.y = chipstack[stack].y + chipstack[stack].height
7970 params.position.z = chipstack[stack].z
7971 spawnObject(params)
7972 money = money - v.value
7973 chipstack[stack].height = chipstack[stack].height + v.height
7974 i = i + 1
7975 if i >= height then
7976 broadcastToColor("Conversion limit reached. The difference is spawned with the least amount of chips as possible", convertingPlayerColor, {1, 1, 0})
7977 end
7978 end
7979 end
7980 end
7981
7982 p["y"] = 10
7983 spawnChips(money, p, r)
7984 convertingPlayer = false
7985end
7986
7987
7988function loadSaveBag(ob, pl)
7989 for i, v in ipairs(savebag.getObjects()) do
7990
7991 if v.name == Player[pl].steam_name then
7992 local params = {}
7993 --params.position = Vector –Optional. Defaults to the container’s position + 2 in the x direction.
7994 --params.rotation = Vector –Optional. Defaults to the container’s rotation.
7995 params.position = tablezones[pl].getPosition()
7996 params.position.y = params.position.y - 8
7997 params.rotation = tablezones[pl].getRotation()
7998 params.callback_owner = Global
7999 --params.guid = v.guid
8000 params.index = v.index
8001 saves[pl] = savebag.takeObject(params)
8002 if saves[pl].getDescription() == "" then
8003 for i, v in ipairs (getSeatedPlayers()) do
8004 if Player[v].admin then
8005 broadcastToColor('Warning: Steamid not found on savebag for player ' .. Player[pl].steam_name, v, {1, 1, 0})
8006 end
8007 end
8008 elseif saves[pl].getDescription() != Player[pl].steam_id then
8009 for i, v in ipairs (getSeatedPlayers()) do
8010 if Player[v].admin then
8011 broadcastToColor('Warning: Steamid on savebag dont match the current player ' .. Player[pl].steam_name, v, {1, 1, 0})
8012 end
8013 end
8014 end
8015 return 1
8016 end
8017 end
8018 for i, v in ipairs (getSeatedPlayers()) do
8019 if Player[v].admin or v == pl then
8020 broadcastToColor('Warning: no save found for player ' .. Player[pl].steam_name .. '.', v, {1, 1, 0})
8021 end
8022 end
8023end
8024
8025
8026
8027--[[ rPrint(struct, [limit], [indent]) Recursively print arbitrary data.
8028 Set limit (default 100) to stanch infinite loops.
8029 Indents tables as [KEY] VALUE, nested tables as [KEY] [KEY]...[KEY] VALUE
8030 Set indent ("") to prefix each line: Mytable [KEY] [KEY]...[KEY] VALUE
8031--]]
8032function rPrint(s, l, i) -- recursive Print (structure, limit, indent)
8033 l = (l) or 100; i = i or ""; -- default item limit, indent string
8034 if (l < 1) then print "ERROR: Item limit reached."; return l - 1 end;
8035 local ts = type(s);
8036 if (ts ~= "table") then print (i, ts, s); return l - 1 end
8037 print (i, ts); -- print "table"
8038 for k, v in pairs(s) do -- print "[ KEY ] VALUE"
8039 l = rPrint(v, l, i.."\t[ "..tostring(k).." ] ");
8040 if (l < 0) then break end
8041 end
8042 return l
8043 end
8044
8045 function comma_value(n) -- credit http://richard.warburton.it
8046 local left, num, right = string.match(n, '^([^%d]*%d)(%d*)(.-)$')
8047 return left..(num:reverse():gsub('(%d%d%d)', '%1,'):reverse())..right
8048 end
8049
8050 --[[ a crude conversion function to convert a currency to a number. DOES NOT ACCOUNT FOR NEGATIVE NUMBERS. accounts for decimals (for example, a crude conversion function to convert a currency to a number. DOES NOT ACCOUNT FOR NEGATIVE NUMBERS. accounts for decimals (for example, $2.50), but will return nil if multiple dots are found, as a valid number would only have one (using american formatting anyway). does not account for other characters, however, so a random string of mixed up numbers and letters will return a value. --]]
8051 function currencyToNumber(s)
8052 local value = 0 -- the value is updated as numbers are found in the string
8053 local dec = 1 -- the decimal places (is that the right term?), multiplied by 10 each time a number is found
8054 local decimalfound = false -- the first time a decimal point is found, used to check for invalid number strings if it finds multiple decimal points (like an ip address)
8055 local r = string.reverse(s) -- reverse the original string to simplify analysis
8056 for i = 1, string.len(r) do
8057 if tonumber(string.sub(r, i, i)) then -- if the character is a number, add its value times the decimal places to the 'value' variable
8058 value = value + (tonumber(string.sub(r, i, i)) * dec)
8059 dec = dec * 10
8060 elseif string.sub(r, i, i) == '.' then -- if the character is a decimal point, divide the value by the decimal places and reset the 'dec' variable to 1
8061 if decimalfound then return nil end
8062 value = value / dec
8063 dec = 1
8064 decimalfound = true
8065 end
8066 end
8067 if value ~= 0 then return value else return nil end -- return the value if it's not still 0, otherwise return nil
8068 end