Advertisement
NanoBob

(old) NanoGlasses

Sep 16th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.60 KB | None | 0 0
  1. monitor=peripheral.wrap("back")
  2. sensor=peripheral.wrap("right")
  3. --shell.run("delete Button")
  4. --shell.run("pastebin get pBfWqGm2 Button")
  5. os.loadAPI("Button")
  6. monitorX,monitorY=monitor.getSize()
  7. Button.monitorSetSide("back")
  8.  
  9. weaponIDs={[23557]=true,[23559]=true,[23561]=true,[23563]=true,[23565]=true,[23567]=true,[23569]=true,[23587]=true,[23589]=true,[23590]=true,[23592]=true,[23594]=true,[23597]=true,[23617]=true,[23619]=true,[23621]=true,[23623]=true,[23625]=true,[23627]=true,
  10. [23629]=true,[23631]=true,[23647]=true,[23649]=true,[23651]=true,[23652]=true,[23667]=true,[23668]=true,[23670]=true,[23672]=true,[23674]=true,[23801]=true,[23803]=true,[23805]=true,[23807]=true,[23809]=true,[23811]=true,[23813]=true,[23815]=true,[23817]=true,
  11. [23819]=true,[23821]=true,[23823]=true,[23825]=true,[23827]=true,[23829]=true,[23831]=true,[23833]=true,[23835]=true,[23837]=true,[23839]=true,[23841]=true,[23843]=true,[23845]=true,[23847]=true,[23848]=true,[23850]=true}
  12.  
  13. blackList={["Doc_Jason"]=true,["iTzBruin"]=true,["darkbobo00"]=true,}
  14.  
  15.  
  16. weaponNames={"sword","rapier","bow","paxel"}
  17.  
  18.  
  19. function getArmor(playerName)
  20.     allArmor=sensor.getPlayerData(playerName)['armor']
  21.     armorFormat={}
  22.     for armorSlot,information in pairs(allArmor) do
  23.         armorFormat[armorSlot]={['name']=information['rawName']}
  24.     end
  25.     return armorFormat
  26. end
  27.  
  28. function getInventorySlot(playerName,slot)
  29.     allSlots=sensor.getPlayerData(playerName)['inventory']
  30.     currentSlot=allSlots[slot]
  31.     slotInfo={}
  32.     slotInfo[armorSlot]={['name']=currentSlot['name']}
  33.     return slotInfo
  34. end
  35.  
  36. function getWeapons(playerName)
  37.     allSlots=sensor.getPlayerData(playerName)['inventory']
  38.     weapons={}
  39.     for id,data in pairs(allSlots) do
  40.         if weaponIDs[data['id']] then
  41.             weapons[data['name']]=true
  42.         else
  43.             loweredString=string.lower(data['name'])
  44.             for id,name in pairs(weaponNames) do
  45.                 if string.find(loweredString,name)~=nil then
  46.                     weapons[loweredString]=true
  47.                 end
  48.             end
  49.         end
  50.     end
  51.     return weapons
  52. end
  53.  
  54. function mainScreen()
  55.     playerIndex=1
  56.     Button.clearButtons()
  57.     for player,__ in pairs(blackList) do
  58.         Button.addButton(player,5,playerIndex*5-2,0,512,256,playerScreen)
  59.         playerIndex=1+1
  60.     end
  61. end
  62.  
  63.  
  64. function armorScreen()
  65.     armorDetails=getArmor(selectedPlayer)
  66.     armorIndex=1
  67.     Button.clearButtons()
  68.     Button.addButton(" Back ",5,monitorY-4,0,512,256,mainScreen)
  69.     for slot,name in pairs(armorDetails) do
  70.         monitor.setCursorPos(5,armorIndex*3+1)
  71.         monitor.write(slot.." : "..name['name'])
  72.         armorIndex=armorIndex+1
  73.     end
  74.     sleep(5)
  75. end
  76.  
  77. function inventoryScreen()
  78.     inventoryDetails=getInventorySlot(selectedPlayer)
  79.     inventoryIndex=1
  80.     Button.clearButtons()
  81.     Button.addButton(" Back ",5,monitorY-4,0,512,256,mainScreen)
  82.     for slot,name in pairs(inventoryDetails) do
  83.         monitor.setCursorPos(5,inventoryIndex*3+1)
  84.         monitor.write(slot.." : "..name['name'])
  85.         inventoryIndex=inventoryIndex+1
  86.     end
  87.     sleep(5)
  88. end
  89.  
  90. function weaponsScreen()
  91.     weaponDetails=getWeapons(selectedPlayer)
  92.     weaponIndex=1
  93.     Button.clearButtons()
  94.     Button.addButton(" Back ",5,monitorY-2,0,512,256,mainScreen)
  95.     for weaponName,name in pairs(weaponDetails) do
  96.         monitor.setCursorPos(5,weaponIndex*2+1)
  97.         monitor.write(weaponName)
  98.         print(weaponName)
  99.         weaponIndex=weaponIndex+1
  100.     end
  101.     sleep(5)
  102. end
  103.  
  104. function playerScreen(name)
  105.     selectedPlayer=name
  106.     Button.clearButtons()
  107.     Button.addButton(" Armor ",5,3,0,512,256,armorScreen)
  108.     Button.addButton("Weapons",5,7,0,512,256,weaponsScreen)
  109.     Button.addButton(" Items ",5,11,0,512,256,armorScreen)
  110.     Button.addButton(" Back ",5,monitorY-3,0,512,256,mainScreen)
  111. end
  112.  
  113. mainScreen()
  114.  
  115. while true do
  116.     Button.monitorPressed()
  117. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement