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); }
/// <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); }
public override bool Operate(TProcessMessage ProcessMsg) { return(base.Operate(ProcessMsg)); }
unsafe static void Main(string[] args) { GameBaseTest g1 = new GameBaseTest(); int n1 = g1.Parse(g1.GameConfig); Console.WriteLine(n1); Console.ReadKey(); return; GameBaseTest g = new GameBaseTest(); g.test(); Thread.Sleep(1000); g = new GameBaseTest(); g.test(); Console.ReadKey(); return; Console.Write(int.MaxValue); Console.ReadKey(); return; int sasdasdasdasd = sizeof(TUnbindInfo);//4491 int asdasd = Marshal.SizeOf(typeof(THumDataInfo)); Console.ReadLine(); DbSession dbsession = new DbSession("MyTest"); TDefaultMessage hun = new TDefaultMessage(); int HumSize = Marshal.SizeOf(hun); TStdItem a = new TStdItem(); MyRefTest(a); // Console.WriteLine(a.Name); IClientScoket socket = new IClientScoket(); socket.OnConnected += socket_OnConnected; socket.ReceivedDatagram += socket_ReceivedDatagram; socket.Connect("127.0.0.1", 6000); TDefaultMessage DefMsg = EncryptUnit.MakeDefaultMsg(1000, 0, 0, 0, 0, 0); TLoadHuman sLoadHuman = new TLoadHuman(); int aaaaaaaaaaaa = Marshal.SizeOf(sLoadHuman); sLoadHuman.sAccount = "123123"; sLoadHuman.sChrName = "啊啊啊啊"; sLoadHuman.sUserAddr = "127.0.0.1"; sLoadHuman.nSessionID = 15; byte[] sdata = StructToBytes(sLoadHuman); // string sDBMsg = EncryptUnit.EncodeMessage(DefMsg) + EncryptUnit.EncodeBuffer<TLoadHuman>(sLoadHuman); // socket.Send(SendDBSockMsg(0, sDBMsg)); Console.WriteLine("ok"); Console.ReadKey(); //TStdItem a = new TStdItem(); // MyRefTest(a); // Console.WriteLine(a.Name); TUnbindInfo abc = new TUnbindInfo(); int MySize = Marshal.SizeOf(abc); HUtil32._MIN(Int32.MaxValue, 14 + (int)Math.Floor(1 / (double)6 + 2.5 * 1)); Math.Round(Math.Round((double)50 / 100, 1), 1); decimal aaaaaaaaa = Round((decimal)Round((decimal)50.0 / 100, 1) * 368, 2); //string strss= EncryptUnit.EncodeBuffer(StructToBytes(a, Marshal.SizeOf(typeof(Struct1))), Marshal.SizeOf(typeof(Struct1))); Class1 b = new Class1(); b.Id = 1; b.Name = "张三"; string strbb = EncryptUnit.EncodeBuffer(ObjectToBytes(b), 8); b.Name = "张三"; //string a = "你好吗"; //sbyte[] by = new sbyte[StringToSBytePtr(a, null, 1) + 1]; //fixed (sbyte* pb = by) //{ // StringToSBytePtr(a, pb, 1); // string b = SBytePtrToString(pb, 1, by.Length - 1); // Console.WriteLine(b); //} //int nLen = StringToIntPtrPlusLen(a, (IntPtr)0, 0); //byte[] byy = new byte[nLen + 1]; //fixed (byte* pb = byy) //{ // StringToIntPtrPlusLen(a, (IntPtr)pb, 1); // string b = IntPtrPlusLenToString((IntPtr)pb, 1); // Console.WriteLine(b); //} Test t = new Test(); t.Main(); // THumDataInfo* HumanRcd = (THumDataInfo*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(THumDataInfo))); //byte[] data=new byte[sizeof(THumDataInfo)]; //fixed (byte* pb = data) //{ // *(THumDataInfo*)pb = *HumanRcd; //} TProcessMessage msg = new TProcessMessage(); int aaaaaaaaaaa = Marshal.SizeOf(typeof(TProcessMessage)); var arrayDouble = Enumerable.Range(1, 1024) .Select(i => (int)i) .ToArray(); fixed(int *p = arrayDouble) { var array2 = ToByte <int>(p, 1); //Assert.AreEqual(arrayDouble, array2); } int[,] arr4 = new int[2, 3] { { 1, 2, 3 }, { 4, 5, 6 } }; //byte[, ,] arr = new byte[8,4,4] //{ // { // {1,2},{1,2} // }, // { // {1,2},{1,2} // } //}; byte[, ,] arr = new byte[, , ] { { { 1, 2 }, { 1, 2 } }, { { 21, 22 }, { 21, 22 } }, { { 31, 32 }, { 31, 32 } } }; string sText = "G73"; int nValNo = 0; nValNo = HUtil32.Str_ToInt(sText.Substring(1, 2), -1); byte[] buff = System.Text.Encoding.GetEncoding("gb2312").GetBytes("我是测试字符串");; string str2 = string.Empty; for (int i = 0; i < 14; i++) { str2 += String.Format("{0:X2}", buff[i]) + ","; } string aa = System.Text.Encoding.GetEncoding("gb2312").GetString(buff); Console.WriteLine(str2); Console.WriteLine(aa); //Console.WriteLine(sizeof(TStdItem)); //Console.WriteLine(Marshal, sizeof(PTDealOffInfo)); string str = string.Empty; string FColor = string.Empty; string BColor = string.Empty; string nTime = string.Empty; string sMsg = "{180,251} 3 战斗区域"; sMsg = HUtil32.ArrestStringEx(sMsg, "{", "}", ref str); str = HUtil32.GetValidStrCap(str, ref FColor, new string[] { "," }); str = HUtil32.GetValidStrCap(str, ref BColor, new string[] { "," }); str = HUtil32.GetValidStrCap(str, ref nTime, new string[] { "," }); Console.WriteLine(MakeWord((byte)255, (byte)56)); //m_CanJmpScriptLableList = new List<string>(); //string msg = @"欢迎,我能为你做点什么?\ \<买/@buy> 物品\<卖/@sell> 物品\<特修毒符/@s_repair>\<询问/@questionprize> 物品详细情况 \<离 开/@exit>\"; //GetScriptLabel(msg); //Console.WriteLine(sizeof(TClientMagic)); //Console.WriteLine(Marshal.SizeOf(typeof(TClientMagic))); //int ccc = sizeof(TClientMagic); //@@rmst //strLen = sLabel.Substring(0, sLabel.Length - 1); //s18 = sLabel.Substring(strLen.Length + 1, sLabel.Length - strLen.Length); //Console.WriteLine(m_CanJmpScriptLableList.Count); //string aaaa= sub_49ADB8("<$USERNAME>加入游戏,<$SERVERNAME>又多了一份力量!", "<$USERNAME>", "1234"); //aaaa = sub_49ADB8(aaaa, "<$SERVERNAME>", "12345"); Console.ReadKey(); }