/// <summary>
        /// Occurs after a player fell from a large distance
        /// </summary>
        /// <param name="cpkt"></param>
        private void CM_CHARACTER_FALL(CMSG_ACTORFALL cpkt)
        {
            if (this.isloaded == false) return;

            //HELPER VARIBALES
            uint value = cpkt.TargetActor / 8;
            ushort NewHP = (ushort)(this.character.HP - value);
            SMSG_TAKEDAMAGE spkt = new SMSG_TAKEDAMAGE();
            spkt.SessionId = this.character.id;

            //Update last hp tick
            this.character.LASTHP_TICK = Environment.TickCount;

            //Get the falling reason
            if (value >= this.character.HP)
                spkt.Reason = (byte)TakeDamageReason.FallenDead;
            else if (NewHP < (this.character.HPMAX / 10))
                spkt.Reason = (byte)TakeDamageReason.Survive;
            else
                spkt.Reason = (byte)TakeDamageReason.Falling;

            //Update some stuff
            bool isdead = value > this.character._status.CurrentHp;
            if (isdead)
            {
                spkt.Damage = this.character._status.CurrentHp;
                this.Send((byte[])spkt);
                this.character.stance = (byte)StancePosition.Dead;
                this.character.UpdateReason |= 1;
                this.character._status.CurrentHp = 0;
                this.character.OnDie();
                this.character._status.Updates |= 1;
                LifeCycle.Update(this.character);
            }
            else
            {
                spkt.Damage = value;
                this.Send((byte[])spkt);
                this.character._status.CurrentHp = NewHP;
                Common.Skills.UpdateAddition(this.character, 201, 30000);
                this.character._status.Updates |= 1;
                LifeCycle.Update(this.character);
            }

            //Update life cycle
            LifeCycle.Update(this.character);
            Regiontree tree = this.character.currentzone.Regiontree;
            foreach (Character sTarget in tree.SearchActors(SearchFlags.Characters))
            {
                if (isdead)
                    Common.Actions.UpdateStance(sTarget, this.character);
            }
        }
Example #2
0
    internal static void SendOxygenTakeDamage(Character c, uint p)
    {
        /*
         * This functions sends a oxygen damage packet
         *
         * Where the damage is already already decided. And take from
         * the character.
         */

        SMSG_TAKEDAMAGE spkt = new SMSG_TAKEDAMAGE();
        spkt.Damage = p;
        spkt.Reason = c.HP > 0 ? (byte)TakeDamageReason.Oxygen : (byte)TakeDamageReason.Suffocated;
        spkt.SessionId = c.id;
        c.client.Send((byte[])spkt);
    }