Example #1
0
        void UpdateArea(uint newArea)
        {
            // FFA_PVP flags are area and not zone id dependent
            // so apply them accordingly
            m_areaUpdateId = newArea;

            AreaTableRecord area          = CliDB.AreaTableStorage.LookupByKey(newArea);
            bool            oldFFAPvPArea = pvpInfo.IsInFFAPvPArea;

            pvpInfo.IsInFFAPvPArea = area != null && area.Flags[0].HasAnyFlag(AreaFlags.Arena);
            UpdatePvPState(true);

            // check if we were in ffa arena and we left
            if (oldFFAPvPArea && !pvpInfo.IsInFFAPvPArea)
            {
                ValidateAttackersAndOwnTarget();
            }

            PhasingHandler.OnAreaChange(this);
            UpdateAreaDependentAuras(newArea);

            if (IsAreaThatActivatesPvpTalents(newArea))
            {
                EnablePvpRules();
            }
            else
            {
                DisablePvpRules();
            }

            // previously this was in UpdateZone (but after UpdateArea) so nothing will break
            pvpInfo.IsInNoPvPArea = false;
            if (area != null && area.IsSanctuary())    // in sanctuary
            {
                AddPvpFlag(UnitPVPStateFlags.Sanctuary);
                pvpInfo.IsInNoPvPArea = true;
                if (duel == null)
                {
                    CombatStopWithPets();
                }
            }
            else
            {
                RemovePvpFlag(UnitPVPStateFlags.Sanctuary);
            }

            AreaFlags areaRestFlag = (GetTeam() == Team.Alliance) ? AreaFlags.RestZoneAlliance : AreaFlags.RestZoneHorde;

            if (area != null && area.Flags[0].HasAnyFlag(areaRestFlag))
            {
                _restMgr.SetRestFlag(RestFlag.FactionArea);
            }
            else
            {
                _restMgr.RemoveRestFlag(RestFlag.FactionArea);
            }

            UpdateCriteria(CriteriaTypes.TravelledToArea, newArea);
        }
Example #2
0
        public void ChangeAreaFlagsUpdatesAreaFlags(AreaFlags flag)
        {
            NwArea area = NwModule.Instance.StartingLocation.Area !;

            area.AreaFlags |= flag;
            Assert.That(area.AreaFlags.HasFlag(flag), Is.EqualTo(true));
            area.AreaFlags &= ~flag;
            Assert.That(area.AreaFlags.HasFlag(flag), Is.EqualTo(false));
        }
Example #3
0
 internal AreasBlockBase(BinaryReader binaryReader)
 {
     this.name                 = binaryReader.ReadString32();
     this.areaFlags            = (AreaFlags)binaryReader.ReadInt32();
     this.invalidName_         = binaryReader.ReadBytes(20);
     this.invalidName_0        = binaryReader.ReadBytes(4);
     this.invalidName_1        = binaryReader.ReadBytes(64);
     this.manualReferenceFrame = binaryReader.ReadInt16();
     this.invalidName_2        = binaryReader.ReadBytes(2);
     this.flightHints          = ReadFlightReferenceBlockArray(binaryReader);
 }
 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.Name                 = binaryReader.ReadString32();
     this.AreasAreaFlags       = ((AreaFlags)(binaryReader.ReadInt32()));
     this.fieldskip            = binaryReader.ReadBytes(20);
     this.fieldskip0           = binaryReader.ReadBytes(4);
     this.fieldpad             = binaryReader.ReadBytes(64);
     this.ManualReferenceFrame = binaryReader.ReadInt16();
     this.fieldpad0            = binaryReader.ReadBytes(2);
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(4));
     return(pointerQueue);
 }
Example #5
0
        void UpdateArea(uint newArea)
        {
            // FFA_PVP flags are area and not zone id dependent
            // so apply them accordingly
            m_areaUpdateId = newArea;

            AreaTableRecord area = CliDB.AreaTableStorage.LookupByKey(newArea);

            pvpInfo.IsInFFAPvPArea = area != null && area.Flags[0].HasAnyFlag(AreaFlags.Arena);
            UpdatePvPState(true);

            UpdateAreaDependentAuras(newArea);
            PhasingHandler.OnAreaChange(this);

            if (IsAreaThatActivatesPvpTalents(newArea))
            {
                EnablePvpRules();
            }
            else
            {
                DisablePvpRules();
            }

            // previously this was in UpdateZone (but after UpdateArea) so nothing will break
            pvpInfo.IsInNoPvPArea = false;
            if (area != null && area.IsSanctuary())    // in sanctuary
            {
                SetByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PvpFlag, UnitBytes2Flags.Sanctuary);
                pvpInfo.IsInNoPvPArea = true;
                if (duel == null)
                {
                    CombatStopWithPets();
                }
            }
            else
            {
                RemoveByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PvpFlag, UnitBytes2Flags.Sanctuary);
            }

            AreaFlags areaRestFlag = (GetTeam() == Team.Alliance) ? AreaFlags.RestZoneAlliance : AreaFlags.RestZoneHorde;

            if (area != null && area.Flags[0].HasAnyFlag(areaRestFlag))
            {
                _restMgr.SetRestFlag(RestFlag.FactionArea);
            }
            else
            {
                _restMgr.RemoveRestFlag(RestFlag.FactionArea);
            }
        }
 public AreaTableEntry(int areaId, int mapId, int parentAreaId, int areaBit, AreaFlags flags, int soundProviderPreference, int soundProviderPreferenceUnderwater, int ambienceId, int zoneMusicId, int introSoundId, int areaExplorationLevel, [NotNull] LocalizedStringDBC <TStringType> areaName, AreaTeams factionTeamMask, [NotNull] Vector4 <int> liquidTypeId, float minimumElevation, float ambientMultiplier, int lightId)
 {
     AreaId                            = areaId;
     MapId                             = mapId;
     ParentAreaId                      = parentAreaId;
     AreaBit                           = areaBit;
     Flags                             = flags;
     SoundProviderPreference           = soundProviderPreference;
     SoundProviderPreferenceUnderwater = soundProviderPreferenceUnderwater;
     AmbienceId                        = ambienceId;
     ZoneMusicId                       = zoneMusicId;
     IntroSoundId                      = introSoundId;
     AreaExplorationLevel              = areaExplorationLevel;
     AreaName                          = areaName ?? throw new ArgumentNullException(nameof(areaName));
     FactionTeamMask                   = factionTeamMask;
     LiquidTypeID                      = liquidTypeId ?? throw new ArgumentNullException(nameof(liquidTypeId));
     MinimumElevation                  = minimumElevation;
     AmbientMultiplier                 = ambientMultiplier;
     LightId                           = lightId;
 }
Example #7
0
 public MapEntry(int mapId, TStringType directory, MapTypes mapType, AreaFlags flags, bool isPvPMap, LocalizedStringDBC <TStringType> mapName, int areaTableId, LocalizedStringDBC <TStringType> mapDescription0, LocalizedStringDBC <TStringType> mapDescription1, int loadingScreenId, float minimapIconScale, int corpseMapId, Vector2 <int> corpse, int timeOfDayOverride, Expansions expansion, int raidOffset, int maxPlayers)
 {
     MapId             = mapId;
     Directory         = directory;
     MapType           = mapType;
     Flags             = flags;
     PvP               = isPvPMap ? 1 : 0;
     MapName           = mapName;
     AreaTableId       = areaTableId;
     MapDescription0   = mapDescription0;
     MapDescription1   = mapDescription1;
     LoadingScreenId   = loadingScreenId;
     MinimapIconScale  = minimapIconScale;
     CorpseMapId       = corpseMapId;
     Corpse            = corpse;
     TimeOfDayOverride = timeOfDayOverride;
     ExpansionId       = (int)expansion;
     RaidOffset        = raidOffset;
     MaxPlayers        = maxPlayers;
 }
 public AreasBlock(BinaryReader binaryReader)
 {
     this.name = binaryReader.ReadString32();
     this.areaFlags = (AreaFlags)binaryReader.ReadInt32();
     this.skip = binaryReader.ReadBytes(20);
     this.skip0 = binaryReader.ReadBytes(4);
     this.padding1 = binaryReader.ReadBytes(64);
     this.manualReferenceFrame = binaryReader.ReadInt16();
     this.padding2 = binaryReader.ReadBytes(2);
     {
         var count = binaryReader.ReadInt32();
         var address = binaryReader.ReadInt32();
         var elementSize = Marshal.SizeOf(typeof(FlightReferenceBlock));
         this.flightHints = new FlightReferenceBlock[count];
         using (binaryReader.BaseStream.Pin())
         {
             for (int i = 0; i < count; ++i)
             {
                 binaryReader.BaseStream.Position = address + i * elementSize;
                 this.flightHints[i] = new FlightReferenceBlock(binaryReader);
             }
         }
     }
 }
Example #9
0
 public bool HasFlag(AreaFlags flag)
 {
     return(Flags[0].HasAnyFlag((uint)flag));
 }