Пример #1
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="sMsg"></param>
        private void SendSocket(string sMsg)
        {
            int    n10 = HUtil32.MakeLong(HUtil32.Str_ToInt(m_sQueryID, 0) ^ 170, sMsg.Length + 6);
            string s18 = EncryptUnit.EncodeBuffer(BitConverter.GetBytes(n10), 4);

            Socket.Socket.Send(System.Text.Encoding.Default.GetBytes('#' + m_sQueryID + '/' + sMsg + s18 + '!'));
        }
Пример #2
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));
        }
Пример #3
0
        public unsafe static byte[] SendDBSockMsg(int nQueryID, string sMsg)
        {
            string sSENDMSG;
            int    nCheckCode;
            string sCheckStr = string.Empty;

            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 + "!";

            byte[] data = System.Text.Encoding.Default.GetBytes(sSENDMSG);
            return(HUtil32.StrToByte(sSENDMSG));
        }
Пример #4
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);
        }
Пример #5
0
        // 刷新属性
        public override bool AttackTarget()
        {
            bool        result;
            TAbility    WAbil;
            int         nPower;
            int         K;
            int         J;
            TBaseObject BaseObject;

            result = false;
            try
            {
                if (!sub_4A5B0C(this.m_nViewRange))  // 守护兽15格开始发亮,没有目标则退出
                {
                    return(result);
                }
                if ((HUtil32.GetTickCount() - m_dwLightTick > 10000))
                {
                    // 通知守护兽发光
                    m_dwLightTick = HUtil32.GetTickCount();
                    if (UserEngine.m_MonObjectList.Count > 0) // 循环列表,找出同个地图的守护兽,
                    {
                        K = HUtil32.Random(6);                // 随机一个守护兽攻击
                        J = 0;
                        for (int I = 0; I < UserEngine.m_MonObjectList.Count; I++)
                        {
                            BaseObject = ((TBaseObject)(UserEngine.m_MonObjectList[I]));
                            if (BaseObject != null)
                            {
                                if (BaseObject.m_PEnvir == this.m_PEnvir)
                                {
                                    // 同个地图内
                                    if (((BaseObject) as TFireDragonGuard).m_boLight || ((BaseObject) as TFireDragonGuard).m_boAttick)
                                    {
                                        break;  // 上次没有处理完就退出循环
                                    }
                                    if (J == K) // 最后熄灭的怪,即攻击怪
                                    {
                                        ((BaseObject) as TFireDragonGuard).m_boAttick    = true;
                                        ((BaseObject) as TFireDragonGuard).m_dwLightTime = 3000;                                               // 发光时长比其它怪多
                                        BaseObject.SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, ""); // 发送最后熄灭的特殊消息(发亮)
                                    }
                                    else
                                    {
                                        // 发送同时熄灭的消息(发亮)
                                        BaseObject.SendRefMsg(Grobal2.RM_LIGHTING, 1, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, "");
                                    }
                                    ((BaseObject) as TFireDragonGuard).m_boLight           = true;
                                    ((BaseObject) as TFireDragonGuard).m_dwSearchEnemyTick = HUtil32.GetTickCount();
                                    J++;
                                    if (J >= 6)
                                    {
                                        break;// 6个怪就退出循环
                                    }
                                }
                            }
                        }
                    }
                }
                if (!sub_4A5B0C(this.m_nViewRange - 2))
                {
                    return(result);// 火龙魔兽11格,没有目标则退出
                }
                if (((int)HUtil32.GetTickCount() - this.m_dwHitTick) > this.m_nNextHitTime)
                {
                    this.m_dwHitTick = HUtil32.GetTickCount();
                    if (HUtil32.Random(3) == 0)
                    {
                        // 群雷攻击
                        this.SendAttackMsg(Grobal2.RM_HIT, this.m_btDirection, this.m_nCurrX, this.m_nCurrY);
                        WAbil  = this.m_WAbil;
                        nPower = (HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1) + HUtil32.LoWord(WAbil.DC));
                        if (this.m_VisibleActors.Count > 0)
                        {
                            for (int I = 0; I < this.m_VisibleActors.Count; I++)
                            {
                                BaseObject = this.m_VisibleActors[I].BaseObject;
                                if (BaseObject == null)
                                {
                                    continue;
                                }
                                if (BaseObject.m_boDeath)
                                {
                                    continue;
                                }
                                if (this.IsProperTarget(BaseObject))
                                {
                                    if ((Math.Abs(this.m_nCurrX - BaseObject.m_nCurrX) < this.m_nViewRange) && (Math.Abs(this.m_nCurrY - BaseObject.m_nCurrY) < this.m_nViewRange))
                                    {
                                        this.m_dwTargetFocusTick = HUtil32.GetTickCount();
                                        this.SendDelayMsg(this, Grobal2.RM_DELAYMAGIC, nPower, HUtil32.MakeLong(BaseObject.m_nCurrX, BaseObject.m_nCurrY), 2, 0, "", 600);
                                        if (HUtil32.Random(4) == 0)
                                        {
                                            this.m_TargetCret = BaseObject;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        // 大火圈攻击
                        if (this.m_TargetCret != null)
                        {
                            WAbil  = this.m_WAbil;
                            nPower = (HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1) + HUtil32.LoWord(WAbil.DC));
                            MagBigExplosion(nPower, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY, 3);
                            this.SendRefMsg(Grobal2.RM_LIGHTING, 1, this.m_nCurrX, this.m_nCurrY, 0, "");
                        }
                    }
                }
                result = true;
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TFireDragon.AttackTarget");
            }
            return(result);
        }
Пример #6
0
        /// <summary>
        /// 获取DBSERBER发送过来的消息
        /// </summary>
        /// <param name="nQueryID"></param>
        /// <param name="nIdent"></param>
        /// <param name="nRecog"></param>
        /// <param name="sStr"></param>
        /// <param name="dwTimeOut"></param>
        /// <param name="boLoadRcd"></param>
        /// <param name="sName"></param>
        /// <returns></returns>
        public unsafe static bool GetDBSockMsg(int nQueryID, ref int nIdent, ref int nRecog, ref string sStr, uint dwTimeOut, bool boLoadRcd, string sName)
        {
            bool            result;
            bool            boLoadDBOK;
            uint            dwTimeOutTick;
            string          s24        = string.Empty;
            string          s28        = string.Empty;
            string          s2C        = string.Empty;
            string          sCheckFlag = string.Empty;
            string          sDefMsg;
            string          s38;
            int             nLen;
            int             nCheckCode;
            TDefaultMessage DefMsg;
            byte            nCode;
            const string    sLoadDBTimeOut = "[RunDB] 读取人物数据超时...";
            const string    sSaveDBTimeOut = "[RunDB] 保存人物数据超时...";

            boLoadDBOK    = false;
            result        = false;
            dwTimeOutTick = HUtil32.GetTickCount();
            nCode         = 0;
            while (true)
            {
                if ((HUtil32.GetTickCount() - dwTimeOutTick) > dwTimeOut)//dwTimeOut--等待消息的时间
                {
                    nCode = 1;
                    break;
                }
                s24 = "";
                HUtil32.EnterCriticalSection(M2Share.UserDBSection);
                try
                {
                    if (M2Share.g_Config.sDBSocketRecvText.IndexOf("!") > 0)
                    {
                        s24 = M2Share.g_Config.sDBSocketRecvText;
                        M2Share.g_Config.sDBSocketRecvText = "";
                    }
                }
                finally
                {
                    HUtil32.LeaveCriticalSection(M2Share.UserDBSection);
                }
                if (s24 != "")
                {
                    s28 = "";
                    s24 = HUtil32.ArrestStringEx(s24, "#", "!", ref s28);
                    if (s28 != "")
                    {
                        s28  = HUtil32.GetValidStr3(s28, ref s2C, new string[] { "/" });
                        nLen = s28.Length;
                        if ((nLen >= sizeof(TDefaultMessage)) && (HUtil32.Str_ToInt(s2C, 0) == nQueryID))
                        {
                            nCheckCode = HUtil32.MakeLong(HUtil32.Str_ToInt(s2C, 0) ^ 170, nLen);
                            byte[] data = new byte[sizeof(int)];
                            fixed(byte *by = data)
                            {
                                *(int *)by = nCheckCode;
                            }

                            sCheckFlag = EncryptUnit.EncodeBuffer(data, data.Length);
                            if (HUtil32.CompareBackLStr(s28, sCheckFlag, sCheckFlag.Length))
                            {
                                if (nLen == Grobal2.DEFBLOCKSIZE)
                                {
                                    sDefMsg = s28;
                                    s38     = "";
                                }
                                else
                                {
                                    sDefMsg = s28.Substring(0, Grobal2.DEFBLOCKSIZE);
                                    s38     = s28.Substring(Grobal2.DEFBLOCKSIZE + 1 - 1, s28.Length - Grobal2.DEFBLOCKSIZE - 6);
                                }
                                DefMsg     = EncryptUnit.DecodeMessage(sDefMsg);
                                nIdent     = DefMsg.Ident;
                                nRecog     = DefMsg.Recog;
                                sStr       = s38;
                                boLoadDBOK = true;
                                result     = true;
                                break;
                            }
                        }
                        else
                        {
                            if ((nLen < Marshal.SizeOf(typeof(TDefaultMessage))))
                            {
                                nCode = 2;
                            }
                            if ((HUtil32.Str_ToInt(s2C, 0) != nQueryID))
                            {
                                nCode = 4;
                            }
                            M2Share.g_Config.nLoadDBErrorCount++;
                            break;
                        }
                    }
                    else
                    {
                        nCode = 3;
                        M2Share.g_Config.nLoadDBErrorCount++;
                        break;
                    }
                }
                else
                {
                    System.Threading.Thread.Sleep(1);
                }
            }
            if (!boLoadDBOK)
            {
                M2Share.g_nSaveRcdErrorCount++;
                if (boLoadRcd)
                {
                    M2Share.MainOutMessage(sLoadDBTimeOut + sName + " Code:" + nCode);
                }
                else
                {
                    M2Share.MainOutMessage(sSaveDBTimeOut + sName + " Code:" + nCode);
                }
            }
            else
            {
                M2Share.g_nSaveRcdErrorCount = 0;
            }
            M2Share.g_Config.boDBSocketWorking = false;
            return(result);
        }
Пример #7
0
        public unsafe static bool GetDBSockMsg(byte[] da, int nQueryID, ref int nIdent, ref int nRecog, ref string sStr, uint dwTimeOut, bool boLoadRcd, string sName)
        {
            bool            result;
            bool            boLoadDBOK;
            string          s24        = string.Empty;
            string          s28        = string.Empty;
            string          s2C        = string.Empty;
            string          sCheckFlag = string.Empty;
            string          sDefMsg;
            string          s38;
            int             nLen;
            int             nCheckCode;
            TDefaultMessage DefMsg;

            boLoadDBOK = false;
            result     = false;
            byte      nCode        = 0;
            const int DEFBLOCKSIZE = 32;

            while (true)
            {
                s24 = "";

                try
                {
                    fixed(byte *pb = da)
                    {
                        s24 = HUtil32.SBytePtrToString((sbyte *)pb, 0, da.Length);
                    }

                    s24 = System.Text.Encoding.Default.GetString(da);
                }
                finally
                {
                }
                if (s24 != "")
                {
                    s28 = "";
                    s24 = HUtil32.ArrestStringEx(s24, "#", "!", ref s28);
                    if (s28 != "")
                    {
                        s28  = HUtil32.GetValidStr3(s28, ref s2C, new string[] { "/" });
                        nLen = s28.Length;
                        if ((nLen >= sizeof(TDefaultMessage)) && (HUtil32.Str_ToInt(s2C, 0) == nQueryID))
                        {
                            nCheckCode = HUtil32.MakeLong(HUtil32.Str_ToInt(s2C, 0) ^ 170, nLen);
                            byte[] data = new byte[sizeof(int)];
                            fixed(byte *by = data)
                            {
                                *(int *)by = nCheckCode;
                            }

                            sCheckFlag = EncryptUnit.EncodeBuffer(data, data.Length);
                            if (HUtil32.CompareBackLStr(s28, sCheckFlag, sCheckFlag.Length))
                            {
                                if (nLen == DEFBLOCKSIZE)
                                {
                                    sDefMsg = s28;
                                    s38     = "";
                                }
                                else
                                {
                                    sDefMsg = s28.Substring(0, DEFBLOCKSIZE);
                                    s38     = s28.Substring(DEFBLOCKSIZE + 1 - 1, s28.Length - DEFBLOCKSIZE - 6);
                                }
                                DefMsg     = EncryptUnit.DecodeMessage(sDefMsg);
                                nIdent     = DefMsg.Ident;
                                nRecog     = DefMsg.Recog;
                                sStr       = s38;
                                boLoadDBOK = true;
                                result     = true;
                                break;
                            }
                        }
                        else
                        {
                            if ((nLen < Marshal.SizeOf(typeof(TDefaultMessage))))
                            {
                                nCode = 2;
                            }
                            if ((HUtil32.Str_ToInt(s2C, 0) != nQueryID))
                            {
                                nCode = 4;
                            }
                            break;
                        }
                    }
                    else
                    {
                        nCode = 3;
                        break;
                    }
                }
                else
                {
                    System.Threading.Thread.Sleep(1);
                }
            }
            if (!boLoadDBOK)
            {
                if (boLoadRcd)
                {
                    //M2Share.MainOutMessage(sLoadDBTimeOut + sName + " Code:" + (nCode).ToString());
                }
                else
                {
                    //M2Share.MainOutMessage(sSaveDBTimeOut + sName + " Code:" + (nCode).ToString());
                }
            }
            else
            {
            }
            return(result);
        }
Пример #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);
        }
Пример #9
0
        public void Execute()
        {
            int     I;
            uint    dwTick2C;
            string  s18 = string.Empty;
            string  s1C = string.Empty;
            string  s24 = string.Empty;
            string  s28 = string.Empty;
            int     nC;
            int     n10;
            int     n14;
            TConfig Config;

            Config   = LSShare.g_Config;
            dwTick2C = 0;
            while (true)
            {
                if ((HUtil32.GetTickCount() - dwTick2C) > 5 * 60 * 1000)
                {
                    dwTick2C = HUtil32.GetTickCount();
                    try
                    {
                        if (File.Exists(Config.sFeedIDList))
                        {
                            AccountLoadList.Clear();
                            AccountLoadList.LoadFromFile(Config.sFeedIDList);
                            if (AccountLoadList.Count > 0)
                            {
                                AccountCostList.Clear();
                                for (I = 0; I < AccountLoadList.Count; I++)
                                {
                                    s18 = AccountLoadList[I].Trim();
                                    s18 = HUtil32.GetValidStr3(s18, ref s1C, new string[] { " ", "\t" });
                                    s18 = HUtil32.GetValidStr3(s18, ref s24, new string[] { " ", "\t" });
                                    s18 = HUtil32.GetValidStr3(s18, ref s28, new string[] { " ", "\t" });
                                    n10 = HUtil32.Str_ToInt(s24, 0);
                                    n14 = HUtil32.Str_ToInt(s28, 0);
                                    nC  = HUtil32.MakeLong(HUtil32._MAX(n14, 0), HUtil32._MAX(n10, 0));
                                    AccountCostList.Add(s1C, nC);
                                    if (!bo40)
                                    {
                                        if ((I % 100) == 0)
                                        {
                                            Thread.Sleep(1);
                                        }
                                    }
                                }
                            }

                            //LoadAccountCostList(Config, AccountCostList);
                        }
                    }
                    catch
                    {
                        LSShare.MainOutMessage("Exception] loading on IDStrList.");
                    }
                    try
                    {
                        if (File.Exists(Config.sFeedIPList))
                        {
                            IPaddrLoadList.Clear();
                            IPaddrLoadList.LoadFromFile(Config.sFeedIPList);
                            if (IPaddrLoadList.Count > 0)
                            {
                                IPaddrCostList.Clear();
                                for (I = 0; I < IPaddrLoadList.Count; I++)
                                {
                                    s18 = IPaddrLoadList[I].Trim();
                                    s18 = HUtil32.GetValidStr3(s18, ref s1C, new string[] { " ", "\t" });
                                    s18 = HUtil32.GetValidStr3(s18, ref s24, new string[] { " ", "\t" });
                                    s18 = HUtil32.GetValidStr3(s18, ref s28, new string[] { " ", "\t" });
                                    n10 = HUtil32.Str_ToInt(s24, 0);
                                    n14 = HUtil32.Str_ToInt(s28, 0);

                                    //@ Unsupported function or procedure: 'MakeLong'
                                    nC = HUtil32.MakeLong(HUtil32._MAX(n14, 0), HUtil32._MAX(n10, 0));
                                    IPaddrCostList.Add(s1C, nC);
                                    if (!bo40)
                                    {
                                        if ((I % 100) == 0)
                                        {
                                            Thread.Sleep(1);
                                        }
                                    }
                                }
                            }

                            //LoadIPaddrCostList(Config, IPaddrCostList);
                        }
                    }
                    catch
                    {
                        LSShare.MainOutMessage("Exception] loading on IPStrList.");
                    }
                }
                Thread.Sleep(10);

                //@ Unsupported property or method(C): 'Terminated'
                //if (this.Terminated)
                //{
                //    break;
                //}
            }
        }
Пример #10
0
        public static void MakeFireball(TBaseObject PlayObject, TMagicMessage MagicMsg, ref TBaseObject TargeTBaseObject, ref bool Result)
        {
            TUserMagic *UserMagic = MagicMsg.UserMagic;
            int         nTargetY  = MagicMsg.nTargetY;

            Result = false;
            int nPower = 0;
            int NGSecPwr;

            if (PlayObject.MagCanHitTarget(PlayObject.m_nCurrX, PlayObject.m_nCurrY, TargeTBaseObject) || M2Share.g_Config.boAutoCanHit)
            {
                if (PlayObject.IsProperTarget(TargeTBaseObject))
                {
                    if ((TargeTBaseObject.m_nAntiMagic <= HUtil32.Random(10)) && (Math.Abs(TargeTBaseObject.m_nCurrX - MagicMsg.nTargetX) <= 1) && (Math.Abs(TargeTBaseObject.m_nCurrY - nTargetY) <= 1))
                    {
                        nPower = PlayObject.GetAttackPower(MagMakeFireball_GetPower(UserMagic, MagMakeFireball_MPow(UserMagic))
                                                           + HUtil32.LoWord(PlayObject.m_WAbil.MC), ((short)HUtil32.HiWord(PlayObject.m_WAbil.MC) - HUtil32.LoWord(PlayObject.m_WAbil.MC)) + 1);
                        switch (UserMagic->MagicInfo.wMagicId)
                        {
                        case MagicConst.SKILL_FIREBALL:
                            if ((PlayObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                            {
                                if (((TPlayObject)(PlayObject)).m_MagicSkill_208 != null)
                                {
                                    NGSecPwr = GetNGPow(PlayObject, ((TPlayObject)(PlayObject)).m_MagicSkill_208, nPower);    // 怒之火球
                                    if (TargeTBaseObject != null)
                                    {
                                        if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((TPlayObject)(TargeTBaseObject)).m_MagicSkill_209, nPower);    // 静之火球
                                        }
                                        else if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((THeroObject)(TargeTBaseObject)).m_MagicSkill_209, nPower);    // 静之火球
                                        }
                                    }
                                    nPower = HUtil32._MAX(0, nPower + NGSecPwr);
                                }
                            }
                            else if ((PlayObject.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                            {
                                if (((THeroObject)(PlayObject)).m_MagicSkill_208 != null)
                                {
                                    NGSecPwr = GetNGPow(PlayObject, ((THeroObject)(PlayObject)).m_MagicSkill_208, nPower);    // 怒之火球
                                    if (TargeTBaseObject != null)
                                    {
                                        if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((TPlayObject)(TargeTBaseObject)).m_MagicSkill_209, nPower);    // 静之火球
                                        }
                                        else if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((THeroObject)(TargeTBaseObject)).m_MagicSkill_209, nPower);    // 静之火球
                                        }
                                    }
                                    nPower = HUtil32._MAX(0, nPower + NGSecPwr);
                                }
                            }
                            break;

                        case MagicConst.SKILL_FIREBALL2:
                            if ((PlayObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                            {
                                if (((TPlayObject)(PlayObject)).m_MagicSkill_210 != null)
                                {
                                    NGSecPwr = GetNGPow(PlayObject, ((TPlayObject)(PlayObject)).m_MagicSkill_210, nPower);    // 怒之大火球
                                    if (TargeTBaseObject != null)
                                    {
                                        if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((TPlayObject)(TargeTBaseObject)).m_MagicSkill_211, nPower);    // 静之大火球
                                        }
                                        else if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((THeroObject)(TargeTBaseObject)).m_MagicSkill_211, nPower);    // 静之大火球
                                        }
                                    }
                                    nPower = HUtil32._MAX(0, nPower + NGSecPwr);
                                }
                            }
                            else if ((PlayObject.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                            {
                                if (((THeroObject)(PlayObject)).m_MagicSkill_210 != null)
                                {
                                    NGSecPwr = GetNGPow(PlayObject, ((THeroObject)(PlayObject)).m_MagicSkill_210, nPower);    // 怒之大火球
                                    if (TargeTBaseObject != null)
                                    {
                                        if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((TPlayObject)(TargeTBaseObject)).m_MagicSkill_211, nPower);    // 静之大火球
                                        }
                                        else if (TargeTBaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                        {
                                            NGSecPwr = NGSecPwr - GetNGPow(TargeTBaseObject, ((THeroObject)(TargeTBaseObject)).m_MagicSkill_211, nPower);    // 静之火球
                                        }
                                    }
                                    nPower = HUtil32._MAX(0, nPower + NGSecPwr);
                                }
                            }
                            break;
                        }
                        PlayObject.SendDelayMsg(PlayObject, Grobal2.RM_DELAYMAGIC, nPower, HUtil32.MakeLong(MagicMsg.nTargetX, nTargetY), 2, 0, "", 600);
                        if ((TargeTBaseObject.m_btRaceServer >= Grobal2.RC_ANIMAL))
                        {
                            Result = true;
                        }
                    }
                    else
                    {
                        TargeTBaseObject = null;
                    }
                }
                else
                {
                    TargeTBaseObject = null;
                }
            }
            else
            {
                TargeTBaseObject = null;
            }
        }
Пример #11
0
        /// <summary>
        /// 取物品的附属属性
        /// </summary>
        /// <param name="UserItem"></param>
        /// <param name="StdItem"></param>
        public unsafe void GetItemAddValue(TUserItem *UserItem, TStdItem *StdItem)
        {
            switch (StdItem->StdMode)
            {
            case 5:
            case 6:
                StdItem->DC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->DC), HUtil32.HiWord(StdItem->DC) + UserItem->btValue[0]);
                StdItem->MC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->MC), HUtil32.HiWord(StdItem->MC) + UserItem->btValue[1]);
                StdItem->SC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->SC), HUtil32.HiWord(StdItem->SC) + UserItem->btValue[2]);
                StdItem->AC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->AC) + UserItem->btValue[3], HUtil32.HiWord(StdItem->AC) + UserItem->btValue[5]);
                StdItem->MAC = HUtil32.MakeLong(HUtil32.LoWord(StdItem->MAC) + UserItem->btValue[4], HUtil32.HiWord(StdItem->MAC) + UserItem->btValue[6]);
                if (((byte)UserItem->btValue[7] - 1) < 10)     // 神圣
                {
                    StdItem->Source = (sbyte)UserItem->btValue[7];
                }
                if (UserItem->btValue[10] != 0)
                {
                    StdItem->Reserved = Convert.ToByte(StdItem->Reserved | 1);
                }
                break;

            case 10:
            case 11:
                StdItem->AC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->AC), HUtil32.HiWord(StdItem->AC) + UserItem->btValue[0]);
                StdItem->MAC = HUtil32.MakeLong(HUtil32.LoWord(StdItem->MAC), HUtil32.HiWord(StdItem->MAC) + UserItem->btValue[1]);
                StdItem->DC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->DC), HUtil32.HiWord(StdItem->DC) + UserItem->btValue[2]);
                StdItem->MC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->MC), HUtil32.HiWord(StdItem->MC) + UserItem->btValue[3]);
                StdItem->SC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->SC), HUtil32.HiWord(StdItem->SC) + UserItem->btValue[4]);
                break;

            case 15:
            case 16:
            case 19:
            case 20:
            case 21:
            case 22:
            case 23:
            case 24:
            case 26:
            case 51:
            case 52:
            case 53:
            case 54:
            case 62:
            case 63:
            case 64:
            case 30:     // 加入勋章分类
                StdItem->AC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->AC), HUtil32.HiWord(StdItem->AC) + UserItem->btValue[0]);
                StdItem->MAC = HUtil32.MakeLong(HUtil32.LoWord(StdItem->MAC), HUtil32.HiWord(StdItem->MAC) + UserItem->btValue[1]);
                StdItem->DC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->DC), HUtil32.HiWord(StdItem->DC) + UserItem->btValue[2]);
                StdItem->MC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->MC), HUtil32.HiWord(StdItem->MC) + UserItem->btValue[3]);
                StdItem->SC  = HUtil32.MakeLong(HUtil32.LoWord(StdItem->SC), HUtil32.HiWord(StdItem->SC) + UserItem->btValue[4]);
                if (UserItem->btValue[5] > 0)
                {
                    StdItem->Need = UserItem->btValue[5];
                }
                if (UserItem->btValue[6] > 0)
                {
                    StdItem->NeedLevel = UserItem->btValue[6];
                }
                break;
            }
            if ((UserItem->btValue[20] > 0) || (StdItem->Source > 0))
            {
                switch (StdItem->StdMode) // 吸伤属性
                {
                case 15:
                case 16:
                case 19:
                case 21:
                case 20:
                case 22:
                case 23:
                case 24:
                case 26:
                case 30:
                case 52:
                case 54:
                case 62:
                case 64:
                    // 头盔,项链,戒指,手镯,鞋子,腰带,勋章
                    // 140
                    if (StdItem->Shape == 188)
                    {
                        StdItem->Source = Convert.ToSByte(StdItem->Source + UserItem->btValue[20]);
                        if (StdItem->Source > 100)
                        {
                            StdItem->Source = 100;
                        }
                        StdItem->Reserved = Convert.ToByte(StdItem->Reserved + UserItem->btValue[9]);
                        if (StdItem->Reserved > 5)
                        {
                            StdItem->Reserved = 5;    // 吸伤装备等级
                        }
                    }
                    break;
                }
            }
        }