def __insertEquips(self, paramMap): # 自己写数据库 rowValueMap = {} rowValueMap[EquipItemKeys.roleID] = self.databaseID uuid = KBEngine.genUUID64() rowValueMap[EquipItemKeys.uuid] = uuid rowValueMap[EquipItemKeys.itemID] = paramMap["itemID"] rowValueMap[EquipItemKeys.amount] = paramMap["amount"] rowValueMap[EquipItemKeys.star] = paramMap["star"] rowValueMap[EquipItemKeys.strongLevel] = paramMap["strongLevel"] rowValueMap[EquipItemKeys.gem1] = paramMap["gem1"] rowValueMap[EquipItemKeys.gem2] = paramMap["gem2"] rowValueMap[EquipItemKeys.gem3] = paramMap["gem3"] sql = util.getInsertSql("tbl_ItemEquips", rowValueMap) @util.dbDeco def cb(result, rownum, error): del rowValueMap["roleID"] self.equipsContainer[uuid] = rowValueMap self.writeToDB() self.noticeClientBagUpdate(rowValueMap["UUID"], paramMap["itemID"], paramMap["amount"]) return KBEngine.executeRawDatabaseCommand(sql, cb) pass
def sendMailToPlayer(self, mailInfo): mailType = mailInfo["mail_type"] title = mailInfo["title"] fromName = mailInfo["from_name"] to_dbid = mailInfo["to_dbid"] text = mailInfo["text"] time = util.getCurrentTime() attachment = mailInfo["attachment"] state = MailState.Unread extern_info = mailInfo["extern_info"] sql = util.getInsertSql("tbl_Mails", mailInfo)
def insertUseDB(self, item): # 自己写数据库 rowValueMap = {} rowValueMap["roleID"] = self.databaseID rowValueMap["UUID"] = item["UUID"] rowValueMap["itemID"] = item["itemID"] rowValueMap["amount"] = item["amount"] item["state"] = DBState.NoAction sql = util.getInsertSql("tbl_ItemUses", rowValueMap) KBEngine.executeRawDatabaseCommand(sql, None, self.id)
def onAcceptAddFriend(self, selfDBID, toDBID, toMethod): # 在线 if toDBID in self.dbidToMailBox: mb = self.dbidToMailBox[toDBID] args = {"acceptorDBID": selfDBID} mb.onPlayerMgrCmd(toMethod, args) DEBUG_MSG("----------onAcceptAddFriend---------online----") # 离线 elif toDBID in self.dbidToOfflinePlayerInfo: DEBUG_MSG("----------onAcceptAddFriend---------offline----") rowValueMap = {"parentID": toDBID, "sm_value": selfDBID} sql = util.getInsertSql("tbl_Avatar_friendDBIDList", rowValueMap, False) KBEngine.executeRawDatabaseCommand(sql, None)
def onReqAddFriend(self, toDBID, toMethod, applyDBID): # 在线 if toDBID in self.dbidToMailBox: mb = self.dbidToMailBox[toDBID] args = {"applyDBID": applyDBID} mb.onPlayerMgrCmd(toMethod, args) # 离线 elif toDBID in self.dbidToOfflinePlayerInfo: # 直接插入数据库 rowValueMap = {} rowValueMap["parentID"] = toDBID rowValueMap["sm_value"] = applyDBID sql = util.getInsertSql("tbl_Avatar_applyDBIDList", rowValueMap, False) KBEngine.executeRawDatabaseCommand(sql)
def insertEquipDB(self, item): # 自己写数据库 rowValueMap = {} rowValueMap[EquipItemKeys.roleID] = self.databaseID uuid = item[EquipItemKeys.uuid] rowValueMap[EquipItemKeys.uuid] = uuid rowValueMap[EquipItemKeys.itemID] = item["itemID"] rowValueMap[EquipItemKeys.amount] = item["amount"] rowValueMap[EquipItemKeys.star] = item["star"] rowValueMap[EquipItemKeys.strongLevel] = item["strongLevel"] rowValueMap[EquipItemKeys.gem1] = item["gem1"] rowValueMap[EquipItemKeys.gem2] = item["gem2"] rowValueMap[EquipItemKeys.gem3] = item["gem3"] sql = util.getInsertSql("tbl_ItemEquips", rowValueMap) item["state"] = DBState.NoAction # ERROR_MSG("Equip insert DB " + sql) KBEngine.executeRawDatabaseCommand(sql, None, self.id)
def __insertDiamonds(self, configID, count=1): # 自己写数据库 rowValueMap = {} rowValueMap["roleID"] = self.databaseID rowValueMap["UUID"] = KBEngine.genUUID64() rowValueMap["itemID"] = configID rowValueMap["amount"] = count sql = util.getInsertSql("tbl_ItemDiamonds", rowValueMap) @util.dbDeco def cb(result, rownum, error): del rowValueMap["roleID"] self.diamondsContainer[rowValueMap["UUID"]] = rowValueMap self.writeToDB() self.noticeClientBagUpdate(rowValueMap["UUID"], configID, count) KBEngine.executeRawDatabaseCommand(sql, cb)