async def remove_initiative_effect(sid: str, data: ServerInitiativeEffectActor): pr: PlayerRoom = game_state.get(sid) if not has_ownership(Shape.get_or_none(uuid=data["actor"]), pr): logger.warning( f"{pr.player.name} attempted to remove an initiative effect") return with db.atomic(): effect = InitiativeEffect.get(uuid=data["effect"]["uuid"]) effect.delete_instance() await sio.emit( "Initiative.Effect.Remove", data, room=pr.active_location.get_path(), skip_sid=sid, namespace=GAME_NS, )
async def update_initiative_effect(sid: int, data: Dict[str, Any]): pr: PlayerRoom = game_state.get(sid) if not has_ownership(Shape.get_or_none(uuid=data["actor"]), pr): logger.warning( f"{pr.player.name} attempted to update an initiative effect") return with db.atomic(): effect = InitiativeEffect.get(uuid=data["effect"]["uuid"]) update_model_from_dict( effect, reduce_data_to_model(InitiativeEffect, data["effect"])) effect.save() await sio.emit( "Initiative.Effect.Update", data, room=pr.active_location.get_path(), skip_sid=sid, namespace=GAME_NS, )
async def update_initiative_effect(sid, data): sid_data = state.sid_map[sid] user = sid_data["user"] room = sid_data["room"] location = sid_data["location"] if room.creator != user and not ShapeOwner.get_or_none(shape=shape, user=user): logger.warning(f"{user.name} attempted to update an initiative effect") return with db.atomic(): effect = InitiativeEffect.get(uuid=data["effect"]["uuid"]) update_model_from_dict( effect, reduce_data_to_model(InitiativeEffect, data["effect"])) effect.save() await sio.emit( "Initiative.Effect.Update", data, room=location.get_path(), skip_sid=sid, namespace="/planarally", )