Esempio n. 1
0
def insertCharacterArenaInfo(characterId):
    """插入角色竞技场信息
    """
    datestr = datetime.date.today()
    sql = "insert into tb_arena(characterId,recorddate,ranking)\
     values(%d,'%s',%d)" % (characterId, datestr, characterId - 1000000)
    dbpool.executeSQL(sql)
Esempio n. 2
0
def insertCharacterArenaInfo(characterId):
    """插入角色竞技场信息
    """
    datestr = datetime.date.today()
    sql = "insert into tb_arena(characterId,recorddate,ranking)\
     values(%d,'%s',%d)"%(characterId,datestr,characterId-1000000)
    dbpool.executeSQL(sql)
Esempio n. 3
0
def insertBattleLog(characterId,tocharacterId,fname,tname,success,rankingChange):
    """插入战斗日志
    """
    sql = "insert into tb_arena_log(tiaozhan,yingzhan,\
    tiaozhanname,yingzhanname,success,rankingChange)\
     values(%d,%d,'%s','%s',%d,%d)"%(characterId,\
                                     tocharacterId,fname,tname,success,rankingChange)

    dbpool.executeSQL(sql)
Esempio n. 4
0
def insertBattleLog(characterId, tocharacterId, fname, tname, success,
                    rankingChange):
    """插入战斗日志
    """
    sql = "insert into tb_arena_log(tiaozhan,yingzhan,\
    tiaozhanname,yingzhanname,success,rankingChange)\
     values(%d,%d,'%s','%s',%d,%d)"                                   %(characterId,\
                                     tocharacterId,fname,tname,success,rankingChange)

    dbpool.executeSQL(sql)
Esempio n. 5
0
def updateMailInfo(mailId, prop):
    """更新邮件信息"""
    sql = util.forEachUpdateProps('tb_mail', prop, {'id': mailId})
    count = dbpool.executeSQL(sql)
    if (count >= 1):
        return True
    return False
Esempio n. 6
0
def updateMailInfo(mailId,prop):
    """更新邮件信息"""
    sql = util.forEachUpdateProps('tb_mail',prop, {'id':mailId})
    count = dbpool.executeSQL(sql)
    if(count >= 1):
        return True
    return False
Esempio n. 7
0
def deleteMail(mailId):
    """删除邮件"""
    sql = "DELETE FROM tb_mail WHERE id = %d"%mailId
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    return False
Esempio n. 8
0
def deleteMail(mailId):
    """删除邮件"""
    sql = "DELETE FROM tb_mail WHERE id = %d" % mailId
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    return False
Esempio n. 9
0
def UpdateGuYongState(characterId, tid, state):
    """更新好友的雇用状态
    """
    sql = "UPDATE `tb_friend` SET guyong = %d WHERE characterId=%d \
    AND playerId =%d" % (state, characterId, tid)
    count = dbpool.executeSQL(sql)
    if count >= 1:
        return True
    return False
Esempio n. 10
0
def UpdateGuYongState(characterId,tid,state):
    """更新好友的雇用状态
    """
    sql = "UPDATE `tb_friend` SET guyong = %d WHERE characterId=%d \
    AND playerId =%d"%(state,characterId,tid)
    count = dbpool.executeSQL(sql)
    if count >= 1:
        return True
    return False
Esempio n. 11
0
def addMail(title,senderId,sender,receiverId,content,mailtype):
    """添加邮件"""
    sql = "INSERT INTO tb_mail(title,senderId,sender,receiverId,\
    `type`,content,sendTime) VALUES ('%s',%d,'%s',%d,%d,'%s',\
    CURRENT_TIMESTAMP())"%(title,senderId,sender,receiverId,mailtype,content)
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    return False
Esempio n. 12
0
def updateCharacterArenaInfo(characterId,props):
    """更新角色的竞技场信息
    """
    sqlstr = util.forEachUpdateProps('tb_arena', props,{'characterId':characterId})
    count = dbpool.executeSQL(sqlstr)

    if count >= 1:
        return True
    else:
        return False
Esempio n. 13
0
def deletePlayerFriend(characterId,friendId):
    """删除角色好友
    @param friendId: int 好友编号
    """
    sql = 'delete from `tb_friend` where characterId=%d friendId = %d'%(characterId,friendId)
    count = dbpool.executeSQL(sql)

    if count>=1:
        return True
    return False
Esempio n. 14
0
def deletePlayerFriend(characterId, friendId):
    """删除角色好友
    @param friendId: int 好友编号
    """
    sql = 'delete from `tb_friend` where characterId=%d friendId = %d' % (
        characterId, friendId)
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    return False
Esempio n. 15
0
def updateCharacterArenaInfo(characterId, props):
    """更新角色的竞技场信息
    """
    sqlstr = util.forEachUpdateProps('tb_arena', props,
                                     {'characterId': characterId})
    count = dbpool.executeSQL(sqlstr)

    if count >= 1:
        return True
    else:
        return False
Esempio n. 16
0
def addMail(title, senderId, sender, receiverId, content, mailtype):
    """添加邮件"""
    sql = "INSERT INTO tb_mail(title,senderId,sender,receiverId,\
    `type`,content,sendTime) VALUES ('%s',%d,'%s',%d,%d,'%s',\
    CURRENT_TIMESTAMP())" % (title, senderId, sender, receiverId, mailtype,
                             content)
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    return False
Esempio n. 17
0
def addGuyongRecord(characterId,rolename,zyname,zyid,bresult,coinbound,huoli):
    """添加雇用记录
    """
    sql = "INSERT INTO tb_guyong_record (characterId,\
    chaname,zyname,zyid,battleresult,coinbound,huoli) VALUES \
    (%d,'%s','%s',%d,%d,%d,%d)"%((characterId,rolename,zyname,\
                                  zyid,bresult,coinbound,huoli))
    count = dbpool.executeSQL(sql)
    if count >= 1:
        return True
    return False
Esempio n. 18
0
def updatePlayerDB(player):
    """更新角色的数据库信息"""
    characterId = player.baseInfo.id
    props = {'level':player.level.getLevel(),'coin':player.finance.getCoin(),
             'exp':player.level.getExp(),'hp':player.attribute.getHp()}
    sqlstr = util.forEachUpdateProps('tb_character',props, {'id':characterId})
    count = dbpool.executeSQL(sqlstr)
    if count >= 1:
        return True
    else:
        log.err(sqlstr)
        return False
Esempio n. 19
0
def addGuyongRecord(characterId, rolename, zyname, zyid, bresult, coinbound,
                    huoli):
    """添加雇用记录
    """
    sql = "INSERT INTO tb_guyong_record (characterId,\
    chaname,zyname,zyid,battleresult,coinbound,huoli) VALUES \
    (%d,'%s','%s',%d,%d,%d,%d)"                               %((characterId,rolename,zyname,\
                                  zyid,bresult,coinbound,huoli))
    count = dbpool.executeSQL(sql)
    if count >= 1:
        return True
    return False
Esempio n. 20
0
def addFriend(characterId, playerId, friendType, isSheildedMail=0):
    """添加一个好友
    @param characterId: int 角色的id
    @param playerId: int 好友的id
    @param friendType: int(1,2) 好友的类型 1:好友  2:仇敌
    @param isSheildedMail:int 是否屏蔽邮件 0.不屏蔽邮件 1.屏蔽
    """
    sql = "insert into `tb_friend`(characterId,playerId,friendType,isSheildedMail)\
     values(%d,%d,%d,%d)" % (characterId, playerId, friendType, isSheildedMail)
    count = dbpool.executeSQL(sql)
    if count >= 1:
        return True
    return False
Esempio n. 21
0
def addFriend(characterId,playerId,friendType,isSheildedMail=0):
    """添加一个好友
    @param characterId: int 角色的id
    @param playerId: int 好友的id
    @param friendType: int(1,2) 好友的类型 1:好友  2:仇敌
    @param isSheildedMail:int 是否屏蔽邮件 0.不屏蔽邮件 1.屏蔽
    """
    sql = "insert into `tb_friend`(characterId,playerId,friendType,isSheildedMail)\
     values(%d,%d,%d,%d)"%(characterId,playerId,friendType,isSheildedMail)
    count = dbpool.executeSQL(sql)
    if count>=1:
        return True
    return False
Esempio n. 22
0
def updatePlayerDB(player):
    """更新角色的数据库信息"""
    characterId = player.baseInfo.id
    props = {
        'level': player.level.getLevel(),
        'coin': player.finance.getCoin(),
        'exp': player.level.getExp(),
        'hp': player.attribute.getHp()
    }
    sqlstr = util.forEachUpdateProps('tb_character', props,
                                     {'id': characterId})
    count = dbpool.executeSQL(sqlstr)
    if count >= 1:
        return True
    else:
        log.err(sqlstr)
        return False