Exemplo n.º 1
0
        public static void Request_Entity_ChangePlayfield(IdPlayfieldPositionRotation arg, Action callback = null, Action <ErrorInfo> onError = null)
        {
            Action <CmdId, object> wiredCallback = null;

            if (callback != null)
            {
                wiredCallback = (_, val) => callback();
            }

            var apiCmd = new GenericAPICommand(
                CmdId.Request_Entity_ChangePlayfield,
                arg,
                wiredCallback,
                onError ?? noOpErrorHandler
                );

            Broker.Execute(apiCmd);
        }
Exemplo n.º 2
0
 public async Task <bool> Request_Entity_ChangePlayfield(IdPlayfieldPositionRotation arg, CancellationToken ct)
 {
     return(await Broker.SendRequestAsync(CmdId.Request_Entity_ChangePlayfield, arg, ct));
 }
Exemplo n.º 3
0
 public async Task <bool> Request_Player_ChangePlayerfield(IdPlayfieldPositionRotation arg)
 {
     return(await Broker.SendRequestAsync(CmdId.Request_Player_ChangePlayerfield, arg));
 }
        public void HandleTeleportCommand(ChatInfo data, Dictionary <string, string> args)
        {
            this.Request_Player_Info(new Id(data.playerId), (info) =>
            {
                if (info.permission < (int)PermissionType.GameMaster)
                {
                    MessagePlayer(data.playerId, "You have insufficient permissions to teleport");
                    return;
                }

                var requesterName = playerInfoCache[data.playerId].playerName;

                var targetName      = args["targetName"];
                var destinationName = args["destinationName"];

                var targetPlayerInfo = targetName == "me" ?
                                       info :
                                       VocallyGetCachedPlayerInfoFromName(targetName, data.playerId);

                var destinationPlayerInfo = destinationName == "me" ?
                                            info :
                                            VocallyGetCachedPlayerInfoFromName(destinationName, data.playerId);

                Action execute = () =>
                {
                    var msg = $@"{requesterName} is teleporting you to the location of {destinationPlayerInfo.playerName}";
                    MessagePlayer(targetPlayerInfo.entityId, msg);

                    if (targetPlayerInfo.playfield != destinationPlayerInfo.playfield)
                    {
                        var teleportArg = new IdPlayfieldPositionRotation(
                            targetPlayerInfo.entityId,
                            destinationPlayerInfo.playfield,
                            destinationPlayerInfo.pos,
                            destinationPlayerInfo.rot
                            );

                        this.Request_Player_ChangePlayerfield(teleportArg);
                    }
                    else
                    {
                        var teleportArg = new IdPositionRotation(
                            targetPlayerInfo.entityId,
                            destinationPlayerInfo.pos,
                            destinationPlayerInfo.rot
                            );

                        this.Request_Entity_Teleport(teleportArg);
                    }
                };

                this.Request_Player_Info(new Id(targetPlayerInfo.entityId), (result) =>
                {
                    targetPlayerInfo = result;
                    this.Request_Player_Info(new Id(destinationPlayerInfo.entityId), result2 =>
                    {
                        destinationPlayerInfo = result2;
                        execute();
                    });
                });
            });
        }
Exemplo n.º 5
0
 public void Request_Entity_ChangePlayfield(IdPlayfieldPositionRotation arg, Action callback = null, Action <ErrorInfo> onError = null)
 {
     Broker.Request_Entity_ChangePlayfield(arg, callback, onError);
 }
Exemplo n.º 6
0
 public static Task <object> Request_Entity_ChangePlayfield(IdPlayfieldPositionRotation param)
 {
     return(Broker.CreateCommandWithArgAndReturn <IdPlayfieldPositionRotation, object>(CmdId.Request_Entity_ChangePlayfield, param));
 }
Exemplo n.º 7
0
 public static Task <object> Request_Entity_ChangePlayfield(IdPlayfieldPositionRotation param, Action callback, Action <ErrorInfo> onError = null)
 {
     return(Broker.CreateCommandWithArgAndReturn <IdPlayfieldPositionRotation, object>(CmdId.Request_Entity_ChangePlayfield, param, callback, onError));
 }