Example #1
0
        /// <summary>
        /// 取内功技能掉内力值
        /// </summary>
        /// <param name="BaseObject"></param>
        /// <param name="UserMagic"></param>
        /// <param name="Power"></param>
        /// <returns></returns>
        public unsafe static int GetNGPow(TBaseObject BaseObject, TUserMagic *UserMagic, int Power)
        {
            int result = 0;
            int nNHPoint;

            if ((UserMagic != null) && (BaseObject != null))
            {
                if ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    nNHPoint = ((TPlayObject)(BaseObject)).GetSpellPoint(UserMagic);
                    if (((TPlayObject)(BaseObject)).m_Skill69NH >= nNHPoint)
                    {
                        ((TPlayObject)(BaseObject)).m_Skill69NH = (uint)HUtil32._MAX(0, ((TPlayObject)(BaseObject)).m_Skill69NH - nNHPoint);
                        ((TPlayObject)(BaseObject)).SendRefMsg(Grobal2.RM_MAGIC69SKILLNH, 0, ((TPlayObject)(BaseObject)).m_Skill69NH, ((TPlayObject)(BaseObject)).m_Skill69MaxNH, 0, "");
                        result = (int)HUtil32.Round((double)Power * ((UserMagic->btLevel + 1) * (M2Share.g_Config.nNGSkillRate / 100))); // 计算攻击力
                        ((TPlayObject)(BaseObject)).NGMagic_Lvexp(UserMagic);                                                            // 内功技能升级
                    }
                }
                else if ((BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                {
                    nNHPoint = ((THeroObject)(BaseObject)).GetSpellPoint(UserMagic);
                    if (((THeroObject)(BaseObject)).m_Skill69NH >= nNHPoint)
                    {
                        ((THeroObject)(BaseObject)).m_Skill69NH = (uint)HUtil32._MAX(0, ((THeroObject)(BaseObject)).m_Skill69NH - nNHPoint);
                        ((THeroObject)(BaseObject)).SendRefMsg(Grobal2.RM_MAGIC69SKILLNH, 0, ((THeroObject)(BaseObject)).m_Skill69NH, ((THeroObject)(BaseObject)).m_Skill69MaxNH, 0, "");
                        result = (int)HUtil32.Round((double)Power * ((UserMagic->btLevel + 1) * (M2Share.g_Config.nNGSkillRate / 100))); // 计算攻击力
                        ((THeroObject)(BaseObject)).NGMAGIC_LVEXP(UserMagic);                                                            // 内功技能升级
                    }
                }
            }
            return(result);
        }
Example #2
0
        public unsafe static int GetPower13(int nInt, TUserMagic *UserMagic)
        {
            int    result;
            double d10;
            double d18;

            d10    = nInt / 3.0;
            d18    = nInt - d10;
            result = (int)HUtil32.Round(d18 / (UserMagic->MagicInfo.btTrainLv + 1) * (UserMagic->btLevel + 1) + d10 + (UserMagic->MagicInfo.btDefPower
                                                                                                                       + HUtil32.Random(UserMagic->MagicInfo.btDefMaxPower - UserMagic->MagicInfo.btDefPower)));
            return(result);
        }
Example #3
0
        private void FlyAxeAttack(TBaseObject Target)
        {
            TAbility WAbil;
            int      nDamage;

            // 重击几率,目标等级不高于自己,才使用重击
            if (((HUtil32.Random(M2Share.g_Config.nFairyDuntRate) == 0) && (Target.m_Abil.Level <= m_Abil.Level)) ||
                (nHitCount >= HUtil32._MIN((3 + M2Share.g_Config.nFairyDuntRateBelow),
                                           (m_btSlaveExpLevel + M2Share.g_Config.nFairyDuntRateBelow))))
            {
                // 月灵重击次数,达到次数时按等级出重击
                m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY);
                WAbil         = m_WAbil;// 重击倍数
                nDamage       = (int)HUtil32._MAX(0, (int)HUtil32.Round((double)((HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1))
                                                                                 + HUtil32.LoWord(WAbil.DC)) * M2Share.g_Config.nFairyAttackRate / 100));
                if (nDamage > 0)
                {
                    nDamage = Target.GetHitStruckDamage(this, nDamage);
                }
                if (nDamage > 0)
                {
                    Target.StruckDamage(nDamage);
                }
                Target.SetLastHiter(this);
                Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP, Target.m_WAbil.MaxHP, Parse(this), "",
                                    (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600);
                SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, m_nCurrX, m_nCurrY, Parse(Target), "");
                m_dwActionTick = HUtil32.GetTickCount();
                nHitCount      = 0;// 攻击计数
            }
            else
            {
                m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY);
                WAbil         = m_WAbil;
                nDamage       = HUtil32._MAX(0, HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1)
                                             + HUtil32.LoWord(WAbil.DC));
                if (nDamage > 0)
                {
                    nDamage = Target.GetHitStruckDamage(this, nDamage);
                }
                if (nDamage > 0)
                {
                    Target.StruckDamage(nDamage);
                }
                Target.SetLastHiter(this);
                Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP,
                                    Target.m_WAbil.MaxHP, Parse(this), "", (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600);
                SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(Target), "");
                m_dwActionTick = HUtil32.GetTickCount();
                nHitCount++;// 攻击计数
            }
        }
Example #4
0
 public override void Run()
 {
     try
     {
         if (!m_boDeath && !m_boGhost && (m_wStatusTimeArr[Grobal2.POISON_STONE] == 0))
         {
             if (((HUtil32.GetTickCount() - m_dwSearchEnemyTick) > 1000) && (m_TargetCret == null))
             {
                 m_dwSearchEnemyTick = HUtil32.GetTickCount();
                 SearchTarget();// 搜索可攻击目标
             }
             if ((m_TargetCret != null))
             {
                 // 走路间隔
                 if ((HUtil32.GetTickCount() - m_dwWalkTick > m_nWalkSpeed) && (!m_TargetCret.m_boDeath))
                 {
                     // 目标不为空
                     if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 5) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 5))
                     {
                         if ((m_WAbil.HP < HUtil32.Round(Convert.ToDouble(m_WAbil.MaxHP))) && (HUtil32.Random(4) == 0))// 使用群体治疗术
                         {
                             if (HUtil32.GetTickCount() - m_dwHitTick > m_nNextHitTime)
                             {
                                 m_dwHitTick = HUtil32.GetTickCount();
                                 M2Share.MagicManager.MagBigHealing(this, 50, m_nCurrX, m_nCurrY);// 群体治疗术
                                 SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, m_nCurrX, m_nCurrY, Parse(this), "");
                             }
                         }
                         AttackTarget();
                     }
                     else
                     {
                         this.GotoTargetXY();
                     }
                 }
             }
         }
     }
     catch
     {
         M2Share.MainOutMessage("{异常} TheCrutchesSpider.Run");
     }
     base.Run();
 }
Example #5
0
        /// <summary>
        /// 寒冰掌,治疗术 攻击
        /// </summary>
        /// <returns></returns>
        public override bool AttackTarget()
        {
            bool result = false;
            int  nPower;
            int  nDir;
            int  push;

            if (this.m_TargetCret == null)
            {
                return(result);
            }
            if (HUtil32.GetTickCount() - this.m_dwHitTick > this.m_nNextHitTime)
            {
                this.m_dwHitTick = (uint)HUtil32.GetTickCount();
                if (!this.m_TargetCret.m_boDeath)
                {
                    if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5))
                    {
                        this.m_dwTargetFocusTick = (uint)HUtil32.GetTickCount();
                        if ((this.m_WAbil.HP < HUtil32.Round(this.m_WAbil.MaxHP * 0.6)) && (HUtil32.Random(2) == 0))
                        {
                            // 使用治疗术
                            this.SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, this.m_nCurrX, this.m_nCurrY, 0, ""); // 治愈术
                            this.SendDelayMsg(this, Grobal2.RM_MAGHEALING, 0, 50, 0, 0, "", 800);                // 发消息给客户端,显示治愈术效果
                            result = true;
                            return(result);
                        }
                        else
                        {
                            // 寒冰掌
                            nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC)));
                            this.SendDelayMsg(this, Grobal2.RM_DELAYMAGIC, nPower, HUtil32.MakeLong(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY), 2, 0, "", 600);
                            if ((!this.m_TargetCret.m_boStickMode) && (HUtil32.Random(2) == 0))
                            {
                                push = HUtil32.Random(3) - 1;
                                if (push > 0)
                                {
                                    nDir = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY);
                                    this.SendDelayMsg(this, Grobal2.RM_DELAYPUSHED, nDir, HUtil32.MakeLong(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY), push, 0, "", 600);
                                }
                            }
                            // 发消息给客户端,显示寒冰掌效果
                            this.SendRefMsg(Grobal2.RM_LIGHTING, 1, this.m_nCurrX, this.m_nCurrY, 0, "");
                            result = true;
                            return(result);
                        }
                    }
                    if (this.m_TargetCret.m_PEnvir == this.m_PEnvir)
                    {
                        if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11))
                        {
                            this.SetTargetXY(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY);
                        }
                    }
                    else
                    {
                        this.DelTargetCreat();
                    }
                }
            }
            return(result);
        }
Example #6
0
        // ----------------------------------------------------------------------
        // 函数功能:检查护身符或毒 是否存在
        // 参数 nType 为指定类型 1 为护身符 2 为毒药
        // 先判断装备栏中是否放有此类物品,如没有,则检查包裹中是否放有此类物品
        // -----------------------------------------------------------------------
        public unsafe static bool CheckAmulet(TBaseObject PlayObject, int nCount, int nType, ref int Idx)
        {
            bool       result = false;
            TUserItem *UserItem;// 毒,护身符直接使用
            TStdItem * AmuletStdItem;

            try
            {
                if (PlayObject.m_boGhost)
                {
                    return(result);
                }
                Idx = 0;
                if (PlayObject.m_UseItems[TPosition.U_ARMRINGL]->wIndex > 0)
                {
                    AmuletStdItem = M2Share.UserEngine.GetStdItem(PlayObject.m_UseItems[TPosition.U_ARMRINGL]->wIndex);
                    if ((AmuletStdItem != null))
                    {
                        if ((AmuletStdItem->StdMode == 25))
                        {
                            switch (nType)
                            {
                            case 1:
                                if ((AmuletStdItem->Shape == 5) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_ARMRINGL]->Dura / 100) >= nCount))
                                {
                                    Idx    = TPosition.U_ARMRINGL;
                                    result = true;
                                    return(result);
                                }
                                break;

                            case 2:
                                if (PlayObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                {
                                    if ((AmuletStdItem->Shape <= 2) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_ARMRINGL]->Dura / 100) >= nCount))
                                    {
                                        Idx    = TPosition.U_ARMRINGL;
                                        result = true;
                                        return(result);
                                    }
                                }
                                else if (PlayObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                {
                                    switch (((THeroObject)(PlayObject)).n_AmuletIndx)
                                    {
                                    case 1:        // 绿毒
                                        if ((AmuletStdItem->Shape == 1) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_ARMRINGL]->Dura / 100) >= nCount))
                                        {
                                            Idx    = TPosition.U_ARMRINGL;
                                            result = true;
                                            return(result);
                                        }
                                        break;

                                    case 2:        // 红毒
                                        if ((AmuletStdItem->Shape == 2) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_ARMRINGL]->Dura / 100) >= nCount))
                                        {
                                            Idx    = TPosition.U_ARMRINGL;
                                            result = true;
                                            return(result);
                                        }
                                        break;
                                    }
                                }
                                break;
                            }
                        }
                    }

                    if (PlayObject.m_UseItems[TPosition.U_BUJUK]->wIndex > 0)
                    {
                        AmuletStdItem = M2Share.UserEngine.GetStdItem(PlayObject.m_UseItems[TPosition.U_BUJUK]->wIndex);
                        if ((AmuletStdItem != null))
                        {
                            if ((AmuletStdItem->StdMode == 25))
                            {
                                switch (nType)
                                {
                                case 1:    // 符
                                    if ((AmuletStdItem->Shape == 5) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_BUJUK]->Dura / 100) >= nCount))
                                    {
                                        Idx    = TPosition.U_BUJUK;
                                        result = true;
                                        return(result);
                                    }
                                    break;

                                case 2:    // 毒
                                    if ((PlayObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT) || (PlayObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER))
                                    {
                                        if ((AmuletStdItem->Shape <= 2) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_BUJUK]->Dura / 100) >= nCount))
                                        {
                                            Idx    = TPosition.U_BUJUK;
                                            result = true;
                                            return(result);
                                        }
                                    }
                                    else if (PlayObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                    {
                                        switch (((THeroObject)(PlayObject)).n_AmuletIndx)
                                        {
                                        case 1:        // 绿毒
                                            if ((AmuletStdItem->Shape == 1) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_BUJUK]->Dura / 100) >= nCount))
                                            {
                                                Idx    = TPosition.U_BUJUK;
                                                result = true;
                                                return(result);
                                            }
                                            break;

                                        case 2:        // 红毒
                                            if ((AmuletStdItem->Shape == 2) && (HUtil32.Round((double)PlayObject.m_UseItems[TPosition.U_BUJUK]->Dura / 100) >= nCount))
                                            {
                                                Idx    = TPosition.U_BUJUK;
                                                result = true;
                                                return(result);
                                            }
                                            break;
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    //毒,护身符直接使用(检测人物包裹是否存在毒,护身符)
                    if (PlayObject.m_ItemList.Count > 0)
                    {
                        for (int I = 0; I < PlayObject.m_ItemList.Count; I++)// 人物包裹不为空
                        {
                            UserItem      = (TUserItem *)PlayObject.m_ItemList[I];
                            AmuletStdItem = M2Share.UserEngine.GetStdItem(UserItem->wIndex);
                            if ((AmuletStdItem != null))
                            {
                                if ((AmuletStdItem->StdMode == 25))
                                {
                                    switch (nType)
                                    {
                                    case 1:
                                        if ((AmuletStdItem->Shape == 5) && (HUtil32.Round((double)UserItem->Dura / 100) >= nCount))
                                        {
                                            Idx    = UserItem->wIndex;
                                            result = true;
                                            return(result);
                                        }
                                        break;

                                    case 2:
                                        if (PlayObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                        {
                                            if ((AmuletStdItem->Shape <= 2) && (HUtil32.Round((double)UserItem->Dura / 100) >= nCount))
                                            {
                                                Idx    = UserItem->wIndex;
                                                result = true;
                                                return(result);
                                            }
                                        }
                                        else if (PlayObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                        {
                                            switch (((THeroObject)(PlayObject)).n_AmuletIndx)
                                            {
                                            case 1:        // 绿毒
                                                if ((AmuletStdItem->Shape == 1) && (HUtil32.Round((double)UserItem->Dura / 100) >= nCount))
                                                {
                                                    Idx    = UserItem->wIndex;
                                                    result = true;
                                                    return(result);
                                                }
                                                break;

                                            case 2:        // 红毒
                                                if ((AmuletStdItem->Shape == 2) && (HUtil32.Round((double)UserItem->Dura / 100) >= nCount))
                                                {
                                                    Idx    = UserItem->wIndex;
                                                    result = true;
                                                    return(result);
                                                }
                                                break;
                                            }
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TMagic.CheckAmulet");
            }
            return(result);
        }
Example #7
0
 public unsafe static int GetPower(int nPower, TUserMagic *UserMagic)
 {
     return((int)HUtil32.Round((double)nPower / (UserMagic->MagicInfo.btTrainLv + 1) * (UserMagic->btLevel + 1)) + (UserMagic->MagicInfo.btDefPower
                                                                                                                    + HUtil32.Random(UserMagic->MagicInfo.btDefMaxPower - UserMagic->MagicInfo.btDefPower)));
 }
Example #8
0
        /// <summary>
        /// 使用灭天火攻击
        /// </summary>
        /// <returns></returns>
        public override bool AttackTarget()
        {
            bool result;
            int  nPower = -1;

            result = false;
            if ((this.m_TargetCret == null))
            {
                return(result);
            }
            if (HUtil32.GetTickCount() - this.m_dwHitTick > this.m_nNextHitTime)
            {
                this.m_dwHitTick = (uint)HUtil32.GetTickCount();
                if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5))
                {
                    this.m_dwTargetFocusTick = (uint)HUtil32.GetTickCount();
                    if (!this.m_TargetCret.m_boDeath)
                    {
                        if ((this.m_TargetCret.m_wStatusTimeArr[Grobal2.POISON_DAMAGEARMOR] == 0))
                        {
                            // 目标红毒时间到,才重新使用施毒术
                            if (this.IsProperTarget(this.m_TargetCret))
                            {
                                if (HUtil32.Random(this.m_TargetCret.m_btAntiPoison + 7) <= 6)
                                {
                                    // 施毒
                                    nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC))); // 中毒类型:红毒
                                    this.m_TargetCret.SendDelayMsg(this, Grobal2.RM_POISON, Grobal2.POISON_DAMAGEARMOR, nPower, this.ToInt(), 4, "", 150);                     // 发消息给客户端,显示施毒效果
                                    this.SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, this.m_nCurrX, this.m_nCurrY, m_TargetCret.ToInt(), "");
                                    result = true;
                                    return(result);
                                }
                            }
                        }
                        else
                        {
                            // 灭天火
                            if ((HUtil32.Random(10) >= this.m_TargetCret.m_nAntiMagic))
                            {
                                nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC)));
                                if (this.m_TargetCret.m_btLifeAttrib == Grobal2.LA_UNDEAD)
                                {
                                    nPower = (int)HUtil32.Round(nPower * 1.5);
                                }
                                // 如果为不死系
                                this.SendDelayMsg(this, Grobal2.RM_DELAYMAGIC, nPower, HUtil32.MakeLong(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY),
                                                  2, m_TargetCret.ToInt(), "", 600);// 发消息给客户端,显示灭天火效果
                                this.SendRefMsg(Grobal2.RM_LIGHTING, 1, this.m_nCurrX, this.m_nCurrY, m_TargetCret.ToInt(), "");
                                if (M2Share.g_Config.boPlayObjectReduceMP)
                                {
                                    this.m_TargetCret.DamageSpell((int)Math.Abs(HUtil32.Round(nPower * 0.35)));// 击中减MP值,减35%
                                }
                                result = true;
                                return(result);
                            }
                            else
                            {
                                // 物理攻击
                                if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2))
                                {
                                    nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC)));
                                    this.HitMagAttackTarget(this.m_TargetCret, nPower / 2, nPower / 2, true);
                                    result = true;
                                    return(result);
                                }
                            }
                        }
                    }
                    if (this.m_TargetCret.m_PEnvir == this.m_PEnvir)
                    {
                        if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11))
                        {
                            this.SetTargetXY(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY);
                        }
                    }
                    else
                    {
                        this.DelTargetCreat();
                    }
                }
            }
            return(result);
        }
Example #9
0
 public static int MagMakeFireball_GetPower(TUserMagic *UserMagic, int nPower)
 {
     return((int)HUtil32.Round((double)nPower / (UserMagic->MagicInfo.btTrainLv + 1) * (UserMagic->btLevel + 1), 1) + (UserMagic->MagicInfo.btDefPower +
                                                                                                                       HUtil32.Random(UserMagic->MagicInfo.btDefMaxPower - UserMagic->MagicInfo.btDefPower)));
 }
Example #10
0
        /// <summary>
        /// 加载怪物数据
        /// </summary>
        /// <returns></returns>
        internal int LoadMonsterDB()
        {
            int          result = 0;
            TMonInfo     Monster;
            IDataReader  dr         = null;
            const string sSQLString = "SELECT NAME,RACE,RACEIMG,APPR,LVL,UNDEAD,COOLEYE,EXP,HP,MP,AC,MAC,DC,DCMAX,MC,SC,SPEED,HIT,WALK_SPD,WALKSTEP,WALKWAIT,ATTACK_SPD FROM TBL_MONSTER";

            HUtil32.EnterCriticalSection(M2Share.ProcessHumanCriticalSection);
            try
            {
                if (UserEngine.MonsterList.Count > 0)
                {
                    for (int I = 0; I < UserEngine.MonsterList.Count; I++)
                    {
                        if (UserEngine.MonsterList[I] != null)
                        {
                            Dispose(UserEngine.MonsterList[I]);
                        }
                    }
                    UserEngine.MonsterList.Clear();
                }
                try
                {
                    dr = DBsession.ExecuteReader(sSQLString);
                }
                catch
                {
                    MainOutMessage("链接数据库发生异常...");
                }
                finally
                {
                    result = -1;
                }
                if (dr == null) //2013.04.16 Fixed dr为空时Read报错
                {
                    return(result);
                }
                while (dr.Read())
                {
                    Monster              = new TMonInfo();
                    Monster.ItemList     = new List <TMonItem>();
                    Monster.sName        = dr.GetString("NAME");
                    Monster.btRace       = dr.GetByte("Race");
                    Monster.btRaceImg    = dr.GetByte("RaceImg");
                    Monster.wAppr        = dr.GetUInt16("Appr");
                    Monster.wLevel       = dr.GetUInt16("Lvl");
                    Monster.btLifeAttrib = dr.GetByte("Undead");            // 不死系 1-不死系
                    Monster.wCoolEye     = dr.GetUInt16("CoolEye");
                    Monster.dwExp        = dr.GetUInt32("Exp");             // 城门或城墙的状态跟HP值有关,如果HP异常,将导致城墙显示不了
                    if ((Monster.btRace == 110) || (Monster.btRace == 111)) // 如果为城墙或城门由HP不加倍
                    {
                        Monster.wHP = dr.GetUInt16("HP");
                    }
                    else
                    {
                        Monster.wHP = (ushort)HUtil32.Round((double)dr.GetInt32("HP") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    }
                    Monster.wMP          = (ushort)HUtil32.Round((double)dr.GetUInt16("MP") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    Monster.wAC          = (ushort)HUtil32.Round((double)dr.GetUInt16("AC") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    Monster.wMAC         = (ushort)HUtil32.Round((double)dr.GetUInt16("MAC") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    Monster.wDC          = (ushort)HUtil32.Round((double)dr.GetUInt16("DC") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    Monster.wMaxDC       = (ushort)HUtil32.Round((double)dr.GetUInt16("DCMAX") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    Monster.wMC          = (ushort)HUtil32.Round((double)dr.GetUInt16("MC") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    Monster.wSC          = (ushort)HUtil32.Round((double)dr.GetUInt16("SC") * (M2Share.g_Config.nMonsterPowerRate / 10));
                    Monster.wSpeed       = dr.GetUInt16("SPEED");
                    Monster.wHitPoint    = dr.GetUInt16("HIT");
                    Monster.wWalkSpeed   = (ushort)HUtil32._MAX(200, dr.GetUInt16("WALK_SPD"));
                    Monster.wWalkStep    = (ushort)HUtil32._MAX(1, dr.GetUInt16("WalkStep"));
                    Monster.wWalkWait    = dr.GetUInt16("WalkWait");
                    Monster.wAttackSpeed = dr.GetUInt16("ATTACK_SPD");
                    if (Monster.wWalkSpeed < 200)
                    {
                        Monster.wWalkSpeed = 200;
                    }
                    if (Monster.wAttackSpeed < 200)
                    {
                        Monster.wAttackSpeed = 200;
                    }
                    Monster.ItemList = null;
                    LoadMonitems(Monster.sName, ref Monster.ItemList);
                    UserEngine.MonsterList.Add(Monster);
                    result = 1;
                }
            }
            finally
            {
                dr.Close();
                dr.Dispose();
                HUtil32.LeaveCriticalSection(M2Share.ProcessHumanCriticalSection);
            }
            return(result);
        }