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_refundBidDelete(self, money, target, item_name): if not self.checkProxyConn(): return mail = MailItem( "Auction House", "Your bid refund on %s!" % item_name, target, money, "The seller of %s has deleted. Refunding your bid." % item_name, time() + 7200, 0) MAILCONNECT.perspective_sendMail(mail, 0)
def perspective_refundBid(self, money, target, item_name): if not self.checkProxyConn(): return mail = MailItem( "Auction House", "You have been outbid on %s!" % item_name, target, money, "You have been outbid on %s! Your bid has been refunded." % item_name, time() + 7200, 0) MAILCONNECT.perspective_sendMail(mail, 0)
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)
def perspective_refundBidBuyout(self, money, target, item_name): if not self.checkProxyConn(): return mail = MailItem( "Auction House", "Your bid refund on %s!" % item_name, target, money, "%s has been purchased outright. Your bid has been refunded." % item_name, time() + 7200, 0) MAILCONNECT.perspective_sendMail(mail, 0)
def doSendMail(self): from partyWnd import PARTYWND from mud.client.playermind import PLAYERMIND cinfo = PARTYWND.charInfos[PARTYWND.curIndex] sendTo = self.sendTo.getValue() sendSubject = self.sendSubject.getValue() sendMessage = self.sendMessage.getValue() sslot = protoid = 0 if (sendTo == ""): TGECall("MessageBoxOK", "Please type in the name of the recepient", "You need to specify who to send the mail to.") return if (sendSubject == ""): TGECall("MessageBoxOK", "Please type in the Subject", "You need to specify a subject.") return if (sendMessage == ""): TGECall("MessageBoxOK", "Please type in the Message", "You need to provide some kind of message.") return coinsP = self.sendMoney_P.getValue() coinsG = self.sendMoney_G.getValue() coinsS = self.sendMoney_S.getValue() coinsC = self.sendMoney_C.getValue() if not coinsP.isdigit() or not coinsG.isdigit() or not coinsS.isdigit( ) or not coinsC.isdigit(): coinsP = coinsG = coinsS = coinsC = 0 mailTin = ExpandMoney(0, coinsC, coinsS, coinsG, coinsP) if mailTin < 0: TGECall("MessageBoxOK", "Invalid Coin Value", "You cannot have a coin value of less than 0.") return if (PARTYWND.mind.rootInfo.TIN < mailTin): TGECall( "MessageBoxOK", "You don't have enough money", "The value you want to send is more than you have. Try again." ) return #Validate it to make sure it is actually in an inventory slot if an item is in the mail if self.mailItemGhost: slotfound = 0 for slot, ghost in cinfo.ITEMS.iteritems(): if ghost == self.mailItemGhost: if RPG_SLOT_CARRY_END > slot >= RPG_SLOT_CARRY_BEGIN: slotfound = 1 break if not slotfound: TGECall( "MessageBoxOK", "Invalid item in the slot", "The item selected to be mailed is not in your inventory.") return sslot = slot protoid = ghost.PROTOID newMail = MailItem(cinfo.NAME, sendSubject, sendTo, mailTin, sendMessage, time()) PLAYERMIND.perspective.callRemote("PlayerAvatar", "sendMail", newMail, protoid, sslot)