Пример #1
0
    def __init__(self, client):
        Engine.__init__(self, client)

        self._player = client.world.player
        self._waiting = False

        if self._player.is_hidden():
            self._client.send(p.UseSkill(SKILL_STEALTH))
        else:
            self._client.send(p.UseSkill(SKILL_HIDING))
        self.call_id = reactor.callLater(0.5, self._next)
Пример #2
0
    def _use_skill(self, skill):
        assert self._target_locked == bool(self._targets)

        log.msg("train skill", SKILL_NAMES[skill])

        if skill == SKILL_MUSICIANSHIP:
            instrument = self._find_instrument()
            if instrument is not None:
                self._client.send(p.Use(instrument.serial))
                self._success()
            else:
                self._client.send(p.Use(SERIAL_PLAYER | self._world.player.serial))
                self._failure(NoSuchEntity('No instrument'))
                return

        elif skill == SKILL_HERDING:
            crook = self._find_crook()
            if crook is not None:
                self._client.send(p.Use(crook.serial))
            else:
                self._client.send(p.Use(SERIAL_PLAYER | self._world.player.serial))
                self._target_mutex.put_target()
                self._failure(NoSuchEntity('No crook'))
                return

        else:
            self._client.send(p.UseSkill(skill))

            if len(self._targets) == 0:
                self._success()
Пример #3
0
 def _check(self):
     if self.player.mana is None:
         self._failure()
     elif self.player.mana.value >= self.mana:
         self._success()
     elif self.player.stats is None or self.player.stats[2] < self.mana:
         self._failure(NotEnoughIntelligence())
     else:
         self._client.send(p.UseSkill(SKILL_MEDITATION))
         delay = uo.rules.skill_delay(SKILL_MEDITATION)
         reactor.callLater(10, self._check)
Пример #4
0
 def _next(self):
     if not self._player.is_hidden():
         # we have been revealed or hiding has failed; finish this
         # engine for now
         self._success()
     elif self._waiting:
         # next stealth attempt
         self._waiting = False
         self._client.send(p.UseSkill(SKILL_STEALTH))
         self.call_id = reactor.callLater(0.5, self._next)
     else:
         # still hidden; wait for skill delay
         self._waiting = True
         self.call_id = reactor.callLater(10, self._next)
Пример #5
0
 def update(self, player):
     if self.call_id is None and not player.is_hidden():
         client = self._client
         client.send(p.UseSkill(SKILL_HIDING))
         self.call_id = reactor.callLater(
             uo.rules.skill_delay(SKILL_HIDING), self._next)