Advertisement
NickM13

[CC] Bee-Dex

Feb 16th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.67 KB | None | 0 0
  1. -- Bee-Dex Uncolored Computer version
  2. -- Other versions, along with other projects, found at pastebin.com/u/NickM13
  3.  
  4. beeList = {} -- {Name, {{Path1}, {Path2}}, Available{Princesses, Drones}, Description}
  5. beeCount = 0
  6. version = "NC 1.0"
  7.  
  8. width, height = term.getSize()
  9.  
  10. local function addBee(name, path, description)
  11.     beeCount = beeCount + 1
  12.     beeList[beeCount] = {}
  13.     beeList[beeCount].name = name
  14.     beeList[beeCount].path = path
  15.     beeList[beeCount].available = {}
  16.     beeList[beeCount].available.princess = 0
  17.     beeList[beeCount].available.drone = 0
  18.     if description then
  19.         beeList[beeCount].description = description
  20.     else
  21.         beeList[beeCount].description = ""
  22.     end
  23. end
  24.  
  25. -- Mundane Bees
  26. addBee("Water", {{"Mundane"}})
  27. addBee("Rocky", {{"Mundane"}})
  28. addBee("Embittered", {{"Mundane"}})
  29. addBee("Marbled", {{"Mundane"}})
  30.  
  31. -- Forestry Bees
  32.     -- Common Branch
  33.     addBee("Forest", {{"Mundane"}})
  34.     addBee("Meadows", {{"Mundane"}})
  35.     addBee("Common", {{"Forest", "Meadows", "Modest", "Tropical", "Wintry", "Marshy", "Water", "Rocky", "Embittered", "Marbled", "Valiant"}, {"Forest", "Meadows", "Modest", "Tropical", "Wintry", "Marshy", "Water", "Rocky", "Embittered", "Marbled", "Valiant"}, 0.15})
  36.     addBee("Cultivated", {{"Common"}, {"Forest", "Meadows", "Modest", "Tropical", "Wintry", "Marshy", "Water", "Rocky", "Embittered", "Marbled", "Valiant"}, 0.12})
  37.    
  38.     -- Noble Branch
  39.     addBee("Noble", {{"Common"}, {"Cultivated"}, 0.10})
  40.     addBee("Majestic", {{"Noble"}, {"Cultivated"}, 0.08})
  41.     addBee("Imperial", {{"Noble"}, {"Majestic"}, 0.08})
  42.    
  43.     -- Industrious Branch
  44.     addBee("Diligent", {{"Common"}, {"Cultivated"}, 0.10})
  45.     addBee("Unweary", {{"Diligent"}, {"Cultivated"}, 0.08})
  46.     addBee("Industrious", {{"Diligent"}, {"Unweary"}, 0.08})
  47.    
  48.     -- Heroic Branch
  49.     addBee("Steadfast", {{"Mundane"}})
  50.     addBee("Valiant", {{"Mundane"}})
  51.     addBee("Heroic", {{"Steadfast"}, {"Valiant"}, 0.06})
  52.    
  53.     -- Infernal Branch
  54.     addBee("Sinister", {{"Modest", "Tropical"}, {"Cultivated"}, 0.60})
  55.     addBee("Fiendish", {{"Sinister"}, {"Cultivated", "Modest", "Tropical"}, 0.40})
  56.     addBee("Demonic", {{"Sinister"}, {"Fiendish"}, 0.25})
  57.    
  58.     -- Austere Branch
  59.     addBee("Modest", {{"Mundane"}})
  60.     addBee("Frugal", {{"Modest"}, {"Sinister", "Fiendish"}, 0.13}, "Sinister=16%, Fiendish=10%") -- Sinister=16%, Fiendish=10%
  61.     addBee("Austere", {{"Modest"}, {"Frugal"}, 0.08})
  62.    
  63.     -- End Branch
  64.     addBee("Ender", {{"Mundane"}})
  65.    
  66.     -- Tropical Branch
  67.     addBee("Tropical", {{"Mundane"}})
  68.     addBee("Exotic", {{"Austere"}, {"Tropical"}, 0.12})
  69.     addBee("Edenic", {{"Exotic"}, {"Tropical"}, 0.08})
  70.    
  71.     -- Frozen Branch
  72.     addBee("Wintry", {{"Mundane"}})
  73.     addBee("Icy", {{"Industrious"}, {"Wintry"}, 0.12}, "Also Known As Froffy")
  74.     addBee("Glacial", {{"Icy"}, {"Wintry"}, 0.08})
  75.     addBee("Frigid", {{"Wintry"}, {"Diligent"}, 0.10}, "Extra Bees Mod")
  76.     addBee("Absolute", {{"Ocean"}, {"Frigid"}, 0.08}, "Extra Bees Mod")
  77.    
  78.     -- Festive Branch
  79.     addBee("Leporine", {{"Meadows"}, {"Forest"}, 0.10}, "Only around Easter (April 6-15)")
  80.     addBee("Merry", {{"Wintry"}, {"Forest"}, 0.10}, "Only around Christmas (December 21-27)")
  81.     addBee("Tipsy", {{"Wintry"}, {"Meadows"}, 0.10}, "Only around New Year's Even (Dec 27 - Jan 2)")
  82.     addBee("Celebratory", {{"Austere"}, {"Excited"}, 0.05}, "Extra Bees Mod")
  83.    
  84.     -- Agrarian Branch
  85.     addBee("Rural", {{"Meadows"}, {"Diligent"}, 0.12})
  86.     addBee("Farmed", {{"Cultivated"}, {"Rural"}, 0.10}, "Extra Bees Mod")
  87.    
  88.     -- Boggy Branch
  89.     addBee("Marshy", {{"Mundane"}})
  90.     addBee("Swamp", {{"Common"}, {"Marshy"}, 0.10}, "Extra Bees Mod")
  91.     addBee("Boggy", {{"Swamp"}, {"Marshy"}, 0.08}, "Extra Bees Mod")
  92.     addBee("Fungal", {{"Boggy"}, {"Swamp"}, 0.08}, "Extra Bees Mod")
  93.  
  94.    
  95.  
  96.  
  97.  
  98. local function say(msg)
  99.     io.write(msg)
  100. end
  101.  
  102. local function sayln(msg)
  103.     say(msg)
  104.     x, y = term.getCursorPos()
  105.     term.setCursorPos(1, y + 1)
  106. end
  107.  
  108. local function clear()
  109.     term.clear()
  110.     term.setCursorPos(1, 1)
  111. end
  112.  
  113. commandList = {}
  114. commandCount = 0
  115.  
  116. local function addCommand(command, action, description)
  117.     commandCount = commandCount + 1
  118.     commandList[commandCount] = {}
  119.     commandList[commandCount].command = command
  120.     commandList[commandCount].action = action
  121.     commandList[commandCount].description = description
  122. end
  123.  
  124. local function printHelp()
  125.     sayln("Available commands:\n")
  126.     for i=1, commandCount do
  127.         sayln(commandList[i].command..": "..commandList[i].description)
  128.     end
  129. end
  130.  
  131. local function showBees(bee)
  132.     for i=1, beeCount do
  133.         if beeList[i].name == bee then
  134.             sayln("Name: "..beeList[i].name)
  135.             say("Partner 1: ")
  136.             for j=1, table.getn(beeList[i].path[1]) do
  137.                 say(beeList[i].path[1][j])
  138.                 if j < table.getn(beeList[i].path[1]) then
  139.                     say(",")
  140.                 end
  141.             end
  142.             sayln("")
  143.             if table.getn(beeList[i].path) >= 3 then
  144.                 say("Partner 2: ")
  145.                 for j=1, table.getn(beeList[i].path[2]) do
  146.                     say(beeList[i].path[2][j])
  147.                     if j < table.getn(beeList[i].path[2]) then
  148.                         say(",")
  149.                     end
  150.                 end
  151.                 sayln("")
  152.             end
  153.             if table.getn(beeList[i].path) >= 3 then
  154.                 say("Chance: ")
  155.                 say((beeList[i].path[3]*100))
  156.                 sayln("%")
  157.             end
  158.             sayln("Princesses: "..beeList[i].available.princess)
  159.             sayln("Drones: "..beeList[i].available.drone)
  160.             sayln("Description: "..beeList[i].description)
  161.         end
  162.     end
  163. end
  164.  
  165. local function pathBees(bee)
  166.     for i=1, beeCount do
  167.         if beeList[i].name == bee then
  168.             say("Partner 1: ")
  169.             for j=1, table.getn(beeList[i].path[1]) do
  170.                 say(beeList[i].path[1][j])
  171.                 if j < table.getn(beeList[i].path[1]) then
  172.                     say(",")
  173.                 end
  174.             end
  175.             sayln("")
  176.             if table.getn(beeList[i].path) >= 3 then
  177.                 say("Partner 2: ")
  178.                 for j=1, table.getn(beeList[i].path[2]) do
  179.                     say(beeList[i].path[2][j])
  180.                     if j < table.getn(beeList[i].path[2]) then
  181.                         say(",")
  182.                     end
  183.                 end
  184.                 sayln("")
  185.             end
  186.             if table.getn(beeList[i].path) >= 3 then
  187.                 say("Chance: ")
  188.                 say((beeList[i].path[3]*100))
  189.                 sayln("%")
  190.             end
  191.         end
  192.     end
  193. end
  194.  
  195. running = true
  196.  
  197. addCommand("help", printHelp, "Displays functions and what they do.")
  198. addCommand("info", showBees, "Shows info on bee.")
  199. addCommand("path", pathBees, "Shows only geneology of bee.")
  200. addCommand("exit", function() running = false end, "Exits program.")
  201.  
  202. clear()
  203.  
  204. sayln("Welcome to Bee-Dex OS")
  205. sayln("Loaded version: "..version)
  206. sayln("Written by NickM13")
  207.  
  208. while running do
  209.     term.setCursorPos(1, height)
  210.     say("BD>")
  211.     local command = io.read()
  212.     args = {}
  213.     for arg in command:gmatch("%S+") do
  214.         table.insert(args, arg)
  215.     end
  216.    
  217.     clear()
  218.  
  219.     local used = false
  220.     for i=1, table.getn(commandList) do
  221.         if args[1] == commandList[i].command then
  222.             commandList[i].action(args[2], args[3], args[4], args[5])
  223.             used = true
  224.             break
  225.         end
  226.     end
  227.     if used == false then
  228.         sayln("Unknown command entered.")
  229.     end
  230. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement