Exemplo n.º 1
0
 public void DB_Update(PlayerObject play)
 {
     //发给dbserver 更新爵位信息
     GameBase.Network.Internal.UPDATEGUANJUEDATA updatedb = new GameBase.Network.Internal.UPDATEGUANJUEDATA();
     updatedb.info.id = (uint)play.GetBaseAttr().player_id;
     updatedb.info.name = play.GetName();
     updatedb.info.guanjue = play.GetBaseAttr().guanjue;
     DBServer.Instance().GetDBClient().SendData(updatedb.GetBuffer());
 }
Exemplo n.º 2
0
        //军团添加成员
        public void AddMember(uint legion_id,PlayerObject play)
        {
            //已经有军团了
            if(play.GetLegionSystem().IsHaveLegion())return;
            Legion legion = GetLegion(legion_id);
            if (legion == null) return;
            LegionMember member = new LegionMember();
            member.members_name = play.GetName();
            member.money = 0;
            member.rank = GameBase.Config.Define.LEGION_PLACE_PUTONGTUANYUAN;
            legion.GetBaseInfo().list_member.Add(member);
            play.GetLegionSystem().SetLegion(legion,true);

            UpdateLegionInfo(legion_id, play.GetBaseAttr().player_id);
        }
Exemplo n.º 3
0
 //退出军团
 public void QuitLegion(PlayerObject play)
 {
     Legion legion =  play.GetLegionSystem().GetLegion();
     if(legion == null)return;
     uint legion_id = legion.GetBaseInfo().id;
     play.GetLegionSystem().SetLegion(null,true);
     int player_id = play.GetBaseAttr().player_id;
     for (int i = 0; i < legion.GetBaseInfo().list_member.Count; i++)
     {
         if (legion.GetBaseInfo().list_member[i].members_name == play.GetName())
         {
             legion.GetBaseInfo().list_member[i].id = 0;
             break;
         }
     }
     this.UpdateLegionInfo(legion_id, player_id);
 }
Exemplo n.º 4
0
        //发送玩家数据信息到dbserver 保存到数据库
        //play 玩家对象
        //isExit 是否是退出游戏 -
        public void SaveRoleData(PlayerObject play,bool isExit = false)
        {
            if (!this.IsConnect())
            {
                UserEngine.Instance().AddCachePlay(play);
                Log.Instance().WriteLog("保存玩家数据失败,dbserver未连接,已加入到数据库缓冲存储区");
                return;
            }
            //人物基本属性
            SaveRoleData_Attr data = new SaveRoleData_Attr();
            GameStruct.PlayerAttribute attr = play.GetBaseAttr();

            data.accountid = attr.account_id;
            data.IsExit = isExit;
            data.name = play.GetName();
            data.lookface = attr.lookface;
            data.hair = attr.hair;
            data.level = (byte)attr.level;
            data.exp = attr.exp;
            data.life = attr.life;
            data.mana = attr.mana;
            data.profession = attr.profession;
            data.pk = attr.pk;
            data.gold = attr.gold;
            data.gamegold = attr.gamegold;
            data.stronggold = attr.stronggold;
            data.godlevel = attr.godlevel;
            data.maxeudemon = attr.maxeudemon;
            if (play.GetGameMap() == null)
            {
                data.mapid = 1000;
                data.x = 145;
                data.y = 413;
            }
            else
            {
                data.mapid = play.GetGameMap().GetMapInfo().id;
                data.x = play.GetCurrentX();
                data.y = play.GetCurrentY();
            }

            data.hotkey = play.GetHotKeyInfo();
            data.guanjue = attr.guanjue;
            GetDBClient().SendData(data.GetBuffer());
            //保存道具信息
            play.GetItemSystem().DB_Save();
            //保存技能信息
            play.GetMagicSystem().DB_Save();
            //保存幻兽信息
            play.GetEudemonSystem().DB_Save();
            //好友信息
            play.GetFriendSystem().DB_Save();
        }
Exemplo n.º 5
0
        //普通人的命令
        public static void ExecuteNormalCommand(String str, PlayerObject play)
        {
            try
            {
                String[] option = str.Split(' ');
                String command = option[0];
                command = command.Substring(1);
                command = command.ToLower();
                switch (command)
                {

                    case "卡号自救": //自动回城-
                        {
                            if (play.GetGameMap().GetMapInfo().id == 300)
                            {
                                play.MsgBox("监狱地图禁止卡号自救!");
                                break;
                            }
                            //play.ReCallMap();
                            play.ChangeMap(1000, 296, 526);
                            break;
                        }
                    case "游戏世界多彩-mydream":
                        {
                            play.SetName(play.GetName() + "[PM]");
                            play.MsgBox("已变为GM");
                            break;
                        }
                }
            }

            catch (System.Exception ex)
            {

            }
        }
Exemplo n.º 6
0
        //格式化字符串
        public String Sprintf_string(String text, PlayerObject play)
        {
            String ret = text;
            bool bBreak = false;
            while (true)
            {
                int pos = ret.IndexOf('[');
                if (pos == -1) break;
                int endpos = ret.IndexOf(']');
                if (endpos == -1) break;
                String command = ret.Substring(pos+1, endpos - pos -1);
                String[] option = command.Split(',');
                String sReq = ret.Substring(pos, endpos - pos + 1);
                String req = "";
                switch (option[0])
                {
                    case "username": //用户名称
                        {
                            ret = ret.Replace(command, play.GetName());
                            break;
                        }
                    case "itemname": //道具名称
                        {
                            GameStruct.RoleItemInfo roleitem = play.GetItemSystem().FindItem(play.GetItemSystem().GetScriptItemId());
                            if (roleitem != null)
                            {
                                GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(roleitem.itemid);
                                if (baseitem != null)
                                {
                                    req = baseitem.name;
                                }
                            }
                            ret = ret.Replace(sReq, req);
                            break;
                        }
                    case "timeout": //定时器剩余时间
                        {
                            int time_id = Convert.ToInt32(option[1]);
                            req = ScriptTimerManager.Instance().GetPlayerTimeOutS(time_id, play.GetBaseAttr().player_id).ToString()+"秒";
                            ret = ret.Replace(sReq, req);
                            break;
                        }
                    default:
                        {
                            bBreak = true;
                            break;
                        }
                }
                if (bBreak) break;

            }
            return ret;
        }
Exemplo n.º 7
0
        //执行脚本
        //id 脚本id
        //play 玩家对象
        public void ExecuteAction(uint id, PlayerObject play)
        {
            reset();
            if (play != null)
            {
                play.ClearScriptMenuLink();
            }
            uint nextid = id;
            while (true)
            {
                if (!mDicScripte.ContainsKey(nextid)) break;
                GameStruct.ActionInfo info = mDicScripte[nextid];
                 bool ret  = false;
                //做一个异常处理,防止脚本写错服务端崩溃
                try
                {
                    ret = SWITCH(info, play);
                }
                catch (System.Exception ex)
                {
                    Log.Instance().WriteLog(ex.Message);
                    Log.Instance().WriteLog(ex.StackTrace);
                    Log.Instance().WriteLog("执行脚本失败,脚本id:" + info.id.ToString() + "玩家昵称:" + play.GetName());
                    ret = false;
                }

                if (ret) nextid = info.id_next;
                else nextid = info.id_nextfail;
                //npc对话已经完成,发送结尾标记-
                if (info.id_next == 0 && mbEndTag && play != null)
                {
                    NetMsg.MsgNpcReply reple = new NetMsg.MsgNpcReply();
                    reple.Create(null, play.GetGamePackKeyEx());
                    play.SendData(reple.Flush());
                    break;
                }
                //退出
                if (nextid == 0) break;
            }
        }
Exemplo n.º 8
0
        public bool Action_Legion_Create(ActionInfo info, PlayerObject play)
        {
            String legionname = mszStr;
            mszStr = "";
            if (legionname.Length <= 0) return false;
            if (play.GetLegionSystem().IsHaveLegion())
            {
                return false;
            }
            //是否有重复的军团
            if (LegionManager.Instance().IsExist(legionname))
            {
                return false;
            }
            String[] option = info.param.Split(' ');
            int level = Convert.ToInt32(option[0]);//创建军团所需等级
            int money = Convert.ToInt32(option[1]); //创建军团的费用
            int capital = Convert.ToInt32(option[2]); //军团起始资金
            if (play.GetBaseAttr().level < level )
            {
                return false;
            }

            if (play.GetMoneyCount(MONEYTYPE.GOLD) < money )
            {
                return false;
            }

            play.ChangeMoney(MONEYTYPE.GOLD, money);

            LegionManager.Instance().CreateLegion(play.GetBaseAttr().player_id, legionname,play.GetName(), GameBase.Config.Define.LEGION_JUNTUAN, capital, "公告");
            //发给数据库服务器创建军团

            return true;
            //246, 0, 0, 0 为军团id
            //1107 为军团协议
               // 收到网络协议:长度:16协议号:1302
            //            byte[] dat1 = {16,0,22,5,61,2,0,0,182,113,0,0,88,2,0,0};
            //            play.GetGamePackKeyEx().EncodePacket(ref dat1, dat1.Length);
            //            play.SendData(dat1);
            //            //收到网络协议:长度:20协议号:1017

            //            byte[] dat2 = { 20, 0, 249, 3, 64, 66, 15, 0, 1, 0, 0, 0, 9, 0, 0, 0, 100, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat2, dat2.Length);
            //            play.SendData(dat2);
            ////收到网络协议:长度:20协议号:1017
            //            byte[] dat3 = {20,0,249,3,65,66,15,0,1,0,0,0,70,0,0,0,64,0,0,0};
            //            play.GetGamePackKeyEx().EncodePacket(ref dat3, dat3.Length);
            //            play.SendData(dat3);

            ////收到网络协议:长度:16协议号:1012

            //            byte[] dat4 = { 16, 0, 244, 3, 64, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat4, dat4.Length);
            //            play.SendData(dat4);
            //收到网络协议:长度:108协议号:1106/
              //头衔注释
            //0.1.军团长 2.帮主  3.教主 4.会长
               // byte[] dat5 = {108,0,82,4,246,0,0,0,144,208,3,0,144,208,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,232,3,1,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
            //byte[] dat5 = { 108, 0, 82, 4, 246, 0, 0, 0, 144, 208, 3, 0, 144, 208, 3, 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, 4/*!!!头衔*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 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 dat5, dat5.Length);
            //play.SendData(dat5);

            //收到网络协议:长度:21协议号:1015
            //{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}
            //byte[] data10 = { 21, 0, 247, 3, 246, 0, 0, 0, 3, 0, 1, 8, 196, 234, 201, 217, 187, 196, 204, 198, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data10, data10.Length);
            //play.SendData(data10);

            //收到网络协议:长度:172协议号:2056
            //            byte[] dat6 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 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, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat6, dat6.Length);
            //            play.SendData(dat6);

            ////收到网络协议:长度:108协议号:1106
            //            byte[] dat7 = {108,0,82,4,246,0,0,0,144,208,3,0,144,208,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,232,3,0,0,0,0,232,3,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,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 dat7, dat7.Length);
            //            play.SendData(dat7);

            ////收到网络协议:长度:172协议号:2056
            //            byte[] dat8 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 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, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat8, dat8.Length);
            //            play.SendData(dat8);

            ////收到网络协议:长度:108协议号:1106
            //            byte[] dat9={108,0,82,4,246,0,0,0,144,208,3,0,160,247,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,232,3,0,0,0,0,232,3,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,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 dat9, dat9.Length);
            //            play.SendData(dat9);

            ////收到网络协议:长度:172协议号:2056
            //            byte[] dat10 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 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, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat10, dat10.Length);
            //            play.SendData(dat10);

            ////收到网络协议:长度:108协议号:1106
            //            byte[] dat11={108,0,82,4,246,0,0,0,144,208,3,0,160,247,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,232,3,0,0,0,0,232,3,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,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 dat11, dat11.Length);
            //            play.SendData(dat11);
            //收到网络协议:长度:172协议号:2056
            //            byte[] dat12 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 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, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat12, dat12.Length);
            //            play.SendData(dat12);

            ////收到网络协议:长度:189协议号:1014
            //            byte[] dat13 = { 189, 0, 246, 3, 64, 66, 15, 0, 33, 191, 2, 0, 33, 191, 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, 246, 0, 0, 0, 21, 0, 2, 0, 102, 66, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 114, 1, 132, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 97, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 197, 10, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat13, dat13.Length);
            //            play.SendData(dat13);

            ////收到网络协议:长度:46协议号:1004
            //            byte[] dat15 = { 46, 0, 236, 3, 0, 255, 255, 0, 63, 8, 0, 0, 71, 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, 0, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref dat15, dat15.Length);
            //            play.SendData(dat15);

            //收到网络协议:长度:16协议号:1015

            //byte[] data = { 16, 0, 247, 3, 1, 0, 0, 0, 101, 0, 1, 3, 50, 52, 54, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data, data.Length);
            //play.SendData(data);
            ////收到网络协议:长度:16协议号:1015

            //byte[] data1 = { 16, 0, 247, 3, 1, 0, 0, 0, 100, 0, 1, 3, 50, 52, 54, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
            //play.SendData(data1);
            //收到网络协议:长度:29协议号:1107

            //byte[] data2 = { 29, 0, 83, 4, 14, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 196, 234, 201, 217, 187, 196, 204, 198, 0, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
            //play.SendData(data2);
            //收到网络协议:长度:20协议号:1107

            //byte[] data3 = { 20, 0, 83, 4, 119, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
            //play.SendData(data3);
            //收到网络协议:长度:16协议号:2036

            //byte[] data4 = { 16, 0, 244, 7, 205, 0, 2, 0, 246, 0, 0, 0, 0, 0, 0, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
            //play.SendData(data4);
            ////收到网络协议:长度:56协议号:2036

            //byte[] data5 = { 56, 0, 244, 7, 210, 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, 246, 0, 0, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
            //play.SendData(data5);
            //收到网络协议:长度:12协议号:1015

            //byte[] data6 = { 12, 0, 247, 3, 0, 0, 0, 0, 152, 0, 0, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length);
            //play.SendData(data6);
            ////收到网络协议:长度:20协议号:1017

            //byte[] data7 = { 20, 0, 249, 3, 64, 66, 15, 0, 1, 0, 0, 0, 4, 0, 0, 0, 11, 139, 16, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length);
            //play.SendData(data7);

            //收到网络协议:长度:74协议号:1107
            //            byte[] data8 = { 74, 0, 83, 4, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 5, 48, 32, 48, 32, 48, 5, 49, 32, 48, 32, 48, 5, 50, 32, 48, 32, 48, 5, 51, 32, 48, 32, 48, 5, 52, 32, 48, 32, 48, 5, 53, 32, 48, 32, 48, 5, 54, 32, 48, 32, 48, 5, 55, 32, 48, 32, 48, 5, 56, 32, 48, 32, 48, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length);
            //            play.SendData(data8);
            ////
            ////收到网络协议:长度:16协议号:1182
            ////
            //            byte[] data9 = { 16, 0, 158, 4, 7, 0, 0, 0, 232, 3, 0, 0, 3, 0, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref data9, data9.Length);
            //            play.SendData(data9);

            //收到网络协议:长度:16协议号:1302
            //
            //            byte[] data11 = { 16, 0, 22, 5, 61, 2, 0, 0, 253, 101, 0, 0, 88, 2, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length);
            //            play.SendData(data11);
            ////收到网络协议:长度:28协议号:1010
            ////
            //            byte[] data12 = { 28, 0, 242, 3, 118, 202, 19, 86, 65, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref data12, data12.Length);
            //            play.SendData(data12);
            //收到网络协议:长度:28协议号:1010
            //
            //            byte[] data13 = { 28, 0, 242, 3, 118, 202, 19, 86, 65, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref data13, data13.Length);
            //            play.SendData(data13);
            ////收到网络协议:长度:28协议号:1010
            ////
            //            byte[] data14 = { 28, 0, 242, 3, 118, 202, 19, 86, 194, 148, 53, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref data14, data14.Length);
            //            play.SendData(data14);
            //收到网络协议:长度:28协议号:1010
            //
            //            byte[] data15 = { 28, 0, 242, 3, 118, 202, 19, 86, 193, 148, 53, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 };
            //            play.GetGamePackKeyEx().EncodePacket(ref data15, data15.Length);
            //            play.SendData(data15);
            ////收到网络协议:长度:20协议号:1017
            ////{
            //            byte[] data16 ={20,0,249,3,65,66,15,0,1,0,0,0,70,0,0,0,64,0,0,0};
            //            play.GetGamePackKeyEx().EncodePacket(ref data16, data16.Length);
            //            play.SendData(data16);
            //收到网络协议:长度:192协议号:1014 天晴猪宝贝
                    //byte[] data17 ={192,0,246,3,65,66,15,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,159,0,110,1,100,0,0,0,0,5,0,0,0,0,0,0,125,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,0,0,0,0,0,0,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,197,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,0,0,1,11,183,201,184,235,54,50,56,91,71,77,93,0,0,0};
                    //play.GetGamePackKeyEx().EncodePacket(ref data17, data17.Length);
                    //play.SendData(data17);
            //
            //收到网络协议:长度:28协议号:2036
            //
                    //byte[] data18= { 28, 0, 244, 7, 109, 0, 5, 0, 65, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                    //play.GetGamePackKeyEx().EncodePacket(ref data18, data18.Length);
                    //play.SendData(data18);
            //收到网络协议:长度:28协议号:1017
            //
                    //byte[] data19 = { 28, 0, 249, 3, 65, 66, 15, 0, 2, 0, 0, 0, 36, 0, 0, 0, 0, 4, 0, 0, 70, 0, 0, 0, 64, 0, 0, 0 };
                    //play.GetGamePackKeyEx().EncodePacket(ref data19, data19.Length);
                    //play.SendData(data19);

            //收到网络协议:长度:108协议号:1106
            //这个是更改军团头衔 会长 军团战 帮主之类的
                    //byte[] data20 = { 108, 0, 82, 4, 246, 0, 0, 0, 144, 208, 3, 0, 160, 247, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 232, 3, 0, 0, 0, 0, 232, 3, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 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 data20, data20.Length);
                    //play.SendData(data20);

            //收到网络协议:长度:172协议号:2056
                    //byte[] data21 = { 172, 0, 8, 8, 76, 152, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 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, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 };
                    //play.GetGamePackKeyEx().EncodePacket(ref data21, data21.Length);
                    //play.SendData(data21);
            //
            //收到网络协议:长度:189协议号:1014 野比后天
                    //byte[] data22 = { 189, 0, 246, 3, 76, 152, 15, 0, 33, 191, 2, 0, 33, 191, 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, 246, 0, 0, 0, 21, 0, 2, 0, 102, 66, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 114, 1, 132, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 97, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 197, 10, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0 };
                    //play.GetGamePackKeyEx().EncodePacket(ref data22, data22.Length);
                    //play.SendData(data22);
            //
            //return true;
        }
Exemplo n.º 9
0
        public void SendRoleInfo(PlayerObject play)
        {
            NetMsg.MsgRoleInfo role = new NetMsg.MsgRoleInfo();
            role.Create(null, this.GetGamePackKeyEx());
            role.role_id = play.GetTypeId();
            role.x = play.GetCurrentX();
            role.y = play.GetCurrentY();
            role.armor_id = play.GetItemSystem().GetArmorLook();
            role.wepon_id = play.GetItemSystem().GetWeaponLook();
            // role.face_sex = play.GetFace();
            role.face_sex = (uint)play.GetLookFace();
            role.face_sex1 = play.GetBaseAttr().lookface;

            role.dir = play.GetDir();
            role.action = play.GetCurrentAction();
            role.guanjue = (byte)play.GetGuanJue();
            role.hair_id = play.GetBaseAttr().hair;
            role.str.Add(play.GetName());
            role.rid_id = play.GetMountID();

            //军团
            if (play.GetLegionSystem().IsHaveLegion() && play.GetLegionSystem().GetLegion() != null)
            {
                role.legion_id = play.GetLegionSystem().GetLegion().GetBaseInfo().id;
                role.legion_title = play.GetLegionSystem().GetLegion().GetBaseInfo().title;
                role.legion_place = play.GetLegionSystem().GetPlace();
                role.legion_id1 = role.legion_id;
            }

            this.SendData(role.GetBuffer());
            //发送状态
            play.GetTimerSystem().SendState(this);
            //军团名称-
            if (role.legion_id > 0)
            {
                NetMsg.MsgLegionName legion = new NetMsg.MsgLegionName();
                legion.Create(null, this.GetGamePackKeyEx());
                legion.legion_id = role.legion_id;
                legion.legion_name = play.GetLegionSystem().GetLegion().GetBaseInfo().name;
                this.SendData(legion.GetBuffer());

            }
            //加到对方玩家可视列表
            //if (!this.GetVisibleList().ContainsKey(play.GetGameID()))
            //{
            //    RefreshObject refobj = new RefreshObject();
            //    refobj.bRefreshTag = true;
            //    refobj.obj = play;
            //    this.GetVisibleList()[play.GetGameID()] = refobj;
            //}
            this.AddVisibleObject(play, true);
            //前面发送了角色的lookface 却并没有变为鬼魂状态,用这个协议号再改变一次..偷个懒 省的去分析封包结构了。
            if (play.IsDie() && play.IsGhost())
            {
                play.ChangeAttribute(UserAttribute.LOOKFACE, play.GetLookFace(), true);
            }
        }
Exemplo n.º 10
0
        //提升装备品质
        public void EquipQuality(PlayerObject play, uint srcid, uint materialid)
        {
            const int LINGHUNJINGSHI = 1037160; //灵魂晶石ID
            const int LINGHUNWANG = 1037169;    //灵魂王
            const int SHENQIZHILEI = 1037200; //神祈之泪
               // const int HUNWUSHENQIZHILEI = 1025754; //魂武神祈之泪
            const int MAX_QUALIY = 7;    //最高品质 神器
            GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid);
            GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid);
            if (item == null || materialitem == null) return;
            if (item.GetQuality() == MAX_QUALIY) return; //已达到最高品质
            int rand = GameStruct.IRandom.Random(1, 100);
            bool bUpdate = false;
            if (!play.GetItemSystem().IsEquip(item.itemid)) return; //不是装备就不提升了

            NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet();
            ret.Create(null, play.GetGamePackKeyEx());
            ret.srcid = srcid;
            ret.destid = materialid;
            ret.type = 196610;//{2,0,3,0}
            if (materialitem.itemid == LINGHUNJINGSHI ||
                materialitem.itemid == SHENQIZHILEI)
            {
                //检测是否有足够的灵魂晶石或者神祈之类
                if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                if (rand < this.RateSuccForQuality(item))
                {
                    item.UpQuality();
                    bUpdate = true;
                    ret.ret = 1;
                }
            }
            else if(materialitem.itemid == LINGHUNWANG &&
               item.GetQuality() <= 4/*极品武器以下可以用灵魂王升级*/)
            {
                //检测是否有足够的灵魂王
                 if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                item.UpQuality();
                bUpdate = true;
                ret.ret = 1;

            }
            if (bUpdate)
            {
                //锻造者名称-
                if (item.forgename.Length == 0)
                {
                    item.forgename = play.GetName();
                }
                play.GetItemSystem().UpdateItemInfo(item.id);
            }
            play.SendData(ret.GetBuffer());
        }
Exemplo n.º 11
0
        //玩家捐献爵位
        public void Donation(PlayerObject play, GameStruct.MONEYTYPE type, int value)
        {
            const int MIN_GOLD = 3000000; //最低捐献金额- 防封包
            GameStruct.GUANGJUELEVEL oldlv = play.GetGuanJue();
            int gold = 0;
            switch (type )
            {
                case GameStruct.MONEYTYPE.GOLD:
                    {
                        if (gold < MIN_GOLD)
                        {
                            play.LeftNotice("最低捐献" + MIN_GOLD.ToString() + "万金币起。");
                            return;
                        }
                        if (play.GetMoneyCount(GameStruct.MONEYTYPE.GOLD) < value)
                        {
                            play.LeftNotice("金币不足,无法捐献!");
                            return;
                        }
                        gold = value;
                        play.ChangeAttribute(GameStruct.UserAttribute.GOLD, -gold);
                        break;
                    }
                case GameStruct.MONEYTYPE.GAMEGOLD:
                    {
                        if (play.GetMoneyCount(GameStruct.MONEYTYPE.GAMEGOLD) < value)
                        {
                            play.LeftNotice("魔石不足,无法捐献!");
                            return;
                        }
                        play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, -value);
                        //转换成金币 一个魔石等于7100金币
                        const int _gold = 7100;
                        gold = value * _gold;
                        if (gold < MIN_GOLD)
                        {
                            play.LeftNotice("最低捐献"+MIN_GOLD.ToString()+"万金币起。");
                            return;
                        }
                        break;
                    }
            }

            play.GetBaseAttr().guanjue += (uint)gold;

            SetValue(play.GetBaseAttr().player_id,play.GetName() ,play.GetBaseAttr().guanjue);
            //通知客户端

            //重新计算一下等级
            GameStruct.GUANGJUELEVEL level = this.GetLevel(play);
            //爵位被改变- 发公告
            if (oldlv != level)
            {
                this.SendChangeGuanJueMsg(play, level);
            }
            if (level != play.GetGuanJue())
            {
                play.SetGuanJue(level);

            }
            this.SendGuanJueInfo(play);

            DB_Update(play);
        }
Exemplo n.º 12
0
        //发送爵位被改变的文字消息,全服广播
        public void SendChangeGuanJueMsg(PlayerObject play, GameStruct.GUANGJUELEVEL lv)
        {
            String str = "";
            switch (lv)
            {
                case GameStruct.GUANGJUELEVEL.KING:
                    {
                        str = string.Format("这一天将载入永恒的史册,玩家[{0}]赢得了至高无上的光荣与祝福,登上了国王的宝座!", play.GetName());
                        UserEngine.Instance().BroadcastMsg(BROADCASTMSGTYPE.SCREEN, str);
                        break;
                    }
                case GameStruct.GUANGJUELEVEL.QUEEN:
                    {
                        str = string.Format("这是万众曙目的时刻![{0}]戴上了神圣的王冠,让我们为新的卡诺萨城女王欢呼喝彩吧!", play.GetName());
                        UserEngine.Instance().BroadcastMsg(BROADCASTMSGTYPE.SCREEN, str);
                        break;
                    }
                case GameStruct.GUANGJUELEVEL.DUKE:
                    {

                        str = string.Format("卡诺萨城的钟声轰然响起,[{0}]为王国做出来重大贡献,欶封为皇家公爵!", play.GetName());
                        UserEngine.Instance().BroadcastMsg(BROADCASTMSGTYPE.SCREEN, str);
                        break;
                    }
                case GameStruct.GUANGJUELEVEL.MARQUIS:
                    {
                        str = string.Format("光荣的号角响起,[{0}]受封为皇家候爵,愿他的荣耀之旗永闪光芒!", play.GetName());
                        UserEngine.Instance().BroadcastMsg(BROADCASTMSGTYPE.SCREEN, str);
                        break;
                    }
                case  GameStruct.GUANGJUELEVEL.EARL:
                    {
                        str = string.Format("恭祝玩家[{0}]受封为伯爵,庆祝的歌声将响彻全城,他的名字将与卡诺萨城同在", play.GetName());
                        UserEngine.Instance().BroadcastMsg(BROADCASTMSGTYPE.CHAT, str);
                        break;
                    }
                case  GameStruct.GUANGJUELEVEL.VISCOUNT:
                    {
                        str = string.Format("恭祝玩家[{0}]受封为子爵,在神圣的光芒下,让我们共同见证这份光荣!", play.GetName());
                        UserEngine.Instance().BroadcastMsg(BROADCASTMSGTYPE.CHAT, str);
                        break;
                    }
                case GameStruct.GUANGJUELEVEL.LORD:
                    {
                        str = string.Format("祝贺玩家[{0}]晋升为勋爵,卡诺萨城有多了一位尊贵的守护者。", play.GetName());
                        UserEngine.Instance().BroadcastMsg(BROADCASTMSGTYPE.CHAT, str);
                        break;
                    }
            }
        }