Esempio n. 1
0
        public void SendFriendInfo(RoleData_Friend info, byte type = NetMsg.MsgFriendInfo.TYPE_FRIEND)
        {
            NetMsg.MsgFriendInfo data = new NetMsg.MsgFriendInfo();
            data.Create(null, play.GetGamePackKeyEx());
            data.playerid = info.friendid;
            data.type     = type;
            data.name     = info.friendname;
            PlayerObject obj = UserEngine.Instance().FindPlayerObjectToPlayerId((int)info.friendid);

            if (obj != null)
            {
                data.Online     = 1;
                data.level      = obj.GetBaseAttr().level;
                data.fightpower = (uint)obj.GetFightSoul();
            }
            play.SendData(data.GetBuffer());
        }
Esempio n. 2
0
 //广播所有好友信息
 public void BrocatMsg(byte type)
 {
     for (int i = 0; i < mList.Count; i++)
     {
         PlayerObject obj = UserEngine.Instance().FindPlayerObjectToPlayerId((int)mList[i].friendid);
         if (obj != null)
         {
             NetMsg.MsgFriendInfo data = new NetMsg.MsgFriendInfo();
             data.Create(null, obj.GetGamePackKeyEx());
             data.fightpower = (uint)play.GetFightSoul();
             data.level      = play.GetBaseAttr().level;
             data.playerid   = (uint)play.GetBaseAttr().player_id;
             data.name       = play.GetName();
             data.type       = type;
             obj.SendData(data.GetBuffer());
         }
     }
 }
Esempio n. 3
0
        //请求加为好友
        public void RequestAddFriend(NetMsg.MsgFriendInfo info)
        {
            PlayerObject target = UserEngine.Instance().FindPlayerObjectToTypeID(info.playerid);

            if (target == null)
            {
                play.LeftNotice("对方已离线,无法添加好友!");
                return;
            }
            if (mList.Count >= MAX_FRIEND_COUNT)
            {
                play.LeftNotice("阁下好友人数已满,无法再次添加!");
                return;
            }
            for (int i = 0; i < mList.Count; i++)
            {
                if (mList[i].friendid == target.GetBaseAttr().player_id)
                {
                    play.ChatNotice(string.Format("{0}已经是你的好友了!", mList[i].friendname));
                    return;
                }
            }
            //发给被请求玩家
            NetMsg.MsgFriendInfo data = new NetMsg.MsgFriendInfo();
            data.Create(null, target.GetGamePackKeyEx());
            data.playerid   = (uint)play.GetBaseAttr().player_id;
            data.fightpower = (uint)play.GetFightSoul();
            data.type       = NetMsg.MsgFriendInfo.TYPE_ADDFRIEND;
            data.Online     = 1;
            data.level      = play.GetBaseAttr().level;
            data.name       = play.GetName();
            target.SendData(data.GetBuffer());
            // target.GetFriendSystem().SetFriendTarget(play.GetTypeId()) ;
            play.LeftNotice("已经发送结为好友的请求");
            target.LeftNotice(string.Format("血与火的洗礼证明了坚固的友谊,{0}对你报以信任的眼神,你是否接受?", play.GetName()));
        }
Esempio n. 4
0
 //广播所有好友信息
 public void BrocatMsg(byte type)
 {
     for (int i = 0; i < mList.Count; i++)
     {
         PlayerObject obj = UserEngine.Instance().FindPlayerObjectToPlayerId((int)mList[i].friendid);
         if (obj != null)
         {
             NetMsg.MsgFriendInfo data = new NetMsg.MsgFriendInfo();
             data.Create(null, obj.GetGamePackKeyEx());
             data.fightpower = (uint)play.GetFightSoul();
             data.level = play.GetBaseAttr().level;
             data.playerid = (uint)play.GetBaseAttr().player_id;
             data.name = play.GetName();
             data.type = type;
             obj.SendData(data.GetBuffer());
         }
     }
 }
Esempio n. 5
0
 public void SendFriendInfo(RoleData_Friend info, byte type = NetMsg.MsgFriendInfo.TYPE_FRIEND)
 {
     NetMsg.MsgFriendInfo data = new NetMsg.MsgFriendInfo();
     data.Create(null, play.GetGamePackKeyEx());
     data.playerid = info.friendid;
     data.type = type;
     data.name = info.friendname;
     PlayerObject obj = UserEngine.Instance().FindPlayerObjectToPlayerId((int)info.friendid);
     if (obj != null)
     {
         data.Online = 1;
         data.level = obj.GetBaseAttr().level;
         data.fightpower = (uint)obj.GetFightSoul();
     }
     play.SendData(data.GetBuffer());
 }
Esempio n. 6
0
 //请求加为好友
 public void RequestAddFriend(NetMsg.MsgFriendInfo info)
 {
     PlayerObject target = UserEngine.Instance().FindPlayerObjectToTypeID(info.playerid);
     if (target == null)
     {
         play.LeftNotice("对方已离线,无法添加好友!");
         return;
     }
     if (mList.Count >= MAX_FRIEND_COUNT)
     {
         play.LeftNotice("阁下好友人数已满,无法再次添加!");
         return;
     }
     for (int i = 0; i < mList.Count; i++)
     {
         if (mList[i].friendid == target.GetBaseAttr().player_id)
         {
             play.ChatNotice(string.Format("{0}已经是你的好友了!", mList[i].friendname));
             return;
         }
     }
     //发给被请求玩家
     NetMsg.MsgFriendInfo data = new NetMsg.MsgFriendInfo();
     data.Create(null, target.GetGamePackKeyEx());
     data.playerid = (uint)play.GetBaseAttr().player_id;
     data.fightpower = (uint)play.GetFightSoul();
     data.type = NetMsg.MsgFriendInfo.TYPE_ADDFRIEND;
     data.Online = 1;
     data.level = play.GetBaseAttr().level;
     data.name = play.GetName();
     target.SendData(data.GetBuffer());
        // target.GetFriendSystem().SetFriendTarget(play.GetTypeId()) ;
     play.LeftNotice("已经发送结为好友的请求");
     target.LeftNotice(string.Format("血与火的洗礼证明了坚固的友谊,{0}对你报以信任的眼神,你是否接受?", play.GetName()));
 }