Пример #1
0
    private void OnReq_StrengthEquip(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        ReqStrengthEquip       req = Serializer.Deserialize <ReqStrengthEquip>(ms);

        AckStrengthEquip ack = new AckStrengthEquip();

        ack.TarEquip = req.TarEquip;
        ack.UseItems.AddRange(req.UseItems);
        NetworkManager.Instance.Send(MessageID.MSG_ACK_STRENGTHEN_EQUIP, ack, 0, 0);
    }
Пример #2
0
    private void OnAck_StrengthEquip(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckStrengthEquip       ack = Serializer.Deserialize <AckStrengthEquip>(ms);

        XEquip       equip           = ack.TarEquip;
        List <XItem> list            = ack.UseItems;
        DEquip       cfg             = ReadCfgEquip.GetDataById(equip.Id);
        int          strengthenLevel = equip.StrengthenLevel;
        int          strID           = cfg.Quality * 1000 + strengthenLevel + 1;
        int          addExpNum       = EquipModule.Instance.GetStrengthenExpByMatList(list);

        DEquipStrengLevel db = ReadCfgEquipStrengLevel.GetDataById(strID);
        int expNum           = db.RequireExp - equip.StrengthenExp;

        while (addExpNum >= expNum)
        {
            strengthenLevel++;
            db      = ReadCfgEquipStrengLevel.GetDataById(cfg.Quality * 1000 + strengthenLevel + 1);
            expNum += db.RequireExp;
        }
        equip.StrengthenLevel = strengthenLevel;
        equip.StrengthenExp   = addExpNum + db.RequireExp - expNum;

        DataDBSEquip.Update(equip.Instance, equip);
        GTDataManager.Instance.UseMoney(DEquip.EQUIP_STRENGTHEN_MONEY_ID_1, expNum);
        for (int i = 0; i < list.Count; i++)
        {
            XItem item = list[i];
            if ((EPosType)item.PosType == EPosType.RoleMoney)
            {
                GTDataManager.Instance.UseMoney(item.Id, item.Num);
            }
            else
            {
                GTDataManager.Instance.DelBagEquip(item.Pos);
            }
        }

        CharacterManager.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);

        GTEventCenter.FireEvent(GTEventID.TYPE_STRENGTHEN_EQUIP);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }