MapServer.PlayerObject.GetLookFace C# (CSharp) Method

GetLookFace() public method

public GetLookFace ( ) : int
return int
        public int GetLookFace()
        {
            int ret = (int)GetBaseAttr().lookface;
            const int LOOK_MALEGHOST = 98;
            const int LOOK_FEMALEGHOST = 99;
            const int MASK_CHANGELOOK = 10000000;						// 变身时LOCKFACE的掩码,face=face + new_face*10000000
            if (IsGhost())
            {
                if (this.GetSex() == Sex.MAN)
                {
                    ret = (int)GetBaseAttr().lookface + MASK_CHANGELOOK * LOOK_MALEGHOST;
                    return ret;
                }
                else
                {
                    ret = (int)GetBaseAttr().lookface + MASK_CHANGELOOK * LOOK_FEMALEGHOST;
                    return ret;
                }
            }
            return ret;
        }

Usage Example

Example #1
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);
            }
        }