Esempio n. 1
0
        private static List <Type> FindIndicatorFromFlags(string ns, UnitFlags flags)
        {
            if (Indicators == null)
            {
                Indicators = new List <Type>();
                Type[] types = Assembly.GetExecutingAssembly().GetTypes();
                foreach (Type type in types)
                {
                    SpellIndicatorFlags[] npi = (SpellIndicatorFlags[])type.GetCustomAttributes(typeof(SpellIndicatorFlags), false);
                    if (npi.Length <= 0)
                    {
                        continue;
                    }
                    Indicators.Add(type);
                }
            }

            List <Type> lv = new List <Type>();

            foreach (Type type in Indicators)
            {
                if (type.Namespace != ns)
                {
                    continue;
                }
                SpellIndicatorFlags[] npi = (SpellIndicatorFlags[])type.GetCustomAttributes(typeof(SpellIndicatorFlags), false);
                if ((npi[0].Flags & flags) != 0)
                {
                    lv.Add(type);
                }
            }

            return(lv);
        }
Esempio n. 2
0
 public DebugUnitEntry(int snoid, string name, UnitFlags flags)
 {
     SNOID      = snoid;
     Name       = name;
     ActorType  = PluginActorType.Monster;
     UnitFlags  = flags;
     TargetType = TargetType.Unit;
 }
Esempio n. 3
0
 public CacheUnitEntry(int snoID, UnitFlags flags, string internalname = "", int interactRange = -1, int collisionRadius = -1)
     : base(snoID)
 {
     InternalName    = internalname;
     _objectType     = flags;
     InteractRange   = interactRange;
     CollisionRadius = collisionRadius;
 }
Esempio n. 4
0
 public DebugUnitEntry(int snoid, string name, UnitFlags flags)
 {
     SNOID = snoid;
     Name = name;
     ActorType = PluginActorType.Monster;
     UnitFlags = flags;
     TargetType = TargetType.Unit;
 }
Esempio n. 5
0
 public UnitEntry(int snoID, UnitFlags flags, string internalname = "")
     : base(snoID)
 {
     InternalName = internalname;
     _objectType  = flags;
     //Monstertype=monstertype;
     //Monstersize=monstersize;
 }
Esempio n. 6
0
 public override void OnDisable()
 {
     for (int i = 0; i < Indicators.Count; i++)
     {
         Indicators[i].Dispose();
     }
     Indicators.Clear();
     LastFlags = 0;
 }
Esempio n. 7
0
 public SettingCluster()
 {
     EnableClusteringTargetLogic = true;
     ClusterDistance             = 10d;
     ClusterMinimumUnitCount     = 2;
     IgnoreClusterLowHPValue     = 0.55d;
     ClusterMaxDistance          = 100;
     UnitException_RareElites    = true;
     UnitExceptions = UnitFlags.SucideBomber | UnitFlags.Unique | UnitFlags.Boss | UnitFlags.AdventureModeBoss | UnitFlags.TreasureGoblin | UnitFlags.AvoidanceSummoner;
 }
Esempio n. 8
0
 Buff(UnitManager source, float totalDuration, UnitStats flatStats, UnitStats percentStats, UnitFlags flags, List<SerializableEffect> periodicEffects, float period, string animationBool)
 {
     this.source = source;
     this.totalDuration = totalDuration;
     this.duration = 0;
     this.flatStats = flatStats;
     this.percentStats = percentStats;
     this.flags = flags;
     this.periodicEffects = new List<SerializableEffect> (periodicEffects);
     this.period = period;
     this.animationBool = animationBool;
 }
Esempio n. 9
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.UnitUnitFlags         = ((UnitFlags)(binaryReader.ReadInt32()));
     this.DefaultTeam           = ((DefaultTeamEnum)(binaryReader.ReadInt16()));
     this.ConstantSoundVolume   = ((ConstantSoundVolumeEnum)(binaryReader.ReadInt16()));
     this.IntegratedLightToggle = binaryReader.ReadTagReference();
     this.CameraFieldOfView     = binaryReader.ReadSingle();
     this.CameraStiffness       = binaryReader.ReadSingle();
     pointerQueue                    = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.UnitCamera.ReadFields(binaryReader)));
     pointerQueue                    = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.Acceleration.ReadFields(binaryReader)));
     this.SoftPingThreshold          = binaryReader.ReadSingle();
     this.SoftPingInterruptTime      = binaryReader.ReadSingle();
     this.HardPingThreshold          = binaryReader.ReadSingle();
     this.HardPingInterruptTime      = binaryReader.ReadSingle();
     this.HardDeathThreshold         = binaryReader.ReadSingle();
     this.FeignDeathThreshold        = binaryReader.ReadSingle();
     this.FeignDeathTime             = binaryReader.ReadSingle();
     this.DistanceOfEvadeAnim        = binaryReader.ReadSingle();
     this.DistanceOfDiveAnim         = binaryReader.ReadSingle();
     this.StunnedMovementThreshold   = binaryReader.ReadSingle();
     this.FeignDeathChance           = binaryReader.ReadSingle();
     this.FeignRepeatChance          = binaryReader.ReadSingle();
     this.SpawnedTurretCharacter     = binaryReader.ReadTagReference();
     this.SpawnedActorCount          = binaryReader.ReadInt32();
     this.SpawnedVelocity            = binaryReader.ReadSingle();
     this.AimingVelocityMaximum      = binaryReader.ReadSingle();
     this.AimingAccelerationMaximum  = binaryReader.ReadSingle();
     this.CasualAimingModifier       = binaryReader.ReadSingle();
     this.LookingVelocityMaximum     = binaryReader.ReadSingle();
     this.LookingAccelerationMaximum = binaryReader.ReadSingle();
     this.RightHandNode              = binaryReader.ReadStringID();
     this.LeftHandNode               = binaryReader.ReadStringID();
     pointerQueue                    = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.MoreDamnNodes.ReadFields(binaryReader)));
     this.MeleeDamage                = binaryReader.ReadTagReference();
     pointerQueue                    = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.YourMomma.ReadFields(binaryReader)));
     this.MotionSensorBlipSize       = ((MotionSensorBlipSizeEnum)(binaryReader.ReadInt16()));
     this.fieldpad3                  = binaryReader.ReadBytes(2);
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(12));
     this.GrenadeVelocity = binaryReader.ReadSingle();
     this.GrenadeType     = ((GrenadeTypeEnum)(binaryReader.ReadInt16()));
     this.GrenadeCount    = binaryReader.ReadInt16();
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(176));
     pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.Boost.ReadFields(binaryReader)));
     pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.Lipsync.ReadFields(binaryReader)));
     return(pointerQueue);
 }
Esempio n. 10
0
 /// <summary>
 /// Execute the Abilities effect.
 /// </summary>
 /// <param name="name">The ability name.</param>
 public UnitFlags Execute(UnitManager source, Vector3 mousePos)
 {
     if ((source.Flags & disableFlags) == 0) {
         cooldown = cooldownTime / source.Stats.cooldownRate;
         targetPos = mousePos;
         abilityFlags = new UnitFlags(windup.Start (source, mousePos, ref current));
         if (current.endOnCollision) {
             source.AddCollisionCallback (NextPhase);
         }
         return abilityFlags;
     } else {
         return null;
     }
 }
Esempio n. 11
0
        SpellCastResult DoCheckCast()
        {
            Pet pet = GetCaster().ToPlayer().GetPet();

            if (pet == null || !pet.IsAlive())
            {
                return(SpellCastResult.CantDoThatRightNow);
            }

            // Do a mini Spell::CheckCasterAuras on the pet, no other way of doing this
            SpellCastResult result   = SpellCastResult.SpellCastOk;
            UnitFlags       unitflag = (UnitFlags)pet.GetUInt32Value(UnitFields.Flags);

            if (!pet.GetCharmerGUID().IsEmpty())
            {
                result = SpellCastResult.Charmed;
            }
            else if (unitflag.HasAnyFlag(UnitFlags.Stunned))
            {
                result = SpellCastResult.Stunned;
            }
            else if (unitflag.HasAnyFlag(UnitFlags.Fleeing))
            {
                result = SpellCastResult.Fleeing;
            }
            else if (unitflag.HasAnyFlag(UnitFlags.Confused))
            {
                result = SpellCastResult.Confused;
            }

            if (result != SpellCastResult.SpellCastOk)
            {
                return(result);
            }

            Unit target = GetExplTargetUnit();

            if (!target)
            {
                return(SpellCastResult.BadTargets);
            }

            if (!pet.IsWithinLOSInMap(target))
            {
                return(SpellCastResult.LineOfSight);
            }

            return(SpellCastResult.SpellCastOk);
        }
Esempio n. 12
0
        SpellCastResult DoCheckCast()
        {
            Guardian pet = GetCaster().ToPlayer().GetGuardianPet();

            if (pet == null || !pet.IsPet() || !pet.IsAlive())
            {
                return(SpellCastResult.NoPet);
            }

            // Do a mini Spell::CheckCasterAuras on the pet, no other way of doing this
            SpellCastResult result   = SpellCastResult.SpellCastOk;
            UnitFlags       unitflag = (UnitFlags)(uint)pet.m_unitData.Flags;

            if (!pet.GetCharmerGUID().IsEmpty())
            {
                result = SpellCastResult.Charmed;
            }
            else if (unitflag.HasAnyFlag(UnitFlags.Stunned))
            {
                result = SpellCastResult.Stunned;
            }
            else if (unitflag.HasAnyFlag(UnitFlags.Fleeing))
            {
                result = SpellCastResult.Fleeing;
            }
            else if (unitflag.HasAnyFlag(UnitFlags.Confused))
            {
                result = SpellCastResult.Confused;
            }

            if (result != SpellCastResult.SpellCastOk)
            {
                return(result);
            }

            Unit target = GetExplTargetUnit();

            if (!target)
            {
                return(SpellCastResult.BadTargets);
            }

            if (!pet.IsWithinLOSInMap(target))
            {
                return(SpellCastResult.LineOfSight);
            }

            return(SpellCastResult.SpellCastOk);
        }
Esempio n. 13
0
        private void UnitFlags2_BmspChanged(object sender, EventArgs e)
        {
            BitmaskCheckBox bmcb = (BitmaskCheckBox)sender;

            if (bmcb.GetValue() == 1) // feign death sets play dead
            {
                if (bmcb.IsChecked == true)
                {
                    UnitFlags.SetValueIsChecked(536870912, true);
                }
                else
                {
                    UnitFlags.SetValueIsChecked(536870912, false);
                }
            }
        }
Esempio n. 14
0
        private void Notification_Unit(GattCharacteristic sender, GattValueChangedEventArgs args)
        {
            lastCommunication = DateTime.UtcNow;
            UnitFlags unit = (UnitFlags)BitConverter.ToInt16(args.CharacteristicValue.ToArray(), 0);

            if (unit.HasFlag(UnitFlags.Metric))
            {
                Log($"Unit change notification METRIC", LoggingLevel.Information);
                ApplicationData.Current.LocalSettings.Values[MetricDisplayKey] = true;
            }
            else if (unit.HasFlag(UnitFlags.Inch))
            {
                Log($"Unit change notification INCH", LoggingLevel.Information);
                ApplicationData.Current.LocalSettings.Values[MetricDisplayKey] = false;
            }
            else
            {
                Log($"Notified of unit change has neither METRIC nor INCH flag: {unit}", LoggingLevel.Warning);
            }
        }
Esempio n. 15
0
 internal static bool CheckFlag(UnitFlags property, UnitFlags flag)
 {
     return((property & flag) != 0);
 }
Esempio n. 16
0
		public static bool HasAnyFlag(this UnitFlags flags, UnitFlags otherFlags)
		{
			return (flags & otherFlags) != 0;
		}
Esempio n. 17
0
 /// <summary>
 /// Removes flags from the unit.
 /// </summary>
 /// <returns><c>true</c>, if flags was removed, <c>false</c> otherwise.</returns>
 /// <param name="f">The UnitFlags containing flag modifiers.</param>
 internal bool RemoveFlags(UnitFlags f)
 {
     if (f != null) {
         return flagModifiers.Remove (f);
     } else
         return false;
 }
Esempio n. 18
0
    public void OnMouseOver()
    {
        if (!UnityEngine.GameObject.Find("InfoPanel"))
        {
            UnityEngine.GameObject tempAuth = Instantiate(Resources.Load("InfoPanel") as UnityEngine.GameObject, new Vector3(Screen.width - 50, 100, 0), Quaternion.identity);
            tempAuth.transform.SetParent(UnityEngine.GameObject.Find("Canvas").gameObject.transform);
            tempAuth.transform.localScale = new Vector3(1, 1, 1);
            tempAuth.name = "InfoPanel";

            targetHealth            = UnityEngine.GameObject.Find("targethealthBarInfo").GetComponent <Image>();
            targetHealth.fillAmount = 0f;

            Transform[] ts = tempAuth.transform.GetComponentsInChildren <Transform>(true);
            foreach (Transform t in ts)
            {
                if (t.gameObject.name == "InfoPanelName")
                {
                    Text temo = t.gameObject.GetComponent <Text>();
                    temo.text = obj.Name;
                }

                if (obj is Unit)
                {
                    unit = obj as Unit;
                    if (t.gameObject.name == "InfoPanelLevel")
                    {
                        Text temo = t.gameObject.GetComponent <Text>();
                        if (obj is Unit)
                        {
                            if (unit.Health <= 0)
                            {
                                temo.text = unit.Level.ToString() + " (Corpse)";
                            }
                            else
                            {
                                temo.text = unit.Level.ToString();
                            }
                        }
                    }

                    uint healthPercent = (unit.Health * 200 + unit.MaxHealth) / (unit.MaxHealth * 2);
                    targetHealth.fillAmount = healthPercent / 100f;
                }

                if (obj is Player)
                {
                    player = obj as Player;
                    if (t.gameObject.name == "InfoPanelLevel")
                    {
                        Text temo = t.gameObject.GetComponent <Text>();
                        temo.text = player.Level.ToString() + " " + player.Race + " " + player.Class;
                    }

                    uint healthPercent = (player.Health * 200 + player.MaxHealth) / (player.MaxHealth * 2);
                    targetHealth.fillAmount = healthPercent / 100f;
                }
            }
        }

        if (this.obj is Unit)
        {
            Unit unit = this.obj as Unit;

            UnitFlags  flags    = (UnitFlags)unit.UnitFlags;
            UnitFlags2 flags2   = (UnitFlags2)unit.UnitFlags2;
            NPCFlags   NpcFlags = (NPCFlags)unit.NpcFlags;

            float distance = Vector3.Distance(UnityEngine.GameObject.Find(Exchange.gameClient.Player.GUID.ToString()).transform.position, transform.position);

            if (NpcFlags.HasAnyFlag(NPCFlags.Gossip))
            {
                if (distance > 4)
                {
                    Texture2D texture2D = Resources.Load("Images/login/speak") as Texture2D;
                    Cursor.SetCursor(texture2D, Vector2.zero, CursorMode.Auto);
                }
                else
                {
                    Texture2D texture2D = Resources.Load("Images/login/speak") as Texture2D;
                    Cursor.SetCursor(texture2D, Vector2.zero, CursorMode.Auto);
                }
            }

            if (NpcFlags.HasAnyFlag(NPCFlags.QuestGiver))
            {
                if (distance > 4)
                {
                    Texture2D texture2D = Resources.Load("Images/login/unablequest") as Texture2D;
                    Cursor.SetCursor(texture2D, Vector2.zero, CursorMode.Auto);
                }
                else
                {
                    Texture2D texture2D = Resources.Load("Images/login/quest") as Texture2D;
                    Cursor.SetCursor(texture2D, Vector2.zero, CursorMode.Auto);
                }
            }
        }

        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            if (this.obj is GameObject)
            {
                return;
            }

            if (Exchange.gameClient.Player.Target == this.obj)
            {
                return;
            }

            if (Exchange.gameClient.Player.Target != null)
            {
                UnityEngine.GameObject.Find(Exchange.gameClient.Player.Target.GUID.ToString() + "targetSelectUnderlay").GetComponent <SpriteRenderer>().enabled = false;
            }

            UnityEngine.GameObject.Find(obj.GUID.ToString() + "targetSelectUnderlay").GetComponent <SpriteRenderer>().enabled = true;
            //UnityEngine.GameObject.Find(obj.GUID.ToString() + "targetSelectUnderlay").GetComponent<SpriteRenderer>().color = Color.red;
            Exchange.gameClient.ThreadHelper.playAudio(obj, "interface/iselecttarget").Play();
            Exchange.gameClient.ThreadHelper.setTarget(this.obj);
        }

        if (Input.GetKeyUp(KeyCode.Mouse1))
        {
            if (Exchange.gameClient.Player.Target != this.obj)
            {
                if (Exchange.gameClient.Player.Target != null)
                {
                    UnityEngine.GameObject.Find(Exchange.gameClient.Player.Target.GUID.ToString() + "targetSelectUnderlay").GetComponent <SpriteRenderer>().enabled = false;
                }

                UnityEngine.GameObject.Find(obj.GUID.ToString() + "targetSelectUnderlay").GetComponent <SpriteRenderer>().enabled = true;
                //UnityEngine.GameObject.Find(obj.GUID.ToString() + "targetSelectUnderlay").GetComponent<SpriteRenderer>().color = Color.red;
                Exchange.gameClient.ThreadHelper.playAudio(obj, "interface/iselecttarget").Play();
                Exchange.gameClient.ThreadHelper.setTarget(this.obj);
            }

            float distance = Vector3.Distance(UnityEngine.GameObject.Find(Exchange.gameClient.Player.GUID.ToString()).transform.position, UnityEngine.GameObject.Find(Exchange.gameClient.Player.Target.GUID.ToString()).transform.position);

            if (distance > 4)
            {
                System.Random random    = new System.Random();
                int[]         AudioFile = new int[3] {
                    2, 4, 5
                };
                int slot = AudioFile[random.Next(0, AudioFile.Length)];

                Exchange.gameClient.ThreadHelper.playAudio(Exchange.gameClient.Player, "character/" +
                                                           Exchange.gameClient.Player.Race.ToString() + "/" +
                                                           Exchange.gameClient.Player.Race.ToString() +
                                                           Exchange.gameClient.Player.Gender.ToString() + "errormessages/" +
                                                           Exchange.gameClient.Player.Race.ToString() +
                                                           Exchange.gameClient.Player.Gender.ToString() + "_err_outofrange0" + slot.ToString()).Play();
            }
        }
    }
Esempio n. 19
0
 public bool HasAttachFlag(UnitFlags flag)
 {
     return((currentUnit & flag) == flag);
 }
Esempio n. 20
0
 public override void OnEnable()
 {
     LastFlags  = 0;
     Indicators = new List <MapProjectile>();
 }
Esempio n. 21
0
File: Unit.cs Progetto: scerdam/Maze
 /// <summary>
 /// Inidicating whether the unit has the specified flags.
 /// </summary>
 /// <param name="flags">Set of the flags to check. Multiple flags should be write as 'Flag1 | Flag2 | Flag3 ...'.</param>
 /// <returns><c>true</c> if the unit has all the checked flags; otherwise, <c>false</c>.</returns>
 public bool HasUnitFlags(UnitFlags flags)
 {
     return (flags & this.unitFlags) == flags;
 }
Esempio n. 22
0
 public static bool HasAnyFlag(this UnitFlags flags, UnitFlags otherFlags)
 {
     return((flags & otherFlags) != UnitFlags.None);
 }
Esempio n. 23
0
        public string ReturnCacheEntryString()
        {
            string sUnitFlags = "UnitFlags." + UnitFlags.ToString().Replace(", ", " | UnitFlags.");

            return("new UnitEntry(" + SNOID + ", UnitFlags." + sUnitFlags + @", """ + Name + @"""),");
        }
Esempio n. 24
0
 public SNO(int sno, string internalname, ActorType? actortype = null, TargetType? targettype = null, float? collisionradius = null, int? interactrange=null, bool? canburrow = null, bool? isbarricade = null, ObstacleType? obstacletype = null, float? actorsphereradius = null, GizmoType? gimzotype = null, PluginDroppedItemTypes? baseitemtype = null, UnitFlags? unitflags = null, GizmoTargetTypes? gizmotargettypes = null, CacheEntry snoentry = null)
 {
     //Creates the perm data
     SNOID = sno;
     _actortype = actortype;
     _targettype = targettype;
     _collisionradius = collisionradius;
     _internalname = internalname;
     _CanBurrow = canburrow;
     _IsBarricade = isbarricade;
     _obstacletype = obstacletype;
     _actorsphereradius = actorsphereradius;
     _gizmotype = gimzotype;
     _itemdroptype = baseitemtype;
     _unitflags = unitflags;
     _gizmoTargetTypes = gizmotargettypes;
     _snoentry = snoentry;
     UpdateLookUpFinalValues();
     IsFinalized = true;
 }
Esempio n. 25
0
 public CacheUnitEntry(int snoID, UnitFlags flags, string internalname = "")
     : base(snoID)
 {
     InternalName = internalname;
     _objectType  = flags;
 }
Esempio n. 26
0
        public CommandsHelper(RealmServerSession session, string message)
        {
            string[] splitMessage = message.Split(' ');

            Console.WriteLine($@"[Comando]: {splitMessage[0].ToLower()}");

            if (splitMessage[0].ToLower() == "db")
            {
                XmlReader.Boot();
            }

            if (splitMessage[0].ToLower() == "obj")
            {
                session.SendPacket(UpdateObject.CreateGameObject(session.Character.MapX, session.Character.MapY, session.Character.MapZ));
            }

            if (splitMessage[0].ToLower() == "unt")
            {
                session.SendPacket(UpdateObject.CreateUnit(session.Character.MapX, session.Character.MapY, session.Character.MapZ, session.Character.MapO));
            }

            if (splitMessage[0].ToLower() == "item")
            {
                Console.WriteLine($@"Veio item aqui {Aba} => {int.Parse(splitMessage[1].ToLower())}");
                MainForm.Database.ItemUpdate(int.Parse(splitMessage[1].ToLower()));

                Thread.Sleep(1500);

                var inventory = MainForm.Database.GetInventory(session.Character);
                for (int j = 0; j < 112; j++)
                {
                    if (inventory.Find(item => item.slot == j) != null)
                    {
                        if (j < 19)
                        {
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_0 + (int)inventory.Find(item => item.slot == j).slot * 12, inventory.Find(item => item.slot == j).item);
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_PROPERTIES + j * 12, 0);
                        }

                        session.Entity.SetUpdateField((int)PlayerFields.PLAYER_FIELD_INV_SLOT_HEAD + j * 2, inventory.Find(item => item.slot == j).item);

                        session.SendPacket(UpdateObject.CreateItem(inventory.Find(item => item.slot == j), session.Character));
                    }
                    else
                    {
                        if (j < 19)
                        {
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_0 + j * 12, 0);
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_PROPERTIES + j * 12, 0);
                        }

                        session.Entity.SetUpdateField((int)PlayerFields.PLAYER_FIELD_INV_SLOT_HEAD + j * 2, 0);
                    }
                }
                Aba++;
            }

            if (splitMessage[0].ToLower() == "gps")
            {
                session.SendMessageMotd(
                    $"MapX: {session.Character.MapX} = MapY: {session.Character.MapY} = MapZ: {session.Character.MapZ} = MapO: {session.Character.MapO}");
                Console.WriteLine($@"MapX: {session.Character.MapX} = MapY: {session.Character.MapY} = MapZ: {session.Character.MapZ} = MapO: {session.Character.MapO}");
                Console.WriteLine($@"----------------------------");
                Console.WriteLine($@"Players: {session.Entity.KnownPlayers.Count}");
                Console.WriteLine($@"Objects: {session.Entity.KnownGameObjects.Count} ");
                // Creatures
                // Corpses
                // You are seen by:
            }

            if (splitMessage[0].ToLower() == "a")
            {
                //session.SendPacket(new SmsgSetRestStart());
                session.SendPacket(new SmsgTriggerCinematic(int.Parse(splitMessage[1].ToLower())));
            }

            if (splitMessage[0].ToLower() == "c")
            {
                session.Entity.SetUpdateField((int)UnitFields.UNIT_NPC_EMOTESTATE, int.Parse(splitMessage[1].ToLower()));
            }

            if (splitMessage[0].ToLower() == "b")
            {
                // Disable Movement
                session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_FLAGS, UnitFlags.UNIT_FLAG_STUNTED); // UNIT_FLAG_STUNTED
                Console.WriteLine($@"Atual: [{Value}] NEW {Enum.GetValues(typeof(UnitFlags)).Cast<UnitFlags>().SkipWhile(e => e != Value).Skip(1).First()}");
                Value = Enum.GetValues(typeof(UnitFlags)).Cast <UnitFlags>().SkipWhile(e => e != Value).Skip(1).First();

                // StandState -> Sit
                session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_1, 1);  //StandStates.STANDSTATE_SIT);

                Thread.Sleep(1000);

                session.SendPacket(new SmsgStandstateUpdate(1));

                Console.WriteLine(Aba);
                Aba++;
            }

            if (splitMessage[0].ToLower() == "emote")
            {
                session.SendPacket(new SmsgTextEmote((int)session.Entity.ObjectGuid.RawGuid,
                                                     Convert.ToUInt32(splitMessage[2]), Convert.ToInt32(splitMessage[1])));
            }

            if (splitMessage[0].ToLower() == "vai")
            {
                string attributeName  = splitMessage[1].ToLower();
                string attributeValue = splitMessage[2];

                switch (attributeName)
                {
                case "l":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_LEVEL, int.Parse(attributeValue));
                    break;

                case "s":
                    session.Entity.Scale = float.Parse(attributeValue);
                    break;

                case "g":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_0,
                                                  (byte)int.Parse(attributeValue), 2);
                    break;

                case "m":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_DISPLAYID, int.Parse(attributeValue));
                    break;

                case "e":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_NPC_EMOTESTATE,
                                                  (byte)int.Parse(attributeValue));
                    break;
                }
            }
        }
Esempio n. 27
0
 internal static bool CheckFlag(UnitFlags property, UnitFlags flag)
 {
     return (property & flag) != 0;
 }
Esempio n. 28
0
        public override void Process()
        {
            if (Unit.Flags != LastFlags)
            {
                UnitFlags leftFlags = Unit.Flags;

                // remove unused projectiles
                for (int i = 0; i < Indicators.Count; i++)
                {
                    UnitFlags flag = 0;
                    switch (Indicators[i].ClassID)
                    {
                    case AllodsProjectile.ProtectionFire:
                        flag = UnitFlags.ProtectionFire;
                        break;

                    case AllodsProjectile.ProtectionWater:
                        flag = UnitFlags.ProtectionWater;
                        break;

                    case AllodsProjectile.ProtectionAir:
                        flag = UnitFlags.ProtectionAir;
                        break;

                    case AllodsProjectile.ProtectionEarth:
                        flag = UnitFlags.ProtectionEarth;
                        break;
                    }

                    if ((Unit.Flags & flag) == 0)
                    {
                        Indicators[i].Dispose();
                        i--;
                        continue;
                    }
                    else
                    {
                        leftFlags &= ~flag;
                    }
                }

                if (leftFlags.HasFlag(UnitFlags.ProtectionAir))
                {
                    CreateProjectile(AllodsProjectile.ProtectionAir);
                }
                if (leftFlags.HasFlag(UnitFlags.ProtectionWater))
                {
                    CreateProjectile(AllodsProjectile.ProtectionWater);
                }
                if (leftFlags.HasFlag(UnitFlags.ProtectionEarth))
                {
                    CreateProjectile(AllodsProjectile.ProtectionEarth);
                }
                if (leftFlags.HasFlag(UnitFlags.ProtectionFire))
                {
                    CreateProjectile(AllodsProjectile.ProtectionFire);
                }
                LastFlags = Unit.Flags;
            }

            for (int i = 0; i < Indicators.Count; i++)
            {
                float         indicatorAngle = (Mathf.PI * 2) / Indicators.Count * i + Mathf.PI * 0.5f;
                MapProjectile p = Indicators[i];

                float pX = -Mathf.Cos(indicatorAngle) * 0.25f;
                float pY = Mathf.Sin(indicatorAngle) * 0.25f;

                if (Indicators.Count == 1)
                {
                    pY = -pY;
                }

                float pZ = MapLogic.Instance.GetHeightAt(Unit.X + Unit.FracX, Unit.Y + Unit.FracY, Unit.Width, Unit.Height) / 32
                           + (1f + (((Unit.Width + Unit.Height) / 2f) - 1f) / 2f);

                p.Alpha = (Unit.GetVisibility() == 2) ? 1f : 0;
                p.SetPosition(Unit.X + Unit.FracX + Unit.Width / 2f + pX, Unit.Y + Unit.FracY + Unit.Height / 2f + pY, pZ);
                p.ZAbsolute = true;
                p.ZOffset   = -32;
                if (Unit.IsFlying)
                {
                    p.ZOffset += 128;
                }
                p.CurrentFrame = (p.CurrentFrame + 1) % p.Class.Phases;
                p.DoUpdateView = true;
            }
        }
Esempio n. 29
0
 public UnitEntry(int snoID, UnitFlags flags, string internalname = "", int interactRange = -1, int collisionRadius = -1)
     : base(snoID)
 {
     InternalName=internalname;
     _objectType = flags;
     InteractRange = interactRange;
     CollisionRadius = collisionRadius;
 }
Esempio n. 30
0
 /// <summary>
 /// Adds flags to the unit.
 /// Adding a CC_IMMUNE_FLAG will clear all crowd control type flags.
 /// Adding a DEAD_FLAG will remove all other flags.
 /// </summary>
 /// <returns><c>true</c>, if flags was added, <c>false</c> otherwise.</returns>
 /// <param name="f">The UnitFlags containing flag modifiers.</param>
 internal bool AddFlags(UnitFlags f)
 {
     //Add conditional effects for when CC_IMMUNE flag or DEAD flag is passed
     if (f != null) {
         //if dead flag is passed, remove all flags and add dead flag and return true
         if ((f.Flags & UnitFlags.DEAD_FLAG) == UnitFlags.DEAD_FLAG) {
             flagModifiers.Clear ();
             flagModifiers.Add (f);
             return true;
         }
         //if cc_immune flag passed remove all unitflags with stun, silence, or imobilized, add flag and return true
         if ((f.Flags & UnitFlags.CC_IMMUNE_FLAG) == UnitFlags.CC_IMMUNE_FLAG) {
             List<UnitFlags> removeFlags = new List<UnitFlags> ();
             foreach (UnitFlags uf in flagModifiers) {
                 if ((uf.Flags & (UnitFlags.STUNNED_FLAG | UnitFlags.SILENCED_FLAG | UnitFlags.IMMOBILIZED_FLAG)) != 0) {
                     removeFlags.Add (uf);
                 }
             }
             foreach (UnitFlags uf in removeFlags) {
                 flagModifiers.Remove (uf);
             }
             flagModifiers.Add (f);
             return true;
         }
         //if a cc flag is passed and unit is currently cc immune return false;
         if ((Flags & UnitFlags.CC_IMMUNE_FLAG) == UnitFlags.CC_IMMUNE_FLAG && (f.Flags & (UnitFlags.STUNNED_FLAG | UnitFlags.SILENCED_FLAG | UnitFlags.IMMOBILIZED_FLAG)) != 0) {
             return false;
         }
         flagModifiers.Add (f);
         return true;
     }
     return false;
 }
Esempio n. 31
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                string str  = trigger.Text.NextModifiers();
                string name = "";

                if (str.Contains("n"))
                {
                    name = trigger.Text.NextWord();
                }
                Unit target = trigger.Args.Target;

                if (target == null)
                {
                    trigger.Reply("No target found.");
                }
                else
                {
                    Map rgn = target.Map;
                    if (rgn == null)
                    {
                        trigger.Reply("Instances are currently not supported.");
                    }
                    else
                    {
                        NPC npc = null;
                        rgn.ExecuteInContext(() =>
                        {
                            foreach (WorldObject worldObject in rgn)
                            {
                                if (worldObject is NPC && (name == "" || worldObject.Name.ContainsIgnoreCase(name)))
                                {
                                    npc = (NPC)worldObject;
                                    break;
                                }
                            }
                        });
                        if (npc == null)
                        {
                            trigger.Reply("Could not find a matching NPC.");
                        }
                        else
                        {
                            Character character = trigger.Args.Character;
                            if (trigger.Args.HasCharacter)
                            {
                                if (name == "" && character.Target != null)
                                {
                                    if (character.Target is NPC)
                                    {
                                        npc = character.Target as NPC;
                                    }
                                    else
                                    {
                                        character.Target = npc;
                                    }
                                }
                                else
                                {
                                    character.Target = npc;
                                }
                            }
                            else
                            {
                                trigger.Args.Target  = npc;
                                trigger.Args.Context = npc;
                            }

                            trigger.Reply("Selected: {0}", (object)npc);
                            NPCFlags npcFlags = npc.NPCFlags;
                            trigger.Reply("NPCFlags {0}:{1}", (object)npcFlags, (object)npcFlags);
                            UnitDynamicFlags dynamicFlags = npc.DynamicFlags;
                            trigger.Reply("DynamicFlags {0}:{1}", (object)dynamicFlags, (object)dynamicFlags);
                            UnitExtraFlags extraFlags = npc.ExtraFlags;
                            trigger.Reply("ExtraFlags {0}:{1}", (object)extraFlags, (object)extraFlags);
                            StateFlag stateFlags = npc.StateFlags;
                            trigger.Reply("StateFlags {0}:{1}", (object)stateFlags, (object)stateFlags);
                            UnitFlags unitFlags = npc.UnitFlags;
                            trigger.Reply("UnitFlags {0}:{1}", (object)unitFlags, (object)(int)unitFlags);
                            UnitFlags2 unitFlags2 = npc.UnitFlags2;
                            trigger.Reply("UnitFlags2 {0}:{1}", (object)unitFlags2, (object)unitFlags2);
                        }
                    }
                }
            }
Esempio n. 32
0
 public SpellIndicatorFlags(UnitFlags flags)
 {
     Flags = flags;
 }
Esempio n. 33
0
File: Unit.cs Progetto: scerdam/Maze
        /// <summary>
        /// Initializes a new instance of the Unit class.
        /// </summary>
        public Unit()
        {
            SetDeathState(DeathStates.Alive);
            this.unitFlags = UnitFlags.None;

            this.respawnLocation = new GridLocation();

            ObjectType = ObjectTypes.Unit;
            this.unitType = UnitTypes.Unit;
            this.unitSide = UnitSides.Evil;

            this.effectList = new EffectCollection(this);

            this.collidingUnits = new List<Unit>();

            BaseSpeed = 1.0d;
            SpeedRate = BaseSpeed;

            this.respawnTimer = 3000;

            this.effectList.EffectApplied += new EffectCollection.EffectHandler(OnEffectApplied);
            this.effectList.EffectRemoved += new EffectCollection.EffectHandler(OnEffectRemoved);
        }
Esempio n. 34
0
 public CachedSNOEntry(int sno, string internalname, ActorType? actortype = null, TargetType? targettype = null, float? collisionradius = null, int? interactrange=null, bool? canburrow = null, bool? isbarricade = null, ObstacleType? obstacletype = null, float? actorsphereradius = null, GizmoType? gizmotype = null, PluginDroppedItemTypes? baseitemtype = null, UnitFlags? unitflags = null, GizmoTargetTypes? gizmotargettypes = null, CacheEntry snoentry = null)
     : base(sno, internalname,  actortype,  targettype, collisionradius, interactrange,  canburrow, isbarricade,  obstacletype,  actorsphereradius,  gizmotype,  baseitemtype,  unitflags, gizmotargettypes, snoentry)
 {
 }
Esempio n. 35
0
        public int UnitLibLoad(string fname)
        {
            string path = "Assets/Resources/DB/"+fname;
            try{
                XmlSerializer SerializerObj = new XmlSerializer(typeof(Unit_Lib_Entry));
                // Create a new file stream for reading the XML file
                FileStream ReadFileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
                // Load the object saved above by using the Deserialize function
                Unit_Lib_Entry LoadedObject = (Unit_Lib_Entry)SerializerObj.Deserialize(ReadFileStream);
                ReadFileStream.Close();
                this.ammo = LoadedObject.ammo;
                this.atks = LoadedObject.atks;
                this.atk_count = LoadedObject.atk_count;
                this.def_air = LoadedObject.def_air;
                this.def_cls = LoadedObject.def_cls;
                this.def_grnd = LoadedObject.def_grnd;
                this.end_year = LoadedObject.end_year;
                this.entr_rate = LoadedObject.entr_rate;
                this.eval_score = LoadedObject.eval_score;
                this.flags = LoadedObject.flags;
                this.fuel = LoadedObject.fuel;
                this.icon_img_name = LoadedObject.icon_img_name;
                this.icon_h = LoadedObject.icon_h;
                this.icon_tiny_img_name = LoadedObject.icon_tiny_img_name;
                this.icon_tiny_h = LoadedObject.icon_tiny_h;
                this.icon_tiny_w = LoadedObject.icon_tiny_w;
                this.icon_type = LoadedObject.icon_type;
                this.icon_w = LoadedObject.icon_w;
                this.id = LoadedObject.id;
                this.ini = LoadedObject.ini;
                this.mov = LoadedObject.mov;
                this.mov_type = LoadedObject.mov_type;
                this.mov_types = LoadedObject.mov_types;
                this.mov_type_count = LoadedObject.mov_type_count;
                this.name = LoadedObject.name;
                this.rng = LoadedObject.rng;
                this.spt = LoadedObject.spt;
                this.start_month = LoadedObject.start_month;
                this.start_year = LoadedObject.start_year;
                this.trgt_type = LoadedObject.trgt_type;
                this.trgt_types = LoadedObject.trgt_types;
                this.trgt_type_count = LoadedObject.trgt_type_count;
                this.unit_class = LoadedObject.unit_class;
                this.unit_classes = LoadedObject.unit_classes;
                this.unit_class_count = LoadedObject.unit_class_count;
                this.unit_info_icons = LoadedObject.unit_info_icons;
            #if TODO_RR
                this.unit_info_icons = new Unit_Info_Icons();
                this.unit_info_icons.atk_img_name = LoadedObject.unit_info_icons.atk_img_name;
                this.unit_info_icons.guard_img_name = LoadedObject.unit_info_icons.guard_img_name;
                this.unit_info_icons.mov_img_name = LoadedObject.unit_info_icons.mov_img_name;
                this.unit_info_icons.str_img_name = LoadedObject.unit_info_icons.str_img_name;
                this.unit_info_icons.str_h = LoadedObject.unit_info_icons.str_h;
                this.unit_info_icons.str_w = LoadedObject.unit_info_icons.str_w;
            #endif
                this.unit_lib = LoadedObject.unit_lib;
                this.unit_lib_main_loaded = true;
                this.offset_img = LoadedObject.offset_img;

                return 0;
            }catch(Exception ex){
                Debug.LogError("exception: "+ex.Message);
                return -1;
            }
        }
Esempio n. 36
0
		public static bool HasFlag(this UnitFlags flags, UnitFlags toCheck)
		{
			return (flags & toCheck) != 0;
		}
Esempio n. 37
0
 public static bool HasTargetFlag(this UnitFlags baseFlags, UnitFlags flag)
 {
     return((baseFlags & flag) == flag);
 }
Esempio n. 38
0
 public static List <Type> FindIndicatorFromFlags(UnitFlags flags)
 {
     return(FindIndicatorFromFlags("SpellEffects", flags));
 }