Пример #1
0
        public ZombieEventUI(PlayerMobile user, ZombieAvatar avatar, ZombieInstance zevent = null, PlayerZombieProfile zprofile = null,
                             Action <GumpButton> onAccept = null, Action <GumpButton> onCancel = null)
            : base(user, null, 0, 0)
        {
            CanDispose     = true;
            CanMove        = true;
            Modal          = false;
            ForceRecompile = true;

            AcceptHandler = onAccept;
            CancelHandler = onCancel;

            CanSearch = true;

            EntriesPerPage = 11;

            SelectedProfile = zprofile;
            ZEvent          = zevent;
            Avatar          = avatar;

            UserProfile = ZombieEvent.EnsureProfile(user);

            AutoRefreshRate = TimeSpan.FromSeconds(60);
            AutoRefresh     = true;
        }
Пример #2
0
 public void DetermineBuryLocation(ZombieAvatar pm, object target, IEntity cache)
 {
     if (target is LandTarget)
     {
         var loc  = ((LandTarget)target).Location;
         var list = loc.GetEntitiesInRange(Map.ZombieLand, 3);
         if (list.Exists(x => x is CacheChest && ((CacheChest)x).Buried))
         {
             pm.SendMessage(54, "You cannot bury a cache here.  There is one already present in this location!  Try to dig it up first.");
         }
         else if (DigTimer == null || !DigTimer.Running)
         {
             var chest = cache as CacheChest;
             if (chest != null)
             {
                 pm.PublicOverheadMessage(MessageType.Label, pm.SpeechHue, true, "*Begins to bury a cache*");
                 chest.MoveToWorld(loc, Map.ZombieLand);
                 DigTimer = new InternalBuryTimer(chest, pm);
                 DigTimer.Start();
                 pm.Frozen = true;
             }
         }
         else
         {
             pm.SendMessage(54, "You are already digging with this shovel!");
         }
     }
 }
Пример #3
0
        public ZombieAvatar CreateAvatar()
        {
            var mob = new ZombieAvatar(Owner);

            mob.Name             = Owner.RawName;
            mob.Hue              = Owner.Hue;
            mob.FacialHairItemID = Owner.FacialHairItemID;
            mob.HairItemID       = Owner.HairItemID;
            mob.HairHue          = Owner.HairHue;
            mob.BodyValue        = Owner.BodyValue;
            mob.RawStr           = 45;
            mob.RawInt           = 35;
            mob.RawDex           = 35;
            mob.Hits             = 60;
            mob.Stam             = 35;
            mob.Mana             = 35;
            mob.SkillsCap        = 50000;
            mob.StatCap          = 225;


            mob.Skills.Anatomy.Base       = 35;
            mob.Skills.Macing.Base        = 35;
            mob.Skills.Swords.Base        = 35;
            mob.Skills.Archery.Base       = 35;
            mob.Skills.MagicResist.Base   = 35;
            mob.Skills.Wrestling.Base     = 35;
            mob.Skills.Fencing.Base       = 35;
            mob.Skills.Poisoning.Base     = 40;
            mob.Skills.ItemID.Base        = 25;
            mob.Skills.ArmsLore.Base      = 25;
            mob.Skills.Alchemy.Base       = 40;
            mob.Skills.Parry.Base         = 10;
            mob.Skills.Blacksmith.Base    = 40;
            mob.Skills.Fletching.Base     = 25;
            mob.Skills.Peacemaking.Base   = 40;
            mob.Skills.Camping.Base       = 40;
            mob.Skills.Carpentry.Base     = 40;
            mob.Skills.Cartography.Base   = 40;
            mob.Skills.Cooking.Base       = 40;
            mob.Skills.EvalInt.Base       = 35;
            mob.Skills.Healing.Base       = 40;
            mob.Skills.Forensics.Base     = 40;
            mob.Skills.Inscribe.Base      = 35;
            mob.Skills.Lockpicking.Base   = 40;
            mob.Skills.Magery.Base        = 35;
            mob.Skills.Tactics.Base       = 35;
            mob.Skills.Tinkering.Base     = 45;
            mob.Skills.Lumberjacking.Base = 40;
            mob.Skills.Mining.Base        = 25;
            mob.Skills.Meditation.Base    = 35;
            mob.Skills.RemoveTrap.Base    = 40;
            ZombieAvatar = mob;

            return(mob);
        }
Пример #4
0
        public void HandleMobDeath(BaseCreature mob, ZombieAvatar avatar)
        {
            if (mob is ZombieZEvent)
            {
                _ZombiesLoc1.Remove(mob);
                _ZombiesLoc2.Remove(mob);
                _ZombiesLoc3.Remove(mob);
                _ZombiesLoc4.Remove(mob);
            }
            else if (mob is DaemonZombieEvent)
            {
                Daemons.Remove(mob);
            }
            else if (mob is TreeFellow)
            {
                TreeFellows.Remove(mob);
            }
            else if (mob is ZombieSpider)
            {
                ZombieSpiders.Remove(mob);
            }
            else if (mob is FeyWarrior)
            {
                FeyWarriors.Remove(mob);
            }
            else if (mob is Vitriol)
            {
                FeyWarriors.Remove(mob);
            }
            else if (mob is Bird)
            {
                FeyWarriors.Remove(mob);
            }
            else if (mob is HorrifyingTentacle)
            {
                HorrifyingTentacles.Remove(mob);
            }
            else if (mob is GoreFiendZombieEvent)
            {
                GoreFiends.Remove(mob);
            }

            if (avatar.Owner != null)
            {
                PlayerZombieProfile profile = ZombieEvent.EnsureProfile(avatar.Owner);
                profile.AddKill(mob);
            }
        }
Пример #5
0
        public void DetermineTarget(ZombieAvatar pm, object target)
        {
            IEntity targetedEntity = target as IEntity;

            if (targetedEntity is CacheChest)
            {
                pm.SendMessage(54, "Where do you wish to bury this cache chest?");
                pm.Target = new GenericSelectTarget <object>((m, t) => DetermineBuryLocation(pm, t, targetedEntity), m => { }, -1, true, TargetFlags.None);
                return;
            }
            if (target is LandTarget)
            {
                var tile = ((LandTarget)target);
                if (!Mining.m_MountainAndCaveTiles.Contains(tile.TileID))
                {
                    pm.PlaySound(Utility.RandomList(0x126));
                    pm.Animate(11, 5, 1, true, false, 0);
                    pm.PublicOverheadMessage(MessageType.Label, pm.SpeechHue, true, "*Begins to dig*");
                    var list = tile.Location.GetEntitiesInRange(Map.ZombieLand, 3);
                    if (list.Exists(x => x is CacheChest && ((CacheChest)x).Buried))
                    {
                        pm.SendMessage(54, "You have found a cache!");
                        var chest = list.First(x => x is CacheChest) as CacheChest;
                        if (chest != null)
                        {
                            DigTimer = new InternalDigTimer(chest, pm);
                            DigTimer.Start();
                            pm.Frozen = true;
                        }
                        return;
                    }
                    pm.SendMessage(54, "There is nothing of note in this location.");
                }
                else
                {
                    if (!HarvestSystem.CheckHarvest(pm, this))
                    {
                        return;
                    }

                    DoHarvest(pm, target);
                }
            }
        }
Пример #6
0
        public bool HandleAvatarDeath(PlayerZombieProfile profile, Mobile lastkiller)
        {
            ZombieAvatar avatar = profile.ZombieAvatar;

            profile.Deaths++;

            if (lastkiller is ZombieAvatar)
            {
                var enemyavatar = lastkiller as ZombieAvatar;
                if (enemyavatar.Owner != null)
                {
                    PlayerZombieProfile enemyprofile = ZombieEvent.EnsureProfile(enemyavatar.Owner);
                    enemyprofile.Kills++;
                }
            }

            Effects.SendIndividualFlashEffect(avatar, FlashType.LightFlash);
            avatar.DropHolding();

            var corpse = CreatePlayerCorpse(avatar) as Corpse;

            if (corpse != null)
            {
                Effects.PlaySound(avatar, avatar.Map, avatar.GetDeathSound());
                ZombieEvent.ZombieDeathAnim(avatar, corpse);
                corpse.MoveToWorld(avatar.Location, Map.ZombieLand);
            }

            avatar.MoveToWorld(GetRandomLocation(), Map.ZombieLand);

            if (avatar.Backpack != null)
            {
                avatar.EquipItem(new Dagger {
                    Speed = 1
                });
                avatar.Backpack.DropItem(new Bandage(7));
                ZombieEvent.RandomClothing(avatar);
            }
            avatar.Hits   = avatar.HitsMax;
            avatar.Stam   = avatar.StamMax;
            avatar.Poison = null;

            return(false);
        }
Пример #7
0
        public ZombieClueGiverUI(
            PlayerMobile user, ZombieAvatar avatar,
            string title = null,
            string html  = null,
            Gump parent  = null,
            int?x        = null,
            int?y        = null,
            Action <GumpButton> onAccept = null)
            : base(user, parent, 0, 0, title, null, 0, onAccept)
        {
            Title    = title;
            CanMove  = true;
            Closable = true;
            Modal    = false;

            HTML = html;

            Avatar = avatar;
        }
Пример #8
0
        public void JoinZombieInstance(PlayerMobile player)
        {
            PlayerZombieProfile profile = ZombieEvent.EnsureProfile(player);
            ZombieAvatar        avatar  = profile.ZombieAvatar;

            profile.Active = true;
            if (avatar == null)
            {
                avatar = profile.CreateAvatar();
            }

            if (profile.ZombieSavePoint == Point3D.Zero && avatar != null &&
                DateTime.UtcNow > (profile.DisconnectTime + TimeSpan.FromMinutes(2)))
            {
                if (avatar.Backpack != null && avatar.Items.Count <= 1)
                {
                    avatar.EquipItem(new Dagger {
                        Speed = 1
                    });
                    avatar.Backpack.DropItem(new Bandage(7));
                    ZombieEvent.RandomClothing(avatar);
                }
                avatar.MoveToWorld(GetRandomLocation(), Map.ZombieLand);
            }

            CreaturePossession.ForcePossessCreature(null, player, avatar);

            if (avatar != null)
            {
                avatar.Blessed       = false;
                avatar.Hidden        = false;
                avatar.IgnoreMobiles = false;
                avatar.CantWalk      = false;
            }

            player.LogoutLocation = player.Location;
            player.Map            = Map.Internal;
            player.LogoutMap      = Map.Felucca;
        }
Пример #9
0
        public void DoHarvest(ZombieAvatar pm, object targeted)
        {
            IEntity targetedEntity = targeted as IEntity;

            if (XmlScript.HasTrigger(targetedEntity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(targetedEntity, pm, TriggerName.onTargeted, this))
            {
                return;
            }

            CustomRegion customRegion = pm.Region as CustomRegion;

            if (customRegion != null && customRegion.Controller != null)
            {
                SkillName skill = SkillName.Spellweaving; // placeholder
                if (HarvestSystem is Mining)
                {
                    skill = SkillName.Mining;
                }

                if (customRegion.Controller.IsRestrictedSkill((int)skill))
                {
                    pm.SendMessage("You cannot use that skill here.");
                    return;
                }
            }

            //conquest skill check
            Skill tskill = null;

            if (HarvestSystem is Mining)
            {
                tskill = pm.Skills[SkillName.Mining];
            }

            HarvestSystem.StartHarvesting(pm, this, targeted);
        }
Пример #10
0
        private static void CSInvoke()
        {
            CommandUtility.Register(
                "Zombieland",
                AccessLevel.Player,
                e =>
            {
                PlayerMobile player = null;
                ZombieAvatar avatar = null;
                if (e.Mobile is PlayerMobile)
                {
                    player = e.Mobile as PlayerMobile;
                }
                else if (e.Mobile is ZombieAvatar)
                {
                    avatar = e.Mobile as ZombieAvatar;
                    if (avatar.Owner != null)
                    {
                        player = ((ZombieAvatar)e.Mobile).Owner;
                    }
                }
                if (player != null)
                {
                    PlayerZombieProfile profile = EnsureProfile(player);
                    ZombieInstance instance     = GetInstance();
                    if (instance != null || player.AccessLevel >= AccessLevel.GameMaster)
                    {
                        new ZombieEventUI(player, e.Mobile as ZombieAvatar, instance, profile).Send();
                    }
                    else
                    {
                        player.SendMessage(54, "Zombieland is currently inactive.");
                    }
                }
            });

            CommandUtility.Register(
                "ZombieRewards",
                AccessLevel.Player,
                e =>
            {
                PlayerMobile player = null;
                if (e.Mobile is PlayerMobile)
                {
                    player = e.Mobile as PlayerMobile;
                }
                else if (e.Mobile is ZombieAvatar)
                {
                    e.Mobile.SendMessage(54, "You can only claim prizes in your player form!");
                    return;
                }
                if (player != null)
                {
                    PlayerZombieProfile profile = EnsureProfile(player);
                    new ZombieEventRewardsUI(player, profile).Send();
                }
            });

            CommandUtility.Register(
                "RecalculatePoints",
                AccessLevel.Developer,
                e =>
            {
                foreach (PlayerZombieProfile playerZombieProfile in PlayerProfiles.Values)
                {
                    playerZombieProfile.RecalculatePoints();
                }
            });

            CommandUtility.Register(
                "FixInstance",
                AccessLevel.Developer,
                e =>
            {
                PlayerZombieProfile profile = PlayerProfiles.Values.FirstOrDefault(x => x.OverallScore >= 1);
                var instance = new ZombieInstance(profile.ZombieKills.Keys.FirstOrDefault());
                ZombieEvents.Add(instance.Uid, instance);
                instance.init();
            });

            CommandUtility.Register(
                "ZombieRespawn",
                AccessLevel.Developer,
                e =>
            {
                ZombieInstance instance = GetInstance();
                instance.RespawnEvent();
            });

            CommandUtility.Register(
                "ZombiePause",
                AccessLevel.Developer,
                e =>
            {
                ZombieInstance instance = GetInstance();
                if (instance != null)
                {
                    PauseEvent();
                }
            });

            CommandUtility.Register(
                "ZombieUnpause",
                AccessLevel.Developer,
                e =>
            {
                ZombieInstance instance = GetPausedInstance();
                if (instance != null)
                {
                    UnpauseEvent();
                }
            });

            CommandUtility.Register(
                "ResetZombieScore",
                AccessLevel.Developer,
                e =>
            {
                if (!(e.Mobile is PlayerMobile))
                {
                    return;
                }

                if (e.Arguments.Length < 1)
                {
                    e.Mobile.SendMessage(0x22, "Format: <PlayerName>");
                    return;
                }

                string name = e.Arguments[0];

                Mobile mobile =
                    World.Mobiles.Values.FirstOrDefault(x => x.RawName == name && x is PlayerMobile);
                if (mobile is PlayerMobile)
                {
                    PlayerZombieProfile profile = EnsureProfile(mobile as PlayerMobile);
                    profile.SpendablePoints     = 0;
                    profile.OverallScore        = 0;
                    mobile.SendMessage(54,
                                       "Your spendable zombie points and zombie score have been wiped by " + e.Mobile.RawName + ".");
                }
            });

            CommandUtility.Register(
                "RewardtheCure",
                AccessLevel.Developer,
                e =>
            {
                ZombieInstance instance = GetPausedInstance();
                if (instance != null)
                {
                    if (instance.CureWinner != null)
                    {
                        if (instance.CureWinner.BankBox != null)
                        {
                            var thecure = new TheCure();
                            instance.CureWinner.BankBox.DropItem(thecure);
                        }
                        var invalid = new List <PlayerMobile>();

                        foreach (PlayerMobile mobile in instance.CureCompleters.ToList())
                        {
                            PlayerZombieProfile profile = EnsureProfile(mobile);
                            if (invalid.Contains(mobile) || instance.CureWinner == mobile)
                            {
                                instance.CureCompleters.Remove(mobile);
                                profile.OverallScore    -= 800;
                                profile.SpendablePoints -= 800;
                            }
                            else
                            {
                                invalid.Add(mobile);
                            }
                        }
                        if (instance.CureCompleters != null && instance.CureCompleters.Count > 0)
                        {
                            foreach (PlayerMobile mobile in instance.CureCompleters)
                            {
                                var thecure = new TheCure();
                                if (mobile != null && mobile.BankBox != null)
                                {
                                    mobile.BankBox.DropItem(thecure);
                                }
                            }
                        }
                    }
                }
            });

            CommandUtility.Register(
                "GrantZombiePointsAll",
                AccessLevel.Developer,
                e =>
            {
                if (!(e.Mobile is PlayerMobile))
                {
                    return;
                }

                if (e.Arguments.Length < 1)
                {
                    e.Mobile.SendMessage(0x22, "Format: <Points>");
                    return;
                }

                int value;

                if (!Int32.TryParse(e.Arguments[0], out value))
                {
                    e.Mobile.SendMessage(0x22, "Format: <PlayerName> <Points>");
                    return;
                }

                if (e.Arguments.Length > 1)
                {
                    e.Mobile.SendMessage(0x22, "Format: <Points>");
                    return;
                }

                foreach (PlayerZombieProfile profile in PlayerProfiles.Values)
                {
                    profile.Owner.SendMessage(54,
                                              "You have been granted " + value + " spendable zombie points by " + e.Mobile.RawName + ".");
                    profile.SpendablePoints += value;
                }
            });

            CommandUtility.RegisterAlias("Zombieland", "z");

            CommandUtility.Register(
                "GrantZombiePoints",
                AccessLevel.Developer,
                e =>
            {
                if (!(e.Mobile is PlayerMobile))
                {
                    return;
                }

                if (e.Arguments.Length < 2)
                {
                    e.Mobile.SendMessage(0x22, "Format: <PlayerName> <Points>");
                    return;
                }

                string name = e.Arguments[0];
                int value;

                if (!Int32.TryParse(e.Arguments[1], out value))
                {
                    e.Mobile.SendMessage(0x22, "Format: <PlayerName> <Points>");
                    return;
                }

                if (e.Arguments.Length > 2)
                {
                    e.Mobile.SendMessage(0x22, "Format: <PlayerName> <Points>");
                    return;
                }

                Mobile mobile =
                    World.Mobiles.Values.FirstOrDefault(x => x.RawName == name && x is PlayerMobile);
                if (mobile is PlayerMobile)
                {
                    PlayerZombieProfile profile = EnsureProfile(mobile as PlayerMobile);
                    profile.SpendablePoints    += value;
                    mobile.SendMessage(54,
                                       "You have been granted " + value + " zombie points by " + e.Mobile.RawName + ".");
                    e.Mobile.SendMessage(54,
                                         "You have granted " + value + " zombie points to " + mobile.RawName + ".");
                }
            });

            foreach (
                ZombieInstance instance in
                ZombieEvents.Values.Where(instance => instance.Status == ZombieEventStatus.Running))
            {
                instance.init();
            }
        }