public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 1: { m_House = reader.ReadItem() as BaseHouse; goto case 0; } case 0: { m_Description = reader.ReadString(); m_Marked = reader.ReadBool(); m_Target = reader.ReadPoint3D(); m_TargetMap = reader.ReadMap(); CalculateHue(); break; } } }
public LocationStruct(GenericReader reader) { int version = reader.ReadInt(); Map = reader.ReadMap(); Location = reader.ReadPoint3D(); Name = reader.ReadString(); }
public override bool OnDragDropInto( Mobile from, Item dropped, Point3D point ) { BasePiece piece = dropped as BasePiece; if ( piece != null && piece.Board == this && base.OnDragDropInto( from, dropped, point ) ) { Packet p = new PlaySound( 0x127, GetWorldLocation() ); p.Acquire(); if ( RootParent == from ) { from.Send( p ); } else { foreach ( NetState state in this.GetClientsInRange( 2 ) ) state.Send( p ); } p.Release(); return true; } else { return false; } }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (this.TurnedOn && this.IsLockedDown && (!m.Hidden || m.IsPlayer()) && Utility.InRange(m.Location, this.Location, 2) && !Utility.InRange(oldLocation, this.Location, 2)) Effects.PlaySound(this.Location, this.Map, m_Sounds[Utility.Random(m_Sounds.Length)]); base.OnMovement(m, oldLocation); }
private static void Main() { Point3D point = new Point3D(2, 4, 6); Point3D pointTwo = new Point3D(8, 5, 3); Console.WriteLine("First point:"); Console.WriteLine(point.ToString()); Console.WriteLine(); Console.WriteLine("Second point:"); Console.WriteLine(pointTwo.ToString()); Console.WriteLine(); Console.WriteLine("Distance:"); Console.WriteLine(DistanceTwo3DPoints.CalcDistance(point, pointTwo)); Console.WriteLine(); Console.WriteLine("Center of coordinate system:"); Console.WriteLine(Point3D.zero.ToString()); Console.WriteLine(); Console.WriteLine("Writing in file \"Paths.txt\" first point, second point, first point again!"); Path firstPath = new Path(); firstPath.AddPoint(pointTwo); firstPath.AddPoint(point); firstPath.AddPoint(pointTwo); PathStorage.SavePath(firstPath); Console.WriteLine("File is saved"); Console.WriteLine(); Console.WriteLine("Loading points from file \"Paths.txt\""); List<Path> pathList = PathStorage.LoadPath(); foreach (var path in pathList) { foreach (var pointers in path.Paths) { Console.WriteLine(pointers); } } }
static void Main() { //Initializing points Point3D a = new Point3D(-7,-4, 3); Point3D b = new Point3D(17, 6, 2.5); //Print points and distance between them Console.WriteLine("the distance between point {0} and point {1} is {2}", a,b,DistanceCalculator.Calculate(a,b)); //Print the static start point Console.WriteLine("Start Point is:{0}",Point3D.Start.ToString()); //Load path from file Path path = PathStorage.Load("../../points.txt"); for (int i = 0; i < path.Count; i++ ) { Console.WriteLine("Point {0}: {1}", i, path[i].ToString()); } //Save new point to file PathStorage.Save("../../points.txt", new Point3D(9, 9, 9)); Console.WriteLine("List after adding a new point {9,9,9}:"); Path newPath = PathStorage.Load("../../points.txt"); for (int i = 0; i < newPath.Count; i++) { Console.WriteLine("Point {0}: {1}", i, newPath[i].ToString()); } }
public ConferenceRoom(GraphicsInterface gi, Vector3D roomSize) : base(gi, roomSize, new Vector3D(0, roomSize.Y / 2.0f, 0), new Resolution(10, 10)) { fWallTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Wall.tiff", false); fCeilingTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Ceiling.tiff", false); fFloorTexture = TextureHelper.CreateTextureFromFile(gi, "Textures\\Carpet_berber_dirt.jpg", false); fChildren = new List<IRenderable>(); SetWallTexture(AABBFace.Ceiling, fCeilingTexture); SetWallTexture(AABBFace.Floor, fFloorTexture); SetWallTexture(AABBFace.Front, fWallTexture); SetWallTexture(AABBFace.Back, fWallTexture); SetWallTexture(AABBFace.Left, fWallTexture); SetWallTexture(AABBFace.Right, fWallTexture); Vector3D wbSize = new Vector3D(4.0f-(0.305f*2.0f), 3.0f, 0.01f); Point3D wbTrans = new Point3D(0, (wbSize.Y/2)+(roomSize.Y-wbSize.Y)/2, -roomSize.Z / 2.0f+.02f); AABB wbBB = new AABB(wbSize, wbTrans); whiteboard = new Whiteboard(gi, wbBB); //whiteboard.ImageSource = localCamProjector; fTable = new PedestalTable(gi); fChildren.Add(whiteboard); fChildren.Add(fTable); }
public static double CalcDistance(Point3D pointOne, Point3D pointTwo) { double distance = 0; distance = Math.Sqrt(Math.Pow(pointOne.pointX - pointTwo.pointX, 2) + Math.Pow(pointOne.pointY - pointTwo.pointY, 2) + Math.Pow(pointOne.pointZ - pointTwo.pointZ, 2)); return distance; }
public override bool DropToItem( Mobile from, Item target, Point3D p ) { bool ret = base.DropToItem( from, target, p ); if ( ret && !Accepted && Parent != from.Backpack ) { if ( from.AccessLevel > AccessLevel.Player ) { return true; } else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) ) { return true; } else { from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest. return false; } } else { return ret; } }
public void Effect( Point3D loc, Map map, bool checkMulti ) { if ( map == null || (!Core.AOS && Caster.Map != map) ) { Caster.SendLocalizedMessage( 1005570 ); // You can not gate to another facet. } else if ( !map.CanFit( loc.X, loc.Y, loc.Z, 16 ) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( (checkMulti && SpellHelper.CheckMulti( loc, map )) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( !SpellHelper.CheckTravel( Caster, loc, map, TravelType.Gate ) && Caster.AccessLevel == AccessLevel.Player ) { Caster.PlaySound( 0x5C ); } else if ( CheckSequence() ) { Caster.SendLocalizedMessage( 501024 ); // You open a magical gate to another location Effects.PlaySound( Caster.Location, Caster.Map, 0x20E ); InternalItem firstGate = new InternalItem( loc, map ); firstGate.MoveToWorld( Caster.Location, Caster.Map ); Effects.PlaySound( loc, map, 0x20E ); InternalItem secondGate = new InternalItem( Caster.Location, Caster.Map ); secondGate.MoveToWorld( loc, map ); } FinishSequence(); }
public static bool InLOS(this Item item, Point3D target) { if (item.Deleted || item.Map == null || item.Parent != null) return false; return item.Map.LineOfSight(item, target); }
public override bool DropToMobile( Mobile from, Mobile target, Point3D p ) { bool ret = base.DropToMobile( from, target, p ); if ( ret && !Accepted && Parent != from.Backpack ) { if ( from.AccessLevel > AccessLevel.Player ) { return true; } else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) ) { return true; } else { from.SendLocalizedMessage( 1049344 ); // You decide against trading the item. You still need it for your quest. return false; } } else { return ret; } }
public SignEntry( string text, Point3D pt, int itemID, int mapLoc ) { m_Text = text; m_Location = pt; m_ItemID = itemID; m_Map = mapLoc; }
public static Path3D LoadPointCoordinates(string path) { Path3D points = new Path3D(); using (var fileSource = new StreamReader(path, Encoding.UTF8)) { string line = fileSource.ReadLine(); while (line != null) { int[] pointCordinates = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries). Select(int.Parse).ToArray(); if (pointCordinates.Length != 3) { throw new ArgumentException(); } Point3D point = new Point3D(pointCordinates[0], pointCordinates[1], pointCordinates[2]); points.AddPoints(point); line = Console.ReadLine(); } } return points; }
public void Target( IPoint3D point ) { Point3D p = new Point3D( point ); Map map = Caster.Map; if ( map == null ) return; HouseRegion r = Region.Find( p, map ).GetRegion( typeof( HouseRegion ) ) as HouseRegion; if ( r != null && r.House != null && !r.House.IsFriend( Caster ) ) return; if ( !map.CanSpawnMobile( p.X, p.Y, p.Z ) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() ) { TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills.Spellweaving.Value / 24 + 25 + FocusLevel * 2 ); NatureFury nf = new NatureFury(); BaseCreature.Summon( nf, false, Caster, p, 0x5CB, duration ); new InternalTimer( nf ).Start(); } FinishSequence(); }
public static Path3D LoadPaths(string fileName) { try { string input = File.ReadAllText(fileName); string pattern = @"X=(.+?), Y=(.+?), Z=(.+?)"; var reg = new Regex(pattern); var matchs = reg.Matches(input); Path3D path = new Path3D(); foreach (Match match in matchs) { double x = double.Parse(match.Groups[1].Value); double y = double.Parse(match.Groups[2].Value); double z = double.Parse(match.Groups[3].Value); Point3D point = new Point3D(x, y, z); path.AddPoint(point); } return path; } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex.InnerException; } }
public MoleHideInfo( Point3D loc, Map map, Mobile user ) { m_Location = loc; m_Map = map; m_User = user; m_Count = 9; }
protected override void OnTarget(Mobile from, object o) { IPoint3D ip = o as IPoint3D; if (ip != null) { if (ip is Item) ip = ((Item)ip).GetWorldTop(); Point3D p = new Point3D(ip); Region reg = Region.Find(new Point3D(p), from.Map); if (from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing(from, p)) this.m_Deed.OnPlacement(from, p); else if (reg.IsPartOf(typeof(TempNoHousingRegion))) from.SendLocalizedMessage(501270); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time. else if (reg.IsPartOf(typeof(TreasureRegion)) || reg.IsPartOf(typeof(HouseRegion))) from.SendLocalizedMessage(1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain. else if (reg.IsPartOf(typeof(HouseRaffleRegion))) from.SendLocalizedMessage(1150493); // You must have a deed for this plot of land in order to build here. else from.SendLocalizedMessage(501265); // Housing can not be created in this area. } }
public override void OnMovement( Mobile m, Point3D oldLocation ) { if ( m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) && Utility.InRange( m.Location, Location, 2 ) && !Utility.InRange( oldLocation, Location, 2 ) ) Effects.PlaySound( Location, Map, m_Sounds[Utility.Random( m_Sounds.Length )] ); base.OnMovement( m, oldLocation ); }
public static Path LoadPath(string filePath) { if (String.IsNullOrWhiteSpace(filePath)) { throw new ArgumentException("File name cannot be null or empty."); } if (!File.Exists(filePath)) { throw new ArgumentException("The specified file doesn't exist in the local file system."); } Path path = new Path(); using (StreamReader fileReader = new StreamReader(filePath)) { string line; while ((line = fileReader.ReadLine()) != null) { string[] coordinates = line.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); int x; int y; int z; if (coordinates.Length == 3 && Int32.TryParse(coordinates[0], out x) && Int32.TryParse(coordinates[1], out y) && Int32.TryParse(coordinates[2], out z)) { Point3D point = new Point3D(x, y, z); path.AddPoint(point); } } } return path; }
public static List<Path> LoadPath() { Path loadPath = new Path(); List<Path> pathsLoaded = new List<Path>(); using (StreamReader reader = new StreamReader(@"../../PathLoads.txt")) { string line = reader.ReadLine(); while (line != null) { if (line != "-") { Point3D point = new Point3D(); string[] points = line.Split(','); point.pointX = int.Parse(points[0]); point.pointY = int.Parse(points[1]); point.pointZ = int.Parse(points[2]); loadPath.AddPoint(point); } else { pathsLoaded.Add(loadPath); loadPath = new Path(); } line = reader.ReadLine(); } } return pathsLoaded; }
public override void OnMovement( Mobile m, Point3D oldLocation ) { if ( m.Player && InRange( m, 6 ) && !InRange( oldLocation, 6 ) ) TryTalkTo( m, false ); base.OnMovement( m, oldLocation ); }
public static Path3D LoadPathFromFile(string filepath) { Path3D path = new Path3D(); using (StreamReader reader = new StreamReader(filepath)) { string line = reader.ReadLine(); const string PointPattern = @"[xyz=:\-\s](\d+(?:(?:\.|,)\d+)*)"; while (line != null) { MatchCollection matches = Regex.Matches(line, PointPattern); if (matches.Count == 3) { double x = double.Parse(matches[0].Groups[1].Value); double y = double.Parse(matches[1].Groups[1].Value); double z = double.Parse(matches[2].Groups[1].Value); Point3D point = new Point3D(x, y, z); path.AddPoints(point); } line = reader.ReadLine(); } } return path; }
public override void OnMovement(Mobile m, Point3D oldLocation) { base.OnMovement(m, oldLocation); Tournament tourny = null; if (this.m_Tournament != null) tourny = this.m_Tournament.Tournament; if (this.InRange(m, 4) && !this.InRange(oldLocation, 4) && tourny != null && tourny.Stage == TournamentStage.Signup && m.CanBeginAction(this)) { Ladder ladder = Ladder.Instance; if (ladder != null) { LadderEntry entry = ladder.Find(m); if (entry != null && Ladder.GetLevel(entry.Experience) < tourny.LevelRequirement) return; } if (tourny.HasParticipant(m)) return; this.PrivateOverheadMessage(MessageType.Regular, 0x35, false, String.Format("Hello m'{0}. Dost thou wish to enter this tournament? You need only to write your name in this book.", m.Female ? "Lady" : "Lord"), m.NetState); m.BeginAction(this); Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseLock_Callback), m); } }
public void BeginLaunch( Mobile from, bool useCharges ) { Map map = from.Map; if ( map == null || map == Map.Internal ) return; if ( useCharges ) { if ( Charges > 0 ) { --Charges; } else { from.SendLocalizedMessage( 502412 ); // There are no charges left on that item. return; } } from.SendLocalizedMessage( 502615 ); // You launch a firework! Point3D ourLoc = GetWorldLocation(); Point3D startLoc = new Point3D( ourLoc.X, ourLoc.Y, ourLoc.Z + 10 ); Point3D endLoc = new Point3D( startLoc.X + Utility.RandomMinMax( -2, 2 ), startLoc.Y + Utility.RandomMinMax( -2, 2 ), startLoc.Z + 32 ); Effects.SendMovingEffect( new Entity( Serial.Zero, startLoc, map ), new Entity( Serial.Zero, endLoc, map ), 0x36E4, 5, 0, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( FinishLaunch ), new object[]{ from, endLoc, map } ); }
public override bool AllowHousing(Mobile from, Point3D p) { if (from.AccessLevel < AccessLevel.GameMaster) return false; return base.AllowHousing(from, p); }
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation) { if (m.Player && Factions.Sigil.ExistsOn(m)) { m.SendMessage(0x22, "You are holding a sigil and cannot enter this zone."); return false; } PlayerMobile pm = m as PlayerMobile; if (pm == null && m is BaseCreature) { BaseCreature bc = (BaseCreature)m; if (bc.Summoned) pm = bc.SummonMaster as PlayerMobile; } if (pm != null && pm.DuelContext != null && pm.DuelContext.StartedBeginCountdown) return true; if (DuelContext.CheckCombat(m)) { m.SendMessage(0x22, "You have recently been in combat and cannot enter this zone."); return false; } return base.OnMoveInto(m, d, newLocation, oldLocation); }
public StrongholdDefinition( Rectangle2D[] area, Point3D joinStone, Point3D factionStone, Point3D[] monoliths ) { m_Area = area; m_JoinStone = joinStone; m_FactionStone = factionStone; m_Monoliths = monoliths; }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckSequence() ) { SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); Effects.PlaySound( p, Caster.Map, 0x382 ); Point3D loc = new Point3D( p.X, p.Y, p.Z ); Item item = new InternalItem( loc, Caster.Map, Caster ); } FinishSequence(); }
public override bool OnDragDropInto( Mobile from, Item item, Point3D p ) { if ( m_Boat == null || !m_Boat.Contains( from ) || m_Boat.IsMoving ) return false; return base.OnDragDropInto( from, item, p ); }
private void timer_Tick(object sender, EventArgs e) { DateTime now = DateTime.Now; if (_useAgentVisual) { if (_use3D) { meshGeometry.Clear(); ClearViewport(); } for (int i = 0; i < scenario.agentsList.Count; i++) { if (_use3D) { if (scenario.agentsList[i].GetPosition() != new Point(-1, -1)) { Point3D position = new Point3D(scenario.agentsList[i].GetPosition().X - scenario.map.GetMap().GetLength(0) / 2, 0, scenario.agentsList[i].GetPosition().Y - scenario.map.GetMap().GetLength(1) / 2); int key = scenario.agentsList[i].Group; if (!meshGeometry.ContainsKey(key)) { meshGeometry.Add(key, new MeshGeometry3D()); } if (scenario.agentsList[i] is HumanAgent) { meshGeometry[key] = HumanAgentVisual3D.AddAgentGeometry(position, new Size3D(1.0D - new Random(scenario.agentsList[i].ID).NextDouble() / 3, 3.0D - new Random(scenario.agentsList[i].ID).NextDouble(), 1.0D - new Random(scenario.agentsList[i].ID).NextDouble() / 3), meshGeometry[key]); } else if (scenario.agentsList[i] is BusAgent) { //TODO Раньше модели создавались в коде, теперь будут подгружаться из внешнего файла //meshGeometry[key] = BusAgentVisual3D.AddAgentGeometry(position, (scenario.agentsList[i] as BusAgent).Size, meshGeometry[key]); mainViewport.Children.Add(BusAgentVisual3D.GetModel(position, (scenario.agentsList[i] as BusAgent).Size, (scenario.agentsList[i] as BusAgent).Angle)); } else if (scenario.agentsList[i] is TrainAgent) { TrainAgent ag = (scenario.agentsList[i] as TrainAgent); for (int g = 0; g < ag.Positions.Length; g++) { if (ag.NeedDraw[g] == true) { position = new Point3D(ag.Positions[g].X - scenario.map.GetMap().GetLength(0) / 2, 0, ag.Positions[g].Y - scenario.map.GetMap().GetLength(1) / 2); // meshGeometry[key] = TrainAgentVisual3D.AddAgentGeometry(position, (scenario.agentsList[i] as TrainAgent).Size, meshGeometry[key]); mainViewport.Children.Add(TrainAgentVisual3D.GetModel(position, ag.Size, ag.Angles[g])); } } } } } else { if (agentVisuals.ContainsKey(scenario.agentsList[i].ID)) { if (agentVisuals[scenario.agentsList[i].ID].Location != scenario.agentsList[i].GetPosition()) { //double angle; //TODO Здесь раньше расчитывался угол поворота, теперь это все перехало в реализацию агента if (UseAnimation) { //agentVisuals[scenario.agentsList[i].ID].AngleAn = angle; agentVisuals[scenario.agentsList[i].ID].LocationAn = scenario.agentsList[i].GetPosition(); } else { //agentVisuals[scenario.agentsList[i].ID].Angle = angle; agentVisuals[scenario.agentsList[i].ID].Location = scenario.agentsList[i].GetPosition(); } } } else { if (scenario.agentsList[i].GetPosition() != new Point(-1, -1)) { if (scenario.agentsList[i] is HumanAgent) { HumanAgentVisual ag = new HumanAgentVisual(scenario.agentsList[i]); agentVisuals.Add(scenario.agentsList[i].ID, ag); pnlMap.Children.Add(ag); } else if (scenario.agentsList[i] is BusAgent) { BusAgentVisual ag = new BusAgentVisual(scenario.agentsList[i]); agentVisuals.Add(scenario.agentsList[i].ID, ag); pnlMap.Children.Add(ag); } else if (scenario.agentsList[i] is TrainAgent) { TrainAgentVisual ag = new TrainAgentVisual(scenario.agentsList[i]); agentVisuals.Add(scenario.agentsList[i].ID, ag); pnlMap.Children.Add(ag); } } } } } if (Use3D) { //Делаем группу для отрисовки агентов Model3DGroup group = new Model3DGroup(); //Добавляем группы агентов в группу отрисофки foreach (var pair in meshGeometry) { GeometryModel3D geom = new GeometryModel3D(pair.Value, new DiffuseMaterial(AgentVisualBase.GetGroupColor(pair.Key))); group.Children.Add(geom); } //Создаем 3D модель ModelVisual3D model = new ModelVisual3D(); model.Content = group; //Чистим ViewPort TODO теперь он чистится раньше //ClearViewport(); //Заполняем ViewPort моделью mainViewport.Children.Add(model); LightDirectionChanged(); } else { for (int i = 0; i < pnlMap.Children.Count; i++) { if (pnlMap.Children[i] is AgentVisualBase) { AgentVisualBase vag = pnlMap.Children[i] as AgentVisualBase; if (!scenario.agentsList.Contains(vag.agentBase)) { pnlMap.Children.Remove(vag); agentVisuals.Remove(vag.agentBase.ID); i--; } } } } } if (!UseAnimation) { tbBenchmark.Text = ((200 - scenario.Benchmark - (DateTime.Now - now).Ticks / 10000) * 10).ToString(); } else { tbBenchmark.Text = ((4000 - scenario.Benchmark - (DateTime.Now - now).Ticks / 10000) / 2).ToString(); } tbSimulationTime.Text = new DateTime().Add(scenario.currentTime).ToString("HH:mm:ss"); tbAgentsCount.Text = scenario.agentsList.Count.ToString(); }
public static bool CheckMulti(Point3D p, Map map) { return(CheckMulti(p, map, true, 0)); }
public static bool IsSafeZone(Map map, Point3D loc) { return(false); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Map.Deleted) { return; } Map map = m_Map.m_Map; if (m_Map.m_Completed) { from.SendLocalizedMessage(503028); // The treasure for this map has already been found. } /* * else if ( from != m_Map.m_Decoder ) * { * from.SendLocalizedMessage( 503016 ); // Only the person who decoded this map may actually dig up the treasure. * } */ else if (m_Map.m_Decoder != from && !m_Map.HasRequiredSkill(from)) { from.SendLocalizedMessage(503031); // You did not decode this map and have no clue where to look for the treasure. return; } else if (!from.CanBeginAction(typeof(TreasureMap))) { from.SendLocalizedMessage(503020); // You are already digging treasure. } else if (!HasDiggingTool(from)) { from.SendMessage("You must have a digging tool to dig for treasure."); } else if (from.Map != map) { from.SendLocalizedMessage(1010479); // You seem to be in the right place, but may be on the wrong facet! } else { IPoint3D p = targeted as IPoint3D; Point3D targ3D; if (p is Item) { targ3D = ((Item)p).GetWorldLocation(); } else { targ3D = new Point3D(p); } int maxRange; double skillValue = from.Skills[SkillName.Mining].Value; if (skillValue >= 100.0) { maxRange = 4; } else if (skillValue >= 81.0) { maxRange = 3; } else if (skillValue >= 51.0) { maxRange = 2; } else { maxRange = 1; } Point2D loc = m_Map.m_Location; int x = loc.X, y = loc.Y; Point3D chest3D0 = new Point3D(loc, 0); if (Utility.InRange(targ3D, chest3D0, maxRange)) { if (from.Location.X == x && from.Location.Y == y) { from.SendLocalizedMessage(503030); // The chest can't be dug up because you are standing on top of it. } else if (map != null) { int z = map.GetAverageZ(x, y); if (!map.CanFit(x, y, z, 16, true, true)) { from.SendLocalizedMessage(503021); // You have found the treasure chest but something is keeping it from being dug up. } else if (from.BeginAction(typeof(TreasureMap))) { new DigTimer(from, m_Map, new Point3D(x, y, z), map).Start(); } else { from.SendLocalizedMessage(503020); // You are already digging treasure. } } } else if (m_Map.Level > 0) { if (Utility.InRange(targ3D, chest3D0, 8)) // We're close, but not quite { from.SendLocalizedMessage(503032); // You dig and dig but no treasure seems to be here. } else { from.SendLocalizedMessage(503035); // You dig and dig but fail to find any treasure. } } else { if (Utility.InRange(targ3D, chest3D0, 8)) // We're close, but not quite { from.SendAsciiMessage(0x44, "The treasure chest is very close!"); } else { Direction dir = Utility.GetDirection(targ3D, chest3D0); string sDir; switch (dir) { case Direction.North: sDir = "north"; break; case Direction.Right: sDir = "northeast"; break; case Direction.East: sDir = "east"; break; case Direction.Down: sDir = "southeast"; break; case Direction.South: sDir = "south"; break; case Direction.Left: sDir = "southwest"; break; case Direction.West: sDir = "west"; break; default: sDir = "northwest"; break; } from.SendAsciiMessage(0x44, "Try looking for the treasure chest more to the {0}.", sDir); } } } }
public void Place(Mobile from, Point3D location, bool bCheck) { Guild g = from.Guild as Guild;; if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); //This must be in your backpack } else if (g == null) { from.SendMessage("You must be a member of a guild to use this."); } else { BaseHouse house = BaseHouse.FindHouseAt(from); Guildstone stone = null; if (house != null) { stone = house.FindGuildstone(); } else { stone = g.Guildstone as Guildstone; } //if (house == null || stone == null || stone.Guild != from.Guild) if (stone == null || stone.Guild != from.Guild) { //from.SendMessage("You must be in the house with your guild's guildstone to use this."); from.SendMessage("You must be a member of a guild and not be in a building which houses another guildstone to use this."); } else { bool bZoneOverlaps = false; bZoneOverlaps = DoesTownshipRegionConflict(location, from.Map, TownshipStone.INITIAL_RADIUS, null); if (bZoneOverlaps) { from.SendMessage("You can't create a township that conflicts with another township, guardzone, or other special area."); return; } double guildPercentage = GetPercentageOfGuildedHousesInArea(location, from.Map, TownshipStone.INITIAL_RADIUS, from.Guild as Guild, true); if (guildPercentage >= Township.TownshipSettings.GuildHousePercentage) { if (bCheck) { from.SendGump(new ConfirmPlacementGump(from, location, this)); } else { TownshipStone ts = new TownshipStone(stone.Guild); ts.GoldHeld = Township.TownshipSettings.InitialFunds; //initial gold :-) ts.MoveToWorld(location, from.Map); ts.CreateInitialArea(location); from.SendMessage("The township has been created."); this.Delete(); } } else { from.SendMessage("You can't create a township without owning most of the houses in the area."); } } } }
private bool DoHousesBelongToGuildOrAllies(Point3D centerLocation, Map map, Guild guild) { bool bReturn = true; int x = centerLocation.X; int y = centerLocation.Y; int z = centerLocation.Z; int x_start = x - TownshipStone.INITIAL_RADIUS; int y_start = y - TownshipStone.INITIAL_RADIUS; int x_end = x + TownshipStone.INITIAL_RADIUS; int y_end = x + TownshipStone.INITIAL_RADIUS; ArrayList houselist = new ArrayList(); for (int i = x_start; i < x_end; i++) { for (int j = y_start; j < y_end; j++) { Region r = Region.Find(new Point3D(i, j, z), map); if (r != null) { if (r is HouseRegion) { BaseHouse h = ((HouseRegion)r).House; if (!houselist.Contains(h)) { houselist.Add(h); } } } } } for (int i = 0; i < houselist.Count; i++) { try { BaseHouse h = (BaseHouse)houselist[i]; if (h.Owner == null) //safety-check... ownerless houses are bad, m'kay { if (h.Owner.Guild == null) { bReturn = false; break; } if (h.Owner.Guild != guild) { if (!guild.Allies.Contains(h.Owner.Guild)) { bReturn = false; break; } } } } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } return(bReturn); }
public static double GetPercentageOfGuildedHousesInArea(Point3D location, Map map, int radius, Guild guild, bool bIgnoreAlliedHouses) { double guildPercentage = 0.0; if (guild == null) { return(guildPercentage); //doublecheck this - return 0 if we're not guilded } if (location == Point3D.Zero) { return(guildPercentage); //might as well check that we're not the default point } try //safety { int x = location.X; int y = location.Y; int z = location.Z; int x_start = x - radius; int y_start = y - radius; int x_end = x + radius; int y_end = y + radius; Rectangle2D rect = new Rectangle2D(x_start, y_start, TownshipStone.INITIAL_RADIUS * 2, TownshipStone.INITIAL_RADIUS * 2); List <BaseHouse> houseList = TownshipDeed.GetHousesInRect(rect, map); int guildCount = 0; int allyCount = 0; int otherCount = 0; int siegetentCount = 0; int countedHouses = 0; foreach (BaseHouse h in houseList) { if (h != null && h.Owner != null) { countedHouses++; Guild houseGuild = h.Owner.Guild as Guilds.Guild; if (h is SiegeTent) { siegetentCount++; } else { if (houseGuild == null) { otherCount++; } else if (houseGuild == guild) { guildCount++; } else if (guild.IsAlly(houseGuild)) { allyCount++; } else { otherCount++; } } } } guildPercentage = ((double)guildCount) / ((double)(countedHouses - allyCount - siegetentCount)); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } return(guildPercentage); }
public void update() { // Controller Pushed if (this.isPushed()) { decimal steps = (decimal)this.manualSpeed * 20m; bool go = false; int x = this.Mouse.LeftButtonPressed.X - this.Left; int y = this.Mouse.LeftButtonPressed.Y - this.Top; Point3D p = new Point3D(this.Position); if (x >= 5 && y >= 9 && x <= 25 && y <= 29) { // X- p.X -= this.stepX * steps; go = true; } if (x >= 48 && y >= 9 && x <= 69 && y <= 29) { // X+ p.X += this.stepX * steps; go = true; } if (x >= 26 && y >= 1 && x <= 47 && y <= 19) { // Y- p.Y -= this.stepY * steps; go = true; } if (x >= 26 && y >= 20 && x <= 47 && y <= 38) { // Y+ p.Y += this.stepY * steps; go = true; } if (x >= 80 && y >= 1 && x <= 101 && y <= 19) { // Z+ p.Z += this.stepZ * steps; go = true; } if (x >= 80 && y >= 20 && x <= 101 && y <= 38) { // Z- p.Z -= this.stepZ * steps; go = true; } if (go) { this.goTo(p.X, p.Y, p.Z, (decimal)this.manualSpeed * 5); } } if (this.isClicked()) { int x1 = this.Mouse.LeftButtonPressed.X - this.Left; int y1 = this.Mouse.LeftButtonPressed.Y - this.Top; int x2 = this.Mouse.LeftButtonReleased.X - this.Left; int y2 = this.Mouse.LeftButtonReleased.Y - this.Top; if (x1 >= 117 && y1 >= 1 && x1 <= 198 && y1 <= 38) { // Origin if (x2 >= 117 && y2 >= 1 && x2 <= 198 && y2 <= 38) { // Origin this.origin(); } } } }
public static bool IsFeluccaT2A(Map map, Point3D loc) { int x = loc.X, y = loc.Y; return(map == Map.Felucca && x >= 5120 && y >= 2304 && x < 6144 && y < 4096); }
public static bool IsFeluccaDungeon(Map map, Point3D loc) { var region = Region.Find(loc, map); return(region.IsPartOf <DungeonRegion>() && region.Map == Map.Felucca); }
public static bool IsWindLoc(Point3D loc) { int x = loc.X, y = loc.Y; return(x >= 5120 && y >= 0 && x < 5376 && y < 256); }
public static bool IsFeluccaWind(Map map, Point3D loc) { return(map == Map.Felucca && IsWindLoc(loc)); }
public static void ResolvePotion(PlayerMobile player, Mobile mobileTarget, CustomAlchemyPotion potion) { if (!SpecialAbilities.Exists(player)) { return; } if (!SpecialAbilities.Exists(mobileTarget)) { return; } bool positiveEffect = potion.PositiveEffect; CustomAlchemy.EffectType primaryEffect = potion.PrimaryEffect; CustomAlchemy.EffectType secondaryEffect = potion.SecondaryEffect; CustomAlchemy.EffectPotencyType potencyType = potion.EffectPotency; int throwSound = 0x5D3; int itemID = potion.ItemID; int itemHue = potion.Hue; int hitSound = Utility.RandomList(0x38E, 0x38F, 0x390); int effectSound = 0x5D8; ConsumePotion(player, potion); SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 0.75, true, 0, false, "", "", "-1"); Point3D location = player.Location; Map map = player.Map; Point3D targetLocation = mobileTarget.Location; Map targetMap = mobileTarget.Map; bool drinkPotion = false; if (positiveEffect && player == mobileTarget && potencyType == EffectPotencyType.Target) { drinkPotion = true; } if (drinkPotion) { player.Animate(34, 5, 1, true, false, 0); Effects.PlaySound(player.Location, player.Map, Utility.RandomList(0x4CC, 0x4CD, 0x030, 0x031)); } else { player.Animate(31, 7, 1, true, false, 0); Effects.PlaySound(player.Location, player.Map, throwSound); } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!SpecialAbilities.Exists(player)) { return; } //Update Target Location if MobileTarget still Valid if (mobileTarget != null && !drinkPotion) { if (Utility.GetDistance(mobileTarget.Location, targetLocation) < 20 && mobileTarget.Map == targetMap) { targetLocation = mobileTarget.Location; } } double distance = Utility.GetDistance(location, targetLocation); double destinationDelay = (double)distance * .04; IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 5), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z + 5), targetMap); if (drinkPotion) { destinationDelay = 0; } else { Effects.SendMovingEffect(startLocation, endLocation, itemID, 10, 0, false, false, itemHue, 0); } Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { //Update Target Location if MobileTarget still Valid if (mobileTarget != null && !drinkPotion) { if (Utility.GetDistance(mobileTarget.Location, targetLocation) < 20 && mobileTarget.Map == targetMap) { targetLocation = mobileTarget.Location; } } int primaryEffectItemId = 0x3709; int primaryEffectHue = 0; int primaryEffectSound = 0x208; int secondaryEffectItemId = 0x3709; int secondaryEffectHue = 0; int secondaryEffectSound = 0x208; List <Point3D> m_EffectLocations = new List <Point3D>(); if (drinkPotion && SpecialAbilities.Exists(player)) { m_EffectLocations.Add(player.Location); } else { int radius = 0; switch (potencyType) { case EffectPotencyType.SmallAoE: radius = 2; break; case EffectPotencyType.MediumAoE: radius = 4; break; case EffectPotencyType.LargeAoE: radius = 6; break; } int minRange = -1 * radius; int maxRange = radius + 1; for (int a = minRange; a < maxRange; a++) { for (int b = minRange; b < maxRange; b++) { Point3D newLocation = new Point3D(targetLocation.X + a, targetLocation.Y + b, targetLocation.Z); if (!m_EffectLocations.Contains(newLocation)) { m_EffectLocations.Add(newLocation); } } } } foreach (Point3D point in m_EffectLocations) { Effects.SendLocationParticles(EffectItem.Create(point, map, TimeSpan.FromSeconds(0.25)), primaryEffectItemId, 10, 30, primaryEffectHue, 0, 5029, 0); //Effect } /* * //Positive * StrengthIncrease, * DexterityIncrease, * IntelligenceIncrease, * HitsRegenIncrease, * StamRegenIncrease, * ManaRegenIncrease, * MeleeDamageDealtIncrease, * MeleeDamageResistIncrease, * SpellDamageDealtIncrease, * SpellDamageResistIncrease, * AccuracyIncrease, * EvasionIncrease, * * //Negative * Entangle, * Petrify, * FireDamage, * FrostDamage, * AbyssalDamage, * ShockDamage, * EarthDamage, * BleedDamage, * Disease, * Poison, * AccuracyReduction, * EvasionReduction * * Target, * SmallAoE, * MediumAoE, * LargeAoE */ if (drinkPotion) { } }); }); }
public static bool CheckMulti(Point3D p, Map map, bool houses) { return(CheckMulti(p, map, houses, 0)); }
public TimeoutTeleporter(Point3D pointDest, Map mapDest, bool creatures) : base(pointDest, mapDest, creatures) { m_Teleporting = new Dictionary <Mobile, Timer>(); }
// Make a transformation for rotation around an arbitrary axis. public static RotateTransform3D Rotate(Vector3D axis, Point3D center, double angle) { Rotation3D rotation = new AxisAngleRotation3D(axis, angle); return(new RotateTransform3D(rotation, center)); }
public override bool AllowHousing(Mobile from, Point3D p) => from.AccessLevel >= AccessLevel.GameMaster && base.AllowHousing(from, p);
public static void ResolveDest(Mobile m, string name, ref Point3D loc, ref Map map) { if (string.IsNullOrWhiteSpace(name)) { return; } switch (name.Trim().ToLower()) { case "dungeon covetous": { loc = new Point3D(2498, 921, 0); map = Map.Trammel; } break; case "dungeon deceit": { loc = new Point3D(4111, 434, 5); map = Map.Trammel; } break; case "dungeon despise": { loc = new Point3D(1301, 1080, 0); map = Map.Trammel; } break; case "dungeon destard": { loc = new Point3D(1176, 2640, 2); map = Map.Trammel; } break; case "dungeon ice": { loc = new Point3D(1999, 81, 4); map = Map.Trammel; } break; case "dungeon fire": { loc = new Point3D(2923, 3409, 8); map = Map.Trammel; } break; case "dungeon hythloth": { loc = new Point3D(4721, 3824, 0); map = Map.Trammel; } break; case "dungeon orc": { loc = new Point3D(1017, 1429, 0); map = Map.Trammel; } break; case "dungeon shame": { loc = new Point3D(511, 1565, 0); map = Map.Trammel; } break; case "dungeon wrong": { loc = new Point3D(2043, 238, 10); map = Map.Trammel; } break; case "dungeon wind": { loc = new Point3D(1361, 895, 0); map = Map.Trammel; } break; case "dungeon doom": { loc = new Point3D(2368, 1267, -85); map = Map.Malas; } break; // is this the right citadel? uoguide.com says it is case "dungeon citadel": { loc = new Point3D(1345, 769, 19); map = Map.Tokuno; } break; case "dungeon fandancer": { loc = new Point3D(970, 222, 23); map = Map.Tokuno; } break; case "dungeon mines": { loc = new Point3D(257, 786, 63); map = Map.Tokuno; } break; case "dungeon bedlam": { loc = new Point3D(2068, 1372, -75); map = Map.Malas; } break; case "dungeon labyrinth": { loc = new Point3D(1732, 975, -75); map = Map.Malas; } break; case "dungeon prism": { loc = new Point3D(3786, 1095, 18); map = Map.Trammel; } break; case "dungeon sanctuary": { loc = new Point3D(761, 1644, 0); map = Map.Trammel; } break; case "dungeon palace": { loc = new Point3D(5624, 3040, 13); map = Map.Trammel; } break; case "dungeon grove": { loc = new Point3D(580, 1655, 0); map = Map.Trammel; } break; case "dungeon caves": { loc = new Point3D(1717, 2991, 0); map = Map.Trammel; } break; case "dungeon blackthorn": { loc = new Point3D(1482, 1474, 0); map = Map.Trammel; } break; case "dungeon underworld": { loc = new Point3D(4195, 3263, 5); map = Map.Trammel; } break; case "dungeon abyss": { PlayerMobile pm = m as PlayerMobile; if (!pm.AbyssEntry) { m.SendLocalizedMessage(1112226); break; } loc = new Point3D(946, 71, 72); map = Map.TerMur; } break; // fel case "fel dungeon covetous": { loc = new Point3D(2498, 921, 0); map = Map.Felucca; } break; case "fel dungeon deceit": { loc = new Point3D(4111, 434, 5); map = Map.Felucca; } break; case "fel dungeon despise": { loc = new Point3D(1301, 1080, 0); map = Map.Felucca; } break; case "fel dungeon destard": { loc = new Point3D(1176, 2640, 2); map = Map.Felucca; } break; case "fel dungeon fire": { loc = new Point3D(2923, 3409, 8); map = Map.Felucca; } break; case "fel dungeon hythloth": { loc = new Point3D(4721, 3824, 0); map = Map.Felucca; } break; case "fel dungeon ice": { loc = new Point3D(1999, 81, 4); map = Map.Felucca; } break; case "fel dungeon orc": { loc = new Point3D(1017, 1429, 0); map = Map.Felucca; } break; case "fel dungeon shame": { loc = new Point3D(511, 1565, 0); map = Map.Felucca; } break; case "fel dungeon wrong": { loc = new Point3D(2043, 238, 10); map = Map.Felucca; } break; case "fel dungeon wind": { loc = new Point3D(1361, 895, 0); map = Map.Felucca; } break; case "fel dungeon prism": { loc = new Point3D(3786, 1095, 18); map = Map.Felucca; } break; case "fel dungeon sanctuary": { loc = new Point3D(761, 1644, 0); map = Map.Felucca; } break; case "fel dungeon palace": { loc = new Point3D(5624, 3040, 13); map = Map.Felucca; } break; case "fel dungeon grove": { loc = new Point3D(580, 1655, 0); map = Map.Felucca; } break; case "fel dungeon caves": { loc = new Point3D(1717, 2991, 0); map = Map.Felucca; } break; case "fel dungeon blackthorn": { loc = new Point3D(1520, 1418, 15); map = Map.Felucca; } break; } }
protected override void OnTick() { if (m_Owner.Deleted) { Stop(); return; } m_Owner.Criminal = false; m_Owner.Kills = 0; m_Owner.Stam = m_Owner.StamMax; Mobile target = m_Owner.Focus; if (target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful(target))) { m_Owner.Focus = null; Stop(); return; } //10OCT2007 InstaKill for Creatures ONLY *** START *** if (target != null && m_Owner.Combatant != target) { m_Owner.Combatant = target; } if (target == null) { Stop(); } else { //kill creatures only if (target is BaseCreature) { target.BoltEffect(0); //((BaseCreature)target).NoKillAwards = true; target.Kill(); // just in case, maybe Damage is overriden on some shard m_Owner.Focus = null; Stop(); } else { //kill player if in a certian region IPoint3D ip = m_Owner as IPoint3D; if (ip != null) { Point3D p = new Point3D(ip); Region reg = Region.Find(new Point3D(p), m_Owner.Map); Console.WriteLine("Guards Called to: " + reg.Name); if (reg.Name == "SafeZone") { target.Frozen = true; target.BoltEffect(0); target.BodyMod = Utility.RandomList(50, 56); Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerCallback(ReportKill)); target.BoltEffect(0); //((BaseCreature)target).NoKillAwards = true; target.Kill(); // just in case, maybe Damage is overriden on some shard target.BodyMod = 0x0; target.Frozen = false; m_Owner.Focus = null; m_TeleportTo = false; Stop(); } else { //Turn Off Guard m_Owner.Focus = null; //wander around and wait for timer to end if ((m_Stage++ % 4) == 0 || !m_Owner.Move(m_Owner.Direction)) { m_Owner.Direction = (Direction)Utility.Random(8); } //Time to talk switch (Utility.Random(5)) //picks one of the following { case 0: { m_Owner.Say("Depend not on fortune, but on conduct."); break; } case 1: { m_Owner.Say("A great fortune in the hands of a fool is a great misfortune."); break; } case 2: { m_Owner.Say("To save time is to lengthen life."); break; } case 3: { m_Owner.Say("Rich gifts wax poor when givers prove unkind."); break; } case 4: { m_Owner.Say("Act the way you'd like to be and soon you'll be the way you act."); break; } } } } } } //10OCT2007 InstaKill for Creatures ONLY *** END *** //{// <instakill> // TeleportTo( target ); // target.BoltEffect( 0 ); // if ( target is BaseCreature ) // ((BaseCreature)target).NoKillAwards = true; // target.Damage( target.HitsMax, m_Owner ); // target.Kill(); // just in case, maybe Damage is overriden on some shard // if ( target.Corpse != null && !target.Player ) // target.Corpse.Delete(); // m_Owner.Focus = null; // Stop(); //}// </instakill> ///*else if ( !m_Owner.InRange( target, 20 ) ) //{ // m_Owner.Focus = null; //} //else if ( !m_Owner.InRange( target, 10 ) || !m_Owner.InLOS( target ) ) //{ // TeleportTo( target ); //} //else if ( !m_Owner.InRange( target, 1 ) ) //{ // if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) ) // TeleportTo( target ); //} //else if ( !m_Owner.CanSee( target ) ) //{ // if ( !m_Owner.UseSkill( SkillName.DetectHidden ) && Utility.Random( 50 ) == 0 ) // m_Owner.Say( "Reveal!" ); //}*/ }
internal override void ComputePlayerCombatReplayActors(AbstractPlayer p, ParsedEvtcLog log, CombatReplay replay) { // Corruption List <AbstractBuffEvent> corruptedMatthias = GetFilteredList(log.CombatData, 34416, p, true); corruptedMatthias.AddRange(GetFilteredList(log.CombatData, 34473, p, true)); int corruptedMatthiasStart = 0; foreach (AbstractBuffEvent c in corruptedMatthias) { if (c is BuffApplyEvent) { corruptedMatthiasStart = (int)c.Time; } else { int corruptedMatthiasEnd = (int)c.Time; replay.Decorations.Add(new CircleDecoration(true, 0, 180, (corruptedMatthiasStart, corruptedMatthiasEnd), "rgba(255, 150, 0, 0.5)", new AgentConnector(p))); Point3D wellNextPosition = replay.PolledPositions.FirstOrDefault(x => x.Time >= corruptedMatthiasEnd); Point3D wellPrevPosition = replay.PolledPositions.LastOrDefault(x => x.Time <= corruptedMatthiasEnd); if (wellNextPosition != null || wellPrevPosition != null) { replay.Decorations.Add(new CircleDecoration(true, 0, 180, (corruptedMatthiasEnd, corruptedMatthiasEnd + 100000), "rgba(0, 0, 0, 0.3)", new InterpolatedPositionConnector(wellPrevPosition, wellNextPosition, corruptedMatthiasEnd))); replay.Decorations.Add(new CircleDecoration(true, corruptedMatthiasEnd + 100000, 180, (corruptedMatthiasEnd, corruptedMatthiasEnd + 100000), "rgba(0, 0, 0, 0.3)", new InterpolatedPositionConnector(wellPrevPosition, wellNextPosition, corruptedMatthiasEnd))); } } } // Well of profane List <AbstractBuffEvent> wellMatthias = GetFilteredList(log.CombatData, 34450, p, true); int wellMatthiasStart = 0; foreach (AbstractBuffEvent c in wellMatthias) { if (c is BuffApplyEvent) { wellMatthiasStart = (int)c.Time; } else { int wellMatthiasEnd = (int)c.Time; replay.Decorations.Add(new CircleDecoration(false, 0, 120, (wellMatthiasStart, wellMatthiasEnd), "rgba(150, 255, 80, 0.5)", new AgentConnector(p))); replay.Decorations.Add(new CircleDecoration(true, wellMatthiasStart + 9000, 120, (wellMatthiasStart, wellMatthiasEnd), "rgba(150, 255, 80, 0.5)", new AgentConnector(p))); Point3D wellNextPosition = replay.PolledPositions.FirstOrDefault(x => x.Time >= wellMatthiasEnd); Point3D wellPrevPosition = replay.PolledPositions.LastOrDefault(x => x.Time <= wellMatthiasEnd); if (wellNextPosition != null || wellPrevPosition != null) { replay.Decorations.Add(new CircleDecoration(true, 0, 300, (wellMatthiasEnd, wellMatthiasEnd + 90000), "rgba(255, 0, 50, 0.5)", new InterpolatedPositionConnector(wellPrevPosition, wellNextPosition, wellMatthiasEnd))); } } } // Sacrifice List <AbstractBuffEvent> sacrificeMatthias = GetFilteredList(log.CombatData, 34442, p, true); int sacrificeMatthiasStart = 0; foreach (AbstractBuffEvent c in sacrificeMatthias) { if (c is BuffApplyEvent) { sacrificeMatthiasStart = (int)c.Time; } else { int sacrificeMatthiasEnd = (int)c.Time; replay.Decorations.Add(new CircleDecoration(true, 0, 120, (sacrificeMatthiasStart, sacrificeMatthiasEnd), "rgba(0, 150, 250, 0.2)", new AgentConnector(p))); replay.Decorations.Add(new CircleDecoration(true, sacrificeMatthiasStart + 10000, 120, (sacrificeMatthiasStart, sacrificeMatthiasEnd), "rgba(0, 150, 250, 0.35)", new AgentConnector(p))); } } // Bombs var zealousBenediction = log.CombatData.GetBuffData(34511).Where(x => x.To == p.AgentItem && x is BuffApplyEvent).ToList(); foreach (AbstractBuffEvent c in zealousBenediction) { int zealousStart = (int)c.Time; int zealousEnd = zealousStart + 5000; replay.Decorations.Add(new CircleDecoration(true, 0, 180, (zealousStart, zealousEnd), "rgba(200, 150, 0, 0.2)", new AgentConnector(p))); replay.Decorations.Add(new CircleDecoration(true, zealousEnd, 180, (zealousStart, zealousEnd), "rgba(200, 150, 0, 0.4)", new AgentConnector(p))); } }
public TimeoutTeleporter(Point3D pointDest, Map mapDest) : this(pointDest, mapDest, false) { }
public BaseDoor(int closedID, int openedID, int openedSound, int closedSound, Point3D offset) : base(closedID) { m_OpenedID = openedID; m_ClosedID = closedID; m_OpenedSound = openedSound; m_ClosedSound = closedSound; m_Offset = offset; m_Timer = new InternalTimer(this); Movable = false; }
protected override void OnTarget(Mobile from, object targeted) { if (m_Banner == null || m_Banner.Deleted) { return; } if (m_Banner.IsChildOf(from.Backpack)) { BaseHouse house = BaseHouse.FindHouseAt(from); if (house != null && house.IsOwner(from)) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null) { return; } Point3D p3d = new Point3D(p); ItemData id = TileData.ItemTable[m_ItemID & 0x3FFF]; if (map.CanFit(p3d, id.Height)) { house = BaseHouse.FindHouseAt(p3d, map, id.Height); if (house != null && house.IsOwner(from)) { bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map); bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map); if (north && west) { from.CloseGump(typeof(FacingGump)); from.SendGump(new FacingGump(m_Banner, m_ItemID, p3d, house)); } else if (north || west) { Banner banner = null; if (north) { banner = new Banner(m_ItemID); } else if (west) { banner = new Banner(m_ItemID + 1); } house.Addons.Add(banner); banner.IsRewardItem = m_Banner.IsRewardItem; banner.MoveToWorld(p3d, map); m_Banner.Delete(); } else { from.SendLocalizedMessage(1042039); // The banner must be placed next to a wall. } } else { from.SendLocalizedMessage(1042036); // That location is not in your house. } } else { from.SendLocalizedMessage(500269); // You cannot build that there. } } else { from.SendLocalizedMessage(502092); // You must be in your house to do this. } } else { from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it. } }
public moongates(Point3D pointDest, Map mapDest) : this(pointDest, mapDest, false) { }
public void OnTarget(Mobile from, object obj) { if (Deleted || InUse) { return; } if (obj is not IPoint3D p3D) { return; } var map = from.Map; if (map == null || map == Map.Internal) { return; } int x = p3D.X, y = p3D.Y, z = map.GetAverageZ(x, y); // OSI just takes the targeted Z if (!from.InRange(p3D, 6)) { from.SendLocalizedMessage(500976); // You need to be closer to the water to fish! } else if (!from.InLOS(obj)) { from.SendLocalizedMessage(500979); // You cannot see that location. } else if (RequireDeepWater ? FullValidation(map, x, y) : ValidateDeepWater(map, x, y) || ValidateUndeepWater(map, obj, ref z)) { var p = new Point3D(x, y, z); if (GetType() == typeof(SpecialFishingNet)) { for (var i = 1; i < Amount; ++i) // these were stackable before, doh { from.AddToBackpack(new SpecialFishingNet()); } } InUse = true; Movable = false; MoveToWorld(p, map); SpellHelper.Turn(from, p); from.Animate(12, 5, 1, true, false, 0); Effects.SendLocationEffect(p, map, 0x352D, 16, 4); Effects.PlaySound(p, map, 0x364); var index = 0; Timer.StartTimer( TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 14, () => DoEffect(from, p, index++) ); from.SendLocalizedMessage( RequireDeepWater ? 1010487 : 1074492 ); // You plunge the net into the sea... / You plunge the net into the water... } else { from.SendLocalizedMessage( RequireDeepWater ? 1010485 : 1074491 ); // You can only use this net in deep water! / You can only use this net in water! } }
private void DoEffect(Mobile from, Point3D p, int index) { if (Deleted) { return; } if (index == 1) { Effects.SendLocationEffect(p, Map, 0x352D, 16, 4); Effects.PlaySound(p, Map, 0x364); } else if (index is <= 7 or 14) { if (RequireDeepWater) { for (var i = 0; i < 3; ++i) { int x, y; switch (Utility.Random(8)) { default: // 0 x = -1; y = -1; break; case 1: x = -1; y = 0; break; case 2: x = -1; y = +1; break; case 3: x = 0; y = -1; break; case 4: x = 0; y = +1; break; case 5: x = +1; y = -1; break; case 6: x = +1; y = 0; break; case 7: x = +1; y = +1; break; } Effects.SendLocationEffect(new Point3D(p.X + x, p.Y + y, p.Z), Map, 0x352D, 16, 4); } } else { Effects.SendLocationEffect(p, Map, 0x352D, 16, 4); } if (Utility.RandomBool()) { Effects.PlaySound(p, Map, 0x364); } if (index == 14) { FinishEffect(p, Map, from); } else { Z -= 1; } } }
public void OnPlacement(Mobile from, Point3D p) { if (Deleted) { return; } if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from)) { from.SendLocalizedMessage(501271); // You already own a house, you may not place another! } else { ArrayList toMove; Point3D center = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z); HousePlacementResult res = HousePlacement.Check(from, m_MultiID, center, out toMove); switch (res) { case HousePlacementResult.Valid: { BaseHouse house = GetHouse(from); house.MoveToWorld(center, from.Map); Delete(); for (int i = 0; i < toMove.Count; ++i) { object o = toMove[i]; if (o is Mobile) { ((Mobile)o).Location = house.BanLocation; } else if (o is Item) { ((Item)o).Location = house.BanLocation; } } break; } case HousePlacementResult.BadItem: case HousePlacementResult.BadLand: case HousePlacementResult.BadStatic: case HousePlacementResult.BadRegionHidden: { from.SendLocalizedMessage(1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain. break; } case HousePlacementResult.NoSurface: { from.SendMessage("The house could not be created here. Part of the foundation would not be on any surface."); break; } case HousePlacementResult.BadRegion: { from.SendLocalizedMessage(501265); // Housing cannot be created in this area. break; } case HousePlacementResult.BadRegionTemp: { from.SendLocalizedMessage(501270); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time. break; } } } }
public void Effect(Point3D loc, Map map, bool checkMulti, bool isboatkey = false) { if (Server.Engines.VvV.VvVSigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (map == null) { Caster.SendLocalizedMessage(1005570); // You can not gate to another facet. } else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom)) { } else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.GateTo)) { } else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young) { Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young. } else if (SpellHelper.RestrictRedTravel && Caster.Murderer && map.Rules != MapRules.FeluccaRules && !Siege.SiegeShard) { Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there. } else if (Caster.Criminal) { Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } else if (SpellHelper.CheckCombat(Caster)) { Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if ((checkMulti && SpellHelper.CheckMulti(loc, map)) && !isboatkey) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (GateExistsAt(map, loc) || GateExistsAt(Caster.Map, Caster.Location)) // SE restricted stacking gates { Caster.SendLocalizedMessage(1071242); // There is already a gate there. } else if (Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster)) { Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order. } else if (CheckSequence()) { Timer.DelayCall(TimeSpan.FromSeconds(1), () => { Caster.SendLocalizedMessage(501024); // You open a magical gate to another location Effects.PlaySound(Caster.Location, Caster.Map, 0x20E); InternalItem firstGate = new InternalItem(loc, map); firstGate.MoveToWorld(Caster.Location, Caster.Map); Effects.PlaySound(loc, map, 0x20E); InternalItem secondGate = new InternalItem(Caster.Location, Caster.Map); secondGate.MoveToWorld(loc, map); firstGate.LinkedGate = secondGate; secondGate.LinkedGate = firstGate; firstGate.BoatGate = BaseBoat.FindBoatAt(firstGate, firstGate.Map) != null; secondGate.BoatGate = BaseBoat.FindBoatAt(secondGate, secondGate.Map) != null; }); } FinishSequence(); }
public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(12); // version if (m_RestoreEquip == null) { writer.Write(false); } else { writer.Write(true); writer.Write(m_RestoreEquip); } writer.Write((int)m_Flags); writer.WriteDeltaTime(m_TimeOfDeath); var list = (m_RestoreTable == null ? null : new List <KeyValuePair <Item, Point3D> >(m_RestoreTable)); int count = (list == null ? 0 : list.Count); writer.Write(count); for (int i = 0; i < count; ++i) { var kvp = list[i]; Item item = kvp.Key; Point3D loc = kvp.Value; writer.Write(item); if (item.Location == loc) { writer.Write(false); } else { writer.Write(true); writer.Write(loc); } } writer.Write(m_DecayTimer != null); if (m_DecayTimer != null) { writer.WriteDeltaTime(m_DecayTime); } writer.Write(m_Looters); writer.Write(m_Killer); writer.Write(m_Aggressors); writer.Write(m_Owner); writer.Write(m_CorpseName); writer.Write((int)m_AccessLevel); writer.Write(m_Guild); writer.Write(m_Kills); writer.Write(m_EquipItems); }
private Model3DGroup CreateBackgroundModelGroup(Point3D p0, Point3D p1, Point3D p2, Point3D p3, ImageBrush image) { MeshGeometry3D mesh = new MeshGeometry3D(); mesh.Positions.Add(p0); mesh.Positions.Add(p1); mesh.Positions.Add(p2); mesh.Positions.Add(p3); mesh.TriangleIndices.Add(0); mesh.TriangleIndices.Add(3); mesh.TriangleIndices.Add(2); mesh.TriangleIndices.Add(0); mesh.TriangleIndices.Add(2); mesh.TriangleIndices.Add(1); Vector3D normal = CalculateNormal(p2, p1, p0); mesh.Normals.Add(normal); mesh.Normals.Add(normal); mesh.Normals.Add(normal); mesh.Normals.Add(normal); mesh.TextureCoordinates.Add(new Point(0, 0)); mesh.TextureCoordinates.Add(new Point(1, 0)); mesh.TextureCoordinates.Add(new Point(1, 1)); mesh.TextureCoordinates.Add(new Point(0, 1)); GeometryModel3D model = new GeometryModel3D(mesh, new DiffuseMaterial(image)); Model3DGroup group = new Model3DGroup(); group.Children.Add(model); return(group); }