Esempio n. 1
0
        protected override void CompileLayout(SuperGumpLayout layout)
        {
            layout.Add(
                "background",
                () =>
            {
                AddBackground(0, 40, 775, 553, 2600);
                AddImage(269, 18, 1419);
                AddImage(346, 0, 1417);
                AddImage(355, 9, 9012, 60);
                AddBackground(35, 100, 703, 444, 9270);
                AddBackground(49, 112, 676, 420, 9200);
                AddBackground(56, 119, 362, 409, 9260);
                AddBackground(423, 119, 296, 409, 9260);

                AddLabel(47, 80, 60, @"Zombieland!!");
                AddItem(146, 58, 9685);

                AddLabel(528, 55, 2049, @"Current Participants:");
                AddLabel(670, 55, 60, ZombieEvent.GetParticipantCount().ToString());

                AddLabel(528, 75, 2049, @"Zombieland Rewards");
                AddButton(660, 75, 247, 248, b =>
                {
                    if (Avatar == null)
                    {
                        new ZombieEventRewardsUI(User, UserProfile).Send();
                    }
                    else
                    {
                        Avatar.SendMessage(61, "You cannot view rewards while participating in the event.  Please log back into your normal character first.");
                    }
                });

                AddItem(351, 130, 4476);
                AddItem(324, 156, 7397, 1270);
                AddItem(333, 154, 7393, 1270);
                AddItem(329, 162, 3795);

                var zinstance = ZombieEvent.GetInstance();

                if (User.AccessLevel >= AccessLevel.GameMaster)
                {
                    if (zinstance == null)
                    {
                        AddLabel(77, 551, 1270, "Start Event?");
                        AddButton(173, 549, 247, 248, b =>
                        {
                            var instance = new ZombieInstance();
                            ZombieEvent.ZombieEvents.Add(instance.Uid, instance);
                            instance.init();
                        });
                    }
                    else
                    {
                        AddLabel(77, 551, 1270, "Stop Event?");
                        AddButton(173, 549, 247, 248, b =>
                        {
                            zinstance.Stop();
                        });
                    }
                }

                if (zinstance != null && !UserProfile.Active)
                {
                    AddLabel(529, 551, 1270, "Join the Event?");
                    AddButton(638, 549, 247, 248, b =>
                    {
                        if (User.Alive)
                        {
                            zinstance.JoinZombieInstance(User);
                        }
                        else
                        {
                            User.SendMessage(54, "You must be alive to join the event!");
                        }
                    });
                }
                else if (zinstance != null && UserProfile.Active)
                {
                    AddLabel(529, 551, 1270, "Leave the Event?");
                    AddButton(638, 549, 247, 248, b =>
                    {
                        zinstance.LeaveZombieInstance(UserProfile);

                        /*if (UserProfile.LeaveEventTimer == null || !UserProfile.LeaveEventTimer.Running)
                         *  ZombieEvent.LeaveEvent(User);
                         * else
                         * {
                         *  new DialogGump(User, this, 0, 0, null, null, 7004, a =>
                         *  {
                         *      if (User.Map == Map.ZombieLand)
                         *      {
                         *          if (ZombieEvent.GetInstance() != null)
                         *          {
                         *              var zevent = ZombieEvent.GetInstance();
                         *              if (zevent != null && UserProfile.LeaveEventTimer != null && UserProfile.LeaveEventTimer.Running)
                         *              {
                         *                  User.SendMessage(54, "You have succesfully left the event.");
                         *                  UserProfile.LeaveEventTimer.Stop();
                         *                  zevent.HandlePlayerDeathLeave(User, null);
                         *              }
                         *          }
                         *      }
                         *  })
                         *  {
                         *      Title = "Leave Event?",
                         *      Html = "Are you sure you wish to leave the event before the leave timer finishes?  You will lose all your items and your current location will not be saved.",
                         *      HtmlColor = DefaultHtmlColor
                         *  }.Send();*/
                    });
                }
            });

            layout.Add(
                "Search",
                () =>
            {
                AddLabel(72, 128, 2049, @"Search");
                AddLabel(72, 146, 1258, @"Enter Character Name");
                AddBackground(70, 164, 139, 29, 3000);

                AddTextEntryLimited(73, 170, 161, 24, TextHue, String.Empty, 20, (b, t) => SearchEmail = t);

                AddButton(213, 168, 4023, 4025, b =>
                {
                    SearchText = SearchEmail;
                    Page       = 0;
                    Refresh(true);
                });
            });

            layout.Add(
                "Profiles",
                () =>
            {
                AddLabel(73, 203, 1258, @"Zombieland Profiles");
                AddLabel(219, 203, 1258, @"Rank");
                AddLabel(270, 203, 1258, @"Score");
                AddLabel(326, 203, 1258, @"View Profile");

                AddBackground(71, 222, 335, 259, 3000);

                if (PageCount - 1 > Page)
                {
                    AddButton(384, 491, 5601, 5605, NextPage);
                }

                if (Page > 0)
                {
                    AddButton(75, 491, 5603, 5607, PreviousPage);
                }
            });

            layout.Add(
                "SelectedProfile",
                () =>
            {
                if (SelectedProfile != null && ZEvent != null)
                {
                    AddLabel(440, 131, 1258, @"Character Name");
                    AddLabel(445, 150, 2049, SelectedProfile.Owner.RawName);

                    AddLabel(570, 131, 1258, @"Murders");
                    AddHtml(569, 151, 46, 22, ("<p align=\"center\">" + SelectedProfile.Kills).WrapUOHtmlColor(KnownColor.White), false, false);

                    AddLabel(654, 131, 1258, @"Deaths");
                    AddHtml(651, 151, 46, 22, ("<p align=\"center\">" + SelectedProfile.Deaths).WrapUOHtmlColor(KnownColor.White), false, false);

                    AddLabel(440, 179, 1258, @"Creature Kills");

                    AddLabel(460, 278, 1258, @"Tentacle");
                    AddHtml(463, 293, 46, 22, ("<p align=\"left\">" + SelectedProfile.GetTentacleKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(445, 240, 9672);

                    AddLabel(439, 360, 1258, @"Zombie");
                    AddHtml(440, 375, 46, 22, ("<p align=\"left\">" + SelectedProfile.GetZombieKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(450, 315, 9685);

                    AddLabel(630, 440, 1258, @"Dk. Creeper");
                    AddHtml(650, 455, 46, 22, ("<p align=\"right\">" + SelectedProfile.GetGoreFiendKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(639, 394, 9773);

                    AddHtml(548, 497, 46, 22, ("<p align=\"center\">" + SelectedProfile.GetVitriolKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(528, 431, 11650);
                    AddLabel(545, 482, 1258, @"Abomination");

                    AddLabel(529, 360, 137, @"Chaos Dragon");
                    AddHtml(548, 375, 46, 22, ("<p align=\"center\">" + SelectedProfile.DragonBossDamage).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(545, 302, 9780);

                    AddLabel(630, 281, 1258, @"Treefellow");
                    AddHtml(643, 294, 46, 22, ("<p align=\"right\">" + SelectedProfile.GetTreefellowKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(639, 243, 9761);

                    AddLabel(661, 360, 1258, @"Daemon");
                    AddHtml(658, 374, 46, 22, ("<p align=\"right\">" + SelectedProfile.GetDaemonKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(669, 315, 8403);

                    AddLabel(455, 440, 1258, @"Fey Warrior");
                    AddHtml(456, 455, 46, 22, ("<p align=\"left\">" + SelectedProfile.GetFeyKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(454, 397, 9609);

                    AddLabel(528, 234, 1258, @"Zombie Spider");
                    AddHtml(548, 250, 46, 22, ("<p align=\"center\">" + SelectedProfile.GetSpiderKills(ZEvent.Uid)).WrapUOHtmlColor(KnownColor.White), false, false);
                    AddItem(536, 196, 9668);
                }
            });

            Dictionary <int, PlayerZombieProfile> range = GetListRange();

            if (range.Count > 0 && ZEvent != null)
            {
                CompileEntryLayout(layout, range);
            }
        }
        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();
            }
        }
Esempio n. 3
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();
            }
        }