being.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/python
  2. """
  3. Copyright 2011, Dipesh Amin <yaypunkrock@gmail.com>
  4. Copyright 2011, Stefan Beller <stefanbeller@googlemail.com>
  5. This file is part of tradey, a trading bot in the mana world
  6. see www.themanaworld.org
  7. """
  8. def job_type(job):
  9. if (job <= 25 or (job >= 4001 and job <= 4049)):
  10. return "player"
  11. elif (job >= 46 and job <= 1000):
  12. return "npc"
  13. elif (job > 1000 and job <= 2000):
  14. return "monster"
  15. elif (job == 45):
  16. return "portal"
  17. class BeingManager:
  18. def __init__(self):
  19. self.container = {}
  20. def findId(self, name, type="player"):
  21. for i in self.container:
  22. if self.container[i].name == name and self.container[i].type == type:
  23. return i
  24. return -10
  25. class Being:
  26. def __init__(self, being_id, job):
  27. self.id = being_id
  28. self.name = ""
  29. self.x = 0
  30. self.y = 0
  31. self.action = ""
  32. self.job = job
  33. self.target = 0
  34. self.type = job_type(job)
  35. if __name__ == '__main__':
  36. print "Do not run this file directly. Run main.py"