Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Boxer Tournament 2013
- Credits
- -------------------------------------
- This Game Is Started By Hellkid98
- Single Player: Hellkid98
- Multiplayer: Herû
- ccConfig API by: theoriginalbit
- And special thanks to GravityScore for the
- modified read function that is very useful ;D
- Translators
- -------------
- English: Hellkid98
- Swedish: Hellkid98
- Norwegian: Herû
- Danish: ?
- Spanish: ?
- Deutch: ?
- French: ?
- Arabic: ?
- Chinese: ?
- -------------------------------------
- If you want to change your character it is on line 164
- NOTE: That is for the map! And change the "@" to whatever you like!
- Further information is under here
- ---------------------------------
- Things you can/shall not do
- *Edit this header
- *Claim this game as your own and claim you're the owner
- *Edit the code unless it is for personal use
- Languages Supported
- *English
- *Swedish
- *Norwegian
- Solo Play Explanation
- ----------------------
- The goal for this is to be the best boxer and try to win every tournament.
- For that it is good to level up your character to keep him/her fit and
- the game will get easier to play, But the enemies will also continue to get
- better as you do.
- If you want to make sure that you'll win you should buy better equipment
- and health items to heal yourself in the game.
- Multiplayer Explanation
- --Herû you should explain what you want here.. Also you should try todo the Norwegian translation.. Since you're norwegian
- ]]--
- local version = 0.91
- os.pullEvent = os.pullEventRaw
- --Default language
- language = "English"
- --GENERAL
- --Name Entry
- local minName = 4
- local maxName = 11
- --Player
- local lvl = 1
- local mLvl = 90
- local lvlD = 0 --The Damage That Increases After Each Level
- local hp = 100 --Player Health
- local tHP = 100 --Total Health
- local sta = 50 -- Stamina
- local tSta = 50 --Total Stamina
- local totalXp = 100
- local xp = 0
- local myScore = 0
- local money = 0
- local wins = 0
- local loss = 0
- local day = 0
- local regainHP = 100
- local regainSTA = 100
- local a = agility1
- local s = speed1
- local dfc = defence1
- local d = damage1
- local bSta = math.random(1,3) -- Block Stamina That Enemy Loses
- local mbrshipDay = 0
- local uD = 10
- --Skills
- local damage1 = math.random(5,10)
- local damage2 = math.random(5,20)
- local damage3 = math.random(5,30)
- local damage4 = math.random(5,40)
- local damage5 = math.random(5,50)
- local agility1 = math.random(5,10)
- local agility2 = math.random(10,20)
- local agility3 = math.random(20,30)
- local agility4 = math.random(30,40)
- local agility5 = math.random(40,50)
- --Screen
- w,h = term.getSize()
- halfW = w/2
- halfH = h/2
- --Top Topics Text
- local ttTextColor = colors.red
- --Top Topic Background
- local ttBackColor = colors.cyan
- --Menus Text
- local menuTextColor = colors.black
- --Menus Background
- local menuBackColor = colors.white
- --Controls
- defaultControls = true
- --Settings
- local optXYpos = 1
- local optColors = 2
- local optDetail = 2
- local optSHscore = 1
- local optConnection = 0
- local optgMode = 1
- local optAutoUpdate = 1
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- --Enemies
- local eAtk = enemyDMG1
- local enemyLvl = 1
- local enemySta = 50
- local enemyHP = 100
- local eLvlD = 0 --The Damage That Increases On The Enemies
- --Enemies Health
- local enemyHP1 = 100
- local enemyHP2 = 125
- local enemyHP3 = 150
- local enemyHP4 = 175
- local enemyHP5 = 200
- local enemyDMG1 = math.random(2,8 + eLvlD) --Enemies Damage. NOTE:If they are Higher Level they get better damage
- local enemyDMG2 = math.random(10,15 + eLvlD) --For example: if enemy level = 12 then eAtk = enemyDMG2
- local enemyDMG3 = math.random(20,30 + eLvlD)
- local enemyDMG4 = math.random(30,45 + eLvlD)
- local enemyDMG5 = math.random(50,60 + eLvlD)
- --Randomly Selects An Enemy PS. This Is For Solo Play
- function randomChallenger()
- t_enemies = {
- "Rock Hardwood", "Olov Reynkon", "Usumo Binlayden", "Duke Parker", "Peter Pestrami", "Lucky Mook",
- "Gouda Croissant", "John Dorkian", "Rochy Ballboda", "Felix Mjellberg", "Turk Turkleton",
- "Gieek Sheet", "Robert DuckFaze", "Mitch Schlucker", "Homer Simpson", "Peter Griffin"
- }
- enemy = t_enemies[math.random(1, #t_enemies)]
- print(enemy)
- cleanScreen()
- end
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- --Basic Drawing Functions
- function drawAt(x,y,text)
- term.setCursorPos(x,y)
- term.write(text)
- end
- function centerPrint(y,text)
- term.setCursorPos(w/2 - #text/2, y)
- term.write(text)
- end
- function cleanScreen()
- term.clear()
- term.setCursorPos(1,1)
- end
- --Draw Cursors
- function drawCursor(x1,x2,y)
- drawAt(x1,y,"[")
- drawAt(x2,y,"]")
- end
- function drawDifCursor(x,y)
- drawAt(x,y,">")
- end
- --Draws The Character
- function drawCharacter()
- if colorsOnOff == "OFF" then
- drawAt (x,y,"@")
- elseif colorsOnOff == "ON" then
- paintutils.drawPixel(x,y,colors.orange)
- end
- end
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- --Resets Everything
- function resetStats()
- d = damage1
- hp = 100
- tHP = 100
- sta = 50
- tSta = 50
- xp = 0
- totalXp = 100
- lvl = 1
- myScore = 0
- money = 0
- wins = 0
- loss = 0
- day = 0
- lvlD = 0
- difficulty = "None"
- end
- ---------------------------------------------------------------------------------------------------
- --SAVING/LOADING/DELETING
- ---------------------------------------------------------------------------------------------------
- function toNum()
- lvl = tonumber(lvl)
- xp = tonumber(xp)
- totalXp = tonumber(totalXp)
- lvlD = tonumber(lvlD)
- hp = tonumber(hp)
- tHP = tonumber(tHP)
- sta = tonumber(sta)
- tSta = tonumber(tSta)
- money = tonumber(money)
- wins = tonumber(wins)
- loss = tonumber(loss)
- myScore = tonumber(myScore)
- day = tonumber(day)
- mbrshipDay = tonumber(mbrshipDay)
- end
- function toStrng()
- lvl = tostring(lvl)
- xp = tostring(xp)
- totalXp = tostring(totalXp)
- lvlD = tostring(lvlD)
- hp = tostring(hp)
- tHP = tostring(tHP)
- sta = tostring(sta)
- tSta = tostring(tSta)
- money = tostring(money)
- wins = tostring(wins)
- loss = tostring(loss)
- myScore = tostring(myScore)
- day = tostring(day)
- mbrshipDay = tostring(mbrshipDay)
- end
- function save(player)
- --[[
- Line1 = myName
- Line2 = lvl
- Line3 = xp
- Line4 = totalXp
- Line5 = lvlD
- Line6 = hp
- Line7 = tHP
- Line8 = sta
- Line9 = tSta
- Line10 = money
- Line11 = wins
- Line12 = loss
- Line13 = myScore
- Line14 = easyMode
- Line15 = normalMode
- Line16 = hardMode
- Line17 = extremeMode
- Line18 = day
- Line19 = mbrshipDay
- ]]--
- toStrng()
- if player == 1 then
- local file = fs.open(".gameData/saves/Player1","w")
- file.writeLine(myName)
- file.writeLine(lvl)
- file.writeLine(xp)
- file.writeLine(totalXp)
- file.writeLine(lvlD)
- file.writeLine(hp)
- file.writeLine(tHP)
- file.writeLine(sta)
- file.writeLine(tSta)
- file.writeLine(money)
- file.writeLine(wins)
- file.writeLine(loss)
- file.writeLine(myScore)
- file.writeLine(difficulty)
- file.writeLine(day)
- file.writeLine(mbrshipDay)
- file.close()
- print(" SAVED!")
- sleep(1)
- elseif player == 2 then
- local file = fs.open(".gameData/saves/Player2","w")
- file.writeLine(myName)
- file.writeLine(lvl)
- file.writeLine(xp)
- file.writeLine(totalXp)
- file.writeLine(lvlD)
- file.writeLine(hp)
- file.writeLine(tHP)
- file.writeLine(sta)
- file.writeLine(tSta)
- file.writeLine(money)
- file.writeLine(wins)
- file.writeLine(loss)
- file.writeLine(myScore)
- file.writeLine(difficulty)
- file.writeLine(day)
- file.writeLine(mbrshipDay)
- file.close()
- print(" SAVED!")
- sleep(1)
- elseif player == 3 then
- local file = fs.open(".gameData/saves/Player3","w")
- file.writeLine(myName)
- file.writeLine(lvl)
- file.writeLine(xp)
- file.writeLine(totalXp)
- file.writeLine(lvlD)
- file.writeLine(hp)
- file.writeLine(tHP)
- file.writeLine(sta)
- file.writeLine(tSta)
- file.writeLine(money)
- file.writeLine(wins)
- file.writeLine(loss)
- file.writeLine(myScore)
- file.writeLine(difficulty)
- file.writeLine(day)
- file.writeLine(mbrshipDay)
- file.close()
- print(" SAVED!")
- sleep(1)
- elseif player == 4 then
- local file = fs.open(".gameData/saves/Player4","w")
- file.writeLine(myName)
- file.writeLine(lvl)
- file.writeLine(xp)
- file.writeLine(totalXp)
- file.writeLine(lvlD)
- file.writeLine(hp)
- file.writeLine(tHP)
- file.writeLine(sta)
- file.writeLine(tSta)
- file.writeLine(money)
- file.writeLine(wins)
- file.writeLine(loss)
- file.writeLine(myScore)
- file.writeLine(difficulty)
- file.writeLine(day)
- file.writeLine(mbrshipDay)
- file.close()
- print(" SAVED!")
- sleep(1)
- end
- lvl = tonumber(lvl)
- xp = tonumber(xp)
- totalXp = tonumber(totalXp)
- lvlD = tonumber(lvlD)
- hp = tonumber(hp)
- tHP = tonumber(tHP)
- sta = tonumber(sta)
- tSta = tonumber(tSta)
- money = tonumber(money)
- wins = tonumber(wins)
- loss = tonumber(loss)
- myScore = tonumber(myScore)
- end
- ---------------------------------------------------------------------------------------------------
- --Loading
- function loadPlayer(player)
- lvl = tonumber(lvl)
- xp = tonumber(xp)
- totalXp = tonumber(totalXp)
- lvlD = tonumber(lvlD)
- hp = tonumber(hp)
- tHP = tonumber(tHP)
- sta = tonumber(sta)
- tSta = tonumber(tSta)
- money = tonumber(money)
- wins = tonumber(wins)
- loss = tonumber(loss)
- myScore = tonumber(myScore)
- day = tonumber(day)
- mbrshipDay = tonumber(mbrshipDay)
- --[[
- Line1 = myName
- Line2 = lvl
- Line3 = xp
- Line4 = totalXp
- Line5 = lvlD
- Line6 = hp
- Line7 = tHP
- Line8 = sta
- Line9 = tSta
- Line10 = money
- Line11 = wins
- Line12 = loss
- Line13 = myScore
- Line14 = Difficulty
- Line15 = day
- Line16 = mbrshipDay
- ]]--
- if player == 1 then
- if fs.exists(".gameData/saves/Player1") then
- file = fs.open(".gameData/saves/Player1","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- local myName1 = fileData[1]
- local lvl1 = fileData[2]
- xp = fileData[3]
- totalXp = fileData[4]
- lvlD = fileData[5]
- hp = fileData[6]
- tHP = fileData[7]
- sta = fileData[8]
- tSta = fileData[9]
- money = fileData[10]
- wins = fileData[11]
- loss = fileData[12]
- myScore = fileData[13]
- difficulty = fileData[14]
- day = fileData[15]
- mbrshipDay = fileData[16]
- print(" Profile Loaded! ")
- sleep(2)
- myName = myName1
- lvl = lvl1
- toNum()
- solo()
- end
- elseif player == 2 then
- if fs.exists(".gameData/saves/Player2") then
- file = fs.open(".gameData/saves/Player2","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- local myName2 = fileData[1]
- local lvl2 = fileData[2]
- xp = fileData[3]
- totalXp = fileData[4]
- lvlD = fileData[5]
- hp = fileData[6]
- tHP = fileData[7]
- sta = fileData[8]
- tSta = fileData[9]
- money = fileData[10]
- wins = fileData[11]
- loss = fileData[12]
- myScore = fileData[13]
- difficulty = fileData[14]
- day = fileData[15]
- mbrshipDay = fileData[16]
- print(" Profile Loaded! ")
- sleep(2)
- myName = myName2
- lvl = lvl2
- toNum()
- solo()
- end
- elseif player == 3 then
- if fs.exists(".gameData/saves/Player3") then
- file = fs.open(".gameData/saves/Player3","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- local myName3 = fileData[1]
- local lvl3 = fileData[2]
- xp = fileData[3]
- totalXp = fileData[4]
- lvlD = fileData[5]
- hp = fileData[6]
- tHP = fileData[7]
- sta = fileData[8]
- tSta = fileData[9]
- money = fileData[10]
- wins = fileData[11]
- loss = fileData[12]
- myScore = fileData[13]
- difficulty = fileData[14]
- day = fileData[15]
- mbrshipDay = fileData[16]
- print(" Profile Loaded! ")
- sleep(2)
- myName = myName3
- lvl = lvl3
- toNum()
- solo()
- end
- elseif player == 4 then
- if fs.exists(".gameData/saves/Player4") then
- file = fs.open(".gameData/saves/Player4","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- local myName4 = fileData[1]
- local lvl4 = fileData[2]
- xp = fileData[3]
- totalXp = fileData[4]
- lvlD = fileData[5]
- hp = fileData[6]
- tHP = fileData[7]
- sta = fileData[8]
- tSta = fileData[9]
- money = fileData[10]
- wins = fileData[11]
- loss = fileData[12]
- myScore = fileData[13]
- difficulty = fileData[14]
- day = fileData[15]
- mbrshipDay = fileData[16]
- print(" Profile Loaded! ")
- sleep(2)
- myName = myName4
- lvl = lvl4
- toNum()
- solo()
- end
- end
- end
- function checkSaves()
- if myName1 == nil then
- myName1 = "No User"
- end
- if myName2 == nil then
- myName2 = "No User"
- end
- if myName3 == nil then
- myName3 = "No User"
- end
- if myName4 == nil then
- myName4 = "No User"
- end
- if myName5 == nil then
- myName5 = "No User"
- end
- if lvl1 == nil then
- lvl1 = "0"
- end
- if lvl2 == nil then
- lvl2 = "0"
- end
- if lvl3 == nil then
- lvl3 = "0"
- end
- if lvl4 == nil then
- lvl4 = "0"
- end
- if lvl5 == nil then
- lvl5 = "0"
- end
- end
- function hOption(hMode)
- --Delete
- if hMode == delete then
- chosenOpt = false
- if colorsOnOff == "OFF" then
- print("")
- print("")
- print(" Delete? (y/n) ")
- while true do
- if chosenOpt == true then
- break
- end
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == "y" then
- hOpt = "Yes"
- chosenOpt = true
- elseif p1 == "n"
- then hOpt = "No"
- chosenOpt = true
- end
- end
- elseif colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(colors.lightGray)
- print("")
- print("")
- print(" Delete? (y/n) ")
- while true do
- if chosenOpt == true then
- break
- end
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == "y" then
- hOpt = "Yes"
- chosenOpt = true
- elseif p1 == "n"
- then hOpt = "No"
- chosenOpt = true
- end
- end
- end
- --Save
- elseif hMode == save then
- chosenOpt = false
- if not saveExist then
- saveMsg = " Save? (y/n)"
- elseif saveExist then
- saveMsg = " Savegame already exists! \n Overwrite savegame? (y/n)"
- end
- if colorsOnOff == "OFF" then
- print("")
- print("")
- print(saveMsg)
- while true do
- if chosenOpt == true then
- break
- end
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == "y" then
- hOpt = "Yes"
- chosenOpt = true
- elseif p1 == "n"
- then hOpt = "No"
- chosenOpt = true
- end
- end
- elseif colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(colors.lightGray)
- print("")
- print("")
- print(saveMsg)
- while true do
- if chosenOpt == true then
- break
- end
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == "y" then
- hOpt = "Yes"
- chosenOpt = true
- elseif p1 == "n"
- then hOpt = "No"
- chosenOpt = true
- end
- end
- saveExist = false
- end
- --Load
- elseif hMode == load then
- chosenOpt = false
- if colorsOnOff == "OFF" then
- print("")
- print("")
- print(" Load? Y/N ")
- while true do
- if chosenOpt == true then
- break
- end
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == "y" then
- hOpt = "Yes"
- chosenOpt = true
- elseif p1 == "n"
- then hOpt = "No"
- chosenOpt = true
- end
- end
- elseif colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(colors.lightGray)
- print("")
- print("")
- print(" Load? Y/N ")
- while true do
- if chosenOpt == true then
- break
- end
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == "y" then
- hOpt = "Yes"
- chosenOpt = true
- elseif p1 == "n"
- then hOpt = "No"
- chosenOpt = true
- end
- end
- end
- end
- end
- function hLoadMenuEvents()
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 200 then
- menuPos = menuPos - 4
- if menuPos < 4 then
- menuPos = 16
- end
- elseif p1 == 208 then
- menuPos = menuPos + 4
- if menuPos > 16 then
- menuPos = 4
- end
- elseif p1 == 14 then
- inMenu = false
- return
- -------------------------------------------------
- --Player 1
- elseif p1 == 28 then
- if menuPos == 4 then
- if sMode then
- if fs.exists(".gameData/saves/player1") then
- saveExist = true
- end
- hOption(save)
- if hOpt == "Yes" then
- save(1)
- elseif hOpt == "No" then
- return
- end
- end
- if dMode then
- hOption(delete)
- if hOpt == "Yes" then
- fs.delete(".gameData/saves/Player1")
- elseif hOpt == "No" then
- return
- end
- end
- if lMode then
- hOption(load)
- if hOpt == "Yes" then
- if not fs.exists(".gameData/saves/player1") then
- print("No Save Game")
- sleep(2)
- return
- end
- loadPlayer(1)
- inMenu = false
- elseif hOpt == "No" then
- return
- end
- end
- -------------------------------------------------
- --Player 2
- elseif menuPos == 8 then
- if sMode then
- if fs.exists(".gameData/saves/player2") then
- saveExist = true
- end
- hOption(save)
- if hOpt == "Yes" then
- save(2)
- elseif hOpt == "No" then
- return
- end
- end
- if dMode then
- hOption(delete)
- if hOpt == "Yes" then
- fs.delete(".gameData/saves/Player2")
- elseif hOpt == "No" then
- return
- end
- end
- if lMode then
- hOption(load)
- if hOpt == "Yes" then
- if not fs.exists(".gameData/saves/player2") then
- print("No Save Game")
- sleep(2)
- return
- end
- loadPlayer(2)
- inMenu = false
- elseif hOpt == "No" then
- return
- end
- end
- -------------------------------------------------
- --Player 3
- elseif menuPos == 12 then
- if sMode then
- if fs.exists(".gameData/saves/player3") then
- saveExist = true
- end
- hOption(save)
- if hOpt == "Yes" then
- save(3)
- elseif hOpt == "No" then
- return
- end
- end
- if dMode then
- hOption(delete)
- if hOpt == "Yes" then
- fs.delete(".gameData/saves/Player3")
- elseif hOpt == "No" then
- return
- end
- end
- if lMode then
- hOption(load)
- if hOpt == "Yes" then
- if not fs.exists(".gameData/saves/player3") then
- print("No Save Game")
- sleep(2)
- return
- end
- loadPlayer(3)
- inMenu = false
- elseif hOpt == "No" then
- return
- end
- end
- -------------------------------------------------
- --Player 4
- elseif menuPos == 16 then
- if sMode then
- if fs.exists(".gameData/saves/player4") then
- saveExist = true
- end
- hOption(save)
- if hOpt == "Yes" then
- save(4)
- elseif hOpt == "No" then
- return
- end
- end
- if dMode then
- hOption()
- if hOpt == "Yes" then
- fs.delete(".gameData/saves/Player4")
- elseif hOpt == "No" then
- return
- end
- end
- if lMode then
- hOption(load)
- if hOpt == "Yes" then
- if not fs.exists(".gameData/saves/player4") then
- print("No Save Game")
- sleep(2)
- return
- end
- loadPlayer(4)
- inMenu = false
- elseif hOpt == "No" then
- return
- end
- end
- end
- end
- end
- end
- -------------------------------------------------
- function readAll()
- if not fs.exists(".gameData/saves/Player1") then
- myName1 = "No User"
- lvl1 = "0"
- dif1 = "------"
- end
- if not fs.exists(".gameData/saves/Player2") then
- myName2 = "No User"
- lvl2 = "0"
- dif2 = "------"
- end
- if not fs.exists(".gameData/saves/Player3") then
- myName3 = "No User"
- lvl3 = "0"
- dif3 = "------"
- end
- if not fs.exists(".gameData/saves/Player4") then
- myName4 = "No User"
- lvl4 = "0"
- dif4 = "------"
- end
- --Player 1
- if fs.exists(".gameData/saves/Player1") then
- file = fs.open(".gameData/saves/Player1","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- myName1 = fileData[1]
- lvl1 = fileData[2]
- dif1 = fileData[14]
- end
- --Player 2
- if fs.exists(".gameData/saves/Player2") then
- file = fs.open(".gameData/saves/Player2","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- myName2 = fileData[1]
- lvl2 = fileData[2]
- dif2 = fileData[14]
- end
- --Player 3
- if fs.exists(".gameData/saves/Player3") then
- file = fs.open(".gameData/saves/Player3","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- myName3 = fileData[1]
- lvl3 = fileData[2]
- dif3 = fileData[14]
- end
- --Player 4
- if fs.exists(".gameData/saves/Player4") then
- file = fs.open(".gameData/saves/Player4","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- myName4 = fileData[1]
- lvl4 = fileData[2]
- dif4 = fileData[14]
- end
- end
- function drawSS()
- readAll()
- if colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| |")
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,4," I ")
- drawAt(1,5,"+-------------------------------------------------+")
- drawAt(1,6,"| | |")
- drawAt(1,7,"+-------------------------------------------------+")
- drawAt(5,6,"+"..myName1.."+")
- drawAt(24,6,"LVL:"..lvl1.." "..dif1)
- drawAt(20,2,"+--"..mode.."--+")
- drawAt(1,8," II ")
- drawAt(1,9,"+-------------------------------------------------+")
- drawAt(1,10,"| | |")
- drawAt(1,11,"+-------------------------------------------------+")
- drawAt(5,10,"+"..myName2.."+")
- drawAt(24,10,"LVL:"..lvl2.." "..dif2)
- drawAt(1,12," III ")
- drawAt(1,13,"+-------------------------------------------------+")
- drawAt(1,14,"| | |")
- drawAt(1,15,"+-------------------------------------------------+")
- drawAt(5,14,"+"..myName3.."+")
- drawAt(24,14,"LVL:"..lvl3.." "..dif3)
- drawAt(1,16," IV ")
- drawAt(1,17,"+-------------------------------------------------+")
- drawAt(1,18,"| | |")
- drawAt(1,19,"+-------------------------------------------------+")
- drawAt(5,18,"+"..myName4.."+")
- drawAt(24,18,"LVL:"..lvl4.." "..dif4)
- drawAt(49,2 + menuPos,"*")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.white)
- term.setTextColor(menuTextColor)
- drawAt(1,1," ")
- drawAt(1,2," ")
- drawAt(1,3," ")
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.red)
- drawAt(1,4," I ")
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,5," ")
- drawAt(1,6," ")
- drawAt(1,7," ")
- drawAt(5,6,"+"..myName1.."+")
- drawAt(24,6,"LVL:"..lvl1.." "..dif1)
- term.setBackgroundColor(menuBackColor)
- drawAt(20,2,"+--"..mode.."--+")
- term.setBackgroundColor(menuBackColor)
- drawAt(48,6," ")
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.red)
- drawAt(1,8," II ")
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,9," ")
- drawAt(1,10," ")
- drawAt(1,11," ")
- drawAt(5,10,"+"..myName2.."+")
- drawAt(24,10,"LVL:"..lvl2.." "..dif2)
- term.setBackgroundColor(menuBackColor)
- drawAt(48,10," ")
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.red)
- drawAt(1,12," III ")
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,13," ")
- drawAt(1,14," ")
- drawAt(1,15," ")
- drawAt(5,14,"+"..myName3.."+")
- drawAt(24,14,"LVL:"..lvl3.." "..dif3)
- term.setBackgroundColor(menuBackColor)
- drawAt(48,14," ")
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.red)
- drawAt(1,16," IV ")
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,17," ")
- drawAt(1,18," ")
- drawAt(1,19," ")
- drawAt(5,18,"+"..myName4.."+")
- drawAt(24,18,"LVL:"..lvl4.." "..dif4)
- term.setBackgroundColor(menuBackColor)
- drawAt(48,18," ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- drawAt(49,2 + menuPos,"*")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- function loadMenu()
- menuPos = 4
- while true do
- checkSaves()
- readAll()
- if not inMenu then
- cleanScreen()
- print(myName)
- break
- end
- cleanScreen()
- drawSS()
- hLoadMenuEvents()
- end
- end
- if not fs.exists(".gameData/APIs") then
- fs.makeDir(".gameData/APIs")
- end
- if not fs.exists(".gameData/saves/") then
- fs.makeDir(".gameData/saves")
- fs.makeDir(".gameData/mods")
- fs.makeDir(".gameData/settings")
- fs.makeDir(".gameData/themes")
- end
- if not fs.exists(".gameData/mods/") then
- fs.makeDir(".gameData/saves")
- fs.makeDir(".gameData/mods")
- fs.makeDir(".gameData/settings")
- fs.makeDir(".gameData/themes")
- end
- if not fs.exists(".gameData/settings/") then
- fs.makeDir(".gameData/saves")
- fs.makeDir(".gameData/mods")
- fs.makeDir(".gameData/settings")
- fs.makeDir(".gameData/themes")
- end
- if not fs.exists(".gameData/themes/") then
- fs.makeDir(".gameData/saves")
- fs.makeDir(".gameData/mods")
- fs.makeDir(".gameData/settings")
- fs.makeDir(".gameData/themes")
- end
- if not fs.exists(".gameData/.mp/settings") then
- fs.makeDir(".gameData/.mp/settings")
- fs.makeDir(".gameData/.mp/mods")
- fs.makeDir(".gameData/.mp/characterArt")
- end
- ---------------------------------------------------------------------------------------------------
- --SETTINGS
- ---------------------------------------------------------------------------------------------------
- function defaultSettings()
- hintLevel = "LOW"
- subOnOff = "OFF"
- xyPosOnOff = "ON"
- colorsOnOff = "OFF"
- hDetailLevel = "NORMAL"
- connection = "NONE"
- shName = "ON"
- shScore = "ON"
- shHUD = "ON"
- gameMode = "Command"
- hAutoUpdate = "OFF"
- language = "English"
- optXYpos = 1
- optColors = 2
- optDetail = 2
- optSHscore = 1
- optConnection = 0
- optgMode = 1
- optAutoUpdate = 1
- optLang = 1
- cheatQuickLeveling = false
- cheatInstaKill = false
- cheatGodMode = false
- cheatUnlimitedMoney = false
- cheatNoClip = false
- cheatSuperFreak = false
- end
- function defaultColors()
- ttTextColor = colors.red
- ttBackColor = colors.cyan
- menuTextColor = colors.black
- menuBackColor = colors.white
- end
- function dApi()
- if not fs.exists(".gameData/APIs/ccConfig") then
- if colorsOnOff == "ON" then
- term.setBackgroundColor(colors.white)
- end
- cleanScreen()
- if not http then
- cleanScreen()
- centerPrint(halfH,"HTTP api not enabled!")
- downloading = false
- end
- --Checks if you can access the site
- if colorsOnOff == "ON" then
- term.setTextColor(colors.black)
- end
- centerPrint(halfH,"Trying to connect to ccConfigs pastebin..")
- http.request("http://pastebin.com/raw.php?i=iMpzmDWt")
- evt = os.pullEvent()
- if evt == "http_success" then
- downloading = true
- elseif evt ~= "http_success" then
- cleanScreen()
- downloading = false
- if colorsOnOff == "OFF" then
- centerPrint(halfH,"Failed to download ccConfig.")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.red)
- centerPrint(halfH,"Failed to download ccConfig.")
- end
- sleep(1)
- end
- --Drawing
- if downloading then
- if colorsOnOff == "ON" then
- term.setBackgroundColor(colors.white)
- end
- cleanScreen()
- if colorsOnOff == "OFF" then
- centerPrint(halfH,"Downloading")
- centerPrint(halfH + 1,"ccConfig..")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.black)
- centerPrint(halfH,"Downloading")
- centerPrint(halfH + 1,"ccConfig..")
- end
- --Downloading
- code = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("iMpzmDWt"))
- file = fs.open(".gameData/APIs/ccConfig","w")
- local sCode = code.readAll()
- file.write(sCode)
- file.close() --Always important to close file
- cleanScreen()
- if colorsOnOff == "OFF" then
- centerPrint(halfH,"Downloaded!")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.lime)
- centerPrint(halfH,"Downloaded!")
- end
- sleep(1)
- end
- end
- end
- function update()
- --[[
- This Updater Is Made By Herû
- I just modified the function a little
- ]]--
- if colorsOnOff == "OFF" then
- cleanScreen()
- centerPrint(halfH,"Looking For Updates..")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- cleanScreen()
- centerPrint(halfH,"Looking For Updates..")
- end
- local newestVersion
- if not http then
- if colorsOnOff == "OFF" then
- cleanScreen()
- drawAt(2,halfH,"You need to have the http api enabled!")
- sleep(0.5)
- elseif colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- drawAt(2,halfH," You need to have the http api enabled! ")
- sleep(0.5)
- end
- else
- local getVersion = "http://admin.boxer.hostei.com/autoupdater/find.php?todo=version"
- http.request(getVersion)
- event, url, newestVersionWeb = os.pullEvent()
- if event == "http_success" then
- newestVersion = newestVersionWeb.readLine()
- local getCurrentVersion = ".gameData/version"
- if fs.exists(getCurrentVersion) then
- local file = fs.open(getCurrentVersion,"r")
- currentVersion = file.readLine()
- file.close()
- else
- currentVersion = version
- end
- currentVersion = tonumber(currentVersion)
- newestVersion = tonumber(newestVersion)
- if newestVersion > currentVersion then
- if colorsOnOff == "OFF" then
- centerPrint(halfH - 1," ")
- centerPrint(halfH," +--Current version is "..newestVersion.."--+ ")
- centerPrint(halfH + 1," Your version is "..currentVersion..", ")
- centerPrint(halfH + 2," Will you update to the newest version? ")
- centerPrint(halfH + 3," (y/n) ")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.yellow)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- drawAt(5,halfH - 1," ")
- drawAt(5,halfH," +--Current version is "..newestVersion.."--+ ")
- term.setTextColor(colors.black)
- drawAt(5,halfH + 1," Your version is "..currentVersion..", ")
- drawAt(5,halfH + 2," Will you update to the newest version? ")
- drawAt(5,halfH + 3," (y/n) ")
- for i = halfH -1, halfH + 3 do
- paintutils.drawPixel(51,i,colors.white)
- end
- term.setBackgroundColor(colors.white)
- end
- if not startUpdate then
- event2, answer = os.pullEvent("char")
- end
- if startUpdate then
- answer = "y"
- end
- if answer == "y" then
- cleanScreen()
- if colorsOnOff == "OFF" then
- centerPrint(halfH,"Updating..")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.yellow)
- centerPrint(halfH - 1," ")
- centerPrint(halfH," Updating..")
- centerPrint(halfH + 1," ")
- end
- local getCurrentCode = "http://admin.boxer.hostei.com/autoupdater/find.php?todo=pastebincode"
- http.request(getCurrentCode)
- event, url, currentLink = os.pullEvent()
- if event == "http_success" then
- local programName = shell.getRunningProgram()
- programName = fs.getName(programName)
- oldSize = fs.getSize(programName)
- local response = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode(currentLink.readLine()))
- if response then
- centerPrint(halfH,"Downloaded, saving to file...")
- sleep(2)
- local file = fs.open(programName,"w")
- local sResponse = response.readAll()
- file.write(sResponse)
- file.close()
- ufile = fs.open(".gameData/version","w")
- ufile.write(newestVersion)
- ufile.close()
- newSize = fs.getSize(programName)
- if colorsOnOff == "OFF" then
- cleanScreen()
- drawAt(2,halfH - 1," ")
- drawAt(2,halfH," You have now updated the game, please exit the ")
- drawAt(2,halfH + 1," Game and open it again to use the updated version. ")
- drawAt(2,halfH + 2," ")
- drawAt(2,halfH + 4,"Boxer Tournament Ver "..newestVersion.." Size: "..newSize.." Byte")
- drawAt(2,halfH + 5,"Boxer Tournament Ver "..version.." Size: "..oldSize.." Byte")
- drawAt(2,halfH + 7,"Free Disk Space: "..fs.getFreeSpace("/").." Byte")
- sleep(0.5)
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.yellow)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- drawAt(1,halfH," You have now updated the game, please exit the ")
- drawAt(1,halfH + 1," Game and open it again to use the updated version. ")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- drawAt(1,halfH + 3," Boxer Tournament Ver "..newestVersion.." Size: "..newSize.." Byte")
- drawAt(1,halfH + 4," Boxer Tournament Ver "..version.." Size: "..oldSize.." Byte")
- drawAt(1,halfH + 6," Free Disk Space: "..fs.getFreeSpace("/").." Byte")
- sleep(0.5)
- end
- else
- if colorsOnOff == "OFF" then
- cleanScreen()
- drawAt(4,halfH,"Something went wrong when trying to")
- drawAt(4,halfH + 1,"Get the pastebin code, Try again later.")
- sleep(0.5)
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- centerPrint(halfH - 1," ")
- centerPrint(halfH," Something went wrong when trying to ")
- centerPrint(halfH + 1," Get the pastebin code, Try again later. ")
- centerPrint(halfH + 2," ")
- term.setBackgroundColor(colors.white)
- sleep(0.5)
- end
- end
- else
- if event == "http_failure" then
- if colorsOnOff == "OFF" then
- cleanScreen()
- centerPrint(halfH,"Something went wrong, try again later.")
- sleep(0.5)
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- centerPrint(halfH - 1," ")
- centerPrint(halfH," Something went wrong, try again later. ")
- centerPrint(halfH + 1," ")
- term.setBackgroundColor(colors.white)
- sleep(0.5)
- end
- end
- end
- else
- if colorsOnOff == "OFF" then
- cleanScreen()
- centerPrint(halfH,"Ok, but remember that you could update it later.")
- sleep(0.5)
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- centerPrint(halfH - 1," ")
- centerPrint(halfH," Ok, but remember that you could update it later. ")
- centerPrint(halfH + 1," ")
- term.setBackgroundColor(colors.white)
- sleep(0.5)
- end
- end
- else
- if colorsOnOff == "OFF" then
- cleanScreen()
- centerPrint(halfH,"You have the newest version")
- sleep(0.5)
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.yellow)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- centerPrint(halfH - 1," ")
- centerPrint(halfH," You have the newest version ")
- centerPrint(halfH + 1," ")
- term.setBackgroundColor(colors.white)
- sleep(0.5)
- end
- end
- else
- if event == "http_failure" then
- if colorsOnOff == "OFF" then
- cleanScreen()
- centerPrint(halfH,"Something went wrong when trying")
- centerPrint(halfH + 1,"To get the newest version, Try again later.")
- sleep(0.5)
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.white)
- cleanScreen()
- term.setBackgroundColor(colors.lightGray)
- centerPrint(halfH - 1," ")
- centerPrint(halfH," Something went wrong when trying to get ")
- centerPrint(halfH + 1," The newest version, Try again later. ")
- centerPrint(halfH + 2," ")
- sleep(0.5)
- end
- end
- end
- end
- if not startUpdate then
- if colorsOnOff == "OFF" then
- centerPrint(19,"Press Any Key To Continue")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.black)
- centerPrint(19,"Press Any Key To Continue")
- end
- end
- if not startUpdate then
- os.pullEvent("key")
- elseif startUpdate then
- sleep(2)
- end
- if not fs.exists(".gameData/APIs/ccConfig") then
- dApi()
- end
- cleanScreen()
- loadSettings()
- return
- end
- --[[
- This is a modified read function by GravityScore
- Properties:
- - replaceChar Replace Character when typing
- - history Up/Down arrow history
- - visibleLength Visible text length
- - textLength Maxmimum typing length
- - liveUpdates Live update function
- - exitOnKey Key that will stop reading
- - refusePrint Array of keys that will not be able to be typed
- - grantPrint Array of characters that are only allowed to be typed
- ]]--
- local function modRead(properties)
- local w, h = term.getSize()
- local defaults = {replaceChar = nil, history = nil, visibleLength = nil, textLength = nil,
- liveUpdates = nil, exitOnKey = nil}
- if not properties then properties = {} end
- for k, v in pairs(defaults) do if not properties[k] then properties[k] = v end end
- if properties.replaceChar then properties.replaceChar = properties.replaceChar:sub(1, 1) end
- if not properties.visibleLength then properties.visibleLength = w end
- local sx, sy = term.getCursorPos()
- local line = ""
- local pos = 0
- local historyPos = nil
- local function redraw(repl)
- local scroll = 0
- if properties.visibleLength and sx + pos > properties.visibleLength + 1 then
- scroll = (sx + pos) - (properties.visibleLength + 1)
- end
- term.setCursorPos(sx, sy)
- local a = repl or properties.replaceChar
- if a then term.write(string.rep(a, line:len() - scroll))
- else term.write(line:sub(scroll + 1, -1)) end
- term.setCursorPos(sx + pos - scroll, sy)
- end
- local function sendLiveUpdates(event, ...)
- if type(properties.liveUpdates) == "function" then
- local ox, oy = term.getCursorPos()
- properties.liveUpdates(line, event, ...)
- if a == true and data == nil then
- term.setCursorBlink(false)
- return line
- elseif a == true and data ~= nil then
- term.setCursorBlink(false)
- return data
- end
- term.setCursorPos(ox, oy)
- end
- end
- term.setCursorBlink(true)
- while true do
- local e, but, x, y, p4, p5 = os.pullEvent()
- if e == "char" then
- local s = false
- if properties.textLength and line:len() < properties.textLength then s = true
- elseif not properties.textLength then s = true end
- local canType = true
- if not properties.grantPrint and properties.refusePrint then
- local canTypeKeys = {}
- if type(properties.refusePrint) == "table" then
- for _, v in pairs(properties.refusePrint) do
- table.insert(canTypeKeys, tostring(v):sub(1, 1))
- end
- elseif type(properties.refusePrint) == "string" then
- for char in properties.refusePrint:gmatch(".") do
- table.insert(canTypeKeys, char)
- end
- end
- for _, v in pairs(canTypeKeys) do if but == v then canType = false end end
- elseif properties.grantPrint then
- canType = false
- local canTypeKeys = {}
- if type(properties.grantPrint) == "table" then
- for _, v in pairs(properties.grantPrint) do
- table.insert(canTypeKeys, tostring(v):sub(1, 1))
- end
- elseif type(properties.grantPrint) == "string" then
- for char in properties.grantPrint:gmatch(".") do
- table.insert(canTypeKeys, char)
- end
- end
- for _, v in pairs(canTypeKeys) do if but == v then canType = true end end
- end
- if s and canType then
- line = line:sub(1, pos) .. but .. line:sub(pos + 1, -1)
- pos = pos + 1
- redraw()
- end
- elseif e == "key" then
- if but == keys.enter then
- break
- elseif but == keys.left then
- if pos > 0 then pos = pos - 1 redraw() end
- elseif but == keys.right then
- if pos < line:len() then pos = pos + 1 redraw() end
- elseif (but == keys.up or but == keys.down) and properties.history then
- redraw(" ")
- if but == keys.up then
- if historyPos == nil and #properties.history > 0 then
- historyPos = #properties.history
- elseif historyPos > 1 then
- historyPos = historyPos - 1
- end
- elseif but == keys.down then
- if historyPos == #properties.history then historyPos = nil
- elseif historyPos ~= nil then historyPos = historyPos + 1 end
- end
- if properties.history and historyPos then
- line = properties.history[historyPos]
- pos = line:len()
- else
- line = ""
- pos = 0
- end
- redraw()
- sendLiveUpdates("history")
- elseif but == keys.backspace and pos > 0 then
- redraw(" ")
- line = line:sub(1, pos - 1) .. line:sub(pos + 1, -1)
- pos = pos - 1
- redraw()
- sendLiveUpdates("delete")
- elseif but == keys.home then
- pos = 0
- redraw()
- elseif but == keys.delete and pos < line:len() then
- redraw(" ")
- line = line:sub(1, pos) .. line:sub(pos + 2, -1)
- redraw()
- sendLiveUpdates("delete")
- elseif but == keys["end"] then
- pos = line:len()
- redraw()
- elseif properties.exitOnKey then
- if but == properties.exitOnKey or (properties.exitOnKey == "control" and
- (but == 29 or but == 157)) then
- term.setCursorBlink(false)
- return nil
- end
- end
- end
- sendLiveUpdates(e, but, x, y, p4, p5)
- end
- term.setCursorBlink(false)
- if line ~= nil then line = line:gsub("^%s*(.-)%s*$", "%1") end
- return line
- end
- --[[
- GAME:{
- Hint Level (hintLevel)
- Subititles (subOnOff)
- }
- GRAPHICS:{
- ShowXYpos = Allows you to choose if you want to see X/Y pos. (xyPosOnOff)
- Colors = Allow you to turn on and off the colors (colorsOnOff)
- Detail Level = Low,Medium, Normal,High,Extreme (detailLevel)
- }
- CONTROLS:{
- Default Controls
- Set Controls
- }
- NETWORK:{
- Connection = Global, Private, Lan (connection)
- Show/Hide Name (shName)
- }
- HUD: {
- Show/Hide Score (shScore)
- Show Hide HUD = Shows Or Hides Everything (shHUD)
- }
- ENTER CHEAT = Here you can enter a cheatCode to enable a cheat
- ]]--
- function saveSettings()
- local file = fs.open(".gameData/settings/cfg","w")
- file.writeLine("--Game") --1
- file.writeLine(hintLevel) --2
- file.writeLine(gameMode) -- 3
- file.writeLine("--Subititles") --4
- file.writeLine(subOnOff) --5
- file.writeLine("--X/Y Pos") --6
- file.writeLine(xyPosOnOff) --7
- file.writeLine("--Colors") --8
- file.writeLine(colorsOnOff) --9
- file.writeLine("--Detail Level") -- 10
- file.writeLine(hDetailLevel)--11
- file.writeLine("--Network/Connection") --12
- file.writeLine(connection) --13
- file.writeLine(shName) --14
- file.writeLine("--Show Score/Hud") --15
- file.writeLine(shScore) -- 16
- file.writeLine(shHUD) --17
- file.writeLine("--Stats") --18
- file.writeLine(optXYpos) -- 19
- file.writeLine(optColors) --20
- file.writeLine(optDetail) -- 21
- file.writeLine(optSHscore) --22
- file.writeLine(optConnection) --23
- file.writeLine(optgMode) -- 24
- file.writeLine("")
- file.writeLine("--Auto Update")
- file.writeLine(hAutoUpdate) --27
- file.writeLine(optAutoUpdate) --28
- file.writeLine("")
- file.writeLine("--Language")
- file.writeLine(language) --31
- file.writeLine(optLang) --32
- file.writeLine("")
- file.writeLine("+----------------------------------------------------+")
- file.writeLine(" DO NOT EDIT THIS UNLESS YOU KNOW WHAT YOU ARE DOING")
- file.writeLine(" EDITING CONFIGS HERE IS AT YOUR OWN RISK!")
- file.writeLine("+----------------------------------------------------+")
- file.writeLine("")
- file.writeLine("+--NOTE--+")
- file.writeLine(" If you get any error, Then try to delete this cfg file")
- file.writeLine(" And try to start the game again, Otherwise you'll have")
- file.writeLine(" To delete the whole .gameData folder.")
- file.close()
- end
- function loadSettings()
- if not fs.exists(".gameData/settings/cfg") then
- defaultSettings()
- end
- if fs.exists(".gameData/settings/cfg") then
- file = fs.open(".gameData/settings/cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- hintLevel = fileData[2]
- gameMode = fileData[3]
- subOnOff = fileData[5]
- xyPosOnOff = fileData[7]
- colorsOnOff = fileData[9]
- hDetailLevel = fileData[11]
- connection = fileData[13]
- shName = fileData[14]
- shScore = fileData[16]
- shHUD = fileData[17]
- optXYpos = fileData[19]
- optColors = fileData[20]
- optDetail = fileData[21]
- optSHscore = fileData[22]
- optConnection = fileData[23]
- optgMode = fileData[24]
- hAutoUpdate = fileData[27]
- optAutoUpdate = fileData[28]
- language = fileData[31]
- optLang = fileData[32]
- file.close()
- end
- end
- function checkSettings()
- if not fs.exists(".gameData/themes/default") then
- defaultColors()
- end
- if fs.exists(".gameData/themes/default") then
- file = fs.open(".gameData/themes/default","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- ttTextColor = fileData[2]
- ttBackColor = fileData[5]
- menuTextColor = fileData[8]
- menuBackColor = fileData[11]
- file.close()
- end
- end
- --Start Updater
- loadSettings()
- checkSettings()
- if hAutoUpdate == "ON" then
- startUpdate = true
- update()
- dApi()
- startUpdate = false
- end
- function drawSetCursor()
- if colorsOnOff == "ON" then
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- if posMode == "show" then
- drawAt(3,sMenuStat,">")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- elseif posMode == "hide" then
- drawAt(3,sMenuStat,"<")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- elseif posMode == "setOption" then
- drawAt(3,sMenuStat,"*")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- elseif colorsOnOff == "OFF" then
- if posMode == "show" then
- drawAt(3,sMenuStat,">")
- elseif posMode == "hide" then
- drawAt(3,sMenuStat,"<")
- elseif posMode == "setOption" then
- drawAt(3,sMenuStat,"*")
- end
- end
- end
- function enterCheatCode()
- --CHEATS
- --QuickLeveling = You Earn 10000xp when winning a match
- --InstaKill = Enemies Die/lose directly so you win
- --GodMode = You Have Unlimited Health/Sta
- --NoClip = You Can Walk Through Houses And Stuff
- --SuperFreak = You Deal Insane Damage
- --UnlimitedMoney = You Have Unlimited Money
- while true do
- cleanScreen()
- if colorsOnOff == "ON" then
- for i = 1, #setMenu do
- drawAt(1,i,setMenuCol[i])
- drawSetMenuExtra()
- drawPCart()
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- end
- elseif colorsOnOff == "OFF" then
- for i = 1, #setMenu do
- drawAt(1,i,setMenu[i])
- drawSetMenuExtra()
- drawPCart()
- end
- end
- drawAt(3,halfH,"CODE:")
- local input = read()
- if input == "ChuckNorrisFists" then
- cheatInstaKill = true
- print(" Cheat Code Entered!")
- sleep(2)
- return settingsMenu()
- elseif input == "KindaGODLIKE" then
- cheatGodMode = true
- print(" Cheat Code Entered!")
- sleep(2)
- return settingsMenu()
- elseif input == "FasterThenLightning" then
- cheatQuickLeveling = true
- print(" Cheat Code Entered!")
- sleep(2)
- return settingsMenu()
- elseif input == "ImSoooRich" then
- cheatUnlimitedMoney = true
- print(" Cheat Code Entered!")
- sleep(2)
- return settingsMenu()
- elseif input == "StupidFreakPowers" then
- cheatSuperFreak = true
- print(" Cheat Code Entered!")
- sleep(2)
- return settingsMenu()
- elseif input == "AreGhostsReal?" then
- cheatNoClip = true
- print(" Cheat Code Entered!")
- sleep(2)
- return settingsMenu()
- else
- print(" Unknown Cheat Code! ")
- sleep(2)
- return settingsMenu()
- end
- end
- end
- function setControls()
- setControlsNum = 1
- while true do
- cleanScreen()
- if setControlsNum > 4 then
- defaultControls = false
- return settingsMenu()
- end
- if colorsOnOff == "ON" then
- for i = 1, #setMenuCol do
- drawAt(1,i,setMenuCol[i])
- end
- term.setBackgroundColor(menuBackColor)
- cleanScreen()
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- drawAt(1,1," ")
- drawAt(1,2," +---SETTINGS---+ ")
- drawAt(1,3," ")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- drawAt(1,18," ")
- drawAt(1,19," ")
- elseif colorsOnOff == "OFF" then
- for i = 1, #setMenu do
- drawAt(1,i,setMenu[i])
- end
- end
- if setControlsNum == 1 then
- centerPrint(halfH - 1,"UP BUTTON")
- centerPrint(halfH + 1," _ ")
- centerPrint(halfH + 2,"| |")
- centerPrint(halfH + 3,"+-+")
- term.setCursorPos(25,halfH + 2)
- upButton = modRead({textLength = 1})
- if #upButton > 0 then
- setControlsNum = setControlsNum + 1
- end
- elseif setControlsNum == 2 then
- centerPrint(halfH - 1,"LEFT BUTTON")
- centerPrint(halfH + 1," _ ")
- centerPrint(halfH + 2,"| |")
- centerPrint(halfH + 3,"+-+")
- term.setCursorPos(25,halfH + 2)
- leftButton = modRead({textLength = 1})
- if #leftButton > 0 then
- setControlsNum = setControlsNum + 1
- end
- elseif setControlsNum == 3 then
- centerPrint(halfH - 1,"DOWN BUTTON")
- centerPrint(halfH + 1," _ ")
- centerPrint(halfH + 2,"| |")
- centerPrint(halfH + 3,"+-+")
- term.setCursorPos(25,halfH + 2)
- downButton = modRead({textLength = 1})
- if #downButton > 0 then
- setControlsNum = setControlsNum + 1
- end
- elseif setControlsNum == 4 then
- centerPrint(halfH - 1,"RIGHT BUTTON")
- centerPrint(halfH + 1," _ ")
- centerPrint(halfH + 2,"| |")
- centerPrint(halfH + 3,"+-+")
- term.setCursorPos(25,halfH + 2)
- rightButton = modRead({textLength = 1})
- if #rightButton > 0 then
- setControlsNum = setControlsNum + 1
- end
- end
- end
- end
- function checkOptions()
- if language == "English" then
- setOpt0 = {
- "GAME",
- "GRAPHICS",
- "CONTROLS",
- "NETWORK",
- "HUD",
- "ENTER CHEAT",
- "RESET",
- "UPDATE",
- }
- setOpt1 = {
- "GAME",
- "----------",
- "Hint Level:"..hintLevel.." ",
- "Subititles:"..subOnOff.." ",
- "Mode:"..gameMode.." ",
- "Language:"..language.." ",
- "----------",
- "GRAPHICS",
- "CONTROLS",
- "NETWORK",
- "HUD",
- "ENTER CHEAT",
- "RESET",
- "UPDATE",
- }
- setOpt2 = {
- "GAME",
- "GRAPHICS",
- "----------",
- "Show X/Y Pos:"..xyPosOnOff.." ",
- "Colors:"..colorsOnOff.." ",
- "Detail Level:"..hDetailLevel.." ",
- "----------",
- "CONTROLS",
- "NETWORK",
- "HUD",
- "ENTER CHEAT",
- "RESET",
- "UPDATE",
- }
- setOpt3 = {
- "GAME",
- "GRAPHICS",
- "CONTROLS",
- "----------",
- "Default Controls",
- "Set Controls",
- "----------",
- "NETWORK",
- "HUD",
- "ENTER CHEAT",
- "RESET",
- "UPDATE",
- }
- setOpt4 = {
- "GAME",
- "GRAPHICS",
- "CONTROLS",
- "NETWORK",
- "----------",
- "Connection:"..connection.." ",
- "Show Name:"..shName.." ",
- "Auto Update:"..hAutoUpdate.." ",
- "----------",
- "HUD",
- "ENTER CHEAT",
- "RESET",
- "UPDATE",
- }
- setOpt5 = {
- "GAME",
- "GRAPHICS",
- "CONTROLS",
- "NETWORK",
- "HUD",
- "----------",
- "Show Score:"..shScore.." ",
- "Show HUD:"..shHUD.." ",
- "----------",
- "ENTER CHEAT",
- "RESET",
- "UPDATE",
- }
- --SWEDISH
- --SVENSKA
- elseif language == "Swedish" then
- setOpt0 = {
- "SPEL",
- "GRAFIKER",
- "KONTROLLER",
- "NÄTVERK",
- "HUD",
- "ANGE FUSKKOD",
- "ÅTERSTÄLL",
- "UPPDATERA",
- }
- setOpt1 = {
- "SPEL",
- "----------",
- "Tips nivå:"..hintLevel.." ",
- "Undertexter:"..subOnOff.." ",
- "Spel-läge:"..gameMode.." ",
- "Språk:"..language.." ",
- "----------",
- "GRAFIKER",
- "KONTROLLER",
- "NÄTVERK",
- "HUD",
- "ANGE FUSKKOD",
- "ÅTERSTÄLL",
- "UPPDATERA",
- }
- setOpt2 = {
- "SPEL",
- "GRAFIKER",
- "----------",
- "Visa X/Y Positon:"..xyPosOnOff.." ",
- "Färger:"..colorsOnOff.." ",
- "Detalj nivå:"..hDetailLevel.." ",
- "----------",
- "KONTROLLER",
- "NÄTVERK",
- "HUD",
- "ANGE FUSKKOD",
- "ÅTERSTÄLL",
- "UPPDATERA",
- }
- setOpt3 = {
- "SPEL",
- "GRAFIKER",
- "KONTROLLER",
- "----------",
- "Förvalda kontroller",
- "Ställ in kontroller",
- "----------",
- "NÄTVERK",
- "HUD",
- "ANGE FUSKKOD",
- "ÅTERSTÄLL",
- "UPPDATERA",
- }
- setOpt4 = {
- "SPEL",
- "GRAFIKER",
- "KONTROLLER",
- "NÄTVERK",
- "----------",
- "Anslutning:"..connection.." ",
- "Visa namn:"..shName.." ",
- "Auto uppdatering:"..hAutoUpdate.." ",
- "----------",
- "HUD",
- "ANGE FUSKKOD",
- "ÅTERSTÄLL",
- "UPPDATERA",
- }
- setOpt5 = {
- "SPEL",
- "GRAFIKER",
- "KONTROLLER",
- "NÄTVERK",
- "HUD",
- "----------",
- "Visa poäng:"..shScore.." ",
- "Visa HUD:"..shHUD.." ",
- "----------",
- "ANGE FUSKKOD",
- "ÅTERSTÄLL",
- "UPPDATERA",
- }
- end
- if setOpt == "Nothing" then
- minStat = 5
- maxStat = 12
- disabled = false
- for i = 1, #setOpt0 do
- drawAt(4,i + 4,setOpt0[i])
- end
- elseif setOpt == "Game" then
- minStat = 6
- maxStat = 10
- for i = 1, #setOpt1 do
- drawAt(4,i + 4,setOpt1[i])
- end
- elseif setOpt == "Graphics" then
- minStat = 7
- maxStat = 10
- for i = 1, #setOpt2 do
- drawAt(4,i + 4,setOpt2[i])
- end
- elseif setOpt == "Controls" then
- minStat = 8
- maxStat = 10
- for i = 1, #setOpt3 do
- drawAt(4,i + 4,setOpt3[i])
- end
- elseif setOpt == "Network" then
- minStat = 9
- maxStat = 12
- for i = 1, #setOpt4 do
- drawAt(4,i + 4,setOpt4[i])
- end
- elseif setOpt == "Hud" then
- minStat = 10
- maxStat = 12
- for i = 1, #setOpt5 do
- drawAt(4,i + 4,setOpt5[i])
- end
- end
- end
- function drawSetMenuExtra()
- if colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- drawAt(1,1," ")
- drawAt(1,2," +---SETTINGS---+ ")
- drawAt(1,3," ")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- drawAt(1,18," ")
- drawAt(1,19," ")
- elseif colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| +---SETTINGS---+ |")
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,18,"+-------------------------------------------------+")
- end
- end
- function drawPCart()
- if colorsOnOff == "OFF" then
- drawAt(26,5," _________")
- drawAt(26,6," |.-------.|")
- drawAt(26,7," || ||")
- drawAt(26,8," ||_______||")
- drawAt(26,9," '---------' __")
- drawAt(26,10," '-------' _[__]")
- drawAt(26,11,"( [_______] |-==-|")
- drawAt(26,12," )'=======' '--,-',")
- drawAt(26,13,"(.------------.) ) ")
- drawAt(26,14," ||#######||#|| [^]")
- drawAt(26,15," '------------' ")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.gray)
- drawAt(27,5," ")
- drawAt(27,6," ")
- drawAt(37,6," ")
- term.setBackgroundColor(colors.black)
- drawAt(28,6," ")
- term.setBackgroundColor(colors.gray)
- drawAt(27,7," ")
- drawAt(37,7," ")
- term.setBackgroundColor(colors.black)
- drawAt(28,7," ")
- term.setBackgroundColor(colors.gray)
- drawAt(27,8," ")
- drawAt(37,8," ")
- term.setBackgroundColor(colors.black)
- drawAt(28,8," ")
- term.setBackgroundColor(colors.gray)
- drawAt(27,9," ")
- term.setTextColor(colors.black)
- drawAt(28,10,"'-------' _[__]")
- drawAt(28,11,"[_______] |-==-|")
- drawAt(28,12,"'=======' '--,-'")
- drawAt(27,13,".------------.) )")
- drawAt(27,14,"||#######||#|| [^]")
- drawAt(27,15,"'------------'")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- function drawSettingsMenuArt()
- setMenu = {
- "+-------------------------------------------------+",
- "| +---SETTINGS---+ |",
- "+-------------------------------------------------+",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "+-------------------------------------------------+",
- }
- setMenuCol = {
- "+-------------------------------------------------+",
- "| +---SETTINGS---+ |",
- "+-------------------------------------------------+",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- }
- for i = 1, #setMenu do
- if colorsOnOff == "ON" then
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,i,setMenuCol[i])
- checkOptions()
- drawSetMenuExtra()
- drawPCart()
- elseif colorsOnOff == "OFF" then
- drawAt(1,i,setMenu[i])
- checkOptions()
- drawSetMenuExtra()
- drawPCart()
- end
- end
- end
- function setMenuEvents()
- if setOpt ~= "Nothing" then
- disabled = true
- end
- if setOpt ~= "Nothing" and
- sMenuStat ~= minStat then
- posMode = "setOption"
- elseif setOpt ~= "Nothing" and
- sMenuStat == minStat then
- posMode = "hide"
- elseif setOpt == "Nothing" then
- posMode = "show"
- end
- drawSetCursor()
- event, p1 = os.pullEvent()
- if event == "key" and
- --UP
- p1 == 200 then
- sMenuStat = sMenuStat - 1
- if sMenuStat < minStat then
- sMenuStat = minStat
- end
- --DOWN
- elseif p1 == 208 then
- sMenuStat = sMenuStat + 1
- if sMenuStat > maxStat then
- sMenuStat = maxStat
- end
- --BACKSPACE
- elseif p1 == 14 then
- checkSettings()
- saveSettings()
- checkSettings()
- return menu()
- --ENTER
- elseif p1 == 28 then
- -------------------------------------------------
- --GAME SETTINGS
- if setOpt == "Game" and
- sMenuStat == 9 then --Game Mode
- optgMode = optgMode + 1
- if optgMode > 2 then
- optgMode = 1
- end
- if optgMode == 1 then
- gameMode = "Command"
- elseif optgMode == 2 then
- gameMode = "GUI"
- end
- elseif sMenuStat == 10 then
- if disabled then
- if setOpt == "Game" then
- optLang = optLang + 1
- if optLang > 3 then
- optLang = 1
- end
- end
- end
- if optLang == 1 then
- language = "English"
- elseif optLang == 2 then
- language = "Swedish"
- elseif optLang == 3 then
- language = "Norwegian"
- end
- end
- --GRAPHIC SETTINGS
- --X/Y Pos
- if setOpt == "Graphics" and
- sMenuStat == 8 then
- optXYpos = optXYpos + 1
- if optXYpos > 2 then
- optXYpos = 1
- end
- if optXYpos == 1 then
- xyPosOnOff = "ON"
- elseif optXYpos == 2 then
- xyPosOnOff = "OFF"
- end
- end
- --Colors
- if setOpt == "Graphics" and
- sMenuStat == 9 then
- optColors = optColors + 1
- if optColors > 2 then
- optColors = 1
- end
- if optColors == 1 then
- if not term.isColor() then
- print("Error; Advanced Computer Required.")
- sleep(2)
- optColors = 2
- return
- elseif term.isColor() then
- colorsOnOff = "ON"
- end
- elseif optColors == 2 then
- colorsOnOff = "OFF"
- end
- end
- --Detail Level
- if setOpt == "Graphics" and
- sMenuStat == 10 then
- optDetail = optDetail + 1
- if optDetail > 4 then
- optDetail = 1
- end
- if optDetail == 1 then
- hDetailLevel = "LOW"
- elseif optDetail == 2 then
- hDetailLevel = "NORMAL"
- elseif optDetail == 3 then
- hDetailLevel = "HIGH"
- elseif optDetail == 4 then
- hDetailLevel = "EXTREME"
- end
- end
- --HUD SETTINGS
- if setOpt == "Hud" and
- sMenuStat == 11 then
- optSHscore = optSHscore + 1
- if optSHscore > 2 then
- optSHscore = 1
- end
- if optSHscore == 1 then
- shScore = "ON"
- elseif optSHscore == 2 then
- shScore = "OFF"
- end
- end
- --NETWORK/CONNECTION SETTINGS
- if setOpt == "Network" then
- if disabled and
- sMenuStat == 10 then
- optConnection = optConnection + 1
- if optConnection > 3 then
- optConnection = 0
- end
- if optConnection == 0 then
- connection = "NONE"
- elseif optConnection == 1 then
- connection = "GLOBAL"
- elseif optConnection == 2 then
- connection = "PRIVATE"
- elseif optConnection == 3 then
- connection = "LAN"
- end
- elseif sMenuStat == 12 then
- if disabled then
- optAutoUpdate = optAutoUpdate + 1
- if optAutoUpdate > 2 then
- optAutoUpdate = 1
- end
- if optAutoUpdate == 1 then
- hAutoUpdate = "OFF"
- elseif optAutoUpdate == 2 then
- hAutoUpdate = "ON"
- end
- end
- end
- end
- --NETWORK NAME SETTINGS
- -------------------------------------------------
- --CONTROL SETTINGS
- --Default
- if setOpt == "Controls" and
- sMenuStat == 9 then
- defaultControls = true
- if colorsOnOff == "ON" then
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- end
- write(" Controls Reset! ")
- sleep(1)
- cleanScreen()
- end
- if setOpt == "Controls" and
- sMenuStat == 10 then
- setControls()
- end
- -------------------------------------------------
- if setOpt ~= "Nothing" then
- if sMenuStat == minStat then
- setOpt = "Nothing"
- sMenuStat = sMenuStat - 1
- end
- end
- if sMenuStat == 5 then
- if disabled == false then
- firstTime = true
- posMode = "hide"
- setOpt = "Game"
- if firstTime then
- checkOptions()
- sMenuStat = minStat
- firstTime = false
- end
- end
- elseif sMenuStat == 6 then
- if disabled == false then
- firstTime = true
- posMode = "hide"
- setOpt = "Graphics"
- if firstTime then
- checkOptions()
- sMenuStat = minStat
- firstTime = false
- end
- end
- elseif sMenuStat == 7 then
- if disabled == false then
- firstTime = true
- posMode = "hide"
- setOpt = "Controls"
- if firstTime then
- checkOptions()
- sMenuStat = minStat
- firstTime = false
- end
- end
- elseif sMenuStat == 8 then
- if disabled == false then
- firstTime = true
- posMode = "hide"
- setOpt = "Network"
- if firstTime then
- checkOptions()
- sMenuStat = minStat
- firstTime = false
- end
- end
- elseif sMenuStat == 9 then
- if disabled == false then
- firstTime = true
- posMode = "hide"
- setOpt = "Hud"
- if firstTime then
- checkOptions()
- sMenuStat = minStat
- firstTime = false
- end
- end
- elseif sMenuStat == 10 then
- if disabled == false then
- checkSettings()
- saveSettings()
- checkSettings()
- enterCheatCode()
- end
- elseif sMenuStat == 11 then
- if disabled == false then
- write("Settings Reset!")
- sleep(1)
- fs.delete(".gameData/settings/cfg")
- defaultSettings()
- end
- elseif sMenuStat == 12 then
- if disabled == false then
- if colorsOnOff == "OFF" then
- write("Trying to update..")
- checkSettings()
- saveSettings()
- checkSettings()
- elseif colorsOnOff == "ON" then
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- write("Trying to update..")
- checkSettings()
- saveSettings()
- checkSettings()
- end
- sleep(1)
- update()
- end
- end
- end
- end
- function settingsMenu()
- setOpt = "Nothing"
- posMode = "show"
- minStat = 5
- maxStat = 10
- sMenuStat = 5
- settingsNum = 0
- loadSettings()
- while true do
- cleanScreen()
- drawSettingsMenuArt()
- setMenuEvents()
- checkOptions()
- end
- end
- ---------------------------------------------------------------------------------------------------
- --MAP SECTION
- ---------------------------------------------------------------------------------------------------
- function drawHUD()
- if xyPosOnOff == "ON" then
- if colorsOnOff == "OFF" then
- drawAt(39,19,"+ X:"..x.." Y:"..y.." +")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightGray)
- drawAt(1,19," + X:"..x.." Y:"..y.." + ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --TreadMill
- ---------------------------------------------------------------------------------------------------
- wButton = true
- tMode = 1
- p = 0
- tm = 100
- btn = "W"
- treadMill1 = {
- " ",
- " ",
- " ",
- " ",
- " ___ ",
- " | .| ",
- " |__-| ",
- " | | ",
- " | | __ ",
- " |=| | ",
- " |_| | ",
- " | | | ",
- " |_| | ",
- " |_| | ",
- " |=-=-=-=-=-=-=-=-=-=| ",
- " ------------------- ",
- "--------------------------------------------------",
- }
- treadMill2 = {
- " ",
- " ",
- " ",
- " ",
- " ___ ",
- " | .| ",
- " |__-| ",
- " | | = ",
- " /| \\/ / __ ",
- " / | \\__/ | ",
- " \\|_|____ | ",
- " /|_____| | ",
- " /_/ |_| | ",
- " |_| | ",
- " |-=-=-=-=-=-=-=-=-=-| ",
- " ------------------- ",
- "--------------------------------------------------",
- }
- treadMill3 = {
- " ",
- " ",
- " ",
- " ",
- " ___ ",
- " | .| ",
- " |__-| ",
- " | | ",
- " | | __ ",
- " |=| | ",
- " |_| | ",
- " | | | ",
- " |_| | ",
- " |_| | ",
- " |=-=-=-=-=-=-=-=-=-=| ",
- " ------------------- ",
- "--------------------------------------------------",
- }
- treadMill4 = {
- " ",
- " ",
- " ",
- " ",
- " ___ ",
- " | .| ",
- " |__-| ",
- " | | = ",
- " / |\\/ / __ ",
- " / / |\\_/ | ",
- " \\=_|____ | ",
- " / /____| | ",
- " /_/ |_| | ",
- " |_| | ",
- " |-=-=-=-=-=-=-=-=-=-| ",
- " ------------------- ",
- "--------------------------------------------------",
- }
- ---------------------------------------------------------------------------------------------------
- function drawTreadMill()
- if tMode > 4 then
- tMode = 1
- end
- if tMode == 1 then
- for i = 1, #treadMill1 do
- drawAt(1,i,treadMill1[i])
- end
- elseif tMode == 2 then
- for i = 1, #treadMill2 do
- drawAt(1,i,treadMill2[i])
- end
- elseif tMode == 3 then
- for i = 1, #treadMill3 do
- drawAt(1,i,treadMill3[i])
- end
- elseif tMode == 4 then
- for i = 1, #treadMill4 do
- drawAt(1,i,treadMill4[i])
- end
- end
- end
- function drawStats()
- if p < 1 then
- mtr = 0
- end
- if p >= 10 then
- mtr = 1
- end
- if p >= 20 then
- mtr = 2
- end
- if p >= 30 then
- mtr = 3
- end
- if p >= 40 then
- mtr = 4
- end
- if p >= 50 then
- mtr = 5
- end
- if p >= 60 then
- mtr = 6
- end
- if p >= 70 then
- mtr = 7
- end
- if p >= 80 then
- mtr = 8
- end
- if p >= 90 then
- mtr = 9
- end
- if p >= 100 then
- mtr = 10
- end
- if btnNum == 1 then
- btn = "W"
- elseif btnNum == 2 then
- btn = "D"
- end
- drawAt(1,18,"Button:"..btn.." "..p..":"..tm)
- drawAt(1,19,"|")
- drawAt(12,19,"|")
- drawAt(2 + mtr,19,"=")
- end
- function hWButton()
- btnNum = 2
- while true do
- event, button = os.pullEvent()
- if event == "char" and
- button == "w" then
- dButton = true
- wButton = false
- tMode = tMode + 1
- p = p + 1
- sleep(0)
- return treadMill()
- end
- end
- end
- function hDButton()
- btnNum = 1
- while true do
- event, button = os.pullEvent()
- if event == "char" and
- button == "d" then
- wButton = true
- dButton = false
- tMode = tMode + 1
- p = p + 1
- sleep(0)
- return treadMill()
- end
- end
- end
- function treadMill()
- while true do
- if p >= tm then
- term.clear()
- term.setCursorPos(1,1)
- xp = xp + trainXp
- sta = sta - 10
- day = day + 1
- mbrshipDay = mbrshipDay - 1
- print("EARNED:"..trainXp)
- print("XP:"..xp)
- sleep(2)
- return inGym()
- end
- term.clear()
- term.setCursorPos(1,1)
- drawTreadMill()
- drawStats()
- if wButton then
- hWButton()
- end
- if dButton then
- hDButton()
- end
- end
- end
- function checkMoney()
- price = 3000
- if money < price then
- cleanScreen()
- term.setCursorPos(10,10)
- print("Not Enough Money!")
- end
- if money >= price then
- mbrshipDay = mbrshipDay + 30
- money = money - 3000
- print("Membership Days Increased By 30 days")
- end
- end
- function checkTrain()
- trainXp = 300
- if hp == 0 or sta == 0 then
- cleanScreen()
- term.setCursorPos(10,10)
- print("Need To Rest First!")
- sleep(1)
- return
- end
- if mbrshipDay == 0 then
- cleanScreen()
- term.setCursorPos(2,10)
- print("You don't have any days left on Your Membership!")
- sleep(1)
- return
- end
- if hp > 0 then if
- sta > 0 then
- if mbrshipDay > 0 then
- treadMill()
- end
- end
- end
- end
- local map1 = {
- " _________________________________________________ ",
- "/ \\",
- "| |",
- "| |",
- "| |",
- "| |",
- "| **| |** |",
- "| **| |** | | |",
- "| | | | | |",
- "| \\ \\-----------| |---------------- |",
- "| \\____________________________ / |",
- "| / / |",
- "| / / |",
- "| / / |", --X:41 Y:14
- "| ** ** / / |",
- "| ---------------------------/ / |",
- "| |_____________________________/ |",
- "\\_________________________________________________/"
- }
- local map1L = {
- " _________________________________________________ ",
- "/ \\",
- "| |",
- "| |",
- "| |",
- "| |",
- "| | | |",
- "| | | | | |",
- "| | | | | |",
- "| \\ \\-----------| |---------------- |",
- "| \\____________________________ / |",
- "| / / |",
- "| / / |",
- "| / / |", --X:41 Y:14
- "| / / |",
- "| ---------------------------/ / |",
- "| |_____________________________/ |",
- "\\_________________________________________________/"
- }
- local mallInterior = {
- " _________________________________________________ ",
- "/\\ ___ ___ /\\",
- "| \\_______\\.../_______________\\.../_____________/ |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| | | |",
- "| |_____________... ..._______________________| |",
- "| / /___|___\\ \\ |",
- "\\/_______________________________________________\\/ "
- }
- local mallInteriorCol = {
- "\\ / ",
- " \\ ___ ___ / ",
- " \\_______| |_______________| |____________/ ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " | | ",
- " |____________ ... ... ______________________| ",
- " / |___|___| \\ ",
- "_/_______________________________________________\\_"
- }
- local gymE = {
- " _____",
- " |_GYM_|",
- " --------",
- "|---__---|",
- "|--|::|--|",
- "'--------'"
- }
- local gymH = {
- " _____",
- " | GYM |",
- " --------",
- "|---__---|",
- "|--|::|--|",
- "'--------'"
- }
- local gym = {
- " _____",
- " | GYM |",
- " --------",
- "|---__---|",
- "|--|::|--|",
- " -------- "
- }
- local gymL = {
- " _____",
- " | GYM |",
- " --------",
- "| __ |",
- "| |::| |",
- " -------- "
- }
- local home = {
- " _____",
- "/_____\\",
- "| _ |",
- "| |:| |",
- "-------"
- }
- local homeL = {
- " _____",
- "/ \\",
- "| _ |",
- "| |:| |",
- "-------"
- }
- local superMallHE = {
- "_____________",
- "|============|",
- "|====MALL====|",
- "--------------",
- "| |",
- "|-----___----|",
- "|____|:|:|___|",
- "--------------"
- }
- local superMall = {
- "_____________",
- "|============|",
- "|====MALL====|",
- "--------------",
- "| |",
- "| ___ |",
- "|____|:|:|___|",
- "--------------"
- }
- local superMallL = {
- "_____________",
- "| |",
- "| MALL |",
- "--------------",
- "| |",
- "| ___ |",
- "|____|:|:|___|",
- "--------------"
- }
- local hospital = {
- "__________",
- "| Hospital|",
- "|_________|",
- "|__|:|:|__|"
- }
- local hospitalL = {
- "__________",
- "| Hospital|",
- "| ___ |",
- "|__|:|:|__|"
- }
- local gymMenuArt = {
- " __________________________",
- "| --[[GYM]]-- |",
- "|-------------------------|",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "|_________________________|"
- }
- local gymMenuArtCol = {
- " ",
- " --[[GYM]]-- ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " "
- }
- local gymOptions = {
- "Buy/Extend Membership", "Train", "Open Map"
- }
- -------------------------------------------------
- function gymEvents()
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 200
- then
- menuStat = menuStat - 1
- if menuStat < 4 then
- menuStat = 6
- end
- elseif p1 == 208 then
- menuStat = menuStat + 1
- if menuStat > 6 then
- menuStat = 4
- end
- elseif p1 == 28 then
- if menuStat == 4 then
- cleanScreen()
- checkMoney()
- sleep(2)
- return
- elseif menuStat == 5 then
- checkTrain()
- sleep(2)
- return
- elseif menuStat == 6 then
- if colorsOnOff == "OFF" then
- map(lastXpos,lastYpos)
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- map(lastXpos,lastYpos)
- end
- end
- end
- end
- end
- -------------------------------------------------
- function gameEvents()
- if defaultControls then
- event, p1 = os.pullEvent()
- if event == "char" and p1 == "a" then
- x = x - 1
- lastXpos = x + 1
- lastYpos = y
- elseif p1 == "d" then
- x = x + 1
- lastXpos = x - 1
- lastYpos = y
- elseif p1 == "s" then
- y = y + 1
- lastYpos = y - 1
- lastXpos = x
- elseif p1 == "w" then
- y = y - 1
- lastYpos = y + 1
- lastXpos = x
- end
- end
- if not defaultControls then
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == leftButton then
- x = x - 1
- lastXpos = x + 1
- lastYpos = y
- elseif p1 == rightButton then
- x = x + 1
- lastXpos = x - 1
- lastYpos = y
- elseif p1 == downButton then
- y = y + 1
- lastYpos = y - 1
- lastXpos = x
- elseif p1 == upButton then
- y = y - 1
- lastYpos = y + 1
- lastXpos = x
- end
- end
- end
- -------------------------------------------------
- function checkMallPos()
- --Checks If You Leave the Mall
- if x == 18 or x == 19 or x == 20 then
- if y == 17 then
- insMall = false
- map(37,9)
- end
- end
- if x == 21 then
- if y == 17 then
- insMall = false
- map(38,9)
- end
- end
- if x == 22 or x == 23 or x == 24 then
- if y == 17 then
- insMall = false
- map(39,9)
- end
- end
- -------------------------------------------------
- --Makes The Mall Solid
- if y < 4 then
- y = 4
- end
- if y > 16 then
- y = 16
- end
- if x < 5 then
- x = 5
- end
- if x > 47 then
- x = 47
- end
- end
- -------------------------------------------------
- function checkHealth()
- if sta < 1 then
- sta = 0
- end
- half = tHP / 2
- oFour = tHP / 4
- tFour = tHP / 4 * 3
- if colorsOnOff == "OFF" then
- if hp == 0 then
- status = "Paralyzed"
- end
- if hp >= 1 and
- hp < oFour then
- status = "Seriously Damaged"
- end
- if hp >= oFour and
- hp < half then
- status = "Very Damaged"
- end
- if hp >= half and
- hp < tFour then
- status = "Damaged"
- end
- if hp >= tFour and
- hp < tHP then
- status = "Minor Injury"
- end
- if hp == tHP then
- status = "Healthy"
- end
- elseif colorsOnOff == "ON" then
- if hp == 0 then
- term.setTextColor(colors.purple)
- status = "Paralyzed"
- term.setTextColor(menuTextColor)
- end
- if hp >= 1 and
- hp < oFour then
- term.setTextColor(colors.red)
- status = "Seriously Damaged"
- term.setTextColor(menuTextColor)
- end
- if hp >= oFour and
- hp < half then
- term.setTextColor(colors.orange)
- status = "Very Damaged"
- term.setTextColor(menuTextColor)
- end
- if hp >= half and
- hp < tFour then
- term.setTextColor(colors.yellow)
- status = "Damaged"
- term.setTextColor(menuTextColor)
- end
- if hp >= tFour and
- hp < tHP then
- term.setTextColor(colors.green)
- status = "Minor Injury"
- term.setTextColor(menuTextColor)
- end
- if hp == tHP then
- term.setTextColor(colors.lime)
- status = "Healthy"
- term.setTextColor(menuTextColor)
- end
- end
- end
- function drawGymInfo()
- if colorsOnOff == "OFF" then
- drawAt(29,3,"NAME:"..myName)
- drawAt(29,4,"HP:"..hp)
- drawAt(29,5,"STA:"..sta)
- drawAt(29,6,"Money"..money.."$")
- drawAt(29,11,"Membership:".. mbrshipDay.." Days Left")
- drawAt(29,7,"DAY:"..day)
- drawAt(29,9,"STATUS:"..status)
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(colors.yellow)
- drawAt(28,1," ")
- drawAt(28,2," ")
- drawAt(28,3," NAME:"..myName.." ")
- term.setTextColor(colors.red)
- drawAt(28,4," HP:"..hp.." ")
- term.setTextColor(colors.cyan)
- drawAt(28,5," STA:"..sta.." ")
- term.setTextColor(colors.lime)
- drawAt(28,6," Money"..money.."$ ")
- drawAt(28,8," ")
- drawAt(28,10," ")
- drawAt(28,12," ")
- drawAt(28,13," ")
- drawAt(28,14," ")
- drawAt(28,15," ")
- drawAt(28,16," ")
- drawAt(28,17," ")
- drawAt(28,18," ")
- drawAt(28,19," ")
- term.setTextColor(menuTextColor)
- drawAt(28,11," Membership:".. mbrshipDay.." Days Left ")
- drawAt(28,7," DAY:"..day.." ")
- checkHealth()
- drawAt(28,9," STATUS:"..status.." ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- function inGym()
- p = 0
- onMap = false
- menuStat = 4
- while true do
- checkHealth()
- cleanScreen()
- if colorsOnOff == "OFF" then
- drawGymMenu()
- drawGymInfo()
- checkHealth()
- gymEvents()
- elseif colorsOnOff == "ON" then
- drawGymMenu()
- drawGymInfo()
- checkHealth()
- gymEvents()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- end
- end
- -------------------------------------------------
- function inMall(pos1,pos2)
- x = pos1
- y = pos2
- onMap = false
- insMall = true
- while insMall do
- cleanScreen()
- checkMallPos()
- drawMallArt()
- drawCharacter()
- drawHUD()
- gameEvents()
- cleanScreen()
- end
- end
- -------------------------------------------------
- function drawDoors()
- term.setBackgroundColor(colors.cyan)
- drawAt(18,17,"___|___")
- drawAt(12,3," ")
- drawAt(32,3," ")
- term.setBackgroundColor(colors.lightGray)
- end
- function drawMallArt()
- if colorsOnOff == "OFF" then
- for i = 1, #mallInterior do
- drawAt(1,i,mallInterior[i])
- end
- elseif colorsOnOff == "ON" then
- for i = 1, #mallInteriorCol do
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- drawAt(1,i,mallInteriorCol[i])
- drawDoors()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- end
- end
- -------------------------------------------------
- function checkPosition()
- --This checks if you enter A Building
- --Checks if you Enter The Gym
- if x == 8 or x == 9 then
- if y == 6 then
- onMap = false
- inGym()
- end
- end
- --Checks if you Enter the Home
- if x == 23 then
- if y == 5 then
- onMap = false
- solo()
- end
- end
- --Checks if you Enter the mall
- if x == 37 then
- if y == 8 then
- onMap = false
- inMall(19,16)
- end
- end
- if x == 38 then
- if y == 8 then
- onMap = false
- inMall(21,16)
- end
- end
- if x == 39 then
- if y == 8 then
- onMap = false
- inMall(23,16)
- end
- end
- --This Does so you don't walk through a house
- --or Fall out of the map
- --Makes the map solid
- if y < 2 then
- y = 2
- end
- if y > 17 then
- y = 17
- end
- if x < 2 then
- x = 2
- end
- if x > 50 then
- x = 50
- end
- --Makes the Gym Solid
- if y == 6 then
- if x == 4 then
- x = 3
- end
- end
- if y == 5 then
- if x == 4 then
- x = 3
- end
- end
- if y == 4 then
- if x == 5 then
- x = 4
- end
- end
- if y == 3 then
- if x == 6 then
- x = 5
- end
- end
- if y == 2 then
- if x == 7 then
- x = 6
- end
- end
- if y == 6 then
- if x == 5 then
- y = 7
- end
- end
- if y == 6 then
- if x == 6 then
- y = 7
- end
- end
- if y == 6 then
- if x == 7 then
- y = 7
- end
- end
- if y == 6 then
- if x == 10 then
- y = 7
- end
- end
- if y == 6 then
- if x == 11 then
- y = 7
- end
- end
- if y == 6 then
- if x == 12 then
- y = 7
- end
- end
- if y == 5 then
- if x == 8 then
- y = 6
- end
- end
- if y == 5 then
- if x == 9 then
- y = 6
- end
- end
- if y == 6 then
- if x == 13 then
- x = 14
- end
- end
- if y == 5 then
- if x == 13 then
- x = 14
- end
- end
- if y == 4 then
- if x == 12 then
- x = 13
- end
- end
- if y == 3 then
- if x == 12 then
- x = 13
- end
- end
- if y == 2 then
- if x == 11 then
- x = 12
- end
- end
- --Makes The Home Solid
- if y == 5 then
- if x == 20 then
- x = 19
- end
- end
- if y == 4 then
- if x == 20 then
- x = 19
- end
- end
- if y == 3 then
- if x == 20 then
- x = 19
- end
- end
- if y == 2 then
- if x == 21 then
- x = 20
- end
- end
- if y == 5 then
- if x == 26 then
- x = 27
- end
- end
- if y == 4 then
- if x == 26 then
- x = 27
- end
- end
- if y == 3 then
- if x == 26 then
- x = 27
- end
- end
- if y == 2 then
- if x == 25 then
- x = 26
- end
- end
- if y == 5 then
- if x == 21 then
- y = 6
- end
- end
- if y == 5 then
- if x == 22 then
- y = 6
- end
- end
- if y == 5 then
- if x == 23 then
- y = 6
- end
- end
- if y == 5 then
- if x == 24 then
- y = 6
- end
- end
- if y == 5 then
- if x == 25 then
- y = 6
- end
- end
- --Makes The Mall Solid
- --Left
- if y == 8 then
- if x == 31 then
- x = 30
- end
- end
- if y == 7 then
- if x == 31 then
- x = 30
- end
- end
- if y == 6 then
- if x == 31 then
- x = 30
- end
- end
- if y == 5 then
- if x == 31 then
- x = 30
- end
- end
- if y == 4 then
- if x == 31 then
- x = 30
- end
- end
- if y == 3 then
- if x == 31 then
- x = 30
- end
- end
- if y == 2 then
- if x == 31 then
- x = 30
- end
- end
- --Right
- if y == 8 then
- if x == 44 then
- x = 45
- end
- end
- if y == 7 then
- if x == 44 then
- x = 45
- end
- end
- if y == 6 then
- if x == 44 then
- x = 45
- end
- end
- if y == 5 then
- if x == 44 then
- x = 45
- end
- end
- if y == 4 then
- if x == 44 then
- x = 45
- end
- end
- if y == 3 then
- if x == 44 then
- x = 45
- end
- end
- if y == 2 then
- if x == 44 then
- x = 45
- end
- end
- --Bottom
- if y == 8 then
- if x == 32 then
- y = 9
- end
- end
- if y == 8 then
- if x == 33 then
- y = 9
- end
- end
- if y == 8 then
- if x == 34 then
- y = 9
- end
- end
- if y == 8 then
- if x == 35 then
- y = 9
- end
- end
- if y == 8 then
- if x == 36 then
- y = 9
- end
- end
- if y == 8 then
- if x == 38 then
- y = 9
- end
- end
- if y == 8 then
- if x == 40 then
- y = 9
- end
- end
- if y == 8 then
- if x == 41 then
- y = 9
- end
- end
- if y == 8 then
- if x == 42 then
- y = 9
- end
- end
- if y == 8 then
- if x == 43 then
- y = 9
- end
- end
- --Makes The House Solid
- --Left
- if y == 12 then
- if x == 19 then
- x = 18
- end
- end
- if y == 13 then
- if x == 18 then
- x = 17
- end
- end
- if y == 14 then
- if x == 18 then
- x = 17
- end
- end
- if y == 15 then
- if x == 18 then
- x = 17
- end
- end
- --Bottom
- if y == 15 then
- if x == 19 then
- y = 16
- end
- end
- if y == 15 then
- if x == 20 then
- y = 16
- end
- end
- if y == 15 then
- if x == 21 then
- y = 16
- end
- end
- if y == 15 then
- if x == 22 then
- y = 16
- end
- end
- if y == 15 then
- if x == 23 then
- y = 16
- end
- end
- --Right
- if y == 15 then
- if x == 24 then
- x = 25
- end
- end
- if y == 14 then
- if x == 24 then
- x = 25
- end
- end
- if y == 13 then
- if x == 24 then
- x = 25
- end
- end
- if y == 12 then
- if x == 23 then
- x = 24
- end
- end
- --Top
- if y == 12 then
- if x == 23 then
- y = 11
- end
- end
- if y == 12 then
- if x == 22 then
- y = 11
- end
- end
- if y == 12 then
- if x == 21 then
- y = 11
- end
- end
- if y == 12 then
- if x == 20 then
- y = 11
- end
- end
- if y == 12 then
- if x == 19 then
- y = 11
- end
- end
- --Makes the Hospital Solid
- --Left
- if y == 13 then
- if x == 4 then
- x = 3
- end
- end
- if y == 14 then
- if x == 4 then
- x = 3
- end
- end
- if y == 15 then
- if x == 4 then
- x = 3
- end
- end
- --Top
- if y == 12 then
- if x == 4 then
- y = 11
- end
- end
- if y == 12 then
- if x == 5 then
- y = 11
- end
- end
- if y == 12 then
- if x == 6 then
- y = 11
- end
- end
- if y == 12 then
- if x == 7 then
- y = 11
- end
- end
- if y == 12 then
- if x == 8 then
- y = 11
- end
- end
- if y == 12 then
- if x == 9 then
- y = 11
- end
- end
- if y == 12 then
- if x == 10 then
- y = 11
- end
- end
- if y == 12 then
- if x == 11 then
- y = 11
- end
- end
- if y == 12 then
- if x == 12 then
- y = 11
- end
- end
- if y == 12 then
- if x == 13 then
- y = 11
- end
- end
- if y == 12 then
- if x == 14 then
- y = 11
- end
- end
- --Bottom
- if y == 15 then
- if x == 4 then
- y = 16
- end
- end
- if y == 15 then
- if x == 5 then
- y = 16
- end
- end
- if y == 15 then
- if x == 6 then
- y = 16
- end
- end
- if y == 15 then
- if x == 7 then
- y = 16
- end
- end
- if y == 15 then
- if x == 8 then
- y = 16
- end
- end
- if y == 15 then
- if x == 9 then
- y = 16
- end
- end
- if y == 15 then
- if x == 10 then
- y = 16
- end
- end
- if y == 15 then
- if x == 11 then
- y = 16
- end
- end
- if y == 15 then
- if x == 12 then
- y = 16
- end
- end
- if y == 15 then
- if x == 13 then
- y = 16
- end
- end
- --Right
- if y == 15 then
- if x == 14 then
- x = 15
- end
- end
- if y == 14 then
- if x == 14 then
- x = 15
- end
- end
- if y == 13 then
- if x == 14 then
- x = 15
- end
- end
- end
- -------------------------------------------------
- --Drawing Section
- function drawMap1()
- if colorsOnOff == "OFF" then
- drawScenery()
- drawBuildings()
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.lime)
- term.setTextColor(colors.green)
- drawScenery()
- drawColorBuildings()
- end
- end
- function drawColorBuildings()
- --HOME1
- term.setBackgroundColor(colors.black)
- drawAt(21,2," ")
- drawAt(20,3," ")
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.brown)
- drawAt(20,4," _ ")
- drawAt(20,5," |:| ")
- --HOME2
- term.setBackgroundColor(colors.black)
- drawAt(19,12," ")
- drawAt(18,13," ")
- term.setBackgroundColor(colors.yellow)
- term.setTextColor(colors.brown)
- drawAt(18,14," _ ")
- drawAt(18,15," |:| ")
- --GYM
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- drawAt(7,2," ")
- drawAt(6,3," GYM ")
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.brown)
- drawAt(5,4," ")
- drawAt(4,5," __ ")
- drawAt(4,6," |::| ")
- term.setTextColor(colors.gray)
- drawAt(4,7,"'--------'")
- --MALL
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.red)
- drawAt(31,2," ")
- drawAt(31,3," ")
- drawAt(31,4," MALL ")
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.brown)
- drawAt(31,5," ")
- drawAt(31,6," ")
- drawAt(31,7," ___ ")
- drawAt(31,8," |:|:| ")
- term.setTextColor(colors.gray)
- drawAt(31,9,"--------------")
- --HOSPITAL
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- drawAt(4,12," ")
- drawAt(4,13," Hospital ")
- term.setTextColor(colors.brown)
- drawAt(4,14," ___ ")
- drawAt(4,15," |:|:| ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- function drawGymMenu()
- if colorsOnOff == "OFF" then
- for i = 1, #gymMenuArt do
- drawAt (1,i,gymMenuArt[i])
- end
- for i = 1, #gymOptions do
- drawAt (3,i + 4,"*")
- drawAt (5,i + 4,gymOptions[i])
- end
- drawCursor(2,4,1 + menuStat)
- elseif colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- for i = 1, #gymMenuArtCol do
- drawAt (1,i,gymMenuArtCol[i])
- end
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- for i = 1, #gymOptions do
- drawAt (3,i + 4,"*")
- drawAt (5,i + 4,gymOptions[i])
- end
- term.setBackgroundColor(ttBackColor)
- drawCursor(2,4,1 + menuStat)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- end
- function drawScenery()
- if hDetailLevel == "LOW" then
- for i = 1, #map1L do
- drawAt(1,i,map1L[i])
- end
- elseif hDetailLevel == "NORMAL" or hDetailLevel == "HIGH" or hDetailLevel == "EXTREME" then
- for i = 1, #map1 do
- drawAt(1,i,map1[i])
- end
- end
- end
- function drawBuildings()
- if colorsOnOff == "OFF" then
- if hDetailLevel == "NORMAL" then
- for i = 1, #gym do
- drawAt(4,i + 1,gym[i])
- end
- for i = 1, #superMall do
- drawAt(31,i + 1,superMall[i])
- end
- for i = 1, #home do
- drawAt(20,i + 1,home[i])
- end
- for i = 1, #home do
- drawAt(18,i + 11,home[i])
- end
- for i = 1, #hospital do
- drawAt(4,i + 11,hospital[i])
- end
- elseif hDetailLevel == "LOW" then
- for i = 1, #gymL do
- drawAt(4,i + 1,gymL[i])
- end
- for i = 1, #superMallL do
- drawAt(31,i + 1,superMallL[i])
- end
- for i = 1, #homeL do
- drawAt(20,i + 1,homeL[i])
- end
- for i = 1, #homeL do
- drawAt(18,i + 11,homeL[i])
- end
- for i = 1, #hospitalL do
- drawAt(4,i + 11,hospitalL[i])
- end
- elseif hDetailLevel == "HIGH" then
- for i = 1, #gymH do
- drawAt(4,i + 1,gymL[i])
- end
- for i = 1, #superMallHE do
- drawAt(31,i + 1,superMallHE[i])
- end
- for i = 1, #home do
- drawAt(20,i + 1,home[i])
- end
- for i = 1, #home do
- drawAt(18,i + 11,home[i])
- end
- for i = 1, #hospital do
- drawAt(4,i + 11,hospital[i])
- end
- elseif hDetailLevel == "EXTREME" then
- for i = 1, #gymE do
- drawAt(4,i + 1,gymE[i])
- end
- for i = 1, #superMallHE do
- drawAt(31,i + 1,superMallHE[i])
- end
- for i = 1, #home do
- drawAt(20,i + 1,home[i])
- end
- for i = 1, #home do
- drawAt(18,i + 11,home[i])
- end
- for i = 1, #hospital do
- drawAt(4,i + 11,hospital[i])
- end
- end
- elseif colorsOnOff == "ON" then
- drawColorBuildings()
- end
- end
- -------------------------------------------------
- function map(pos1,pos2)
- x = pos1
- y = pos2
- onMap = true
- while true do
- if onMap == false
- then
- break
- end
- cleanScreen()
- drawMap1(detailLevel)
- checkPosition()
- drawHUD()
- drawCharacter()
- gameEvents()
- cleanScreen()
- end
- end
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- local function CheckUserName()
- if #myName < minName then
- return false, " Name is too short."
- elseif #myName > maxName then
- return false, " Name is too long."
- end
- return true
- end
- ---------------------------------------------------------------------------------------------------
- --:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ---------------------------------------------------------------------------------------------------
- --MULTIPLAYER SECTION
- ---------------------------------------------------------------------------------------------------
- --LOCAL Multiplayer
- ---------------------------------------------------------------------------------------------------
- -----------------------------------
- --MENUS OPTIONS
- -----------------------------------
- local warningOptions = {
- "Yes", "No"
- }
- local hMenuOptions =
- {
- "Quick Match", "Tournament", "Inventory", "Open Map", "Relax", "Save", "Exit To Main Menu"
- }
- local chMenuOptions =
- {
- "New Game", "Load", "Delete", "Exit"
- }
- local dMenuOptions =
- {
- "Easy", "Normal", "Hard", "Extreme"
- }
- --Draws the Gameplay
- function drawMatchArt()
- if colorsOnOff == "OFF" then
- drawAt(10,9,"ACTION: ")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.black)
- drawAt(10,9,"ACTION: ")
- end
- end
- --Draw The players and The Enemies Grid PS. This Is for solo Play
- function drawGrids()
- if hDetailLevel == "LOW" then
- drawAt(1,1,"|======| "..myName.." ")
- drawAt(1,2,"| O ..O| HP:"..hp.."/"..tHP)
- drawAt(1,3,"| _ | STA:"..sta.."/"..tSta)
- drawAt(1,4,"| | LVL:"..lvl.." ")
- drawAt(1,5,"|------+ ")
- drawAt(28,1,"|======| "..enemy.." ")
- drawAt(28,2,"|O ..O | HP:"..enemyHP.." ")
- drawAt(28,3,"| _ | STA:"..enemySta.." ")
- drawAt(28,4,"| | LVL:"..enemyLvl.." ")
- drawAt(28,5,"|------+ ")
- elseif hDetailLevel == "NORMAL" or hDetailLevel == "HIGH" or hDetailLevel == "EXTREME" then
- if colorsOnOff == "OFF" then
- drawAt(1,1," '''''' "..myName.." ")
- drawAt(1,2,"' . . HP:"..hp.."/"..tHP)
- drawAt(1,3,"d - | STA:"..sta.."/"..tSta)
- drawAt(1,4,"| _ | LVL:"..lvl.." ")
- drawAt(1,5,"|______/")
- drawAt(28,1," '''''' "..enemy.." ")
- drawAt(28,2," . . ' HP:"..enemyHP.." ")
- drawAt(28,3,"| - D STA:"..enemySta.." ")
- drawAt(28,4,"| _ | LVL:"..enemyLvl.." ")
- drawAt(28,5,"\\______| ")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.brown)
- drawAt(1,1," '''''' "..myName.." ")
- drawAt(1,2,"' . . HP:"..hp.."/"..tHP.." ")
- term.setTextColor(colors.black)
- drawAt(1,3,"d - | STA:"..sta.."/"..tSta.." ")
- drawAt(1,4,"| _ | LVL:"..lvl.." ")
- drawAt(1,5,"|______/ ")
- --Player Info
- term.setTextColor(colors.yellow)
- drawAt(10,1,myName)
- term.setTextColor(colors.red)
- drawAt(10,2,"HP:"..hp.."/"..tHP)
- term.setTextColor(colors.cyan)
- drawAt(10,3,"STA:"..sta.."/"..tSta)
- term.setTextColor(colors.yellow)
- drawAt(10,4,"LVL:"..lvl)
- term.setTextColor(colors.brown)
- drawAt(28,1," '''''' "..enemy.." ")
- term.setTextColor(colors.black)
- drawAt(28,2," . . ' HP:"..enemyHP.." ")
- drawAt(28,3,"| - D STA:"..enemySta.." ")
- drawAt(28,4,"| _ | LVL:"..enemyLvl.." ")
- drawAt(28,5,"\\______| ")
- drawAt(1,6," ")
- --Enemy Info
- term.setTextColor(colors.yellow)
- drawAt(37,1,enemy)
- term.setTextColor(colors.red)
- drawAt(37,2,"HP:"..enemyHP)
- term.setTextColor(colors.cyan)
- drawAt(37,3,"STA:"..enemySta)
- term.setTextColor(colors.yellow)
- drawAt(37,4,"LVL:"..enemyLvl)
- term.setBackgroundColor(colors.lightGray)
- drawAt(1,7," ")
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --MENUS ART
- ---------------------------------------------------------------------------------------------------
- function drawBoxingGloves()
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- drawAt(35,8," Boxing ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- drawAt(35,9," _____ ")
- drawAt(35,10," .' . '. _ ")
- drawAt(35,11," | : .- | | ")
- drawAt(35,12," | : (__ |_| ")
- drawAt(35,13," '._ ___/ ")
- drawAt(35,14," .' '. _ ")
- drawAt(35,15," | | | ")
- drawAt(35,16," | |_| ")
- drawAt(35,17," '._____.' ")
- drawAt(35,18," ")
- term.setBackgroundColor(colors.lightGray)
- drawAt(35,19," Gloves Ascii ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- end
- --Draws The Main Menu
- function drawMenu()
- cleanScreen()
- if language == "English" then
- menuOptions = {
- "Solo", "Multiplayer", "Settings", "Highscore", "Help", "Credits", "Quit"
- }
- elseif language == "Swedish" then
- menuOptions = {
- "Solo Spel", "Flerspelare", "Inställningar", "Rekord", "Hjälp", "Krediter", "Lämna"
- }
- end
- if colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- drawAt(1,1," ")
- drawAt(1,2," ")
- drawAt(1,3," ")
- centerPrint(2,"Boxer Tournament Ver "..version)
- term.setBackgroundColor(menuBackColor)
- drawAt(1,4," ")
- drawAt(1,5," ")
- drawAt(1,6," ")
- drawAt(1,7," ")
- drawAt(1,8," ")
- drawAt(1,9," ")
- drawAt(1,10," ")
- drawAt(1,11," ")
- drawAt(1,12," ")
- drawAt(1,13," ")
- drawAt(1,14," ")
- drawAt(1,15," ")
- drawAt(1,16," ")
- drawAt(1,17," ")
- drawAt(1,18," ")
- drawAt(1,19," ")
- drawBoxingGloves()
- for i = 1, #menuOptions do
- term.setTextColor(menuTextColor)
- drawAt(3,i + 4,"*")
- drawAt(5,i + 4,menuOptions[i])
- end
- term.setTextColor(menuTextColor)
- drawCursor(2,4,3 + menuStat)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- elseif colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| |")
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,4,"| |")
- drawAt(1,5,"| |")
- drawAt(1,6,"| |")
- drawAt(1,7,"| |")
- drawAt(1,8,"| |")
- drawAt(1,9,"| _____ |")
- drawAt(1,10,"| .' . '. _ |")
- drawAt(1,11,"| | : .- | | |")
- drawAt(1,12,"| | : (__ |_| |")
- drawAt(1,13,"| '._ ___/ |")
- drawAt(1,14,"| .' '. _ |")
- drawAt(1,15,"| | | | |")
- drawAt(1,16,"| | |_| |")
- drawAt(1,17,"| '._____.' |")
- drawAt(1,18,"+-------------------------------------------------+")
- centerPrint(2,"Boxer Tournament Ver "..version)
- for i = 1, #menuOptions do
- drawAt(3,i + 4,"*")
- drawAt(5,i + 4,menuOptions[i])
- end
- drawCursor(2,4,3 + menuStat)
- end
- end
- --Draws The Difficulty Menu
- function drawDifMenuU()
- cleanScreen()
- if colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| |") --Draw Difficulty at 19
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,4,"| |")
- drawAt(1,5,"| |")
- drawAt(1,6,"| |")
- drawAt(1,7,"| |")
- drawAt(1,8,"| |")
- drawAt(1,9,"| |")
- drawAt(1,10,"| |")
- drawAt(1,11,"| |")
- drawAt(1,12,"| |")
- drawAt(1,13,"| |")
- drawAt(1,14,"| |")
- drawAt(1,15,"| |")
- drawAt(1,16,"| |")
- drawAt(1,17,"| |")
- drawAt(1,18,"+-------------------------------------------------+")
- for i = 1, #menuOptions do
- drawAt(22,i + 4,dMenuOptions[i])
- end
- drawDifCursor(20,3 + menuStat)
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(ttTextColor)
- drawAt(1,1," ")
- drawAt(1,2," ")
- drawAt(1,3," ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,4," ")
- drawAt(1,5," ")
- drawAt(1,6," ")
- drawAt(1,7," ")
- drawAt(1,8," ")
- drawAt(1,9," ")
- drawAt(1,10," ")
- drawAt(1,11," ")
- drawAt(1,12," ")
- drawAt(1,13," ")
- drawAt(1,14," ")
- drawAt(1,15," ")
- drawAt(1,16," ")
- drawAt(1,17," ")
- drawAt(1,18," ")
- drawAt(1,19," ")
- term.setTextColor(colors.gray)
- centerPrint(6,"EASY")
- term.setTextColor(colors.gray)
- centerPrint(7,"NORMAL")
- term.setTextColor(colors.gray)
- centerPrint(8,"HARD")
- term.setTextColor(colors.gray)
- centerPrint(9,"EXTREME")
- term.setTextColor(colors.black)
- drawDifCursor(20,4 + menuStat)
- end
- end
- --Draws The Difficulty Menu
- function drawDifMenu()
- if colorsOnOff == "OFF" then
- cleanScreen()
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| --[Difficulty]-- |")
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,4,"| |")
- drawAt(1,5,"| |")
- drawAt(1,6,"| |")
- drawAt(1,7,"| |")
- drawAt(1,8,"| |")
- drawAt(1,9,"| |")
- drawAt(1,10,"| |")
- drawAt(1,11,"| |")
- drawAt(1,12,"| |")
- drawAt(1,13,"| |")
- drawAt(1,14,"| |")
- drawAt(1,15,"| |")
- drawAt(1,16,"| |")
- drawAt(1,17,"| |")
- drawAt(1,18,"+-------------------------------------------------+")
- for i = 1, #menuOptions do
- drawAt(22,i + 4,dMenuOptions[i])
- end
- drawDifCursor(20,3 + menuStat)
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(ttTextColor)
- drawAt(1,1," ")
- drawAt(1,2," ")
- drawAt(1,3," ")
- centerPrint(2,"--[Difficulty]--")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,4," ")
- drawAt(1,5," ")
- drawAt(1,6," ")
- drawAt(1,7," ")
- drawAt(1,8," ")
- drawAt(1,9," ")
- drawAt(1,10," ")
- drawAt(1,11," ")
- drawAt(1,12," ")
- drawAt(1,13," ")
- drawAt(1,14," ")
- drawAt(1,15," ")
- drawAt(1,16," ")
- drawAt(1,17," ")
- drawAt(1,18," ")
- drawAt(1,19," ")
- term.setTextColor(colors.green)
- centerPrint(6,"EASY")
- term.setTextColor(colors.cyan)
- centerPrint(7,"NORMAL")
- term.setTextColor(colors.orange)
- centerPrint(8,"HARD")
- term.setTextColor(colors.red)
- centerPrint(9,"EXTREME")
- term.setTextColor(colors.black)
- drawDifCursor(20,4 + menuStat)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- function drawHomeCharacter()
- if colorsOnOff == "ON" then
- if hDetailLevel == "LOW" then
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightGray)
- drawAt(28,1," ")
- term.setBackgroundColor(colors.black)
- drawAt(28,2," |======| "..myName.." ")
- drawAt(28,3," | O ..O| HP:"..hp.."/"..tHP.." ")
- drawAt(28,4," | _ | STA:"..sta.."/"..tSta.." ")
- drawAt(28,5," | | XP:"..xp.."/"..totalXp.." ")
- drawAt(28,6," |------+ LVL:"..lvl.." ")
- drawAt(28,7," MONEY:"..money.."$ ")
- drawAt(28,8," WINS:"..wins.." ")
- drawAt(28,9," LOSSES:"..loss.." ")
- drawAt(28,10," SCORE:"..myScore.." ")
- drawAt(1,11," ")
- drawAt(1,12," ")
- drawAt(1,13," ")
- drawAt(1,14," ")
- drawAt(1,15," ")
- drawAt(1,16," ")
- drawAt(1,17," ")
- drawAt(1,18," ")
- term.setBackgroundColor(colors.lightGray)
- drawAt(1,19," ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- elseif hDetailLevel == "NORMAL" or hDetailLevel == "HIGH" or hDetailLevel == "EXTREME" then
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightGray)
- drawAt(28,1," ")
- term.setBackgroundColor(colors.black)
- drawAt(28,2," '''''' "..myName.." ")
- drawAt(28,3," ' . . HP:"..hp.."/"..tHP.." ")
- drawAt(28,4," d - | STA:"..sta.."/"..tSta.." ")
- drawAt(28,5," | _ | XP:"..xp.."/"..totalXp.." ")
- drawAt(28,6," |______/ LVL:"..lvl.." ")
- drawAt(28,7," MONEY:"..money.."$ ")
- drawAt(28,8," WINS:"..wins.." ")
- drawAt(28,9," LOSSES:"..loss.." ")
- drawAt(28,10," SCORE:"..myScore.." ")
- drawAt(1,11," ")
- drawAt(1,12," ")
- drawAt(1,13," ")
- drawAt(1,14," ")
- drawAt(1,15," ")
- drawAt(1,16," ")
- drawAt(1,17," ")
- drawAt(1,18," ")
- term.setBackgroundColor(colors.lightGray)
- drawAt(1,19," ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- end
- elseif colorsOnOff == "OFF" then
- if hDetailLevel == "LOW" then
- drawAt(28,1," ")
- drawAt(28,2,"|======| "..myName.." ")
- drawAt(28,3,"| O ..O| HP:"..hp.."/"..tHP.." ")
- drawAt(28,4,"| _ | STA:"..sta.."/"..tSta.." ")
- drawAt(28,5,"| | XP:"..xp.."/"..totalXp.." ")
- drawAt(28,6,"|------+ LVL:"..lvl.." ")
- drawAt(28,7," MONEY:"..money.."$ ")
- drawAt(28,8," WINS:"..wins.." ")
- drawAt(28,9," LOSSES:"..loss.." ")
- drawAt(28,10," SCORE:"..myScore.." ")
- elseif hDetailLevel == "NORMAL" or hDetailLevel == "HIGH" or hDetailLevel == "EXTREME" then
- drawAt(28,1," ")
- drawAt(28,2," '''''' "..myName.." ")
- drawAt(28,3,"' . . HP:"..hp.."/"..tHP.." ")
- drawAt(28,4,"d - | STA:"..sta.."/"..tSta.." ")
- drawAt(28,5,"| _ | XP:"..xp.."/"..totalXp.." ")
- drawAt(28,6,"|______/ LVL:"..lvl.." ")
- drawAt(28,7," MONEY:"..money.."$ ")
- drawAt(28,8," WINS:"..wins.." ")
- drawAt(28,9," LOSSES:"..loss.." ")
- drawAt(28,10," SCORE:"..myScore.." ")
- end
- end
- end
- --Draws the Home Menu
- function drawHomeMenu()
- cleanScreen()
- if colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------+")
- drawAt(1,2,"| HOME |======+ "..myName.." ")
- drawAt(1,3,"|-------------------------| O ..O| HP:"..hp.."/"..tHP)
- drawAt(1,4,"| | _ | STA:"..sta.."/"..tSta)
- drawAt(1,5,"| | | XP:"..xp.."/"..totalXp)
- drawAt(1,6,"| |------+ LVL:"..lvl.."/"..mLvl)
- drawAt(1,7,"| | MONEY:"..money.."$ ")
- drawAt(1,8,"| | WINS:"..wins.." ")
- drawAt(1,9,"| | LOSSES:"..loss.." ")
- drawAt(1,10,"| | SCORE:"..myScore.." ")
- drawAt(1,11,"+-------------------------+")
- for i = 1, #hMenuOptions do
- drawAt(4,i + 3,"*")
- drawAt(6,i + 3,hMenuOptions[i])
- drawHomeCharacter()
- end
- drawCursor(3,5,2 + menuStat)
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(ttTextColor)
- drawAt(1,1," ")
- drawAt(1,2," HOME ")
- drawAt(1,3," ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,4," ")
- drawAt(1,5," ")
- drawAt(1,6," ")
- drawAt(1,7," ")
- drawAt(1,8," ")
- drawAt(1,9," ")
- drawAt(1,10," ")
- drawAt(1,11," ")
- for i = 1, #hMenuOptions do
- term.setTextColor(colors.black)
- drawAt(4,i + 3,"*")
- drawAt(6,i + 3,hMenuOptions[i])
- drawHomeCharacter()
- end
- drawCursor(3,5,2 + menuStat)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- ---------------------------------------------------------------------------------------------------
- --Draws Warning Menu
- function drawWarningMenu()
- if colorsOnOff == "OFF" then
- cleanScreen()
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| #####---!WARNING!---##### |")
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,4,"| If you quit to the main menu you will |")
- drawAt(1,5,"| lose all unsaved progress made in the game. |")
- drawAt(1,6,"| ARE YOU SURE YOU WANT TO QUIT? |")
- drawAt(1,7,"| |")
- drawAt(1,8,"| |")
- drawAt(1,9,"| |")
- drawAt(1,10,"+-------------------------------------------------+")
- for i = 1, #warningOptions do
- drawAt(20,i + 6,"*")
- drawAt(22,i + 6,warningOptions[i])
- end
- drawCursor(19,21,2 + menuStat)
- elseif colorsOnOff == "ON" then
- cleanScreen()
- term.setBackgroundColor(ttBackColor)
- term.setBackgroundColor(ttTextColor)
- drawAt(1,1," ")
- drawAt(1,2," #####---!WARNING!---##### ")
- drawAt(1,3," ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(ttTextColor)
- drawAt(1,4," ")
- drawAt(1,5," If you quit to the main menu you will ")
- drawAt(1,6," lose all unsaved progress made in the game. ")
- drawAt(1,7," ARE YOU SURE YOU WANT TO QUIT? ")
- drawAt(1,8," ")
- drawAt(1,9," ")
- drawAt(1,10," ")
- drawAt(1,11," ")
- term.setBackgroundColor(colors.lightGray)
- drawAt(1,12," ")
- term.setBackgroundColor(menuBackColor)
- for i = 1, #warningOptions do
- drawAt(20,i + 7,"*")
- drawAt(22,i + 7,warningOptions[i])
- end
- drawCursor(19,21,3 + menuStat)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- ---------------------------------------------------------------------------------------------------
- function drawBoxerAscii()
- if colorsOnOff == "OFF" then
- drawAt(17,6," /////' ")
- drawAt(17,7," ' o o ")
- drawAt(17,8," C - | ")
- drawAt(17,9," ___ ' =__' ___")
- drawAt(17,10," (' _ \\_ | | _/ ')")
- drawAt(17,11," \\ (__\\ ,---- _ |----. / __)-|")
- drawAt(17,12," \\__ ( ( / ) ) __/")
- drawAt(17,13," |_X_\\/ \\. # _. | \\/_X_|")
- drawAt(17,14," | \\ /( / /\\ / |")
- drawAt(17,15," \\ / ( , / \\ _/")
- drawAt(17,16," / /")
- drawAt(17,17," [:::::::]")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- drawAt(17,5," Boxer Ascii ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- drawAt(17,6," /////' ")
- drawAt(17,7," ' o o ")
- drawAt(17,8," C - | ")
- drawAt(17,9," ___ ' =__' ___ ")
- drawAt(17,10," (' _ \\_ | | _/ ') ")
- drawAt(17,11," \\ (__\\ ,---- _ |----. / __)-| ")
- drawAt(17,12," \\__ ( ( / ) ) __/ ")
- drawAt(17,13," |_X_\\/ \\. # _. | \\/_X_| ")
- drawAt(17,14," | \\ /( / /\\ / | ")
- drawAt(17,15," \\ / ( , / \\ _/ ")
- drawAt(17,16," / / ")
- drawAt(17,17," [:::::::] ")
- term.setBackgroundColor(colors.lightGray)
- drawAt(17,18," 2013 ")
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- end
- end
- function drawChMenu()
- cleanScreen()
- if colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| [Character Menu] |")
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,4,"| |")
- drawAt(1,5,"| |")
- drawAt(1,6,"| |")
- drawAt(1,7,"| |")
- drawAt(1,8,"| |")
- drawAt(1,9,"| |")
- drawAt(1,10,"| |")
- drawAt(1,11,"| |")
- drawAt(1,12,"| |")
- drawAt(1,13,"| |")
- drawAt(1,14,"| |")
- drawAt(1,15,"| |")
- drawAt(1,16,"| |")
- drawAt(1,17,"| |")
- drawAt(1,18,"+-------------------------------------------------+")
- for i = 1, #chMenuOptions do
- drawAt(3,i + 4,"*")
- drawAt(5,i + 4,chMenuOptions[i])
- drawBoxerAscii()
- end
- drawCursor(2,4,3 + menuStat)
- elseif colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- drawAt(1,1," ")
- drawAt(1,2," [Character Menu] ")
- drawAt(1,3," ")
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- drawAt(1,4," ")
- drawAt(1,5," ")
- drawAt(1,6," ")
- drawAt(1,7," ")
- drawAt(1,8," ")
- drawAt(1,9," ")
- drawAt(1,10," ")
- drawAt(1,11," ")
- drawAt(1,12," ")
- drawAt(1,13," ")
- drawAt(1,14," ")
- drawAt(1,15," ")
- drawAt(1,16," ")
- drawAt(1,17," ")
- drawAt(1,18," ")
- drawAt(1,19," ")
- for i = 1, #chMenuOptions do
- drawAt(3,i + 4,"*")
- drawAt(5,i + 4,chMenuOptions[i])
- drawBoxerAscii()
- end
- drawCursor(2,4,3 + menuStat)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- end
- --Credits
- function cEvents()
- event, p1 = os.pullEvent()
- if event == "key" and
- p1 == 28 then
- inCredits = false
- elseif p1 == 200 then
- yCrdPos = yCrdPos + 1
- scrollBar = scrollBar - 1
- if scrollBar < 4 then
- scrollBar = 4
- yCrdPos = 10
- end
- elseif p1 == 208 then
- yCrdPos = yCrdPos - 1
- scrollBar = scrollBar + 1
- if scrollBar > 17 then
- scrollBar = 17
- yCrdPos = yCrdPos + 1
- end
- end
- end
- --Credits
- function credits()
- inCredits = true
- yCrdPos = 10
- scrollBar = 4
- while inCredits do
- cleanScreen()
- drawCredits()
- drawExtra()
- cEvents()
- end
- end
- function drawExtra()
- if colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| --CREDITS-- |")
- drawAt(1,3,"|-------------------------------------------------|")
- drawAt(1,18,"+-------------------------------------------------+")
- drawAt(1,19," --PRESS [ENTER] TO EXIT-- ")
- elseif colorsOnOff == "ON" then
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.cyan)
- drawAt(1,1," ")
- drawAt(1,2," --CREDITS-- ")
- drawAt(1,3," ")
- term.setBackgroundColor(colors.cyan)
- term.setTextColor(colors.black)
- drawAt(1,18," ")
- drawAt(1,19," --PRESS [ENTER] TO EXIT-- ")
- end
- end
- function drawCredits()
- creditsMenuArt = {
- "+-------------------------------------------------+",
- "| --CREDITS-- |",
- "|-------------------------------------------------|",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "| | |",
- "+-------------------------------------------------+",
- " --PRESS [ENTER] TO EXIT-- ",
- }
- creditsMenuArtCol = {
- " ",
- " --CREDITS-- ",
- " ",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- " | |",
- "+-------------------------------------------------+",
- " --PRESS [ENTER] TO EXIT-- ",
- }
- if colorsOnOff == "OFF" then
- for i = 1, #creditsMenuArt do
- drawAt(1,i,creditsMenuArt[i])
- drawAt(50,scrollBar,"=")
- drawAt(16,yCrdPos - 3,"Boxer Tournament 2013(c)")
- drawAt(19,yCrdPos,"Author: Hellkid98")
- drawAt(19,yCrdPos + 3,"+--PROGRAMMERS--+")
- drawAt(21,yCrdPos + 5,"Single Player")
- drawAt(23,yCrdPos + 7,"Hellkid98")
- drawAt(22,yCrdPos + 10,"Multiplayer")
- drawAt(25,yCrdPos + 12,"Herû")
- drawAt(21,yCrdPos + 15,"ccConfig API")
- drawAt(20,yCrdPos + 17,"theoriginalbit")
- end
- elseif colorsOnOff == "ON" then
- for i = 1, #creditsMenuArt do
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- drawAt(1,i,creditsMenuArtCol[i])
- term.setBackgroundColor(colors.gray)
- drawAt(50,scrollBar," ")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- drawAt(16,yCrdPos - 3,"Boxer Tournament 2013(c)")
- term.setTextColor(colors.black)
- drawAt(19,yCrdPos,"Author: Hellkid98")
- drawAt(19,yCrdPos + 3,"+--PROGRAMMERS--+")
- drawAt(21,yCrdPos + 5,"Single Player")
- term.setTextColor(colors.blue)
- drawAt(23,yCrdPos + 7,"Hellkid98")
- term.setTextColor(colors.black)
- drawAt(22,yCrdPos + 10,"Multiplayer")
- term.setTextColor(colors.blue)
- drawAt(25,yCrdPos + 12,"Herû")
- term.setTextColor(colors.black)
- drawAt(21,yCrdPos + 15,"ccConfig API")
- term.setTextColor(colors.purple)
- drawAt(20,yCrdPos + 17,"theoriginalbit")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- end
- end
- end
- function highScore()
- highCheck()
- cleanScreen()
- if colorsOnOff == "ON" then
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- drawAt(1,1," ")
- drawAt(1,2," +--Highscore--+ ")
- drawAt(1,3," ")
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- drawAt(1,4," ")
- drawAt(1,5," 1. ")
- drawAt(1,6," 2. ")
- drawAt(1,7," 3. ")
- drawAt(1,8," 4. ")
- drawAt(1,9," 5. ")
- drawAt(1,10," 6. ")
- drawAt(1,11," 7. ")
- drawAt(1,12," 8. ")
- drawAt(1,13," 9. ")
- drawAt(1,14," 10. ")
- drawAt(1,15," ")
- drawAt(1,16," ")
- term.setBackgroundColor(ttBackColor)
- drawAt(1,17," ")
- drawAt(1,18," PRESS [ENTER] TO EXIT ")
- drawAt(1,19," ")
- term.setBackgroundColor(menuBackColor)
- drawNames()
- drawScores()
- while true do
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 28 then
- return
- end
- end
- end
- elseif colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| +--Highscore--+ |")
- drawAt(1,3,"|-------------------------------------------------|")
- drawAt(1,4,"| |")
- drawAt(1,5,"| 1. |")
- drawAt(1,6,"| 2. |")
- drawAt(1,7,"| 3. |")
- drawAt(1,8,"| 4. |")
- drawAt(1,9,"| 5. |")
- drawAt(1,10,"| 6. |")
- drawAt(1,11,"| 7. |")
- drawAt(1,12,"| 8. |")
- drawAt(1,13,"| 9. |")
- drawAt(1,14,"| 10. |")
- drawAt(1,15,"| |")
- drawAt(1,16,"| |")
- drawAt(1,17,"+-------------------------------------------------+")
- drawAt(1,18," PRESS [ENTER] TO EXIT ")
- drawAt(1,19,"")
- drawNames()
- drawScores()
- while true do
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 28 then
- return
- end
- end
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --HIGHSCORE
- ---------------------------------------------------------------------------------------------------
- function drawNames()
- drawAt(8,5,myNm1)
- drawAt(8,6,myNm2)
- drawAt(8,7,myNm3)
- drawAt(8,8,myNm4)
- drawAt(8,9,myNm5)
- drawAt(8,10,myNm6)
- drawAt(8,11,myNm7)
- drawAt(8,12,myNm8)
- drawAt(8,13,myNm9)
- drawAt(8,14,myNm10)
- end
- function drawScores()
- drawAt(21,5,"Score:"..mySc1)
- drawAt(21,6,"Score:"..mySc2)
- drawAt(21,7,"Score:"..mySc3)
- drawAt(21,8,"Score:"..mySc4)
- drawAt(21,9,"Score:"..mySc5)
- drawAt(21,10,"Score:"..mySc6)
- drawAt(21,11,"Score:"..mySc7)
- drawAt(21,12,"Score:"..mySc8)
- drawAt(21,13,"Score:"..mySc9)
- drawAt(21,14,"Score:"..mySc10)
- end
- ---------------------------------------------------------------------------------------------------
- function highCheck()
- --Here It checks if the users are nil or not
- if myNm1 == nil then
- myNm1 = "No User"
- end
- if myNm2 == nil then
- myNm2 = "No User"
- end
- if myNm3 == nil then
- myNm3 = "No User"
- end
- if myNm4 == nil then
- myNm4 = "No User"
- end
- if myNm5 == nil then
- myNm5 = "No User"
- end
- if myNm6 == nil then
- myNm6 = "No User"
- end
- if myNm7 == nil then
- myNm7 = "No User"
- end
- if myNm8 == nil then
- myNm8 = "No User"
- end
- if myNm9 == nil then
- myNm9 = "No User"
- end
- if myNm10 == nil then
- myNm10 = "No User"
- end
- --Here It checks Score
- if mySc1 == nil then
- mySc1 = 0
- end
- if mySc2 == nil then
- mySc2 = 0
- end
- if mySc3 == nil then
- mySc3 = 0
- end
- if mySc4 == nil then
- mySc4 = 0
- end
- if mySc5 == nil then
- mySc5 = 0
- end
- if mySc6 == nil then
- mySc6 = 0
- end
- if mySc7 == nil then
- mySc7 = 0
- end
- if mySc8 == nil then
- mySc8 = 0
- end
- if mySc9 == nil then
- mySc9 = 0
- end
- if mySc10 == nil then
- mySc10 = 0
- end
- if myScore > mySc10 and
- myScore < mySc9 then
- myNm10 = myName
- mySc10 = myScore
- end
- if myScore > mySc9 and
- myScore < mySc8 then
- myNm9 = myName
- mySc9 = myScore
- end
- if myScore > mySc8 and
- myScore < mySc7 then
- myNm8 = myName
- mySc8 = myScore
- end
- if myScore > mySc7 and
- myScore < mySc6 then
- myNm7 = myName
- mySc7 = myScore
- end
- if myScore > mySc6 and
- myScore < mySc5 then
- myNm6 = myName
- mySc6 = myScore
- end
- if myScore > mySc5 and
- myScore < mySc4 then
- myNm5 = myName
- mySc5 = myScore
- end
- if myScore > mySc4 and
- myScore < mySc3 then
- myNm4 = myName
- mySc4 = myScore
- end
- if myScore > mySc3 and
- myScore < mySc2 then
- myNm3 = myName
- mySc3 = myScore
- end
- if myScore > mySc2 and
- myScore < mySc1 then
- myNm2 = myName
- mySc2 = myScore
- end
- if myScore > mySc2 then
- myNm1 = myName
- mySc1 = myScore
- end
- end
- function enemyAction()
- if enemyHP < 25 and
- enemyPotions > 1 then
- print(enemy.." Heals him/herself")
- enemyHP = enemyHP + 25
- enemyPotions = enemyPotions - 1
- sleep(2)
- end
- if act == Punch then
- enemyAct = math.random(1,4)
- end
- if act == Uppercut then
- enemyAct = math.random(1,5)
- end
- end
- ---------------------------------------------------------------------------------------------------
- --TOURNAMENT
- ---------------------------------------------------------------------------------------------------
- function startTournament()
- load(8)
- cleanScreen()
- print("Nothing Available YET")
- sleep(1)
- return
- end
- ---------------------------------------------------------------------------------------------------
- --QUICK MATCH
- ---------------------------------------------------------------------------------------------------
- function startFight()
- enemyPotions = math.random(0,3)
- matchPlaying = true
- checkAvail()
- checkXp()
- if matchPlaying == false
- then
- solo()
- end
- load(6)
- var = 0
- checkDifficulty()
- randomChallenger()
- drawGrids()
- drawMatchArt()
- while true do
- checkStatus()
- checkMatch()
- if matchPlaying == false
- then
- checkXp()
- solo()
- end
- if cheatGodMode == true then
- hp = tHP
- sta = tSta
- end
- cleanScreen()
- checkHP()
- checkSta()
- drawGrids()
- drawMatchArt()
- myAction()
- end
- end
- function myAction()
- myAct = string.lower(read())
- if myAct == "Punch" or myAct == "punch"
- then
- act = Punch
- enemyAction()
- if enemyAct == 1 or enemyAct == 2 then
- drawGrids()
- drawMatchArt()
- print("")
- print(myName.." did "..d.." damage")
- sleep(0.5)
- print(enemy.." did "..eAtk.." damage")
- sta = sta - 1
- enemyHP = enemyHP - d
- hp = hp - eAtk
- enemySta = enemySta - 1
- sleep(1)
- cleanScreen()
- elseif enemyAct == 3 then
- drawGrids()
- drawMatchArt()
- print("")
- print(myName.." did "..d.." damage")
- sta = sta - 1
- enemyHP = enemyHP - d
- sleep(1)
- cleanScreen()
- elseif enemyAct == 4 then
- drawGrids()
- drawMatchArt()
- print("")
- print(myName.." tries to punch "..enemy)
- print("But "..enemy.." blocks the attack")
- sta = sta - 1
- sleep(3)
- cleanScreen()
- end
- ------------------------
- ------------------------
- elseif myAct == "Punch Myself" or myAct == "punch myself"
- then
- drawGrids()
- drawMatchArt()
- print("")
- print(myName.." punches himself/herself in the head.")
- print(enemy.." just stands and stares.")
- hp = hp - d
- sleep(3)
- cleanScreen()
- ------------------------
- ------------------------
- elseif myAct == "Leave" or myAct == "leave" then
- print("Goodbye")
- sleep(1)
- matchPlaying = false
- ------------------------
- ------------------------
- elseif myAct == "Kill" or myAct == "kill" then
- if cheatInstaKill == true then
- enemyHP = enemyHP - enemyHP
- print("Enemy will now die")
- sleep(1)
- cleanScreen()
- end
- ------------------------
- elseif myAct == "Uppercut" or myAct == "uppercut" then
- if lvl >= 5 then
- act = Uppercut
- enemyAction()
- if enemyAct == 1 or enemyAct == 2 then
- enemyHP = enemyHP - d
- print(myName.." Did an Uppercut On "..enemy)
- print("And Dealt "..d.." Damage")
- sleep(2)
- cleanScreen()
- elseif enemyAct == 3 then
- print(enemy.." Dodged "..myName.."'s attack")
- sleep(2)
- sta = sta - 2
- elseif enemyAct == 4 then
- print(enemy.." Dodged "..myName.."'s attack")
- print("And Punched "..myName)
- sleep(2)
- sta = sta - 3
- hp = hp - eAtk
- elseif enemyAct == 5 then
- print(enemy.." Blocked "..myName.."'s attack")
- sleep(2)
- sta = sta - 1
- end
- end
- ------------------------
- elseif myAct == "Kick" or myAct == "kick" then
- print("Soon My Friend")
- sleep(2)
- ------------------------
- elseif myAct == "Dodge" or myAct == "dodge" then
- dodge = math.random(1,3)
- if dodge == 1 or dodge == 2 then
- print(myName.." Dodged "..enemy.."'s attack successfully")
- enemySta = enemySta - 3
- sleep(2)
- elseif dodge == 3 then
- print(myName.." did'nt succeed to dodge")
- print(enemy.." dealt "..eAtk.." damage")
- hp = hp - eAtk
- sleep(2)
- end
- ------------------------
- elseif myAct == "Block" or myAct == "block" then
- block = math.random(1,2)
- if block == 1
- then
- print(enemy.." Blocked Successfully")
- enemySta = enemySta - bSta
- sleep(2)
- cleanScreen()
- elseif block == 2 then
- print(enemy.." Blocked Unsuccessfully")
- sleep(2)
- hp = hp - eAtk
- sleep(2)
- cleanScreen()
- end
- else
- term.setCursorPos(10,9)
- print("Unknown Action")
- sleep(0.2)
- cleanScreen()
- end
- end
- ------------------------
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------
- --CHEATS
- --QuickLeveling = You Earn 10000xp when winning a match
- --InstaKill = Enemies Die/lose directly so you win
- --GodMode = You Have Unlimited Health/Sta
- --NoClip = You Can Walk Through Houses And Stuff
- --SuperFreak = You Deal Insane Damage
- --UnlimitedMoney = You Have Unlimited Money
- ---------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- --Checks If someone Has Won
- function checkMatch()
- checkXp()
- if enemyLvl > lvl then
- mReward = 300
- xpReward = 250
- end
- if enemyLvl == lvl then
- mReward = 150
- xpReward = 150
- end
- if enemyLvl < lvl then
- mReward = 150
- xpReward = 100
- end
- if cheatQuickLeveling == true then
- xpReward = 10000
- end
- myName = myName
- enemy = enemy
- d = damage1
- damage1 = math.random(5,10)
- eAtk = enemyDMG1
- enemyDMG1 = math.random(2,8)
- if hp == 0 or sta == 0 then
- checkXp()
- cleanScreen()
- drawAt(11,9,enemy.." Won")
- drawAt(11,10,"Score For This Match: 100")
- myScore = myScore + 100
- loss = loss + 1
- checkXp()
- sleep(2)
- checkXp()
- matchPlaying = false
- end
- if enemyHP == 0 or enemySta == 0
- then
- checkXp()
- cleanScreen()
- myScore = myScore + 450
- xp = xp + xpReward
- money = money + mReward
- drawAt(11,9,myName.." Won")
- drawAt(11,10,xpReward.." Xp Earned")
- drawAt(11,11,mReward.." $ Earned")
- drawAt(11,12,"Score For This Match: 450")
- wins = wins + 1
- checkXp()
- sleep(2)
- checkXp()
- matchPlaying = false
- end
- if hp == 0 or sta == 0 and
- enemyHP == 0 or enemySta == 0 then
- drawAt(11,9,"It's A Tie")
- return
- end
- end
- ---------------------------------------------------------------------------------------------------
- --Checks If you Can start the match
- function checkAvail()
- if hp == 0 then
- cleanScreen()
- term.setCursorPos(6,6)
- print("Need to rest first!")
- sleep(2)
- matchPlaying = false
- end
- if sta == 0 then
- cleanScreen()
- term.setCursorPos(6,6)
- print("Need to rest first!")
- sleep(2)
- matchPlaying = false
- end
- end
- --Checks Status of HP/STA
- function checkStatus()
- checkXp()
- if hp < 1 then hp = 0
- end
- if enemyHP < 1 then enemyHP = 0
- end
- if sta < 1 then sta = 0
- end
- if enemySta < 1 then enemySta = 0
- end
- end
- ---------------------------------------------------------------------------------------------------
- function checkXp()
- if lvl == 9 and
- xp >= totalXp then
- cleanScreen()
- drawAt(halfW,halfH - 1,"New Ability Unlocked!")
- drawAt(halfW,halfH," ---UPPERCUT---")
- sleep(3)
- end
- if xp >= totalXp and
- lvl == 90 then
- xp = 0
- end
- uD = 0
- damage1 = math.random(5,10 + lvlD + uD)
- damage2 = math.random(5,20 + lvlD + uD)
- damage3 = math.random(5,30 + lvlD + uD)
- damage4 = math.random(5,40 + lvlD + uD)
- damage5 = math.random(5,50 + lvlD + uD)
- local enemyDMG1 = math.random(2,8 + eLvlD)
- local enemyDMG2 = math.random(10,15 + eLvlD)
- local enemyDMG3 = math.random(20,30 + eLvlD)
- local enemyDMG4 = math.random(30,45 + eLvlD)
- local enemyDMG5 = math.random(50,60 + eLvlD)
- while true do
- if lvl >= 90 then
- lvl = 90
- enemyLvl = 90
- end
- xpLeft = xp - totalXp
- --Checks if you level Up
- if xp >= totalXp then
- lvlUp = true
- xp = 0 + xpLeft
- lvl = lvl + 1
- lvlD = lvlD + 1
- totalXp = totalXp + 50
- tHP = tHP + 10
- tSta = tSta + 1
- end
- if xp < totalXp then
- lvlUp = false
- end
- if not lvlUp then
- if lvl >= 90 then
- lvl = 90
- enemyLvl = 90
- end
- break
- end
- if lvl > mLvl
- then lvl = mLvl
- end
- if lvl == mLvl
- then if xp > totalXp then
- xp = totalXp
- end
- --Checks Level Properties
- if lvl >= 10 then
- d = damage2
- elseif lvl >= 20 then
- d = damage3
- elseif lvl >= 30 then
- d = damage4
- elseif lvl >= 40 then
- d = damage5
- end
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --Checks if Hp are a larger value than the total Health
- function checkHP()
- if hp > tHP then
- hp = tHP
- end
- end
- --Checks if Stamina have a larger value than the total Stamina
- function checkSta()
- if sta > tSta then
- sta = tSta
- end
- end
- ---------------------------------------------------------------------------------------------------
- --Relax
- function relax()
- t = 0
- while true do
- checkHP()
- checkSta()
- cleanScreen()
- drawReAnim1()
- sleep(0.3)
- cleanScreen()
- drawReAnim2()
- sleep(0.3)
- cleanScreen()
- drawReAnim3()
- sleep(0.3)
- cleanScreen()
- t = t + 1
- if t == 5 then
- sta = sta + regainSTA
- hp = hp + regainHP
- day = day + 1
- drawFinishedAnim()
- drawAt(20,2,day.." ")
- sleep(3)
- checkHP()
- checkSta()
- solo()
- end
- end
- end
- --Relax Anims
- local rAnim1 =
- {
- " ",
- " ",
- " ",
- " ",
- " ",
- " Z ",
- " ____________________ ",
- " / \\ ",
- " / \\ ",
- " /________________________\\ ",
- " | | ",
- " | | ",
- " | _______ | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " -------------------------- "
- }
- local rAnim2 =
- {
- " ",
- " ",
- " ",
- " ",
- " Z ",
- " Z ",
- " ____________________ ",
- " / \\ ",
- " / \\ ",
- " /________________________\\ ",
- " | | ",
- " | | ",
- " | _______ | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " -------------------------- "
- }
- local rAnim3 =
- {
- " ",
- " ",
- " ",
- " Z ",
- " Z ",
- " ",
- " ____________________ ",
- " / \\ ",
- " / \\ ",
- " /________________________\\ ",
- " | | ",
- " | | ",
- " | _______ | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " -------------------------- "
- }
- local finishedAnim =
- {
- " PLAYED ",
- " ",
- " DAYS ",
- " ",
- " ",
- " ",
- " ____________________ ",
- " / \\ ",
- " / \\ ",
- " /________________________\\ ",
- " | | ",
- " | | ",
- " | _______ | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " | |:::::::| | ",
- " -------------------------- "
- }
- --1
- function drawReAnim1()
- for i = 1, #rAnim1 do
- drawAt(1,i,rAnim1[i])
- end
- end
- --2
- function drawReAnim2()
- for i = 1, #rAnim2 do
- drawAt(1,i,rAnim2[i])
- end
- end
- --3
- function drawReAnim3()
- for i = 1, #rAnim3 do
- drawAt(1,i,rAnim3[i])
- end
- end
- --END
- function drawFinishedAnim()
- for i = 1, #finishedAnim do
- drawAt(1,i,finishedAnim[i])
- end
- end
- ---------------------------------------------------------------------------------------------------
- --DIFFICULTY
- ---------------------------------------------------------------------------------------------------
- --Checks What Difficulty It is
- difficulty = "None Difficulty"
- function checkLevels()
- local enemyDMG1 = math.random(2,8 + eLvlD)
- local enemyDMG2 = math.random(10,15 + eLvlD)
- local enemyDMG3 = math.random(20,30 + eLvlD)
- local enemyDMG4 = math.random(30,45 + eLvlD)
- local enemyDMG5 = math.random(50,60 + eLvlD)
- if enemyHP < 100 then
- enemyHP = 100
- end
- if eLvlD <= 0 then
- eLvlD = 0
- end
- if enemyLvl < 1 then
- enemyLvl = 1
- enemyHP = 100
- enemySta = 50
- end
- if enemyLvl >= 10 and
- enemyLvl < 20 then
- eAtk = enemyDMG2
- end
- if enemyLvl >= 20 and
- enemyLvl < 30 then
- eAtk = enemyDMG3
- end
- if enemyLvl >= 30 and
- enemyLvl < 40 then
- eAtk = enemyDMG4
- end
- if enemyLvl >= 40 then
- eAtk = enemyDMG5
- end
- end
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- function checkDifficulty()
- if difficulty == "Easy" then
- ranLvl = 0
- ranLvl = math.random(1,5)
- if ranLvl == 1 then
- enemyLvl = lvl - 1
- enemyHP = tHP - 10
- eLvlD = lvlD - 1
- checkLevels()
- elseif ranLvl == 2 then
- enemyLvl = lvl - 2
- enemyHP = tHP - 20
- eLvlD = lvlD - 2
- checkLevels()
- elseif ranLvl == 3 then
- enemyLvl = lvl - 3
- enemyHP = tHP - 30
- eLvlD = lvlD - 3
- checkLevels()
- elseif ranLvl == 4 then
- enemyLvl = lvl - 4
- enemyHP = tHP - 40
- eLvlD = lvlD - 4
- checkLevels()
- elseif ranLvl == 5 then
- enemyLvl = lvl - 5
- enemyHP = tHP - 50
- eLvlD = lvlD - 1
- checkLevels()
- end
- end
- if difficulty == "Normal" then
- enemyLvl = lvl
- enemyHP = tHP
- eLvlD = lvlD - 1
- checkLevels()
- end
- if difficulty == "Hard" then
- ranLvl = 0
- ranLvl = math.random(1,5)
- if ranLvl == 1 then
- enemyLvl = lvl + 2
- enemyHP = tHP + 20
- eLvlD = lvlD + 2
- elseif ranLvl == 2 then
- enemyLvl = lvl + 3
- enemyHP = tHP + 30
- eLvlD = lvlD + 3
- elseif ranLvl == 3 then
- enemyLvl = lvl + 4
- enemyHP = tHP + 40
- eLvlD = lvlD + 4
- elseif ranLvl == 4 then
- enemyLvl = lvl + 5
- enemyHP = tHP + 50
- eLvlD = lvlD + 5
- elseif ranLvl == 5 then
- enemyLvl = lvl + 6
- enemyHP = tHP + 60
- eLvlD = lvlD + 6
- end
- end
- if difficulty == "Extreme" then
- ranLvl = 0
- ranLvl = math.random(1,5)
- if ranLvl == 1 then
- enemyLvl = lvl + 3
- enemyHP = tHP + 30
- eLvlD = lvlD + 3
- elseif ranLvl == 2 then
- enemyLvl = lvl + 4
- enemyHP = tHP + 40
- eLvlD = lvlD + 4
- elseif ranLvl == 3 then
- enemyLvl = lvl + 5
- enemyHP = tHP + 50
- eLvlD = lvlD + 5
- elseif ranLvl == 4 then
- enemyLvl = lvl + 6
- enemyHP = tHP + 60
- eLvlD = lvlD + 6
- elseif ranLvl == 5 then
- enemyLvl = lvl + 8
- enemyHP = tHP + 80
- eLvlD = lvlD + 8
- end
- end
- checkLevels()
- end
- ---------------------------------------------------------------------------------------------------
- --MENU EVENTS
- ---------------------------------------------------------------------------------------------------
- --Difficulty Menu Events
- function dMenuEvents()
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 200 then
- menuStat = menuStat - 1
- if menuStat < 2 then
- menuStat = 5
- end
- elseif p1 == 208 then
- menuStat = menuStat + 1
- if menuStat > 5 then
- menuStat = 2
- end
- elseif p1 == 14 then
- return characterMenu()
- elseif p1 == 28
- then if menuStat == 2
- then
- difficulty = "Easy"
- checkDifficulty()
- enterName()
- elseif menuStat == 3 then
- difficulty = "Normal"
- checkDifficulty()
- enterName()
- elseif menuStat == 4 then
- difficulty = "Hard"
- checkDifficulty()
- enterName()
- elseif menuStat == 5 then
- difficulty = "Extreme"
- checkDifficulty()
- enterName()
- end
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --Character Menu Events
- function chMenuEvents()
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 200
- then
- menuStat = menuStat - 1
- if menuStat < 2 then
- menuStat = 5
- end
- elseif p1 == 208 then
- menuStat = menuStat + 1
- if menuStat > 5 then
- menuStat = 2
- end
- elseif p1 == 28 then
- if menuStat == 2 then
- difMenu()
- enterName()
- solo()
- elseif menuStat == 3 then
- inMenu = true
- lMode = true
- dMode = false
- sMode = false
- mode = "LOAD"
- loadMenu()
- elseif menuStat == 4 then
- inMenu = true
- dMode = true
- sMode = false
- lMode = false
- mode = "DELETE"
- loadMenu()
- elseif menuStat == 5 then
- return
- menu()
- end
- end
- end
- end
- --Warning Menu events
- function wMenuEvents()
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 200
- then
- menuStat = menuStat - 1
- if menuStat < 5 then
- menuStat = 6
- end
- elseif p1 == 208 then
- menuStat = menuStat + 1
- if menuStat > 6 then
- menuStat = 5
- end
- elseif p1 == 14 then
- solo()
- elseif p1 == 28 then
- if menuStat == 5 then
- resetStats()
- menu()
- elseif menuStat == 6 then
- solo()
- end
- end
- end
- end
- --Main Menu Events
- function menuEvents()
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 200
- then
- menuStat = menuStat - 1
- if menuStat < 2 then
- menuStat = 8
- end
- elseif p1 == 208 then
- menuStat = menuStat + 1
- if menuStat > 8 then
- menuStat = 2
- end
- elseif p1 == 28 then
- if menuStat == 2 then
- characterMenu()
- elseif menuStat == 3 then
- cleanScreen()
- print("Not Available YET")
- sleep(1)
- return
- elseif menuStat == 4 then
- settingsMenu()
- elseif menuStat == 5 then
- highScore()
- elseif menuStat == 6 then
- helpMenu()
- elseif menuStat == 7 then
- credits()
- elseif menuStat == 8 then
- myName = nil
- cleanScreen()
- print("Thanks For Playing!")
- error()
- end
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --HomeMenu Events
- function hMenuEvents()
- event, p1 = os.pullEvent()
- if event == "key" then
- if p1 == 200
- then
- menuStat = menuStat - 1
- if menuStat < 2 then
- menuStat = 8
- end
- elseif p1 == 208 then
- menuStat = menuStat + 1
- if menuStat > 8 then
- menuStat = 2
- end
- elseif p1 == 28 then
- if menuStat == 2 then
- startFight()
- elseif menuStat == 3 then
- startTournament()
- elseif menuStat == 4 then
- cleanScreen()
- print("Nothing Here YET!")
- sleep(1)
- return
- elseif menuStat == 5 then
- map(23,6)
- elseif menuStat == 6 then
- relax()
- elseif menuStat == 7 then
- inMenu = true
- sMode = true
- dMode = false
- lMode = false
- mode = "SAVE"
- loadMenu()
- elseif menuStat == 8 then
- warningMenu()
- end
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --Loading Section
- function load(s)
- tipses()
- local t = 0
- repeat
- drawLoadingStuff()
- cleanScreen()
- drawLoadingStuff()
- drawLoad1()
- sleep(0.2)
- cleanScreen()
- drawLoadingStuff()
- drawLoad2()
- sleep(0.2)
- cleanScreen()
- drawLoadingStuff()
- drawLoad3()
- sleep(0.2)
- t = t + 1
- until t == s
- end
- --Draws The loading Stuff
- function drawLoadingStuff()
- drawAt(21,11,"Loading")
- drawAt(5,13,"TIPS:")
- term.setCursorPos(11,13)
- print(tips)
- end
- --Draws The Load anim 1
- function drawLoad1()
- drawAt(18,8," ___________")
- drawAt(18,9,"|// // // //|")
- drawAt(18,10," -----------")
- end
- --Draw The Load Anim 2
- function drawLoad2()
- drawAt(18,8," ___________")
- drawAt(18,9,"| // // // /|")
- drawAt(18,10," -----------")
- end
- --Draw The Load Anim 3
- function drawLoad3()
- drawAt(18,8," ___________")
- drawAt(18,9,"|/ // // // |")
- drawAt(18,10," -----------")
- end
- --Tips For Gameplay
- function tipses()
- t_tips = {
- "Running Out Of Stamina Is Not Good!", "Punching Enemies is a Good way to win.",
- "You can Always Leave a \n Match When You Want.", "Energy Drinks Regerenates Your Stamina.",
- "Blocking can Tire out the Enemy!", "Save Your Game Often!",
- "If the Game Gets to Hard \n You can Cheat.", "Trolling in the Game is Allowed!",
- "You can Improve your character \n By buying new Equipment", "This is a Useless Tips",
- "When you Level up You \n Should Improve Your Skills!", "Playing Multiplayer is More fun.",
- "Horses does not exist.", "Be careful so you don't \n End up in the hospital!",
- "Play Quick Match to earn Quick Xp", "Change the Settings to Your Likings",
- "Train to Earn Xp Quickly", "If you think the game is too easy \n Then play on a higher difficulity!",
- "Check Out The Credits!", "Always Have Some Health Stuff on You!",
- }
- tips = t_tips[math.random(1, #t_tips)]
- print(tips)
- cleanScreen()
- end
- ---------------------------------------------------------------------------------------------------
- function hExitEvents()
- local e, but, x, y = os.pullEvent()
- if e == "mouse_click" and
- x >= 35 and
- x <= 45 and
- y >= 7 and
- y <= 9 then
- return characterMenu()
- elseif e == "key" and
- but == 14 then
- return characterMenu()
- end
- end
- --Enter Your Name
- function enterName()
- if colorsOnOff == "OFF" then
- repeat
- drawNameMenu()
- drawAt(14,halfH + 1,"|ENTER NAME: ")
- myName = modRead({textLength = 11})
- drawAt(14,halfH + 4,"PRESS ANY BUTTON TO CONFIRM")
- drawAt(15,halfH + 5,"PRESS BACKSPACE TO RETURN")
- local e, but, x, y = os.pullEvent()
- if e == "key" and
- but == 14 then
- return characterMenu()
- end
- local valid, err = CheckUserName()
- if not valid then
- print("")
- print("")
- print(err)
- sleep(2)
- end
- until valid
- solo()
- elseif colorsOnOff == "ON" then
- repeat
- drawNameMenu()
- drawAt(27,halfH + 1," ")
- drawAt(14,halfH + 1," ENTER NAME: ")
- myName = modRead({textLength = 11})
- drawAt(14,halfH + 4,"PRESS ANY BUTTON TO CONFIRM")
- drawAt(15,halfH + 5,"PRESS BACKSPACE TO RETURN")
- hExitEvents()
- local valid, err = CheckUserName()
- if not valid then
- print("")
- print("")
- print(err)
- sleep(2)
- end
- until valid
- solo()
- end
- end
- --Draws the Name menu
- function drawNameMenu()
- cleanScreen()
- if colorsOnOff == "OFF" then
- drawAt(14,halfH,"+-------------------------+")
- drawAt(40,halfH + 1,"|")
- drawAt(14,halfH + 2,"+-------------------------+")
- elseif colorsOnOff == "ON" then
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- cleanScreen()
- term.setTextColor(ttTextColor)
- term.setBackgroundColor(ttBackColor)
- drawAt(14,halfH," ")
- drawAt(14,halfH + 1," ")
- drawAt(14,halfH + 2," ")
- term.setBackgroundColor(colors.lightGray)
- drawAt(14,halfH + 3," ")
- drawAt(14,halfH - 1," ")
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- drawAt(38,halfH - 1," X ")
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- end
- end
- ---------------------------------------------------------------------------------------------------
- --HELP
- ---------------------------------------------------------------------------------------------------
- function drawExtraHelp()
- if colorsOnOff == "OFF" then
- drawAt(1,1,"+-------------------------------------------------+")
- drawAt(1,2,"| +---HELP---+ |")
- drawAt(1,3,"+-------------------------------------------------+")
- drawAt(1,18,"+-------------------------------------------------+")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(ttBackColor)
- term.setTextColor(ttTextColor)
- drawAt(1,1," ")
- drawAt(1,2," +---HELP---+ ")
- drawAt(1,3," ")
- drawAt(1,18," ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- function drawHelpMenu()
- helpMenuArt = {
- "+-------------------------------------------------+",
- "| +---HELP---+ |",
- "+-------------------------------------------------+",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "| |",
- "+-------------------------------------------------+",
- }
- helpMenuArtCol = {
- " ",
- " +---HELP---+ ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- }
- for i = 1, #helpMenuArt do
- if colorsOnOff == "OFF" then
- drawAt(1,i,helpMenuArt[i])
- drawExtraHelp()
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- drawAt(1,i,helpMenuArtCol[i])
- drawExtraHelp()
- end
- end
- if colorsOnOff == "OFF" then
- term.setCursorPos(17,halfH - 3)
- if exit == false then
- if helpMenuStat == 1 then
- print("--How To Play--")
- term.setCursorPos(20,halfH - 2)
- print("Controls")
- term.setCursorPos(21,halfH - 1)
- print("Commands")
- term.setCursorPos(22,halfH)
- print("Abilities")
- elseif helpMenuStat == 2 then
- term.setCursorPos(17,halfH - 3)
- print("--Controls--")
- term.setCursorPos(20,halfH - 2)
- print("Commands")
- term.setCursorPos(21,halfH - 1)
- print("Abilities")
- term.setCursorPos(22,halfH)
- print("How To Play")
- elseif helpMenuStat == 3 then
- term.setCursorPos(17,halfH - 3)
- print("--Commands--")
- term.setCursorPos(20,halfH - 2)
- print("Abilities")
- term.setCursorPos(21,halfH - 1)
- print("How To Play")
- term.setCursorPos(22,halfH)
- print("Controls")
- elseif helpMenuStat == 4 then
- term.setCursorPos(17,halfH - 3)
- print("--Abilities--")
- term.setCursorPos(20,halfH - 2)
- print("How To Play")
- term.setCursorPos(21,halfH - 1)
- print("Controls")
- term.setCursorPos(22,halfH)
- print("Commands")
- end
- end
- elseif colorsOnOff == "ON" then
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- term.setCursorPos(17,halfH - 3)
- if exit == false then
- if helpMenuStat == 1 then
- term.setTextColor(ttTextColor)
- print("--How To Play--")
- term.setTextColor(menuTextColor)
- term.setCursorPos(20,halfH - 2)
- print("Controls")
- term.setCursorPos(21,halfH - 1)
- print("Commands")
- term.setCursorPos(22,halfH)
- print("Abilities")
- elseif helpMenuStat == 2 then
- term.setTextColor(ttTextColor)
- term.setCursorPos(17,halfH - 3)
- print("--Controls--")
- term.setTextColor(menuTextColor)
- term.setCursorPos(20,halfH - 2)
- print("Commands")
- term.setCursorPos(21,halfH - 1)
- print("Abilities")
- term.setCursorPos(22,halfH)
- print("How To Play")
- elseif helpMenuStat == 3 then
- term.setTextColor(ttTextColor)
- term.setCursorPos(17,halfH - 3)
- print("--Commands--")
- term.setTextColor(menuTextColor)
- term.setCursorPos(20,halfH - 2)
- print("Abilities")
- term.setCursorPos(21,halfH - 1)
- print("How To Play")
- term.setCursorPos(22,halfH)
- print("Controls")
- elseif helpMenuStat == 4 then
- term.setTextColor(ttTextColor)
- term.setCursorPos(17,halfH - 3)
- print("--Abilities--")
- term.setTextColor(menuTextColor)
- term.setCursorPos(20,halfH - 2)
- print("How To Play")
- term.setCursorPos(21,halfH - 1)
- print("Controls")
- term.setCursorPos(22,halfH)
- print("Commands")
- end
- end
- end
- end
- function helpEvents()
- event, p1 = os.pullEvent()
- if event == "key" and
- p1 == 200 then --UP
- helpMenuStat = helpMenuStat - 1
- if helpMenuStat < 1 then
- helpMenuStat = 4
- end
- elseif p1 == 208 then -- DOWN
- helpMenuStat = helpMenuStat + 1
- if helpMenuStat > 4 then
- helpMenuStat = 1
- end
- elseif p1 == 28 then --ENTER
- if helpMenuStat == 1 then
- exit = true
- hHowToPlay()
- elseif helpMenuStat == 2 then
- exit = true
- hHelpControls()
- elseif helpMenuStat == 3 then
- exit = true
- hHelpCommands()
- elseif helpMenuStat == 4 then
- exit = true
- hHelpAbilities()
- end
- elseif p1 == 14 then
- exit = true
- end
- end
- function pageEvents()
- event, p1 = os.pullEvent()
- if event == "char" and
- p1 == "b" then
- page = page - 1
- if page < minPage then
- page = minPage
- end
- elseif p1 == "n" then
- page = page + 1
- if page > maxPage then
- page = maxPage
- end
- elseif p1 == 14 then
- inHelpTopic = false
- exit = false
- end
- end
- function drawButtons()
- if colorsOnOff == "OFF" then
- drawAt(2,19,"[Backspace]Exit [n]Next [b]Back ["..page.."]/["..maxPage.."]")
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- drawAt(1,19," [Backspace]Exit [n]Next [b]Back ["..page.."]/["..maxPage.."] ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- end
- ---------------------------------------------------------------------------------------------------
- function drawHowToPlay()
- htp1 = {
- " HOW TO PLAY |",
- " -:INTRODUCTION:- |",
- " Well I don't know how much i can explain about |",
- " -this that you could'nt figure out for yourself|",
- " -or already knowed. It's pretty much an RPG and|",
- " -you play it by writing commands or simply |",
- " -punch if it is the GUI version that is |",
- " -easier to play since the controls can be |",
- " -watched ingame and also here in the help |"
- }
- htp1Col = {
- " HOW TO PLAY ",
- " -:INTRODUCTION:- ",
- " Well I don't know how much i can explain about ",
- " -this that you could'nt figure out for yourself ",
- " -or already knowed. It's pretty much an RPG and ",
- " -you play it by writing commands or simply ",
- " -punch if it is the GUI version that is ",
- " -easier to play since the controls can be ",
- " -watched ingame and also here in the help "
- }
- htp2 = {
- " HOW TO PLAY |",
- " |",
- " The Controls if ofcourse were it says |",
- " 'Controls' in the help section, Where Else? |",
- " |",
- " |"
- }
- htp2Col = {
- " HOW TO PLAY ",
- " ",
- " The Controls if ofcourse were it says ",
- " 'Controls' in the help section, Where Else? ",
- " ",
- " "
- }
- htp3 = {
- " HOW TO PLAY |",
- " -:SINGLE PLAYER:- |",
- " Well here you'll unlock new abilities at some |",
- " -certain levels like uppercut is unlocked at |",
- " -level 10 and you'll also get a new ability |",
- " -point every level so you can increase damage |",
- " -and other stuff off the ability. |",
- " You Should start by playing some quick matches |",
- " -before you join any tournament since they are |",
- " -much more difficult than quick match. |",
- " And when you get enough money you can join |",
- " -the gym and earn experience and improve your |",
- " -damage and skill and more ofcourse. |"
- }
- htp3Col = {
- " HOW TO PLAY ",
- " -:SINGLE PLAYER:- ",
- " Well here you'll unlock new abilities at some ",
- " -certain levels like uppercut is unlocked at ",
- " -level 10 and you'll also get a new ability ",
- " -point every level so you can increase damage ",
- " -and other stuff off the ability. ",
- " You Should start by playing some quick matches ",
- " -before you join any tournament since they are ",
- " -much more difficult than quick match. ",
- " And when you get enough money you can join ",
- " -the gym and earn experience and improve your ",
- " -damage and skill and more ofcourse. "
- }
- htp4 = {
- " HOW TO PLAY |",
- " |",
- " So now you know that you can improve your |",
- " -character at the gym, But remember to have |",
- " -enough money to buy Membership. |",
- " So now when you know all that you should learn |",
- " -that you can go to the mall and enter either |",
- " -the equipment shop or the foodcourt to buy |",
- " -items like:Energy Drink, Hamburgers and |",
- " -boxing gloves, helmet and shoes + more |",
- }
- htp4Col = {
- " HOW TO PLAY ",
- " ",
- " So now you know that you can improve your ",
- " -character at the gym, But remember to have ",
- " -enough money to buy Membership. ",
- " So now when you know all that you should learn ",
- " -that you can go to the mall and enter either ",
- " -the equipment shop or the foodcourt to buy ",
- " -items like:Energy Drink, Hamburgers and ",
- " -boxing gloves, helmet and shoes + more ",
- }
- htp5 = {
- " HOW TO PLAY |",
- " |",
- " Why don't you go out on an adventure and earn |",
- " -some money from chests and you can find more |",
- " -like for example new special equipment that |",
- " -does special attacks and more damage |",
- " Adventure is GUI and not command based since |",
- " -it's special and adds variation to the game |",
- }
- htp5Col = {
- " HOW TO PLAY ",
- " ",
- " Why don't you go out on an adventure and earn ",
- " -some money from chests and you can find more ",
- " -like for example new special equipment that ",
- " -does special attacks and more damage ",
- " Adventure is GUI and not command based since ",
- " -it's special and adds variation to the game ",
- }
- htp6 = {
- " HOW TO PLAY |",
- " -:MULTIPLAYER:- |",
- " Multiplayer Quick Match is like a regular |",
- " -quick match but you play against another |",
- " -player that isn't an AI |",
- " Multiplayer Tournament is much more awesome |",
- " -since you can win much more money and xp |",
- " -there is also 'first win of the day' rewards |",
- " -and the tournaments is mostly players that |",
- " -is in a high level since you atleast have to |",
- " -be over level 25 to play MP tournament |",
- " You can also start a custom match and select |",
- " -who to invite and what options it should be |",
- }
- htp6Col = {
- " HOW TO PLAY ",
- " -:MULTIPLAYER:- ",
- " Multiplayer Quick Match is like a regular ",
- " -quick match but you play against another ",
- " -player that isn't an AI ",
- " Multiplayer Tournament is much more awesome ",
- " -since you can win much more money and xp ",
- " -there is also 'first win of the day' rewards ",
- " -and the tournaments is mostly players that ",
- " -is in a high level since you atleast have to ",
- " -be over level 25 to play MP tournament ",
- " You can also start a custom match and select ",
- " -who to invite and what options it should be ",
- }
- htp7 = {
- " HOW TO PLAY |",
- " |",
- " Like if the match should be Command or GUI, |",
- " If cheats are enabled and mode like |",
- " Adventure,PvP,PvE and you can select so you |",
- " Play more than two in a match for example |",
- " 4vs4 or just select MaxPlayers:4 or something |",
- }
- htp7Col = {
- " HOW TO PLAY ",
- " ",
- " Like if the match should be Command or GUI, ",
- " If cheats are enabled and mode like ",
- " Adventure,PvP,PvE and you can select so you ",
- " Play more than two in a match for example ",
- " 4vs4 or just select MaxPlayers:4 or something ",
- }
- if colorsOnOff == "OFF" then
- if page == 1 then
- for i = 1, #htp1 do
- drawAt(2,i + 3,htp1[i])
- end
- elseif page == 2 then
- for i = 1, #htp2 do
- drawAt(2,i + 3,htp2[i])
- end
- elseif page == 3 then
- for i = 1, #htp3 do
- drawAt(2,i + 3,htp3[i])
- end
- elseif page == 4 then
- for i = 1, #htp4 do
- drawAt(2,i + 3,htp4[i])
- end
- elseif page == 5 then
- for i = 1, #htp5 do
- drawAt(2,i + 3,htp5[i])
- end
- elseif page == 6 then
- for i = 1, #htp6 do
- drawAt(2,i + 3,htp6[i])
- end
- elseif page == 7 then
- for i = 1, #htp7 do
- drawAt(2,i + 3,htp7[i])
- end
- end
- elseif colorsOnOff == "ON" then
- term.setBackgroundColor(menuBackColor)
- term.setTextColor(menuTextColor)
- if page == 1 then
- for i = 1, #htp1 do
- drawAt(2,i + 3,htp1Col[i])
- end
- elseif page == 2 then
- for i = 1, #htp2 do
- drawAt(2,i + 3,htp2Col[i])
- end
- elseif page == 3 then
- for i = 1, #htp3 do
- drawAt(2,i + 3,htp3Col[i])
- end
- elseif page == 4 then
- for i = 1, #htp4 do
- drawAt(2,i + 3,htp4Col[i])
- end
- elseif page == 5 then
- for i = 1, #htp5 do
- drawAt(2,i + 3,htp5Col[i])
- end
- elseif page == 6 then
- for i = 1, #htp6 do
- drawAt(2,i + 3,htp6Col[i])
- end
- elseif page == 7 then
- for i = 1, #htp7 do
- drawAt(2,i + 3,htp7Col[i])
- end
- end
- end
- end
- function drawHelpControls()
- ctrl1 = {
- " CONTROLS |",
- " -:Menus:- |",
- " UP/DOWN Arrow: Move Up And Down |",
- " ENTER: Makes Your Selection |",
- " BACKSPACE: Exit |",
- " Y/N: Accept Or Decline the Question |"
- }
- ctrl1Col = {
- " ",
- " CONTROLS ",
- " -:Menus:- ",
- " UP/DOWN Arrow: Move Up And Down ",
- " ENTER: Makes Your Selection ",
- " BACKSPACE: Exit ",
- " Y/N: Accept Or Decline the Question "
- }
- ctrl2 = {
- " CONTROLS |",
- " -:In Game:- |",
- " A: Punch |",
- " D: Uppercut |",
- " S: Special Attack |",
- " CTRL: Block |",
- " SPACE: Kick |",
- " X = Leave |",
- }
- ctrl2Col = {
- " ",
- " CONTROLS ",
- " -:In Game:- ",
- " A: Punch ",
- " D: Uppercut ",
- " S: Special Attack ",
- " CTRL: Block ",
- " SPACE: Kick ",
- " X = Leave ",
- }
- ctrl3 = {
- " CONTROLS |",
- " -:In Map:- |",
- " W: Move Up |",
- " A: Move Left |",
- " S: Move Down |",
- " D: Move Right |",
- }
- ctrl3Col = {
- " ",
- " CONTROLS ",
- " -:In Map:- ",
- " W: Move Up ",
- " A: Move Left ",
- " S: Move Down ",
- " D: Move Right ",
- }
- ctrl4 = {
- " CONTROLS |",
- " -:Adventure:- |",
- " A: Move Left |",
- " D: Move Right |",
- " SPACE: Jump |",
- " W: Punch |",
- " F: Interact |",
- }
- ctrl4Col = {
- " ",
- " CONTROLS ",
- " -:Adventure:- ",
- " A: Move Left ",
- " D: Move Right ",
- " SPACE: Jump ",
- " W: Punch ",
- " F: Interact ",
- }
- if colorsOnOff == "OFF" then
- if page == 1 then
- for i = 1, #ctrl1 do
- drawAt(2,i + 3,ctrl1[i])
- end
- elseif page == 2 then
- for i = 1, #ctrl2 do
- drawAt(2,i + 3,ctrl2[i])
- end
- elseif page == 3 then
- for i = 1, #ctrl3 do
- drawAt(2,i + 3,ctrl3[i])
- end
- elseif page == 4 then
- for i = 1, #ctrl4 do
- drawAt(2,i + 3,ctrl4[i])
- end
- end
- elseif colorsOnOff == "ON" then
- if page == 1 then
- for i = 1, #ctrl1 do
- drawAt(2,i + 3,ctrl1Col[i])
- end
- elseif page == 2 then
- for i = 1, #ctrl2 do
- drawAt(2,i + 3,ctrl2Col[i])
- end
- elseif page == 3 then
- for i = 1, #ctrl3 do
- drawAt(2,i + 3,ctrl3Col[i])
- end
- elseif page == 4 then
- for i = 1, #ctrl4 do
- drawAt(2,i + 3,ctrl4Col[i])
- end
- end
- end
- end
- function drawHelpCommands()
- hc1 = {
- " COMMANDS |",
- " -:Explanation:- |",
- " Ok so first I'll explain that a command is |",
- " What you write like 'Leave' then you'll leave |",
- " The match since 'Leave' is a command in the |",
- " Game that's available. |",
- }
- hc1Col = {
- " ",
- " COMMANDS ",
- " -:Explanation:- ",
- " Ok so first I'll explain that a command is ",
- " What you write like 'Leave' then you'll leave ",
- " The match since 'Leave' is a command in the ",
- " Game that's available. ",
- }
- hc2 = {
- " COMMANDS |",
- " -:Commands:- |",
- " Punch: Punches The Enemy and deals damage to |",
- " the enemy if you don't miss them. |",
- " |",
- " Block: Blocks the enemys attack if you do a |",
- " Successful block then the enemy loses stamina |",
- " And you don't take any damage ofcourse. |",
- " |",
- " Leave: Leaves the match. |",
- " |",
- " Kick: Kicks the enemy, But be careful so you |",
- " Don't get disqualified from the match. |",
- }
- hc2Col = {
- " ",
- " COMMANDS ",
- " -:Commands:- ",
- " Punch: Punches The Enemy and deals damage to ",
- " the enemy if you don't miss them. ",
- " ",
- " Block: Blocks the enemys attack if you do a ",
- " Successful block then the enemy loses stamina ",
- " And you don't take any damage ofcourse. ",
- " ",
- " Kick: Kicks the enemy, But be careful so you ",
- " Don't get disqualified from the match. ",
- }
- hc3 = {
- " COMMANDS |",
- " |",
- " Drink <item> = Drinks the drink you have and |",
- " you regenate something like STA or HP. |",
- " |",
- " Eat <item> = Eat the food item you have and |",
- " Regenate HP. |",
- " |",
- " Uppercut: Does An Uppercut that deals more dmg |",
- " |",
- " Dodge: Dodges the enemy attack if successful |",
- }
- hc3Col = {
- " ",
- " COMMANDS ",
- " ",
- " Drink <item> = Drinks the drink you have and ",
- " you regenate something like STA or HP. ",
- " ",
- " Eat <item> = Eat the food item you have and ",
- " Regenate HP. ",
- " ",
- " Uppercut: Does An Uppercut that deals more dmg ",
- " ",
- " Dodge: Dodges the enemy attack if successful ",
- " ",
- " Leave: Leaves the match. ",
- }
- hc4 = {
- " COMMANDS |",
- " -:Cheat Commands:- |",
- " Kill: Kills the enemy instantly |",
- " |",
- " Attack with <god weapons>: Deals maxium or |",
- " Super high damage. |",
- }
- hc4Col = {
- " ",
- " COMMANDS ",
- " -:Cheat Commands:- ",
- " Kill: Kills the enemy instantly ",
- " ",
- " Attack with <god weapons>: Deals maxium or ",
- " Super high damage. ",
- }
- if colorsOnOff == "OFF" then
- if page == 1 then
- for i = 1, #hc1 do
- drawAt(2,i + 3,hc1[i])
- end
- elseif page == 2 then
- for i = 1, #hc2 do
- drawAt(2,i + 3,hc2[i])
- end
- elseif page == 3 then
- for i = 1, #hc3 do
- drawAt(2,i + 3,hc3[i])
- end
- elseif page == 4 then
- for i = 1, #hc4 do
- drawAt(2,i + 3,hc4[i])
- end
- end
- elseif colorsOnOff == "ON" then
- if page == 1 then
- for i = 1, #hc1 do
- drawAt(2,i + 3,hc1Col[i])
- end
- elseif page == 2 then
- for i = 1, #hc2 do
- drawAt(2,i + 3,hc2Col[i])
- end
- elseif page == 3 then
- for i = 1, #hc3 do
- drawAt(2,i + 3,hc3Col[i])
- end
- elseif page == 4 then
- for i = 1, #hc4 do
- drawAt(2,i + 3,hc4Col[i])
- end
- end
- end
- end
- function drawHelpAbilities()
- hlpAbi1 = {
- " ABILITIES |",
- " -:Explanation:- |",
- " An ability is something like an 'Uppercut' or |",
- " 'Block', And all abilities can be upgraded |",
- " Like for example 'Block' can get better |",
- " Resistans against attacks and better chance |",
- " To block and attack from an enemy or such |",
- }
- hlpAbi1Col = {
- " ",
- " ABILITIES ",
- " -:Explanation:- ",
- " An ability is something like an 'Uppercut' or ",
- " 'Block', And all abilities can be upgraded ",
- " Like for example 'Block' can get better ",
- " Resistans against attacks and better chance ",
- " To block and attack from an enemy or such ",
- }
- if colorsOnOff == "OFF" then
- if page == 1 then
- for i = 1, #hlpAbi1 do
- drawAt(2,i + 3,hlpAbi1[i])
- end
- end
- elseif colorsOnOff == "ON" then
- if page == 1 then
- for i = 1, #hlpAbi1 do
- drawAt(2,i + 3,hlpAbi1Col[i])
- end
- end
- end
- end
- ---------------------------------------------------------------------------------------------------
- --How To Play
- function hHowToPlay()
- inHelpTopic = true
- minPage = 1
- maxPage = 7
- page = 1
- while inHelpTopic do
- cleanScreen()
- drawButtons()
- drawHelpMenu()
- drawHowToPlay()
- pageEvents()
- end
- end
- --Controls
- function hHelpControls()
- inHelpTopic = true
- minPage = 1
- maxPage = 4
- page = 1
- while inHelpTopic do
- cleanScreen()
- drawButtons()
- drawHelpMenu()
- drawHelpControls()
- pageEvents()
- end
- end
- function hHelpCommands()
- inHelpTopic = true
- minPage = 1
- maxPage = 4
- page = 1
- while inHelpTopic do
- cleanScreen()
- drawButtons()
- drawHelpMenu()
- drawHelpCommands()
- pageEvents()
- end
- end
- function hHelpAbilities()
- inHelpTopic = true
- minPage = 1
- maxPage = 1
- page = 1
- while inHelpTopic do
- cleanScreen()
- drawButtons()
- drawHelpMenu()
- drawHelpAbilities()
- pageEvents()
- end
- end
- ---------------------------------------------------------------------------------------------------
- local helpArt = {
- " _____",
- " / \\______",
- "| .-''-. |",
- "| / \\ |",
- "| \\ / |",
- "| '-..-;\\ |",
- "|________\\\\___|",
- " \\|"
- }
- --Help Menu
- function helpMenu()
- exit = false
- helpMenuStat = 1
- while true do
- if colorsOnOff == "ON" then
- term.setBackgroundColor(ttBackColor)
- drawAt(1,19," ")
- end
- if exit == true then
- break
- end
- cleanScreen()
- drawHelpMenu()
- if colorsOnOff == "OFF" then
- for i = 1, #helpArt do
- drawAt(10,i + 9,helpArt[i])
- end
- elseif colorsOnOff == "ON" then
- term.setTextColor(menuTextColor)
- term.setBackgroundColor(menuBackColor)
- for i = 1, #helpArt do
- drawAt(10,i + 9,helpArt[i])
- end
- end
- helpEvents()
- end
- end
- ---------------------------------------------------------------------------------------------------
- --MENUS
- ---------------------------------------------------------------------------------------------------
- --Difficulty Menu
- function difMenu()
- cleanScreen()
- drawDifMenuU()
- sleep(0.7)
- term.setCursorPos(17,2)
- if colorsOnOff == "ON" then
- term.setBackgroundColor(ttBackColor)
- textutils.slowPrint("--[Difficulty]--")
- sleep(0.5)
- elseif colorsOnOff == "OFF" then
- textutils.slowPrint("--[Difficulty]--")
- sleep(0.5)
- end
- menuStat = 2
- while true do
- cleanScreen()
- drawDifMenu()
- dMenuEvents()
- end
- end
- --Character Menu
- function characterMenu()
- menuStat = 2
- while true do
- cleanScreen()
- drawChMenu()
- chMenuEvents()
- end
- end
- --Warning Menu
- function warningMenu()
- menuStat = 5
- while true do
- drawWarningMenu()
- wMenuEvents()
- end
- end
- --Solo Menu
- function solo()
- checkDifficulty()
- menuStat = 2
- while true do
- checkStatus()
- if cheatUnlimitedMoney == true then
- money = 99999999999999
- end
- drawHomeMenu()
- hMenuEvents()
- end
- end
- --Main Menu
- function menu()
- menuStat = 2
- loadSettings()
- checkSettings()
- while true do
- checkXp()
- drawMenu()
- menuEvents()
- end
- end
- --Starts The Game
- menu()
- ---------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment