Esempio n. 1
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. 2
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. 3
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.");
            }
        }