//查看摊位 //ptich_obj_id 摊位对象id //page 页码 public void LookPtich(PlayerObject play, uint ptich_obj_id) { int ptich_id = -1; for (int i = 0; i < mListPtichInfo.Count; i++) { if (mListPtichInfo[i].PtichObj == null) continue; if (mListPtichInfo[i].PtichObj.GetTypeId() == ptich_obj_id) { ptich_id = i; break; } } if (ptich_id == -1) return; // 摊位信息 byte[] senddata = { 42, 0, 105, 4, 244, 1, 0, 0, 64, 66, 15, 0, 36, 52, 156, 8, 3, 0, 0, 0, 30, 214, 44, 135, 2, 0, 0, 0, 164, 3, 178, 5, 1, 0 }; PacketOut outpack = new PacketOut(); outpack.WriteBuff(senddata); outpack.WriteInt16((short)(ptich_id + 1)); byte[] data2 = { 1, 4, 202, 165, 213, 189 }; outpack.WriteBuff(data2); play.SendData(outpack.Flush(), true); //出售的道具信息 for (int i = 0; i < mListPtichInfo[ptich_id].mSellItemList.Count; i++) { RoleItemInfo item_info = null; RoleData_Eudemon eudemon = null; if (mListPtichInfo[ptich_id].mSellItemList[i].item_id >= IDManager.eudemon_start_id) { eudemon = mListPtichInfo[ptich_id].play.GetEudemonSystem().FindEudemon( mListPtichInfo[ptich_id].mSellItemList[i].item_id); if (eudemon == null) continue; item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem( eudemon.itemid); } else { item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem( mListPtichInfo[ptich_id].mSellItemList[i].item_id); } if (item_info != null) { NetMsg.MsgPtichItemInfo msg = new NetMsg.MsgPtichItemInfo(item_info, ptich_obj_id, mListPtichInfo[ptich_id].mSellItemList[i].price,mListPtichInfo[ptich_id].mSellItemList[i].sell_type); play.SendData(msg.GetBuffer(), true); //发送幻兽信息 if (item_info.typeid >= IDManager.eudemon_start_id) { mListPtichInfo[ptich_id].play.GetEudemonSystem().SendLookPtichEudemonInfo(play, eudemon); // play.GetEudemonSystem().SendEudemonInfo(eudemon, false, true); } } } //道具id //摊位对象id //魔石价格 //道具基础id //最大损耗 172, 38, //当前损耗 172, 38, //摊位栏 3 //是否鉴定 0.已鉴定 1.未鉴定 //未知 50 //第一个宝石 30 //第二个宝石 30 //未知 0,0 //强化等级 12 //32.未知 //33.未知 //34.未知 //35.未知 //36/37.38.39 未知 //40.41. 战魂等级 //42-51 未知 //52 地攻击 //53 水攻击 //54 火攻击 //55 风攻击 //56 特效 //64 第三个宝石 // byte[] data = { 101, 0, 84, 4, 13, 11, 150, 7, 67,162,1,0, 172, 13, 0, 0, 132, 70, 2, 0, 172, 38, 172, 38, 3, 0, 50, 30, 30, 0, 0, 12, 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, 3, 10, 209, 215, 253, 136, 133, 101, 159, 111, 235, 112, 0, 0, 0, 0, 0 }; // play.SendData(GameServer.PtichData, true); //107075 // 收到网络协议:长度:98协议号:1108 //byte[] data1 = { 98, 0, 84, 4, 110, 134, 61, 138, 67, 162, 1, 0, 14, 0, 0, 0, 118, 91, 16, 0, 0, 0, 0, 0, 3, 0, 53, 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, 1, 9, 198, 230, 210, 236, 202, 222, 79, 208, 205, 0, 0, 0 }; //play.SendData(data1,true); //收到网络协议:长度:24协议号:2037 //byte[] data3 = {24,0,245,7,3,0,0,0,110,134,61,138,1,0,0,0,24,0,0,0,138,2,0,0}; // play.SendData(data3,true); ////收到网络协议:长度:496协议号:2037 // byte[] data4 = { 240, 1, 245, 7, 3, 0, 0, 0, 110, 134, 61, 138, 60, 0, 0, 0, 6, 0, 0, 0, 159, 8, 0, 0, 7, 0, 0, 0, 159, 8, 0, 0, 10, 0, 0, 0, 81, 0, 0, 0, 8, 0, 0, 0, 150, 0, 0, 0, 9, 0, 0, 0, 83, 94, 121, 19, 55, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 2, 0, 0, 0, 21, 0, 0, 0, 5, 0, 0, 0, 23, 0, 0, 0, 1, 0, 0, 0, 25, 0, 0, 0, 244, 5, 0, 0, 26, 0, 0, 0, 33, 5, 0, 0, 27, 0, 0, 0, 165, 3, 0, 0, 28, 0, 0, 0, 19, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 11, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 1, 0, 0, 0, 24, 0, 0, 0, 138, 2, 0, 0, 13, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0, 13, 4, 0, 0, 0, 0, 0, 0, 204, 5, 0, 0, 3, 0, 0, 0, 231, 2, 0, 0, 2, 0, 0, 0, 11, 4, 0, 0, 4, 0, 0, 0, 47, 2, 0, 0, 5, 0, 0, 0, 190, 2, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 176, 10, 0, 0, 37, 0, 0, 0, 235, 49, 0, 0, 38, 0, 0, 0, 79, 71, 0, 0, 39, 0, 0, 0, 168, 35, 0, 0, 40, 0, 0, 0, 235, 49, 0, 0, 41, 0, 0, 0, 225, 26, 0, 0, 42, 0, 0, 0, 179, 32, 0, 0, 83, 0, 0, 0, 50, 0, 0, 0 }; // play.SendData(data4, true); }
public void Run() { int runtime = System.Environment.TickCount; while (true) { if (System.Environment.TickCount - runtime > 300) { break; //超出三百毫秒下次再处理 } SocketInfo info = GetInfo(); if (info == null) { break; } if (info.s == null) { break; } Socket s = info.s; switch (info.type) { case TYPE_ONCONNECT: { // SessionManager.Instance().AddSession(s, GameServer.GetTcpServer()); break; } case TYPE_CLOSE: { // PlayerObject play = UserEngine.Instance().FindPlayerObjectToSocket(s); // SessionManager.Instance().RemoveSession(s); // UserEngine.Instance().RemovePlayObject(play); //if (play != null) // { // play.GetGameSession().Dispose(); // play.SetGameSession(null); //} break; } case TYPE_RECEIVE: { GameBase.Network.GameSession session = info.session; byte[] bydata = new byte[info.data.Length]; Buffer.BlockCopy(info.data, 0, bydata, 0, info.data.Length); session.m_GamePack.ProcessNetData(bydata); // session.m_nLastTime = System.Environment.TickCount; byte[] retdata = session.m_GamePack.GetData(); if (retdata != null) { GameBase.Network.PackIn packin = new GameBase.Network.PackIn(retdata); ushort tag = packin.ReadUInt16(); switch (tag) { case PacketProtoco.C_LOGINUSER: { GameBase.Network.PacketOut packout = new GameBase.Network.PacketOut(session.GetGamePackKeyEx()); byte[] sendbyte = { 0, 1, 59, 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, 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, 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, 7, 0, 0, 0,255, 255, 255, 255 }; packout.WriteBuff(sendbyte); sendbyte = packout.Flush(); Program.server.SendData(info.s, sendbyte); break; } } } // SessionManager.Instance().AddNetData(s, info.data, info.data.Length); break; } } } }
public override byte[] GetBuffer() { PacketOut outpack = new PacketOut(mKey); byte[] data = Coding.GetDefauleCoding().GetBytes(name); mMsgLen += (ushort)data.Length; outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteUInt32(id); outpack.WriteUInt32(lookface); outpack.WriteBuff(param); outpack.WriteUInt32(play_id); outpack.WriteInt32(life); outpack.WriteInt32(life_max); outpack.WriteInt16(x); outpack.WriteInt16(y); outpack.WriteInt16(dir); outpack.WriteByte(wuxing); outpack.WriteBuff(param1); outpack.WriteUInt32(monsterid); outpack.WriteInt32(param3); outpack.WriteInt32(param4); outpack.WriteInt32(param5); outpack.WriteInt32(star); outpack.WriteBuff(param2); outpack.WriteByte(count); outpack.WriteString(name); outpack.WriteInt16(0); return outpack.Flush(); }
public override byte[] GetBuffer() { PacketOut outpack = new PacketOut(mKey); mMsgLen += (ushort)(list_item.Count * 40); outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteInt16(param); outpack.WriteInt32(page); outpack.WriteInt32(param1); outpack.WriteInt16(param2); outpack.WriteInt16((short)list_item.Count); outpack.WriteInt32(param3); for (int i = 0; i < list_item.Count; i++) { byte[] namebyte = Coding.GetDefauleCoding().GetBytes(list_item[i].name); byte[] namebyteex = null; //防止溢出- 2016.1.23 if (namebyte.Length > 15) { namebyteex = new byte[15]; Buffer.BlockCopy(namebyte, 0, namebyteex, 0, 15); } else { namebyteex = new byte[namebyte.Length]; Buffer.BlockCopy(namebyte, 0, namebyteex, 0, namebyte.Length); } outpack.WriteBuff(namebyteex); byte[] byte_ = new byte[16 - namebyteex.Length]; outpack.WriteBuff(byte_); outpack.WriteInt32(0); outpack.WriteULong(list_item[i].guanjue); outpack.WriteInt32(1); outpack.WriteInt32(list_item[i].pos); outpack.WriteInt32(0); } return outpack.Flush(); }
public override byte[] GetBuffer() { combo.WriteByte(0); byte[] combodata = combo.GetBuffer(); // Log.Instance().WriteLog(Coding.GetDefauleCoding().GetString(combodata)); mMsgLen += (ushort)combodata.Length; PacketOut outpack = new PacketOut(mKey); outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteUInt32(count); outpack.WriteInt16(type); outpack.WriteByte((byte)count); outpack.WriteBuff(combodata); byte[] ret = outpack.Flush(); // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(ret)); return ret; }
public override byte[] GetBuffer() { PacketOut outpack = new PacketOut(mKey); mMsgLen += (ushort)(152/*道具数据结构信息*/* list_item.Count); outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteInt32(tag); outpack.WriteByte(param1); outpack.WriteByte(type); outpack.WriteInt16(action); outpack.WriteInt32(param2); outpack.WriteUInt32(playid); outpack.WriteInt32((int)list_item.Count); byte[] data = null; for (int i = 0; i < list_item.Count; i++) { GameStruct.RoleItemInfo item = list_item[i]; GameStruct.ItemTypeInfo baseitem = MapServer.ConfigManager.Instance().GetItemTypeInfo(list_item[i].itemid); if (baseitem == null) { data = new byte[152]; outpack.WriteBuff(data); continue; } outpack.WriteUInt32(item.id); outpack.WriteUInt32(item.itemid); //当前耐久度 outpack.WriteUInt16(item.amount); //最大耐久度 outpack.WriteUInt16(baseitem.amount_limit); outpack.WriteByte(0); //状态 1.未鉴定 0.已鉴定 outpack.WriteByte((byte)item.gem1); outpack.WriteByte((byte)item.gem2); outpack.WriteByte((byte)0); //技能 outpack.WriteByte((byte)0); //技能 outpack.WriteByte(item.GetStrongLevel()); outpack.WriteByte((byte)0); //技能 outpack.WriteInt32(0); outpack.WriteInt32(0);//装备锁住时间 outpack.WriteInt32(item.war_ghost_exp); outpack.WriteInt32(0); outpack.WriteInt32(0); outpack.WriteByte(item.di_attack);//地攻击 outpack.WriteByte(item.shui_attack);//水攻击 outpack.WriteByte(item.huo_attack);//火攻击 outpack.WriteByte(item.feng_attack);//风攻击 outpack.WriteByte(0);//特效 outpack.WriteByte(0); outpack.WriteByte(0); outpack.WriteInt16(0); outpack.WriteInt32(0);//道具属性 什么封印道具 系统赠送道具 魂契武器的标识 outpack.WriteByte((byte)item.gem3);//第三个宝石 outpack.WriteInt32(item.god_strong); //神炼强度 outpack.WriteInt16((short)item.god_exp); //神佑经验 outpack.WriteInt32(0); //未激活时间 data = new byte[21]; outpack.WriteBuff(data); //写名称- byte[] namebyte = Coding.GetDefauleCoding().GetBytes(baseitem.name); outpack.WriteBuff(namebyte); data = new byte[68 - namebyte.Length]; outpack.WriteBuff(data); } // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(outpack.GetNormalBuff())); return outpack.Flush(); }
public void SetTrading(bool v) { mIsTrad = v; PacketOut outpack = null; if (mIsTrad) { PlayerObject target = UserEngine.Instance().FindPlayerObjectToTypeID(GetTradTarget()); if (target == null) { SetTrading(false); return; } outpack = new PacketOut(target.GetGamePackKeyEx()); outpack.WriteUInt16(16); outpack.WriteUInt16(1056); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteUInt32(3); outpack.WriteUInt32(1); target.SendData(outpack.Flush()); } else { byte[] data = { 16, 0, 32, 4, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0 }; outpack = new PacketOut(play.GetGamePackKeyEx()); outpack.WriteBuff(data); play.SendData(outpack.Flush()); play.LeftNotice("交易失败!"); //返还魔石、金币 道具与装备 play.ChangeAttribute(GameStruct.UserAttribute.GOLD, mnGold); if (mnGameGold > 0) { play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, mnGameGold); } if (mnGold > 0) { play.ChangeAttribute(GameStruct.UserAttribute.GOLD, mnGameGold); } //装备 for (int i = 0; i < mListItem.Count; i++) { play.GetItemSystem().AddTradItem(mListItem[i]); } //返还幻兽 for (int i = 0; i < mListEudemon.Count; i++) { play.GetEudemonSystem().AddEudemon(mListEudemon[i]); } mListItem.Clear(); mListEudemon.Clear(); } }
public override byte[] GetBuffer() { if (forgetname.Length > 0) { mMsgLen = (ushort)(mMsgLen + Coding.GetDefauleCoding().GetBytes(forgetname).Length + 1); } PacketOut outpack = new PacketOut(); outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteUInt32(id); outpack.WriteUInt32(ptich_obj_id); outpack.WriteInt32(price); outpack.WriteUInt32(base_item_id); outpack.WriteInt16(max_dura); outpack.WriteInt16(cur_dura); outpack.WriteByte(tag); outpack.WriteByte(status); outpack.WriteByte(postion); outpack.WriteByte(gem1); outpack.WriteByte(gem2); outpack.WriteInt16(param1); outpack.WriteByte(strong_lv); outpack.WriteInt32(param2); outpack.WriteInt32(param3); outpack.WriteInt16(soul_lv); outpack.WriteBuff(param4); outpack.WriteByte(di_attack); outpack.WriteByte(shui_attack); outpack.WriteByte(huo_attack); outpack.WriteByte(feng_attack); outpack.WriteByte(effect); outpack.WriteByte(gem3); outpack.WriteBuff(param5); if (forgetname.Length > 0) { //六个空字节 outpack.WriteInt32(0); outpack.WriteInt16(0); outpack.WriteByte(1); outpack.WriteString(forgetname); outpack.WriteByte(0); outpack.WriteByte(0); outpack.WriteByte(0); } else { outpack.WriteInt32(0); } return outpack.Flush(); }
public void SendEudemonInfo(PlayerObject _play = null) { if (mMonsterInfo == null) return; //合体状态与休息状态下不发-- if (this.GetState() == EUDEMONSTATE.FIT || this.GetState() == EUDEMONSTATE.NROMAL) return; //刷新幻兽数据 NetMsg.MsgEudemonBattleInfo battleinfo = new NetMsg.MsgEudemonBattleInfo(); battleinfo.id = this.GetTypeId(); GameStruct.RoleItemInfo role_item = play.GetItemSystem().FindItem(this.GetEudemonInfo().itemid); if (role_item == null) return; battleinfo.lookface = mMonsterInfo.lookface;; battleinfo.name = role_item.forgename; battleinfo.monsterid = mMonsterInfo.id; battleinfo.play_id = play.GetTypeId(); battleinfo.life = mInfo.life; battleinfo.life_max = mInfo.life; battleinfo.x = this.GetCurrentX(); battleinfo.y = this.GetCurrentY(); battleinfo.dir = play.GetDir(); battleinfo.wuxing =(byte) mInfo.wuxing; battleinfo.wuxing =(byte) EudemonWuXing.LEI; if (mInfo.quality == 0) //没进化的,不显示至尊圣兽 { battleinfo.param4 = 0; } else { battleinfo.param4 = 69888;//0, 17, 1, 0 //至尊圣兽 } int nStar = (int)(mInfo.quality / 100); battleinfo.star = nStar; //111为幻兽星级 //186, 90, 16, 0 = 1071802 幻兽对应的物品id //54, 55, 191, 0 //前面四个字节貌似与幻兽神等级有关? //17 幻兽单项属性 //1 为排名 byte[] data = { 44, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 89, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Buffer.BlockCopy(data, 0, battleinfo.param2, 0, data.Length); if (_play != null) { _play.SendData(battleinfo.GetBuffer(),true); } else { this.BrocatBuffer(battleinfo.GetBuffer()); } PacketOut outpack = null; if (this.GetAttr().bDie) { outpack = new PacketOut(); outpack.WriteInt16(20); outpack.WriteInt16(1017); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt32(1); outpack.WriteInt32(26); outpack.WriteInt32(6); this.BrocatBuffer(outpack.Flush()); } // {28,0,241,3,39,31,97,5,2,32,201,122,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} byte[] data1 = { 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1009); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteBuff(data1); this.BrocatBuffer(outpack.Flush()); //要有血量,不然就挂了 //NetMsg.MsgEudemonInfo eudemoninfo = new NetMsg.MsgEudemonInfo(); //eudemoninfo.id = mInfo.GetTypeID(); //eudemoninfo.AddAttribute(GameStruct.EudemonAttribute.Life, mInfo.life); //eudemoninfo.AddAttribute(GameStruct.EudemonAttribute.Life_Max, mInfo.life); //this.BrocatBuffer(eudemoninfo.GetBuffer()); }
private const String XPFULL = "xpfull"; //xp满 参数: xp值 #endregion Fields #region Methods public static void ExecuteGMCommand(String str, PlayerObject play) { try { String[] option = str.Split(' '); String command = option[0]; command = command.Substring(1); command = command.ToLower(); switch (command) { case AWARDITEM: { uint itemid; byte postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK; //默认背包 if (option.Length >= 2) { itemid = Convert.ToUInt32(option[1]); if (option.Length > 2) postion = Convert.ToByte(option[2]); play.GetItemSystem().AwardItem(itemid, postion); } break; } case ADDMAGIC: { uint magicid; byte level = 0; uint exp = 0; if (option.Length >= 2) { magicid = Convert.ToUInt32(option[1]); if (option.Length >= 3) level = Convert.ToByte(option[2]); if (option.Length >= 4) exp = Convert.ToUInt32(option[3]); play.GetMagicSystem().AddMagicInfo(magicid, level, exp); } break; } case XPFULL: { //byte[] data1 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 28, 0, 0, 0, 30, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); //play.SendData(data1); int exp = 100; if (option.Length >= 2) { exp = Convert.ToInt32(option[1]); } play.ChangeAttribute(GameStruct.UserAttribute.XP, exp); //NetMsg.MsgUserAttribute attr = new NetMsg.MsgUserAttribute(); //attr.Create(null, play.GetGamePackKeyEx()); //attr.AddAttribute(GameStruct.UserAttribute.XP, (uint)exp); //attr.role_id = play.GetTypeId(); //play.SendData(attr.GetBuffer()); break; } case MOB: { if (option.Length < 2) break; uint monsterid = Convert.ToUInt32(option[1]); GameStruct.MonsterInfo info = ConfigManager.Instance().GetMonsterInfo(monsterid); if (info == null) break; MapServer.MonsterObject obj = new MapServer.MonsterObject(monsterid, info.ai,play.GetCurrentX(),play.GetCurrentY()); play.GetGameMap().AddObject(obj); obj.Walk(GameStruct.DIR.MAX_DIRSIZE); //play.SendMonsterInfo(obj); //GameStruct.Action action = new GameStruct.Action(GameStruct.Action.MOVE, null); //play.PushAction(action); break; } case ADDGOLD: { if (option.Length < 2) break; byte btype = Convert.ToByte(option[1]); int count = Convert.ToInt32(option[2]); if (btype == 1)//金币 { play.ChangeAttribute(GameStruct.UserAttribute.GOLD, count); } else if (btype == 2) { play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, count); } break; } case FOLLOW: { if (option.Length < 2) break; String name = option[1]; PlayerObject target = UserEngine.Instance().FindPlayerObjectToName(name); if (target != null) { //在同一张地图上 if (target.GetGameMap().GetID() == play.GetGameMap().GetID()) { play.ScroolRandom(target.GetCurrentX(), target.GetCurrentY()); } else { play.ChangeMap(target.GetGameMap().GetID(), target.GetCurrentX(), target.GetCurrentY()); } } else { play.LeftNotice("玩家不存在,无法传送到玩家点。"); } break; } case LEVEL: { if (option.Length < 2) break; int level = Convert.ToInt32(option[1]); play.ChangeAttribute(GameStruct.UserAttribute.LEVEL, level); break; } case RELOAD: { String sPath = option[1]; ScripteManager.Instance().LoadScripteFile(sPath, true); break; } case RELOADALL: { ConfigManager.Instance().ReloadAllScripte(); play.ChatNotice("重加载脚本成功!"); break; } case CHANGEMAP: { uint mapid = Convert.ToUInt32(option[1]); GameMap map = MapManager.Instance().GetGameMapToID(mapid); if (map == null) break; short x = (short)map.GetMapInfo().recallx; short y = (short)map.GetMapInfo().recally; if (option.Length >= 4) { x = Convert.ToInt16(option[2]); y = Convert.ToInt16(option[3]); } play.ChangeMap(mapid, x, y); break; } case ROBOTACTION: { uint action_id = Convert.ToUInt32(option[1]); play.PlayRobotAction(action_id); break; } case KILLPLAY: { String name = option[1]; PlayerObject obj_play = UserEngine.Instance().FindPlayerObjectToName(option[1]); if (obj_play != null) { obj_play.ExitGame(); play.MsgBox("踢出成功!"); } else play.MsgBox("踢出失败,未找到玩家对象!"); break; } case "test": { //测试更改幻兽信息 int type = Convert.ToInt32(option[1]); int value = Convert.ToInt32(option[2]); //PacketOut outpack = new PacketOut(play.GetGamePackKeyEx()); //byte[] buff = {24,0,245,7,1,0,0,0,208,175,166,119,1,0,0,0}; //outpack.WriteBuff(buff); //outpack.WriteInt32(type); //outpack.WriteInt32(value); //play.SendData(outpack.Flush()); PacketOut outpack = new PacketOut(play.GetGamePackKeyEx()); outpack.WriteUInt16(176); outpack.WriteUInt16(1102); outpack.WriteInt32(2005); outpack.WriteByte(0); outpack.WriteByte(10); outpack.WriteInt16(0); outpack.WriteInt32(0); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteInt32((int)1); outpack.WriteUInt32(656); outpack.WriteUInt32(420171); //当前耐久度 outpack.WriteUInt16(1000); //最大耐久度 outpack.WriteUInt16(9000); byte[] data = new byte[72]; data[type] = (byte)value; outpack.WriteBuff(data); GameStruct.ItemTypeInfo baseitem = MapServer.ConfigManager.Instance().GetItemTypeInfo(420170); if (baseitem != null) { byte[] namebyte = Coding.GetDefauleCoding().GetBytes(baseitem.name); outpack.WriteBuff(namebyte); data = new byte[68 - namebyte.Length]; outpack.WriteBuff(data); } else { data = new byte[68]; outpack.WriteBuff(data); } play.SendData(outpack.Flush()); // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(outpack.GetNormalBuff())); break; } case TESTCOMBO: { Program._Head = Convert.ToByte(option[1]); Program._Tail = Convert.ToByte(option[2]); break; } case CHANGELOOKFACE: { int look = Convert.ToInt32(option[1]); play.ChangeAttribute(GameStruct.UserAttribute.LOOKFACE, look); break; } case OTHERROLE: { //军团职位 // 200 普通团员 // 1000 军团长 // 690 指挥官 //680 荣誉指挥官 //收到网络协议:长度:185协议号:1014 //{189,0,246,3,217,168,113,0,17,152,2,0,17,152,2,0,0,0,0,0,0,0,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,250,17,0,0,42,0,2,0,132,66,6,0,0,0,0,0,0,0,0,0,59,1,217,1,161,0,0,0,6,5,0,0,100,0,0,0,130,20,0,0,0,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,130,2,0,0,0,0,0,1,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,0,1,0,0,0,250,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,179,224,215,211,196,167,207,192,0,0,0} short legion_pos = Convert.ToInt16(option[1]); PacketOut outpack = new PacketOut(play.GetGamePackKeyEx()); byte[] data11 = { 185, 0, 246, 3, 200, 16, 24, 0, 209, 251, 1, 0, 209, 251, 1, 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, 117, 1, 0, 0, 64, 234, 2, 0, 244, 83, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 214, 0, 138, 0, 119, 0, 0, 0, 3, 5, 0, 0, 100, 0, 0, 0, 125, 70, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1/*军团头衔*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};// /*军团职位*//*178, 2*/,0/* 1*/, byte[] data2 = { 0, 0, 0, 0, 0, /*1, 16*/0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 255, 8, 0, 0, 117, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 }; outpack.WriteBuff(data11); outpack.WriteInt16(legion_pos); outpack.WriteBuff(data2); play.SendData(outpack.Flush()); //byte[] data11 = { 185, 0, 246, 3, 200, 16, 24, 0, 209, 251, 1, 0, 209, 251, 1, 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, 117, 1, 0, 0, 64, 234, 2, 0, 244, 83, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 214, 0, 138, 0, 119, 0, 0, 0, 3, 5, 0, 0, 100, 0, 0, 0, 125, 70, 0, 0, 0, 5, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1/*军团头衔*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,232,3 /*军团职位*//*178, 2*/,0/* 1*/, // 0, 0, 0, 0, 0, /*1, 16*/0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 74, 0, 255, 8, 0, 0, 117, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length); // play.SendData(data11); //收到网络协议:长度:28协议号:2036 //byte[] data1 = {28,0,244,7,109,0,5,0,84,66,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); // play.SendData(data1); //收到网络协议:长度:16协议号:1012 //byte[] data12 = {16,0,244,3,212,21,24,0,0,0,0,0,0,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data12, data12.Length); // play.SendData(data12); //收到网络协议:长度:27协议号:1015 byte[] data13 = { 27, 0, 247, 3, 117, 1, 0, 0, 3, 0, 1, 14, 169, 89, 211, 200, 207, 170, 161, 239, 180, 180, 187, 212, 187, 205, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data13, data13.Length); play.SendData(data13); //收到网络协议:长度:16协议号:2036 // byte[] data14 = {16,0,244,7,199,0,2,0,84,66,15,0,40,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data14, data14.Length); // play.SendData(data14); ////收到网络协议:长度:16协议号:1034 //byte[] data15 = { 16, 0, 10, 4, 2, 0, 1, 0, 200, 16, 24, 0, 206, 0, 130, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data15, data15.Length); //play.SendData(data15); //收到网络协议:长度:16协议号:1034 //// // byte[] data11 = { 16, 0, 10, 4, 2, 0, 1, 0, 200, 16, 24, 0, 224, 0, 135, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length); // play.SendData(data11); // byte[] data1 = {187,0,246,3,58,255,230,0,17,152,2,0,17,152,2,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,243,2,0,0,18,0,2,0,247,65,6,0,0,0,0,0,0,0,0 //,0,243,0,249,0,101,0,0,0,4,5,0,0,100,0,0,0,112,20,0,0,0,5,0,5,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,200,0,3,0,0,0,0,0,1,21,0,0,0,0,0,0,0,0,0,0,0,0,0, //0,0,0,0,0,0,0,0,0,91,0,127,4,0,0,243,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,97,118,49,51,49,52,0,0,0}; // byte pos = Convert.ToByte(option[1]); // byte value = Convert.ToByte(option[2]); // byte[] data2 = {187,0,246,3,58,255,230,0,17,152,2,0,17,152,2,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,243,2,0,0,18,0,2,0,247,65,6,0,0,0,0,0,0,0,0,0,243,0,249,0,101,0,0,0,4,5,0,0,100,0,0,0,112,20}; // byte[] data3 = new byte[90]; // data3[pos] = value; // byte[] data4 = { 1, 6, 97, 118, 49, 51, 49, 52, 0, 0, 0 }; // PacketOut outpack = new PacketOut(play.GetGamePackKeyEx()); // outpack.WriteBuff(data2); // outpack.WriteBuff(data3); // outpack.WriteBuff(data4); //// play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); // play.SendData(outpack.Flush()); //byte[] data2 = { 28, 0, 244, 7, 109, 0, 5, 0, 58, 255, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); //play.SendData(data2); //byte[] data3 = { 20, 0, 249, 3, 58, 255, 230, 0, 1, 0, 0, 0, 36, 0, 0, 0, 0, 4, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); //play.SendData(data3); ////军团信息 //byte[] data4 = { 20, 0, 247, 3, 243, 2, 0, 0, 3, 0, 1, 7, 65, 198, 172, 190, 252, 205, 197, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); //play.SendData(data4); //byte[] data5 = { 28, 0, 242, 3, 174, 95, 70, 0, 58, 255, 230, 0, 243, 0, 249, 0, 4, 0, 0, 0, 100, 0, 0, 0, 58, 37, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); //play.SendData(data5); break; } case "qicheng": { uint rid_id = Convert.ToUInt32(option[1]); //byte[] data = { 36, 0, 244, 7, 209, 0, 7, 0 }; //byte[] data1 = { 226, 200, 184, 119, 45, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0 }; //PacketOut outpack = new PacketOut(play.GetGamePackKeyEx()); //outpack.WriteBuff(data); //outpack.WriteUInt32(play.GetTypeId()); //outpack.WriteUInt32(rid_id); //outpack.WriteBuff(data1); //play.SendData(outpack.Flush()); play.TakeMount(0,rid_id); break; } case "下马": { play.TakeOffMount(0); break; } case CALLSCRIPT: { uint scripte_id = Convert.ToUInt32(option[1]); ScripteManager.Instance().ExecuteAction(scripte_id, play); break; } case "魔龙守护": { //收到网络协议:长度:40协议号:1022 //byte[] data2 = { 40, 0, 254, 3, 0, 0, 0, 0, 84, 66, 15, 0, 0, 0, 0, 0, 67, 2, 56, 1, 21, 0, 0, 0, 105, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); //play.SendData(data2); ////收到网络协议:长度:116协议号:1105 //byte[] data3 = { 116, 0, 81, 4, 84, 66, 15, 0, 67, 2, 56, 1, 105, 20, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 200, 184, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 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 }; //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); //play.SendData(data3); ////收到网络协议:长度:20协议号:1017 byte[] data7 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length); play.SendData(data7); ////收到网络协议:长度:48协议号:1127 //8, 7,0,0 byte[] data4 = { 48, 0, 103, 4, 84, 66, 15, 0, 8, 7, 0, 0, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); play.SendData(data4); ////收到网络协议:长度:48协议号:1127 //byte[] data5 = { 48, 0, 103, 4, 226, 200, 184, 119, 8, 7, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); //play.SendData(data5); ////收到网络协议:长度:16协议号:1104 //byte[] data6 = { 16, 0, 80, 4, 84, 66, 15, 0, 114, 0, 0, 0, 105, 20, 1, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length); //play.SendData(data6); break; } case TESTDIE: //测试死亡 { //血量清零 //byte[] data1 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); //play.SendData(data1); ////收到网络协议:长度:40协议号:1022 // byte[] data2 = { 40, 0, 254, 3, 0, 0, 0, 0, 200, 105, 7, 0, 84, 66, 15, 0, 47, 3, 17, 4, 2, 0, 0, 0, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); // play.SendData(data2); ////收到网络协议:长度:40协议号:1022 //参数 //time 0, 0, 0, 0 //怪物id 200, 105, 7, 0 //角色id 84, 66, 15, 0 //x 50, 3 //y 17, 4 //标记 14 byte[] data3 = { 40, 0, 254, 3, 0, 0, 0, 0, 200, 105, 7, 0, 84, 66, 15, 0, 50, 3, 17, 4, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); play.SendData(data3); //收到网络协议:长度:20协议号:1017 -- // byte[] data4 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); // play.SendData(data4); ////收到网络协议:长度:20协议号:1017 // byte[] data5 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 26, 0, 0, 0, 2, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); //play.SendData(data5); //收到网络协议:长度:32协议号:1101 //byte[] data6 = { 32, 0, 77, 4, 248, 149, 1, 0, 204, 165, 16, 0, 50, 3, 17, 4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length); //play.SendData(data6); ////收到网络协议:长度:20协议号:1017 //byte[] data7 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 4, 0, 0, 0, 137, 172, 15, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length); //play.SendData(data7); ////收到网络协议:长度:67协议号:1004 //byte[] data8 = { 67, 0, 236, 3, 0, 0, 255, 0, 213, 7, 0, 0, 173, 8, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 6, 83, 89, 83, 84, 69, 77, 8, 210, 176, 177, 200, 186, 243, 204, 236, 0, 21, 196, 227, 210, 197, 202, 167, 193, 203, 50, 50, 52, 50, 54, 195, 182, 189, 240, 177, 210, 161, 163, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length); //play.SendData(data8); // //收到网络协议:长度:16协议号:1012 //byte[] data9 = { 16, 0, 244, 3, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data9, data9.Length); //play.SendData(data9); // byte[] data2 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ; // play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); // play.SendData(data2); // byte[] data1 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); // play.SendData(data1); // byte[] data3 = {40,0,254,3,0,0,0,0,24,87,7,0,76,152,15,0,228,3,214,1,2,0,0,0,233,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); // play.SendData(data3); // byte[] data4 = {40,0,254,3,0,0,0,0,24,87,7,0,76,152,15,0,225,3,214,1,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); // play.SendData(data4); // byte[] data5= {20,0,249,3, 66, 15, 0, 1,1,0,0,0,28,0,0,0,0,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); // play.SendData(data5); // byte[] data6 = { 20, 0, 249, 3, 66, 15, 0, 1, 1, 0, 0, 0, 26, 0, 0, 0, 2, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length); // play.SendData(data6); // byte[] data7 = {32,0,77,4,48,101,1,0,204,165,16,0,225,3,214,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length); // play.SendData(data7); //byte[] data8 = {16,0,244,3, 66, 15, 0, 1,0,0,0,0,0,0,0,0}; //play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length); //play.SendData(data8); byte[] data = { 28, 0, 249, 3, 84, 66, 15, 0, 2, 0, 0, 0, 26, 0, 0, 0, 6, 0, 0, 0, 12, 0, 0, 0, 33, 92, 108, 58 }; play.GetGamePackKeyEx().EncodePacket(ref data, data.Length); play.SendData(data); break; } case "引诱": { NetMsg.MsgMonsterMagicInjuredInfo injuredInfo = new NetMsg.MsgMonsterMagicInjuredInfo(); injuredInfo.tag = 21; // public int time; //时间 //public uint roleid; //角色id //public uint monsterid; //怪物id //public short role_x; //角色x //public short role_y; //角色y //public uint tag; //标记 //public ushort magicid; //技能id //public ushort magiclv; //技能等级 //public uint injuredvalue; //攻击伤害值 //public int[] param; //未知参数 // 收到网络协议:长度:20协议号:1017 //{20,0,249,3,76,152,15,0,1,0,0,0,9,0,0,0,97,0,0,0} //收到网络协议:长度:40协议号:1022 byte[] data1 = { 40, 0, 254, 3, 0, 0, 0, 0, 84, 66, 15, 0, 84, 66, 15, 0, 63, 3, 7, 4, 21, 0, 0, 0, 235, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); play.SendData(data1); //收到网络协议:长度:88协议号:1105 byte[] data2 = { 88, 0, 81, 4, 84, 66, 15, 0, 84, 66, 15, 0, 235, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 66, 15, 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 }; play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); play.SendData(data2); //收到网络协议:长度:16协议号:1104 // byte[] data3 = { 16, 0, 80, 4, 84, 66, 15, 0, 83, 0, 0, 0, 235, 3, 1, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); // play.SendData(data3); ////收到网络协议:长度:16协议号:1012 // byte[] data4 = { 16, 0, 244, 3, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); // play.SendData(data4); //收到网络协议:长度:20协议号:1017 //byte[] data5 = { 20, 0, 249, 3, 76, 152, 15, 0, 1, 0, 0, 0, 28, 0, 0, 0, 30, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); //play.SendData(data5); break; } case "骑士团守护": { //收到网络协议:长度:40协议号:1022 byte[] data1 = { 40, 0, 254, 3, 0, 0, 0, 0, 84, 66, 15, 0, 0, 0, 0, 0, 63, 2, 56, 1, 21, 0, 0, 0, 91, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); play.SendData(data1); //收到网络协议:长度:172协议号:1105 byte[] data10 = { 172, 0, 81, 4, 84, 66, 15, 0, 63, 2, 56, 1, 91, 20, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 180, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 180, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 180, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 180, 11, 0, 1, 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 }; play.GetGamePackKeyEx().EncodePacket(ref data10, data10.Length); play.SendData(data10); //收到网络协议:长度:81协议号:2069 //byte[] data2 = { 81, 0, 21, 8, 90, 180, 11, 0, 84, 66, 15, 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, 201, 5, 0, 0, 63, 2, 63, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 1, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); //play.SendData(data2); //收到网络协议:长度:28协议号:1010 //byte[] data3 = { 28, 0, 242, 3, 6, 140, 47, 86, 90, 180, 11, 0, 63, 2, 63, 1, 1, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); //play.SendData(data3); //收到网络协议:长度:81协议号:2069 //byte[] data4 = { 81, 0, 21, 8, 91, 180, 11, 0, 84, 66, 15, 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, 201, 5, 0, 0, 55, 2, 51, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 2, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); //play.SendData(data4); //收到网络协议:长度:28协议号:1010 //byte[] data5 = { 28, 0, 242, 3, 6, 140, 47, 86, 91, 180, 11, 0, 55, 2, 51, 1, 2, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); //play.SendData(data5); //收到网络协议:长度:81协议号:2069 //byte[] data6 = { 81, 0, 21, 8, 92, 180, 11, 0, 84, 66, 15, 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, 201, 5, 0, 0, 67, 2, 51, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 5, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length); //play.SendData(data6); //收到网络协议:长度:28协议号:1010 //byte[] data7 = { 28, 0, 242, 3, 6, 140, 47, 86, 92, 180, 11, 0, 67, 2, 51, 1, 5, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length); //play.SendData(data7); //收到网络协议:长度:81协议号:2069 //byte[] data8 = { 81, 0, 21, 8, 93, 180, 11, 0, 84, 66, 15, 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, 201, 5, 0, 0, 71, 2, 59, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 6, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length); //play.SendData(data8); //收到网络协议:长度:28协议号:1010 //byte[] data9 = { 28, 0, 242, 3, 6, 140, 47, 86, 93, 180, 11, 0, 71, 2, 59, 1, 6, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data9, data9.Length); //play.SendData(data9); //收到网络协议:长度:32协议号:1101 //地面持续特效 //176, 9, 13, 0 时间戳 // 176, 23, 0, 0 特效id //63, 2 x坐标 //55,1 y坐标 byte[] data11 = { 32, 0, 77, 4, 176, 9, 13, 0, 176, 23, 0, 0, 63, 2, 55, 1, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length); play.SendData(data11); ////收到网络协议:长度:16协议号:1104 //byte[] data12 = { 16, 0, 80, 4, 84, 66, 15, 0, 89, 0, 0, 0, 91, 20, 1, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data12, data12.Length); //play.SendData(data12); break; } case "清除特效": { byte[] data11 = { 32, 0, 77, 4, 176, 9, 13, 0, 176, 23, 0, 0, 63, 2, 55, 1, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length); play.SendData(data11); break; } case "下雪": { // 收到网络协议:长度:28协议号:1010 // byte[] data1 = {28,0,242,3,232,3,0,0,76,152,15,0,75,1,155,1,0,0,0,0,232,3,0,0,63,37,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); // play.SendData(data1); ////收到网络协议:长度:28协议号:1010 // byte[] data2 = { 28, 0, 242, 3, 52, 159, 49, 86, 76, 152, 15, 0, 75, 1, 155, 1, 0, 0, 0, 0, 255, 255, 255, 255, 95, 37, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); // play.SendData(data2); //收到网络协议:长度:20协议号:1110 //地图id //地图id //类型 byte[] data3={20,0,86,4,232,3,0,0,232,3,0,0,0,0,32,0,128,0,18,0}; play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); play.SendData(data3); break; } case "元素掌控": { // 收到网络协议:长度:40协议号:1022 byte[] data1 = { 40, 0, 254, 3, 186, 192, 18, 1, 84, 66, 15, 0, 0, 0, 0, 0, 93, 1, 179, 1, 21, 0, 0, 0, 180, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); play.SendData(data1); //收到网络协议:长度:20协议号:1017 byte[] data2 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 101, 0, 0, 0, 0, 2, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); play.SendData(data2); //收到网络协议:长度:48协议号:1127 byte[] data3 = { 48, 0, 103, 4, 84, 66, 15, 0, 128, 81, 1, 0, 100, 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, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); play.SendData(data3); //收到网络协议:长度:88协议号:1105 byte[] data4 = { 88, 0, 81, 4, 84, 66, 15, 0, 0, 0, 0, 0, 180, 20, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 }; play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); play.SendData(data4); byte[] data5 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 107, 0, 0, 0, 3, 0, 0, 0 }; play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); play.SendData(data5); break; } case WUDI: { if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_WUDI) != null) { play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_WUDI); play.LeftNotice("角色已取消无敌!!!"); } else { play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_WUDI); play.LeftNotice("角色已无敌!!!"); } break; } case "幻兽死亡": { EudemonObject obj = play.GetEudemonSystem().GetBattleEudemonSystem(0); if (obj == null) break; GameStruct.Action action = new GameStruct.Action(GameStruct.Action.DIE); obj.PushAction(action); break; } case "幻兽技能": { EudemonObject obj = play.GetEudemonSystem().GetBattleEudemonSystem(0); if (obj == null) break; ushort magicid = Convert.ToUInt16(option[1]); obj.AddMagicInfo(magicid); break; } case "幻兽等级": { EudemonObject obj = play.GetEudemonSystem().GetBattleEudemonSystem(0); if (obj == null) break; obj.GetEudemonInfo().level = 100; play.GetEudemonSystem().SendEudemonInfo(obj.GetEudemonInfo()); break; } case "怪物外观": { uint lookface = Convert.ToUInt32(option[1]); NetMsg.MsgMonsterInfo info = new NetMsg.MsgMonsterInfo(); info.id = 500000; info.typeid = 3020; info.lookface = lookface; info.x = play.GetCurrentX(); info.y = play.GetCurrentY(); info.level = 125; info.maxhp =10000; info.hp = 10000; info.dir = 7; play.SendData(info.GetBuffer(), true); break; } case "怪物名字": { uint typeid = Convert.ToUInt32(option[1]); NetMsg.MsgMonsterInfo info = new NetMsg.MsgMonsterInfo(); info.id = 500000; info.typeid = typeid; info.lookface = 1243; info.x = play.GetCurrentX(); info.y = play.GetCurrentY(); info.level = 125; info.maxhp = 10000; info.hp = 10000; info.dir = 7; play.SendData(info.GetBuffer(), true); break; } case "创建npc": { uint id = Convert.ToUInt32(option[1]); NetMsg.MsgNpcInfo info = new NetMsg.MsgNpcInfo(); info.Init(id, play.GetCurrentX(), play.GetCurrentY(), play.GetDir()); play.SendData(info.GetBuffer(),true); break; } case GETONLINECOUNT: { play.ChatNotice("当前在线人数:" + UserEngine.Instance().GetOnlineCount().ToString()); break; } case "名人堂": { //248,42,0,0 用做NPC索引ID //241,73,2,0 lookface //241,73,2,0 lookface //0, 0, 0, 0 未知 //60, 156, 29, 0 动作 //1, 0 名人堂排名名次 //132,16,2,0 衣服 //193, 182, 6, 0 学徒杖 武器 //205, 10, 0, 0 战斗力 // 178, 2, 0, 0 未知 // 33, 0, 0, 0 未知 //101, 0 X坐标 // 185, 0 Y坐标 //132, 0, 0, 0 发型 byte[] data = { 195, 0, 246, 3, 248, 42, 0, 0, 241, 73, 2, 0, 241, 73, 2, 0, 0, 0, 0, 0, /*60, 156, 29, 0*/0,0,0,0, 1, 0, 205, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 16, 2, 0, 193, 182, 6, 0,/* 178, 2, 0, 0, 33, 0, 0, 0*/0,0,0,0,0,0,0,0, 101, 0, 185, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*33, 10,*/0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*100*/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/*5*/, 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, 1, 14, 185, 254, 176, 205, 185, 183, 176, 188, 161, 204, 205, 185, 194, 252, 0, 0, 0 }; play.SendData(data, true); break; } case NOTICE: { String sMsg = option[1]; UserEngine.Instance().SceneNotice(sMsg); break; } case "角色属性": { GameStruct.UserAttribute attr = (GameStruct.UserAttribute)Convert.ToInt32(option[1]); int v = Convert.ToInt32(option[2]); NetMsg.MsgUserAttribute msg = new NetMsg.MsgUserAttribute(); msg.role_id = play.GetTypeId(); msg.Create(null, null); msg.AddAttribute(attr, (uint)v); play.SendData(msg.GetBuffer(), true); break; } } } catch (System.Exception ex) { Log.Instance().WriteLog("----------------------------------------------------------------"); Log.Instance().WriteLog("执行GM命令出错!!" + str); Log.Instance().WriteLog(ex.Message); Log.Instance().WriteLog(ex.StackTrace); Log.Instance().WriteLog("----------------------------------------------------------------"); } }
public void Run() { int runtime = System.Environment.TickCount; while (true) { if (System.Environment.TickCount - runtime > 300) break;//超出三百毫秒下次再处理 SocketInfo info = GetInfo(); if (info == null) break; if (info.s == null) break; Socket s = info.s; switch (info.type) { case TYPE_ONCONNECT: { // SessionManager.Instance().AddSession(s, GameServer.GetTcpServer()); break; } case TYPE_CLOSE: { // PlayerObject play = UserEngine.Instance().FindPlayerObjectToSocket(s); // SessionManager.Instance().RemoveSession(s); // UserEngine.Instance().RemovePlayObject(play); //if (play != null) // { // play.GetGameSession().Dispose(); // play.SetGameSession(null); //} break; } case TYPE_RECEIVE: { GameBase.Network.GameSession session = info.session; byte[] bydata = new byte[info.data.Length]; Buffer.BlockCopy(info.data, 0, bydata, 0, info.data.Length); session.m_GamePack.ProcessNetData(bydata); // session.m_nLastTime = System.Environment.TickCount; byte[] retdata = session.m_GamePack.GetData(); if (retdata != null) { GameBase.Network.PackIn packin = new GameBase.Network.PackIn(retdata); ushort tag = packin.ReadUInt16(); switch (tag) { case PacketProtoco.C_LOGINUSER: { GameBase.Network.PacketOut packout = new GameBase.Network.PacketOut(session.GetGamePackKeyEx()); byte[] sendbyte = { 0, 1, 59, 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, 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, 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, 7, 0, 0, 0, 255, 255, 255, 255 }; packout.WriteBuff(sendbyte); sendbyte = packout.Flush(); Program.server.SendData(info.s, sendbyte); break; } } } // SessionManager.Instance().AddNetData(s, info.data, info.data.Length); break; } } } }
//下马 //eudemon_id 幻兽id public void TakeOffMount(uint eudemon_id) { //锁定状态不允许骑乘 if (this.IsLock()) return; this.GetEudemonSystem().TakeOffMount(eudemon_id); //收到网络协议:长度:28协议号:1009 //{28,0,241,3,39,31,97,5,2,32,201,122,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} PacketOut outpack = new PacketOut(); outpack.WriteUInt16(28); outpack.WriteUInt16(1009); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteUInt32(eudemon_id); byte[] data1 = { 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack.WriteBuff(data1); this.BroadcastBuffer(outpack.Flush(), true); mnMountID = 0; this.GetMagicSystem().SetMoveSpeed(GameBase.Config.Define.ROLE_MOVE_SPEED); }
//骑乘 //eudemon_id 幻兽id //nMountID 坐骑id public void TakeMount(uint eudemon_id, uint nMountID) { //锁定状态不允许骑乘 if (this.IsLock()) return; this.GetEudemonSystem().TakeMount(eudemon_id); byte[] data = { 36, 0, 244, 7, 209, 0, 7, 0 }; //75为 75星品质的幻兽 byte[] data1 = { 75, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0 }; PacketOut outpack = new PacketOut(); outpack.WriteBuff(data); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteUInt32(nMountID); outpack.WriteUInt32(eudemon_id); outpack.WriteBuff(data1); this.BroadcastBuffer(outpack.Flush(), true); mnMountID = nMountID; this.GetMagicSystem().SetMoveSpeed(GameBase.Config.Define.ROLE_RIG_MOVE_SPEED); }
public void Ptich() { GameStruct.NPCInfo info = this.GetCurrentNpcInfo(); if (info == null) return; short nPtichId = (short)((int)info.id - GameBase.Config.Define.PTICH_START_ID); if (PtichManager.Instance().PtichHasPlay(nPtichId)) { return; } this.SetCurrentPtichID(nPtichId); //16,39,0,0 摆摊需要金币 //4,202,165,213,189 摊位的主人名称 字符串 //75, 0 摊位的编号 // byte[] senddata = { 42, 0, 105, 4, 16, 39, 0, 0, 64, 66, 15, 0, 174, 88, 159, 122, 6, 0, 0, 0, 145, 116, 47, 102, 5, 0, 0, 0, 117, 180, 50, 5, 1, 0, 75, 0, 1, 4, 202, 165, 213, 189 }; byte[] senddata = { 42, 0, 105, 4, 244, 1, 0, 0, 64, 66, 15, 0, 36, 52, 156, 8, 3, 0, 0, 0, 30, 214, 44, 135, 2, 0, 0, 0, 164, 3, 178, 5, 1, 0}; PacketOut outpack = new PacketOut(); outpack.WriteBuff(senddata); outpack.WriteInt16((short)(nPtichId + 1)); byte[] data2 = { 1, 4, 202, 165, 213, 189 }; outpack.WriteBuff(data2); this.SendData(outpack.Flush(), true); }
//发送幻兽信息 //info 幻兽信息 //tag 是否发送休息标记 //brank 是否发送排行榜信息 public void SendEudemonInfo(RoleData_Eudemon info, bool tag = true,bool bRank = true) { if (tag) { //要设置一个标记才可以出征,,目前不知道这个消息是干什么用的为何 应该是状态之类的吧。。。(*^__^*) 嘻2015.9.28 NetMsg.MsgEudemonTag eudemontag = new NetMsg.MsgEudemonTag(); eudemontag.playerid = play.GetTypeId(); eudemontag.eudemonid = info.GetTypeID(); eudemontag.SetBreakTag(); play.SendData(eudemontag.GetBuffer(), true); } //所有幻兽都为至尊圣兽 if (bRank && info.quality > 0) { byte[] data1 = { 12, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, 0, 0 }; PacketOut outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1010); outpack.WriteUInt32(info.typeid); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data1); play.SendData(outpack.Flush(),true); } NetMsg.MsgEudemonInfo msg = new NetMsg.MsgEudemonInfo(); msg.id = info.GetTypeID(); msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Max, info.atk_max); msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Min, info.atk_min); msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Max, info.magicatk_max); msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Min, info.magicatk_min); msg.AddAttribute(GameStruct.EudemonAttribute.Defense, info.defense); msg.AddAttribute(GameStruct.EudemonAttribute.Magic_Defense, info.magicdef); msg.AddAttribute(GameStruct.EudemonAttribute.Life, info.life); msg.AddAttribute(GameStruct.EudemonAttribute.Life_Max, info.life_max); msg.AddAttribute(GameStruct.EudemonAttribute.Intimacy, info.intimacy); msg.AddAttribute(GameStruct.EudemonAttribute.Level, info.level); msg.AddAttribute(GameStruct.EudemonAttribute.WuXing, info.wuxing); msg.AddAttribute(GameStruct.EudemonAttribute.Luck, info.luck); msg.AddAttribute(GameStruct.EudemonAttribute.Recall_Count, info.recall_count); msg.AddAttribute(EudemonAttribute.Card, info.card); msg.AddAttribute(EudemonAttribute.Exp, info.exp); msg.AddAttribute(EudemonAttribute.Quality, info.quality); msg.AddAttribute(EudemonAttribute.Init_Atk, info.GetInitAtk()); msg.AddAttribute(EudemonAttribute.Init_Magic_Atk, info.GetInitMagicAtk()); msg.AddAttribute(EudemonAttribute.Init_Defense, info.GetInitDefense()); msg.AddAttribute(EudemonAttribute.Init_Life, info.init_life); msg.AddAttribute(EudemonAttribute.Life_Grow_Rate, ConvertGrowRate(info.life_grow_rate)); msg.AddAttribute(EudemonAttribute.Atk_Min_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate)); msg.AddAttribute(EudemonAttribute.Atk_Max_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate_max )); msg.AddAttribute(EudemonAttribute.MagicAtk_Min_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate)); msg.AddAttribute(EudemonAttribute.MagicAtk_Max_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate_max)); msg.AddAttribute(EudemonAttribute.Defense_Grow_Rate, ConvertGrowRate(info.defense_grow_rate )); msg.AddAttribute(EudemonAttribute.MagicDefense_Grow_Rate, ConvertGrowRate(info.magicdef_grow_rate)); GameStruct.MonsterInfo _info = EudemonObject.GetMonsterInfo(play, info.itemid); if (_info != null) { msg.AddAttribute(EudemonAttribute.Riding, _info.eudemon_type); } play.SendData(msg.GetBuffer(),true); }
public override byte[] GetBuffer() { mMsgLen++; //字符串长度 for (int i = 0; i < str.Count; i++) { mMsgLen += (ushort)(1 + Coding.GetDefauleCoding().GetBytes(str[i]).Length); } PacketOut outpack = new PacketOut(mKey); outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteUInt32(role_id); outpack.WriteUInt32(face_sex); outpack.WriteUInt32(face_sex1); for (int i = 0; i < param.Length; i++) { outpack.WriteInt32(param[i]); } outpack.WriteUInt32(legion_id); outpack.WriteUInt32(armor_id); outpack.WriteUInt32(wepon_id); outpack.WriteInt32(param1); outpack.WriteUInt32(rid_id); //如果是坐骑有一个标识。。目前暂时不太清楚这个参数有什么用 if (rid_id > 0) { //2015.10.15 20下标是角色缩放。。。 param11[22] = 75; //这个是幻兽星级,根据幻兽星级显示坐骑的外观 } outpack.WriteInt16(x); outpack.WriteInt16(y); outpack.WriteUInt32(hair_id); outpack.WriteByte(dir); outpack.WriteByte(TodayGuideCountByOther); outpack.WriteUInt16(param2); outpack.WriteUInt32(action); outpack.WriteByte(level); outpack.WriteByte(job); outpack.WriteInt16(param6); outpack.WriteByte(param7); outpack.WriteInt16(param8); outpack.WriteByte(guanjue); outpack.WriteBuff(param9); outpack.WriteByte(legion_title); outpack.WriteBuff(param10); outpack.WriteInt16(legion_place); //public byte[] param11 = new byte[35]; //public uint legion_id1; //军团id? outpack.WriteBuff(param11); outpack.WriteUInt32(legion_id1); for (int i = 0; i < param5.Length; i++) { outpack.WriteByte(param5[i]); } outpack.WriteByte((byte)str.Count); for (int i = 0; i < str.Count; i++) { outpack.WriteString(str[i]); // outpack.WriteByte(0); } for (int i = 0; i < param3.Length; i++) { outpack.WriteByte(param3[i]); } // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(outpack.GetNormalBuff())); return outpack.Flush(); }
//查看幻兽- 把自身装备信息发给对方 public void SendLookEudemonInfo(PlayerObject target) { uint play_id = play.GetTypeId(); PacketOut outpack = new PacketOut(); EudemonObject obj = null; for (int i = 0; i < mListObj.Count; i++) { obj = mListObj[i]; uint itemid = obj.GetEudemonInfo().itemid; RoleItemInfo item_info = play.GetItemSystem().FindItem(itemid); RoleData_Eudemon info = obj.GetEudemonInfo(); if (item_info == null) continue; //发送道具信息 outpack = new PacketOut(); int nLen = 84 + Coding.GetDefauleCoding().GetBytes(item_info.forgename).Length; outpack.WriteInt16((short)nLen); outpack.WriteInt16(1008); //道具信息 outpack.WriteUInt32(play_id); outpack.WriteUInt32(info.GetTypeID()); outpack.WriteUInt32(item_info.itemid); outpack.WriteInt32(0); outpack.WriteByte(NetMsg.MsgItemInfo.TAG_LOOKROLEEUDEMONINFO); //幻兽背包 outpack.WriteByte(0); outpack.WriteByte(NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK);//幻兽背包 byte[] _data = { 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, 1 }; outpack.WriteBuff(_data); outpack.WriteString(item_info.forgename); outpack.WriteByte(0); outpack.WriteByte(0); outpack.WriteByte(0); target.SendData(outpack.Flush(), true); //target.GetItemSystem().SendItemInfo(item_info, NetMsg.MsgItemInfo.TAG_LOOKROLEEUDEMONINFO); //发送幻兽详细信息 NetMsg.MsgEudemonInfo msg = new NetMsg.MsgEudemonInfo(); msg.id = info.GetTypeID(); msg.tag = 2; msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Max, info.atk_max); msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Min, info.atk_min); msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Max, info.magicatk_max); msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Min, info.magicatk_min); msg.AddAttribute(GameStruct.EudemonAttribute.Defense, info.defense); msg.AddAttribute(GameStruct.EudemonAttribute.Magic_Defense, info.magicdef); msg.AddAttribute(GameStruct.EudemonAttribute.Life, info.life); msg.AddAttribute(GameStruct.EudemonAttribute.Life_Max, info.life_max); msg.AddAttribute(GameStruct.EudemonAttribute.Intimacy, info.intimacy); msg.AddAttribute(GameStruct.EudemonAttribute.Level, info.level); msg.AddAttribute(GameStruct.EudemonAttribute.WuXing, info.wuxing); msg.AddAttribute(GameStruct.EudemonAttribute.Luck, info.luck); msg.AddAttribute(GameStruct.EudemonAttribute.Recall_Count, info.recall_count); msg.AddAttribute(EudemonAttribute.Card, info.card); msg.AddAttribute(EudemonAttribute.Exp, info.exp); msg.AddAttribute(EudemonAttribute.Quality, info.quality); msg.AddAttribute(EudemonAttribute.Init_Atk, info.GetInitAtk()); msg.AddAttribute(EudemonAttribute.Init_Magic_Atk, info.GetInitMagicAtk()); msg.AddAttribute(EudemonAttribute.Init_Defense, info.GetInitDefense()); msg.AddAttribute(EudemonAttribute.Init_Life, info.init_life); msg.AddAttribute(EudemonAttribute.Life_Grow_Rate, ConvertGrowRate(info.life_grow_rate)); msg.AddAttribute(EudemonAttribute.Atk_Min_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate)); msg.AddAttribute(EudemonAttribute.Atk_Max_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate_max)); msg.AddAttribute(EudemonAttribute.MagicAtk_Min_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate)); msg.AddAttribute(EudemonAttribute.MagicAtk_Max_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate_max)); msg.AddAttribute(EudemonAttribute.Defense_Grow_Rate, ConvertGrowRate(info.defense_grow_rate)); msg.AddAttribute(EudemonAttribute.MagicDefense_Grow_Rate, ConvertGrowRate(info.magicdef_grow_rate)); GameStruct.MonsterInfo _info = EudemonObject.GetMonsterInfo(play, info.itemid); if (_info != null) { msg.AddAttribute(EudemonAttribute.Riding, _info.eudemon_type); } target.SendData(msg.GetBuffer(), true); } // 收到网络协议:长度:99协议号:1008 //byte[] data1 = {99,0,240,3,73,48,96,5,253,159,138,131,93,92,16,0,0,0,0,0,7,0,53,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,1,14,218,164,186,211,189,228,193,233,161,164,206,172,193,208,0,0,0}; // target.SendData(data1,true); // //收到网络协议:长度:143协议号:1116 //byte[] data2 = {143,0,92,4,253,159,138,131,183,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,73,48,96,5,220,3,0,0,220,3,0,0,199,1,52,2,6,0,3,0,0,0,0,0,29,26,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,92,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,14,218,164,186,211,189,228,193,233,161,164,206,172,193,208,0,0}; // target.SendData(data2,true); // //收到网络协议:长度:24协议号:2037 // byte[] data3 = { 24, 0, 245, 7, 2, 0, 0, 0, 253, 159, 138, 131, 1, 0, 0, 0, 24, 0, 0, 0, 7, 0, 0, 0 }; // target.SendData(data3, true); ////收到网络协议:长度:496协议号:2037 //byte[] data4 = {240,1,245,7,2,0,0,0,253,159,138,131,60,0,0,0,6,0,0,0,220,3,0,0,7,0,0,0,220,3,0,0,10,0,0,0,37,0,0,0,8,0,0,0,149,0,0,0,9,0,0,0,51,235,16,0,55,0,0,0,0,0,0,0,12,0,0,0,3,0,0,0,14,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,18,0,0,0,0,0,0,0,19,0,0,0,3,0,0,0,21,0,0,0,5,0,0,0,23,0,0,0,1,0,0,0,25,0,0,0,202,0,0,0,26,0,0,0,188,4,0,0,27,0,0,0,142,3,0,0,28,0,0,0,9,0,0,0,50,0,0,0,1,0,32,0,73,0,0,0,0,0,0,0,51,0,0,0,0,0,0,0,59,0,0,0,0,0,0,0,60,0,0,0,0,0,0,0,61,0,0,0,0,0,0,0,62,0,0,0,0,0,0,0,63,0,0,0,11,0,0,0,64,0,0,0,0,0,0,0,65,0,0,0,0,0,0,0,66,0,0,0,0,0,0,0,74,0,0,0,0,0,0,0,75,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,77,0,0,0,0,0,0,0,78,0,0,0,0,0,0,0,79,0,0,0,0,0,0,0,80,0,0,0,0,0,0,0,81,0,0,0,0,0,0,0,84,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,24,0,0,0,7,0,0,0,13,0,0,0,48,0,0,0,1,0,0,0,38,0,0,0,0,0,0,0,83,0,0,0,3,0,0,0,250,0,0,0,2,0,0,0,221,1,0,0,4,0,0,0,182,1,0,0,5,0,0,0,196,0,0,0,64,0,0,0,0,0,0,0,65,0,0,0,0,0,0,0,66,0,0,0,0,0,0,0,82,0,0,0,0,0,0,0,36,0,0,0,162,10,0,0,37,0,0,0,233,3,0,0,38,0,0,0,208,8,0,0,39,0,0,0,234,25,0,0,40,0,0,0,144,50,0,0,41,0,0,0,164,46,0,0,42,0,0,0,72,20,0,0,83,0,0,0,50,0,0,0}; //target.SendData(data4, true); //收到网络协议:长度:20协议号:1103 //{20,0,79,4,253,159,138,131,0,0,0,0,213,7,0,0,0,0,0,0} //收到网络协议:长度:20协议号:1103 //{20,0,79,4,253,159,138,131,0,0,0,0,233,3,0,0,0,0,0,0} //收到网络协议:长度:20协议号:1103 //{20,0,79,4,253,159,138,131,0,0,0,0,185,11,0,0,0,0,0,0} //收到网络协议:长度:20协议号:1103 //{20,0,79,4,253,159,138,131,0,0,0,0,230,7,0,0,0,0,0,0} //收到网络协议:长度:172协议号:1117 //byte[] data5 = { 172, 0, 93, 4 }; // byte[] data6 = {0,0,0,0,0,70,0,0,0,0,1,0,12,228,48,138,92,92,16,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,15,0,0,0,15,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,4,0,0,0,0,0,15,0,26,18,104,0,107,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,11,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,218,164,186,211,189,228,193,233,161,164,206,172,193,208,0,0,0,0,0,0,0,0,0,0,0,0}; // PacketOut outpack = new PacketOut(); // outpack.WriteBuff(data5); // outpack.WriteUInt32(play.GetTypeId()); // outpack.WriteBuff(data6); // target.SendData(outpack.Flush(), true); //for (int i = 0; i < mListObj.Count; i++); //{ // EudemonObject obj = mListObj[i]; // GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(obj.GetEudemonInfo().itemid); // if (item == null) continue; // target.GetItemSystem().SendItemInfo(item, NetMsg.MsgItemInfo.TAG_LOOKROLEEUDEMONINFO); // target.GetEudemonSystem().SendEudemonInfo(obj.GetEudemonInfo(),false,true); //} }
public override byte[] GetBuffer() { byte[] bBuff = new byte[18]; PacketOut outpack = new PacketOut(mKey); mMsgLen += (ushort)(List_Obj.Count * (28 + 1)+bBuff.Length); if (bSigle) { mMsgLen += 13; } outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteUInt32(nID); //单体魔法攻击是对方的id,这样才会有轨迹特效 if (bSigle) { outpack.WriteUInt32(nTargetID); } else { outpack.WriteInt16(nX); outpack.WriteInt16(nY); } outpack.WriteUInt16(nMagicID); outpack.WriteUInt16(nMagicLv); outpack.WriteByte(bDir); //int nCount = List_Obj.Count == 0 ? 1 : List_Obj.Count; outpack.WriteByte((byte)List_Obj.Count); outpack.WriteBuff(bBuff); if (bSigle) { bBuff = new byte[43]; } else { bBuff = new byte[20]; } for (int i = 0; i < List_Obj.Count; i++) { outpack.WriteUInt32(List_Obj[i]); outpack.WriteInt32(List_Value[i]); outpack.WriteBuff(bBuff); } outpack.WriteInt32(0); outpack.WriteInt32(0); outpack.WriteBuff(bBuff); // Log.Instance().WriteLog(GameBase.Network.GamePacketKeyEx.byteToText(outpack.GetNormalBuff())); return outpack.Flush(); }
public void DeleteEudemon(uint eudemon_id) { RoleData_Eudemon eudemon = null; if (mDicEudemon.ContainsKey(eudemon_id)) { eudemon = mDicEudemon[eudemon_id]; //PacketOut outpack = null; mDicEudemon.Remove(eudemon_id); //实例对象也移除 for (int i = 0; i < mListObj.Count; i++) { if (mListObj[i].GetTypeId() == eudemon_id) { mListObj.RemoveAt(i); break; } } } // 收到网络协议:长度:12协议号:1015 //{12,0,247,3,117,251,72,119,89,2,0,0} PacketOut outpack = new PacketOut(); outpack.WriteUInt16(12); outpack.WriteUInt16(1015); outpack.WriteUInt32(eudemon_id); outpack.WriteInt32(601); play.SendData(outpack.Flush(), true); //收到网络协议:长度:76协议号:1040 byte[] data1 = { 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 }; outpack = new PacketOut(); outpack.WriteInt16(76); outpack.WriteInt16(1040); outpack.WriteInt32(0); outpack.WriteInt16(5); outpack.WriteInt16(1); outpack.WriteUInt32(eudemon_id); outpack.WriteBuff(data1); play.SendData(outpack.Flush(), true); //刷新幻兽界面...经过测试 这些封包并没有什么卵用,幻兽界面还是有这个幻兽,后面再说吧。。2015.11.6 //// 收到网络协议:长度:76协议号:1040 //2015.11.9 已解决..是因为这里删掉了幻兽..后面调用playeritem的clearitem 找不到id了。。。 //就在这里发清除道具的信息 NetMsg.MsgClearItem clear = new NetMsg.MsgClearItem(); clear.id = eudemon_id; clear.roleid = play.GetTypeId(); play.SendData(clear.GetBuffer(), true); }
public override byte[] GetBuffer() { PacketOut packout = new PacketOut(mKey); packout.WriteUInt16(mMsgLen); packout.WriteUInt16(mParam); packout.WriteUInt32(mnID); packout.WriteInt16(mnX); packout.WriteInt16(mnY); packout.WriteInt32(lookface); byte[] data = { 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; packout.WriteBuff(data); //packout.WriteUInt16(mnState); //packout.WriteUInt16(mnParam2); //packout.WriteUInt16(mnParam3); //packout.WriteUInt16(mnParam4); //packout.WriteUInt16(mnParam5); return packout.Flush(); }
//幻兽解体 public void Eudemon_BreakUp(uint eudemon_id) { EudemonObject obj = GetBattleEudemon(eudemon_id); if (obj == null) return; if (obj.GetState() != EUDEMONSTATE.FIT) return; mBattleObj.Remove(obj); //this.Eudemon_ReCall(eudemon_id); // 收到网络协议:长度:28协议号:1009 byte[] data1 = { 255, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; PacketOut outpack = new PacketOut(); outpack.WriteUInt16(28); outpack.WriteUInt16(1009); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteBuff(data1); play.SendData(outpack.Flush(), true); //收到网络协议:长度:32协议号:2037 byte[] data2 = { 2, 0, 0, 0, 6, 0, 0, 0, 228, 0, 0, 0, 7, 0, 0, 0, 228, 0, 0, 0 }; outpack = new PacketOut(); outpack.WriteUInt16(32); outpack.WriteUInt16(2037); outpack.WriteUInt32(1); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteBuff(data2); play.SendData(outpack.Flush(), true); //收到网络协议:长度:16协议号:1012 outpack = new PacketOut(); outpack.WriteUInt16(16); outpack.WriteUInt16(1012); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteInt32(0); outpack.WriteInt32(0); play.SendData(outpack.Flush(), true); obj.SetState(EUDEMONSTATE.NROMAL); }
public virtual byte[] GetBuffer() { PacketOut outpack = new PacketOut(mKey); outpack.WriteBuff(m_Data); return outpack.Flush(); }
//进化 public void Eudemon_Evolution(uint eudemon_id) { EudemonObject obj = GetBattleEudemon(eudemon_id); //要出征才能进化 if (obj == null) return; if (obj.GetState() != EUDEMONSTATE.BATTLE) return; GameStruct.RoleItemInfo role_item = play.GetItemSystem().FindItem(obj.GetEudemonInfo().itemid); RoleData_Eudemon eudemon_info = this.FindEudemon(eudemon_id); if (role_item == null || eudemon_info == null) return; //最多进化二次哦 String sEvolution = role_item.itemid.ToString(); PacketOut outpack = null; int nEvolutionCount = Convert.ToInt32(sEvolution.Substring(sEvolution.Length - 1)); if (nEvolutionCount >= GameBase.Config.Define.EUDEMON_EVOLUTION_COUNT) return; GameStruct.ItemTypeInfo follow_info = ConfigManager.Instance().GetItemTypeInfo(role_item.itemid+1); if (follow_info == null) { play.MsgBox("进化失败.1"); uint normal_id = role_item.itemid + 1; Log.Instance().WriteLog("进化失败,未找到道具ID:" + normal_id.ToString()); return; } GameStruct.MonsterInfo monster_info = ConfigManager.Instance().GetMonsterInfo(follow_info.monster_type); if (monster_info == null) { play.MsgBox("进化失败2."); Log.Instance().WriteLog("进化失败,未找到怪物类型:" + follow_info.monster_type.ToString()); return; } if (nEvolutionCount == 0) //第一次进化是二十级 { if (obj.GetEudemonInfo().level < GameBase.Config.Define.EUDEMON_EVOLUTION_ONE) return; if (obj.GetEudemonInfo().quality == 0) { GameStruct.EudemonInfo base_eudemon_info = ConfigManager.Instance().GetEudemonInfo(role_item.itemid); int nQuality = GameBase.Config.Define.EUDEMON_NORMAL_QUALITY; //默认极品十星 if (base_eudemon_info != null) { nQuality = IRandom.Random(base_eudemon_info.quality_min, base_eudemon_info.qulity_max); } eudemon_info.quality = nQuality; // obj.GetEudemonInfo().quality = nQuality; } role_item.itemid++; //增加id } else //第二次进化 { if (obj.GetEudemonInfo().level < GameBase.Config.Define.EUDEMON_EVOLUTION_TWO) return; role_item.itemid++; //增加id eudemon_info.card = IDManager.CreateEudemonCard(); //创建身份牌号码 // obj.GetEudemonInfo().card =IDManager.CreateEudemonCard(); //创建身份牌号码 } obj.SetEudemonInfo(eudemon_info); //更新道具与幻兽信息 play.GetItemSystem().UpdateItemInfo(role_item.id); obj.SetMosterInfo(monster_info) ; //---更改幻兽模型---- outpack = new PacketOut(); outpack.WriteInt16(24); outpack.WriteInt16(2035); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteUInt32(obj.GetMonsterInfo().lookface); outpack.WriteInt32(2); outpack.WriteInt16(obj.GetCurrentX()); outpack.WriteInt16(obj.GetCurrentY()); outpack.WriteUInt32(obj.GetTypeId()); obj.BrocatBuffer(outpack.Flush()); this.SendEudemonInfo(obj.GetEudemonInfo(),false); //幻兽排行榜 //收到网络协议:长度:28协议号:1010 //幻兽总排行榜 12 //幻兽/神兽星级榜 13 //初始生命排行 14 //生命成长排行 15 //初始最小物攻排行 16 //初始最小物攻排行 17 //最小物攻成长排行 18 //初始最大物攻排行 19 //最大物攻成长排行 20 //初始物防 21 //物防成长排行 22 //初始最小魔攻排行 23 //最小魔攻成长排行 24 //初始最大魔攻排行 25 //最大魔攻成长排行 26 //初始魔防排行 27 //魔防成长排行 28 //雷霆骑士排行 29 //超杀 30 //灵性 31 //智慧 32 byte[] data1 = { 12, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, 0, 0 }; outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1010); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data1); obj.BrocatBuffer(outpack.Flush()); //收到网络协议:长度:28协议号:1009 //幻兽进化特效 byte[] data2 = { 1, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1009); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteBuff(data2); obj.BrocatBuffer(outpack.Flush()); // obj.SendEudemonInfo(); }
public override byte[] GetBuffer() { PacketOut outpack = new PacketOut(mKey); outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteUInt32(playerid); outpack.WriteUInt32(fightpower); outpack.WriteByte(type); outpack.WriteByte(Online); outpack.WriteByte(level); outpack.WriteByte(param); byte[] namebyte = Coding.GetDefauleCoding().GetBytes(name); outpack.WriteBuff(namebyte); byte[] end = new byte[32 - namebyte.Length]; outpack.WriteBuff(end); return outpack.Flush(); }
//幻兽合体 public void Eudemon_Fit(uint eudemon_id) { EudemonObject obj = GetBattleEudemon(eudemon_id); if (obj == null) return; obj.SetState(EUDEMONSTATE.FIT); // mBattleObj.Remove(obj); //长度:28协议号:1009 byte[] data1 = { 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; PacketOut outpack = new PacketOut(); outpack.WriteUInt16(28); outpack.WriteUInt16(1009); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteBuff(data1); play.BroadcastBuffer(outpack.Flush(), true); //收到网络协议:长度:28协议号:1010 byte[] data2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 }; outpack = new PacketOut(); outpack.WriteUInt16(28); outpack.WriteUInt16(1010); outpack.WriteInt32(System.Environment.TickCount); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteBuff(data2); play.BroadcastBuffer(outpack.Flush(), true); //收到网络协议:长度:28协议号:1010 //byte[] data3 = { 28, 0, 242, 3, 143, 246, 58, 86, 0, 148, 53, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 }; //play.SendData(data3, true); //收到网络协议:长度:32协议号:2037 //幻兽最大血量- 与最小血量 //byte[] data4 = { 2, 0, 0, 0, 6, 0, 0, 0, 228, 0, 0, 0, 7, 0, 0, 0, 228, 0, 0, 0 }; outpack = new PacketOut(); outpack.WriteUInt16(32); outpack.WriteUInt16(2037); outpack.WriteUInt32(1); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteInt32(2); outpack.WriteInt32(6); outpack.WriteInt32(obj.GetAttr().life); outpack.WriteInt32(7); outpack.WriteInt32(obj.GetAttr().life_max); play.SendData(outpack.Flush(), true); //play.BroadcastBuffer(outpack.Flush(), true); //收到网络协议:长度:28协议号:1009 byte[] data5 = { 255, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack = new PacketOut(); outpack.WriteUInt16(28); outpack.WriteUInt16(1009); outpack.WriteUInt32(obj.GetTypeId()); outpack.WriteBuff(data5); play.BroadcastBuffer(outpack.Flush(), true); //下面这个好像无用 //收到网络协议:长度:32协议号:2037 //byte[] data6 = { 32, 0, 245, 7, 1, 0, 0, 0, 0, 148, 53, 119, 2, 0, 0, 0, 6, 0, 0, 0, 228, 0, 0, 0, 7, 0, 0, 0, 228, 0, 0, 0 }; //play.SendData(data6, true); ////收到网络协议:长度:28协议号:1010 //byte[] data7 = { 28, 0, 242, 30, 148, 53, 119, 86, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 38, 0, 0 }; //play.SendData(data7, true); ////收到网络协议:长度:16协议号:1012 //byte[] data8 = { 16, 0, 244, 3, 86, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.SendData(data8, true); }
public override byte[] GetBuffer() { if (legion_id1 == 0) { legion_id1 = legion_id; } PacketOut outpack = new PacketOut(mKey); outpack.WriteUInt16(mMsgLen); outpack.WriteUInt16(mParam); outpack.WriteUInt32(legion_id); outpack.WriteInt32(money); outpack.WriteInt32(devote); outpack.WriteBuff(param); outpack.WriteInt32(param1); outpack.WriteInt32(param2); outpack.WriteInt16(param3); outpack.WriteInt16(place); outpack.WriteInt16(param4); outpack.WriteByte(title); outpack.WriteBuff(param5); byte[] byte_name = Coding.GetDefauleCoding().GetBytes(legion_name); outpack.WriteBuff(byte_name); int nLen = 18 - byte_name.Length; if (nLen > 0) { byte[] byte_len = new byte[nLen]; byte_len = new byte[nLen]; outpack.WriteBuff(byte_len); } outpack.WriteUInt32(legion_id1); outpack.WriteBuff(param6); return outpack.Flush(); }
//结尾标记 public byte[] Flush() { byte[] b = new byte[flushdata.Length]; PacketOut outpack = new PacketOut(mKey); outpack.WriteBuff(flushdata); return outpack.Flush(); }
public static void SendConnectMapServer(GameSession session, int key, int key2) { byte[] defdata = { 232, 16, 67, 3 }; byte[] defdata2 = { 121, 39, 0, 0, 49, 50, 48, 46, 49, 51, 50, 46, 54, 57, 46, 49, 52, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; byte[] ipdata = Coding.GetDefauleCoding().GetBytes(m_GameServerIP); PacketOut packout = new PacketOut(session.GetGamePackKeyEx()); packout.WriteUInt16(84); packout.WriteUInt16(PacketProtoco.S_GAMESERVERINFO); packout.WriteInt32(key); packout.WriteInt32(key2); packout.WriteInt32(m_GameServerPort); packout.WriteBuff(defdata); packout.WriteBuff(ipdata); for (int i = 0; i < 28 - ipdata.Length; i++) { packout.WriteByte(0); } packout.WriteBuff(defdata2); defdata = packout.Flush(); server.SendData(session.m_Socket, defdata); }
//npc头像 public byte[] NpcImage(ushort imageid) { byte[] b = { 16, 0, 240, 7, 0, 0, 0, 0}; byte[] end = { 255, 4, 0, 0, 0, 0 }; PacketOut outpack = new PacketOut(mKey); outpack.WriteBuff(b); outpack.WriteUInt16(imageid); outpack.WriteBuff(end); return outpack.Flush(); }
//播放动作- //action_id :动作id //play : 参数如果不为空,则只对该角色播放动作,否则广播 public void PlayFaceAcion(uint action_id,PlayerObject play = null) { PacketOut outpack ; if(play == null) { outpack = new PacketOut(); }else { outpack = new PacketOut(play.GetGamePackKeyEx()); } outpack.WriteUInt16(28); outpack.WriteUInt16(1010); outpack.WriteUInt32(0); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteUInt32(23855267); outpack.WriteUInt32(mInfo.dir); outpack.WriteUInt32(action_id); outpack.WriteUInt32(9530); byte[] data = outpack.Flush(); if(play != null) { play.SendData(data); return; } //this.RefreshVisibleObject(); foreach (RefreshObject o in mVisibleList.Values) { BaseObject obj = o.obj; if (obj.type == OBJECTTYPE.PLAYER) { PlayerObject _play = obj as PlayerObject; outpack = new PacketOut(_play.GetGamePackKeyEx()); outpack.WriteBuff(data); _play.SendData(outpack.Flush()); } } }
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; } } }