Esempio n. 1
0
        public static bool IsInIOBRegion(Mobile m)
        {
            try
            {
                RegionControl regstone = null;
                //check if there is a DRDT region and also if were in a house and if so use the DRDT rules
                CustomRegion inHouse = null;
                inHouse = CustomRegion.FindDRDTRegion(m);
                if (inHouse != null)
                {
                    regstone = inHouse.GetRegionControler();
                }

                if ((regstone != null && regstone.IOBAlign != IOBAlignment.None) || (regstone != null && regstone.IOBZone))
                {
                    return(true);
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0}", e);
            }
            catch
            {
                Console.WriteLine("Caught Exception in IOBRegions::IsInIOBRegion()");
            }

            return(IsInIOBRegion(m.Location.X, m.Location.Y));
        }
        public void DeleteCustomRegionPositive()
        {
            var   registryService = ServiceLocator.Current.GetInstance <IHospitalRegistryService>();
            var   registry        = registryService.CurrentRegistry;
            int   cntHospitals;
            int   cntCustomRegions;
            State virginia = null;

            using (var session = CreateSession())
            {
                cntHospitals     = session.Query <Hospital>().Where(reg => reg.Registry.Id == registry.Id).Count();
                cntCustomRegions = session.Query <CustomRegion>().Where(reg => reg.Registry.Id == registry.Id).Count();
                virginia         = session.Query <State>().Where(st => st.Abbreviation == "va").Single();
            }

            int          id        = 0;
            CustomRegion newRegion = registryService.CreateRegion();

            newRegion.Name  = "Some name";
            newRegion.State = virginia;
            Assert.AreEqual(0, id);
            registryService.Save(newRegion);
            id = newRegion.Id;
            Assert.AreNotEqual(0, id);
            registryService.Delete(newRegion);
            using (var session = CreateSession())
            {
                var test = session.Get <CustomRegion>(id);
                Assert.IsNull(test);
            }
        }
Esempio n. 3
0
        public bool CheckLooting(Mobile from)
        {
            try
            {
                if (from.AccessLevel == AccessLevel.Player)
                {
                    RegionControl regstone = null;
                    CustomRegion  reg      = null;
                    if (this.Deleted == false)
                    {
                        reg = CustomRegion.FindDRDTRegion(this);
                    }
                    if (reg != null)
                    {
                        regstone = reg.GetRegionControler();
                    }

                    // if this region does not allow looting, fail
                    if (regstone != null && regstone.BlockLooting == true)
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                Server.Commands.LogHelper.LogException(ex);
            }

            return(true);
        }
Esempio n. 4
0
        public override bool Drink(Mobile from)
        {
            if (from.Poisoned)
            {
                DoCure(from);

                BasePotion.PlayDrinkEffect(from);

                from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                from.PlaySound(0x1E0);

                CustomRegion region1 = from.Region as CustomRegion;

                if (!Engines.ConPVP.DuelContext.IsFreeConsume(from) && (region1 == null || !region1.PlayingGame(from)))
                {
                    this.Consume();
                }
            }
            else
            {
                from.SendLocalizedMessage(1042000);                   // You are not poisoned.
                return(false);
            }

            return(true);
        }
Esempio n. 5
0
        private static bool AllowGain(Mobile from, Skill skill, object obj)
        {
            /*
             * if (Core.AOS && Faction.InSkillLoss(from))	//Changed some time between the introduction of AoS and SE.
             *  return false;
             *
             * if (AntiMacroCode && from is PlayerMobile && UseAntiMacro[skill.Info.SkillID])
             *  return ((PlayerMobile)from).AntiMacroCheck(skill, obj);
             * else
             */

            if (from.IsInEvent)
            {
                from.SendAsciiMessage("You cannot gain skills while in an event");
                return(false);
            }

            CustomRegion cR = from.Region as CustomRegion;

            if (cR != null && !cR.Controller.AllowSkillGain)
            {
                from.SendAsciiMessage("You cannot gain skills here");
                return(false);
            }

            return(true);
        }
Esempio n. 6
0
        public ActionResult Delete(int customRegionId)
        {
            var userId = Convert.ToInt32(Session["userId"]);

            if (userId <= 0)
            {
                var loggedOutJson = new { response = "You have been logged out. Please log back in to delete this.", success = false };
                return(Json(loggedOutJson));
            }
            CustomRegion cr = db.CustomRegions.Find(customRegionId);

            if (cr == null)
            {
                var missingJson = new { response = "Something went wrong. Please try again later.", success = false };
                return(Json(missingJson));
            }
            if (cr.UserID != userId)
            {
                var illegalJson = new { response = "You're trying to delete someone else's custom region. Don't be a douche.", success = false };
                return(Json(illegalJson));
            }
            db.CustomRegions.Remove(cr);
            db.SaveChanges();
            var successJson = new { response = "Successfully deleted!", success = true };

            return(Json(successJson));
        }
Esempio n. 7
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }

            CustomRegion cR = Caster.Region as CustomRegion;

            if (cR != null && cR.Controller.FizzlePvP && CheckHSequence(m))
            {
                SpellHelper.CheckReflect((int)Circle, Caster, ref m);

                double damage = Utility.RandomMinMax(15, 20) + ((int)((GetDamageSkill(Caster) * 3) - GetResistSkill(m)) / 8);

                m.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
                m.PlaySound(Sound);

                SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
            }
            else if (CheckHSequence(m)) //Loki edit: New PvP changes
            {
                SpellHelper.CheckReflect((int)Circle, Caster, ref m);

                double damage = 17 + ((int)((GetDamageSkill(Caster) * 3) - GetResistSkill(m)) / 8);

                if (Scroll == null)
                {
                    damage += 5;
                }

                if (m is PlayerMobile)
                {
                    double aR = ((PlayerMobile)m).BaseArmorRatingSpells;

                    if (aR < 55)
                    {
                        damage += 1;
                    }
                    if (aR < 45)
                    {
                        damage += 1;
                    }
                    if (aR < 35)
                    {
                        damage += 1;
                    }
                    if (aR < 25)
                    {
                        damage += 1;
                    }
                }

                m.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
                m.PlaySound(Sound);

                SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
            }
            FinishSequence();
        }
Esempio n. 8
0
        public bool CanChange(Mobile from)
        {
            bool bReturn = false;

            if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            CustomRegion cr = CustomRegion.FindDRDTRegion(from.Map, this.Location);

            if (cr is TownshipRegion)
            {
                TownshipRegion tsr = cr as TownshipRegion;
                if (tsr != null && tsr.TStone != null && tsr.TStone.Guild != null &&
                    tsr.TStone.Guild == from.Guild)
                {
                    bReturn = true;
                }
                else
                {
                    from.SendMessage("You must be a member of this township to modify this wall.");
                    bReturn = false;
                }
            }
            else
            {
                from.SendMessage("You must be within the township to modify this wall.");
                bReturn = false;
            }

            return(bReturn);
        }
Esempio n. 9
0
        public void UpdateRegion()
        {
            if (Coords != null && Coords.Count != 0)
            {
                if (m_Region == null)
                {
                    m_Region = new CustomRegion(this, this.Map);
                    //Region.AddRegion( m_Region );	//Maybe not needed cause setting map will call this?
                }

                Region.RemoveRegion(m_Region);

                m_Region.Coords = Coords;

                m_Region.Disabled = !(GetFlag(RegionFlag.IsGuarded));

                m_Region.Music = Music;
                m_Region.Name  = m_RegionName;

                m_Region.Priority = (int)m_Priority;

                m_Region.Map = this.Map;

                Region.AddRegion(m_Region);
            }

            return;
        }
Esempio n. 10
0
        private void OnCustomRegionImported(CustomRegion newRegion)
        {
            var vm = new RegionViewModel(newRegion);

            HospitalDataService.RegionViewModels.Add(vm);

            _refreshCollection(vm);
        }
Esempio n. 11
0
        /// <summary>
        /// Gets the kin city
        /// </summary>
        /// <param name="m">The m.</param>
        /// <returns></returns>
        public static KinCityRegion GetKinCityAt(Mobile m)
        {
            CustomRegion c = CustomRegion.FindDRDTRegion(m);

            if (c is KinCityRegion)
            {
                return((KinCityRegion)c);
            }

            return(null);
        }
Esempio n. 12
0
        /// <summary>
        /// Gets the kin city
        /// </summary>
        /// <param name="m">The m.</param>
        /// <returns></returns>
        public static KinCityRegion GetKinCityAt(Map map, Point3D point)
        {
            CustomRegion c = CustomRegion.FindDRDTRegion(map, point);

            if (c is KinCityRegion)
            {
                return((KinCityRegion)c);
            }

            return(null);
        }
Esempio n. 13
0
        public override TimeSpan GetCastDelay()
        {
            CustomRegion cR = Caster.Region as CustomRegion;

            if (cR != null && cR.Controller.FizzlePvP && Caster.AccessLevel == AccessLevel.Player)
            {
                return(TimeSpan.FromSeconds(3.5));
            }

            return(base.GetCastDelay());
        }
Esempio n. 14
0
        /// <summary>
        /// Gets the kin city.
        /// </summary>
        /// <param name="i">The i.</param>
        /// <returns></returns>
        public static KinCityRegion GetKinCityAt(Item i)
        {
            CustomRegion c = CustomRegion.FindDRDTRegion(i, i.Location);

            if (c is KinCityRegion)
            {
                return((KinCityRegion)c);
            }

            return(null);
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                Mobile killer = m_Killers[m_Idx];
                if (killer != null && !killer.Deleted)
                {
                    Region        region  = Region.Find(m_Location, m_Map);
                    CustomRegion  cregion = region as CustomRegion;
                    GuardedRegion gregion = region as GuardedRegion;

                    if (region is DungeonRegion || (gregion != null && !gregion.IsDisabled()) || (cregion != null && cregion.Controller.IsDungeonRegion))
                    {
                        killer.ShortTermMurders++;
                    }

                    killer.Kills++;
                    //killer.ShortTermMurders++;

                    if (killer is PlayerMobile)
                    {
                        ((PlayerMobile)killer).ResetKillTime();
                    }

                    killer.SendLocalizedMessage(1049067);                              //You have been reported for murder!

                    if (killer.Kills == 5)
                    {
                        killer.SendLocalizedMessage(502134);                                  //You are now known as a murderer!
                    }
                    else if (SkillHandlers.Stealing.SuspendOnMurder && killer.Kills == 1 && killer is PlayerMobile && ((PlayerMobile)killer).NpcGuild == NpcGuild.ThievesGuild)
                    {
                        killer.SendLocalizedMessage(501562);                                   // You have been suspended by the Thieves Guild.
                    }
                }
                break;
            }

            case 2:
            {
                break;
            }
            }

            m_Idx++;
            if (m_Idx < m_Killers.Count)
            {
                from.SendGump(new ReportMurdererGump(from, m_Killers, m_Location, m_Map, m_Idx));
            }
        }
Esempio n. 16
0
        public bool CheckHSequence(Mobile target)
        {
            try
            {
                RegionControl regstone = null;
                CustomRegion  reg      = null;
                if (target != null)
                {
                    reg = CustomRegion.FindDRDTRegion(target);
                }
                if (reg != null)
                {
                    regstone = reg.GetRegionControler();
                }

                //if your in a region area spells will fail if disallowed, prevents the run outside of area precast
                //run back into region then release spell ability
                if (m_Caster != null && target != null && m_Caster.Spell != null && m_Caster.Region != target.Region && regstone != null && (regstone.IsRestrictedSpell(m_Caster.Spell, m_Caster) || regstone.IsMagicIsolated) && m_Caster.AccessLevel == AccessLevel.Player && ((m_Caster is BaseCreature && !regstone.RestrictCreatureMagic) || m_Caster is PlayerMobile))
                {
                    m_State = SpellState.None;
                    if (m_Caster.Spell == this)
                    {
                        m_Caster.Spell = null;
                    }
                    Targeting.Target.Cancel(m_Caster);
                    m_Caster.SendMessage("You cannot cast your spell into that area.");
                    return(false);
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0} Caught exception.", e);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            if (!target.Alive)
            {
                m_Caster.SendLocalizedMessage(501857);                 // This spell won't work on that!
                return(false);
            }
            else if (Caster.CanBeHarmful(target) && CheckSequence())
            {
                Caster.DoHarmful(target);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static void FindRegionControl_OnCommand(CommandEventArgs e)
        {
            CustomRegion reg = e.Mobile.Region as CustomRegion;

            if (reg != null && reg.Controller != null && !reg.Controller.Deleted)
            {
                e.Mobile.MoveToWorld(reg.Controller.Location, reg.Controller.Map);
            }
            else
            {
                e.Mobile.SendMessage("There is no controller for this region.");
            }
        }
Esempio n. 18
0
        private static string GetRegion(Mobile m)
        {
            string        regionString;
            GuardedRegion reg      = (GuardedRegion)m.Region.GetRegion(typeof(GuardedRegion));
            CustomRegion  cR       = (CustomRegion)m.Region.GetRegion(typeof(CustomRegion));
            bool          blueText = false;

            if (m.Hidden)
            {
                regionString = "-";
            }
            else if (string.IsNullOrEmpty(m.Region.Name))
            {
                regionString = "-";
            }
            else if (m.Region is DungeonRegion || m.Region.Name.ToLower().Contains("dungeon"))
            {
                regionString = "Dungeon";
            }
            else if (m.Region is TownRegion)
            {
                if (reg != null && !reg.Disabled)
                {
                    blueText = true;
                }

                regionString = m.Region.Name;
            }
            else if (reg != null && !reg.Disabled)
            {
                regionString = m.Region.Name;
                blueText     = true;
            }
            else if (cR != null && (!cR.Controller.AllowPvP || !cR.Controller.CanBeDamaged || !cR.Controller.AllowHarmPlayer))
            {
                regionString = m.Region.Name;
                blueText     = true;
            }
            else
            {
                regionString = "-";
            }

            if (regionString != "-")
            {
                regionString = string.Format(blueText ? "<div class=\"PlayerRegion_Guarded\">{0}</div>" : "<div class=\"PlayerRegion_Unguarded\">{0}</div>", regionString);
            }

            return(regionString);
        }
        public static void PullRegionControl_OnCommand(CommandEventArgs e)
        {
            CustomRegion reg = e.Mobile.Region as CustomRegion;

            if (reg != null && reg.Controller != null && !reg.Controller.Deleted)
            {
                reg.Controller.MoveToWorld(e.Mobile.Location, e.Mobile.Map);
                e.Mobile.SendMessage("The region controller has been pulled to your location.");
            }
            else
            {
                e.Mobile.SendMessage("There is no controller for this region.");
            }
        }
Esempio n. 20
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
            {
                Caster.SendLocalizedMessage(1061654);                   // You cannot heal that which is not alive.
            }
            else if (m is Golem)
            {
                Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951);                   // You cannot heal that.
            }
            else if (CheckBSequence(m))
            {
                int toHeal;

                CustomRegion cR = Caster.Region as CustomRegion;

                if (Core.AOS)
                {
                    // TODO: / 100 or / 120 ? 1, 3 or 1, 4 ?
                    toHeal  = Caster.Skills.Magery.Fixed / 100;
                    toHeal += Utility.RandomMinMax(1, 3);
                }
                else //Loki edit: New PvP changes
                {
                    toHeal = 3 + (int)(Caster.Skills[SkillName.Magery].Value * 0.1);
                    if (m.Poisoned)
                    {
                        toHeal -= 3;
                        if (toHeal < 1)
                        {
                            toHeal = 1;
                        }
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x22, true, "The poison mitigates your healing!");
                    }
                }

                m.Heal(toHeal);

                m.FixedParticles(0x376A, 5, 15, 5005, EffectLayer.Waist);
                m.PlaySound(Sound);
            }

            FinishSequence();
        }
Esempio n. 21
0
        public override void OnDoubleClick(Mobile from)
        {
            CustomRegion cR = from.Region as CustomRegion;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1060640); // "This item must be in your backpack to use it"
                return;
            }

            if (PointDest == Point3D.Zero || MapDest == null || MapDest == Map.Internal)
            {
                from.SendAsciiMessage("This waystone does not lead anywhere");
                return;
            }

            if (m_TeleportTimer != null && m_TeleportTimer.Running)
            {
                from.SendAsciiMessage("You stop the timer");
                m_TeleportTimer.Stop();
                return;
            }

            if (cR != null && !cR.Controller.CanUseStuckMenu)
            {
                from.SendAsciiMessage("You cannot use a waystone in this region");
                return;
            }

            if (from.Region.IsPartOf(typeof(Jail)))
            {
                from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
                return;
            }

            if (from.Hits < from.HitsMax)
            {
                from.SendAsciiMessage("You must be fully healed to use this");
                return;
            }

            m_Origin = from.Location;
            from.SendAsciiMessage(string.Format("You will be teleported in {0} seconds", Delay));

            m_TeleportTimer = new TeleportTimer(this, from);
            m_TeleportTimer.Start();
        }
Esempio n. 22
0
        public void Target(Mobile m)
        {
            CustomRegion customRegion = m.Region as CustomRegion;

            if (customRegion != null && customRegion.Controller != null && !customRegion.Controller.AllowHiding)
            {
                Caster.LocalOverheadMessage(MessageType.Regular, 38, false, "A unknown force prevents your spell from taking effect!");
            }
            else if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (m is ZombieClueGiver)
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (m is Mobiles.BaseVendor || m is Mobiles.PlayerVendor || m is Mobiles.PlayerBarkeeper || m.AccessLevel > Caster.AccessLevel)
            {
                Caster.SendLocalizedMessage(501857);                   // This spell won't work on that!
            }
            else if (CheckBSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                Effects.SendLocationParticles(EffectItem.Create(new Point3D(m.X, m.Y, m.Z + 16), Caster.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045);
                m.PlaySound(0x3C4);

                m.Hidden    = true;
                m.Combatant = null;
                m.Warmode   = false;

                RemoveTimer(m);

                TimeSpan duration = TimeSpan.FromSeconds(((1.2 * Caster.Skills.Magery.Fixed) / 10));

                Timer t = new InternalTimer(m, duration);

                BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825, duration, m));                         //Invisibility/Invisible

                m_Table[m] = t;

                t.Start();
            }

            FinishSequence();
        }
Esempio n. 23
0
        public override void OnHit(Mobile attacker, Mobile defender)
        {
            CustomRegion cR = defender.Region as CustomRegion;

            if (cR == null || cR.Controller.AllowSpecialAttacks)
            {
                if (Utility.Random(20) <= 2) // 10% chance of scoring a critical hit
                {
                    attacker.SendAsciiMessage("You poison your target!");
                    defender.PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*{0} suddenly feels very ill*", defender.Name));
                    defender.ApplyPoison(attacker, Poison.GetPoison(0));
                    new InternalTimer(defender).Start();
                }
            }

            base.OnHit(attacker, defender);
        }
Esempio n. 24
0
        public override bool Drink(Mobile from)
        {
            if (DoAgility(from))
            {
                CustomRegion region1 = from.Region as CustomRegion;
                BasePotion.PlayDrinkEffect(from);

                if (!Engines.ConPVP.DuelContext.IsFreeConsume(from) && (region1 == null || !region1.PlayingGame(from)))
                {
                    this.Consume();
                }

                return(true);
            }

            return(false);
        }
Esempio n. 25
0
        public override void OnHit(Mobile attacker, Mobile defender)
        {
            CustomRegion cR = defender.Region as CustomRegion;

            if (cR == null || cR.Controller.AllowSpecialAttacks)
            {
                if (Utility.Random(20) <= 2) // 10% chance of scoring a critical hit
                {
                    attacker.SendAsciiMessage("You score a critical hit!");
                    defender.PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*Critical hit!*"));
                    defender.BoltEffect(0);
                    defender.Hits -= 10;
                }
            }

            base.OnHit(attacker, defender);
        }
Esempio n. 26
0
        private void OnSaveCustomRegion()
        {
            Validate();
            if (HasErrors)
            {
                return;
            }

            //if (string.IsNullOrWhiteSpace(RegionTitle) || RegionID == null || SelectedState == null)
            //{
            //    MessageBox.Show("Please enter a region  ID , name and select a state before adding a custom geographic region.",
            //        "Unable to add Custom Region", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            //    return;
            //}

            var customRegion = new CustomRegion
            {
                Code = string.Format("CUS{0}{1}", RegionID, SelectedState),
                Name = RegionTitle,
                IsSourcedFromBaseData = false,
                State          = SelectedState,
                Version        = 1,
                Created        = DateTime.Now,
                ImportRegionId = RegionID
            };

            using (var session = DataserviceProvider.SessionFactory.OpenSession())
            {
                try
                {
                    OnAddNewItem(customRegion);
                    CollectionItems.AddNewItem(customRegion);
                    CollectionItems.CommitNew();
                    Reset();
                    var msg = String.Format("Custom region {0} with state {1} has been added", customRegion.Name, customRegion.State);
                    MappedCustomRegionToPopulationCount = Service.GetCustomRegionToPopulationMappingCount(ConfigurationService.HospitalRegion.DefaultStates.OfType <string>().ToList());
                    EventAggregator.GetEvent <GenericNotificationEvent>().Publish(msg);
                    IsAddNewRegionPopupVisible = false;
                }
                catch (GenericADOException)
                {
                    MessageBox.Show("region  ID already exist.", "Unable to add Custom Region", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
Esempio n. 27
0
        public override void OnHit(Mobile attacker, Mobile defender)
        {
            CustomRegion cR = defender.Region as CustomRegion;

            if (cR == null || cR.Controller.AllowSpecialAttacks)
            {
                if (Utility.Random(28) <= 2) // 7% chance of scoring a critical hit
                {
                    attacker.SendAsciiMessage("You score a critical hit!");
                    defender.PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*Critical hit!*"));
                    defender.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                    defender.PlaySound(283);

                    int damage = 15;

                    #region Damage based on AR
                    if (defender is PlayerMobile)
                    {
                        int basedamage = damage;
                        damage = (damage * 4) - (int)defender.ArmorRating - 5;

                        //Minimum damage 15
                        if (damage < basedamage)
                        {
                            damage = basedamage;
                        }

                        //Maximum damage 30
                        if (damage > 30)
                        {
                            damage = 30;
                        }
                    }
                    else //Always deal maxdamage when fighting monsters
                    {
                        damage = 30;
                    }
                    #endregion

                    defender.Hits -= damage;
                }
            }

            base.OnHit(attacker, defender);
        }
Esempio n. 28
0
        public void NotifyOfDamager(Mobile damager)
        {
            if (damager == null)
            {
                return;                              //safety
            }
            Point3D      targetPoint = this.Location;
            CustomRegion cr          = CustomRegion.FindDRDTRegion(damager.Map, targetPoint);

            if (cr is TownshipRegion)
            {
                TownshipRegion tsr = cr as TownshipRegion;
                if (tsr != null &&
                    tsr.TStone != null &&
                    tsr.TStone.Guild != null &&
                    tsr.TStone.Guild != damager.Guild)
                {
                    // every 10 minutes we will get a message unless the damager changes.
                    //	also, township members can type .status from within the township to dump the spam queue
                    string text = string.Format("{0} at {1} is damaging your township's wall.", damager.Name, damager.Location.ToString());
                    if (tsr.IsSpam(damager, text) == false)
                    {
                        tsr.QueueSpam(damager, text);
                        tsr.TStone.Guild.GuildMessage(text);
                        try
                        {
                            string allytext = "[" + TownshipStone.GetTownshipSizeDesc(tsr.TStone.ActivityLevel) + " of the " + tsr.TStone.GuildName + "]: " + text;
                            foreach (Server.Guilds.Guild g in tsr.TStone.Guild.Allies)
                            {
                                g.GuildMessage(allytext);
                            }
                        }
                        catch (Exception exc)
                        {
                            Server.Commands.LogHelper.LogException(exc);
                        }
                    }
                    else
                    {
                        tsr.QueueSpam(damager, text);
                    }
                }
            }
        }
Esempio n. 29
0
        public void UpdateRegion()
        {
            if (Enabled)
            {
                if (Coords != null && Coords.Count != 0)
                {
                    if (m_Region == null)
                    {
                        //Pix: This change was needed so that classes derived from
                        // RegionControl could have a different CustomRegion (i.e. a different
                        // class derived from CustomRegion)
                        //m_Region = new CustomRegion( this, this.Map );
                        m_Region = CreateRegion(this, this.Map);
                    }

                    Region.RemoveRegion(m_Region);

                    m_Region.Coords = Coords;

                    m_Region.InnBounds = InnBounds;

                    m_Region.IsGuarded = (GetFlag(RegionFlag.IsGuarded));

                    m_Region.Name = m_RegionName;

                    m_Region.Priority = (int)m_Priority;

                    m_Region.Map = m_TargetMap;

                    m_Region.MinZ = m_MinZ;

                    m_Region.MaxZ = m_MaxZ;

                    m_Region.GoLocation = m_GoLocation;

                    m_Region.Music = m_Music;

                    Region.AddRegion(m_Region);
                }
            }

            return;
        }
Esempio n. 30
0
        private static void Execute(CommandEventArgs e)
        {
            Mobile       m  = e.Mobile;
            CustomRegion cR = m.Region as CustomRegion;

            if (cR != null && !cR.Controller.CanUseStuckMenu)
            {
                m.SendAsciiMessage("You cannot join the deathmatch from where you are right now");
                return;
            }

            if (m.HasTrade)
            {
                m.SendLocalizedMessage(1004041);
                return;
            }

            if (m.Region.IsPartOf(typeof(Jail)))
            {
                m.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
                return;
            }

            if (SpellHelper.CheckCombat(m))
            {
                m.SendAsciiMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                return;
            }

            if (m.SolidHueOverride != -1)
            {
                m.SendAsciiMessage("You cannot join an event while using a teleporter");
                return;
            }

            if (m.Hits < m.HitsMax)
            {
                m.SendAsciiMessage("You must be fully healed to join the deatmatch!");
                return;
            }

            PvpCore.TryJoinDM(m);
        }
Esempio n. 31
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CustomRegion obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }