예제 #1
0
def matchBattle(randomID, mess, dbi):
    try:
        if randomID == '':
            VirusManager.VirusManager.addError('12000')
        else:
            if mess == '':
                VirusManager.VirusManager.addError('12001')
            else:
                mes = mess.split(',')
                if mes[0] == '':
                    VirusManager.VirusManager().addError('')
                else:
                    if mes[1] == '':
                        VirusManager.VirusManager.addError('')
                    else:
                        num = dbi.combatmatch.getmaxID()
                        if num == None:
                            idnum = 1
                        else:
                            idnum = num + 1
                        dbi.combatmatch.addMatcher(idnum, randomID, mes[0],
                                                   mes[1])
    except Exception as e:
        VirusManager.VirusManager().addError('12999')
        VirusManager.VirusManager().addError(e)
예제 #2
0
 def showHero(self):
     try:
         cur = dba.dba().excute('select * from hero')
         for row in cur.fetchall():
             return str(row)
     except Exception as e:
         VirusManager.VirusManager().addError('22222')
         VirusManager.VirusManager().addError(e)
예제 #3
0
파일: fileTable.py 프로젝트: Hengle/Virus
 def getMaxVersion(self):
     try:
         cur = dba.dba().excute('select Max(id) as id FROM filetable')
         for row in cur.fetchall():
             return row[0]
     except Exception as e:
         VirusManager.VirusManager().addError('101111')
         VirusManager.VirusManager().addError(e)
예제 #4
0
파일: CombatMatch.py 프로젝트: Hengle/Virus
 def deleteMatcher(self,randomID):
     try:
         if randomID=='':
             VirusManager.VirusManager().addError('80002')
         else:
             cur=dba.dba().excute('delete FROM combatmatch WHERE userRandom='+"'"+randomID+"'")
     except Exception as e:
         VirusManager.VirusManager().addError('88888')
         VirusManager.VirusManager().addError(e)
예제 #5
0
 def deleteUserMap(self,random):
     try:
         if random=='':
             VirusManager.VirusManager().addError('70001')
         else:
             cur=dba.dba().excute('delete from usermap where random='+"'"+random+"'")
     except Exception as e:
         VirusManager.VirusManager().addError('77777')
         VirusManager.VirusManager().addError(e)
예제 #6
0
파일: HeroConfig.py 프로젝트: Hengle/Virus
 def deleteHero(self, heroid):
     try:
         if heroid == '':
             VirusManager.VirusManager().addError('50001')
         else:
             cur = dba.dba().excute('delete FROM heroconfig WHERE heroID=' +
                                    "'" + heroid + "'")
     except Exception as e:
         VirusManager.VirusManager().addError('55555')
         VirusManager.VirusManager().addError(e)
예제 #7
0
 def deleteHero(self, id):
     try:
         if id == '':
             VirusManager.VirusManager().addError('20002')
         else:
             cur = dba.dba().excute('delete FROM hero WHERE id=' + "'" +
                                    id + "'")
     except Exception as e:
         #print('s8')
         VirusManager.VirusManager().addError('22222')
         VirusManager.VirusManager().addError(e)
예제 #8
0
 def getUserID(self,random):
     try:
         if random=='':
             VirusManager.VirusManager().addError('70001')
         else:
             cur=dba.dba().excute('select userID from usermap where random= '+"'"+random+"'")
             for row in cur.fetchall():
                 return row[0]
     except Exception as e:
         VirusManager.VirusManager().addError('77777')
         VirusManager.VirusManager().addError(e)
예제 #9
0
파일: SkillConfig.py 프로젝트: Hengle/Virus
 def deleteSkill(self, skillid):
     try:
         if skillid == '':
             VirusManager.VirusManager().addError('60001')
         else:
             cur = dba.dba().excute(
                 'delete from skillconfig where skillID=' + "'" + skillid +
                 "'")
     except Exception as e:
         VirusManager.VirusManager().addError('66666')
         VirusManager.VirusManager().addError(e)
예제 #10
0
파일: CombatMatch.py 프로젝트: Hengle/Virus
 def getUserID(self,userrandom):
     try:
         if userrandom=='':
             VirusManager.VirusManager().addError('80001')
         else:
             cur=dba.dba().excute('select userID from combatmatch WHERE userRandom='+"'"+userrandom+"'")
             for row in cur.fetchall():
                 return row[0]
     except Exception as e:
         VirusManager.VirusManager().addError('88888')
         VirusManager.VirusManager().addError(e)
예제 #11
0
파일: CombatNews.py 프로젝트: Hengle/Virus
 def addHouse(self, houseid):
     try:
         if houseid == '':
             VirusManager.VirusManager().addError('90001')
         else:
             cur = dba.dba().excute(
                 "insert into combatnews(houseid,news) VALUE ('" +
                 str(houseid) + "','')")
     except Exception as e:
         VirusManager.VirusManager().addError('99999')
         VirusManager.VirusManager().addError(e)
예제 #12
0
파일: CombatMatch.py 프로젝트: Hengle/Virus
 def getMatcher(self,id):
     try:
         if id=='':
             VirusManager.VirusManager().addError('80001')
         else:
             cur=dba.dba().excute('select * from combatmatch where id='+"'"+id+"'")
             for row in cur.fetchall():
                 return row[0]+','+row[1]+','+row[2]+','+row[3]
     except Exception as e:
         VirusManager.VirusManager().addError('88888')
         VirusManager.VirusManager().addError(e)
예제 #13
0
 def deleteItem(self, id):
     try:
         if id == '':
             VirusManager.VirusManager().addError('30001')
         else:
             #print(userid)
             cur = dba.dba().excute('delete from item where id=' + "'" +
                                    id + "'")
     except Exception as e:
         VirusManager.VirusManager().addError('33333')
         VirusManager.VirusManager().addError(e)
예제 #14
0
파일: CombatNews.py 프로젝트: Hengle/Virus
 def deleteNews(self, houseid):
     try:
         if houseid == '':
             VirusManager.VirusManager().addError('90001')
         else:
             cur = dba.dba().excute(
                 'delete FROM combatnews WHERE houseID=' + "'" + houseid +
                 "'")
     except Exception as e:
         VirusManager.VirusManager().addError('99999')
         VirusManager.VirusManager().addError(e)
예제 #15
0
파일: HeroConfig.py 프로젝트: Hengle/Virus
 def getUserHero(self, heroid):
     try:
         if heroid == '':
             VirusManager.VirusManager().addError('50001')
         else:
             cur = dba.dba().excute(
                 'select * from heroconfig where heroID=' + "'" + heroid +
                 "'")
             for row in cur.fetchall(self):
                 return row[0] + ',' + row[1] + ',' + row[2]
     except Exception as e:
         VirusManager.VirusManager().addError(e)
예제 #16
0
 def addUserMap(self,random,userid):
     try:
         if random=='':
             VirusManager.VirusManager().addError('70001')
         else:
             if userid=='':
                 VirusManager.VirusManager().addError('70002')
             else:
                 cur=dba.dba().excute("insert into usermap(random,userID) VALUE ('"+str(random)+"','"+str(userid)+"')")
     except Exception as e:
         VirusManager.VirusManager().addError('77777')
         VirusManager.VirusManager().addError(e)
예제 #17
0
파일: fileTable.py 프로젝트: Hengle/Virus
 def getFile(self, id):
     try:
         if id == '':
             VirusManager.VirusManager().addError('100000')
         else:
             cur = dba.dba().excute('select * from filetable where id=' +
                                    "'" + str(id) + "'")
             for row in cur.fetchall():
                 return row[1] + '|' + row[2] + '|' + row[3]
     except Exception as e:
         VirusManager.VirusManager().addError('101111')
         VirusManager.VirusManager().addError(e)
예제 #18
0
 def getItemID(self, id):
     try:
         if id == '':
             VirusManager.VirusManager().addError('30001')
         else:
             cur = dba.dba().excute('select itemID from item where id=' +
                                    "'" + id + "'")
             for row in cur.fetchall():
                 return row[0]
     except Exception as e:
         VirusManager.VirusManager().addError('33333')
         VirusManager.VirusManager().addError(e)
예제 #19
0
파일: CombatNews.py 프로젝트: Hengle/Virus
 def getNews(self, houseid):
     try:
         if houseid == '':
             VirusManager.VirusManager().addError('90001')
         else:
             cur = dba.dba().excute(
                 'select * from combatnews where houseID=' + "'" + houseid +
                 "'")
             for row in cur.fetchall():
                 return str(row[1])
     except Exception as e:
         VirusManager.VirusManager().addError('99999')
         VirusManager.VirusManager().addError(e)
예제 #20
0
 def getUserHero(self, userid):
     try:
         if userid == '':
             VirusManager.VirusManager().addError('20006')
         else:
             cur = dba.dba().excute(
                 'select heroID from hero where userID=' + "'" + userid +
                 "'")
             for row in cur.fetchall():
                 return row[0]
     except Exception as e:
         VirusManager.VirusManager().addError('22222')
         VirusManager.VirusManager().addError(e)
예제 #21
0
파일: SkillConfig.py 프로젝트: Hengle/Virus
 def getSkill(self, skillid):
     try:
         if skillid == '':
             VirusManager.VirusManager().addError('60001')
         else:
             cur = dba.dba().excute(
                 'select * from skillconfig where skillID=' + "'" +
                 skillid + "'")
             for row in cur.fetchall():
                 return row[1]
     except Exception as e:
         VirusManager.VirusManager().addError('66666')
         VirusManager.VirusManager().addError(e)
예제 #22
0
 def updateItemNumber(self, itemid, itemnumber):
     try:
         if itemid == '':
             VirusManager.VirusManager().addError('30002')
         else:
             if itemnumber == '':
                 VirusManager.VirusManager().addError('30003')
             else:
                 cur = dba.dba().excutecur = dba.dba().excute(
                     'update item set itemNumber="' + str(itemnumber) +
                     '"where itemID=' + "'" + itemid + "'")
     except Exception as e:
         VirusManager.VirusManager().addError('33333')
         VirusManager.VirusManager().addError(e)
예제 #23
0
def getSkill(randomID, mess, dbi):
    try:
        if randomID == '':
            VirusManager.VirusManager().addError('')
        else:
            if mess == '':
                VirusManager.VirusManager().addError('')
            else:
                userid = dbi.usermap.getUserID(randomID)
                skill = dbi.hero.getSkill(mess, userid)
                return '300202' + '|' + skill
    except Exception as e:
        VirusManager.VirusManager().addError('')
        VirusManager.VirusManager().addError(e)
예제 #24
0
def reSelectSkill(randomID, mess, dbi):
    try:
        if randomID == '':
            VirusManager.VirusManager().addError('')
        else:
            if mess == '':
                VirusManager.VirusManager().addError('')
            else:
                userid = dbi.usermap.getUserID(randomID)
                dbi.hero.updateTalent(userid, '1|1|1')
                preskill = '0001' + ',' + '0008' + ',' + '0020'
                return '300102' + '|' + '' + '|' + preskill
    except Exception as e:
        VirusManager.VirusManager().addError('')
        VirusManager.VirusManager().addError(e)
예제 #25
0
파일: CombatMatch.py 프로젝트: Hengle/Virus
 def getMatchRandom(self,num):
     try:
         if num=='':
             VirusManager.VirusManager().addError('')
         else:
             cur=dba.dba().excute('select userRandom from combatmatch where playerNumber='+"'"+num+"'")
             randoms=''
             i=0
             for row in cur.fetchall():
                 randoms=randoms+row[0]+','
                 i=i+1
             return randoms+'.'+i
     except Exception as e:
         VirusManager.VirusManager().addError('88888')
         VirusManager.VirusManager().addError(e)
예제 #26
0
파일: HeroConfig.py 프로젝트: Hengle/Virus
 def updateHero(self, heroid, heroatt):
     try:
         if heroid == '':
             VirusManager.VirusManager().addError('50001')
         else:
             if heroatt == '':
                 VirusManager.VirusManager().addError('50002')
             else:
                 cur = dba.dba().excute("update heroconfig set heroAtt="
                                        '+str(heroatt)+'
                                        " where heroID=" + "'" + heroid +
                                        "'")
     except Exception as e:
         VirusManager.VirusManager().addError('55555')
         VirusManager.VirusManager().addError(e)
예제 #27
0
def sendVersionFile(randomID, mess, dbi):
    try:
        if randomID == '':
            VirusManager.VirusManager().addError('15000')
        else:
            if mess == '':
                VirusManager.VirusManager().addError('15001')
            else:
                mes = int(mess)
                filenews = dbi.filetable.getRealFile(mes)
                row = dbi.filetable.readFile(mes)
                file = '200202' + '|' + filenews + '|' + row
                return file
    except Exception as e:
        VirusManager.VirusManager().addError('15999')
        VirusManager.VirusManager().addError(e)
예제 #28
0
파일: fileTable.py 프로젝트: Hengle/Virus
 def readFile(self, id):
     try:
         if id == '':
             VirusManager.VirusManager().addError('100000')
         else:
             file = self.getFile(id)
             fileatt = file.split('|')
             fg = open(fileatt[1] + fileatt[0] + '.' + fileatt[2], 'r')
             row = fg.read()
             return row
             '''f.read(size)参数size表示读取的数量,如果size省略,则表示读所有的内容
              f.readline()读取一行
              f.readlines()读取所有的行到数组里面[line1,line2,...lineN]。在避免将所有文件内容加载到内存中。'''
     except Exception as e:
         VirusManager.VirusManager().addError('101111')
         VirusManager.VirusManager().addError(e)
예제 #29
0
파일: CombatMatch.py 프로젝트: Hengle/Virus
 def getmaxID(self):
     try:
         cur=dba.dba().excute('select Max(id) as id FROM combatmatch')
         for row in cur.fetchall():
             return row[0]
     except Exception as e:
          VirusManager.VirusManager().addError(e)
예제 #30
0
파일: CombatNews.py 프로젝트: Hengle/Virus
 def addNews(self, houseid, news):
     houseid = houseid
     oldNews = self.getNews(houseid)
     try:
         if houseid == '':
             VirusManager.VirusManager().addError('90001')
         else:
             if news == '':
                 VirusManager.VirusManager().addError('90002')
             else:
                 cur = dba.dba().excute('update combatnews set news="' +
                                        oldNews + '|' + news +
                                        '"where houseID=' + "'" + houseid +
                                        "'")
     except Exception as e:
         VirusManager.VirusManager().addError('99999')
         VirusManager.VirusManager().addError(e)