示例#1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                if (Filled && from is ZombieAvatar)
                {
                    var avatar = from as ZombieAvatar;
                    PlayerZombieProfile profile = ZombieEvent.EnsureProfile(avatar.Owner);
                    from.SendMessage(61, "You drink the contents of the crystal flask.");
                    Consume();
                    if (Bad)
                    {
                        from.SendMessage(54, "Whatever was in the flask wasn't the cure.");
                        from.Poison = Poison.Lethal;
                        from.Hits   = 5;
                    }
                    else
                    {
                        from.SendMessage(61, "You are now immune to the Zombie Plague!");
                        from.Hue = 61;
                        ZombieInstance instance = ZombieEvent.GetInstance();
                        if (instance != null)
                        {
                            if (instance.CureWinner == null)
                            {
                                NetState.Instances.Where(ns => ns != null && ns.Mobile is PlayerMobile)
                                .ForEach(
                                    ns =>
                                    ns.Mobile.SendNotification <CureWinner>(
                                        profile.Owner.RawName +
                                        " was the first person to innoculate themselves against the Zombie Plague!",
                                        true, 1.0, 30.0, Color.LawnGreen));

                                instance.CureWinner      = avatar.Owner;
                                profile.OverallScore    += 1500;
                                profile.SpendablePoints += 1500;
                            }
                            else
                            {
                                instance.CureCompleters.Add(avatar.Owner);
                                profile.OverallScore    += 800;
                                profile.SpendablePoints += 800;
                            }
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            base.OnDoubleClick(from);
        }
示例#2
0
        public override void OnDamage(int amount, Mobile @from, bool willKill)
        {
            if (Owner != null)
            {
                PlayerZombieProfile profile = ZombieEvent.EnsureProfile(Owner);
                ZombieInstance      zevent  = ZombieEvent.GetInstance();

                if (zevent != null && profile.LeaveEventTimer != null && profile.LeaveEventTimer.Running)
                {
                    profile.LeaveEventTimer.Stop();
                    SendMessage(54,
                                "Your attempt to leave was interrupted.  Either initate another leave attempt or close and reopen your client to log instantly.");
                }
            }
            base.OnDamage(amount, @from, willKill);
        }
示例#3
0
 public void AwardPoints()
 {
     if (Damagers != null)
     {
         foreach (ZombieAvatar avatar in Damagers.Keys)
         {
             if (avatar.Owner != null)
             {
                 PlayerZombieProfile profile = ZombieEvent.EnsureProfile(avatar.Owner);
                 if (Damagers.ContainsKey(avatar))
                 {
                     profile.DragonBossDamage += Damagers[avatar];
                 }
             }
         }
     }
 }
示例#4
0
        public override void OnNetStateChanged()
        {
            if (NetState == null)
            {
                if (ZombieEvent.GetInstance() != null && Owner != null)
                {
                    var profile = ZombieEvent.EnsureProfile(Owner);

                    profile.DisconnectTime = DateTime.UtcNow;

                    if (profile.Active)
                    {
                        profile.Active = false;
                    }
                }
            }
            base.OnNetStateChanged();
        }
示例#5
0
        public override bool OnBeforeDeath()
        {
            if (Owner != null)
            {
                PlayerZombieProfile profile = ZombieEvent.EnsureProfile(Owner);
                ZombieInstance      zevent  = ZombieEvent.GetInstance();

                if (NetState == null)
                {
                    Blessed                 = true;
                    Hidden                  = true;
                    CantWalk                = true;
                    IgnoreMobiles           = true;
                    profile.ZombieSavePoint = Point3D.Zero;
                }

                if (zevent != null)
                {
                    return(zevent.HandleAvatarDeath(profile, LastKiller));
                }
            }

            return(OnBeforeDeath());
        }
示例#6
0
        public override void DoSpeech(string text, int[] keywords, MessageType type, int hue)
        {
            if ((text.ToLower() == "i don't want to live" || text.ToLower() == "i dont want to live"))
            {
                if (SuicideTimer <= DateTime.UtcNow)
                {
                    SuicideTimer = DateTime.UtcNow + TimeSpan.FromMinutes(1);
                    Kill();
                }
                else
                {
                    SendMessage(54, "You must wait 1 minute between suicides.");
                }
            }

            var wep = Weapon as BaseWeapon;

            if (wep != null && DateTime.UtcNow > ZombieSwingTime)
            {
                switch (text)
                {
                case "!9":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.North);
                    ZombieSwingTime = DateTime.UtcNow +
                                      TimeSpan.FromSeconds(0.6 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                    return;
                }

                case "!6":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.Right);
                    ZombieSwingTime = DateTime.UtcNow +
                                      TimeSpan.FromSeconds(0.6 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                    return;
                }

                case "!3":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.East);
                    ZombieSwingTime = DateTime.UtcNow +
                                      TimeSpan.FromSeconds(0.6 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                    return;
                }

                case "!2":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.Down);
                    ZombieSwingTime = DateTime.UtcNow +
                                      TimeSpan.FromSeconds(0.6 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                    return;
                }

                case "!1":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.South);
                    ZombieSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(0.6 * wep.DamageMax / 24);
                    return;
                }

                case "!4":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.Left);
                    ZombieSwingTime = DateTime.UtcNow +
                                      TimeSpan.FromSeconds(0.6 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                    return;
                }

                case "!7":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.West);
                    ZombieSwingTime = DateTime.UtcNow +
                                      TimeSpan.FromSeconds(0.6 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                    return;
                }

                case "!8":
                {
                    ZombieEvent.ZombieSwingDirection(this, Direction.Up);
                    ZombieSwingTime = DateTime.UtcNow +
                                      TimeSpan.FromSeconds(0.6 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                    return;
                }
                }
            }
            else if ((text == "!2" || text == "!3" || text == "!4" || text == "!1" || text == "!6" || text == "!7" ||
                      text == "!8" || text == "!9") && DateTime.UtcNow <= ZombieSwingTime)
            {
                SendMessage(38, "You fumble your weapon attempting to swing it too quickly.");
                ZombieSwingTime = DateTime.UtcNow +
                                  TimeSpan.FromSeconds(0.8 * Math.Pow(wep.DamageMax / 48.0, 0.5));
                return;
            }

            base.DoSpeech(text, keywords, type, hue);
        }