def attemptGiftPurchase(self, avId, targetId, avatar, optional): av = self.air.doId2do.get(avId) if not av: return recipient = GiftAvatar.createFromFields(avatar) context = optional[0] item = optional[1] returnCode = self.checkPurchaseLimit(recipient, item) if returnCode != ToontownGlobals.P_ItemOnOrder: self.sendGiftPurchaseResponse(context, avId, returnCode) return item.giftTag = avId self.chargeAvatar(av, optional[2], item.getEmblemPrices()) recipient.onGiftOrder.append(item) dg = self.air.dclassesByName['DistributedToonAI'].aiFormatUpdate( 'setGiftSchedule', targetId, targetId, self.air.ourChannel, [recipient.getGiftScheduleBlob()]) self.air.send(dg) self.sendGiftPurchaseResponse(context, avId, ToontownGlobals.P_ItemOnOrder)
def attemptGiftPurchase(self, avId, targetId, avatar, optional): av = self.air.doId2do.get(avId) if not av: return recipient = GiftAvatar.createFromFields(avatar) context = optional[0] item = optional[1] returnCode = self.checkPurchaseLimit(recipient, item) if returnCode != ToontownGlobals.P_ItemOnOrder: self.sendGiftPurchaseResponse(context, avId, returnCode) return item.giftTag = avId self.chargeAvatar(av, optional[2], item.getEmblemPrices()) recipient.onGiftOrder.append(item) dg = self.air.dclassesByName['DistributedToonAI'].aiFormatUpdate('setGiftSchedule', targetId, targetId, self.air.ourChannel, [recipient.getGiftScheduleBlob()]) self.air.send(dg) self.sendGiftPurchaseResponse(context, avId, ToontownGlobals.P_ItemOnOrder)
def setGiftAvatar(self, fields): if not self.phoneGui: return self.phoneGui.setFriendReady(GiftAvatar.createFromJson(fields))