internal void PacketItem_UserEquip(CObject_Item item)
        {
            if (item == null)
            {
                return;
            }
            //摆摊时不可以随便换装
            //...TODO

            //验证是否可以使用
            if (!item.Rule(ITEM_RULE.RULE_USE))
            {
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, item.RuleFailMessage(ITEM_RULE.RULE_USE));
                return;
            }

            CCharacterData pCharData = CObjectManager.Instance.getPlayerMySelf().GetCharacterData();

            if (pCharData == null)
            {
                LogManager.LogError("playerMyself's charData is null.");
                return;
            }
            int needLevel   = item.GetNeedLevel();
            int playerLevel = pCharData.Get_Level();

            if (playerLevel < needLevel)
            {
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "等级不够");

                return;
            }
            //是否鉴定
            if (((CObject_Item_Equip)item).GetEquipQuantity() == EQUIP_QUALITY.BLUE_EQUIP &&
                ((CObject_Item_Equip)item).GetEquipAttrib() == EQUIP_ATTRIB.EQUIP_ATTRIB_UNIDENTIFY)
            {
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "此物品需要鉴定");
                return;
            }

            //取得详细信息
            string szExtraInfo = item.GetExtraDesc();

            //如果没有详细信息,从服务器上请求详细信息
            if (szExtraInfo == "")
            {
                CDataPool.Instance.UserBag_AskExtraInfo(item.PosIndex);
            }

            CGUseEquip msg = new CGUseEquip();

            msg.BagIndex = (byte)item.PosIndex;
            NetManager.GetNetManager().SendPacket(msg);
        }
示例#2
0
    // 得到自己的队伍信息(从自己的数据池获取)
    void FillMyInfo(TeamMemberInfo member)
    {
        if (member == null)
        {
            throw new NullReferenceException("team member in FillMyInfo(member)");
        }

        CObject_PlayerMySelf pMe = CObjectManager.Instance.getPlayerMySelf();

        CCharacterData pMyData = pMe.GetCharacterData();

        if (null == pMyData)
        {
            return;
        }
        member.m_szNick        = pMyData.Get_Name();
        member.m_uFamily       = pMyData.Get_MenPai();
        member.m_uDataID       = pMyData.Get_RaceID();
        member.m_uLevel        = pMyData.Get_Level();
        member.m_nPortrait     = pMyData.Get_PortraitID();
        member.m_WorldPos.m_fX = pMe.GetPosition().x;
        member.m_WorldPos.m_fZ = pMe.GetPosition().z;
        member.m_nHP           = pMyData.Get_HP();
        member.m_dwMaxHP       = pMyData.Get_MaxHP();
        member.m_nMP           = pMyData.Get_MP();
        member.m_dwMaxMP       = pMyData.Get_MaxMP();
        member.m_nAnger        = 100; // 客户端没有
        member.m_WeaponID      = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_WEAPON);
        member.m_CapID         = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_CAP);
        member.m_ArmourID      = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_ARMOR);
        member.m_CuffID        = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_CUFF);
        member.m_FootID        = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_BOOT);
        member.m_uBackID       = pMyData.Get_Equip(HUMAN_EQUIP.HEQUIP_BACK);//  [8/30/2010 Sun]
        member.m_bDead         = (pMe.CharacterLogic_Get() == ENUM_CHARACTER_LOGIC.CHARACTER_LOGIC_DEAD);

        member.m_uFaceMeshID = pMyData.Get_FaceMesh();
        member.m_uHairMeshID = pMyData.Get_HairMesh();
        member.m_uHairColor  = pMyData.Get_HairColor();
    }
        public string GetData(string typeName)
        {
            if (CObjectManager.Instance.getPlayerMySelf() == null)
            {
                return("");
            }

            CCharacterData pCharData = CObjectManager.Instance.getPlayerMySelf().GetCharacterData();

            if (typeName == "LEVEL")      //等级
            {
                return(pCharData.Get_Level().ToString());
            }
            else if (typeName == "HP") //生命值
            {
                return(pCharData.Get_HP().ToString());
            }
            else if (typeName == "MP") //魔法值
            {
                return(pCharData.Get_MP().ToString());
            }
            else if (typeName == "MENPAI")  //门派
            {
                return(pCharData.Get_MenPai().ToString());
            }
            else if (typeName == "AMBIT") //境界名称
            {
                return(pCharData.Get_Ambit().ToString());
            }
            else if (typeName == "PORTRAIT") //头像
            {
                //得到玩家和自己的头像
                string pImageName = "";
                //打开生物定义表
                _DBC_CHAR_FACE pFaceImage = CDataBaseSystem.Instance.GetDataBase <_DBC_CHAR_FACE>((int)DataBaseStruct.DBC_CHAR_FACE).Search_Index_EQU(pCharData.Get_PortraitID());

                if (pFaceImage != null)
                {
                    pImageName = pFaceImage.pImageSetName;
                }

                //else // 默认状态不显示头像图标, 头像图标显示空
                //{
                //	pFaceImage = (const _DBC_CHAR_FACE*)(s_pFaceImageDBC->Search_LineNum_EQU(0));
                //	pImageName = pFaceImage->pImageSetName;
                //}//

                return(pImageName);
            }
            else if (typeName == "STR") //力量 力量 金
            {                           //基础值
                return((pCharData.Get_STR() - pCharData.Get_BringSTR()).ToString());
            }
            else if (typeName == "SPR") //灵气 灵力 木
            {
                return((pCharData.Get_SPR() - pCharData.Get_BringSPR()).ToString());
            }
            else if (typeName == "CON") //体制 体制 水
            {
                return((pCharData.Get_CON() - pCharData.Get_BringCON()).ToString());
            }
            else if (typeName == "INT") //定力 智力 火
            {
                return((pCharData.Get_INT() - pCharData.Get_BringINT()).ToString());
            }
            else if (typeName == "DEX") //身法 敏捷 土
            {
                return((pCharData.Get_DEX() - pCharData.Get_BringDEX()).ToString());
            }
            else if (typeName == "BRING_STR")
            {
                return(pCharData.Get_BringSTR().ToString());
            }
            else if (typeName == "BRING_SPR")
            {
                return(pCharData.Get_BringSPR().ToString());
            }
            else if (typeName == "BRING_CON")
            {
                return(pCharData.Get_BringCON().ToString());
            }
            else if (typeName == "BRING_INT")
            {
                return(pCharData.Get_BringINT().ToString());
            }
            else if (typeName == "BRING_DEX")
            {
                return(pCharData.Get_BringDEX().ToString());
            }
            else if (typeName == "ATT_PHYSICS")                 //物理攻击力
            {
                return(pCharData.Get_AttPhysics().ToString());
            }
            else if (typeName == "ATT_MAGIC")                           // 魔法攻击力 [7/16/2011 ivan edit]
            {
                return(pCharData.Get_AttMagic().ToString());
            }
            else if (typeName == "DEF_PHYSICS")                 //物理防御力
            {
                return(pCharData.Get_DefPhysics().ToString());
            }
            else if (typeName == "DEF_MAGIC")                           //魔法防御力
            {
                return(pCharData.Get_DefMagic().ToString());
            }
            else if (typeName == "HIT")                                 //命中率
            {
                return(pCharData.Get_Hit().ToString());
            }
            else if (typeName == "MISS")                                //闪避率
            {
                return(pCharData.Get_Miss().ToString());
            }
            else if (typeName == "CRITRATE")                            //会心率
            {
                return(pCharData.Get_CritRate().ToString());
            }
            else if (typeName == "DEFCRITRATE")                 // 会心防御 [12/24/2010 ivan edit]
            {
                return(pCharData.Get_DefCritRate().ToString());
            }
            else if (typeName == "MAXHP")   //最大生命值
            {
                return(pCharData.Get_MaxHP().ToString());
            }
            else if (typeName == "MAXMP") //最大魔法值
            {
                return(pCharData.Get_MaxMP().ToString());
            }

            return("0");
        }