Пример #1
0
    void ExpWashShenQi()
    {
        if (m_ShenQiItem == null)
        {
            GUIData.AddNotifyData2Client(false, "#{4966}");
            return;
        }
        if (m_ShenQiItem.IsValid() == false)
        {
            GUIData.AddNotifyData2Client(false, "#{4966}");
            return;
        }
        Tab_ShenQiInfo _ShenQiInfo = TableManager.GetShenQiInfoByID(m_ShenQiItem.DataID, 0);

        if (_ShenQiInfo == null)
        {
            GUIData.AddNotifyData2Client(false, "#{4966}");
            return;
        }
        //经验是否充足
        if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Exp < _ShenQiInfo.ExpCostNum)
        {
            GUIData.AddNotifyData2Client(false, "#{4999}");
            return;
        }
        //是否需要消耗物品
        if (_ShenQiInfo.ExpCostItemId != -1)
        {
            if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(_ShenQiInfo.ExpCostItemId) < _ShenQiInfo.ExpCostItemNum)
            {
                GUIData.AddNotifyData2Client(false, "#{4951}");
                return;
            }
        }
        //锁定的物品是否够
        if (m_nLockNum > 0)
        {
            if (m_nLockNum >= _ShenQiInfo.MaxAttrNum)
            {
                GUIData.AddNotifyData2Client(false, "#{5157}");
                return;
            }
            if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(_ShenQiInfo.LockNeedItemId) < _ShenQiInfo.LockNeedItemNum * m_nLockNum)
            {
                GUIData.AddNotifyData2Client(false, "#{4961}");
                return;
            }
        }
        //发包升级
        CG_SHENQI_WASHATTR packet = (CG_SHENQI_WASHATTR)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SHENQI_WASHATTR);

        packet.ShenqiGuid = m_ShenQiItem.Guid;
        packet.WashType   = (int)CG_SHENQI_WASHATTR.WASHTYPE.WASH_EXP;
        if (m_nLockNum > 0)
        {
            packet.IsLockAttr1 = (m_AttrToggle[0].value == true ? 1 : 0);
            packet.IsLockAttr2 = (m_AttrToggle[1].value == true ? 1 : 0);
            packet.IsLockAttr3 = (m_AttrToggle[2].value == true ? 1 : 0);
        }
        packet.SendPacket();
        m_nLastWastType = (int)CG_SHENQI_WASHATTR.WASHTYPE.WASH_EXP;
        if (null != GameManager.gameManager)
        {
            GameManager.gameManager.SoundManager.PlaySoundEffect(28);
        }
    }
Пример #2
0
    void YBWashShenQi()
    {
        if (m_ShenQiItem == null)
        {
            GUIData.AddNotifyData2Client(false, "#{4966}");
            return;
        }
        if (m_ShenQiItem.IsValid() == false)
        {
            GUIData.AddNotifyData2Client(false, "#{4966}");
            return;
        }
        Tab_ShenQiInfo _ShenQiInfo = TableManager.GetShenQiInfoByID(m_ShenQiItem.DataID, 0);

        if (_ShenQiInfo == null)
        {
            GUIData.AddNotifyData2Client(false, "#{4966}");
            return;
        }
        //元宝是否充足
        if (GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBao() < _ShenQiInfo.YBCostMoney)
        {
            // 元宝不足
            MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{1848}"), "", BuyChargeOK, BuyChargeCancel);
            return;
        }
        //是否需要消耗物品
        if (_ShenQiInfo.YBCostItemId != -1)
        {
            if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(_ShenQiInfo.YBCostItemId) < _ShenQiInfo.YBCostItemNum)
            {
                GUIData.AddNotifyData2Client(false, "#{4951}");
                return;
            }
        }
        //锁定的物品是否够
        if (m_nLockNum > 0)
        {
            if (m_nLockNum >= _ShenQiInfo.MaxAttrNum)
            {
                GUIData.AddNotifyData2Client(false, "#{5157}");
                return;
            }
            if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(_ShenQiInfo.LockNeedItemId) < _ShenQiInfo.LockNeedItemNum * m_nLockNum)
            {
                GUIData.AddNotifyData2Client(false, "#{4961}");
                return;
            }
        }
        //发包升级
        CG_SHENQI_WASHATTR packet = (CG_SHENQI_WASHATTR)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SHENQI_WASHATTR);

        packet.ShenqiGuid = m_ShenQiItem.Guid;
        packet.WashType   = (int)CG_SHENQI_WASHATTR.WASHTYPE.WASH_YB;
        if (m_nLockNum > 0)
        {
            packet.IsLockAttr1 = (m_AttrToggle[0].value == true ? 1 : 0);
            packet.IsLockAttr2 = (m_AttrToggle[1].value == true ? 1 : 0);
            packet.IsLockAttr3 = (m_AttrToggle[2].value == true ? 1 : 0);
        }
        packet.SendPacket();
        m_nLastWastType = (int)CG_SHENQI_WASHATTR.WASHTYPE.WASH_YB;
        if (null != GameManager.gameManager)
        {
            GameManager.gameManager.SoundManager.PlaySoundEffect(28);
        }
    }