Ejemplo n.º 1
0
 def initCards(self, instanceid, dropoutid, cardNum):
     '''初始化卡片组
     @param instanceid: int 副本id
     @param dropoutid: int 掉落id
     @param cardNum: int 卡片数量
     '''
     self._IsShowed = 0
     dropoutdata = dropout.getByDropOutByid(dropoutid)
     if not dropoutdata:
         raise u'没有掉落数据'
     for cardId in range(cardNum):
         dropInfo = dropoutdata[cardId]
         card = Card(id=cardId, coin= dropInfo.get('coin',0),\
                      coupon= dropInfo.get('coupon',0),itemBound=dropInfo.get('item'))
         self._cards[card.getID()] = card
 def doCardBound(self,instance):
     '''获取翻牌奖励
     '''
     dropoutid = instance._dropoutid
     dropoutdata=dropout.getByDropOutByid(dropoutid)
     cardbound = random.choice(dropoutdata)
     dropItem = cardbound.get('item')
     coin = cardbound.get('coin',0)
     msgHead = Lg().g(461)
     if coin:
         self._owner.finance.addCoin(coin)
         msg = Lg().g(311)%coin
     elif dropItem:
         itemtemplateid = dropItem.baseInfo.itemTemplateId
         itemname = dropItem.baseInfo.getRichName()
         stack = dropItem.pack.getStack()
         self._owner.pack.putNewItemInPackage(dropItem)
         msg =Lg().g(462)+ u"<a href = 'event:%d'><u>%s</u></a> x %d"%(itemtemplateid,itemname,stack)
     else:
         msg = Lg().g(463)
     return msgHead + msg +' \n'
Ejemplo n.º 3
0
 def doCardBound(self, instance):
     '''获取翻牌奖励
     '''
     dropoutid = instance._dropoutid
     dropoutdata = dropout.getByDropOutByid(dropoutid)
     cardbound = random.choice(dropoutdata)
     dropItem = cardbound.get('item')
     coin = cardbound.get('coin', 0)
     msgHead = Lg().g(461)
     if coin:
         self._owner.finance.addCoin(coin)
         msg = Lg().g(311) % coin
     elif dropItem:
         itemtemplateid = dropItem.baseInfo.itemTemplateId
         itemname = dropItem.baseInfo.getRichName()
         stack = dropItem.pack.getStack()
         self._owner.pack.putNewItemInPackage(dropItem)
         msg = Lg().g(462) + u"<a href = 'event:%d'><u>%s</u></a> x %d" % (
             itemtemplateid, itemname, stack)
     else:
         msg = Lg().g(463)
     return msgHead + msg + ' \n'