Example #1
0
        private void OnHold(ClickFlag flag)
        {
            for (int i = 0; i < 2; i++)
            {
                foreach (Player plr in Players[i])
                {
                    if (plr == null || plr.IsDisposed || !plr.IsInWorld())
                    {
                        continue;
                    }

                    flag.SendFlagInfo(plr);
                    flag.SendMeTo(plr);
                    if (_glowObject != null)
                    {
                        _glowObject.VfxState = (byte)flag.HoldOwner;
                    }
                }
            }
        }
        private void OnCaptured(ClickFlag flag)
        {
            flag.GlowOwner = flag.Owner;
            EvtInterface.RemoveEvent(Lock);
            for (int i = 0; i < 2; i++)
            {
                foreach (Player plr in Players[i])
                {
                    if (plr == null || plr.IsDisposed || !plr.IsInWorld())
                    {
                        continue;
                    }

                    flag.SendFlagInfo(plr);
                    flag.SendFlagState(plr);
                    flag.SendMeTo(plr);
                }
            }

            if (flag.Owner == (int)Realms.REALMS_REALM_ORDER)
            {
                PlaySoundToAll(580);
            }
            else if (flag.Owner == (int)Realms.REALMS_REALM_DESTRUCTION)
            {
                PlaySoundToAll(818);
            }


            if (Flags[0].Owner == Flags[1].Owner)
            {
                Broadcast(new[] { (Flags[0].Owner == (int)Realms.REALMS_REALM_ORDER ? "Order" : "Destruction") + " will lock down both control points in 15 seconds!" },
                          ChatLogFilters.CHATLOGFILTERS_C_WHITE, Localized_text.CHAT_TAG_DEFAULT);
                EvtInterface.AddEvent(Lock, 15000, 1);
            }
        }
Example #3
0
        private void OnCaptured(ClickFlag flag)
        {
            for (int i = 0; i < 2; i++)
            {
                foreach (Player plr in Players[i])
                {
                    if (plr == null || plr.IsDisposed || !plr.IsInWorld())
                    {
                        continue;
                    }

                    flag.SendFlagInfo(plr);
                    flag.SendFlagState(plr);
                    flag.SendMeTo(plr);
                }
            }

            if (flag.Owner == 0)
            {
                return; // Nothing to do, probably a canceled capture
            }
            GivePoints(flag.Owner, flag.CapturePoints);
            int index = Flags.IndexOf(flag);

            //leave the last flag open for capture
            if (index == 0 || index == Flags.Count - 1)
            {
                flag.Open = true;
            }
            else
            {
                flag.Open = false;
            }

            //unlock foward flag
            if (flag.Owner == 1)
            {
                for (int i = index + 1; i < Flags.Count; i++)
                {
                    Flags[i].Open      = true;
                    CurrentFlag        = Flags[i];
                    Flags[i].HoldOwner = 0;
                    Flags[i].Owner     = 0;
                    break;
                }
            }
            else if (flag.Owner == 2)
            {
                for (int i = index - 1; i >= 0; i--)
                {
                    Flags[i].Open      = true;
                    CurrentFlag        = Flags[i];
                    Flags[i].HoldOwner = 0;
                    Flags[i].Owner     = 0;
                    break;
                }
            }

            CreateGlow(CurrentFlag);

            string packetString =
                $"{flag.ObjectiveName} is now {(flag.Owner == 1 ? "Order" : "Destruction")} controlled!";

            for (int i = 0; i < 2; i++)
            {
                foreach (Player plr in Players[i])
                {
                    SendObjectiveStates(plr);
                    CurrentFlag.SendMeTo(plr);
                    plr.SendLocalizeString(packetString, SystemData.ChatLogFilters.CHATLOGFILTERS_C_WHITE, Localized_text.CHAT_TAG_DEFAULT);
                }
            }
        }