This commit is contained in:
afornerot 2024-02-23 22:37:46 +01:00
parent 15fe7fa703
commit e853921fcd
1 changed files with 74 additions and 0 deletions

View File

@ -35,6 +35,18 @@ function onInit() {
rpc.register("getConfig"); rpc.register("getConfig");
rpc.register("upsertConfig"); rpc.register("upsertConfig");
rpc.register("getCard");
rpc.register("upsertCard");
rpc.register("getTile");
rpc.register("upsertTile");
rpc.register("getTiletype");
rpc.register("upsertTiletype");
rpc.register("getTilelevel");
rpc.register("upsertTilelevel");
rpc.register("getPartys"); rpc.register("getPartys");
rpc.register("getPartyswait"); rpc.register("getPartyswait");
rpc.register("getParty"); rpc.register("getParty");
@ -45,6 +57,12 @@ function onInit() {
rpc.register("getPlayer"); rpc.register("getPlayer");
rpc.register("initPlayer"); rpc.register("initPlayer");
rpc.register("upsertPlayer"); rpc.register("upsertPlayer");
rpc.register("getPlayerParty");
rpc.register("upsertlayerParty");
rpc.register("getPlayerPartyTile");
rpc.register("upsertlayerPartyTile");
} }
// Repository Auth // Repository Auth
@ -89,6 +107,27 @@ async function upsertConfig(ctx,config) {
return obj; return obj;
} }
// Repository Card
async function getCard(ctx,id) {
var obj = await store.get(ctx, "Card",id);
if(obj&&!obj.value) obj.value=obj.default;
return obj;
}
async function upsertCard(ctx,card) {
var obj = await store.upsert(ctx, "Card", config);
return obj;
}
rpc.register("getTile");
rpc.register("upsertTile");
rpc.register("getTiletype");
rpc.register("upsertTiletype");
rpc.register("getTilelevel");
rpc.register("upsertTilelevel");
// Repository Party // Repository Party
async function getPartys(ctx) { async function getPartys(ctx) {
var obj = await store.query(ctx, "Party"); var obj = await store.query(ctx, "Party");
@ -145,6 +184,41 @@ async function upsertPlayer(ctx,player) {
return obj; return obj;
} }
// Repository PlayerParty
async function getPlayerParty(ctx,playerid,partyid) {
var obj = await store.query(ctx, "PlayerParty",
{
"and": [
"eq":{ "playerid": playerid },
"eq":{ "partyid": partyid }
]
}
);
return obj;
}
async function upsertPlayerParty(ctx,playerparty) {
var obj = await store.upsert(ctx, "PlayerParty", playerparty);
return obj;
}
// Repository PlayerPartyCase
async function getPlayerPartyTile(ctx,playerid,partyid,Tileid) {
var obj = await store.query(ctx, "PlayerPartyTile",
{
"and": [
"eq":{ "playerid": playerid },
"eq":{ "partyid": partyid },
"eq":{ "tileid": tileid },
]
}
);
return obj;
}
async function upsertPlayerPartyCase(ctx,playerpartycase) {
var obj = await store.upsert(ctx, "PlayerPartyCase", playerpartycase);
return obj;
}
// La fonction "onClientMessage(ctx, message)" est automatiquement // La fonction "onClientMessage(ctx, message)" est automatiquement
// exécutée quand le serveur de votre application reçoit un // exécutée quand le serveur de votre application reçoit un
// message en provenance du client. // message en provenance du client.