Exemplo n.º 1
0
        public void Action(Player Player, string[] cmd)
        {
            Player.X = int.Parse(cmd[2]);
            Player.Y = int.Parse(cmd[3]);

            Player.Map.SendToAll(cmd[0] + "|" + cmd[1] + "|" + cmd[2] + "|" + cmd[3]);
        }
Exemplo n.º 2
0
        public void Action(Player Player, string[] cmd)
        {
            switch (cmd[0])
            {
                case MsgC.GetID:
                    Player.WriteS.Write(MsgS.SetID + "|" + Player.Index.ToString());
                    Player.WriteS.Write(MsgS.MapSetting + "|" + Setting.Map.MaxX.ToString() + "|" + Setting.Map.MaxY.ToString() + "|" + Setting.Map.MaxPlayers.ToString());

                    Player.X = Setting.Position.Pos[Player.Index, 0];
                    Player.Y = Setting.Position.Pos[Player.Index, 1];

                    Player.Map.SendToAll(
                        MsgS.Join + "|" + Player.Index.ToString() + "|" + Player.X.ToString() + "|" +
                                Player.Y.ToString(), Player.Index
                    );

                    for (int i = 0; i < Player.Index && i != Player.Index; i++)
                    {
                        Player.WriteS.Write(
                            MsgS.Move + "|" + i.ToString() + "|" + Player.Map.Players[i].X.ToString() + "|" +
                                Player.Map.Players[i].Y.ToString()
                        );
                    }

                break;
                case MsgC.SetNick:

                    int Index = 0;

                    try
                    {
                        Index = int.Parse(cmd[1]);
                    }
                    catch (FormatException fe)
                    {
                        Log.Error(fe.Message);
                        return;
                    }

                    Player.Nick = cmd[2];

                    Player.Map.SendToAll(MsgS.GetNick + "|" + Index.ToString() + "|" + Player.Nick, Index);

                    for (int i = 0; i < Player.Map.Index && i != Player.Index; i++)
                    {
                            Player.WriteS.Write(MsgS.GetNick + "|" + i.ToString() + "|" +
                                Player.Map.Players[i].Nick);
                    }

                    Player.WriteS.Write(MsgS.Move + "|" + Index.ToString() + "|" + Player.X.ToString() + "|" +
                        Player.Y.ToString());

                    break;

            }
        }
Exemplo n.º 3
0
 public TimeObject(Player Player, string[] Cmd, int Time)
 {
     this.Cmd = Cmd;
     this.Time = Time;
     this.Player = Player;
 }