private static void CityTool_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; Console.WriteLine("*[{1}] {0} Arcquitectura deco tool**", from.Name, from.AccessLevel); PlayerMobile pm = (PlayerMobile)from; if (pm.City != null) { if (pm.City.Mayor != from) { from.CloseGump(typeof(CityTool)); from.SendMessage("Debes de ser el alcalde para usar el comando"); } else if (!PlayerGovernmentSystem.IsAtCity(from)) { from.CloseGump(typeof(CityTool)); from.SendMessage("Debes estar dentro de la ciudad para usar el comando."); } else { from.SendGump(new CityTool(from)); } } else { from.CloseGump(typeof(CityTool)); from.SendMessage("You must be the mayor of a city in order to use this."); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item item = (Item)targeted; if (!PlayerGovernmentSystem.IsIteminCity(from, item)) { from.SendMessage("You may only lock down things in your city limits!"); return; } if (item is ResourceBox) { if (item is CityResourceBox) { if (!PlayerGovernmentSystem.IsIteminCity(from, item)) { from.SendMessage("You may only lock this down in the city proper!"); return; } } else { from.SendMessage("You may only lock this down in your house"); return; } } ArrayList decore = m_Stone.isLockedDown; if (m_Stone.CurrentDecore == m_Stone.MaxDecore) { from.SendMessage("You cannot secure anymore items in this city."); } else if (item.Movable == true) { if (decore == null) { m_Stone.isLockedDown = new ArrayList(); decore = m_Stone.isLockedDown; } item.Movable = false; decore.Add(item); m_Stone.CurrentDecore += 1; from.SendMessage("You secure the item."); } else { from.SendMessage("That item cannot be locked down because it is already not movable."); } } }
public void OnChop(Mobile from) { BaseHouse house = BaseHouse.FindHouseAt(this); PlayerMobile pm = (PlayerMobile)from; //NEW for Player city bool ismayor = false; if (pm.City != null && pm.City.Mayor == pm && PlayerGovernmentSystem.IsAtCity(from)) { ismayor = true; } if (house != null && house.IsOwner(from) && house.Addons.Contains(this) || ismayor) { Effects.PlaySound(GetWorldLocation(), Map, 0x3B3); from.SendLocalizedMessage(500461); // You destroy the item. int hue = 0; if (RetainDeedHue) { for (int i = 0; hue == 0 && i < m_Components.Count; ++i) { AddonComponent c = m_Components[i]; if (c.Hue != 0) { hue = c.Hue; } } } Delete(); if (house != null) { house.Addons.Remove(this); } BaseAddonDeed deed = Deed; if (deed != null) { if (RetainDeedHue) { deed.Hue = hue; } from.AddToBackpack(deed); } } }
protected override void OnTarget(Mobile from, object target) { IPoint3D pi = target as IPoint3D; Map map = from.Map; Region reg; Point3D p; PlayerMobile pm = (PlayerMobile)from; CityManagementStone stone = pm.City; ArrayList decore = stone.isLockedDown; ArrayList delete = stone.toDelete; if (stone.CurrentDecore == stone.MaxDecore) { from.SendMessage("You cannot secure anymore items in this city."); return; } if (decore == null) { stone.isLockedDown = new ArrayList(); decore = stone.isLockedDown; } if (pi == null || map == null || m_deed.Deleted) { return; } Server.Spells.SpellHelper.GetSurfaceTop(ref pi); p = new Point3D(pi.X, pi.Y, pi.Z); reg = Region.Find(p, map); if (from.Region is PlayerCityRegion && reg == from.Region && PlayerGovernmentSystem.IsAtCity(from)) { CityResourceBox box = new CityResourceBox(); box.Stone = stone; box.MoveToWorld(new Point3D(p), map); box.Movable = false; decore.Add(box); delete.Add(box); stone.CurrentDecore += 1; m_deed.Delete(); } else { from.SendMessage("You must be in your city to do this."); } }
public override void OnDoubleClick(Mobile from) { if (m_stone == null) { from.SendMessage("There was an error, please contact a GM "); } else { if (PlayerGovernmentSystem.IsMemberOf(from, m_stone)) { base.OnDoubleClick(from); } else { from.SendMessage("Only citizens of the town may access this"); } } }
public override void OnDoubleClick(Mobile from) { PlayerMobile pm = (PlayerMobile)from; if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (pm.City != null) { ArmyController army = from.Backpack.FindItemByType(typeof(ArmyController)) as ArmyController; if (pm.City.Mayor != from && pm.City.AssistMayor != from && pm.City.General != from) { from.SendMessage("You must be the mayor, assistant mayor, or general of a city to place this structure."); } else if (!PlayerGovernmentSystem.IsAtCity(from)) { from.SendMessage("You must be inside your city to place this structure."); } else if (army != null) { from.SendMessage("You appear to already have an army barracks. You may only control one army."); } else if (!PlayerGovernmentSystem.IsCityLevelReached(pm.City.Mayor, 3)) { from.SendMessage("Your city must be at least level 3 before you can place this structure."); } else if (PlayerGovernmentSystem.NeedsForensics && from.Skills[SkillName.Forensics].Base < 40.0) { from.SendMessage("You lack the required skill to place this building, You need at least 40.0 points in forensics."); } else { base.OnDoubleClick(from); } } else { from.SendMessage("You must be the mayor, assistant mayor, or general of a city in order to use this."); } }
public override bool OnDragDrop(Mobile from, Item dropped) { if (m_stone == null) { from.SendMessage("There was an error, please contact a GM "); return(false); } else { if (PlayerGovernmentSystem.IsMemberOf(from, m_stone)) { return(base.OnDragDrop(from, dropped)); } else { from.SendMessage("Only citizens of the town may access this"); return(false); } } }
public override void OnDoubleClick(Mobile from) { PlayerMobile pm = (PlayerMobile)from; if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (pm.City != null) { if (pm.City.Mayor != from) { from.SendMessage("You must be the mayor of your city to place this structure."); } else if (!PlayerGovernmentSystem.IsAtCity(from)) { from.SendMessage("You must be inside your city to place this structure."); } else if (!PlayerGovernmentSystem.IsCityLevelReached(from, 3)) { from.SendMessage("Your city must be at least level 3 before you can place this structure."); } else if (pm.City.HasMoongate != false) { from.SendMessage("Your city already has a moongate, Remove that one first before placing this one."); } else if (PlayerGovernmentSystem.NeedsForensics && from.Skills[SkillName.Forensics].Base < 55.0) { from.SendMessage("You lack the required skill to place this building, You need at least 55.0 points in forensics."); } else { base.OnDoubleClick(from); } } else { from.SendMessage("You must be the mayor of a city in order to use this."); } }
public override void OnResponse(Mobile from, string text) { text = text.Trim(); if (text.Length > 40) { text = text.Substring(0, 40); } if (text.Length > 0) { if (PlayerGovernmentSystem.CheckCityName(text)) { m_From.SendMessage("That name conflicts with another cities name."); } else { m_Stone.CityName = text; if (m_Stone.Citizens != null) { foreach (Mobile m in m_Stone.Citizens) { m.SendMessage(53, "Your cities name has been changed to {0}.", text); PlayerMobile pm = (PlayerMobile)m; if (pm.ShowCityTitle == true) // Updates Title { pm.ShowCityTitle = true; } } } } } m_From.CloseGump(typeof(CityManagementGump)); m_From.SendGump(new CityManagementGump(m_Stone, m_From)); }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (PlayerGovernmentSystem.CheckIfMayor(from)) { from.SendMessage("You are already a mayor of another town, You cannot place another city hall."); } else if (PlayerGovernmentSystem.CheckIfCitizen(from)) { from.SendMessage("You are already a member of another city, You must leave that city first."); } else if (PlayerGovernmentSystem.CheckMapCityLimit(from)) { from.SendMessage("There can not be anymore cities on this facet."); } else { base.OnDoubleClick(from); } }
public override void OnDoubleClick(Mobile from) { if (IsChildOf(from.Backpack)) { PlayerMobile pm = (PlayerMobile)from; bool ismayor = false; bool isvalid = false; if (pm.City != null && pm.City.Mayor == pm) { ismayor = true; } if (PlayerGovernmentSystem.IsAtCity(from)) { isvalid = true; } if (ismayor && isvalid) { from.Target = new CityBoxTarget(from, this); } else { if (!ismayor) { from.SendMessage("Only the Mayor may place this in their town"); } else { from.SendMessage("You may only place this in city buldings or public areas."); } } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }
protected override void OnTarget(Mobile from, object o) { if (o is CityPlayerVendor) { if (((CityPlayerVendor)o).City == null) { from.SendMessage("You may not move a vendor that is sceduled for termination!"); } Mobile mob = o as Mobile; if (PlayerGovernmentSystem.IsAtCity(from, mob) || CityRentedVendor.IsLegitmateVendor(from, mob)) { from.Target = new MoveVendorTarget(o); } else { from.SendMessage("You may only move vendors that are in the public town areas."); } } else if (o is CityResourceBox) { Item item = o as Item; if (PlayerGovernmentSystem.IsAtCity(item)) { from.Target = new MoveVendorTarget(o); } else { from.SendMessage("You may only move boxes that are in the public town areas."); } } else { from.SendMessage("You may only use this to move City Vendors or Town Resource Boxes!"); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { Mobile mob = (Mobile)targeted; ArrayList banned = m_Stone.Banned; if (PlayerGovernmentSystem.CheckIfHouseInCity(mob, m_Stone.PCRegion)) { from.SendMessage("You cannot ban someone who owns a house in the city."); } else if (mob == from) { from.SendMessage("You cant ban yourself."); } else if (PlayerGovernmentSystem.MaxBannedPerCity == 0) { from.SendMessage("City banning has been disabled."); } else if (banned.Count >= PlayerGovernmentSystem.MaxBannedPerCity) { from.SendMessage("You cannot ban anymore players from this city, The ban list is full."); } else if (mob.AccessLevel == AccessLevel.Player) { from.SendMessage("You have banned them from the city."); mob.SendMessage("You have been banned from this city."); banned.Add(mob); // TODO: Set up a ban location. } else { from.SendMessage("You cant ban a staff member."); } } }
public static bool Mobile_AllowHarmful(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } Map map = from.Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { return(true); // In felucca, anything goes } if (!from.Player && !(from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned))) { if (!CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from)) { return(false); } return(true); // Uncontroled NPCs are only restricted by the young system } // XmlPoints challenge mod if (XmlPoints.AreChallengers(from, target)) { return(true); } Guild fromGuild = GetGuildFor(from.Guild as Guild, from); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild))) { return(true); // Guild allies or enemies can be harmful } if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster))) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); // Cannot harm innocent mobiles } } if (PlayerGovernmentSystem.CheckIfBanned(from, target)) { return(true); } if (PlayerGovernmentSystem.CheckAtWarWith(from, target)) { return(true); } if (PlayerGovernmentSystem.CheckCityAlly(from, target)) { return(true); } return(true); }
public AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref List <BaseHouse> houses) { if (PlayerGovernmentSystem.IsAtCity(this)) { return(AddonFitResult.Valid); } if (Deleted) { return(AddonFitResult.Blocked); } if (houses == null) { houses = new List <BaseHouse>(); } foreach (AddonComponent c in m_Components) { Point3D p3D = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z); if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, (c.Z == 0))) { //World.Broadcast(1154, true, "Blocked"); return(AddonFitResult.Blocked); } else if (!CheckHouse(from, p3D, map, c.ItemData.Height, ref houses)) { //World.Broadcast(1154, true, "Not in House"); return(AddonFitResult.NotInHouse); } if (c.NeedsWall) { Point3D wall = c.WallPosition; if (!IsWall(p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map)) { return(AddonFitResult.NoWall); } } } foreach (BaseHouse house in houses) { ArrayList doors = house.Doors; for (int i = 0; i < doors.Count; ++i) { BaseDoor door = doors[i] as BaseDoor; if (door != null && door.Open) { return(AddonFitResult.DoorsNotClosed); } Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; foreach (AddonComponent c in m_Components) { Point3D addonLoc = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z); int addonHeight = c.ItemData.CalcHeight; if (Utility.InRange(doorLoc, addonLoc, 1) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z))) { return(AddonFitResult.DoorTooClose); } } } } return(AddonFitResult.Valid); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (from == null) { return; } if (info.ButtonID == 1) // Vote { if (m_Stone.Voters.Contains(from)) { from.SendMessage("You have already voted for this election."); } else { m_Stone.RunnerOneVotes += 1; m_Stone.Voters.Add(from); from.SendMessage("Your vote has been counted."); if (PlayerGovernmentSystem.NeedsForensics) { m_Stone.RunnerOne.CheckSkill(SkillName.Forensics, 0.0, 100.0); // Normal Skill Check if (m_Stone.RunnerOne.Skills[SkillName.Forensics].Base >= 0.0 && m_Stone.RunnerOne.Skills[SkillName.Forensics].Base <= 99.9) { m_Stone.RunnerOne.Skills[SkillName.Forensics].Base += 0.1; } } } } if (info.ButtonID == 2) // Vote { if (m_Stone.Voters.Contains(from)) { from.SendMessage("You have already voted for this election."); } else { m_Stone.RunnerTwoVotes += 1; m_Stone.Voters.Add(from); from.SendMessage("Your vote has been counted."); if (PlayerGovernmentSystem.NeedsForensics) { m_Stone.RunnerTwo.CheckSkill(SkillName.Forensics, 0.0, 100.0); // Normal Skill Check if (m_Stone.RunnerTwo.Skills[SkillName.Forensics].Base >= 0.0 && m_Stone.RunnerTwo.Skills[SkillName.Forensics].Base <= 99.9) { m_Stone.RunnerTwo.Skills[SkillName.Forensics].Base += 0.1; } } } } if (info.ButtonID == 3) // Run { if (PlayerGovernmentSystem.CheckIfCanBeMayor(from)) { if (from == m_Stone.RunnerOne || from == m_Stone.RunnerTwo) { from.SendMessage("Your already in this election."); } else if (m_Stone.RunnerOne == null) { m_Stone.RunnerOne = from; from.SendMessage("You are now in the election."); } else if (m_Stone.RunnerTwo == null) { m_Stone.RunnerTwo = from; from.SendMessage("You are now in the election."); } else { from.SendMessage("The election is full."); } } else { from.SendMessage("You lack the required skill to become a mayor at this time, You need at least 35.0 points in forensics."); } } }
public static int MobileNotoriety(Mobile source, Mobile target) { if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } // XmlPoints challenge mod if (XmlPoints.AreTeamMembers(source, target)) { return(Notoriety.Ally); } else if (XmlPoints.AreChallengers(source, target)) { return(Notoriety.Enemy); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !Server.Spells.Necromancy.TransformationSpell.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } if (PlayerGovernmentSystem.CheckIfBanned(source, target)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckAtWarWith(source, target)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckCityAlly(source, target)) { return(Notoriety.Ally); } return(Notoriety.Innocent); }
public static int MobileNotoriety(Mobile source, Mobile target) { if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } #region Dueling if (source is PlayerMobile && target is PlayerMobile) { PlayerMobile pmFrom = (PlayerMobile)source; PlayerMobile pmTarg = (PlayerMobile)target; if (pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext) { return(pmFrom.DuelContext.IsAlly(pmFrom, pmTarg) ? Notoriety.Ally : Notoriety.Enemy); } } #endregion if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; Mobile master = bc.GetMaster(); if (master != null && master.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } master = bc.ControlMaster; if (Core.ML && master != null) { if ((source == master && CheckAggressor(target.Aggressors, source)) || (CheckAggressor(source.Aggressors, bc))) { return(Notoriety.CanBeAttacked); } else { return(MobileNotoriety(source, master)); } } if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent... { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction(typeof(Server.Spells.Seventh.PolymorphSpell))) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null) { if (CheckAggressor(master.Aggressors, target) || MobileNotoriety(master, target) == Notoriety.CanBeAttacked) { return(Notoriety.CanBeAttacked); } } } if (PlayerGovernmentSystem.CheckIfBanned(source, target)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckAtWarWith(source, target)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckCityAlly(source, target)) { return(Notoriety.Ally); } return(Notoriety.Innocent); }
/*private static bool CheckHarmfulStatus( GuildStatus from, GuildStatus target ) * { * if ( from == GuildStatus.Waring && target == GuildStatus.Waring ) * return true; * * return false; * }*/ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } #region Factions Faction targetFaction = Faction.Find(target, true); if (targetFaction != null) { if (Faction.Find(from, true) != targetFaction) { return(false); } } #endregion Map map = from.Map; if (map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0) { return(true); // In felucca, anything goes } if (!from.Player) { return(true); // NPCs have no restrictions } if (target is BaseCreature && !((BaseCreature)target).Controlled) { return(false); // Players cannot heal uncontroled mobiles } // XmlPoints challenge mod if (XmlPoints.AreInAnyGame(target)) { return(XmlPoints.AreTeamMembers(from, target)); } if (from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young)) { return(false); // Young players cannot perform beneficial actions towards older players } Guild fromGuild = from.Guild as Guild; Guild targetGuild = target.Guild as Guild; if (fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly(targetGuild))) { return(true); // Guild members can be beneficial } if (PlayerGovernmentSystem.CheckIfBanned(from, target)) { return(false); } if (PlayerGovernmentSystem.CheckAtWarWith(from, target)) { return(false); } if (PlayerGovernmentSystem.CheckCityAlly(from, target)) { return(true); } return(CheckBeneficialStatus(GetGuildStatus(from), GetGuildStatus(target))); }
protected override void OnTarget(Mobile from, object targeted) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null || m_Deed.Deleted) { return; } if (m_Deed.IsChildOf(from.Backpack)) { BaseAddon addon = m_Deed.Addon; Server.Spells.SpellHelper.GetSurfaceTop(ref p); List <BaseHouse> houses = new List <BaseHouse>(); PlayerMobile pm = (PlayerMobile)from; //NEW Added for player city bool ismayor = false; if (pm.City != null && pm.City.Mayor == pm && PlayerGovernmentSystem.IsAtCity(from)) { ismayor = true; } AddonFitResult res = addon.CouldFit(p, map, from, ref houses); if (res == AddonFitResult.Valid) { addon.MoveToWorld(new Point3D(p), map); } else if (ismayor) { CityManagementStone stone = pm.City; addon.MoveToWorld(new Point3D(p), map); stone.AddOns.Add(addon); } else if (res == AddonFitResult.Blocked) { from.SendLocalizedMessage(500269); // You cannot build that there. } else if (res == AddonFitResult.NotInHouse) { from.SendLocalizedMessage(500274); // You can only place this in a house that you own! } else if (res == AddonFitResult.DoorsNotClosed) { from.SendMessage("You must close all house doors before placing this."); } else if (res == AddonFitResult.DoorTooClose) { from.SendLocalizedMessage(500271); // You cannot build near the door. } else if (res == AddonFitResult.NoWall) { from.SendLocalizedMessage(500268); // This object needs to be mounted on something. } if (res == AddonFitResult.Valid) { m_Deed.Delete(); foreach (BaseHouse h in houses) { h.Addons.Add(addon); } } else if (ismayor) { m_Deed.Delete(); } else { addon.Delete(); } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }
public static bool Mobile_AllowHarmful(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } #region Dueling PlayerMobile pmFrom = from as PlayerMobile; PlayerMobile pmTarg = target as PlayerMobile; if (pmFrom == null && from is BaseCreature) { BaseCreature bcFrom = (BaseCreature)from; if (bcFrom.Summoned) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } } if (pmTarg == null && target is BaseCreature) { BaseCreature bcTarg = (BaseCreature)target; if (bcTarg.Summoned) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } } if (pmFrom != null && pmTarg != null) { if (pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started))) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated)) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started) { return(true); } } if ((pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) { return(false); } Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } #endregion Map map = from.Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { return(true); // In felucca, anything goes } BaseCreature bc = from as BaseCreature; if (!from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player)) { if (!CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from)) { return(false); } return(true); // Uncontrolled NPCs are only restricted by the young system } Guild fromGuild = GetGuildFor(from.Guild as Guild, from); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild))) { return(true); // Guild allies or enemies can be harmful } if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster))) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (Notoriety.Compute(from, target) == Notoriety.Innocent) { return(false); // Cannot harm innocent mobiles } } if (PlayerGovernmentSystem.CheckIfBanned(from, target)) { return(true); } if (PlayerGovernmentSystem.CheckAtWarWith(from, target)) { return(true); } if (PlayerGovernmentSystem.CheckCityAlly(from, target)) { return(true); } return(true); }
/*private static bool CheckHarmfulStatus( GuildStatus from, GuildStatus target ) * { * if ( from == GuildStatus.Waring && target == GuildStatus.Waring ) * return true; * * return false; * }*/ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } #region Dueling PlayerMobile pmFrom = from as PlayerMobile; PlayerMobile pmTarg = target as PlayerMobile; if (pmFrom == null && from is BaseCreature) { BaseCreature bcFrom = (BaseCreature)from; if (bcFrom.Summoned) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } } if (pmTarg == null && target is BaseCreature) { BaseCreature bcTarg = (BaseCreature)target; if (bcTarg.Summoned) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } } if (pmFrom != null && pmTarg != null) { if (pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started))) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated)) { return(false); } if (pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated && pmFrom.DuelContext != null && pmFrom.DuelContext.IsSuddenDeath) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started) { return(true); } } if ((pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) { return(false); } Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone; if (sz != null /*&& sz.IsDisabled()*/) { return(false); } #endregion Map map = from.Map; #region Factions Faction targetFaction = Faction.Find(target, true); if ((!Core.ML || map == Faction.Facet) && targetFaction != null) { if (Faction.Find(from, true) != targetFaction) { return(false); } } #endregion if (map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0) { return(true); // In felucca, anything goes } if (!from.Player) { return(true); // NPCs have no restrictions } if (target is BaseCreature && !((BaseCreature)target).Controlled) { return(false); // Players cannot heal uncontrolled mobiles } if (from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young)) { return(false); // Young players cannot perform beneficial actions towards older players } Guild fromGuild = from.Guild as Guild; Guild targetGuild = target.Guild as Guild; if (fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly(targetGuild))) { return(true); // Guild members can be beneficial } if (PlayerGovernmentSystem.CheckIfBanned(from, target)) { return(false); } if (PlayerGovernmentSystem.CheckAtWarWith(from, target)) { return(false); } if (PlayerGovernmentSystem.CheckCityAlly(from, target)) { return(true); } return(CheckBeneficialStatus(GetGuildStatus(from), GetGuildStatus(target))); }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { PlayerMobile pm = (PlayerMobile)from; CityManagementStone stone = (CityManagementStone)pm.City; if (stone == null) { from.SendMessage("You must be a citizen of a city to use this!"); } else { Region r = stone.PCRegion; if (PlayerGovernmentSystem.CheckIfHouseInCity(from, r)) { ; } { if (from.Region is HouseRegion) { BaseHouse house = BaseHouse.FindHouseAt(from); if (house.Owner != from) { from.SendMessage("You may not place vendors in a house you do not own!"); } else { Mobile v = new CityPlayerVendor(from, stone); stone.Vendors.Add(v); CityPlayerVendor vend = (CityPlayerVendor)v; vend.TaxRate = stone.IncomeTax; vend.OriginalStone = stone; v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } } else { bool market = false; if (from.Region is CityMarketRegion) { CityMarketRegion cr = (CityMarketRegion)from.Region; if (cr.Stone == stone) { market = true; } } if (PlayerGovernmentSystem.IsAtCity(from) || market) { Mobile v = new CityPlayerVendor(from, stone); stone.Vendors.Add(v); CityPlayerVendor vend = (CityPlayerVendor)v; vend.OriginalStone = stone; vend.TaxRate = stone.IncomeTax; v.Direction = from.Direction & Direction.Mask; v.MoveToWorld(from.Location, from.Map); v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } else { from.SendMessage("You may only do this in a city you are a member of!"); } } } } } }
public static int CorpseNotoriety(Mobile source, Corpse target) { if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } Body body = (Body)target.Amount; BaseCreature cretOwner = target.Owner as BaseCreature; if (cretOwner != null) { Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target.Owner); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target.Owner, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (CheckHouseFlag(source, target.Owner, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } int actual = Notoriety.CanBeAttacked; if (target.Kills >= 5 || (body.IsMonster && IsSummoned(target.Owner as BaseCreature)) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead))) { actual = Notoriety.Murderer; } if (DateTime.Now >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice)) { return(actual); } Party sourceParty = Party.Get(source); List <Mobile> list = target.Aggressors; for (int i = 0; i < list.Count; ++i) { if (list[i] == source || (sourceParty != null && Party.Get(list[i]) == sourceParty)) { return(actual); } } if (PlayerGovernmentSystem.CheckBanLootable(source, target.Owner)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckAtWarWith(source, target.Owner)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckCityAlly(source, target.Owner)) { return(Notoriety.Ally); } return(Notoriety.Innocent); } else { if (target.Kills >= 5 || (body.IsMonster && IsSummoned(target.Owner as BaseCreature)) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal && target.Map != null && ((target.Map.Rules & MapRules.HarmfulRestrictions) == 0)) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target.Owner); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target.Owner, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { List <Mobile> secondList = target.Aggressors; for (int i = 0; i < secondList.Count; ++i) { if (secondList[i] == source || secondList[i] is BaseFactionGuard) { return(Notoriety.Enemy); } } } if (target.Owner != null && target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target.Owner, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target.Owner is PlayerMobile) && !IsPet(target.Owner as BaseCreature)) { return(Notoriety.CanBeAttacked); } List <Mobile> list = target.Aggressors; for (int i = 0; i < list.Count; ++i) { if (list[i] == source) { return(Notoriety.CanBeAttacked); } } if (PlayerGovernmentSystem.CheckBanLootable(source, target.Owner)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckAtWarWith(source, target.Owner)) { return(Notoriety.Enemy); } if (PlayerGovernmentSystem.CheckCityAlly(source, target.Owner)) { return(Notoriety.Ally); } return(Notoriety.Innocent); } }