def perspective_refreshInboxList(self, charName, lastID): #Find all the mail since the last update (or first update)..a handful of joins here cnt = 0 mailList = {} query = "SELECT id, message_from,subject,message_to,tin,message,time_end,item_proto from MailStore \ WHERE id > %d and message_to = '%s';" % (lastID, charName) for id, mail_from, subject, mail_to, tin, message, time_end, itemProto in self.conn.execute( query): cnt += 1 mailList[id] = MailItem(mail_from, subject, mail_to, tin, message, time_end, id) mailList[id].itemProto = itemProto if cnt < 1: return None else: for id, mail in mailList.iteritems(): if mail.itemProto: item = ItemInstanceReceive(None, True) #Populate the item with instance values item.setItemAH(self.conn, id) #Set Auction values to be used by the world server and client item.auctionID = id item.auctionItemID = mail.itemProto mailList[id].item = item return mailList
def perspective_sendRevoke(self, item, target): if not self.checkProxyConn(): return #buyer mail = MailItem( "Auction House", "%s has been returned!" % item.name, target, 0, "%s has been returned from the Auction House." % item.name, time() + 7200, 0) mail.item = item MAILCONNECT.perspective_sendMail(mail, item.auctionItemID)
def perspective_auctionTimeLimit(self, item, target): if not self.checkProxyConn(): return #buyer mail = MailItem( "Auction House", "%s failed to sell!" % item.name, target, 0, "%s failed to sell so it is being returned." % item.name, time() + 7200, 0) mail.item = item MAILCONNECT.perspective_sendMail(mail, item.auctionItemID)
def perspective_sendWinnings(self, item, money, buyer, seller): if not self.checkProxyConn(): return #buyer mail = MailItem( "Auction House", "You have won %s!" % item.name, buyer, 0, "You have won %s! Please take your winnings!" % item.name, time() + 7200, 0) mail.item = item MAILCONNECT.perspective_sendMail(mail, item.auctionItemID) #seller mail = MailItem( "Auction House", "You successfully sold %s" % item.name, seller, money, "You successfully sold %s! Please take your earnings!" % item.name, time() + 7200, 0) MAILCONNECT.perspective_sendMail(mail, 0)