Exemplo n.º 1
0
 def getVillageIdWithSettler(self):
     villagesId = util.readConfigWithKey("VILLAGESID")
     for villageId in villagesId:
         self.goToDorf1(villageId)
         if (self.isSettlerInVillage()):
             return villageId
     return None
Exemplo n.º 2
0
 def createSettler(self):
     villagesId = util.readConfigWithKey("VILLAGESID")
     for villageId in villagesId:
         util.goToVillageBuiding(self.browser, villageId, '32')
         util.waitUntil(self.browser, 5, 'build_logo')
         time.sleep(1)
         if (self.isSubmitTroop(villageId)):
             return villageId
     self.create()
Exemplo n.º 3
0
 def build(self):
     time.sleep(1)
     villagesId = util.readConfigWithKey("VILLAGESID")
     farmersList = util.readFarmer()
     for villageId in villagesId:
         print("<< Move Dorf 1 >> Go to village Id " + str(villageId))
         if (self.isBroken(villageId)):
             for building in farmersList["farmers"]:
                 buildingId = building["id"]
                 self.upgradeToMaxLevel(villageId, buildingId)
Exemplo n.º 4
0
import Service.auth as auth
import Service.util as util
import time

SERVER = util.readConfigWithKey("SERVER")


class city:
    def __init__(self, browser):
        if browser is None:
            self.browser = auth.login(False)
        self.browser = browser

    def isBroken(self, villageId):
        self.browser.get(SERVER + "/dorf2.php?newdid=" + str(villageId))
        util.waitUntil(self.browser, 5, 'village2')
        time.sleep(2)
        try:
            city = self.browser.find_elements_by_xpath(
                "//div[contains(@class, 'max')]")
            print("<< Building Dorf2 >> VillageId: " + str(villageId) +
                  " city: " + str(len(city)))
            if (len(city) >= 18):
                return False
            return True
        except:
            return True

    def isMaxLevel(self):
        try:
            self.browser.find_elements_by_xpath(