예제 #1
0
        public override bool AttackTarget()
        {
            bool result = false;
            byte btDir  = 0;

            if (m_TargetCret != null)
            {
                if (TargetInSpitRange(m_TargetCret, ref btDir))
                {
                    m_dwHitTick         = HUtil32.GetTickCount();
                    m_dwTargetFocusTick = HUtil32.GetTickCount();
                    this.Attack(m_TargetCret, btDir);
                    result = true;
                }
                if (m_TargetCret.m_PEnvir == m_PEnvir)
                {
                    if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11))
                    {
                        SetTargetXY(m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);
                    }
                }
                else
                {
                    DelTargetCreat();
                }
            }
            return(result);
        }
예제 #2
0
 public TSpitSpider()
     : base()
 {
     m_dwSearchTime = Convert.ToUInt32(HUtil32.Random(1500) + 1500);
     m_boAnimal     = true;
     m_boUsePoison  = true;
 }
예제 #3
0
        public override void Run()
        {
            int         nAbs;
            int         nRage = 9999;
            TBaseObject BaseObject;
            TBaseObject TargeTBaseObject = null;

            if (!this.m_boDeath && !this.m_boGhost && (this.m_wStatusTimeArr[Grobal2.POISON_STONE] == 0))
            {
                if ((HUtil32.GetTickCount() - this.m_dwSearchEnemyTick) >= 5000)
                {
                    this.m_dwSearchEnemyTick = HUtil32.GetTickCount();
                    if (this.m_VisibleActors.Count > 0)
                    {
                        for (int I = 0; I < this.m_VisibleActors.Count; I++)
                        {
                            BaseObject = this.m_VisibleActors[I].BaseObject;
                            if (BaseObject.m_boDeath)
                            {
                                continue;
                            }
                            if (this.IsProperTarget(BaseObject))
                            {
                                if (!BaseObject.m_boHideMode || this.m_boCoolEye)
                                {
                                    nAbs = Math.Abs(this.m_nCurrX - BaseObject.m_nCurrX) + Math.Abs(this.m_nCurrY - BaseObject.m_nCurrY);
                                    if (nAbs < nRage)
                                    {
                                        nRage            = nAbs;
                                        TargeTBaseObject = BaseObject;
                                    }
                                }
                            }
                        }
                    }
                    if (TargeTBaseObject != null)
                    {
                        this.SetTargetCreat(TargeTBaseObject);
                    }
                }
                if (((0 - this.m_dwWalkTick) > this.m_nWalkSpeed) && (this.m_TargetCret != null))
                {
                    if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 4) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 4))
                    {
                        if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2))
                        {
                            if (HUtil32.Random(5) == 0)
                            {
                                this.GetBackPosition(ref this.m_nTargetX, ref this.m_nTargetY);
                            }
                        }
                        else
                        {
                            this.GetBackPosition(ref this.m_nTargetX, ref this.m_nTargetY);
                        }
                    }
                }
            }
            base.Run();
        }
예제 #4
0
        public override bool Operate(TProcessMessage ProcessMsg)
        {
            bool result = false;

            try
            {
                result = false;
                if ((ProcessMsg.wIdent == Grobal2.RM_STRUCK) || (ProcessMsg.wIdent == Grobal2.RM_MAGSTRUCK))
                {
                    if (GetObject <TTrainer>(ProcessMsg.BaseObject) == this)
                    {
                        n56C   += ProcessMsg.wParam;
                        m_dw568 = HUtil32.GetTickCount();
                        n570++;
                        this.ProcessSayMsg("破坏力为 " + ProcessMsg.wParam + ",平均值为 " + (n56C / n570).ToString());
                    }
                }
                if (ProcessMsg.wIdent == Grobal2.RM_MAGSTRUCK)
                {
                    result = base.Operate(ProcessMsg);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TTrainer.Operate");
            }
            return(result);
        }
예제 #5
0
        public override void Attack(TBaseObject TargeTBaseObject, int nDir)
        {
            TAbility WAbil  = m_WAbil;
            int      nPower = GetAttackPower(HUtil32.LoWord(WAbil.DC), ((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)));

            HitMagAttackTarget(TargeTBaseObject, nPower / 2, nPower / 2, true);
        }
예제 #6
0
        public override bool AttackTarget()
        {
            bool result = false;
            byte bt06   = 0;

            if (this.GetAttackDir(this.m_TargetCret, ref bt06))
            {
                if ((HUtil32.GetTickCount() - this.m_dwHitTick) > this.m_nNextHitTime)
                {
                    this.m_dwHitTick         = (uint)HUtil32.GetTickCount();
                    this.m_dwTargetFocusTick = (uint)HUtil32.GetTickCount();
                    this.Attack(this.m_TargetCret, bt06);
                    this.m_WAbil.HP = 0;// 死亡
                }
                result = true;
            }
            else
            {
                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);
        }
예제 #7
0
        private void NewSession(string sAccount, string sIPaddr, int nSessionID, int nPayMent, int nPayMode)
        {
            TSessInfo SessInfo;

            SessInfo                = new TSessInfo();
            SessInfo.sAccount       = sAccount;
            SessInfo.sIPaddr        = sIPaddr;
            SessInfo.nSessionID     = nSessionID;
            SessInfo.nPayMent       = nPayMent;
            SessInfo.nPayMode       = nPayMode;
            SessInfo.nSessionStatus = 0;
            SessInfo.dwStartTick    = HUtil32.GetTickCount();
            SessInfo.dwActiveTick   = HUtil32.GetTickCount();
            SessInfo.nRefCount      = 1;

            //m_SessionList.__Lock();
            try
            {
                m_SessionList.Add(SessInfo);
            }
            finally
            {
                // m_SessionList.UnLock();
            }
        }
예제 #8
0
        /// <summary>
        /// btLoadType 0-召唤 1-新建 2-删除 3-查询数据 4-召唤副将英雄 5-新建副将英雄 6-删除副将英雄
        /// </summary>
        /// <param name="sCharName"></param>
        /// <param name="sMsg"></param>
        /// <param name="PlayObject"></param>
        /// <param name="btLoadType"></param>
        public void AddToLoadHeroRcdList(string sCharName, string sMsg, TPlayObject PlayObject, byte btLoadType)
        {
            TLoadDBInfo LoadRcdInfo = new TLoadDBInfo();

            PlayObject.m_boWaitHeroDate  = true;
            LoadRcdInfo.sAccount         = PlayObject.m_sUserID;
            LoadRcdInfo.sCharName        = sCharName;
            LoadRcdInfo.sIPaddr          = PlayObject.m_sIPaddr;
            LoadRcdInfo.boClinetFlag     = PlayObject.m_boClientFlag;
            LoadRcdInfo.nSessionID       = PlayObject.m_nSessionID;
            LoadRcdInfo.nSoftVersionDate = PlayObject.m_nSoftVersionDate;
            LoadRcdInfo.nPayMent         = PlayObject.m_nPayMent;
            LoadRcdInfo.nPayMode         = PlayObject.m_nPayMode;
            LoadRcdInfo.nSocket          = PlayObject.m_nSocket;
            LoadRcdInfo.nGSocketIdx      = PlayObject.m_nGSocketIdx;
            LoadRcdInfo.nGateIdx         = PlayObject.m_nGateIdx;
            LoadRcdInfo.dwNewUserTick    = HUtil32.GetTickCount();
            LoadRcdInfo.PlayObject       = PlayObject;
            LoadRcdInfo.nReLoadCount     = 0;
            LoadRcdInfo.boIsHero         = true;
            LoadRcdInfo.btLoadDBType     = btLoadType;
            LoadRcdInfo.sMsg             = sMsg;
            LoadRcdInfo.btJob            = PlayObject.m_btDeputyHeroJob;
            HUtil32.EnterCriticalSection(m_UserCriticalSection);
            try
            {
                m_LoadRcdList.Add(LoadRcdInfo);
            }
            finally
            {
                HUtil32.LeaveCriticalSection(m_UserCriticalSection);
            }
        }
예제 #9
0
        /// <summary>
        /// 添加到加载角色队列里面
        /// </summary>
        /// <param name="sAccount"></param>
        /// <param name="sChrName"></param>
        /// <param name="sIPaddr"></param>
        /// <param name="boFlag"></param>
        /// <param name="nSessionID"></param>
        /// <param name="nPayMent"></param>
        /// <param name="nPayMode"></param>
        /// <param name="nSoftVersionDate"></param>
        /// <param name="nSocket"></param>
        /// <param name="nGSocketIdx"></param>
        /// <param name="nGateIdx"></param>
        public void AddToLoadRcdList(string sAccount, string sChrName, string sIPaddr, bool boFlag, int nSessionID, int nPayMent, int nPayMode, int nSoftVersionDate, int nSocket, int nGSocketIdx, int nGateIdx)
        {
            TLoadDBInfo LoadRcdInfo = new TLoadDBInfo();

            LoadRcdInfo.sAccount         = sAccount;
            LoadRcdInfo.sCharName        = sChrName;
            LoadRcdInfo.sIPaddr          = sIPaddr;
            LoadRcdInfo.boClinetFlag     = boFlag;
            LoadRcdInfo.nSessionID       = nSessionID;
            LoadRcdInfo.nSoftVersionDate = nSoftVersionDate;
            LoadRcdInfo.nPayMent         = nPayMent;
            LoadRcdInfo.nPayMode         = nPayMode;
            LoadRcdInfo.nSocket          = nSocket;
            LoadRcdInfo.nGSocketIdx      = nGSocketIdx;
            LoadRcdInfo.nGateIdx         = nGateIdx;
            LoadRcdInfo.dwNewUserTick    = HUtil32.GetTickCount();
            LoadRcdInfo.PlayObject       = null;
            LoadRcdInfo.nReLoadCount     = 0;
            LoadRcdInfo.boIsHero         = false;
            HUtil32.EnterCriticalSection(m_UserCriticalSection);
            try
            {
                m_LoadRcdList.Add(LoadRcdInfo);
            }
            finally
            {
                HUtil32.LeaveCriticalSection(m_UserCriticalSection);
            }
        }
예제 #10
0
        /// <summary>
        /// 加载英雄数据
        /// </summary>
        /// <param name="sAccount"></param>
        /// <param name="sCharName"></param>
        /// <param name="sStr"></param>
        /// <param name="nCertCode"></param>
        /// <param name="HumanRcd"></param>
        /// <returns></returns>
        public unsafe static bool LoadHeroRcd(string sAccount, string sCharName, string sStr, int nCertCode, THumDataInfo *HumanRcd)
        {
            bool            result;
            TDefaultMessage DefMsg;
            int             nQueryID     = 0;
            int             nIdent       = 0;
            int             nRecog       = 0;
            string          sHumanRcdStr = string.Empty;
            string          sDBMsg       = string.Empty;
            string          sDBCharName;

            nQueryID = GetQueryID(M2Share.g_Config);
            DefMsg   = EncryptUnit.MakeDefaultMsg(Common.DB_LOADHERORCD, 0, 0, 0, 0, 0);
            TLoadHuman LoadHuman = new TLoadHuman();

            LoadHuman.sAccount   = sAccount;
            LoadHuman.sChrName   = sCharName;
            LoadHuman.sUserAddr  = sStr;
            LoadHuman.nSessionID = nCertCode;
            byte[] data = HUtil32.StructToBytes(LoadHuman);
            sDBMsg = EncryptUnit.EncodeMessage(DefMsg) + EncryptUnit.EncodeBuffer(data, Marshal.SizeOf(LoadHuman));
            SendDBSockMsg(nQueryID, sDBMsg);
            if (GetDBSockMsg(nQueryID, ref nIdent, ref nRecog, ref sHumanRcdStr, M2Share.g_Config.dwGetDBSockMsgTime, true, "LoadHeroRcd(" + sAccount + "/" + sCharName + ")"))
            {
                result = false;
                if (nIdent == Common.DB_LOADHERORCD)
                {
                    if (nRecog == 1)
                    {
                        sHumanRcdStr = HUtil32.GetValidStr3(sHumanRcdStr, ref sDBMsg, new string[] { "/" });
                        sDBCharName  = EncryptUnit.DeCodeString(sDBMsg);
                        if (sDBCharName == sCharName)
                        {
                            if (HUtil32.GetCodeMsgSize(sizeof(THumDataInfo) * 4 / 3) == sHumanRcdStr.Length)
                            {
                                EncryptUnit.DecodeBuffer(sHumanRcdStr, HumanRcd, sizeof(THumDataInfo));
                                result = true;
                            }
                        }
                        else
                        {
                            result = false;
                        }
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
예제 #11
0
        /// <summary>
        /// 发信息给DBServer
        /// </summary>
        /// <param name="nQueryID"></param>
        /// <param name="sMsg"></param>
        public unsafe static void SendDBSockMsg(int nQueryID, string sMsg)
        {
            string sSENDMSG;
            int    nCheckCode;
            string sCheckStr = string.Empty;

            if (!DBSocketConnected())
            {
                return;
            }
            HUtil32.EnterCriticalSection(M2Share.UserDBSection);
            try
            {
                M2Share.g_Config.sDBSocketRecvText = "";
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.UserDBSection);
            }
            nCheckCode = HUtil32.MakeLong(nQueryID ^ 170, sMsg.Length + 6);
            byte[] by = new byte[sizeof(int)];
            fixed(byte *pb = by)
            {
                *(int *)pb = nCheckCode;
            }

            sCheckStr = EncryptUnit.EncodeBuffer(by, by.Length);
            sSENDMSG  = "#" + nQueryID + "/" + sMsg + sCheckStr + "!";
            M2Share.g_Config.boDBSocketWorking = true;
            byte[] data = System.Text.Encoding.Default.GetBytes(sSENDMSG);
            TFrmMain.DBSocket.Send(HUtil32.StrToByte(sSENDMSG));
        }
예제 #12
0
        // 远距离使用冰咆哮 5*5范围
        public override bool AttackTarget()
        {
            bool result = false;

            if (m_TargetCret == null)
            {
                return(result);
            }
            if (HUtil32.GetTickCount() - m_dwHitTick > m_nNextHitTime)
            {
                m_dwHitTick = HUtil32.GetTickCount();
                if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 5) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 5))
                {
                    m_dwTargetFocusTick = HUtil32.GetTickCount();
                    m_btDirection       = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);
                    M2Share.MagicManager.MagBigExplosion(this, GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))),
                                                         m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY, M2Share.g_Config.nSnowWindRange, MagicConst.SKILL_SNOWWIND);
                    SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(m_TargetCret), "");
                    result = true;
                    return(result);
                }
                if (m_TargetCret.m_PEnvir == m_PEnvir)
                {
                    if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11))
                    {
                        SetTargetXY(m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);
                    }
                }
                else
                {
                    DelTargetCreat();
                }
            }
            return(result);
        }
예제 #13
0
        public bool AutoAvoid_GetAvoidXY(ref int nTargetX, ref int nTargetY)
        {
            bool result;
            int  n10;
            int  nDir;
            int  nX;
            int  nY;

            nX     = nTargetX;
            nY     = nTargetY;
            result = AutoAvoid_GetGotoXY(m_btLastDirection, ref nTargetX, ref nTargetY);
            n10    = 0;
            while (true)
            {
                if (n10 >= 10)
                {
                    break;
                }
                if (result)
                {
                    break;
                }
                nTargetX = nX;
                nTargetY = nY;
                nDir     = HUtil32.Random(7);
                result   = AutoAvoid_GetGotoXY(nDir, ref nTargetX, ref nTargetY);
                n10++;
            }
            return(result);
        }
예제 #14
0
 // 月灵间隔
 private void ResetElfMon()
 {
     if (m_Master != null)
     {
         m_nWalkSpeed = HUtil32._MAX(200, nWalkSpeed - m_btSlaveMakeLevel * 50); // 走路速度 由DB设置的走路速度控制
     }
 }
예제 #15
0
 public unsafe bool Add(THumInfo HumRecord)
 {
     try
     {
         HumInfo objHumInfo = new HumInfo();
         objHumInfo.boDeleted   = HumRecord.Header.boDeleted;
         objHumInfo.boIsHero    = HumRecord.Header.boIsHero;
         objHumInfo.bt2         = HumRecord.Header.bt2;
         objHumInfo.dCreateDate = HumRecord.Header.dCreateDate;
         objHumInfo.sName       = HumRecord.Header.sName;
         //objHumInfo.sName = HUtil32.SBytePtrToString(HumRecord.Header.sName, 15);
         objHumInfo.boDeleted1 = HumRecord.boDeleted;
         objHumInfo.boIsHero1  = HumRecord.boIsHero;
         objHumInfo.boSelected = HumRecord.boSelected;
         objHumInfo.btCount    = HumRecord.btCount;
         objHumInfo.dModDate   = HumRecord.dModDate.ToOADate();
         objHumInfo.n6         = HUtil32.BytePtrToByteArray(HumRecord.n6, 6);
         objHumInfo.sAccount   = HumRecord.sAccount;
         //objHumInfo.sAccount = HUtil32.SBytePtrToString(HumRecord.sAccount, 30);
         objHumInfo.sChrName = HumRecord.sChrName;
         //objHumInfo.sChrName = HUtil32.SBytePtrToString(HumRecord.sChrName, 14);
         objHumInfo.nSelectID = HumRecord.Header.nSelectID;
         HumInfoSet.AddObject(objHumInfo);
         objMir2Entities.SaveChanges();
     }
     catch (Exception ex)
     {
         DBShare.MainOutMessage(ex.Message);
         return(false);
     }
     return(true);
 }
예제 #16
0
        /// <summary>
        /// 检查是否存在列表里,如不存在,则增加,存在则退出
        /// </summary>
        /// <param name="sAccount"></param>
        /// <param name="sChrName"></param>
        /// <returns></returns>
        public bool InSaveRcdList(string sAccount, string sChrName)
        {
            bool     result = false;
            TSaveRcd SaveRcd;

            HUtil32.EnterCriticalSection(m_UserCriticalSection);
            try
            {
                if (m_SaveRcdList.Count > 0)
                {
                    for (int I = 0; I < m_SaveRcdList.Count; I++)
                    {
                        SaveRcd = m_SaveRcdList[I];
                        if (string.Compare(SaveRcd.sAccount, sAccount, true) == 0 && string.Compare(SaveRcd.sChrName, sChrName, true) == 0)
                        {
                            result = true;
                            break;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(m_UserCriticalSection);
            }
            return(result);
        }
예제 #17
0
        public void ChangeItemName(string[] @params, TPlayObject PlayObject)
        {
            int    nMakeIndex;
            int    nItemIndex;
            string sMakeIndex = @params.Length > 0 ? @params[0] : "";
            string sItemIndex = @params.Length > 1 ? @params[1] : "";
            string sItemName  = @params.Length > 2 ? @params[2] : "";

            if ((PlayObject.m_btPermission < 6))
            {
                return;
            }
            if ((sMakeIndex == "") || (sItemIndex == "") || (sItemName == ""))
            {
                PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " 物品编号 物品ID号 物品名称", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nMakeIndex = HUtil32.Str_ToInt(sMakeIndex, -1);
            nItemIndex = HUtil32.Str_ToInt(sItemIndex, -1);
            if ((nMakeIndex <= 0) || (nItemIndex < 0))
            {
                PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " 物品编号 物品ID号 物品名称", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (ItemUnit.AddCustomItemName(nMakeIndex, nItemIndex, sItemName))
            {
                ItemUnit.SaveCustomItemName();
                PlayObject.SysMsg("物品名称设置成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                return;
            }
            PlayObject.SysMsg("此物品,已经设置了其它的名称!!!", TMsgColor.c_Red, TMsgType.t_Hint);
        }
예제 #18
0
        public TSaveRcd GetSaveRcd(string sAccount, string sCharName)
        {
            TSaveRcd result = null;
            TSaveRcd SaveRcd;

            HUtil32.EnterCriticalSection(m_UserCriticalSection);
            try
            {
                if (m_SaveRcdList.Count > 0)
                {
                    for (int I = 0; I < m_SaveRcdList.Count; I++)
                    {
                        SaveRcd = m_SaveRcdList[I];
                        if (SaveRcd.sAccount == sAccount && SaveRcd.sChrName == sCharName)
                        {
                            result = SaveRcd;
                            break;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(m_UserCriticalSection);
            }
            return(result);
        }
예제 #19
0
 public override void Run()
 {
     try
     {
         if (!this.m_boGhost && !this.m_boDeath && (this.m_wStatusTimeArr[Grobal2.POISON_STONE] == 0))
         {
             if ((HUtil32.GetTickCount() - this.m_dwWalkTick) > this.m_nWalkSpeed)
             {
                 this.m_dwWalkTick = HUtil32.GetTickCount();
                 if (m_boLight)// 发亮
                 {
                     if ((HUtil32.GetTickCount() - this.m_dwSearchEnemyTick) > m_dwLightTime)
                     {
                         this.m_dwSearchEnemyTick = HUtil32.GetTickCount();
                         m_dwLightTime            = 2500;// 发光时长
                         m_boLight = false;
                     }
                 }
                 if (m_boAttick && !m_boLight && (s_AttickXY != ""))
                 {
                     if (AttackTarget())     // 可以攻击
                     {
                         m_boAttick = false; // 处理攻击代码
                     }
                 }
             }
         }
         base.Run();
     }
     catch
     {
         M2Share.MainOutMessage("{异常} TFireDragonGuard.Run");
     }
 }
예제 #20
0
        /// <summary>
        /// 更新角色是否存在列表里
        /// </summary>
        /// <param name="SaveRcd"></param>
        /// <returns></returns>
        public bool UpDataSaveRcdList(TSaveRcd SaveRcd)
        {
            bool     result = false;
            TSaveRcd HumanRcd;

            HUtil32.EnterCriticalSection(m_UserCriticalSection);
            try
            {
                for (int I = m_SaveRcdList.Count - 1; I >= 0; I--)
                {
                    if (m_SaveRcdList.Count <= 0)
                    {
                        break;
                    }
                    HumanRcd = m_SaveRcdList[I];
                    if (HumanRcd != null)
                    {
                        if (HumanRcd.sAccount == SaveRcd.sAccount && HumanRcd.sChrName == SaveRcd.sChrName)
                        {
                            HumanRcd.HumanRcd = SaveRcd.HumanRcd;
                            result            = true;
                            return(result);
                        }
                    }
                }
                m_SaveRcdList.Add(SaveRcd);
            }
            finally
            {
                HUtil32.LeaveCriticalSection(m_UserCriticalSection);
            }
            return(result);
        }
예제 #21
0
        public void SpirtStart(string[] @Params, TPlayObject PlayObject)
        {
            string sParam1 = @Params.Length > 0 ? @Params[0] : "";

            if ((PlayObject.m_btPermission < 6))
            {
                return;
            }
            if ((sParam1 != "") && (sParam1[0] == '?'))
            {
                PlayObject.SysMsg("此命令用于开始祈祷生效宝宝叛变。", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            int  nTime  = HUtil32.Str_ToInt(sParam1, -1);
            uint dwTime = 0;

            if (nTime > 0)
            {
                dwTime = (uint)nTime * 1000;
            }
            else
            {
                dwTime = M2Share.g_Config.dwSpiritMutinyTime;
            }
            M2Share.g_dwSpiritMutinyTick = HUtil32.GetTickCount() + dwTime;
            PlayObject.SysMsg("祈祷叛变已开始。持续时长 " + dwTime / 1000 + " 秒。", TMsgColor.c_Green, TMsgType.t_Hint);
        }
예제 #22
0
        public void DeleteHuman(int nGateIndex, int nSocket)
        {
            TLoadDBInfo LoadRcdInfo = null;

            HUtil32.EnterCriticalSection(m_UserCriticalSection);
            try
            {
                for (int I = m_LoadRcdList.Count - 1; I >= 0; I--)
                {
                    if (m_LoadRcdList.Count <= 0)
                    {
                        break;
                    }
                    LoadRcdInfo = m_LoadRcdList[I];
                    if ((LoadRcdInfo.nGateIdx == nGateIndex) && (LoadRcdInfo.nSocket == nSocket))
                    {
                        m_LoadRcdList.RemoveAt(I);
                        Dispose(LoadRcdInfo);
                        break;
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(m_UserCriticalSection);
            }
        }
예제 #23
0
        private void RefListViewSession()
        {
            int                I;
            TBaseObject        Monster;
            ListViewItem       ListItem;
            List <TBaseObject> MonList;

            this.Text        = "正在取得数据...";
            PanelStatus.Text = "正在取得数据...";
            ListView.Visible = false;
            ListView.Items.Clear();
            if (ConfigMonGen.SelEnvirnoment != null)
            {
                MonList = new List <TBaseObject>();
                M2Share.UserEngine.GetMapMonster(ConfigMonGen.SelEnvirnoment, MonList);
                for (I = 0; I < MonList.Count; I++)
                {
                    Monster       = ((TBaseObject)(MonList[I]));
                    ListItem      = new ListViewItem();
                    ListItem.Text = (I + 1).ToString();
                    ListItem.SubItems.Add(Monster.m_sCharName);
                    ListItem.SubItems.Add((Monster.m_nCurrX).ToString() + ':' + (Monster.m_nCurrY).ToString());
                    ListItem.SubItems.Add((Monster.m_Abil.Level).ToString());
                    ListItem.SubItems.Add((Monster.m_Abil.HP).ToString() + '/' + (Monster.m_Abil.MaxHP).ToString());
                    ListItem.SubItems.Add((Monster.m_Abil.MP).ToString() + '/' + (Monster.m_Abil.MaxMP).ToString());
                    ListItem.SubItems.Add(HUtil32.BooleanToStr(Monster.m_boDeath));
                    ListView.Items.Add(ListItem);
                }
                this.Text = ConfigMonGen.SelEnvirnoment.sMapDesc + ' ' + "怪物数:" + (ListView.Items.Count).ToString();
            }
            ListView.Visible = true;
        }
예제 #24
0
        public void ReNewLevel(string[] @Params, TPlayObject PlayObject)
        {
            string sHumanName = @Params.Length > 0 ? @Params[0] : "";
            string sLevel     = @Params.Length > 1 ? @Params[1] : "";

            if ((PlayObject.m_btPermission < 6))
            {
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " 人物名称 点数(为空则查看)", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            int         nLevel       = HUtil32.Str_ToInt(sLevel, -1);
            TPlayObject m_PlayObject = UserEngine.GetPlayObject(sHumanName);

            if (m_PlayObject != null)
            {
                if ((nLevel >= 0) && (nLevel <= 255))
                {
                    m_PlayObject.m_btReLevel = (byte)nLevel;
                    m_PlayObject.RefShowName();
                }
                PlayObject.SysMsg(sHumanName + " 的转生等级为 " + PlayObject.m_btReLevel, TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                PlayObject.SysMsg(sHumanName + " 没在线上!!!", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }
예제 #25
0
        public override bool AttackTarget()
        {
            bool result = false;
            byte btDir  = 0;

            if (m_TargetCret == null)
            {
                return(result);
            }
            if (TargetInSpitRange(m_TargetCret, ref btDir))
            {
                if ((HUtil32.GetTickCount() - m_dwHitTick) > m_nNextHitTime)
                {
                    m_dwHitTick         = HUtil32.GetTickCount();
                    m_dwTargetFocusTick = HUtil32.GetTickCount();
                    SpitAttack(btDir);
                    BreakHolySeizeMode();
                }
                result = true;
                return(result);
            }
            if (m_TargetCret.m_PEnvir == m_PEnvir)
            {
                if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11))
                {
                    SetTargetXY(m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);
                }
            }
            else
            {
                DelTargetCreat();
            }
            return(result);
        }
예제 #26
0
        /// <summary>
        /// 攻击怪物会执行此方法
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <returns></returns>
        public override bool Operate(TProcessMessage ProcessMsg)
        {
            bool result = false;
            byte nCode  = 0;

            try
            {
                if (ProcessMsg.wIdent == Grobal2.RM_STRUCK) // 打击
                {
                    nCode = 1;
                    TBaseObject BaseObject = HUtil32.IntToObject <TBaseObject>(ProcessMsg.nParam3);
                    if ((HUtil32.IntToObject <TBaseObject>(ProcessMsg.BaseObject) == this) &&
                        (BaseObject != null))
                    {
                        nCode = 2;
                        this.SetLastHiter(BaseObject);
                        nCode = 3;
                        this.Struck(BaseObject);
                        nCode = 4;
                        this.BreakHolySeizeMode();
                        nCode = 10;
                        if ((this.m_Master != null) && (!BaseObject.m_boDeath))
                        {
                            nCode = 9;
                            if (((BaseObject != this.m_Master) && (((BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT) || ((BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT))))))
                            {
                                nCode = 6;
                                if (this.m_Master.m_Master != null)
                                {
                                    nCode = 7;
                                    if (this.m_Master.m_Master != BaseObject)
                                    {
                                        this.m_Master.SetPKFlag(BaseObject);
                                    }
                                }
                                else
                                {
                                    this.m_Master.SetPKFlag(BaseObject);
                                }
                            }
                        }
                        nCode = 8;
                        if (GameConfig.boMonSayMsg)
                        {
                            this.MonsterSayMsg(BaseObject, TMonStatus.s_UnderFire);
                        }
                    }
                    result = true;
                }
                else
                {
                    result = base.Operate(ProcessMsg);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TAnimalObject.Operate Code:" + nCode);
            }
            return(result);
        }
예제 #27
0
        private void LightingAttack(int nDir)
        {
            TAbility WAbil;
            int      nPower;
            int      nDamage;
            int      btGetBackHP;

            if (m_TargetCret != null)
            {
                m_btDirection = (byte)nDir;
                WAbil         = m_WAbil;
                nPower        = GetAttackPower(HUtil32.LoWord(WAbil.MC), ((short)HUtil32.HiWord(WAbil.MC) - HUtil32.LoWord(WAbil.MC)));
                nDamage       = m_TargetCret.GetMagStruckDamage(this, nPower);
                if (nDamage > 0)
                {
                    btGetBackHP = (byte)m_WAbil.MP;
                    if (btGetBackHP != 0)
                    {
                        m_WAbil.HP += nDamage / btGetBackHP;
                    }
                    m_TargetCret.StruckDamage(nDamage);
                    m_TargetCret.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, m_TargetCret.m_WAbil.HP, m_TargetCret.m_WAbil.MaxHP, Parse(this), "", 200);
                }
                SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(m_TargetCret), "");
            }
        }
예제 #28
0
        /// <summary>
        /// 被击中
        /// </summary>
        /// <param name="hiter"></param>
        public virtual void Struck(TBaseObject hiter)
        {
            byte btDir = 0;

            this.m_dwStruckTick = HUtil32.GetTickCount();
            if (hiter != null)
            {
                if ((this.m_TargetCret == null) || this.GetAttackDir(this.m_TargetCret, ref btDir) || (HUtil32.Random(6) == 0))
                {
                    if (this.IsProperTarget(hiter))
                    {
                        this.SetTargetCreat(hiter);
                    }
                }
            }
            if (this.m_boAnimal) // 是动物
            {
                this.m_nMeatQuality = this.m_nMeatQuality - HUtil32.Random(300);
                if (this.m_nMeatQuality < 0)
                {
                    this.m_nMeatQuality = 0;
                }
            }
            this.m_dwHitTick = Convert.ToUInt32(this.m_dwHitTick + (150 - HUtil32._MIN(130, this.m_Abil.Level * 4)));
        }
예제 #29
0
        public unsafe void TrainingSkill(string[] @Params, TPlayObject PlayObject)
        {
            string      sHumanName = @Params.Length > 0 ? @Params[0] : "";
            string      sSkillName = @Params.Length > 1 ? @Params[1] : "";
            int         nLevel     = @Params.Length > 2 ? int.Parse(@Params[2]) : 0;
            TUserMagic *UserMagic;

            if ((sHumanName == "") || (sSkillName == "") || (nLevel <= 0))
            {
                PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " 人物名称  技能名称 修炼等级(0-3)", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nLevel = HUtil32._MIN(3, nLevel);
            TPlayObject m_PlayObject = UserEngine.GetPlayObject(sHumanName);

            if (m_PlayObject == null)
            {
                PlayObject.SysMsg(String.Format("{0}不在线,或在其它服务器上!!", sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            for (int I = 0; I < m_PlayObject.m_MagicList.Count; I++)
            {
                UserMagic = (TUserMagic *)m_PlayObject.m_MagicList[I];
                if ((HUtil32.SBytePtrToString(UserMagic->MagicInfo.sDescr, 0, UserMagic->MagicInfo.DescrLen)).ToLower().CompareTo((sSkillName).ToLower()) == 0)
                {
                    UserMagic->btLevel = (byte)nLevel;
                    m_PlayObject.SendMsg(m_PlayObject, Grobal2.RM_MAGIC_LVEXP, 0, UserMagic->MagicInfo.wMagicId, UserMagic->btLevel, UserMagic->nTranPoint, "");
                    m_PlayObject.SysMsg(String.Format("{0}的修改炼等级为{1}", sSkillName, nLevel), TMsgColor.c_Green, TMsgType.t_Hint);
                    PlayObject.SysMsg(String.Format("{0}的技能{1}修炼等级为{2}", sHumanName, sSkillName, nLevel), TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
                }
            }
        }
예제 #30
0
        public override void Run()
        {
            int nPower;

            try
            {
                if (!m_boDeath && !m_boGhost && (m_wStatusTimeArr[Grobal2.POISON_STONE] == 0))
                {
                    if ((m_TargetCret != null) && (HUtil32.GetTickCount() - m_dwHitTick > m_nNextHitTime) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 2))
                    {
                        m_dwHitTick = HUtil32.GetTickCount();
                        if ((HUtil32.Random(4) == 0))// 癫狂状态
                        {
                            if ((M2Share.g_EventManager.GetEvent(m_PEnvir, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY, Grobal2.ET_FIRE) == null))
                            {
                                MagMakeFireCross(this, GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))), 4, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY);// 火墙
                            }
                            else if ((HUtil32.Random(4) == 0))
                            {
                                if (IsProperTarget(m_TargetCret))
                                {
                                    if (HUtil32.Random(m_TargetCret.m_btAntiPoison + 7) <= 6)                                                                  // 施毒
                                    {
                                        nPower = GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))); // 中毒类型 - 绿毒
                                        m_TargetCret.SendDelayMsg(this, Grobal2.RM_POISON, Grobal2.POISON_DECHEALTH, nPower, Parse(this), 4, "", 150);
                                    }
                                }
                            }
                            else
                            {
                                AttackTarget();// 物理攻击
                            }
                        }
                        else
                        {
                            if (HUtil32.Random(4) == 0)
                            {
                                if (IsProperTarget(m_TargetCret))
                                {
                                    if (HUtil32.Random(m_TargetCret.m_btAntiPoison + 7) <= 6)                                                                  // 施毒
                                    {
                                        nPower = GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))); // 中毒类型 - 绿毒
                                        m_TargetCret.SendDelayMsg(this, Grobal2.RM_POISON, Grobal2.POISON_DECHEALTH, nPower, Parse(this), 4, "", 150);
                                    }
                                }
                            }
                            else if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 2))
                            {
                                AttackTarget();// 物理攻击
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TSalamanderATMonster.Run");
            }
            base.Run();
        }