function get_module_name() return "NPC_Bingo" end function GambitKoala_Initiate() cprint("Gambit the Gambler stares at you with a weird smirk on his face..") dlg_title("Gambit the Gambler") dlg_text("Hehehe.. Nerk nerk! Wanna play some bingo?") dlg_menu("[ Bingo? ]", "GambitKoala_Explain(1)") dlg_menu("[ My current offences ]", "GambitKoala_Explain(4)") dlg_menu(" --------------------- ", "Theresa_doNothing()") dlg_menu("[ Play for Ruppees ]", "GambitKoala_PickBets(1)") dlg_menu("[ Play for CM ]", "GambitKoala_PickBets(2)") if gv("lv") >= 150 then dlg_menu("[ Play for exp ]", "GambitKoala_PickBets(3)") end dlg_menu(" --------------------- ", "Theresa_doNothing()") dlg_menu("[ Close ]", "") dlg_show() end function GambitKoala_Explain(qCode) dlg_title("Gambit the Gambler") if qCode == 1 then dlg_text("NERK! I have a little.. Gambling problem - okay? How about you give me a litttttle bit of them sweet Ruppees or better yet - the [CM] - you have?") dlg_menu("[ Why should I? ]", "GambitKoala_Explain(2)") dlg_menu("[ What about exp? ]", "GambitKoala_Explain(5)") elseif qCode == 2 then dlg_text("Well.. NERK! I might give you something worth the value back to you! NERK!") dlg_menu("[ How do I win? ]", "GambitKoala_Explain(3)") elseif qCode == 3 then dlg_text("You see this dice over here? This a special dice.. NERK! If I roll your number - you win!") elseif qCode == 4 then -- Fetch current macro fails; local mf = get_flag("mf") if mf == "" then set_flag("mf","0") mf = "0" end dlg_text("Your current offences are "..tostring(mf).."/5 fails. Upon reaching 5/5 and failing again you will be disconnected.") elseif qCode == 5 then dlg_text("For experience? I only bet that with strong heroes like I am. Ater level 150 we can discuss that again..") end dlg_menu("[ Alright, got it. ]", "GambitKoala_Initiate()") dlg_show() end function GambitKoala_PickBets(qCode) cprint("Gambit the Gamblers face lights up as he sees a chance to gamble.") dlg_title("Gambit the Gambler") if qCode == 1 then dlg_text("Meh.. Ruppees? Alright. Pick a table and place your bets!") dlg_menu(" --------------------- ", "Gambit_doNothing()") dlg_menu("[ 1 Million ]", "GambitKoala_prePickTable(1000000,1,15)") dlg_menu("[ 5 Million ]", "GambitKoala_prePickTable(5000000,1,13)") dlg_menu("[ 10 Million ]", "GambitKoala_prePickTable(10000000,1,11)") dlg_menu("[ 25 Million ]", "GambitKoala_prePickTable(25000000,1,9)") dlg_menu("[ 50 Million ]", "GambitKoala_prePickTable(50000000,1,7)") dlg_menu("[ 100 Million ]", "GambitKoala_prePickTable(100000000,1,5)") dlg_menu("[ 500 Million ]", "GambitKoala_prePickTable(500000000,1,4)") dlg_menu("[ 1 Billion ]", "GambitKoala_prePickTable(1000000000,1,3)") dlg_menu("[ 2 Billion ]", "GambitKoala_prePickTable(2000000000,1,2)") elseif qCode == 2 then dlg_text("NEEEEEERK! CHALLENGE MARKS! Quickly, place your bets!!") dlg_menu(" --------------------- ", "Gambit_doNothing()") dlg_menu("[ 1 CM ]", "GambitKoala_prePickTable(1,2,12)") dlg_menu("[ 5 CM ]", "GambitKoala_prePickTable(5,2,10)") dlg_menu("[ 10 CM ]", "GambitKoala_prePickTable(10,2,8)") dlg_menu("[ 15 CM ]", "GambitKoala_prePickTable(15,2,7)") dlg_menu("[ 25 CM ]", "GambitKoala_prePickTable(25,2,5)") dlg_menu("[ 50 CM ]", "GambitKoala_prePickTable(50,2,4)") dlg_menu("[ 100 CM ]", "GambitKoala_prePickTable(50,2,3)") elseif qCode == 3 and gv("lv") >= 150 then dlg_text("Like I'd need any experience.. But I can always use some more!") dlg_menu(" --------------------- ", "Gambit_doNothing()") dlg_menu("[ 5% experience ]", "GambitKoala_prePickTable(5,3,12)") dlg_menu("[ 10% experience ]", "GambitKoala_prePickTable(10,3,10)") dlg_menu("[ 15% experience ]", "GambitKoala_prePickTable(15,3,8)") dlg_menu("[ 20% experience ]", "GambitKoala_prePickTable(20,3,6)") dlg_menu("[ 25% experience ]", "GambitKoala_prePickTable(25,3,4)") dlg_menu("[ 35% experience ]", "GambitKoala_prePickTable(35,3,2)") end dlg_menu(" --------------------- ", "Gambit_doNothing()") dlg_menu("[ Go back ]", "GambitKoala_Initiate()") dlg_show() end function Gambit_doNothing() return end function GambitKoala_prePickTable(aValue,bType,maxChance) if bType == 3 then GambitKoala_PickTable(aValue,bType,maxChance,1) else dlg_title("Gambit the Gambler") dlg_text("How many times would you like to bet me?") dlg_menu("[ 1 time ]", "GambitKoala_PickTable("..aValue..","..bType..","..maxChance..",1)") dlg_menu("[ 5 times ]", "GambitKoala_PickTable("..aValue..","..bType..","..maxChance..",5)") dlg_menu("[ 10 times ]", "GambitKoala_PickTable("..aValue..","..bType..","..maxChance..",10)") dlg_menu("[ Go back ]", "GambitKoala_PickBets("..bType..")") dlg_show() end end function GambitKoala_PickTable(aValue,bType,maxChance,times) dlg_title("Gambit the Gambler") dlg_text("PICK YOUR POISON!") for i = 1, maxChance, 1 do dlg_menu("[ Pick "..tostring(i).." ]", "GambitKoala_Validate("..aValue..","..bType..","..i..","..maxChance..","..times..")") end dlg_menu(" --------------------- ", "Gambit_doNothing()") dlg_menu("[ Change bet ]", "GambitKoala_PickBets("..bType..")") dlg_menu("[ Nevermind.. ]", " ") dlg_menu("[ Go back ]", "GambitKoala_Initiate()") dlg_show() end function GambitKoala_Validate(aValue,bType,uNum,maxChance,times) update_gold_chaos() local userRups = gv("gold") local userLev = gv("lv") aValue = aValue*times dlg_title("Gambit the Gambler") if (userRups < aValue and bType == 1) or (not validateMarks(aValue) and bType == 2) or (userLev < 150 and bType == 3) then cprint("Gambit the Gambler sniffs through your inventory..") dlg_text("Go away! SHOO! Come back when you actually have anything to bet on!") dlg_menu("[ Yeah okay.. ]", "") else dlg_text("Are you ready to gamble? NERK! NERK!") -- Antibot measure; local antibot = math.random(1,8) aValue = aValue/times if antibot == 1 or antibot == 5 then dlg_menu("<#2ecc71>[ Roll the dice ]", "GambitKoala_PlaceBets("..aValue..","..bType..","..uNum..","..maxChance..","..times..")") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") elseif antibot == 2 or antibot == 6 then dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("<#3498db>[ Roll the dice ]", "GambitKoala_PlaceBets("..aValue..","..bType..","..uNum..","..maxChance..","..times..")") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") elseif antibot == 3 or antibot == 7 then dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("<#9b59b6>[ Roll the dice ]", "GambitKoala_PlaceBets("..aValue..","..bType..","..uNum..","..maxChance..","..times..")") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") elseif antibot == 4 or antibot == 8 then dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("[ Macro protection ]", "GambitKoala_MacroProtection()") dlg_menu("<#f1c40f>[ Roll the dice ]", "GambitKoala_PlaceBets("..aValue..","..bType..","..uNum..","..maxChance..","..times..")") end dlg_menu(" --------------------- ", "Gambit_doNothing()") dlg_menu("[ Change bet ]", "GambitKoala_PickBets("..bType..")") dlg_menu("[ No.. Nevermind! ]", "GambitKoala_Initiate()") end dlg_show() end function GambitKoala_MacroProtection() -- Fetch current macro fails; local mf = get_flag("mf") if mf == "" then set_flag("mf","0") mf = "0" end cprint("<#f1c40f>You have "..tostring(mf).."/5 macro protection failures.") if mf == 0 then set_flag("mf","1") elseif mf == 1 then set_flag("mf","2") elseif mf == 2 then set_flag("mf","3") elseif mf == 3 then set_flag("mf","4") elseif mf == 4 then set_flag("mf","5") dlg_general("If you fail one more macro protection you will be disconnected.") elseif mf == 5 then set_flag("mf","0") notice("Gambit the Gambler has whooped "..gv("name").." ass for trying to macro him!") kick() end end function GambitKoala_PlaceBets(aValue,bType,uNum,maxChance,times) local timesWon = 0 local timesLost = 0 local timesPlayed = 0 local numbersShuffeled local userBet = 0 for i = 1, times, 1 do local rndResult = math.random(1,maxChance) userBet = rndResult local userRups = gv("gold") local userExp = gv("exp") local wonBet = false if numbersShuffeled == nil then numbersShuffeled = tostring(rndResult) else numbersShuffeled = tostring(numbersShuffeled)..", "..tostring(rndResult) end if rndResult == uNum then wonBet = true timesWon = timesWon+1 else timesLost = timesLost+1 end timesPlayed = timesPlayed+1 if not wonBet then if get_flag("gambitLost") == "" then set_flag("gambitLost", 1) else set_flag("gambitLost", tonumber(get_flag("gambitLost"))+1) end if (get_global_variable("gambitLost_n") == "") or (get_global_variable("gambitLost_t") == "") then set_global_variable("gambitLost_n", gv("name")) set_global_variable("gambitLost_t", get_flag("gambitLost")) else local loseLeader = get_global_variable("gambitLost_n") local loseTimes = tonumber(get_global_variable("gambitLost_t")) local myLoseTimes = tonumber(get_flag("gambitLost")) if (loseTimes < myLoseTimes) and (loseLeader ~= gv("name")) then announce(""..gv("name").." is now the loser of Gambit the Gambler with "..tostring(get_flag("gambitLost")).." losing bets!") set_global_variable("gambitLost_n", gv("name")) set_global_variable("gambitLost_t", get_flag("gambitLost")) elseif (loseTimes < myLoseTimes) and (loseLeader == gv("name")) then set_global_variable("gambitLost_n", gv("name")) set_global_variable("gambitLost_t", get_flag("gambitLost")) end end if bType == 1 then sv("gold",userRups-aValue) update_gold_chaos() elseif bType == 2 then removeMarks(aValue) elseif bType == 3 then sv("exp", userExp - (userExp * (aValue / 100))) end else if get_flag("gambitWon") == "" then set_flag("gambitWon", 1) else set_flag("gambitWon", tonumber(get_flag("gambitWon"))+1) end if (get_global_variable("gambitWon_n") == "") or (get_global_variable("gambitWon_t") == "") then set_global_variable("gambitWon_n", gv("name")) set_global_variable("gambitWon_t", get_flag("gambitWon")) else local winLeader = get_global_variable("gambitWon_n") local winTimes = tonumber(get_global_variable("gambitWon_t")) local myWinTimes = tonumber(get_flag("gambitWon")) if (winTimes < myWinTimes) and (winLeader ~= gv("name")) then announce(""..gv("name").." is now the leader of Gambit the Gambler with "..tostring(get_flag("gambitWon")).." winning bets!") set_global_variable("gambitWon_n", gv("name")) set_global_variable("gambitWon_t", get_flag("gambitWon")) elseif (winTimes < myWinTimes) and (winLeader == gv("name")) then set_global_variable("gambitWon_n", gv("name")) set_global_variable("gambitWon_t", get_flag("gambitWon")) end end local giveJunk = math.random(0, 10) if giveJunk <= 8 then GambitKoala_GiveJunk() else GambitKoala_GiveGood() end end end cprint("You bet on "..tostring(uNum)..". Gambit the Gambler shuffled the following dices: "..numbersShuffeled..".") cprint("You lost the bet x"..timesLost.." times and won the bet x"..timesWon.." times.") if times == 1 then GambitKoala_PickTable(aValue,bType,maxChance,times) end end function GambitKoala_GiveGood() local rndReward_r = math.random(1,19) -- Real rewards; -- Expert shards; local rr_1 = math.random(801321, 801324) local rr_1_amount = math.random(1,15) -- Rage stone; local rr_2 = 801325 local rr_2_amount = 1 -- Deva's blessing; local rr_3 = 601100231 local rr_3_amount = math.random(5,15) -- Non tradable taming scroll; local rr_4 = 491008 local rr_4_amount = math.random(1,15) -- T-Pro, tradable; local rr_5 = 960021 local rr_5_amount = math.random(1,10) -- Gender change pot; local rr_6 = 960123 local rr_6_amount = 1 -- Char name change; local rr_7 = 930042 local rr_7_amount = 1 -- Homonculus; local rr_8 = 601100284 local rr_8_amount = 1 -- RB; local rr_9 = 2011369 local rr_9_amount = 1 -- Lv150-160 cs helms; local t1helms = { 302701, 302705, 302709, 302713 } local rr_10_t1 = t1helms[math.random(1,4)] local t2helms = { 302717, 302721, 302725, 302729 } local rr_10_t2 = t2helms[math.random(1,4)] local t3helms = { 302733, 302737, 302741, 302745 } local rr_10_t3 = t3helms[math.random(1,4)] local rr_10_amount = 1 -- Teardrops; local rr_11 = math.random(810301, 810314) local rr_11_amount = math.random(1,2) -- Challenge marks; local rr_12 = 2021300 local rr_12_amount = math.random(1,25) -- Arena crystals; local rr_13 = 3800283 local rr_13_amount = math.random(1,25) -- Random summoning scroll; local rr_14 = 3630270 local rr_14_amount = math.random(1,15) -- Mohi, Snooby etc looters; local rr_15 = math.random(2012151, 2012156) local rr_15_amount = 1 -- Skin colors; local rr_17 = math.random(960116, 960120) local rr_17_amount = 1 -- Sealing scrolls; local rr_18 = 705002 local rr_18_amount = math.random(1,15) -- Choose what items we're gonna give; local rr_good_chance = 25 local rr_got_chance = math.random(0,100) local gg_id, gg_amount if rndReward_r == 1 then gg_id = rr_1 gg_amount = rr_1_amount elseif rndReward_r == 2 then gg_id = rr_2 gg_amount = rr_2_amount elseif rndReward_r == 3 then gg_id = rr_3 gg_amount = rr_3_amount elseif rndReward_r == 4 then gg_id = rr_4 gg_amount = rr_4_amount elseif rndReward_r == 5 then gg_id = rr_5 gg_amount = rr_5_amount elseif rndReward_r == 6 then gg_id = rr_6 gg_amount = rr_6_amount elseif rndReward_r == 7 then gg_id = rr_7 gg_amount = rr_7_amount elseif rndReward_r == 8 then gg_id = rr_8 gg_amount = rr_8_amount elseif rndReward_r == 9 then gg_id = rr_9 gg_amount = rr_9_amount elseif rndReward_r == 10 then gg_id = rr_10_t1 gg_amount = rr_10_amount notice(gv("name").." just ripped the Gambit the Gambler off with a ["..get_item_name_by_code(rr_10_t1).."]!") elseif rndReward_r == 11 then gg_id = rr_10_t2 gg_amount = rr_10_amount notice(gv("name").." just ripped the Gambit the Gambler off with a ["..get_item_name_by_code(rr_10_t2).."]!") elseif rndReward_r == 12 then gg_id = rr_10_t3 gg_amount = rr_10_amount notice(gv("name").." just ripped the Gambit the Gambler off with a ["..get_item_name_by_code(rr_10_t3).."]!") elseif rndReward_r == 13 then gg_id = rr_11 gg_amount = rr_11_amount notice(gv("name").." just ripped the Gambit the Gambler off with x"..tostring(rr_11_amount).." ["..get_item_name_by_code(rr_1).."]!") elseif rndReward_r == 14 then gg_id = rr_12 gg_amount = rr_13_amount elseif rndReward_r == 15 then gg_id = rr_13 gg_amount = rr_13_amount elseif rndReward_r == 16 then gg_id = rr_14 gg_amount = rr_14_amount elseif rndReward_r == 17 then gg_id = rr_15 gg_amount = rr_15_amount elseif rndReward_r == 18 then gg_id = rr_17 gg_amount = rr_17_amount elseif rndReward_r == 19 then gg_id = rr_18 gg_amount = rr_18_amount end -- Display a message and give item; if gg_id == rr_15 then insert_item(gg_id, gg_amount, 0, 1, 32) else insert_item(gg_id, gg_amount, 0, 1, 2) end cprint("You have received x"..tostring(gg_amount).." ["..get_item_name_by_code(gg_id).."] from Gambit the Gambler.") end function GambitKoala_GiveJunk() local rndReward_j = math.random(1,8) -- Junk; -- Boxes that contain altered pieces and epic stones; local rnd_1_min = 3600033 local rnd_1_max = 3600039 -- Strike/def cube random box; local rnd_2_min = 2010711 local rnd_2_max = 2010722 -- Random ass ND gear; local rnd_3_min = 3600020 local rnd_3_max = 3600023 -- Random ass potions; local rnd_4_min = 2902123 local rnd_4_max = 2902127 -- Random timed deco; local rnd_5 = 2013485 -- World buffs or r7 soul stone; local rnd_6_min = 2012605 local rnd_6_max = 2012606 -- Epic 20 to 140 soul stone; local rnd_7_min = 1001023 local rnd_7_max = 1001036 -- Random T2-T4 pet card; local rnd_8_min = 2010698 local rnd_8_max = 2010710 local gj_id, gj_amount if rndReward_j == 1 then gj_id = math.random(rnd_1_min,rnd_1_max) elseif rndReward_j == 2 then gj_id = math.random(rnd_2_min,rnd_2_max) elseif rndReward_j == 3 then gj_id = math.random(rnd_3_min,rnd_3_max) elseif rndReward_j == 4 then gj_id = math.random(rnd_4_min,rnd_4_max) elseif rndReward_j == 5 then gj_id = rnd_5 elseif rndReward_j == 6 then gj_id = math.random(rnd_6_min,rnd_6_max) elseif rndReward_j == 7 then gj_id = math.random(rnd_7_min,rnd_7_max) elseif rndReward_j == 8 then gj_id = math.random(rnd_8_min,rnd_8_max) end -- Display a message and give item; insert_item(gj_id, 1, 0, 1, 2) cprint("You have received x"..tostring(gj_amount).." ["..get_item_name_by_code(gj_id).."] from Gambit the Gambler.") end