/////////// Private ///////////
        private void ReceiveAndProcessPlayerPackets(Characters.Player plr)
        {
            return;

            /*
             * Packet p = null;
             * while ((p = plr.GetPacket()) != null)
             * {
             *  switch ((ClientToInstancePackets.PacketType)p.Type)
             *  {
             *      case (ClientToInstancePackets.PacketType.Player_MovementRequest_i):
             *          {
             *              ClientToInstancePackets.Player_MovementRequest_i pp = p as ClientToInstancePackets.Player_MovementRequest_i;
             *
             *              MovePoint[] mps = map.CalculatePath(plr.Position, new Position2D(pp.posx, pp.posy));
             *              if (mps.Length > 0)
             *                  plr.SetMovePointsPath(mps);
             *          }
             *          break;
             *
             *      default:
             *          Log.Log("Received invalid packet from player: " + plr.Info.Name);
             *          plr.SendPacket(new ClientToInstancePackets.Error_c(ClientToInstancePackets.Error_c.ErrorCode.InvalidPacket));
             *          break;
             *  }
             * }
             */
        }
예제 #2
0
 public override bool execute(Characters.Player player)
 {
     if (this.hasSecondWord())
     {
         player.outputMessage("\nKeep calm and carry on" + this.secondWord);
     }
     return(false);
 }
예제 #3
0
 public override bool execute(Characters.Player player)
 {
     if (this.hasSecondWord())
     {
         player.outputMessage("\nI cannot quit " + this.secondWord);
     }
     return(false);
 }
        private void RemovePlayer(Characters.Player p)
        {
            p.RemoveSeenByAllOther();

            allCharacters.Remove(p);
            players.Remove(p);
            Log.Log("Player left instance. [" + p.Info.Name + "]");
        }
 public override bool execute(Characters.Player player)
 {
     if (this.hasSecondWord())
     {
         player.outputMessage("\n>.< wasn't able to find it" + this.secondWord);
     }
     return(false);
 }
예제 #6
0
        public override bool execute(Characters.Player player)
        {
            if (this.hasSecondWord())
            {
                try
                {
                    int        values = Convert.ToInt32(this.secondWord);
                    TextReader logs   = new StreamReader("PathLog.txt");
                    ArrayList  temp   = new ArrayList();
                    foreach (var i in logs.ReadLine())
                    {
                        temp.Add(i);
                    }

                    if (values > temp.Count)
                    {
                        values = temp.Count;
                    }
                    for (int i = values; i > 0; i--)
                    {
                        var x = temp[i];
                        if (x == "west")
                        {
                            x = "east";
                        }
                        else if (x == "east")
                        {
                            x = "west";
                        }
                        else if (x == "north")
                        {
                            x = "south";
                        }
                        else if (x == "south")
                        {
                            x = "north";
                        }

                        Command command = "go" + (string)x;  //parser.parseCommand(Console.ReadLine());
                        temp.RemoveAt(i);
                    }

                    player.outputMessage("\nI cannot backup " + this.secondWord);
                }
                catch
                {
                    Console.WriteLine("Your not aloud to do that please continue");
                }
            }
            else
            {
                player.outputMessage("\n How far to return to the past?");
            }

            return(false);
        }
        public void AddPlayerToInstance(Characters.Player p, Position2D position = null)
        {
            if (position != null)
            {
                p.Position.Set(position);
            }

            this.Invoke(() =>
            {
                this.AddPlayer(p);
            });
        }
예제 #8
0
 public override bool execute(Characters.Player player)
 {
     if (this.hasSecondWord())
     {
         player.outputMessage("\n >.< You tried, but wasn't able to find it" + this.secondWord);
     }
     else
     {
         player.outputMessage("\n You wheren't able to find anything");
     }
     return(false);
 }
 private void UpdatePlayerMapView(Characters.Player p)
 {
     //Give whole map for now
     Single[,] block;
     for (int i = 0; i < map.Terrain.NumBlocksX; i++)
     {
         for (int j = 0; j < map.Terrain.NumBlocksY; j++)
         {
             block = map.Terrain.GetBlock(i, j);
             p.SendPacket(new ClientToInstancePackets.Map_TerrainBlock_c(i, j, block));
         }
     }
 }
예제 #10
0
 public bool execute(Characters.Player player)
 {
     if (this.hasSecondWord())
     {
         player.waltTo(this.secondWord);
         string[] X = new string[1];
         X[0] = this.secondWord;
         File.AppendAllLines("PathLog.txt", X);
     }
     else
     {
         player.outputMessage("\nGo Where?");
     }
     return(false);
 }
예제 #11
0
        public bool execute(Characters.Player player)
        {
            bool answer = true;

            if (this.hasThirdWord())
            {
                player.outputMessage("\nI cannot quit " + this.secondWord + ' ' + this.thirdWord);
                answer = false;
            }
            else if (this.hasSecondWord())
            {
                player.outputMessage("\nI cannot quit " + this.secondWord);
                answer = false;
            }

            return(answer); // if the bool = true the program quits
        }
        private void AddPlayer(Characters.Player p)
        {
            p.SetID(NextCharacterID);

            allCharacters.Add(p);
            players.Add(p);

            p.SendPacket(new ClientToInstancePackets.Map_Reset_c(map.Terrain.NumBlocksX, map.Terrain.NumBlocksY));
            p.SendPacket(new ClientToInstancePackets.Character_Add_c(p.Id, CharacterType.Player, p.Info.Name));
            p.SendPacket(new ClientToInstancePackets.Character_Position_c(p.Id, p.Position.x, p.Position.y));
            p.SendPacket(new ClientToInstancePackets.Player_SetControl_c(p.Id));
            p.SendPacket(new ClientToInstancePackets.Character_UpdateStats_c(p.Id, p.Stats));

            UpdatePlayerMapView(p);
            UpdateCharacterView(p);

            Log.Log("Player joined instance. [" + p.Info.Name + "]");
        }
예제 #13
0
 /*
  * public int hasTime()
  * {
  *  return _Time;
  * }
  */
 public abstract bool execute(Characters.Player player);