public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null && msg.Length == mMsgLen - 2 ) { PackIn packin = new PackIn(msg); packin.ReadUInt16(); //协议号 time = packin.ReadInt32(); id = packin.ReadUInt32(); x = packin.ReadInt16(); y = packin.ReadInt16(); dir = packin.ReadByte(); ucMode = packin.ReadByte(); param = packin.ReadUInt16(); param2 = packin.ReadInt32(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); tick = inpack.ReadInt32(); type = inpack.ReadByte(); param = inpack.ReadByte(); param3 = inpack.ReadInt16(); param1 = inpack.ReadInt32(); param2 = inpack.ReadInt32(); itemid = inpack.ReadUInt32(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null ) { PackIn inpack = new PackIn(msg); inpack.ReadInt16(); roleid = inpack.ReadUInt32(); lookface = inpack.ReadUInt32(); hair = inpack.ReadUInt32(); gold = inpack.ReadUInt32(); gamegold = inpack.ReadUInt32(); exp = inpack.ReadUInt32(); expparam = inpack.ReadUInt32(); mentorexp = inpack.ReadUInt32(); mercenarexp = inpack.ReadUInt32(); potential = inpack.ReadUInt32(); attackpower = inpack.ReadUInt16(); constitution = inpack.ReadUInt16(); doage = inpack.ReadUInt16(); decdoage = inpack.ReadUInt16(); health = inpack.ReadUInt16(); magic_attack = inpack.ReadUInt16(); addpoint = inpack.ReadUInt16(); life = inpack.ReadUInt16(); maxlife = inpack.ReadUInt16(); manna = inpack.ReadUInt16(); param = inpack.ReadUInt32(); param1 = inpack.ReadUInt32(); pk = inpack.ReadUInt16(); level = inpack.ReadByte(); profession = inpack.ReadByte(); param2 = inpack.ReadByte(); param3 = inpack.ReadByte(); param4 = inpack.ReadByte(); mentorlevel = inpack.ReadByte(); param14 = inpack.ReadByte(); guanjue = inpack.ReadByte(); // Mercenarylevel = inpack.ReadUInt16(); maxpetcall = inpack.ReadUInt16(); exploit = inpack.ReadInt32(); bonuspoint = inpack.ReadInt32(); edubroodpacksize = inpack.ReadByte(); winglevel = inpack.ReadByte(); godpetpackagelimit = inpack.ReadByte(); demonlev = inpack.ReadByte(); demonexp = inpack.ReadInt32(); demonexpparam = inpack.ReadInt32(); param5 = inpack.ReadInt32(); godlevel = inpack.ReadInt32(); param9 = inpack.ReadByte(); param10 = inpack.ReadUInt16(); param11 = inpack.ReadByte(); for (int i = 0; i < param6.Length; i++) { param6[i]= inpack.ReadInt32(); } originalserverid = inpack.ReadInt32(); wordtreeareaid = inpack.ReadUInt16(); for (int i = 0; i < param7.Length; i++) { param7[i] = inpack.ReadInt32(); } param8 = inpack.ReadUInt16(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); time = inpack.ReadInt32(); roleid = inpack.ReadUInt32(); type = inpack.ReadInt32(); param = inpack.ReadInt32(); value = inpack.ReadInt32(); tag = inpack.ReadInt32(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); type = inpack.ReadInt32(); tag = inpack.ReadInt16(); tag2 = inpack.ReadByte(); // len = inpack.ReadByte(); if (inpack.IsComplete()) return; str = inpack.ReadString(); //for (int i = 0; i < param1.Length; i++) //{ // param1[i] = inpack.ReadByte(); // } } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg.Length == mMsgLen - 2) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); id = inpack.ReadUInt32(); type = inpack.ReadInt32(); param = inpack.ReadInt32(); sp = inpack.ReadInt32(); } }
public void ProcessNetMsg() { foreach (GameSession session in m_DicSession.Values) { if (session == null || session.m_GamePack == null) { continue; } byte[] retdata = session.m_GamePack.GetData(); if (retdata != null) { GameBase.Network.PackIn packin = new GameBase.Network.PackIn(retdata); PlayerObject play = UserEngine.Instance().FindPlayerObjectToID(session.gameid); ushort tag = packin.ReadUInt16(); if (play != null) { play.ProcessNetMsg(tag, retdata); continue; } //第一次的封包一定是更新key哒.. if (play == null && tag != PacketProtoco.C_UPDATEKEY && tag != PacketProtoco.C_QUERYCREATEROLENAME && tag != PacketProtoco.C_CREATEROLE) { continue; } switch (tag) { case PacketProtoco.C_UPDATEKEY: { int key = packin.ReadInt32(); int key2 = packin.ReadInt32(); TempPlayObject tempplay = UserEngine.Instance().GetTempPlayObj(key, key2); if (tempplay == null) { return; //没有经过loginsserver进入的非法封包 } tempplay.play.SetGameSession(session); session.GetGamePackKeyEx().SunUpdateKey(key, key2); NetMsg.MsgNotice msgNotice; //没有角色就创建角色 if (!tempplay.isRole) { msgNotice = new NetMsg.MsgNotice(); msgNotice.Create(null, session.GetGamePackKeyEx()); session.SendData(msgNotice.GetCreateRoleBuff()); return; } //有角色就进游戏 UserEngine.Instance().RemoveTempPlayObject(tempplay.play.GetGameID()); tempplay.play.EnterGame(session); break; } case PacketProtoco.C_QUERYCREATEROLENAME: //创建角色名查询 { NetMsg.MsgQueryCreateRoleName info = new NetMsg.MsgQueryCreateRoleName(); info.Create(retdata, null); int key = 0, key2 = 0; session.GetGamePackKeyEx().GetKey(ref key, ref key2); TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(key, key2); if (temp == null) { Log.Instance().WriteLog("找到玩家对象-在ProcessNetMsg code:1"); break; } //发给dbserver 查询 GameBase.Network.Internal.QueryRoleName query = new GameBase.Network.Internal.QueryRoleName(); query.gameid = temp.play.GetGameID(); query.name = info.GetName(); DBServer.Instance().GetDBClient().SendData(query.GetBuffer()); //NetMsg.MsgNotice notice = new NetMsg.MsgNotice(); //notice.Create(null, session.GetGamePackKeyEx()); //session.SendData(notice.GetQueryNameBuff()); break; } case PacketProtoco.C_CREATEROLE: //创建角色 { int key = 0, key2 = 0; session.GetGamePackKeyEx().GetKey(ref key, ref key2); TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(key, key2); if (temp == null) { Log.Instance().WriteLog("找到玩家对象-在ProcessNetMsg code:2"); break; } NetMsg.MsgCreateRoleInfo info = new NetMsg.MsgCreateRoleInfo(); info.Create(retdata, null); if (info.GetName().Length <= 0) { Log.Instance().WriteLog("角色名称为空!!"); break; } PlayerObject _play = temp.play; _play.SetGameSession(session); _play.SetName(info.GetName()); _play.GetBaseAttr().profession = (byte)info.profession; _play.GetBaseAttr().lookface = info.lookface; //发给dbserver GameBase.Network.Internal.CreateRole create = new GameBase.Network.Internal.CreateRole(); create.accountid = temp.accountid; create.lookface = info.lookface; create.name = info.GetName(); create.profession = (byte)info.profession; create.gameid = temp.play.GetGameID(); DBServer.Instance().GetDBClient().SendData(create.GetBuffer()); //测试游戏 //play = new PlayerObject(); //play.mapid = 1000; //play.mPoint.x = 400; //play.mPoint.y = 440; //session.gameid = play.GetGameID(); //MapManager.Instance().GetGameMapToID(play.mapid).AddObject(play, session); //UserEngine.Instance().AddPlayerObject(play); ////公告信息 //NetMsg.MsgNotice msgNotice = new NetMsg.MsgNotice(); //msgNotice.Create(null, session.GetGamePackKeyEx()); //session.SendData(msgNotice.GetStartGameBuff()); //byte[] roledata = {238, 3, 64, 66, 15, 0, 241, 73, 2, 0, 101, // 0, 0, 0, 60, 1, 0, 0, 0, 0, 0, 0, 81, 118, // 203, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 31, 1, 0, 0, 73, 0, 0, 0, 30, 0, 100, 0, 99, // 0, 102, 0, 0, 0, 202, 3, 222, 3, 134, 7, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 255, 10, 0, 0, 1, 0, 0, // 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 12, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 20, 0, 4, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, // 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 2, 8, 102, 101, 111, 119, 102, 113, 101, 119, 2, // 206, 222, 0, 0, 0 }; ////session.GetGamePackKeyEx().EncodePacket(ref roledata, roledata.Length); ////session.SendData(roledata); //// //NetMsg.MsgSelfRoleInfo rolemsg = new NetMsg.MsgSelfRoleInfo(); //rolemsg.Create(roledata, session.GetGamePackKeyEx()); //rolemsg.roletype = 140001; //rolemsg.roleid = play.GetTypeId(); //rolemsg.name = "测试角色" + play.GetTypeId().ToString(); //play.Name = rolemsg.name; //session.SendData(rolemsg.GetBuffer()); ////测试增加装备 测试装备 //NetMsg.MsgItemInfo item = new NetMsg.MsgItemInfo(); //item.Create(null, session.GetGamePackKeyEx()); //item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_ARMOR; //item.id = 112434; //item.item_id = 135114; //item.amount = item.amount_limit = 1; //session.SendData(item.GetBuffer()); ////测试武器 //item = new NetMsg.MsgItemInfo(); //item.Create(null, session.GetGamePackKeyEx()); //item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_WEAPONR; //item.id = 112435; //item.item_id = 440244; //item.amount = item.amount_limit = 1; //session.SendData(item.GetBuffer()); //NetMsg.MsgUpdateSP sp = new NetMsg.MsgUpdateSP(); //sp.Create(null, session.GetGamePackKeyEx()); //sp.role_id = play.GetTypeId(); //sp.value = 37; //sp.sp = 100; //session.SendData(sp.GetBuffer()); //sp = new NetMsg.MsgUpdateSP(); //sp.Create(null, session.GetGamePackKeyEx()); //sp.role_id = play.GetTypeId(); //session.SendData(sp.GetBuffer()); ////测试新增技能 //ushort[] skill = { 3011 };//, 3002, 1010, 3005, 3009, 8003 //for (int i = 0; i < skill.Length; i++) //{ // NetMsg.MsgMagicInfo magicinfo = new NetMsg.MsgMagicInfo(); // magicinfo.Create(null, session.GetGamePackKeyEx()); // magicinfo.id = play.GetTypeId(); // magicinfo.magicid = skill[i]; // magicinfo.level = 2; // session.SendData(magicinfo.GetBuffer()); //} ////进入地图 //NetMsg.MsgMapInfo mapinfo = new NetMsg.MsgMapInfo(); //mapinfo.Create(null, session.GetGamePackKeyEx()); //mapinfo.Init(play.mapid, play.mPoint.x, play.mPoint.y); //session.SendData(mapinfo.GetBuffer()); ////刷新可视列表; //play.RefreshVisibleObject(); //GameStruct.Action act = new GameStruct.Action(GameStruct.Action.MOVE); //play.PushAction(act); break; } } } } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); tag = inpack.ReadString(16); name = inpack.ReadString(16); tag1 = inpack.ReadString(16); hardwaretag = inpack.ReadString(44); version = inpack.ReadInt32(); lookface = inpack.ReadUInt32(); profession = inpack.ReadUInt16(); param = inpack.ReadUInt16(); param1 = inpack.ReadInt32(); param2 = inpack.ReadInt32(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); id = inpack.ReadUInt32(); dwData = inpack.ReadUInt32(); usAction = inpack.ReadUInt16(); param = inpack.ReadUInt16(); amount = inpack.ReadUInt16(); param1 = inpack.ReadUInt16(); param2 = inpack.ReadUInt32(); param3 = inpack.ReadInt32(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null && msg.Length == mMsgLen - 2) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); time = inpack.ReadInt32(); roleid = inpack.ReadUInt32(); monsterid = inpack.ReadUInt32(); role_x = inpack.ReadInt16(); role_y = inpack.ReadInt16(); tag = inpack.ReadUInt32(); injuredvalue = inpack.ReadUInt32(); for (int i = 0; i < param.Length; i++) { param[i] = inpack.ReadInt32(); } } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); Name = inpack.ReadBuff(16); version = inpack.ReadInt32(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null ) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); time = inpack.ReadInt32(); roleId = inpack.ReadUInt32(); idTarget = inpack.ReadUInt32(); usPosX = inpack.ReadUInt16(); usPosY = inpack.ReadUInt16(); tag = inpack.ReadUInt32(); usType = inpack.ReadUInt32(); int j = 12; if (tag == 2) j = 11; for (int i = 0; i < j; i++) { param[i] = inpack.ReadByte(); } } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); param = inpack.ReadInt32(); param2 = inpack.ReadUInt16(); optionid = inpack.ReadByte(); interactType = inpack.ReadUInt16(); byte nlen = inpack.ReadByte(); text = inpack.ReadString(nlen); for (int i = 0; i < param3.Length; i++) { param3[i] = inpack.ReadByte(); } } }
public void ProcessNetMsg() { foreach (GameSession session in m_DicSession.Values) { if (session == null || session.m_GamePack == null) continue; byte[] retdata = session.m_GamePack.GetData(); if (retdata != null) { GameBase.Network.PackIn packin = new GameBase.Network.PackIn(retdata); PlayerObject play = UserEngine.Instance().FindPlayerObjectToID(session.gameid); ushort tag = packin.ReadUInt16(); if (play != null) { play.ProcessNetMsg(tag, retdata); continue; } //第一次的封包一定是更新key哒.. if (play == null && tag != PacketProtoco.C_UPDATEKEY && tag != PacketProtoco.C_QUERYCREATEROLENAME && tag != PacketProtoco.C_CREATEROLE) continue; switch (tag) { case PacketProtoco.C_UPDATEKEY: { int key = packin.ReadInt32(); int key2 = packin.ReadInt32(); TempPlayObject tempplay = UserEngine.Instance().GetTempPlayObj(key, key2); if (tempplay == null) return; //没有经过loginsserver进入的非法封包 tempplay.play.SetGameSession(session); session.GetGamePackKeyEx().SunUpdateKey(key, key2); NetMsg.MsgNotice msgNotice; //没有角色就创建角色 if (!tempplay.isRole) { msgNotice = new NetMsg.MsgNotice(); msgNotice.Create(null, session.GetGamePackKeyEx()); session.SendData(msgNotice.GetCreateRoleBuff()); return; } //有角色就进游戏 UserEngine.Instance().RemoveTempPlayObject(tempplay.play.GetGameID()); tempplay.play.EnterGame(session); break; } case PacketProtoco.C_QUERYCREATEROLENAME: //创建角色名查询 { NetMsg.MsgQueryCreateRoleName info = new NetMsg.MsgQueryCreateRoleName(); info.Create(retdata, null); int key = 0,key2 = 0; session.GetGamePackKeyEx().GetKey(ref key,ref key2); TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(key,key2); if(temp == null) { Log.Instance().WriteLog("找到玩家对象-在ProcessNetMsg code:1"); break; } //发给dbserver 查询 GameBase.Network.Internal.QueryRoleName query = new GameBase.Network.Internal.QueryRoleName(); query.gameid = temp.play.GetGameID(); query.name = info.GetName(); DBServer.Instance().GetDBClient().SendData(query.GetBuffer()); //NetMsg.MsgNotice notice = new NetMsg.MsgNotice(); //notice.Create(null, session.GetGamePackKeyEx()); //session.SendData(notice.GetQueryNameBuff()); break; } case PacketProtoco.C_CREATEROLE: //创建角色 { int key = 0, key2 = 0; session.GetGamePackKeyEx().GetKey(ref key, ref key2); TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(key, key2); if (temp == null) { Log.Instance().WriteLog("找到玩家对象-在ProcessNetMsg code:2"); break; } NetMsg.MsgCreateRoleInfo info = new NetMsg.MsgCreateRoleInfo(); info.Create(retdata, null); if (info.GetName().Length <= 0) { Log.Instance().WriteLog("角色名称为空!!"); break; } PlayerObject _play = temp.play; _play.SetGameSession(session); _play.SetName(info.GetName()); _play.GetBaseAttr().profession = (byte)info.profession; _play.GetBaseAttr().lookface = info.lookface; //发给dbserver GameBase.Network.Internal.CreateRole create = new GameBase.Network.Internal.CreateRole(); create.accountid = temp.accountid; create.lookface = info.lookface; create.name = info.GetName(); create.profession = (byte)info.profession; create.gameid = temp.play.GetGameID(); DBServer.Instance().GetDBClient().SendData(create.GetBuffer()); //测试游戏 //play = new PlayerObject(); //play.mapid = 1000; //play.mPoint.x = 400; //play.mPoint.y = 440; //session.gameid = play.GetGameID(); //MapManager.Instance().GetGameMapToID(play.mapid).AddObject(play, session); //UserEngine.Instance().AddPlayerObject(play); ////公告信息 //NetMsg.MsgNotice msgNotice = new NetMsg.MsgNotice(); //msgNotice.Create(null, session.GetGamePackKeyEx()); //session.SendData(msgNotice.GetStartGameBuff()); //byte[] roledata = {238, 3, 64, 66, 15, 0, 241, 73, 2, 0, 101, // 0, 0, 0, 60, 1, 0, 0, 0, 0, 0, 0, 81, 118, // 203, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 31, 1, 0, 0, 73, 0, 0, 0, 30, 0, 100, 0, 99, // 0, 102, 0, 0, 0, 202, 3, 222, 3, 134, 7, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 255, 10, 0, 0, 1, 0, 0, // 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 12, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 20, 0, 4, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, // 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 2, 8, 102, 101, 111, 119, 102, 113, 101, 119, 2, // 206, 222, 0, 0, 0 }; ////session.GetGamePackKeyEx().EncodePacket(ref roledata, roledata.Length); ////session.SendData(roledata); //// //NetMsg.MsgSelfRoleInfo rolemsg = new NetMsg.MsgSelfRoleInfo(); //rolemsg.Create(roledata, session.GetGamePackKeyEx()); //rolemsg.roletype = 140001; //rolemsg.roleid = play.GetTypeId(); //rolemsg.name = "测试角色" + play.GetTypeId().ToString(); //play.Name = rolemsg.name; //session.SendData(rolemsg.GetBuffer()); ////测试增加装备 测试装备 //NetMsg.MsgItemInfo item = new NetMsg.MsgItemInfo(); //item.Create(null, session.GetGamePackKeyEx()); //item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_ARMOR; //item.id = 112434; //item.item_id = 135114; //item.amount = item.amount_limit = 1; //session.SendData(item.GetBuffer()); ////测试武器 //item = new NetMsg.MsgItemInfo(); //item.Create(null, session.GetGamePackKeyEx()); //item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_WEAPONR; //item.id = 112435; //item.item_id = 440244; //item.amount = item.amount_limit = 1; //session.SendData(item.GetBuffer()); //NetMsg.MsgUpdateSP sp = new NetMsg.MsgUpdateSP(); //sp.Create(null, session.GetGamePackKeyEx()); //sp.role_id = play.GetTypeId(); //sp.value = 37; //sp.sp = 100; //session.SendData(sp.GetBuffer()); //sp = new NetMsg.MsgUpdateSP(); //sp.Create(null, session.GetGamePackKeyEx()); //sp.role_id = play.GetTypeId(); //session.SendData(sp.GetBuffer()); ////测试新增技能 //ushort[] skill = { 3011 };//, 3002, 1010, 3005, 3009, 8003 //for (int i = 0; i < skill.Length; i++) //{ // NetMsg.MsgMagicInfo magicinfo = new NetMsg.MsgMagicInfo(); // magicinfo.Create(null, session.GetGamePackKeyEx()); // magicinfo.id = play.GetTypeId(); // magicinfo.magicid = skill[i]; // magicinfo.level = 2; // session.SendData(magicinfo.GetBuffer()); //} ////进入地图 //NetMsg.MsgMapInfo mapinfo = new NetMsg.MsgMapInfo(); //mapinfo.Create(null, session.GetGamePackKeyEx()); //mapinfo.Init(play.mapid, play.mPoint.x, play.mPoint.y); //session.SendData(mapinfo.GetBuffer()); ////刷新可视列表; //play.RefreshVisibleObject(); //GameStruct.Action act = new GameStruct.Action(GameStruct.Action.MOVE); //play.PushAction(act); break; } } } } }
public override void Create(byte[] msg = null,GamePacketKeyEx key = null) { base.Create(msg,key); if (msg != null) { PackIn packin = new PackIn(msg); rgba = packin.ReadInt32(); type = packin.ReadUInt16(); tag = packin.ReadUInt16(); param = packin.ReadInt32(); param1 = packin.ReadInt32(); param2 = packin.ReadInt32(); btype = packin.ReadByte(); byte nLen = packin.ReadByte(); str1 = packin.ReadString(nLen); nLen = packin.ReadByte(); str2 = packin.ReadString(nLen); packin.ReadByte(); nLen = packin.ReadByte(); str3 = packin.ReadString(nLen); packin.ReadByte(); param3 = packin.ReadUInt16(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); param = inpack.ReadInt32(); unTxtAttribute = inpack.ReadUInt16(); tag = inpack.ReadUInt16(); param = inpack.ReadInt32(); param1 = inpack.ReadInt32(); param2 = inpack.ReadInt32(); // param3 = inpack.ReadInt32(); byte count = inpack.ReadByte(); for (int i = 0; i < count; i++) { String str = inpack.ReadString(); liststr.Add(str); } inpack.ReadByte(); inpack.ReadByte(); inpack.ReadByte(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null && msg.Length == mMsgLen - 2) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); id = inpack.ReadUInt32(); param = inpack.ReadInt32(); param = inpack.ReadInt32(); for (int i = 0; i < param2.Length; i++) { param2[i] = inpack.ReadInt32(); } lookface = inpack.ReadUInt32(); x = inpack.ReadInt16(); y = inpack.ReadInt16(); hp_ = inpack.ReadUInt16(); level = inpack.ReadUInt16(); typeid = inpack.ReadUInt32(); maxhp = inpack.ReadInt32(); hp = inpack.ReadInt32(); dir = inpack.ReadInt32(); } }
public override void Create(byte[] msg = null, GamePacketKeyEx key = null) { base.Create(msg, key); if (msg != null) { PackIn inpack = new PackIn(msg); inpack.ReadUInt16(); id = inpack.ReadUInt32(); id = id ^ 9527; typeid = inpack.ReadUInt32(); x = inpack.ReadInt16(); y = inpack.ReadInt16(); param = inpack.ReadInt32(); tag = inpack.ReadUInt32(); param1 = inpack.ReadInt32(); } }
public static void ProcessDBNetMsg() { byte[] data = mDBPacket.GetData(); if (data == null) return; PackIn inpack = new PackIn(data); ushort param = inpack.ReadUInt16(); switch (param) { case GameBase.Network.Internal.Define.QUERYROLE_RET: { uint gameid = inpack.ReadUInt32(); int key = inpack.ReadInt32(); int key2 = inpack.ReadInt32(); byte ret = inpack.ReadByte(); if (ret == 1) //有这个帐号-- { GameSession session = FindGameSessionToGameID(gameid); if (session != null) { //发送数据给客户端,连接mapserver Log.Instance().WriteLog("通知客户端登录MapServer"); SendConnectMapServer(session,key,key2); } } else if (ret == 2) //重复登录,踢下线 { GameSession session = FindGameSessionToGameID(gameid); if (session != null) { lock (_lock_session) { m_DicSession.Remove(session.m_Socket); } session.Dispose(); } } break; } } }
public void ProcessNetMsg(ushort tag, byte[] netdata) { PlayerObject play = this; // Log.Instance().WriteLog("协议号:" + tag.ToString()); // Log.Instance().WriteLog("data:"+GamePacketKeyEx.byteToText(netdata)); switch (tag) { case PacketProtoco.C_MOVE: { //被锁定之后无法进行操作 NetMsg.MsgMoveInfo moveinfo = new NetMsg.MsgMoveInfo(); moveinfo.Create(netdata, session.GetGamePackKeyEx()); byte[] movebuf = null; //角色移动 if (moveinfo.id == this.GetTypeId()) { if (this.IsLock()) return; //摆摊状态 if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null) return; if (this.Move(moveinfo)) { moveinfo.id = this.GetTypeId(); moveinfo.x = this.GetCurrentX(); moveinfo.y = this.GetCurrentY(); moveinfo.dir = this.GetDir(); movebuf = moveinfo.GetBuffer(); //发给自己 this.SendData(movebuf); } break; } //幻兽移动 play.GetEudemonSystem().Move(moveinfo); //正在跳舞中- 就设置停止跳舞标记 if (this.IsDancing()) { this.SetDancing(0); } // this.GetGameMap().BroadcastMove(play, movebuf); break; } case PacketProtoco.C_OPENNPC: //单击npc { PackIn inpack = new PackIn(netdata); inpack.ReadUInt16(); uint npcid = inpack.ReadUInt32(); ScripteManager.Instance().ExecuteActionForNpc(npcid, this); break; } case PacketProtoco.C_NPCREPLY: //点击npc选项 { PackIn inpack = new PackIn(netdata); inpack.ReadUInt16(); inpack.ReadUInt32(); inpack.ReadUInt16(); byte selectindex = inpack.ReadByte(); inpack.ReadInt16(); String szStr = inpack.ReadString(); if (selectindex == 255) //退出该npc对话脚本 { this.SetTaskID(0); break; } if ((selectindex > 0)) { ScripteManager.Instance().ExecuteOptionId(selectindex, this, szStr); } else if (this.GetTaskID() != 0) //回调- { ScripteManager.Instance().ExecuteOptionId(play.GetTaskID(), this, szStr); this.SetTaskID(0); } break; } case PacketProtoco.C_ATTACK: //攻击 { //检测是否是安全区- 防作弊 if (this.GetGameMap().IsSafeArea(this.GetCurrentX(), this.GetCurrentY())) { this.LeftNotice("该区域内禁止PK!"); break; } NetMsg.MsgAttackInfo info = new NetMsg.MsgAttackInfo(); info.Create(netdata, this.GetGamePackKeyEx()); if (info.tag == 21)//魔法攻击 要解密 { uint nData = ((info.usPosX) ^ (info.roleId) ^ 0x2ED6); info.usPosX = (ushort)(0xFFFF & (BaseFunc.ExchangeShortBits(nData, 16 - 1) + 0xDD12)); nData = ((info.usPosY) ^ (info.roleId) ^ 0xB99B); info.usPosY = (ushort)(0xFFFF & (BaseFunc.ExchangeShortBits(nData, 16 - 5) + 0x76DE)); info.idTarget = (BaseFunc.ExchangeLongBits((info.idTarget), 13) ^ (info.roleId) ^ 0x5F2D2463) + 0x8B90B51A; info.usType = 0xFFFF & (BaseFunc.ExchangeShortBits(((info.usType) ^ (info.roleId) ^ 0x915D), 16 - 3) + 0x14BE); } if (info.roleId == this.GetTypeId()) //角色攻击 { //被锁定之后无法进行操作 this.GetFightSystem().SetFighting(); //摆摊状态 if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null) return; if (this.IsLock() || this.IsDie()) return; //潜行状态就移除 if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_STEALTH) != null) { this.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_STEALTH); } switch (info.tag) { case 2: //普通攻击 { // this.Attack(info); GetFightSystem().Attack(info); break; } case 21: //魔法攻击 { //this.MagicAttack(info); GetFightSystem().MagicAttack(info); break; } } //正在跳舞中- 就设置停止跳舞标记 if (this.IsDancing()) { this.SetDancing(0); } break; } //幻兽攻击 this.GetEudemonSystem().Eudemon_Attack(info); break; } case PacketProtoco.C_MSGIEM: //道具操作信息 { //被锁定后是无法使用道具的 if (this.IsLock()) break; NetMsg.MsgOperateItem info = new NetMsg.MsgOperateItem(); info.Create(netdata); switch (info.usAction) { //case NetMsg.MsgOperateItem.ITEMACT_EQUIP: //穿戴装备 // { // this.GetItemSystem().Equip(info.id, info.dwData); // break; // } case NetMsg.MsgOperateItem.ITEMACT_BUY: //购买道具 { //魔石商店 1207为魔石商店的id switch (info.id) { case GameBase.Config.Define.GMAESHOPID: //魔石商店 { this.GetItemSystem().BuyGameShopItem(info.dwData, info.amount); break; } case GameBase.Config.Define.LOOKFACEID: //头像商店 { this.GetItemSystem().ChangeLookFace(info.dwData); break; } case GameBase.Config.Define.HAIRID: //发型商店 { this.GetItemSystem().ChangeHair(info.dwData); break; } default: { //普通的npc商店 this.GetItemSystem().BuyItem(info.id, info.dwData); break; } } break; } case NetMsg.MsgOperateItem.ITEMACT_SELL: //卖出道具 { this.GetItemSystem().SellItem(info.id, info.dwData); break; } case NetMsg.MsgOperateItem.ITEMACT_UNEQUIP: //卸下装备 { this.GetItemSystem().UnEquip(info.id, info.dwData); break; } case NetMsg.MsgOperateItem.ITEMACT_USE: //使用道具 { // this.GetItemSystem().UseItem(info.id, info.dwData, (short)info.amount, (short)info.param1); break; } case NetMsg.MsgOperateItem.ITEMACT_REPAIREQUIP: { this.GetItemSystem().RepairEquip(info.param1, info.id); break; } case NetMsg.MsgOperateItem.ITEMACT_DROP: //丢弃道具,从道具栏 { this.GetItemSystem().DropItemBag(info.id); break; } case NetMsg.MsgOperateItem.ITEMACT_OPENGEM: //装备打洞 { //Log.Instance().WriteLog("装备打洞:" + play.GetName() + " " + GamePacketKeyEx.byteToText(netdata)); EquipOperation.Instance().OpenGem(this, info.id, (uint)BaseFunc.MakeLong(info.amount,info.param1)); break; } case NetMsg.MsgOperateItem.STRONGACT_SAVEMONEY: //仓库存钱 { this.GetItemSystem().SaveStrongMoney((int)info.dwData); break; } case NetMsg.MsgOperateItem.STRONGACT_GIVEMONEY: //仓库取钱 { this.GetItemSystem().GiveStrongMoney((int)info.dwData); break; } case NetMsg.MsgOperateItem.EUDEMONACT_RECALL: //幻兽召回 { this.GetEudemonSystem().Eudemon_ReCall(info.id); break; } case NetMsg.MsgOperateItem.EUDEMONACT_FIT://幻兽合体 { this.GetEudemonSystem().Eudemon_Fit(info.id); break; } case NetMsg.MsgOperateItem.EUDEMONACT_BREAK_UP: //幻兽解体 { this.GetEudemonSystem().Eudemon_BreakUp(info.id); break; } case NetMsg.MsgOperateItem.EUDEMON_EVOLUTION: //幻兽进化 { this.GetEudemonSystem().Eudemon_Evolution(info.id); break; } case NetMsg.MsgOperateItem.EUDEMON_DELETE_MAGIC: //删除幻兽技能 { this.GetEudemonSystem().Eudemon_DeleteMagic(info.id, (ushort)info.amount); break; } case NetMsg.MsgOperateItem.TAKEMOUNT: //骑乘 { //如果幻兽出征了,先召回 EudemonObject obj = this.GetEudemonSystem().GetEudmeonObject(info.id); if (obj == null) break; GameStruct.RoleItemInfo item = this.GetItemSystem().FindItem(obj.GetEudemonInfo().itemid); if (item == null) break; this.TakeMount(obj.GetTypeId(), item.itemid); break; } case NetMsg.MsgOperateItem.TAKEOFFMOUNT: //下马 { this.TakeOffMount(info.id); break; } case NetMsg.MsgOperateItem.GET_EXPBALL_EXP: //获取经验球的等级 { int id = BaseFunc.MakeLong(info.amount, info.param1); if (id == this.GetTypeId()) { this.LeftNotice("经验球不允许给人物使用"); break; } // 收到网络协议:长度:28协议号:1009 //{28,0,241,3,122,243,157,131,32,147,105,18,50,0,0,0,122,243,157,131,0,0,0,0,0,0,0,0} break; } case NetMsg.MsgOperateItem.USE_EXPBALL_EXP: //使用经验球 { int id = BaseFunc.MakeLong(info.amount, info.param1); if (id == this.GetTypeId()) { this.LeftNotice("经验球不允许给人物使用"); break; } //给幻兽使用 RoleData_Eudemon eudemon_info = this.GetEudemonSystem().FindEudemon((uint)id); EudemonObject _obj = this.GetEudemonSystem().GetEudmeonObject((uint)id); if (_obj == null || eudemon_info == null) break; eudemon_info.level = 0; // _obj.GetAttr().level = 0; _obj.ChangeAttribute(EudemonAttribute.Level, this.GetBaseAttr().level + GameBase.Config.Define.EXPBALL_EUDEMON_MAXLEVEL, false); //删除经验球 this.GetItemSystem().DeleteItemByID(info.id); break; } case NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GOLD: //摊位以金币方式出售道具 { PtichManager.Instance().SellItem(this, info.id, (byte)NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GOLD, (int)info.dwData); break; } case NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GAMEGOLD: //摊位以魔石方式出售道具 { PtichManager.Instance().SellItem(this, info.id, (byte)NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GAMEGOLD, (int)info.dwData); break; } case NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM: //摊位取回道具 { PtichManager.Instance().GetBackItem(this, info.id); break; } case NetMsg.MsgOperateItem.PTICH_BUY_ITEM: //购买摊位道具 { PtichManager.Instance().BuyItem(this, info.dwData, info.id); break; } case NetMsg.MsgOperateItem.GET_REMOTE_PTICH://获取远程摊位 { PtichManager.Instance().GetRemotePtich(this); break; } case NetMsg.MsgOperateItem.BUY_REMOTE_PTICH_ITEM: //购买远程摊位道具 { PtichManager.Instance().BuyRemotePtichItem(this,info.id); break; } case NetMsg.MsgOperateItem.GET_REMOTE_PTICH_ID: //获取远程摊位- 从指定摊位号 { PtichManager.Instance().GetRemotePtich(this,(int) (info.dwData - 1)/*客户端传上来的是以1为下标*/); break; } case NetMsg.MsgOperateItem.EUDEMON_FOOD: //幻兽喂食圣兽魔晶 { if (this.GetMoneyCount(MONEYTYPE.GAMEGOLD) < 19) return; uint eudemon_id = (uint)BaseFunc.MakeLong(info.amount, info.param1); EudemonObject eudemon = this.GetEudemonSystem().GetBattleEudemon(eudemon_id); if (eudemon == null ) break; //幻兽等级不能超过角色九级以上 if (eudemon.GetAttr().level + 50 > this.GetBaseAttr().level + 8) { eudemon.ChangeAttribute(EudemonAttribute.Level, this.GetBaseAttr().level + 8 - eudemon.GetAttr().level); } //最高255级 else if (eudemon.GetAttr().level + 50 > 255) { eudemon.ChangeAttribute(EudemonAttribute.Level, 255 - eudemon.GetAttr().level); } else eudemon.ChangeAttribute(EudemonAttribute.Level, 50); eudemon.CalcAttribute(); this.ChangeMoney(MONEYTYPE.GAMEGOLD, -19); break; } default: { //Log.Instance().WriteLog("未知操作封包:" + play.GetName() + " " + GamePacketKeyEx.byteToText(netdata)); break; } } break; } case PacketProtoco.C_MSGTALK: { NetMsg.MsgTalkInfo talkinfo = new NetMsg.MsgTalkInfo(); talkinfo.Create(netdata); String talk = talkinfo.GetTalkText(); if (talk.Length > 0) { if (talk[0] == '\\' && this.IsGM()) { //GM命令-- GMCommand.ExecuteGMCommand(talk, this); } if (talk[0] == '\\') //普通命令-- { GMCommand.ExecuteNormalCommand(talk, this); } } PacketOut outpack; switch (talkinfo.unTxtAttribute) { case NetMsg.MsgTalkInfo._TXTATR_TALK: //公聊 { outpack = new PacketOut(); outpack.WriteUInt16((ushort)(netdata.Length + 2)); outpack.WriteBuff(netdata); this.BroadcastBuffer(outpack.Flush(), false); break; } case NetMsg.MsgTalkInfo._TXTATR_PRIVATE: //私聊 { String targetname = talkinfo.GetTalkTargetText(); PlayerObject targetobj = UserEngine.Instance().FindPlayerObjectToName(targetname); if (targetobj != null) { outpack = new PacketOut(targetobj.GetGamePackKeyEx()); outpack.WriteUInt16((ushort)(netdata.Length + 2)); outpack.WriteBuff(netdata); targetobj.SendData(outpack.Flush()); } break; } case NetMsg.MsgTalkInfo._TXTATR_REJECT: //驳回 { String targetname = talkinfo.GetTalkTargetText(); PlayerObject targetobj = UserEngine.Instance().FindPlayerObjectToName(targetname); if (targetobj != null) { switch (talkinfo.GetTalkText()) { case "a": //好友请求驳回 { break; } case "b": //交易请求驳回 { this.GetTradSystem().SetTradTarget(0); targetobj.GetTradSystem().SetTradTarget(0); targetobj.LeftNotice("对方拒绝你的交易请求"); break; } case "c": //队伍请求 { break; } } } break; } } break; } case PacketProtoco.C_PICKDROPITEM: //拾取道具 { NetMsg.MsgDropItem item = new NetMsg.MsgDropItem(); item.Create(netdata, null); BaseObject obj = GetGameMap().GetObject(item.id); if (obj == null) break; if (this.IsDie() || this.IsLock()) break;//死亡或者被锁定 if (this.GetCurrentX() != obj.GetCurrentX() || this.GetCurrentY() != obj.GetCurrentY()) { //连击技能或者xp技能没校验过坐标。。 就校验一下坐标 2015.11.21 //该道具暂时不可拾取- this.ScroolRandom(this.GetCurrentX(), this.GetCurrentY()); } if ((obj as DropItemObject).IsOwner() && (obj as DropItemObject).GetOwnerId() != this.GetTypeId()) { this.LeftNotice("该道具暂时无法拾取!"); return; } //在地图 GameStruct.RoleItemInfo roleitem = (obj as DropItemObject).GetRoleItemInfo(); (obj as DropItemObject).BroadcastInfo(2); this.GetGameMap().RemoveObj(obj); //捡起来放到背包 if (roleitem == null) //怪物爆的 { this.GetItemSystem().AwardItem(obj.GetTypeId(), NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK); } else { //玩家丢的 //如果是幻兽蛋,就得有幻兽数据 if (roleitem.postion == NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK) { this.GetEudemonSystem().AddTempEudemon((obj as DropItemObject).GetRoleEudemonInfo()); } this.GetItemSystem().AwardItem(roleitem); } break; } case PacketProtoco.C_CHANGEPKMODE: //更改pk模式 { bool isrecall = false; NetMsg.MsgChangePkMode action = new NetMsg.MsgChangePkMode(); action.Create(netdata, GetGamePackKeyEx()); switch (action.tag) { case NetMsg.MsgAction.TYPE_CHANGEPKMODE: { if (action.value >= 0 && action.value <= 5) { this.SetPkMode((byte)action.value); isrecall = true; } break; } //xp技能单击 case NetMsg.MsgAction.TYPE_XPFULL: { GetTimerSystem().XPFull((short)action.value); //测试-- //PacketOut outpack = new PacketOut(this.GetGamePackKeyEx()); //outpack.WriteUInt16(28); //outpack.WriteUInt16(1017); //outpack.WriteUInt32(this.GetTypeId()); //outpack.WriteUInt32(2); //outpack.WriteInt32(36); //outpack.WriteInt32(64); //outpack.WriteInt32(71); //outpack.WriteInt32(2048); //byte[] data = outpack.Flush(); //this.SendData(data); break; } //幻兽出征 case NetMsg.MsgAction.TYPE_EUDEMON_BATTLE: { //value = id; this.GetEudemonSystem().Eudemon_Battle((uint)action.value); break; } //表情动作 case NetMsg.MsgAction.TYPE_FACEACTION: { if (this.IsLock()) break; uint nAction = BitConverter.ToUInt32(netdata, 18); this.SetCurrentAction(nAction); action.SetKey(null); this.BroadcastBuffer(action.GetBuffer()); //迷心术 if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_MIXINSHU) != null) { foreach (RefreshObject refobj in this.GetVisibleList().Values) { BaseObject obj = refobj.obj; if (obj.type == OBJECTTYPE.PLAYER) { (obj as PlayerObject).PlayAction(nAction); } } } break; } //获取角色详细信息 case NetMsg.MsgAction.TYPE_FRIENDINFO: { this.GetFriendSystem().GetFriendInfo(action.value); break; } //复活角色 case NetMsg.MsgAction.TYPE_ALIVE: { //要是鬼魂状态 并且死亡超过等于二十秒 if (IsGhost() && System.Environment.TickCount - mnGhostTick >= GameBase.Config.Define.ALIVE_TIME) { Alive(); } break; } case NetMsg.MsgAction.TYPE_FLY_DOWN: //雷霆万钧 下降 { play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_FLY); play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_XPFULL_ATTACK); if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HEILONGWU) != null) { play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_HEILONGWU); } break; } case NetMsg.MsgAction.TYPE_EUDEMON_RANK: //查看幻兽排行榜 { //data1 从总星排行开始 超出100名为0 byte[] data1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; //{36,0,102,4,114,189,89,134,39,31,97,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,85,0,0,0,0} PacketOut outpack = new PacketOut(); outpack.WriteInt16(36); outpack.WriteInt16(1126); outpack.WriteUInt32((uint)action.value); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt16(0); outpack.WriteBuff(data1); this.SendData(outpack.Flush(), true); break; } case NetMsg.MsgAction.TYPE_EUDEMON_SOULINFO: //主幻兽增加分数信息 { EudemonObject obj = this.GetEudemonSystem().GetEudmeonObject((uint)action.time); if (obj == null) break; this.GetEudemonSystem().SetSoulEudemon((uint)action.time); GameStruct.EudemonSoulInfo soulinfo = ConfigManager.Instance().GetEudemonSoulInfo((int)(obj.GetEudemonInfo().quality / 100)); if (soulinfo == null) { this.MsgBox("获取幻化信息错误!!"); Log.Instance().WriteLog("获取幻化信息错误:名称:" + play.GetName() + " 品质:" + obj.GetEudemonInfo().quality.ToString() + "道具id:" + obj.GetEudemonInfo().itemid.ToString()); break; } //125为等级需求 // byte[] data1 = { 32, 0, 244, 7, 73, 0, 6, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/*, 9, 0, 0, 0, 1, 0, 0, 0*/ }; PacketOut outpack = new PacketOut(); outpack.WriteInt16(32); outpack.WriteInt16(2036); outpack.WriteInt16(73); outpack.WriteInt16(6); outpack.WriteInt32(soulinfo.level); outpack.WriteInt32(soulinfo.fu_star); outpack.WriteInt32(0);//亲密度 outpack.WriteInt32(0); outpack.WriteInt32(0); // outpack.WriteBuff(data1); //这个问成长率总分 outpack.WriteInt32(obj.GetEudemonInfo().quality); // outpack.WriteInt32(9); outpack.WriteInt32(1); play.SendData(outpack.Flush(), true); break; } case NetMsg.MsgAction.TYPE_EUDEMON_SOUL: //幻兽幻化 { this.GetEudemonSystem().Eudemon_Soul((uint)action.value); break; } case NetMsg.MsgAction.TYPE_LOOKROLEINFO: //查看装备 { PlayerObject obj = UserEngine.Instance().FindPlayerObjectToTypeID((uint)action.value); if (obj == null) break; obj.GetItemSystem().SendLookRoleInfo(this); break; } case NetMsg.MsgAction.TYPE_LOOKEUDEMONINFO: //查看幻兽 { PlayerObject obj = UserEngine.Instance().FindPlayerObjectToTypeID((uint)action.value); if (obj == null) break; obj.GetEudemonSystem().SendLookEudemonInfo(this); break; } case NetMsg.MsgAction.TYPE_FINDPATH: //单击地图自动寻路 { short x = BaseFunc.LoWord(action.type); short y = BaseFunc.HiWord(action.type); if (!this.GetGameMap().CanMove(x, y)) break; //{28,0,242,3,1,0,0,0,73,48,96,5,195,1,159,1,0,0,0,0,232,3,0,0,166,38,0,0} PacketOut outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1010); outpack.WriteInt32(1); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt16(x); outpack.WriteInt16(y); outpack.WriteInt32(0); outpack.WriteUInt32(this.GetGameMap().GetMapInfo().id); outpack.WriteInt32(9894); this.SendData(outpack.Flush(), true); break; } case NetMsg.MsgAction.TYPE_CONTINUEGAME: //继续游戏 { PacketOut outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1010); outpack.WriteInt32(System.Environment.TickCount); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt32(0); outpack.WriteInt32(0); outpack.WriteInt32(0); outpack.WriteInt32(9630); this.SendData(outpack.Flush(), true); break; } case NetMsg.MsgAction.TYPE_PTICH: //摆摊有关 { if (this.GetCurrentPtichID() == -1) break; PtichManager.Instance().AddPlayPtich(this.GetCurrentPtichID(), this); break; } case NetMsg.MsgAction.TYPE_SHUT_PTICH: //收摊 { PtichManager.Instance().ShutPtich(this,true); break; } case 9528: { //{242,3,180,167,114,0,174,66,15,0,70,1,211,1,0,0,0,0,0,0,0,0,56,37,0,0,} // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(netdata)); break; } case 9855: //开启远程浏览 { break; } case NetMsg.MsgAction.TYPE_LOOK_PTICH: //查看摊位 { uint ptich_obj_id = (uint)action.time; PtichManager.Instance().LookPtich(this, ptich_obj_id); //Log.Instance().WriteLog(GamePacketKeyEx.byteToText(netdata)); break; } } //是否回发- if (isrecall) { this.SendData(action.GetBuffer()); } break; ; } //保存热键信息 case PacketProtoco.C_HOTKEY: { // Log.Instance().WriteLog("data:" + GamePacketKeyEx.byteToText(netdata)); NetMsg.MsgHotKey hotkey = new NetMsg.MsgHotKey(); hotkey.Create(netdata, GetGamePackKeyEx()); switch (hotkey.tag) { case NetMsg.MsgHotKey.TAG_SAVEHOTKEY: //保存热键 { String[] hotkeyarr = hotkey.GetHotKeyArr(); if (hotkeyarr != null) { this.ClearHotKey(hotkey.GetGroup()); for (int i = 0; i < hotkeyarr.Length; i++) { GameStruct.HotkeyInfo info = new GameStruct.HotkeyInfo(hotkey.GetGroup(), hotkeyarr[i]); if (info.index == 0 && info.id == 0) continue; this.AddHotKeyInfo(info); } } break; } case NetMsg.MsgHotKey.TAG_WANGLING_STATE: //切换亡灵形态 { if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING) != null) { this.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING); } else { this.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING); } break; } case NetMsg.MsgHotKey.WORLD_CHAT: //魔法飞鸽 { //this.MsgBox("游戏当前禁止发送飞鸽!"); //break; // hotkey.str; int Index = WorldPigeon.Instance().AddText(this.GetName(), this.GetTypeId(), hotkey.str); if (Index > 1) { this.MsgBox("发布飞鸽成功,目前排在:" + Index.ToString() + "位"); } else if (Index == -1) { this.MsgBox("你已经发过一次飞鸽了,请等上一次的飞鸽发完。"); } break; } case NetMsg.MsgHotKey.CHANGE_EUDEMON_NAME: //更改幻兽名字 { // hotkey.type 幻兽id // hotkey.str if (hotkey.str.Length > 8) return; EudemonObject obj = this.GetEudemonSystem().GetEudmeonObject((uint)hotkey.type); if (obj == null) return; GameStruct.RoleItemInfo role_item = this.GetItemSystem().FindItem(obj.GetEudemonInfo().itemid); if (role_item == null) return; role_item.forgename = hotkey.str; // {21,0,247,3,114,189,89,134,24,0,1,8,210,187,184,246,201,181,177,198,0} PacketOut outpack = new PacketOut(); outpack.WriteInt16((short)(11 + Coding.GetDefauleCoding().GetBytes(role_item.forgename).Length + 2)); outpack.WriteInt16(1015); outpack.WriteUInt32((uint)hotkey.type); outpack.WriteInt16(24); outpack.WriteByte(1); outpack.WriteString(role_item.forgename); outpack.WriteByte(0); this.BroadcastBuffer(outpack.Flush(), true); this.GetItemSystem().UpdateItemInfo(role_item.id); this.GetEudemonSystem().SendEudemonInfo(obj.GetEudemonInfo()); //出战的时候也要同步改名 if (this.GetEudemonSystem().GetBattleEudemon((uint)hotkey.type) != null) { obj.SendEudemonInfo(); } break; } case 288: //进入/离开名人堂 { this.MsgBox("名人堂下一个版本开放!"); break; } } break; } case PacketProtoco.C_EQUIPOPERATION: { NetMsg.MsgEquipOperation equip = new NetMsg.MsgEquipOperation(); equip.Create(netdata, null); // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(netdata)); switch (equip.type) { //提升魔魂等级 case NetMsg.MsgEquipOperation.EQUIPSTRONG: case NetMsg.MsgEquipOperation.EQUIPSTRONGEX: { EquipOperation.Instance().EquipStrong(this, equip.itemid, equip.materialid); break; } //提升幻魔等级 case NetMsg.MsgEquipOperation.EQUIPLEVEL: { EquipOperation.Instance().EquipLevel(this, equip.itemid, equip.materialid); break; } //提升装备品质 case NetMsg.MsgEquipOperation.EQUIPQUALITY: { EquipOperation.Instance().EquipQuality(this, equip.itemid, equip.materialid); break; } //宝石镶嵌 case NetMsg.MsgEquipOperation.GEMSET: { byte index = 0;//第几个洞 uint gemid = 0; if (equip.materialid != 0) { gemid = equip.materialid; index = 0; } else if (equip.param != 0) { gemid = equip.param; index = 1; } else if (equip.param1 != 0) { gemid = equip.param1; index = 2; } if (gemid == 0) return; EquipOperation.Instance().GemSet(this, gemid, equip.itemid, index); break; } case NetMsg.MsgEquipOperation.MAMIC_ADD_GOD: { EquipOperation.Instance().Magic_Add_God(this, equip.itemid, equip.materialid); break; } //宝石融合 case NetMsg.MsgEquipOperation.GEMFUSION: { EquipOperation.Instance().GemFusion(this, equip.itemid); break; } //宝石替换 case NetMsg.MsgEquipOperation.GEMREPLACE: { EquipOperation.Instance().GemReplace(this, netdata); break; } case NetMsg.MsgEquipOperation.EQUIP_GODEXP://提升神佑 { EquipOperation.Instance().Equip_GodExp(this,equip.itemid, equip.materialid); break; } case NetMsg.MsgEquipOperation.GUANJUE_GOLD: { GuanJueManager.Instance().Donation(this, MONEYTYPE.GOLD, (int)equip.itemid); break; } case NetMsg.MsgEquipOperation.GUANJUE_GAMEGOLD: { GuanJueManager.Instance().Donation(this, MONEYTYPE.GAMEGOLD, (int)equip.itemid); break; } case NetMsg.MsgEquipOperation.EXIT_GAME: { byte[] data = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0}; PacketOut outpack = new PacketOut(); outpack.WriteInt16(32); outpack.WriteInt16(1032); outpack.WriteInt32(System.Environment.TickCount); outpack.WriteBuff(data); this.SendData(outpack.Flush(), true); break; } } break; } case PacketProtoco.C_STRONGPACK: { NetMsg.MsgStrongPack msgstrongpack = new NetMsg.MsgStrongPack(); msgstrongpack.Create(netdata); switch (msgstrongpack.param) { case NetMsg.MsgStrongPack.STRONGPACK_TYPE: //仓库操作 { switch (msgstrongpack.type) { case NetMsg.MsgStrongPack.STRONGPACK_TYPE_SAVE: //存道具 { if (this.GetItemSystem().GetStrongItemCount() >= PlayerItem.MAX_STRONGITEM) return; //仓库道具已满,存不了了 this.GetItemSystem().MoveItem(msgstrongpack.itemid, (ushort)NetMsg.MsgItemInfo.ITEMPOSTION_STRONG_PACK); break; } case NetMsg.MsgStrongPack.STRONGPACK_TYPE_GIVE://取道具 { if (this.GetItemSystem().IsItemFull()) return; //包裹道具已满,存不了了 this.GetItemSystem().MoveItem(msgstrongpack.itemid, (ushort)NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK); break; } } break; } case NetMsg.MsgStrongPack.CHEST_TYPE: { switch (msgstrongpack.type) { case NetMsg.MsgStrongPack.CHEST_TYPE_GIVE: //取回衣柜时装 { this.GetItemSystem().Give_FashionChest(msgstrongpack.itemid); break; } } break; } } break; } case PacketProtoco.C_GETFRIENDINFO: { //for (int i = 0; i < 10; i++) //{ // NetMsg.MsgFriendInfo info = new NetMsg.MsgFriendInfo(); // info.Create(null, this.GetGamePackKeyEx()); // info.level = 130; // info.type = 15; // info.actorid = this.GetTypeId() + 1; // info.name = "狂拽酷炫屌炸天"+i.ToString(); // info.Online = 1; // this.SendData(info.GetBuffer()); //} //info = new NetMsg.MsgFriendInfo(); //info.Create(null, this.GetGamePackKeyEx()); //info.level = 130; //info.type = 15; //info.actorid = this.GetTypeId() + 2; //info.name = "离线人物"; //info.Online = 0; //this.SendData(info.GetBuffer()); // this.GetFriendSystem().SendAllFriendInfo(); break; } case PacketProtoco.C_ADDFRIEND: { NetMsg.MsgFriendInfo info = new NetMsg.MsgFriendInfo(); info.Create(netdata); switch (info.type) { case NetMsg.MsgFriendInfo.TYPE_ADDFRIEND: { this.GetFriendSystem().RequestAddFriend(info); break; } case NetMsg.MsgFriendInfo.TYPE_AGREED: //接收好友请求 { this.GetFriendSystem().AddFriend(info.playerid, NetMsg.MsgFriendInfo.TYPE_FRIEND); break; } case NetMsg.MsgFriendInfo.TYPE_REFUSE: //拒绝好友请求 { this.GetFriendSystem().RefuseFriend(info.playerid); break; } case NetMsg.MsgFriendInfo.TYPE_KILL: //绝交 { this.GetFriendSystem().DeleteFriend(info.playerid); break; } } break; } case PacketProtoco.C_TRAD: { NetMsg.MsgTradInfo info = new NetMsg.MsgTradInfo(); info.Create(netdata, null); switch (info.type) { case NetMsg.MsgTradInfo.REQUEST_TRAD: { this.GetTradSystem().RequstTrad(info); break; } case NetMsg.MsgTradInfo.QUIT_TRAD: { this.GetTradSystem().QuitTrad(info); break; } case NetMsg.MsgTradInfo.GOLD_TRAD: { this.GetTradSystem().SetTradGold((int)info.typeid); break; } case NetMsg.MsgTradInfo.GAMEGOLD_TRAD: { this.GetTradSystem().SetTradGameGold((int)info.typeid); break; } case NetMsg.MsgTradInfo.ITEM_TRAD: { this.GetTradSystem().AddTradItem(info.typeid); break; } case NetMsg.MsgTradInfo.SURE_TRAD: { this.GetTradSystem().SureTrad(); break; } } break; } case PacketProtoco.C_GUANJUE: { PackIn inguanjue = new PackIn(netdata); inguanjue.ReadUInt16(); short type = inguanjue.ReadInt16(); byte page = inguanjue.ReadByte(); if (type == 2) //请求获得爵位数据 { GuanJueManager.Instance().RequestData(this, page); } // byte[] data = {162,1,12,8,2,0,0,0,0,0,5,0,0,0,0,0,10,0,226,12,16,0,205,168,204,236,177,166,56,0,0,0,0,0,0,0,0,0,0,0,0,0,128,226,104,182,10,0,0,0,1,0,0,0,0,0,0,0,119,109, //15,0,161,254,192,230,194,228,161,254,0,0,0,0,0,0,0,0,0,0,0,0,80,231,196,204,9,0,0,0,1,0,0,0,1,0,0,0,130,72,16,0,185,243,215,229,193,236,208,228,0,0,0,0,0,0 //,0,0,0,0,0,0,0,190,229,228,8,0,0,0,1,0,0,0,2,0,0,0,230,90,15,0,126,194,182,45,194,182,45,193,250,126,0,0,0,0,0,0,0,0,0,0,98,3,137,149,7,0,0,0,3,0,0,0,3,0,0 //,0,30,145,15,0,126,204,236,200,244,211,208,199,233,126,0,0,0,0,0,0,0,0,0,0,176,56,161,110,6,0,0,0,3,0,0,0,4,0,0,0,236,69,15,0,193,233,202,166,0,0,0,0,0,0,0 //,0,0,0,0,0,0,0,0,0,195,147,65,41,5,0,0,0,3,0,0,0,5,0,0,0,179,169,15,0,213,189,198,199,161,162,208,204,204,236,0,0,0,0,0,0,0,0,0,0,184,62,118,7,4,0,0,0,3,0, //0,0,6,0,0,0,213,95,16,0,40,95,136,181,165,235,164,240,213,108,215,237,0,0,0,0,0,0,0,0,0,59,223,155,3,0,0,0,3,0,0,0,7,0,0,0,206,207,15,0,182,192,185,194,161 //,162,176,212,204,236,0,0,0,0,0,0,0,0,0,0,128,149,127,73,3,0,0,0,3,0,0,0,8,0,0,0,40,79,15,0,196,234,199,225,190,205,210,170,192,203,0,0,0,0,0,0,0,0,0,0,115, //166,15,67,3,0,0,0,3,0,0,0,9,0,0,0}; // this.GetGamePackKeyEx().EncodePacket(ref data, data.Length); // this.SendData(data); break; } case PacketProtoco.C_DANCING: //跳舞 { PackIn inpack = new PackIn(netdata); short _param = inpack.ReadInt16(); uint role_id = inpack.ReadUInt32(); uint target_id = inpack.ReadUInt32(); int param1 = inpack.ReadInt32(); short magic_id = inpack.ReadInt16(); short magic_lv = inpack.ReadInt16(); PacketOut outpack = new PacketOut(); switch (param1) { case 1280: //请求跳舞 { BaseObject targetobj = play.GetGameMap().FindObjectForID(target_id); if (targetobj == null) { return; } //距离太远 if (Math.Abs(this.GetCurrentX() - targetobj.GetCurrentX()) > 2 || Math.Abs(this.GetCurrentY() - targetobj.GetCurrentY()) > 2) { this.LeftNotice("离对方太远了,再走近点吧。"); return; } // 收到网络协议:长度:28协议号:1049 byte[] data1 = { 2, 5, 0, 0, 232, 0, 0, 0, 131, 0, 0, 0, 255, 255, 255, 255 }; outpack.WriteUInt16(28); outpack.WriteUInt16(1049); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteUInt32(target_id); outpack.WriteBuff(data1); play.BroadcastBuffer(outpack.Flush(), true); outpack = new PacketOut(); byte[] data2 = { 3, 5, 0, 0, 25, 2, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 }; outpack.WriteUInt16(28); outpack.WriteUInt16(1049); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteUInt32(target_id); outpack.WriteBuff(data2); play.BroadcastBuffer(outpack.Flush(), true); mnDancingId = magic_id; mnDancingTick = System.Environment.TickCount; break; } case 1285: //停止跳舞 { if (mnDancingId > 0 && System.Environment.TickCount - mnDancingTick > 2000) { byte[] data1 = { 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack = new PacketOut(); outpack.WriteUInt16(28); outpack.WriteUInt16(1049); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteUInt32(target_id); outpack.WriteBuff(data1); play.BroadcastBuffer(outpack.Flush(), true); mnDancingId = 0; } break; } } //Log.Instance().WriteLog(GameBase.Network.GamePacketKeyEx.byteToText(netdata)); break; } default: { Debug.WriteLine("未知封包,协议号:" + tag.ToString()); break; } } }