Esempio n. 1
0
        //public override void ReduceHp(L2Character attacker, double damage)
        //{
        //    if (Dead)
        //        return;

        //    //if ((this is L2Player && attacker is L2Player))
        //    //{
        //    //    if (CurCp > 0)
        //    //    {
        //    //        CurCp -= damage;

        //    //        if (CurCp < 0)
        //    //        {
        //    //            damage = CurCp * -1;
        //    //            CurCp = 0;
        //    //        }
        //    //    }
        //    //}

        //    CharStatus.ReduceHp(damage,attacker);

        //    StatusUpdate statusUpdate = new StatusUpdate(this);
        //    statusUpdate.Add(StatusUpdate.CurHp, (int)CharStatus.CurrentHp);
        //    // statusUpdate.Add(StatusUpdate.CurCp, (int)CurCp);
        //    BroadcastPacket(statusUpdate);

        //    if (CharStatus.CurrentHp <= 0)
        //    {
        //        DoDie(attacker);
        //        return;
        //    }
        //}

        public virtual void DoDie(L2Character killer)
        {
            lock (this)
            {
                if (Dead)
                {
                    return;
                }

                CharStatus.SetCurrentHp(0);

                Dead = true;
            }

            Target = null;
            NotifyStopMove(true, true);

            if (IsAttacking())
            {
                AbortAttack();
            }

            CharStatus.StopHpMpRegeneration();

            BroadcastStatusUpdate();

            BroadcastPacket(new Die(this));
        }
Esempio n. 2
0
 public L2Merchant(int objectId, NpcTemplate template, L2Spawn spawn) : base(objectId, template, spawn)
 {
     Template = template;
     Name     = template.Name;
     InitializeCharacterStatus();
     CharStatus.SetCurrentHp(MaxHp);
     CharStatus.SetCurrentMp(MaxMp);
     //Stats = new CharacterStat(this);
 }
Esempio n. 3
0
 public L2Trainer(SpawnTable spawnTable, int objectId, NpcTemplate template, L2Spawn spawn) : base(spawnTable, objectId, template, spawn)
 {
     Template = template;
     Name     = template.Name;
     InitializeCharacterStatus();
     CharStatus.SetCurrentHp(MaxHp);
     CharStatus.SetCurrentMp(MaxMp);
     //Stats = new CharacterStat(this);
 }
Esempio n. 4
0
 public L2Npc(SpawnTable spawnTable, int objectId, NpcTemplate template, L2Spawn spawn) : base(objectId, template)
 {
     Template = template;
     Name     = Template.Name;
     Initialize();
     CharStatus.SetCurrentHp(MaxHp);
     CharStatus.SetCurrentMp(MaxMp);
     this.spawn = spawn;
     //CStatsInit();
 }
Esempio n. 5
0
        public L2Monster(int objectId, NpcTemplate template) : base(objectId, template)
        {
            Template = template;
            Name     = template.Name;
            InitializeCharacterStatus();

            CharStatus.SetCurrentHp(Template.BaseHpMax(0));
            CharStatus.SetCurrentMp(Template.BaseMpMax(0));
            //Stats = new CharacterStat(this);
        }
Esempio n. 6
0
        public override async Task DoDieAsync(L2Character killer)
        {
            lock (this)
            {
                if (Dead)
                {
                    return;
                }

                CharStatus.SetCurrentHp(0);

                Dead = true;
            }
            //Check For Exp
            if (killer is L2Player)
            {
                ((L2Player)killer).AddExpSp(this.Template.Exp, this.Template.Sp, true);
            }

            Target = null;
            await CharMovement.NotifyStopMove(true);

            if (IsAttacking())
            {
                AbortAttack();
            }

            CharStatus.StopHpMpRegeneration();

            await BroadcastPacketAsync(new Die(this));

            _spawnTable.RegisterRespawn(spawn);
            if (Template.CorpseTime <= 0)
            {
                return;
            }
            CorpseTimer          = new Timer(Template.CorpseTime * 1000);
            CorpseTimer.Elapsed += new ElapsedEventHandler(RemoveCorpse);
            CorpseTimer.Start();
        }
Esempio n. 7
0
        public override void DoDie(L2Character killer)
        {
            lock (this)
            {
                if (Dead)
                {
                    return;
                }

                CharStatus.SetCurrentHp(0);

                Dead = true;
            }

            Target = null;
            NotifyStopMove(true, true);

            if (IsAttacking())
            {
                AbortAttack();
            }

            CharStatus.StopHpMpRegeneration();

            BroadcastPacket(new Die(this));

            SpawnTable.Instance.RegisterRespawn(spawn);

            if (Template.CorpseTime <= 0)
            {
                return;
            }

            CorpseTimer          = new Timer(Template.CorpseTime * 1000);
            CorpseTimer.Elapsed += new ElapsedEventHandler(RemoveCorpse);
            CorpseTimer.Start();
        }
Esempio n. 8
0
        public override async Task DoDieAsync(L2Character killer)
        {
            lock (this)
            {
                if (Dead)
                {
                    return;
                }

                CharStatus.SetCurrentHp(0);

                Dead = true;
            }

            Target = null;
            await Movement.NotifyStopMove(true);

            if (IsAttacking())
            {
                AbortAttack();
            }

            CharStatus.StopHpMpRegeneration();

            await BroadcastPacketAsync(new Die(this));

            _spawnTable.RegisterRespawn(spawn);

            if (Template.CorpseTime <= 0)
            {
                return;
            }

            CorpseTimer          = new Timer(Template.CorpseTime * 1000);
            CorpseTimer.Elapsed += RemoveCorpse;
            CorpseTimer.Start();
        }
Esempio n. 9
0
 public L2Chair(int objectId, CharTemplate template) : base(objectId, template)
 {
     Closed = 0;
     //MaxHp = 0;
     CharStatus.SetCurrentHp(0);
 }