示例#1
0
 /// <summary>
 /// Called when [death].
 /// </summary>
 /// <param name="m">The m.</param>
 /// <returns></returns>
 public void OnDeath(Mobile m)
 {
     if (m is GolemController)
     {
         ProcessActivity(KinFactionActivityTypes.GCDeath);
     }
     else if (m is PlayerMobile)
     {
         PlayerMobile pm = ((PlayerMobile)m);
         if (pm.IOBRealAlignment == IOBAlignment.None)
         {
             return;
         }
         KinCityData data = KinCityManager.GetCityData(City);
         if (data == null)
         {
             return;
         }
         if (data.ControlingKin == pm.IOBRealAlignment)
         {
             ProcessActivity(KinFactionActivityTypes.FriendlyDeath);
         }
         else
         {
             ProcessActivity(KinFactionActivityTypes.Death);
         }
     }
     else if (m is BaseCreature)
     {
         if (((BaseCreature)m).Spawner is KinGuardPost)
         {
             ProcessActivity(KinFactionActivityTypes.GuardDeath);
         }
     }
 }
示例#2
0
 protected override void OnTick()
 {
     if (m_Cycle != 5)
     {
         //Display warning message
         if (KinCityManager.OnLBChangeWarning != null)
         {
             KinCityManager.OnLBChangeWarning(m_City);
             ++m_Cycle;
             Start();
         }
     }
     else
     {
         //Switch on LB guards
         KinCityData cityData = KinCityManager.GetCityData(m_City);
         if (cityData != null)
         {
             //Don't change the guards if it's somehow now owned by the GCs
             if (cityData.ControlingKin == IOBAlignment.None)
             {
                 return;
             }
             cityData.GuardOption = KinCityData.GuardOptions.LordBritish;
             cityData.ClearAllGuardPosts();
             //Switch on patrol npc guard type
             cityData.SetNPCFlag(KinCityData.NPCFlags.Patrol, true);
             //Raise event for the regions to sort themselves out with the new changes
             if (KinCityManager.OnChangeGuards != null)
             {
                 KinCityManager.OnChangeGuards(m_City, KinCityData.GuardOptions.LordBritish);
             }
         }
     }
 }
示例#3
0
        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.");
                }
            }
        }