def chooseQuest(self, questId, quest=None):
    avId = self.air.getAvatarIdFromSender()
    self.notify.debug(('chooseQuest: avatar %s choseQuest %s' % (avId, questId)))
    if (not self.pendingAvId):
        self.notify.warning(('chooseQuest: not expecting an answer from any avatar: %s' % avId))
        return
    if (self.pendingAvId != avId):
        self.notify.warning(('chooseQuest: not expecting an answer from this avatar: %s' % avId))
        return
    if (questId == 0):
        self.pendingAvId = None
        self.pendingQuests = None
        self.air.questManager.avatarCancelled(avId)
        self.cancelChoseQuest(avId)
        return
    for quest in self.pendingQuests:
        if (questId == quest[0]):
            self.pendingAvId = None
            self.pendingQuests = None
            self.air.questManager.avatarChoseQuest(avId, self, *quest)
            return
    self.air.questManager.avatarChoseQuest(avId, self, *quest)
    self.notify.warning(('chooseQuest: avatar: %s chose a quest not offered: %s' % (avId, questId)))
    self.pendingAvId = None
    self.pendingQuests = None
    return
def chooseQuest(self, questId, quest=None):
    avId = self.air.getAvatarIdFromSender()
    self.notify.debug(('chooseQuest: avatar %s choseQuest %s' % (avId, questId)))
    if (not self.pendingAvId):
        self.notify.warning(('chooseQuest: not expecting an answer from any avatar: %s' % avId))
        return
    if (self.pendingAvId != avId):
        self.notify.warning(('chooseQuest: not expecting an answer from this avatar: %s' % avId))
        return
    if (questId == 0):
        self.pendingAvId = None
        self.pendingQuests = None
        self.air.questManager.avatarCancelled(avId)
        self.cancelChoseQuest(avId)
        return
    for quest in self.pendingQuests:
        if (questId == quest[0]):
            self.pendingAvId = None
            self.pendingQuests = None
            self.air.questManager.avatarChoseQuest(avId, self, *quest)
            return
    self.air.questManager.avatarChoseQuest(avId, self, *quest)
    self.notify.warning(('chooseQuest: avatar: %s chose a quest not offered: %s' % (avId, questId)))
    self.pendingAvId = None
    self.pendingQuests = None
    return