feat(server): add current world
This commit is contained in:
parent
d33eebdc20
commit
8ee73c70f0
|
@ -1,19 +1,20 @@
|
|||
create table players
|
||||
(
|
||||
name text not null,
|
||||
world int not null,
|
||||
timestamp timestamp with time zone not null,
|
||||
territory int not null,
|
||||
x float not null,
|
||||
y float not null,
|
||||
z float not null,
|
||||
w float not null,
|
||||
customize blob not null,
|
||||
level smallint not null,
|
||||
job int not null,
|
||||
free_company text,
|
||||
current_hp int not null,
|
||||
max_hp int not null,
|
||||
name text not null,
|
||||
world int not null,
|
||||
timestamp timestamp with time zone not null,
|
||||
territory int not null,
|
||||
current_world int not null,
|
||||
x float not null,
|
||||
y float not null,
|
||||
z float not null,
|
||||
w float not null,
|
||||
customize blob not null,
|
||||
level smallint not null,
|
||||
job int not null,
|
||||
free_company text,
|
||||
current_hp int not null,
|
||||
max_hp int not null,
|
||||
|
||||
primary key (name, world)
|
||||
);
|
||||
|
|
|
@ -40,25 +40,27 @@ async fn upload(
|
|||
sqlx::query!(
|
||||
// language=sqlite
|
||||
"
|
||||
insert into players (name, world, timestamp, territory, x, y, z, w, customize, level, job, free_company, current_hp,
|
||||
insert into players (name, world, timestamp, territory, current_world, x, y, z, w, customize, level, job, free_company, current_hp,
|
||||
max_hp)
|
||||
values (?, ?, current_timestamp, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
on conflict (name, world) do update set timestamp = current_timestamp,
|
||||
territory = ?,
|
||||
x = ?,
|
||||
y = ?,
|
||||
z = ?,
|
||||
w = ?,
|
||||
customize = ?,
|
||||
level = ?,
|
||||
job = ?,
|
||||
free_company = ?,
|
||||
current_hp = ?,
|
||||
max_hp = ?
|
||||
values (?, ?, current_timestamp, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
on conflict (name, world) do update set timestamp = current_timestamp,
|
||||
territory = ?,
|
||||
current_world = ?,
|
||||
x = ?,
|
||||
y = ?,
|
||||
z = ?,
|
||||
w = ?,
|
||||
customize = ?,
|
||||
level = ?,
|
||||
job = ?,
|
||||
free_company = ?,
|
||||
current_hp = ?,
|
||||
max_hp = ?
|
||||
",
|
||||
player.name,
|
||||
player.world,
|
||||
data.territory,
|
||||
player.current_world,
|
||||
player.x,
|
||||
player.y,
|
||||
player.z,
|
||||
|
@ -71,6 +73,7 @@ async fn upload(
|
|||
player.max_hp,
|
||||
|
||||
data.territory,
|
||||
player.current_world,
|
||||
player.x,
|
||||
player.y,
|
||||
player.z,
|
||||
|
@ -100,6 +103,7 @@ struct Update {
|
|||
struct PlayerInfo {
|
||||
name: String,
|
||||
world: u32,
|
||||
current_world: u32,
|
||||
x: f32,
|
||||
y: f32,
|
||||
z: f32,
|
||||
|
|
Loading…
Reference in New Issue