def updatePlayerDB(player): '''更新角色的数据库信息''' characterId = player.baseInfo.id position = player.baseInfo.getPosition() props = {'level':player.level.getLevel(),'coin':player.finance.getCoin(), 'town':player.baseInfo.getTown(),'energy':player.attribute.getEnergy(), 'exp':player.level.getExp(),'hp':player.attribute.getHp(), 'contribution':player.guild.contribution,'outtime':str(datetime.datetime.now()), 'LastonlineTime':str(player.lastOnline), 'isOnline':0,'novicestep':player.award.awardstep, 'leavetime':str(player.guild.getLeaveTime()), 'prestige':player.finance.getPrestige(), 'morale':player.finance.getMorale(), 'NobilityLevel':player.nobility.getLevel(), 'position_x':position[0], 'position_y':position[1]} sqlstr = "update `tb_character` set" sqlstr = util.forEachUpdateProps(sqlstr, props) sqlstr += " where id = %d" % characterId # dbnoderemote.execSql_defered(sqlstr, println) cursor = dbaccess.dbpool.cursor() count = cursor.execute(sqlstr) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True else: # log.err(sqlstr) return False
def updateCharacterTurnRecord(characterId,props): '''更新角色点石成金和加急训练信息''' sql = "update `tb_turnrecord` set" sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateCharacterTrain(characterId,props): '''更新角色的挖掘记录''' sql = "update `tb_training` set" sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateUserInfo(userId, props): '''更新角色信息''' sql = "update `tb_user_character` set" sql = util.forEachUpdateProps(sql, props) sql += " where id = %d" % userId cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateUserInfo(userId,props): '''更新角色信息''' sql = "update `tb_user_character` set" sql = util.forEachUpdateProps(sql, props) sql += " where id = %d" % userId cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateCharacterTowerRecord(characterId, props): '''更新角色的爬塔记录 ''' sql = "update `tb_tower_record` set" sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateCharacterGuildInfo(characterId,prot): '''更新角色的行会关系表''' sql = 'update `tb_guild_character` set' sql = util.forEachUpdateProps(sql, prot) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if count>=1: return True return False
def updatePetInfo(petId,prop): '''更新宠物的信息''' sql = 'update `tb_pet` set' sql = util.forEachUpdateProps(sql, prop) sql += " where id = %d" % petId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if(count >= 1): return True return False
def updateCharacterGuildInfo(characterId, prot): '''更新角色的行会关系表''' sql = 'update `tb_guild_character` set' sql = util.forEachUpdateProps(sql, prot) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True return False
def updateCharacterWishRecord(characterId,props): '''更新角色的许愿记录 ''' sql = 'update `tb_wish_record` set' sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if count>=1: return True return False
def updateGuildInfo(guildId, attrs): '''修改玩家信息''' sql = 'update `tb_guild` set' sql = util.forEachUpdateProps(sql, attrs) sql += " where id=%d" % guildId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if(count >= 1): return True else: return False
def updateCharacterFateSetting(characterId,prop): '''更新角色命格设置 ''' sql = 'update `tb_character_fate` set' sql = util.forEachUpdateProps(sql, prop) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if(count >= 1): return True return False
def updateSchedule(characterId,props): '''更新角色日程进度 @param characterId: int 角色的ID @param schedule_tag: int 进度标识 @param props: dict 需要更新的值 ''' sql = "update `tb_schedule` set" sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d and datediff(scheduledate,current_date())=0;"%(characterId) cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateCharacterDaily(characterId,dailyId,props): '''更新角色目标记录 @param characterId: int 角色的id @param dailyId: int 每日目标的ID @param current: int 当前进度 ''' sql = "update `tb_character_daily` set" sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d and dailyId = %d;"%(characterId,dailyId) cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateCharacterWishRecord(characterId, props): '''更新角色的许愿记录 ''' sql = 'update `tb_wish_record` set' sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True return False
def updateGuildInfo(guildId, attrs): '''修改玩家信息''' sql = 'update `tb_guild` set' sql = util.forEachUpdateProps(sql, attrs) sql += " where id=%d" % guildId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if (count >= 1): return True else: return False
def updateFortressInfo(fortressId, props): '''更新要塞的信息 ''' sqlstr = "update `tb_fortress` set" sqlstr = util.forEachUpdateProps(sqlstr, props) sqlstr += " where id = %d" % fortressId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sqlstr) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True else: return False
def updateFortressInfo(fortressId,props): '''更新要塞的信息 ''' sqlstr = "update `tb_fortress` set" sqlstr = util.forEachUpdateProps(sqlstr, props) sqlstr += " where id = %d" % fortressId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sqlstr) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True else: return False
def updateCharacterTowerRecord(characterId,props): '''更新角色的爬塔记录 ''' sql = "update `tb_tower_record` set" sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateCharacterArenaInfo(characterId, props): '''更新角色的竞技场信息 ''' sqlstr = "update `tb_arena` set" sqlstr = util.forEachUpdateProps(sqlstr, props) sqlstr += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sqlstr) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True else: return False
def updateSchedule(characterId, props): '''更新角色日程进度 @param characterId: int 角色的ID @param schedule_tag: int 进度标识 @param props: dict 需要更新的值 ''' sql = "update `tb_schedule` set" sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d and datediff(scheduledate,current_date())=0;" % ( characterId) cursor = dbaccess.dbpool.cursor() cursor.execute(sql) dbaccess.dbpool.commit() cursor.close()
def updateCharacterArenaInfo(characterId,props): '''更新角色的竞技场信息 ''' sqlstr = "update `tb_arena` set" sqlstr = util.forEachUpdateProps(sqlstr, props) sqlstr += " where characterId = %d" % characterId cursor = dbaccess.dbpool.cursor() count = cursor.execute(sqlstr) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True else: return False
def updateQuestRecord(characterId,taskId,props): '''更新角色任务记录 @param characterId: int 角色的id @param taskId: int 任务的id ''' sql = 'update `tb_task_record` set ' sql = util.forEachUpdateProps(sql, props) sql += " where taskId=%d and characterId = %d" %(taskId,characterId) cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if count: return True return False
def updateQuestRecord(characterId, taskId, props): '''更新角色任务记录 @param characterId: int 角色的id @param taskId: int 任务的id ''' sql = 'update `tb_task_record` set ' sql = util.forEachUpdateProps(sql, props) sql += " where taskId=%d and characterId = %d" % (taskId, characterId) cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if count: return True return False
def updatePlayerInfoByprops(characterId,props): '''更新角色数据库信息''' sqlstr = "update `tb_character` set" sqlstr = util.forEachUpdateProps(sqlstr, props) sqlstr += " where id = %d" % characterId # dbnoderemote.execSql_defered(sqlstr, println) cursor = dbaccess.dbpool.cursor() count = cursor.execute(sqlstr) dbaccess.dbpool.commit() cursor.close() if count >= 1: return True else: # log.err(sqlstr) return False
def updateCharacterMatrixInfo(characterId,props): '''更新角色的阵法设置信息 @param characterId: int 角色的id @param matrixId: int 阵法的id @param props: dict 更新的属性 ''' sql = "UPDATE tb_character_matrix set " sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" %( characterId) cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if(count >= 1): return True return False
def updateCharacterMatrixInfo(characterId, props): '''更新角色的阵法设置信息 @param characterId: int 角色的id @param matrixId: int 阵法的id @param props: dict 更新的属性 ''' sql = "UPDATE tb_character_matrix set " sql = util.forEachUpdateProps(sql, props) sql += " where characterId = %d" % (characterId) cursor = dbaccess.dbpool.cursor() count = cursor.execute(sql) dbaccess.dbpool.commit() cursor.close() if (count >= 1): return True return False