private static HousePlacementResult HousePlacementRegionCheck(Mobile from, Map map, Point3D testPoint) { Sector sector = map.GetSector(testPoint); ArrayList list = sector.Regions; for (int i = 0; i < list.Count; ++i) { Region region = (Region)list[i]; if (region.Contains(testPoint)) { if (region is HouseRegion) { return(HousePlacementResult.BadRegion); } if (!region.AllowHousing(from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc { if (region is TreasureRegion) { return(HousePlacementResult.BadRegionHidden); } return(HousePlacementResult.BadRegion); } if (region is TownshipRegion) { if (((TownshipRegion)region).CanBuildHouseInTownship(from) == false) { return(HousePlacementResult.BadRegionTownship); } } if (region is NoHousingRegion) { return(HousePlacementResult.BadRegion); } } } return(HousePlacementResult.Valid); }
public virtual bool IsObjective(Mobile mob) { if (m_Creature == null) { return(false); } if (m_Creature.IsAssignableFrom(mob.GetType())) { if (m_Region != null && !m_Region.Contains(mob.Location)) { return(false); } return(true); } return(false); }
private void BootMobiles() { if (m_BootLocation.X != 0 && m_BootLocation.Y != 0) { List <Mobile> toBoot = new List <Mobile>(); Rectangle2D rect = new Rectangle2D(RegionPoint1, RegionPoint2); // Ajout des joueurs déconnectés à la liste de boot. Region regionDC = new Region("Loc", Map.Felucca, 0, rect); foreach (Mobile m in World.Mobiles.Values) { if (m != null) { if (regionDC.Contains(m.LogoutLocation) && !m.IsConnected) { toBoot.Add(m); } } } // Ajout des joueurs connectés à la liste de boot. IPooledEnumerable <Mobile> list = Map.Felucca.GetMobilesInBounds(rect); foreach (Mobile m in list) { if (m != null && !toBoot.Contains(m)) // Better be safe than sorry. { toBoot.Add(m); } } list.Free(); // Application du boot. for (int i = 0; i < toBoot.Count; ++i) { Mobile m = toBoot[i]; m.Location = m_BootLocation; m.LogoutLocation = m_BootLocation; } } }
public override bool IsInside(Point3D p, int height) { if (ForSaleSign == null) { return(false); } if (Map == null || Region == null) { Delete(); return(false); } Sector sector = null; try { if (ForSaleSign is RentalContract && Region.Contains(p)) { return(true); } sector = Map.GetSector(p); return(!sector.Multis.Any(m => m != null && m != this && m is TownHouse && ((TownHouse)m).ForSaleSign is RentalContract && ((TownHouse)m).IsInside(p, height)) && Region.Contains(p)); } catch (Exception e) { Errors.Report("Error occured in IsInside(). More information on the console."); Console.WriteLine("Info:{0}, {1}, {2}", Map, sector, Region); Console.WriteLine(e.Source); Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); return(false); } }
private void SetInitialPageStatus(KernelMemoryMapArray *maps, PageStatus status) { for (var i = 0; i < maps->Count; i++) { var map = maps->Items[i]; if (map.Start >= BootInfo.Header->InstalledPhysicalMemory) { continue; } if ((map.AddressSpaceKind & AddressSpaceKind.Physical) == 0) { continue; } var mapPages = KMath.DivCeil(map.Size, 4096); var fistPageNum = KMath.DivFloor(map.Start, 4096); KernelMessage.WriteLine("Mark Pages from {0:X8}, Size {1:X8}, Type {2}, FirstPage {3}, Pages {4}, Status {5}", map.Start, map.Size, (uint)map.Type, (uint)fistPageNum, mapPages, (uint)status); for (var p = fistPageNum; p < fistPageNum + mapPages; p++) { var addr = p * 4096; if (!Region.Contains(addr)) { continue; } if (addr >= BootInfo.Header->InstalledPhysicalMemory) { KernelMessage.WriteLine("addr >= BootInfo.Header->InstalledPhysicalMemory"); break; } var page = GetPageByNum(p); Assert.IsSet(page, "page == null"); page->Status = status; } } }
public virtual int ComputeSpawnCount() { int playerCount = 0; Map map = this.Map; if (map != null) { Point3D loc = GetWorldLocation(); Sector sec = map.GetSector(loc); ArrayList regions = sec.Regions; for (int i = 0; playerCount == 0 && i < regions.Count; ++i) { Region reg = (Region)regions[i]; if (reg != null && reg != m_Region && reg.Contains(loc)) { playerCount = reg.Players.Count; } } } if (playerCount == 0 && m_Region != null) { playerCount = m_Region.Players.Count; } int count = (playerCount + PlayersPerSpawn - 1) / PlayersPerSpawn; if (count < 1) { count = 1; } return(count); }
public virtual bool IsObjective(Mobile mob) { if (m_Creatures == null) { return(false); } if (m_Region != null && !m_Region.Contains(mob.Location)) { return(false); } for (int i = 0; i < m_Creatures.Length; i++) { Type creature = m_Creatures[i]; if (creature.IsAssignableFrom(mob.GetType())) { return(true); } } return(false); }
private bool IsMouseHovering() { return((!PositionLocked || Util.IsControlDown()) && IsHudVisible() && Region.Contains(mMousePos)); }
private void Update() { // Panning with WASD float speed = 5.0f; if (Input.GetKey(KeyCode.D)) { transform.Translate(new Vector3(speed * Time.deltaTime, 0, 0)); } if (Input.GetKey(KeyCode.A)) { transform.Translate(new Vector3(-speed * Time.deltaTime, 0, 0)); } if (Input.GetKey(KeyCode.S)) { transform.Translate(new Vector3(0, -speed * Time.deltaTime, 0)); } if (Input.GetKey(KeyCode.W)) { transform.Translate(new Vector3(0, speed * Time.deltaTime, 0)); } // Check for lock. Do nothing if not acquired. if (_inputLock.IsLocked) { return; } positionToMoveTo = transform.position; float cameraAspectSize = _camera.orthographicSize * _camera.aspect; Vector3 newCameraPosition = Vector3.zero; if (regionHandler != null && regionHandler.Regions.Count > 0) { Region region = regionHandler.ActiveRegion; // The following block holds the logic for moving the camera on the horizontal axis. If the current regions width is small than that of the width of the // camera, the camera stays fixed at the center of the region. Otherwise it'll move towards the target on the x-axis. if (region.Width < cameraAspectSize * 2) { newCameraPosition.x = region.p0.x + region.Width / 2; } else { newCameraPosition.x = Mathf.Clamp(positionToMoveTo.x, region.p0.x + cameraAspectSize, region.p1.x - cameraAspectSize); } // The same logic but this time for the vertical axis. If the active region is smaller in height than the height of the camera, the camera stays fixed in the // center of the region. if (region.Height < _camera.orthographicSize * 2) { newCameraPosition.y = region.p1.y + region.Height / 2; } else { newCameraPosition.y = Mathf.Clamp(positionToMoveTo.y, region.p1.y + _camera.orthographicSize, region.p0.y - _camera.orthographicSize); } if (!region.Contains(positionToMoveTo)) { regionHandler.SetActiveRegion(positionToMoveTo); } } else { newCameraPosition = positionToMoveTo; } // Restrict the camera to only move on the x- and y-axis. newCameraPosition.z = transform.position.z; // Move towards the new target position that has been defined above. If lerpToTargetPosition is enabled, the camera lerps towards the target. if (lerpToTargetPosition) { transform.position = Vector3.Lerp(transform.position, newCameraPosition, smoothTime); } else { transform.position = newCameraPosition; } // Check if we are hovering UI if (_eventSystem.IsPointerOverGameObject()) { return; } using (_inputLock.Lock()) { // Panning with mouse float mouseSensitivity = 0.02f; if (Input.GetMouseButtonDown(0)) { // We can't inject IGridUnitManager or IGridInputManager since camera controller lives // in the project context, so we have to raycast :/. if (Physics2D.Raycast(_camera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, 1000.0f, LayerMask.GetMask("Units")).collider != null) { return; } lastPosition = Input.mousePosition; } if (Input.GetMouseButton(0) && lastPosition != null) { Vector3 delta = Input.mousePosition - lastPosition.Value; transform.Translate(-delta.x * mouseSensitivity, -delta.y * mouseSensitivity, 0); lastPosition = Input.mousePosition; } if (Input.GetMouseButtonUp(0)) { lastPosition = null; } } }
private Dictionary <int, Queue <ICommand> > GetCommadsQueue(State state, List <Vector> points, Region region, bool flag) { var commands = new Dictionary <int, Queue <ICommand> >(); var fobidden = new HashSet <Vector>(); var used = new HashSet <Vector>(); for (var index = 0; index < points.Count; index++) { var bot = state.Bots[index]; var target = points[index]; if ((bot.Pos - target).IsNd) { continue; } var point = GetNearestTargetPoint(bot.Pos, target, v => state.Matrix.Contains(v) && !region.Contains(v) && state.Bots.All(x => bot.Bid == x.Bid || x.Pos != v) && !used.Contains(v) && !fobidden.Contains(v)); if (point == null) { continue; } used.Add(point); fobidden.UnionWith(used); var(positions, moveCommands) = GetMoveCommands(state, bot, point, fobidden, flag); if (positions.Any()) { fobidden.UnionWith(positions); } if (moveCommands.Any()) { commands.Add(bot.Bid, new Queue <ICommand>(moveCommands)); } } for (var i = points.Count; i < state.Bots.Length; i++) { var bot = state.Bots[i]; if (region.Contains(bot.Pos)) { var point = new Vector(0, 0, i); used.Add(point); fobidden.UnionWith(used); var(positions, moveCommands) = GetMoveCommands(state, bot, point, fobidden, flag); fobidden.UnionWith(positions); if (moveCommands.Any()) { commands.Add(bot.Bid, new Queue <ICommand>(moveCommands)); } } } return(commands); }
public bool MatchesTerms(string terms) { return(Address.Contains(terms, System.StringComparison.OrdinalIgnoreCase) || Region.Contains(terms, System.StringComparison.OrdinalIgnoreCase) || PostalCode.Contains(terms, System.StringComparison.OrdinalIgnoreCase)); }
public bool Contains(IntVector3 p) { return(m_region.Contains(p)); }
public static void EJECTREGIONPLAYERS(TriggerObject trigObject, Region region) { var mobs = region.GetMobiles(); ArrayList murdererRectangles = new ArrayList(MurdererEjectionRectangles); ArrayList normalRectangles = new ArrayList(EjectionRectangles); foreach (Mobile m in mobs) { if (m.Player) { if (m.Kills < 5) { if (!MOVETOSPAWNLOCATION(trigObject, m, Map.Felucca, normalRectangles)) { m.MoveToWorld(new Point3D(2667, 2108, 0), Map.Felucca); // bucs, shouldn't ever get here really } } else { if (!MOVETOSPAWNLOCATION(trigObject, m, Map.Felucca, murdererRectangles)) { m.MoveToWorld(new Point3D(2667, 2108, 0), Map.Felucca); // bucs, shouldn't ever get here really } } } else if (m is BaseCreature) { BaseCreature bc = (BaseCreature)m; if (bc.ControlMaster != null && bc.ControlMaster.Player && bc.ControlMaster.Map == Map.Felucca) { bc.MoveToWorld(bc.ControlMaster.Location, bc.ControlMaster.Map); } } } // now boot out any logged out mobs in the region foreach (Mobile m in World.Mobiles.Values.Where( m => !m.Deleted && m.Player && m.Map == Map.Internal && m.LogoutMap == region.Map && region.Contains(m.LogoutLocation)) ) { m.LogoutMap = Map.Felucca; // brit bank : buc's den m.LogoutLocation = m.Kills < 5 ? new Point3D(1438, 1690, 0) : new Point3D(2722, 2184, 0); } }
/// <inheritdoc /> public override bool Test(Extent extent, Vector position) => _region.Contains(position);
public bool ContainsPage(Page *page) { var addr = GetAddress(page); return(Region.Contains(addr)); }
public virtual Region PickRandomDestination(out Point3D point) { point = new Point3D(); if (SystemInitialized() == false) { return(null); // Not yet fully initialized } // sanity if (GetPossibleDestinations() == null || GetPossibleDestinations().Length == 0) { return(null); } string[] px = GetPossibleDestinations(); object[,] places = new object[px.Length, 2]; for (int ix = 0; ix < px.Length; ix++) { places[ix, 0] = px[ix]; places[ix, 1] = Utility.RandomDouble(); } // Bubble sort method. object[,] holder = new object[1, 2]; for (int x = 0; x < px.Length; x++) { for (int y = 0; y < px.Length - 1; y++) { if ((double)places[y, 1] > (double)places[y + 1, 1]) { // holder = places[y + 1]; holder[0, 0] = places[y + 1, 0]; holder[0, 1] = places[y + 1, 1]; // places[y + 1] = places[y]; places[y + 1, 0] = places[y, 0]; places[y + 1, 1] = places[y, 1]; // places[y] = holder; places[y, 0] = holder[0, 0]; places[y, 1] = holder[0, 1]; } } } for (int jx = 0; jx < px.Length; jx++) { Region reg = Find(places[jx, 0] as string); // keep trying if we pick a spot where we are if (reg == null || reg.Contains(this.Location) || reg.Name == null || reg.Name == "" || reg.Name == "DynRegion") { continue; } point = Point3D.Parse(places[jx, 0] as string); return(reg); } return(null); // Adam: remove this old implementation as it can loop forever if the array passed is bad. /*if (SystemInitialized() == false) * return null; // Not yet fully initialized * * string[] possible = GetPossibleDestinations(); * string picked = null; * Region test = null; * * while (picked == null && possible != null) * { * picked = possible[Utility.Random(possible.Length)]; * test = Find(picked); * * // keep trying if we pick a spot where we are * if (test == null || test.Contains(this.Location) || test.Name == null || test.Name == "" || test.Name == "DynRegion") || picked = null; ||} || ||return test;*/ }
public static CustomRegion FindDRDTRegion(Map map, Point3D loc) { Point3D p = loc; if (p == Point3D.Zero) { return(null); } if (map == Map.Internal || map == null) { return(null); } Sector sector = map.GetSector(p); if (sector == null || sector.Owner == null || sector == sector.Owner.InvalidSector) { return(null); } if (sector.Regions == null) //new check 2/2/07 { return(null); } ArrayList list = sector.Regions; if (list == null || list.Count == 0) { return(null); } ArrayList list2 = new ArrayList(); for (int i = 0; i < list.Count; ++i) { if (list[i] is Region) //new check 2/2/07 { Region region = (Region)list[i]; if (region == null) { continue; } if (region.Contains(p)) { list2.Add(region); } } } foreach (Region reg in list2) { if (reg == null) { continue; } CustomRegion test = null; if (reg is CustomRegion) { test = reg as CustomRegion; if (test != null) { return(test); } } } //no custom region found return(null); }
protected override void Script() { Scaling.Init(); var isInSupport = AutoBattle.IsInSupport(); var supportBound = new Region(53 * 2, 0, 143 * 2, 110 * 2); var regionAnchor = ImageLocator.SupportRegionTool; var regionArray = AutomataApi.FindAll(new Region(2100, 0, 300, 1440), regionAnchor, Support.SupportRegionToolSimilarity); var screenBounds = new Region(0, 0, Game.ScriptWidth, Game.ScriptHeight); var timestamp = DateTime.Now.Ticks; var i = 0; foreach (var testRegion in regionArray) { // At max two Servant+CE are completely on screen if (i > 1) { break; } if (isInSupport) { supportBound.Y = testRegion.Y - 70 + 68 * 2; } else // Assume we are on Friend List { supportBound.Y = testRegion.Y + 82; supportBound.X += 10; } if (!screenBounds.Contains(supportBound)) { continue; } using var pattern = supportBound.GetPattern(); var servant = pattern.Crop(new Region(0, 0, 125, 44)); servant.Save(GetServantImgPath(timestamp, i)); var ce = pattern.Crop(new Region(0, 80, pattern.Width, 25)); ce.Save(GetCeImgPath(timestamp, i)); ++i; } if (i == 0) { throw new ScriptExitException("No support images were found on the current screen. Are you on Support selection or Friend list screen?"); } if (_callback != null) { _callback.Invoke(timestamp.ToString()); _callback = null; } throw new ScriptExitException($"Support Image(s) were generated."); }
public unsafe bool ContainsPage(Page *page) { return(Region.Contains(page->Address)); }
public void ContainsTest() { XmlElement xml = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 Region parent = null; // TODO: 初始化为适当的值 Region target = new Region( xml, map, parent ); // TODO: 初始化为适当的值 Point3D point3D = new Point3D(); // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.Contains( point3D ); Assert.AreEqual( expected, actual ); Assert.Inconclusive( "验证此测试方法的正确性。" ); }
protected override Direction Next(Agent agent) { if (_initialRegion == null) { _initialRegion = Region.FromMap(agent.WorkingMap) .Where(x => x.Tier == 0) .OrderByDescending(x => x.Area * _rand.NextDouble()) .First(); _visitedInitialRegion = _rand.NextDouble() < 0.25; } if (!_visitedInitialRegion) { _visitedInitialRegion = _initialRegion.Contains(agent.Pos); } if (!_visitedInitialRegion) { var nearest = _initialRegion .OrderBy(x => x.Distance(agent.Pos)) .First(); return(agent.GetDirection(nearest)); } var validDirs = new List <Direction>(); if (agent.X > 0) { validDirs.Add(Direction.West); } if (agent.Y > 0) { validDirs.Add(Direction.North); } if (agent.X < Map.Width - 1) { validDirs.Add(Direction.East); } if (agent.Y < Map.Height - 1) { validDirs.Add(Direction.South); } var dirs = validDirs .Select(x => Tuple.Create(x, GetScore(agent, x))) .Where(x => x.Item2 > 0.0) .OrderBy(x => _rand.Next()) .OrderByDescending(x => x.Item2) .ToList(); if (dirs.Count == 0) { for (int r = 1; r < Map.Width; ++r) { var scores = agent.Pos.GetNeighbours(r) .Select(x => Tuple.Create(agent.GetDirection(x), agent.WorkingMap[x])) .Where(x => x.Item2 > 0.0); if (scores.Count() == 0) { continue; } dirs = validDirs .Select(x => Tuple.Create(x, scores .Where(y => y.Item1 == x) .Sum(y => y.Item2))) .OrderByDescending(x => x.Item2) .ToList(); break; } } if (dirs.Count == 0) { return(Direction.None); } while (dirs.Count > 1 && _rand.NextDouble() < _error) { dirs.RemoveAt(0); } return(dirs.First().Item1); }
public void WindowMessage(Decal.Adapter.WindowMessageEventArgs e) { const short WM_MOUSEMOVE = 0x200; const short WM_LBUTTONDOWN = 0x201; const short WM_LBUTTONUP = 0x202; const short WM_RBUTTONDOWN = 0x0204; const short WM_RBUTTONUP = 0x0205; // A hack to reduce the number of checks for every windows message const short HANDLED_MESSAGES = WM_RBUTTONDOWN | WM_LBUTTONDOWN | WM_LBUTTONUP | WM_RBUTTONUP | WM_MOUSEMOVE; if (!Visible || (e.Msg & HANDLED_MESSAGES) == 0) { return; } Point prevMousePos = mMousePos; mMousePos = new Point(e.LParam); bool prevMouseOverHud = mMouseOverHud; mMouseOverHud = Region.Contains(mMousePos); MouseButtons mouseButton = MouseButtons.None; if (e.Msg == WM_MOUSEMOVE) { } else if (e.Msg == WM_LBUTTONDOWN || e.Msg == WM_LBUTTONUP) { mouseButton = MouseButtons.Left; } else if (e.Msg == WM_RBUTTONDOWN || e.Msg == WM_RBUTTONUP) { mouseButton = MouseButtons.Right; } Point relativeMousePos = new Point(mMousePos.X - Location.X, mMousePos.Y - Location.Y); switch (e.Msg) { case WM_MOUSEMOVE: if (mMovingHud) { // Snap to edge int x = mMousePos.X + mMouseDownOffset.X; int y = mMousePos.Y + mMouseDownOffset.Y; Rectangle me = new Rectangle(x, y, mSize.Width, mSize.Height); Rectangle r3D = Util.Region3D; Rectangle rAC = Util.RegionWindow; if (Math.Abs(me.Left - r3D.Left) < SnapToEdgePixels) { me.X = r3D.Left; } else if (me.Left - rAC.Left < SnapToEdgePixels) { me.X = rAC.Left; } else if (Math.Abs(me.Right - r3D.Right) < SnapToEdgePixels) { me.X = r3D.Right - me.Width; } else if (rAC.Right - me.Right < SnapToEdgePixels) { me.X = rAC.Right - me.Width; } if (Math.Abs(me.Top - r3D.Top) < SnapToEdgePixels) { me.Y = r3D.Top; } else if (me.Top - rAC.Top < SnapToEdgePixels) { me.Y = rAC.Top; } else if (Math.Abs(me.Bottom - r3D.Bottom) < SnapToEdgePixels) { me.Y = r3D.Bottom - me.Height; } else if (rAC.Bottom - me.Bottom < SnapToEdgePixels) { me.Y = rAC.Bottom - me.Height; } Location = new Point(me.X, me.Y); } else if (mMousePressedOverHud || mMouseOverHud) { foreach (ToolbarButton b in mButtons) { b.MouseHovering = b.Region.Contains(relativeMousePos); } } break; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: if (e.Msg == WM_RBUTTONDOWN && !RespondsToRightClick) { break; } if (mMouseOverHud) { e.Eat = true; mMousePressedOverHud = true; bool onButton = false; foreach (ToolbarButton b in mButtons) { if (b.Region.Contains(relativeMousePos)) { b.MousePressed = true; onButton = true; break; } } if (!onButton) { mMovingHud = true; mMouseDownOffset = new Point(Location.X - mMousePos.X, Location.Y - mMousePos.Y); } } if (e.Eat) { mMouseDownEaten |= mouseButton; } break; case WM_LBUTTONUP: case WM_RBUTTONUP: if (e.Msg == WM_RBUTTONUP && !RespondsToRightClick) { break; } mMovingHud = false; if (mMousePressedOverHud || mMouseOverHud) { foreach (ToolbarButton b in mButtons) { if (b.MousePressed && b.Region.Contains(relativeMousePos)) { b.HandleClick(); break; } b.MousePressed = false; } } if ((mMouseDownEaten & mouseButton) != 0) { e.Eat = true; mMouseDownEaten &= ~mouseButton; } break; } if (prevMouseOverHud && !mMouseOverHud) { foreach (ToolbarButton b in mButtons) { b.MouseHovering = false; } } }
public bool IsInRadius(Point touchPosition) { return(Region.Contains(touchPosition)); }
public static bool REGIONCONTAINS(TriggerObject trigObject, Region region, IPoint3D location) { return region != null && location != null && region.Contains(new Point3D(location)); }
/*public Rectangle2D[] Bounds * { * get{ return m_Bounds; } * }*/ public bool Contains(Point3D p) { return(m_Region.Contains(p)); }
public static void WipeMagicToTarget(Mobile from, object target) { try { Region region = null; if (target is HouseSign) { BaseHouse bh = (target as HouseSign).Structure; if (bh == null) { from.SendMessage("This house sign is not associated with any house."); return; } region = bh.Region; if (region == null) { from.SendMessage("This house is not associated with any region."); return; } } else if (target is TownshipStone) { region = (target as TownshipStone).MyRegion; if (region == null) { from.SendMessage("This township stone is not associated with any region."); return; } } from.SendMessage("Searching for runes marked for this region"); LogHelper Logger = new LogHelper("WipeMagicToTarget.log", from, false); foreach (Item item in World.Items.Values) { if (item is RecallRune) { RecallRune rune = (RecallRune)item; if (rune.Marked && rune.TargetMap != null && region.Contains(rune.Target)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, rune, rune.Description); rune.Target = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, rune, rune.Description); rune.Target = new Point3D(0, 0, 0); } } } else if (item is Moonstone) { Moonstone stone = (Moonstone)item; if (stone.Marked && region.Contains(stone.Destination)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, stone, stone.Description); stone.Destination = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, stone, stone.Description); stone.Destination = new Point3D(0, 0, 0); } } } else if (item is Runebook) { Runebook book = (Runebook)item; for (int i = 0; i < book.Entries.Count; ++i) { RunebookEntry entry = (RunebookEntry)book.Entries[i]; if (entry.Map != null && region.Contains(entry.Location)) { object root = item.RootParent; if (root is Mobile) { if (((Mobile)root).AccessLevel < AccessLevel.GameMaster) { Logger.Log(LogType.Item, item, string.Format("{0}:{1}:{2}", i, entry.Description, book.Description)); entry.Location = new Point3D(0, 0, 0); } } else { Logger.Log(LogType.Item, item, string.Format("{0}:{1}:{2}", i, entry.Description, book.Description)); entry.Location = new Point3D(0, 0, 0); } } } } } Logger.Finish(); from.SendMessage("Done searching for runes withing house regions"); // okay, now turn off all house security //int houseschecked = Server.Multis.BaseHouse.SetSecurity(false); //e.Mobile.SendMessage("Setting {0} houses to insecure",houseschecked); return; } catch (Exception exc) { from.SendMessage("Exception in [findrunes -- see console."); System.Console.WriteLine("Exception in [findrunes: {0}", exc.Message); System.Console.WriteLine(exc.StackTrace); return; } }
public virtual bool CheckAtDestination() { if (m_Quest != null) { EscortObjective escort = GetObjective(); if (escort == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter == null) { return(false); } if (escort.Region != null && escort.Region.Contains(Location)) { Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. escort.Complete(); if (m_Quest.Completed) { escorter.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete. if (QuestHelper.AnyRewards(m_Quest)) { escorter.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Rewards, false, true)); } else { m_Quest.GiveRewards(); } escorter.PlaySound(m_Quest.CompleteSound); StopFollow(); m_EscortTable.Remove(escorter); m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete)); // fame Misc.Titles.AwardFame(escorter, escort.Fame, true); // compassion bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 times in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } else if (VirtueHelper.Award(pm, VirtueName.Compassion, escort.Compassion, ref gainedPath)) { pm.SendLocalizedMessage(1074949, null, 0x2A); // You have demonstrated your compassion! Your kind actions have been noted. if (gainedPath) { pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } else { pm.SendLocalizedMessage(1053002); // You have gained in compassion. } pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } } else { escorter.PlaySound(m_Quest.UpdateSound); } return(true); } } else if (!m_Checked) { Region region = GetDestination(); if (region != null && region.Contains(Location)) { m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete)); m_Checked = true; } } return(false); }
/// <summary> /// Clears the buildings in region. /// </summary> /// <param name='region'> /// Region in world space. /// </param> private void ClearBuildingsInRegion(Region region) { Vector3 p; GameObject[] instances = m_buildingInstances.ToArray(); foreach (GameObject go in instances) { p = go.transform.position; if (!region.Contains(p)) { continue; } m_buildingInstances.Remove(go); Destroy(go); } }