Esempio n. 1
0
        private static void HandleDropFlag(NetworkMessage msg)
        {
            MsgDropFlag df = msg as MsgDropFlag;

            WriteLine("MsgDropFlag " + df.PlayerID.ToString());
            WriteLine("\tFlagID " + df.FlagID.ToString());
        }
Esempio n. 2
0
        private void HandleDropFlag(NetworkMessage msg)
        {
            MsgDropFlag df = msg as MsgDropFlag;

            var          owner = PlayerList.GetPlayerByID(df.PlayerID);
            FlagInstance flag  = FindFlagByID(df.FlagID);

            if (owner != null)
            {
                owner.SetFlag(null);
            }

            if (flag != null)
            {
                flag.Owner  = null;
                flag.Status = FlagStatuses.FlagInAir;
                if (owner != null)
                {
                    flag.CurrentPosition = owner.Position;
                }

                if (FlagDropped != null)
                {
                    FlagDropped.Invoke(this, flag);
                }
            }
        }
Esempio n. 3
0
        internal void HandleDropFlag(ServerPlayer player, MsgDropFlag message)
        {
            if (message == null)
            {
                return;
            }

            if (player.Info.CariedFlag == null)
            {
                return;
            }

            player.Info.CariedFlag.Position = message.Postion;

            DropFlag(player);
        }
Esempio n. 4
0
        public void DropFlag(ServerPlayer player)
        {
            if (player == null || player.Info.CariedFlag == null)
            {
                return;
            }

            if (player.Info.CariedFlag.Flag == FlagTypeList.Identify)
            {
                player.SendMessage(new MsgNearFlag());  // send them an empty ID message to clear out the display
            }
            FlagInstance flag = player.Info.CariedFlag;

            ComputeFlagDrop?.Invoke(player, flag);

            MsgDropFlag drop = new MsgDropFlag();

            drop.FlagID   = flag.FlagID;
            drop.PlayerID = player.PlayerID;
            drop.Data     = flag;

            player.Info.CariedFlag = null;
            flag.Owner             = null;

            Players.SendToAll(drop, false);

            lock (CarriedFlags)
            {
                if (CarriedFlags.ContainsKey(flag.FlagID))
                {
                    CarriedFlags.Remove(flag.FlagID);
                }
            }

            lock (WorldFlags)
                WorldFlags.Add(flag.FlagID, flag);

            FlagDropped?.Invoke(this, flag);
        }