コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="city"></param>
 /// <param name="page"></param>
 /// <param name="session"></param>
 private KinGuardPostGump(KinGuardPost guardPost, int page, GumpSession session, Mobile from)
     : base(page, session, from)
 {
     if (Session["GuardPost"] == null)
     {
         Session["GuardPost"] = guardPost;
         SetCurrentPage();
         if (CurrentPage != null)
         {
             CurrentPage.Create();
         }
     }
 }
コード例 #2
0
            /// <summary>
            /// Attempts to unregister a guard post to this city
            /// </summary>
            /// <param name="gp"></param>
            /// <param name="pm"></param>
            /// <returns></returns>
            public bool UnRegisterGuardPost(KinGuardPost gp)
            {
                //wooooo sanity!
                if (gp == null || Pm == null || gp.Deleted || Pm.Deleted)
                {
                    return(false);
                }
                //Check the guard post is registred with this char
                if (!GuardPosts.Contains(gp))
                {
                    return(false);
                }
                int guardCost = (int)GuardPosts[GuardPosts.IndexOf(gp)].CostType;

                //Remove guard post and increment slots
                GuardPosts.Remove(gp);
                RemoveGuardSlots(guardCost);
                return(true);
            }
コード例 #3
0
            /// <summary>
            /// Attempts to register a guard post to this city
            /// </summary>
            /// <param name="gp"></param>
            /// <param name="pm"></param>
            /// <returns></returns>
            public bool RegisterGuardPost(KinGuardPost gp)
            {
                //wooooo sanity!
                if (gp == null || Pm == null || gp.Deleted || Pm.Deleted)
                {
                    return(false);
                }

                //check the player has enough free guard slots to register this sort of guard
                int guardCost = (int)gp.CostType;

                if (guardCost <= UnassignedGuardSlots)
                {
                    //all good,	 register this guard post and decrement slots as required
                    GuardPosts.Add(gp);
                    AssignGuardSlots(guardCost);
                }
                else
                {
                    return(false);
                }
                return(true);
            }
コード例 #4
0
 public KinGuardPostGump(KinGuardPost guardPost, int page, Mobile from)
     : this(guardPost, page, null, from)
 {
 }
コード例 #5
0
 public KinGuardPostGump(KinGuardPost guardPost, Mobile from)
     : this(guardPost, 1, from)
 {
 }
コード例 #6
0
ファイル: Keywords.cs プロジェクト: zerodowned/angelisland
        private static void EventSink_Speech(SpeechEventArgs e)
        {
            Mobile from = e.Mobile;

            int[] keywords = e.Keywords;

            for (int i = 0; i < keywords.Length; ++i)
            {
                switch (keywords[i])
                {
                case 0x00EC:                         // *showscore*
                {
                    if (KinSystemSettings.PointsEnabled && from is PlayerMobile && from.Alive)
                    {
                        PlayerMobile pm = from as PlayerMobile;
                        from.PublicOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, true, string.Format("Unassisted: {0:0.00}", pm.KinSoloPoints));
                        from.PublicOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, true, string.Format("Assisted: {0:0.00}", pm.KinTeamPoints));

                        from.SendMessage("Unassisted: {0:0.00}", pm.KinSoloPoints);
                        from.SendMessage("Assisted: {0:0.00}", pm.KinTeamPoints);
                        from.SendMessage("Power: {0:0.00}", pm.KinPowerPoints);
                    }
                    break;
                }
                }
            }

            if (e.Mobile != null && e.Mobile is PlayerMobile && e.Mobile.Alive)
            {
                if (e.Speech.ToLower().IndexOf("i wish to place a guard post") > -1)
                {
                    //wooo sanity!
                    PlayerMobile pm = e.Mobile as PlayerMobile;
                    if (pm == null || pm.IOBRealAlignment == IOBAlignment.None)
                    {
                        return;
                    }

                    //Check player is in a faction region
                    if (!(pm.Region is KinCityRegion))
                    {
                        pm.SendMessage("You are not within a faction city where you are a beneficiary.");
                        return;
                    }

                    //Check they are a beneficiary
                    KinCityData cityData = KinCityManager.GetCityData(((KinCityRegion)pm.Region).KinFactionCity);
                    if (cityData == null)
                    {
                        return;
                    }
                    KinCityData.BeneficiaryData bd = cityData.GetBeneficiary(pm);
                    if (bd == null)
                    {
                        pm.SendMessage("You are not within a faction city where you are a beneficiary.");
                        return;
                    }

                    if (cityData.GuardOption == KinCityData.GuardOptions.LordBritish || cityData.GuardOption == KinCityData.GuardOptions.None)
                    {
                        pm.SendMessage("You may not place a guard post with your city's current guard policy");
                        return;
                    }


                    IPooledEnumerable eable = pm.GetItemsInRange(5);
                    if (eable != null)
                    {
                        try
                        {
                            foreach (Item i in eable)
                            {
                                if (i != null && i is KinGuardPost && !i.Deleted)
                                {
                                    pm.SendMessage("You may not place a guard post this close to another guard post");
                                    return;
                                }
                            }
                        }
                        finally
                        {
                            eable.Free();
                            eable = null;
                        }
                    }

                    eable = pm.GetItemsInRange(3);
                    if (eable != null)
                    {
                        try
                        {
                            foreach (Item i in eable)
                            {
                                if (i != null && i is BaseDoor && !i.Deleted)
                                {
                                    pm.SendMessage("You may not place a guard post this close to a door");
                                    return;
                                }
                            }
                        }
                        finally
                        {
                            eable.Free();
                            eable = null;
                        }
                    }

                    //Check they have enough spare guard slots
                    if (bd.UnassignedGuardSlots < 1)
                    {
                        pm.SendMessage("You do not have enough free guard slots to create a guard post");
                        return;
                    }

                    //Test the 8 squares around the target tile to make sure there is nothing blocking there.
                    for (int x = -1; x < 2; x++)
                    {
                        for (int y = -1; y < 2; y++)
                        {
                            if (x == 0 && y == 0)
                            {
                                continue;                                               //ignore the tile where they are standing
                            }
                            Point3D location = pm.Location;
                            location.X += x;
                            location.Y += y;
                            if (!pm.Map.CanSpawnMobile(location))
                            {
                                pm.SendMessage("You must have at least one free space in every direction around you.");
                                return;
                            }
                        }
                    }


                    //Place & register guard post
                    KinGuardPost kgp = new KinGuardPost(0x429, pm, KinFactionGuardTypes.FactionHenchman, ((KinCityRegion)pm.Region).KinFactionCity);
                    if (bd.RegisterGuardPost(kgp))
                    {
                        pm.SendMessage("Successfully created guard post.");
                        kgp.MoveToWorld(pm.Location, pm.Map);
                        kgp.Visible = true;
                    }
                    else
                    {
                        kgp.Delete();
                    }
                }
                else if (e.Speech.ToLower().IndexOf("i wish to fund my guard post") > -1)
                {
                    //wooo sanity!
                    PlayerMobile pm = e.Mobile as PlayerMobile;
                    if (pm == null || pm.IOBRealAlignment == IOBAlignment.None)
                    {
                        return;
                    }

                    pm.SendMessage("Select the guard post you would like to fund");
                    pm.Target = new KinGuardPostFundTarget();
                }
                else if (e.Speech.ToLower().IndexOf("i renounce my kin status") > -1)
                {
                    ((PlayerMobile)e.Mobile).ResetIOBRankTime();
                    e.Mobile.SendMessage("You have reduced your rank.");
                }
            }
        }
コード例 #7
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if( targeted == null || !(targeted  is Item) )
                return;

            if (_guardPost == null)
            {
                //Guard post stage
                if (!(targeted is KinGuardPost))
                {
                    from.SendMessage("You may only fund guard posts");
                    return;
                }

                //Grab guardpost
                KinGuardPost gp = targeted as KinGuardPost;
                if (gp == null) return;

                //Verify owner
                KinCityData data = KinCityManager.GetCityData(gp.City);
                if( data == null )
                {
                    from.SendMessage("That guard post does not appear to be a valid part of a faction city");
                    return;
                }

                //Owner or city leader can fund
                if (gp.Owner != from && gp.Owner != data.CityLeader )
                {
                    from.SendMessage("That guard post does not belong to you");
                    return;
                }

                from.SendMessage("Select the silver you wish to fund it with");

                //Issue new target
                from.Target = new KinGuardPostFundTarget(gp);
            }
            else
            {
                Silver silver = targeted as Silver;
              //Silver stage
                if (silver == null)
                {
                    from.SendMessage("You may only fund the guard post with silver");
                    return;
                }
                if (!from.Backpack.Items.Contains(targeted))
                {
                    from.SendMessage("The silver must be in your backpack");
                }
                if (from.GetDistanceToSqrt(_guardPost.Location) > 3)
                {
                    from.SendMessage("You are not close enough to the guard post");
                    return;
                }

                //Verify owner
                KinCityData data = KinCityManager.GetCityData(_guardPost.City);
                if (data == null)
                {
                    from.SendMessage("That guard post does not appear to be a valid part of a faction city");
                    return;
                }

                //check again that the guard post exists and they are the owner
                if (_guardPost.Deleted || (_guardPost.Owner != from && _guardPost.Owner != data.CityLeader))
                {
                    from.SendMessage("The guard post no longer or exists or you are no longer the rightful owner");
                    return;
                }

                int amount = silver.Amount;

                if (amount <= 0)
                {
                    //should be impossible
                    from.SendMessage("Your guard post was not successfully funded");
                    return;
                }

                //Fund guardpost
                silver.Delete();
                _guardPost.Silver += amount;
                //if( !_guardPost.Running ) _guardPost.Running = true;
                from.SendMessage("Your guard post was successfully funded with {0} silver",amount);
            }
        }
コード例 #8
0
 public KinGuardPostFundTarget(KinGuardPost guardPost)
     : base(4, false, TargetFlags.None)
 {
     _guardPost = guardPost;
 }