This commit is contained in:
Bluzume 2019-09-16 20:11:35 +12:00 committed by GitHub
parent c72d2196d5
commit f481b62cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 11 deletions

View File

@ -40,10 +40,16 @@ def TryUpdate():
cur = c.execute('SELECT Name from users WHERE LastSession=?',(authToken,))
rows = cur.fetchone()
username = rows[0]
if nextRubishSpawnTime == None:
nextRubishSpawnTime = math.floor(time.time()) + 600
c.execute('UPDATE areaList SET NextRubishSpawnTime=? WHERE Name=? and AreaId=?',(nextRubishSpawnTime,username,areaId))
c.execute('UPDATE areaList SET ActualAreaId=? WHERE Name=? and ActualAreaId IS NOT NULL',(areaId,username))
cur = c.execute('SELECT COUNT(1) from areaList WHERE Name=? and AreaId=?',(username,areaId))
rows = cur.fetchone()
count = rows[0]
if count == 0:
c.execute('INSERT INTO areaList VALUES(?,NULL,?,?,NULL)',(username,areaId,nextRubishSpawnTime))
c.execute('UPDATE areaList SET ActualAreaId=? WHERE Name=? and ActualAreaId IS NOT NULL',(areaId,username))
else:
c.execute('UPDATE areaList SET NextRubishSpawnTime=? WHERE Name=? and AreaId=?',(nextRubishSpawnTime,username,areaId))
c.execute('UPDATE areaList SET ActualAreaId=? WHERE Name=? and ActualAreaId IS NOT NULL',(areaId,username))
try:

View File

@ -41,7 +41,7 @@ def TryAdd():
c.execute('DELETE from harvestList where Name=? and AreaId=? and containerName=?',(username,AreaId,ContainerName))
c.execute('INSERT INTO harvestList VAlUES (?,?,NULL,?,NULL,?)',(username,harvestableTemplateId,containerName,AreaId))
c.execute('INSERT INTO harvestList VAlUES (?,?,NULL,?,NULL,?)',(username,HarvestableTemplateId,ContainerName,AreaId))
try:

View File

@ -42,7 +42,14 @@ def TryUpdate():
username = rows[0]
c.execute('UPDATE npcList SET RequestLevel=?,Pool=?, NextTimestamp=? WHERE Name=? AND CharacterId=?',(RequestLevel,Pool,NextTimestamp,username,CharacterId))
cur = c.execute('SELECT COUNT(1) from npcList WHERE Name=? AND CharacterId=?',(username,CharacterId))
rows = cur.fetchone()
count = rows[0]
if count == 0:
c.execute('INSERT INTO npcList VALUES(?,?,?,?,?)',(username,CharacterId,NextTimestamp,Pool,RequestLevel))
else:
c.execute('UPDATE npcList SET RequestLevel=?,Pool=?, NextTimestamp=? WHERE Name=? AND CharacterId=?',(RequestLevel,Pool,NextTimestamp,username,CharacterId))
try:

View File

@ -40,8 +40,13 @@ def TryUpdate():
rows = cur.fetchone()
username = rows[0]
c.execute('UPDATE relationsList SET Level=?,Progress=? WHERE Name=? AND CharacterId=?',(Level,Progress,username,CharacterId))
cur = c.execute('SELECT COUNT(1) from relationsList WHERE Name=? AND CharacterId=?',(username,CharacterId))
rows = cur.fetchone()
count = rows[0]
if count == 0:
c.execute('INSERT INTO relationsList VALUES(?,?,?,?)',(username,CharacterId,Level,Progress))
else:
c.execute('UPDATE relationsList SET Level=?,Progress=? WHERE Name=? AND CharacterId=?',(Level,Progress,username,CharacterId))
try:

View File

@ -38,7 +38,7 @@ def TryRemove():
username = rows[0]
c.execute('DELETE from rubishList WHERE Name=? and Id=?',(username,rubishId))
c.execute('DELETE from rubishList WHERE Name=? and Id=?',(username,Id))
return 0

View File

@ -39,8 +39,14 @@ def TryUpdate():
cur = c.execute('SELECT Name from users WHERE LastSession=?',(authToken,))
rows = cur.fetchone()
username = rows[0]
c.execute('UPDATE scenario SET CustomData=?,StepId=? WHERE Name=? AND ScenarioId=?',(CustomData,StepId,username,ScenarioId))
cur = c.execute('SELECT COUNT(1) from scenario WHERE Name=? AND ScenarioId=?',(username,ScenarioId))
rows = cur.fetchone()
count = rows[0]
if count == 0:
c.execute('INSERT INTO scenario VALUES(?,?,?,?,0)',(username,ScenarioId,CustomData,StepId))
else:
c.execute('UPDATE scenario SET CustomData=?,StepId=? WHERE Name=? AND ScenarioId=?',(CustomData,StepId,username,ScenarioId))
try: