Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import os
  2. import sys
  3.  
  4. rectList = []
  5. for line in open("index"):
  6. path = line.split()[1]
  7. if path[-1] == os.linesep:
  8. path = path[:-1]
  9.  
  10. for line2 in open(path + "/" + "Setting.txt"):
  11. tokens = line2.split()
  12. if not tokens:
  13. continue
  14.  
  15. if tokens[0] == "BasePosition":
  16. x, y = [int(item) / 100 for item in tokens[1:3]]
  17. elif tokens[0] == "MapSize":
  18. w, h = [int(item) * 256 for item in tokens[1:3]]
  19.  
  20. rectList.append((path, x, y, x+w, y+h))
  21.  
  22. x = int(sys.argv[1])
  23. y = int(sys.argv[2])
  24. for rect in rectList:
  25. if x >= rect[1] and y >= rect[2] and x <= rect[3] and y<= rect[4]:
  26. print rect[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement