add function tile, tilelevel

This commit is contained in:
Rudy Masson 2024-02-23 23:05:35 +01:00
parent e853921fcd
commit bae336b31b
1 changed files with 55 additions and 8 deletions

View File

@ -37,15 +37,19 @@ function onInit() {
rpc.register("getCard"); rpc.register("getCard");
rpc.register("upsertCard"); rpc.register("upsertCard");
rpc.register("initCard");
rpc.register("getTile"); rpc.register("getTile");
rpc.register("upsertTile"); rpc.register("upsertTile");
rpc.register("initTile");
rpc.register("getTiletype"); rpc.register("getTiletype");
rpc.register("upsertTiletype"); rpc.register("upsertTiletype");
rpc.register("initTiletype");
rpc.register("getTilelevel"); rpc.register("getTilelevel");
rpc.register("upsertTilelevel"); rpc.register("upsertTilelevel");
rpc.register("initTilelevel");
rpc.register("getPartys"); rpc.register("getPartys");
rpc.register("getPartyswait"); rpc.register("getPartyswait");
@ -117,16 +121,59 @@ async function upsertCard(ctx,card) {
var obj = await store.upsert(ctx, "Card", config); var obj = await store.upsert(ctx, "Card", config);
return obj; return obj;
} }
function initCard(ctx,card) {
var obj = store.get(ctx, "Card",card._id);
if(obj) card.value=obj.value;
var obj = store.upsert(ctx, "Card", card);
return obj;
}
// Repository Tile
async function getTile(ctx,id) {
var obj = await store.get(ctx, "Tile",id);
if(obj&&!obj.value) obj.value=obj.default;
return obj;
}
async function upsertTile(ctx,card) {
var obj = await store.upsert(ctx, "Tile", config);
return obj;
}
function initTile(ctx,tile) {
var obj = store.get(ctx, "Tile",tile._id);
if(obj) tile.value=obj.value;
var obj = store.upsert(ctx, "Tile", tile);
}
rpc.register("getTile"); // Repository TileType
rpc.register("upsertTile"); async function getTiletype(ctx,id) {
var obj = await store.get(ctx, "Tiletype",id);
rpc.register("getTiletype"); if(obj&&!obj.value) obj.value=obj.default;
rpc.register("upsertTiletype"); return obj;
}
rpc.register("getTilelevel"); async function upsertTiletype(ctx,card) {
rpc.register("upsertTilelevel"); var obj = await store.upsert(ctx, "Tiletype", config);
return obj;
}
function initTiletype(ctx,tiletype) {
var obj = store.get(ctx, "Tiletype",tiletype._id);
if(obj) tiletype.value=obj.value;
var obj = store.upsert(ctx, "Tiletype", tiletype);
}
// Repository Tilelevel
async function getTilelevel(ctx,id) {
var obj = await store.get(ctx, "Tilelevel",id);
if(obj&&!obj.value) obj.value=obj.default;
return obj;
}
async function upsertTilelevel(ctx,card) {
var obj = await store.upsert(ctx, "Tilelevel", config);
return obj;
}
function initTilelevel(ctx,tilelevel) {
var obj = store.get(ctx, "Tilelevel",tilelevel._id);
if(obj) tilelevel.value=obj.value;
var obj = store.upsert(ctx, "Tilelevel", tilelevel);
}
// Repository Party // Repository Party
async function getPartys(ctx) { async function getPartys(ctx) {