public override void Draw(SpriteBatchUI spriteBatch, Point position) { AEntity player = WorldModel.Entities.GetPlayerEntity(); float x = (float)Math.Round((player.Position.X % 256) + player.Position.X_offset) / 256f; float y = (float)Math.Round((player.Position.Y % 256) + player.Position.Y_offset) / 256f; Vector3 playerPosition = new Vector3(x - y, x + y, 0f); float minimapU = (m_GumpTexture.Width / 256f) / 2f; float minimapV = (m_GumpTexture.Height / 256f) / 2f; VertexPositionNormalTextureHue[] v = new VertexPositionNormalTextureHue[4] { new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y, 0), playerPosition + new Vector3(-minimapU, -minimapV, 0), new Vector3(0, 0, 0)), new VertexPositionNormalTextureHue(new Vector3(position.X + Width, position.Y, 0), playerPosition + new Vector3(minimapU, -minimapV, 0), new Vector3(1, 0, 0)), new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y + Height, 0), playerPosition + new Vector3(-minimapU, minimapV, 0), new Vector3(0, 1, 0)), new VertexPositionNormalTextureHue(new Vector3(position.X + Width, position.Y + Height, 0), playerPosition + new Vector3(minimapU, minimapV, 0), new Vector3(1, 1, 0)) }; spriteBatch.Draw(m_GumpTexture, v, Techniques.MiniMap); if (UltimaGame.TotalMS % 500f < 250f) { if (m_PlayerIndicator == null) { m_PlayerIndicator = new Texture2D(spriteBatch.GraphicsDevice, 1, 1); m_PlayerIndicator.SetData <uint>(new uint[1] { 0xFFFFFFFF }); } spriteBatch.Draw2D(m_PlayerIndicator, new Vector3(position.X + Width / 2, position.Y + Height / 2 - 8, 0), Vector3.Zero); } }
private void ReceiveObjectPropertyList(IRecvPacket packet) { ObjectPropertyListPacket p = (ObjectPropertyListPacket)packet; AEntity entity = EntityManager.GetObject <AEntity>(p.Serial, false); if (entity == null) { return; // received property list for entity that does not exist. } entity.PropertyList.Hash = p.Hash; entity.PropertyList.Clear(); for (int i = 0; i < p.CliLocs.Count; i++) { string iCliLoc = UltimaData.StringData.Entry(p.CliLocs[i]); if (p.Arguements[i] == string.Empty) { entity.PropertyList.AddProperty(iCliLoc); } else { entity.PropertyList.AddProperty(constructCliLoc(iCliLoc, p.Arguements[i])); } } }
// ============================================================================================================ // OnEntityUpdate - called when spellbook entity is updated by server. // ============================================================================================================ void OnEntityUpdate(AEntity entity) { if (m_Spellbook.BookType == SpellBookTypes.Magic) { CreateMageryGumplings(); } }
public AAIEntity GetAIEntityFromEntity(AEntity entity) { lock (this.objectLock) { return(this.objectToObjectAIs[entity]); } }
internal virtual void SendEventToWorld(Model.Event.EventType eventType, AEntity entityConcerned, string details) { if (this.world2D.TryGetTarget(out World2D world)) { world.SendEventToWorld(new GameEvent(eventType, this.parentLayer, entityConcerned, details)); } }
protected virtual void OnEntityAdded(AEntity obj) { lock (this.objectLock) { this.AddEntity(obj); } }
public static double TimeToCompleteMove(AEntity entity, Direction facing) { if (entity is Mobile && (entity as Mobile).IsMounted) return (facing & Direction.Running) == Direction.Running ? m_TimeRunMount : m_TimeWalkMount; else return (facing & Direction.Running) == Direction.Running ? m_TimeRunFoot : m_TimeWalkFoot; }
public void DoubleClick(AEntity item) // used by itemgumpling, paperdollinteractable, topmenu, worldinput. { if (item != null) { m_Network.Send(new DoubleClickPacket(item.Serial)); } }
/// <summary> /// Checks if the specified z-height is under an item or a ground. /// </summary> /// <param name="z">The z value to check.</param> /// <param name="underEntity">Returns the first roof, surface, or wall that is over the specified z. /// If no such objects exist above the specified z, then returns null.</param> /// <param name="underGround">Returns the ground object of this tile if the specified z is under the ground. /// Returns null otherwise.</param> public void IsZUnderEntityOrGround(int z, out AEntity underEntity, out AEntity underGround) { // getting the publicly exposed Entities collection will sort the entities if necessary. List <AEntity> entities = Entities; underEntity = null; underGround = null; for (int i = entities.Count - 1; i >= 0; i--) { if (entities[i].Z <= z) { continue; } if (entities[i] is Item) // checks Item and StaticItem entities. { UltimaData.ItemData data = ((Item)entities[i]).ItemData; if (data.IsRoof || data.IsSurface || (data.IsWall && data.IsImpassable)) { if (underEntity == null || entities[i].Z < underEntity.Z) { underEntity = entities[i]; } } } else if (entities[i] is Ground && entities[i].GetView().SortZ >= z + 12) { underGround = entities[i]; } } }
/// <summary> /// Adds the passed entity to this Tile's entity collection, and forces a resort of the entities on this tile. /// </summary> /// <param name="entity"></param> public void OnEnter(AEntity entity) { // only allow one ground object. if (entity is Ground) { if (Ground != null) { Ground.Dispose(); } Ground = (Ground)entity; } // if we are receiving a Item with the same position and itemID as a static item, then replace the static item. if (entity is Item) { Item item = entity as Item; for (int i = 0; i < m_Entities.Count; i++) { if (m_Entities[i] is Item) { Item comparison = m_Entities[i] as Item; if (comparison.ItemID == item.ItemID && comparison.Z == item.Z) { m_Entities.RemoveAt(i); i--; } } } } m_Entities.Add(entity); m_NeedsSorting = true; }
// ============================================================================================================ // ctor, pick // ============================================================================================================ public MobileView(AEntity entity) : base(entity) { _mobileLayers = new MobileViewLayer[(int)EquipLayer.LastUserValid]; PickType = PickType.PickObjects; IsShadowCastingView = true; }
T InternalCreateEntity <T>(Serial serial) where T : AEntity { var ctor = typeof(T).GetConstructor(new[] { typeof(Serial), typeof(Map) }); AEntity e = (T)ctor.Invoke(new object[] { serial, m_Model.Map }); if (e.Serial == WorldModel.PlayerSerial) { e.IsClientEntity = true; } if (e is Mobile) { for (int i = 0; i < m_OrphanedItems.Count; i++) { if (m_OrphanedItems[i].ParentSerial == serial) { (e as Mobile).WearItem(m_OrphanedItems[i].Item, m_OrphanedItems[i].Layer); m_OrphanedItems.RemoveAt(i--); } } } // If the entities collection is locked, add the new entity to the queue. Otherwise // add it directly to the main entity collection. if (m_EntitiesCollectionIsLocked) { m_Entities_Queued.Add(e); } else { m_Entities.Add(e.Serial, e); } return((T)e); }
public static void InitializeData() { using (var context = new MyDbContext()) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var a = new AEntity { Name = "Root" }; for (var i = 0; i < 10; i++) { var b = new BEntity { Name = $"Item {i}" }; a.Bs.Add(b); for (var j = 0; j < 20; j++) { b.Cs.Add(new CEntity { Name = $"Item {i}.{j}" }); } } context.As.Add(a); context.SaveChanges(); } }
internal override List <AEntity> Interaction(AEntity interactionEntity) { if (typeof(EnemyFarmPseudoEntity) == interactionEntity.GetType()) { Random ran = new Random(); List <AEntity> output = new List <AEntity>(); CoupleDouble speed = new CoupleDouble(0.1, 0.1) * new Degree(ran.Next(360)).GetProjections(); int ranX = ran.Next(2 * _maxX); int ranY = ran.Next(2 * _maxY); if ((Math.Abs(ranX - _maxX - playerShip.Pos.X) > 50) && ((Math.Abs(ranY - _maxY - playerShip.Pos.Y) > 50))) { CoupleDouble ranPos = new CoupleDouble(ranX - _maxX, ranY - _maxY); if (ran.NextDouble() < 0.02) { output.Add(new Ufo(ranPos, new CoupleDouble(5, 5), speed, playerShip)); } if (ran.NextDouble() < 0.06) { output.Add(new Asteroid(ranPos, new CoupleDouble(6, 6), speed, 2)); } return(output); } } return(null); }
public MiniMapChunk(MapChunk block) { X = (uint)block.ChunkX; Y = (uint)block.ChunkY; Colors = new uint[64]; for (uint tile = 0; tile < 64; tile++) { uint color = 0xffff00ff; // get the topmost static item or ground int eIndex = block.Tiles[tile].Entities.Count - 1; while (eIndex >= 0) { AEntity e = block.Tiles[tile].Entities[eIndex]; if (e is Ground) { color = RadarColorData.Colors[(e as Ground).LandDataID]; break; } else if (e is StaticItem) { color = RadarColorData.Colors[(e as StaticItem).ItemID + 0x4000]; break; } eIndex--; } Colors[tile] = color; } }
/// <summary> /// Picks up item/amount from stack. If item cannot be picked up, nothing happens. If item is within container, /// removes it from the containing entity. Informs server we picked up the item. Server can cancel pick up. /// Note: I am unsure what will happen if we can pick up an item and add to inventory before server can cancel. /// </summary> void PickupItemWithoutAmountCheck(Item item, int x, int y, int amount) { if (!item.TryPickUp()) { return; } // Removing item from parent causes client "in range" check. Set position to parent entity position. if (item.Parent != null) { item.Position.Set(item.Parent.Position.X, item.Parent.Position.Y, item.Parent.Position.Z); if (item.Parent is Mobile) { (item.Parent as Mobile).RemoveItem(item.Serial); } else if (item.Parent is ContainerItem) { AEntity parent = item.Parent; if (parent is Corpse) { (parent as Corpse).RemoveItem(item.Serial); } else { (parent as ContainerItem).RemoveItem(item.Serial); } } item.Parent = null; } RecursivelyCloseItemGumps(item); item.Amount = amount; HeldItem = item; m_HeldItemOffset = new Point(x, y); m_Network.Send(new PickupItemPacket(item.Serial, amount)); }
void mouseTargetingEventObject(AEntity selectedEntity) { // If we are passed a null object, keep targeting. if (selectedEntity == null) { return; } var serial = selectedEntity.Serial; // Send the targetting event back to the server if (serial.IsValid) { _network.Send(new TargetObjectPacket(selectedEntity, _targetCursorID, _targetCursorType)); } else { var modelNumber = 0; if (selectedEntity is StaticItem) { modelNumber = ((StaticItem)selectedEntity).ItemID; } else { modelNumber = 0; } _network.Send(new TargetXYZPacket((short)selectedEntity.Position.X, (short)selectedEntity.Position.Y, (short)selectedEntity.Z, (ushort)modelNumber, _targetCursorID, _targetCursorType)); } // Clear our target cursor. ClearTargetingWithoutTargetCancelPacket(); }
void OnItemUpdated(AEntity entity) { // delete any items in our pack that are no longer in the container. var ControlsToRemove = new List <AControl>(); foreach (var c in Children) { if (c is ItemGumpling && !_item.Contents.Contains(((ItemGumpling)c).Item)) { ControlsToRemove.Add(c); } } foreach (var c in ControlsToRemove) { Children.Remove(c); } // add any items in the container that are not in our pack. foreach (var item in _item.Contents) { var controlForThisItem = false; foreach (var c in Children) { if (c is ItemGumpling && ((ItemGumpling)c).Item == item) { controlForThisItem = true; break; } } if (!controlForThisItem) { AddControl(new ItemGumpling(this, item)); } } }
public static int Compare(AEntity x, AEntity y) { int x_z; int x_threshold; int x_type; int x_tiebreaker; int y_z; int y_threshold; int y_type; int y_tiebreaker; GetSortValues(x, out x_z, out x_threshold, out x_type, out x_tiebreaker); GetSortValues(y, out y_z, out y_threshold, out y_type, out y_tiebreaker); x_z += x_threshold; y_z += y_threshold; int comparison = x_z - y_z; if (comparison == 0) { comparison = x_type - y_type; } if (comparison == 0) { comparison = x_threshold - y_threshold; } if (comparison == 0) { comparison = x_tiebreaker - y_tiebreaker; } return(comparison); }
public static int Compare(AEntity x, AEntity y) { int xZ, xType, xThreshold, xTiebreaker; int yZ, yType, yThreshold, yTiebreaker; GetSortValues(x, out xZ, out xType, out xThreshold, out xTiebreaker); GetSortValues(y, out yZ, out yType, out yThreshold, out yTiebreaker); xZ += xThreshold; yZ += yThreshold; int comparison = xZ - yZ; if (comparison == 0) { comparison = xType - yType; } if (comparison == 0) { comparison = xThreshold - yThreshold; } if (comparison == 0) { comparison = xTiebreaker - yTiebreaker; } return(comparison); }
/// <summary> /// 拾取道具的接口方法 /// </summary> /// <param name="aEntity"></param> internal void TakeItem(AEntity aEntity) { if (Available) { ItemEffect(aEntity); } }
public AnimatedItemEffect(Map map, int sourceSerial, int xSource, int ySource, int zSource, int ItemID, int Hue, int duration) : this(map, ItemID, Hue, duration) { AEntity source = WorldModel.Entities.GetObject <AEntity>(sourceSerial, false); if (source != null) { if (source is Mobile) { Mobile mobile = source as Mobile; if ((!mobile.IsClientEntity && !mobile.IsMoving) && (((xSource != 0) || (ySource != 0)) || (zSource != 0))) { mobile.Position.Set(xSource, ySource, zSource); } SetSource(mobile); } else if (source is Item) { Item item = source as Item; if (((xSource != 0) || (ySource != 0)) || (zSource != 0)) { item.Position.Set(xSource, ySource, zSource); } SetSource(item); } else { SetSource(xSource, ySource, zSource); } } else { SetSource(xSource, ySource, zSource); } }
protected override bool AttackAction(AEntity entity) { if (laserObject == null) { InitLaser(); } if (!RotateAction(entity.gameObject.transform.position)) { return(false); // not done rotating } if (currentAttackFrame == -1) { Debug.Log("StormTrooper attacking"); actions.Attack(); currentAttackFrame = 0; return(false); } else if (currentAttackFrame < totalAttackFrames) { currentAttackFrame++; return(false); } else { audioSource.volume = 0.5f; audioSource.Play(); setupLaser(entity); currentAttackFrame = -1; return(true); } }
public VendorBuyGump(AEntity vendorBackpack, VendorBuyListPacket packet) : base(0, 0) { // sanity checking: don't show buy gumps for empty containers. if (!(vendorBackpack is Container) || ((vendorBackpack as Container).Contents.Count <= 0) || (packet.Items.Count <= 0)) { Dispose(); return; } IsMoveable = true; // note: original gumplings start at index 0x0870. AddControl(m_Background = new ExpandableScroll(this, 0, 0, 360, false)); AddControl(new HtmlGumpling(this, 0, 6, 300, 20, 0, 0, " <center><span color='#004' style='font-family:uni0;'>Shop Inventory")); m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this)); AddControl(m_ShopContents = new RenderedTextList(this, 22, 32, 250, 260, m_ScrollBar)); BuildShopContents(vendorBackpack, packet); AddControl(m_TotalCost = new HtmlGumpling(this, 44, 334, 200, 30, 0, 0, string.Empty)); UpdateCost(); Button okButton = (Button)AddControl(new Button(this, 220, 333, 0x907, 0x908, ButtonTypes.Activate, 0, 0)); okButton.GumpOverID = 0x909; okButton.MouseClickEvent += okButton_MouseClickEvent; }
public AEntity GetFormAData(int year, int userId) { AEntity formA = null; DataSet dsFormA = new DataSet(); SpParamCollection spParams = new SpParamCollection(); sqlConn = new SqlConnection(m_connectionString); spParams.Add(new SpParam("@userId", userId)); spParams.Add(new SpParam("@Year", year)); DBHelper.ExecProcAndFillDataSet("GetFormAData", spParams, dsFormA, sqlConn); if (dsFormA != null && dsFormA.Tables.Count > 0) { try { DataTable dtFormA = dsFormA.Tables[0]; if (dtFormA != null && dtFormA.Rows.Count > 0) { DataRow drFormA = dtFormA.Rows[0]; formA = new AEntity(); formA.Name = Utils.GetStringValue(drFormA["name"]); formA.Designation = Utils.GetStringValue(drFormA["designation"]); formA.Institute = Utils.GetStringValue(drFormA["institute"]); formA.Village = Utils.GetStringValue(drFormA["villagename"]); formA.Tehsil = Utils.GetStringValue(drFormA["tehsilname"]); formA.District = Utils.GetStringValue(drFormA["districtname"]); formA.City = Utils.GetStringValue(drFormA["cityname"]); formA.State = Utils.GetStringValue(drFormA["statename"]); formA.PinCode = Utils.GetStringValue(drFormA["pincode"]); formA.OtherDetails = Utils.GetStringValue(drFormA["description"]); formA.CurrentValue = Utils.GetDoubleValue(drFormA["presentvalue"]); formA.OwnName = Utils.GetBoolValue(drFormA["if_notown_name"]); formA.OwnerName = Utils.GetStringValue(drFormA["whosename"]); formA.OwnerRelation = Utils.GetStringValue(drFormA["relationship"]); formA.HowAcquired = (Constants.HowAcquired)Enum.Parse(typeof(Constants.HowAcquired), drFormA["purchasedetails"].ToString()); formA.AcquiredFrom = Utils.GetStringValue(drFormA["person_whom_acquired"]); formA.AcquiredDate = Utils.GetDateTimeValue(drFormA["purchase_date"]).Value; formA.FundingSource = Utils.GetStringValue(drFormA["funding_details"]); formA.AnnualIncome = Utils.GetDoubleValue(drFormA["annual_income"]); formA.OtherDetails = Utils.GetStringValue(drFormA["remarks"]); } } catch (Exception ex) { throw ex; } } return(formA); }
public Gump OpenContainerGump(AEntity entity) // used by ultimaclient. { Gump gump; if ((gump = (Gump)m_UserInterface.GetControl(entity.Serial)) != null) { gump.Dispose(); } else { if (entity is Corpse) { gump = new ContainerGump(entity, 0x2006); m_UserInterface.AddControl(gump, 96, 96); } else if (entity is SpellBook) { gump = new SpellbookGump((SpellBook)entity, ((Container)entity).ItemID); m_UserInterface.AddControl(gump, 96, 96); } else { gump = new ContainerGump(entity, ((Container)entity).ItemID); m_UserInterface.AddControl(gump, 64, 64); } } return(gump); }
public void SetSource(int x, int y, int z) { m_Source = null; m_xSource = x; m_ySource = y; m_zSource = z; }
public void SetTarget(int x, int y, int z) { m_Target = null; m_xTarget = x; m_yTarget = y; m_zTarget = z; }
public static void Reset(bool clearPlayerEntity = false) { if (clearPlayerEntity) { m_Entities.Clear(); foreach (AEntity entity in m_Entities.Values) { entity.Dispose(); } } else { foreach (AEntity entity in m_Entities.Values) { if (!entity.IsClientEntity) { entity.Dispose(); } } AEntity player = GetPlayerObject(); m_Entities.Clear(); if (player != null) { AddEntity(player); } } }
void mouseTargetingEventObject(AEntity selectedEntity) { // If we are passed a null object, keep targeting. if (selectedEntity == null) { return; } Serial serial = selectedEntity.Serial; // Send the targetting event back to the server if (serial.IsValid) { World.Engine.Client.Send(new TargetObjectPacket(selectedEntity, m_TargetID)); } else { int modelNumber = 0; if (selectedEntity is StaticItem) { modelNumber = ((StaticItem)selectedEntity).ItemID; } else { modelNumber = 0; } World.Engine.Client.Send(new TargetXYZPacket((short)selectedEntity.Position.X, (short)selectedEntity.Position.Y, (short)selectedEntity.Z, (ushort)modelNumber, m_TargetID)); } // Clear our target cursor. ClearTargetingWithoutTargetCancelPacket(); }
public void Reset(bool clearPlayerEntity = false) { m_QueuedWornItems.Clear(); if (clearPlayerEntity) { m_Entities.Clear(); foreach (AEntity entity in m_Entities.Values) { entity.Dispose(); } } else { foreach (AEntity entity in m_Entities.Values) { if (!entity.IsClientEntity) { entity.Dispose(); } } AEntity player = GetPlayerEntity(); m_Entities.Clear(); if (player != null) { m_Entities.Add(player.Serial, player); } } }
public static bool Set( string dictionary, string entityName , AEntity entity) { try { if( EntitiesController.dictionaries.ContainsKey( dictionary ) ) { if( EntitiesController.dictionaries[ dictionary ].ContainsKey( entityName ) ) { EntitiesController.dictionaries[ dictionary ][ entityName ] = entity; } else { EntitiesController.dictionaries[ dictionary ].Add( entityName, entity ); } } else { Dictionary<string, AEntity> temp = new Dictionary<string, AEntity>(); temp.Add( entityName, entity ); EntitiesController.dictionaries.Add( dictionary, temp ); } } catch { return false; } return true; }
public AnimatedItemEffect(Map map, AEntity Source, int ItemID, int Hue, int duration) : this(map, ItemID, Hue, duration) { SetSource(Source); }
public LightningEffect(Map map, AEntity Source, int hue) : this(map, hue) { SetSource(Source); }
public MovingEffect(Map map,int xSource, int ySource, int zSource, AEntity Target, int itemID, int hue) : this(map, itemID, hue) { base.SetSource(xSource, ySource, zSource); base.SetTarget(Target); }
public void SaveLastParent() { m_lastParent = Parent; }
public MobileEquipment(AEntity parent) { m_Equipment = new Item[(int)EquipLayer.LastValid + 1]; m_Parent = parent; }
public MovingEffect(Map map,AEntity Source, int xTarget, int yTarget, int zTarget, int itemID, int hue) : this(map, itemID, hue) { base.SetSource(Source); base.SetTarget(xTarget, yTarget, zTarget); }
public void SetTarget(AEntity target) { m_Target = target; }
public override void Dispose() { m_Source = null; m_Target = null; base.Dispose(); }
public static int GetActionIndex(AEntity entity, MobileAction action, int index) { Body body = 0; bool isMounted = false, isWarMode = false, isSitting = false, dieForwards = false; int lightSourceBodyID = 0; if (entity is Corpse) { body = (entity as Corpse).Body; dieForwards = (entity as Corpse).DieForwards; } else if (entity is Mobile) { Mobile mobile = entity as Mobile; body = mobile.Body; isMounted = mobile.IsMounted; isWarMode = mobile.Flags.IsWarMode; isSitting = mobile.IsSitting; lightSourceBodyID = mobile.LightSourceBodyID; } else { Tracer.Critical("Entity of type {0} cannot get an action index.", entity.ToString()); } if (body.IsHumanoid) { switch (action) { case MobileAction.None: // this will never be called. return GetActionIndex(entity, MobileAction.Stand, index); case MobileAction.Walk: if (isMounted) return (int)ActionIndexHumanoid.Mounted_RideSlow; else if (isWarMode) return (int)ActionIndexHumanoid.Walk_Warmode; else { // if carrying a light source, return Walk_Armed. if (lightSourceBodyID != 0) return (int)ActionIndexHumanoid.Walk_Armed; else return (int)ActionIndexHumanoid.Walk; } case MobileAction.Run: if (isMounted) return (int)ActionIndexHumanoid.Mounted_RideFast; else { // if carrying a light source, return Run_Armed. if (lightSourceBodyID!= 0) return (int)ActionIndexHumanoid.Run_Armed; else return (int)ActionIndexHumanoid.Run; } case MobileAction.Stand: if (isMounted) { return (int)ActionIndexHumanoid.Mounted_Stand; } else { if (isSitting) { return (int)ActionIndexHumanoid.Sit; } else if (isWarMode) { // TODO: Also check if weapon type is 2h. Can be 1H or 2H return (int)ActionIndexHumanoid.Stand_Warmode1H; } else { return (int)ActionIndexHumanoid.Stand; } } case MobileAction.Death: if (dieForwards) return (int)ActionIndexHumanoid.Die_Backwards; else return (int)ActionIndexHumanoid.Die_Forwards; case MobileAction.Attack: if (isMounted) { // check weapon type. Can be 1H, Bow, or XBow return (int)ActionIndexHumanoid.Mounted_Attack_1H; } else { // check weapon type. Can be 1H, 2H across, 2H down, 2H jab, bow, xbow, or unarmed. return (int)ActionIndexHumanoid.Attack_1H; } case MobileAction.Cast_Directed: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Cast_Directed; case MobileAction.Cast_Area: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Cast_Area; case MobileAction.GetHit: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Hit; case MobileAction.Block: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Block_WithShield; case MobileAction.Emote_Fidget_1: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Fidget_1; case MobileAction.Emote_Fidget_2: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Fidget_2; case MobileAction.Emote_Bow: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Emote_Bow; case MobileAction.Emote_Salute: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Emote_Salute; case MobileAction.Emote_Eat: if (isMounted) return GetActionIndex(entity, MobileAction.Stand, index); else return (int)ActionIndexHumanoid.Emote_Eat; default: return (int)ActionIndexHumanoid.Walk; } } else if (body.IsAnimal) { switch (action) { case MobileAction.None: return GetActionIndex(entity, MobileAction.Stand, index); case MobileAction.Walk: return (int)ActionIndexAnimal.Walk; case MobileAction.Run: return (int)ActionIndexAnimal.Run; case MobileAction.Stand: return (int)ActionIndexAnimal.Stand; case MobileAction.Death: if (dieForwards) return (int)ActionIndexAnimal.Die_Backwards; else return (int)ActionIndexAnimal.Die_Forwards; case MobileAction.MonsterAction: return index; default: return (int)ActionIndexHumanoid.Walk; } } else if (body.IsMonster) { switch (action) { case MobileAction.None: return GetActionIndex(entity, MobileAction.Stand, index); case MobileAction.Walk: return (int)ActionIndexMonster.Walk; case MobileAction.Run: return (int)ActionIndexMonster.Walk; case MobileAction.Stand: return (int)ActionIndexMonster.Stand; case MobileAction.Death: if (dieForwards) return (int)ActionIndexMonster.Die_Backwards; else return (int)ActionIndexMonster.Die_Forwards; case MobileAction.MonsterAction: return index; default: return (int)ActionIndexHumanoid.Walk; } } return (int)ActionIndexHumanoid.Walk; }
public override void doState(AEntity entity) { entity.Hp -= 2; }
public MobileMovement(AEntity entity) { m_entity = entity; m_MoveEvents = new MobileMoveEvents(); }
private static void getStartZ(AEntity m, Map map, Position3D loc, List<Item> itemList, out int zLow, out int zTop) { int xCheck = (int)loc.X, yCheck = (int)loc.Y; MapTile mapTile = map.GetMapTile(xCheck, yCheck); if (mapTile == null) { zLow = int.MinValue; zTop = int.MinValue; } bool landBlocks = mapTile.Ground.LandData.IsImpassible; //(TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Impassable) != 0; // if (landBlocks && m.CanSwim && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) != 0) // landBlocks = false; // else if (m.CantWalk && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) == 0) // landBlocks = true; int landLow = 0, landCenter = 0, landTop = 0; landCenter = map.GetAverageZ(xCheck, yCheck, ref landLow, ref landTop); bool considerLand = !mapTile.Ground.IsIgnored; int zCenter = zLow = zTop = 0; bool isSet = false; if (considerLand && !landBlocks && loc.Z >= landCenter) { zLow = landLow; zCenter = landCenter; if (!isSet || landTop > zTop) zTop = landTop; isSet = true; } StaticItem[] staticTiles = mapTile.GetStatics().ToArray(); for (int i = 0; i < staticTiles.Length; ++i) { StaticItem tile = staticTiles[i]; int calcTop = ((int)tile.Z + tile.ItemData.CalcHeight); if ((!isSet || calcTop >= zCenter) && ((tile.ItemData.Flags & TileFlag.Surface) != 0) && loc.Z >= calcTop) { // || (m.CanSwim && (id.Flags & TileFlag.Wet) != 0) // if (m.CantWalk && (id.Flags & TileFlag.Wet) == 0) // continue; zLow = (int)tile.Z; zCenter = calcTop; int top = (int)tile.Z + tile.ItemData.Height; if (!isSet || top > zTop) zTop = top; isSet = true; } } for (int i = 0; i < itemList.Count; ++i) { Item item = itemList[i]; ItemData id = item.ItemData; int calcTop = item.Z + id.CalcHeight; if ((!isSet || calcTop >= zCenter) && ((id.Flags & TileFlag.Surface) != 0) && loc.Z >= calcTop) { // || (m.CanSwim && (id.Flags & TileFlag.Wet) != 0) // if (m.CantWalk && (id.Flags & TileFlag.Wet) == 0) // continue; zLow = item.Z; zCenter = calcTop; int top = item.Z + id.Height; if (!isSet || top > zTop) zTop = top; isSet = true; } } if (!isSet) zLow = zTop = (int)loc.Z; else if (loc.Z > zTop) zTop = (int)loc.Z; }
public void SetSource(AEntity source) { m_Source = source; }
public abstract void doState(AEntity entity);
public static int GetActionIndex(AEntity entity, MobileAction action) { return GetActionIndex(entity, action, -1); }