Esempio n. 1
0
 public static void SendAuraUpdate(Unit owner, Aura aura)
 {
     if (owner is NPC)
     {
         Asda2CombatHandler.SendNpcBuffedResponse((NPC)owner, aura);
     }
     else
     {
         if (!(owner is Character))
         {
             return;
         }
         Character character = (Character)owner;
         if (!character.CanMove)
         {
             Asda2MovmentHandler.SendEndMoveByFastInstantRegularMoveResponse(character);
         }
         Asda2SpellHandler.SendCharacterBuffedResponse(character, aura);
         if (character.IsInGroup)
         {
             Asda2GroupHandler.SendPartyMemberBuffInfoResponse(character);
         }
         if (character.SoulmateCharacter == null)
         {
             return;
         }
         Asda2SoulmateHandler.SendSoulmateBuffUpdateInfoResponse(character);
     }
 }
Esempio n. 2
0
        public static void SendAuraUpdate(Unit owner, Aura aura)
        {
            if (owner is NPC)
            {
                Asda2CombatHandler.SendNpcBuffedResponse((NPC)owner, aura);
            }
            else if (owner is Character)
            {
                var chr = (Character)owner;
                if (!chr.CanMove)
                {
                    Asda2MovmentHandler.SendEndMoveByFastInstantRegularMoveResponse(chr);
                }
                Asda2SpellHandler.SendCharacterBuffedResponse(chr, aura);
                if (chr.IsInGroup)
                {
                    Asda2GroupHandler.SendPartyMemberBuffInfoResponse(chr);
                }
                if (chr.SoulmateCharacter != null)
                {
                    Asda2SoulmateHandler.SendSoulmateBuffUpdateInfoResponse(chr);
                }
            }

            /*if (!owner.IsAreaActive) return;
             *  using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AURA_UPDATE))
             *  {
             *          owner.EntityId.WritePacked(packet);
             *
             *          WriteAura(aura, packet);
             *
             *          owner.SendPacketToArea(packet);
             *  }*/
        }
Esempio n. 3
0
 protected override void Apply(WorldObject target, ref DamageAction[] actions)
 {
     if (Effect.Spell.Id == 207 || Effect.Spell.Id == 97)
     {
         var distance = m_cast.CasterObject.Position.GetDistance(target.Position) - ((Unit)target).BoundingRadius -
                        0.7f;
         var direction = target.Position - m_cast.CasterObject.Position;
         direction.Normalize();
         Cast.CasterChar.Position = Cast.CasterChar.Position + direction * distance;
         if (target is NPC || Effect.Spell.Id == 207)
         {
             Asda2MovmentHandler.SendStartMoveCommonToAreaResponse(Cast.CasterChar, true);
         }
     }
 }
Esempio n. 4
0
        /// <summary>Starts moving to current Destination</summary>
        /// <remarks>Sends movement packet to client</remarks>
        protected void MoveToDestination()
        {
            m_moving          = true;
            m_totalMovingTime = RemainingTime;
            m_owner.SetOrientationTowards(ref m_destination);
            NPC owner = m_owner as NPC;

            if (_lastDestPosition != m_destination.XY)
            {
                Asda2MovmentHandler.SendMonstMoveOrAtackResponse(-1, owner, -1,
                                                                 new Vector3(m_destination.X - m_owner.Map.Offset,
                                                                             m_destination.Y - m_owner.Map.Offset), false);
                _lastDestPosition = m_destination.XY;
            }

            m_lastMoveTime         = Utility.GetSystemTime();
            m_desiredEndMovingTime = m_lastMoveTime + m_totalMovingTime;
        }
Esempio n. 5
0
        protected override void Apply(WorldObject target, ref DamageAction[] actions)
        {
            if (this.Effect.Spell.Id != 207U && this.Effect.Spell.Id != 97U)
            {
                return;
            }
            float num = (float)((double)this.m_cast.CasterObject.Position.GetDistance(target.Position) -
                                (double)((Unit)target).BoundingRadius - 0.699999988079071);
            Vector3 vector3 = target.Position - this.m_cast.CasterObject.Position;

            vector3.Normalize();
            this.Cast.CasterChar.Position = this.Cast.CasterChar.Position + vector3 * num;
            if (!(target is NPC) && this.Effect.Spell.Id != 207U)
            {
                return;
            }
            Asda2MovmentHandler.SendStartMoveCommonToAreaResponse(this.Cast.CasterChar, true, true);
        }
Esempio n. 6
0
        /// <summary>Starts moving to current Destination</summary>
        /// <remarks>Sends movement packet to client</remarks>
        protected void MoveToDestination()
        {
            this.m_moving          = true;
            this.m_totalMovingTime = this.RemainingTime;
            this.m_owner.SetOrientationTowards(ref this.m_destination);
            NPC owner = this.m_owner as NPC;

            if (this._lastDestPosition != this.m_destination.XY)
            {
                Asda2MovmentHandler.SendMonstMoveOrAtackResponse((short)-1, owner, -1,
                                                                 new Vector3(this.m_destination.X - this.m_owner.Map.Offset,
                                                                             this.m_destination.Y - this.m_owner.Map.Offset), false);
                this._lastDestPosition = this.m_destination.XY;
            }

            this.m_lastMoveTime         = Utility.GetSystemTime();
            this.m_desiredEndMovingTime = this.m_lastMoveTime + this.m_totalMovingTime;
        }
Esempio n. 7
0
        protected override void Apply()
        {
            if (Owner.IsInfluenced)
            {
                return;
            }
            if (Owner is Character)
            {
                Character owner = (Character)Owner;
                owner.SetMover(Owner, false);
                owner.SpeedFactor *= 0.5f;
                Asda2MovmentHandler.OnMoveRequest(owner.Client, owner.Asda2Y + Utility.Random(-10, 10),
                                                  owner.Asda2X + Utility.Random(-10, 10));
            }
            else if (Owner is NPC)
            {
                m_aura.Auras.Owner.Brain.State = BrainState.Fear;
            }

            Owner.IsInfluenced = true;
        }
Esempio n. 8
0
 public void TryCapture(Character activeCharacter)
 {
     lock (this)
     {
         if (this.CapturingCharacter != null)
         {
             activeCharacter.SendWarMsg(string.Format("Point {0} already capturing by {1}.",
                                                      (object)((int)this.Id + 1), (object)this.CapturingCharacter.Name));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.Fail);
         }
         else if ((double)activeCharacter.Asda2Position.GetDistance(new Vector3((float)this.X,
                                                                                (float)this.Y)) > 7.0)
         {
             activeCharacter.SendWarMsg(string.Format("Distance to {0} is too big.",
                                                      (object)((int)this.Id + 1)));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.Fail);
         }
         else if (this.Status != Asda2WarPointStatus.NotOwned &&
                  (int)this.OwnedFaction == (int)activeCharacter.Asda2FactionId)
         {
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.YouAreOcupaingTheSameSide);
         }
         else
         {
             this.CapturingCharacter = activeCharacter;
             activeCharacter.CurrentCapturingPoint = this;
             this.CapturingCharacter.IsMoving      = false;
             this.CapturingCharacter.IsFighting    = false;
             Asda2MovmentHandler.SendEndMoveByFastInstantRegularMoveResponse(this.CapturingCharacter);
             this._isCapturing          = false;
             this._timeToStartCapturing = CharacterFormulas.DefaultTimeToStartCapture;
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, this.Id,
                                                                        OcupationPointStartedStatus.Ok);
         }
     }
 }
Esempio n. 9
0
 //todo disable on move\take dmg\stun
 public void TryCapture(Character activeCharacter)
 {
     lock (this)
     {
         if (CapturingCharacter != null)
         {
             activeCharacter.SendWarMsg(string.Format("Point {0} already capturing by {1}.", Id + 1,
                                                      CapturingCharacter.Name));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                        OcupationPointStartedStatus.Fail);
             return;
         }
         if (activeCharacter.Asda2Position.GetDistance(new Vector3(X, Y)) > 7)
         {
             activeCharacter.SendWarMsg(string.Format("Distance to {0} is too big.", Id + 1));
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                        OcupationPointStartedStatus.Fail);
             return;
         }
         if (Status != Asda2WarPointStatus.NotOwned && OwnedFaction == activeCharacter.Asda2FactionId)
         {
             Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                        OcupationPointStartedStatus.YouAreOcupaingTheSameSide);
             return;
         }
         CapturingCharacter = activeCharacter;
         activeCharacter.CurrentCapturingPoint = this;
         CapturingCharacter.IsMoving           = false;
         CapturingCharacter.IsFighting         = false;
         Asda2MovmentHandler.SendEndMoveByFastInstantRegularMoveResponse(CapturingCharacter);
         _isCapturing          = false;
         _timeToStartCapturing = CharacterFormulas.DefaultTimeToStartCapture;
         Asda2BattlegroundHandler.SendOccupyingPointStartedResponse(activeCharacter.Client, Id,
                                                                    OcupationPointStartedStatus.Ok);
     }
 }
Esempio n. 10
0
 private static void OnCharacterProvoked(Character chr, Unit caster)
 {
     chr.IsAggred        = true;
     chr.ArggredDateTime = DateTime.Now.AddMilliseconds(2500.0);
     Asda2MovmentHandler.OnMoveRequest(chr.Client, caster.Asda2Y, caster.Asda2X);
 }
Esempio n. 11
0
        public override void Update(int dt)
        {
            base.Update(dt);

            if (m_isLoggingOut)
            {
                m_logoutTimer.Update(dt);
            }

            if (!IsMoving && LastSendIamNotMoving < (uint)Environment.TickCount)
            {
                LastSendIamNotMoving = (uint)(Environment.TickCount + CharacterFormulas.TimeBetweenImNotMovingPacketSendMillis);
                Asda2MovmentHandler.SendStartMoveCommonToAreaResponse(this, true, false);
            }
            Asda2MovmentHandler.CalculateAndSetRealPos(this, dt);
            if (Asda2Pet != null)
            {
                if (LastPetExpGainTime < (uint)Environment.TickCount)
                {
                    Asda2Pet.GainXp(1);
                    LastPetExpGainTime = (uint)Environment.TickCount + CharacterFormulas.TimeBetweenPetExpGainSecs * 1000;
                }
                if (!PetNotHungerEnabled && LastPetEatingTime < (uint)Environment.TickCount)
                {
                    if (Asda2Pet.HungerPrc == 1)
                    {
                        Asda2TitleChecker.OnPetStarve(this);
                        //Stop pet
                        Asda2PetHandler.SendPetGoesSleepDueStarvationResponse(Client, Asda2Pet);
                        Asda2Pet.RemoveStatsFromOwner();
                        Asda2Pet.HungerPrc = 0;
                        Asda2Pet           = null;
                        GlobalHandler.UpdateCharacterPetInfoToArea(this);
                    }
                    else
                    {
                        Asda2Pet.HungerPrc--;
                        LastPetEatingTime = (uint)Environment.TickCount + CharacterFormulas.TimeBetweenPetEatingsSecs * 1000;
                    }
                }
            }
            if (PremiumBuffs.Count > 0)
            {
                foreach (var functionItemBuff in PremiumBuffs.Values)
                {
                    if (functionItemBuff.Duration < dt)
                    {
                        ProcessFunctionalItemEffect(functionItemBuff, false);
                        CategoryBuffsToDelete.Add(functionItemBuff.Template.Category);
                        functionItemBuff.DeleteLater();
                    }
                    else
                    {
                        functionItemBuff.Duration -= dt;
                    }
                }
            }
            foreach (var functionItemBuff in LongTimePremiumBuffs)
            {
                if (functionItemBuff == null)
                {
                    continue;
                }
                if (functionItemBuff.EndsDate < DateTime.Now)
                {
                    ProcessFunctionalItemEffect(functionItemBuff, false);
                    CategoryBuffsToDelete.Add(functionItemBuff.Template.Category);
                    functionItemBuff.DeleteLater();
                }
            }
            if (CategoryBuffsToDelete.Count > 0)
            {
                foreach (var asda2ItemCategory in CategoryBuffsToDelete)
                {
                    PremiumBuffs.Remove(asda2ItemCategory);
                    for (int i = 0; i < LongTimePremiumBuffs.Length; i++)
                    {
                        if (LongTimePremiumBuffs[i] == null || LongTimePremiumBuffs[i].Template.Category != asda2ItemCategory)
                        {
                            continue;
                        }
                        LongTimePremiumBuffs[i] = null;
                        break;
                    }
                }
                CategoryBuffsToDelete.Clear();
            }
            var toDelete = new List <Asda2PereodicActionType>();

            foreach (var pereodicAction in PereodicActions)
            {
                pereodicAction.Value.Update(dt);
                if (pereodicAction.Value.CallsNum <= 0)
                {
                    toDelete.Add(pereodicAction.Key);
                }
            }
            foreach (var t in toDelete)
            {
                PereodicActions.Remove(t);
            }
            if (SoulmateRecord != null)
            {
                SoulmateRecord.OnUpdateTick();
            }
            if (BanChatTill < DateTime.Now)
            {
                BanChatTill = null;
                ChatBanned  = false;
                SendInfoMsg("Chat is unbanned.");
            }
        }