Ejemplo n.º 1
0
    private void OnAck_UpgradeRelics(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckUpgradeRelics       ack = Serializer.Deserialize <AckUpgradeRelics>(ms);


        DRelics db     = ReadCfgRelics.GetDataById(ack.RelicsID);
        XRelics relics = DataDBSRelics.GetDataById(ack.RelicsID);

        relics.Level++;
        relics.CurExp1 = relics.CurExp1 - db.LevelExp[relics.Level - 1];
        relics.CurExp2 = relics.CurExp2 - db.LevelExp[relics.Level - 1];
        relics.CurExp3 = relics.CurExp3 - db.LevelExp[relics.Level - 1];
        DataDBSRelics.Update(ack.RelicsID, relics);

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);
        GTEventCenter.FireEvent(GTEventID.TYPE_RELICS_UPGRADE, ack.RelicsID);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
Ejemplo n.º 2
0
    private void OnAck_ChargeRelics(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckChargeRelics        ack = Serializer.Deserialize <AckChargeRelics>(ms);
        int index    = ack.Index;
        int relicsID = ack.RelicsID;

        DRelics db     = ReadCfgRelics.GetDataById(relicsID);
        int     itemID = db.ArtificeCostID[index - 1];
        DItem   itemDB = ReadCfgItem.GetDataById(itemID);
        XRelics relics = DataDBSRelics.GetDataById(relicsID);

        if (relics == null)
        {
            relics    = new XRelics();
            relics.Id = relicsID;
        }
        switch (index)
        {
        case 1:
            relics.CurExp1 += itemDB.Data1;
            break;

        case 2:
            relics.CurExp2 += itemDB.Data1;
            break;

        case 3:
            relics.CurExp3 += itemDB.Data1;
            break;
        }

        DataDBSRelics.Update(relicsID, relics);
        GTDataManager.Instance.UseItemById(itemID);

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);
        GTEventCenter.FireEvent(GTEventID.TYPE_RELICS_CHARGE, relicsID, index);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }