Ejemplo n.º 1
0
 public override void Push(CStream Stream_)
 {
     Stream_.Pop(ref ID);
     Stream_.Pop(ref PW);
     Stream_.Pop(ref ServerNo);
     {
         Servers.Clear();
         Int32 Cnt = 0;
         Stream_.Pop(ref Cnt);
         for (Int32 i = 0; i < Cnt; ++i)
         {
             SNamePort Value = new SNamePort();
             Stream_.Pop(Value);
             Servers.Add(Value);
         }
     }
     Stream_.Pop(ref LocalDirectory);
     Stream_.Pop(ref RemoteDirectory);
     {
         Commands.Clear();
         Int32 Cnt = 0;
         Stream_.Pop(ref Cnt);
         for (Int32 i = 0; i < Cnt; ++i)
         {
             SCommand Value = new SCommand();
             Stream_.Pop(Value);
             Commands.Add(Value);
         }
     }
 }
Ejemplo n.º 2
0
        public void CEventItemThrow(GSSession session, CEventItemThrow message)
        {
            var plr  = session.Player;
            var inv  = plr.Character.Inventory;
            var item = inv.GetEvent(message.Ipos);

            if (item == null)
            {
                return;
            }

            var bag = (from b in ResourceCache.Instance.GetItemBags()
                       where b.Number == item.Number && (b.Plus == item.Plus || b.Plus == 0xffff)
                       select b).FirstOrDefault();

            _ = session.SendAsync(new SEventItemThrow {
                Result = 1, Pos = message.Ipos
            });
            if (bag != null)
            {
                if (bag.LevelMin <= plr.Character.Level)
                {
                    inv.DeleteEvent(message.Ipos);
                    foreach (var reward in bag.GetReward())
                    {
                        plr.Character.Map.AddItem(message.px, message.py, reward, plr.Character);
                    }
                    var msg = new SCommand(ServerCommandType.Fireworks, (byte)plr.Character.Position.X, (byte)plr.Character.Position.X);
                    _ = plr.Session.SendAsync(msg);
                    plr.SendV2Message(msg);
                }
                else
                {
                    _ = item.Drop(message.px, message.py);
                    return;
                }
            }
            else
            {
                _ = item.Drop(message.px, message.py);
                inv.RemoveEvent(message.Ipos);
            }
        }
Ejemplo n.º 3
0
        static void Main()
        {
            #region Definations
            IBase     _SBase     = new SBase();
            ICommand  _SCommand  = new SCommand(_SBase);
            ILocation _SLocation = new SLocation(_SCommand);
            IRover    _SRover    = new SRover(_SCommand, _SBase, _SLocation);
            IPlateau  _SPlateau  = new SPlateau();
            #endregion

            #region Test Input One
            Plateau plateau = _SPlateau.createPlateau(5, 5);
            Dictionary <Rover, bool> firstRover = _SRover.setRoverLocation(plateau, 1, 2, enumMainDirections.N);

            if (firstRover.FirstOrDefault().Value)
            {
                Dictionary <Rover, bool> firstRoverResponse = _SRover.updateRoverLocation(plateau, firstRover.FirstOrDefault().Key, "LMLMLMLMM");
                _SLocation.roverResultLocation(firstRoverResponse);
            }
            else
            {
                _SCommand.printInvalidLocationOrDirection();
            }
            #endregion

            #region Test Input Two
            Dictionary <Rover, bool> secondRover = _SRover.setRoverLocation(plateau, 3, 3, enumMainDirections.E);
            if (firstRover.FirstOrDefault().Value)
            {
                Dictionary <Rover, bool> secondRoverResponse = _SRover.updateRoverLocation(plateau, secondRover.FirstOrDefault().Key, "MMRMMRMRRM");
                _SLocation.roverResultLocation(secondRoverResponse);
            }
            else
            {
                _SCommand.printInvalidLocationOrDirection();
            }
            #endregion

            Console.ReadLine();
        }
Ejemplo n.º 4
0
 public void Set(SCommand Obj_)
 {
     Name    = Obj_.Name;
     Command = Obj_.Command;
 }
Ejemplo n.º 5
0
 public SCommand(SCommand Obj_)
 {
     Name    = Obj_.Name;
     Command = Obj_.Command;
 }
Ejemplo n.º 6
0
 public CommandItem(SCommand command)
 {
     Command = command;
 }