Example #1
0
 void   ReadRoleData()
 {
     DataDBSBagItem.Read(GetDataPath(GTDataKey.Data_BagItems), EDataKeyType.Pos);
     DataDBSEquip.Read(GetDataPath(GTDataKey.Data_Equips), EDataKeyType.Instance);
     DataDBSDressEquip.Read(GetDataPath(GTDataKey.Data_DressEquips), EDataKeyType.Pos);
     DataDBSMoney.Read(GetDataPath(GTDataKey.Data_Moneys), EDataKeyType.Id);
     DataDBSAction.Read(GetDataPath(GTDataKey.Data_Actions), EDataKeyType.Id);
     DataDBSSoul.Read(GetDataPath(GTDataKey.Data_Souls), EDataKeyType.Id);
     DataDBSBagGem.Read(GetDataPath(GTDataKey.Data_BagGems), EDataKeyType.Pos);
     DataDBSGem.Read(GetDataPath(GTDataKey.Data_Gems), EDataKeyType.Instance);
     DataDBSDressGem.Read(GetDataPath(GTDataKey.Data_DressGems), EDataKeyType.Pos);
     DataDBSBagChip.Read(GetDataPath(GTDataKey.Data_BagChips), EDataKeyType.Pos);
     DataDBSBagFashion.Read(GetDataPath(GTDataKey.Data_BagFashions), EDataKeyType.Pos);
     DataDBSBagRune.Read(GetDataPath(GTDataKey.Data_BagRunes), EDataKeyType.Pos);
     DataDBSDressRune.Read(GetDataPath(GTDataKey.Data_DressRunes), EDataKeyType.Pos);
     DataDBSDressFashion.Read(GetDataPath(GTDataKey.Data_DressFashions), EDataKeyType.Pos);
     DataDBSRune.Read(GetDataPath(GTDataKey.Data_Runes), EDataKeyType.Instance);
     DataDBSCopy.Read(GetDataPath(GTDataKey.Data_Copys), EDataKeyType.Id);
     DataDBSMainChapter.Read(GetDataPath(GTDataKey.Data_MainChapters), EDataKeyType.Id);
     DataDBSRaid.Read(GetDataPath(GTDataKey.Data_Raid), EDataKeyType.Id);
     DataDBSPartner.Read(GetDataPath(GTDataKey.Data_Partners), EDataKeyType.Id);
     DataDBSMount.Read(GetDataPath(GTDataKey.Data_Mounts), EDataKeyType.Id);
     DataDBSRelics.Read(GetDataPath(GTDataKey.Data_Relics), EDataKeyType.Id);
     DataDBSPet.Read(GetDataPath(GTDataKey.Data_Pets), EDataKeyType.Id);
     DataDBSGuide.Read(GetDataPath(GTDataKey.Data_Guides), EDataKeyType.Id);
     DataDBSThreadTask.Read(GetDataPath(GTDataKey.Data_MainTasks), EDataKeyType.Id);
     DataDBSBranchTask.Read(GetDataPath(GTDataKey.Data_BranchTasks), EDataKeyType.Id);
     DataDBSDailyTask.Read(GetDataPath(GTDataKey.Data_DailyTasks), EDataKeyType.Id);
 }
Example #2
0
    void   DumpRoleData()
    {
        DataDBSMoney.Clear();
        DataDBSAction.Clear();
        DataDBSSoul.Clear();

        DataDBSBagItem.Clear();
        DataDBSBagGem.Clear();
        DataDBSBagChip.Clear();
        DataDBSBagRune.Clear();
        DataDBSBagFashion.Clear();

        DataDBSDressEquip.Clear();
        DataDBSDressFashion.Clear();
        DataDBSDressGem.Clear();
        DataDBSDressRune.Clear();

        DataDBSEquip.Clear();
        DataDBSGem.Clear();
        DataDBSRune.Clear();
        DataDBSMainChapter.Clear();
        DataDBSCopy.Clear();
        DataDBSRaid.Clear();

        DataDBSRelics.Clear();
        DataDBSMount.Clear();
        DataDBSPartner.Clear();
        DataDBSPet.Clear();
        DataDBSGuide.Clear();

        DataDBSThreadTask.Clear();
        DataDBSBranchTask.Clear();
        DataDBSDailyTask.Clear();
    }
Example #3
0
    public bool DelBagGem(int pos)
    {
        XItem item = DataDBSBagGem.GetDataById(pos);

        if (item == null)
        {
            return(false);
        }
        DataDBSBagGem.Delete(pos);
        DataDBSGem.Delete(item.Instance);
        return(true);
    }
Example #4
0
    private void OnReq_DressGem(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        ReqDressGem            req = Serializer.Deserialize <ReqDressGem>(ms);

        XItem       bagGem = DataDBSBagGem.GetDataById(req.SrcPos);
        DGem        cfg    = ReadCfgGem.GetDataById(bagGem.Id);
        AckDressGem ack    = new AckDressGem();

        ack.SrcPos = req.SrcPos;
        ack.Index  = req.Index;
        ack.TarPos = cfg.Pos;
        NetworkManager.Instance.Send(MessageID.MSG_ACK_DRESS_GEM, ack, 0, 0);
    }
Example #5
0
    private void OnAck_DressGem(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckDressGem            ack = Serializer.Deserialize <AckDressGem>(ms);

        int srcPos = ack.SrcPos;
        int tarPos = ack.TarPos;
        int index  = ack.Index;

        XItem sourceGem = DataDBSBagGem.GetDataById(srcPos);
        DGem  gemDB     = ReadCfgGem.GetDataById(sourceGem.Id);
        int   pos       = MLGem.Instance.GetDressGemPosByIndexAndTargetPos(index, gemDB.Pos);
        XItem dressGem  = DataDBSDressGem.GetDataById(pos);

        if (dressGem != null)
        {
            int sourceInstanceID = sourceGem.Instance;
            int sourceId         = sourceGem.Id;

            sourceGem.Instance = dressGem.Instance;
            sourceGem.Id       = dressGem.Id;

            dressGem.Instance = sourceInstanceID;
            dressGem.Id       = sourceId;

            DataDBSDressGem.Update(dressGem.Pos, dressGem);
            DataDBSBagGem.Update(sourceGem.Pos, sourceGem);
        }
        else
        {
            dressGem          = new XItem();
            dressGem.Instance = sourceGem.Instance;
            dressGem.Pos      = pos;
            dressGem.PosType  = (int)EPosType.RoleGem;
            dressGem.Id       = sourceGem.Id;
            dressGem.Num      = 1;
            DataDBSDressGem.Insert(pos, dressGem);
            DataDBSBagGem.Delete(sourceGem.Pos);
        }

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);

        GTEventCenter.FireEvent(GTEventID.TYPE_BAG_DRESS_GEM, srcPos, tarPos);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
Example #6
0
    public void AddNewGem(int instance, int id)
    {
        int newPos = GetNewPos(EBagType.GEM);

        if (newPos == 0)
        {
            return;
        }
        XItem item = new XItem();

        item.Instance = instance;
        item.Pos      = newPos;
        item.Id       = id;
        item.Num      = 1;
        item.PosType  = (int)EPosType.BagGem;

        DataDBSBagGem.Insert(newPos, item);
        DataDBSGem.Insert(instance, GTDataFactory.CreateGem(id, instance));
    }
Example #7
0
    private void OnAck_UnloadGem(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckUnloadGem           ack = Serializer.Deserialize <AckUnloadGem>(ms);

        int newPos = ack.NewPos;
        int tarPos = ack.TarPos;

        XItem dressGem = DataDBSDressGem.GetDataById(tarPos);
        XItem bagGem   = new XItem();

        bagGem.Instance = dressGem.Instance;
        bagGem.Pos      = newPos;
        bagGem.PosType  = (int)EPosType.BagGem;
        bagGem.Id       = dressGem.Id;
        bagGem.Num      = 1;
        DataDBSBagGem.Insert(newPos, bagGem);
        DataDBSDressGem.Delete(tarPos);

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_CURRATTR);

        GTEventCenter.FireEvent(GTEventID.TYPE_BAG_UNLOAD_GEM, newPos, tarPos);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
Example #8
0
    private void OnAck_SortBag(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckSortBag             ack = Serializer.Deserialize <AckSortBag>(ms);

        EBagType bagType = (EBagType)ack.BagType;
        Dictionary <int, XItem> items = GTDataManager.Instance.GetBagDataByBagType(bagType);
        List <XItem>            list  = new List <XItem>();

        list.AddRange(items.Values);
        items.Clear();

        switch (bagType)
        {
        case EBagType.ITEM:
        {
            list.Sort(MLBag.Instance.CompareBagItem);
            DataDBSBagItem.Clear(false);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].Pos = i + 1;
                DataDBSBagItem.Insert(list[i].Pos, list[i]);
            }
        }
        break;

        case EBagType.GEM:
        {
            list.Sort(MLBag.Instance.CompareBagGem);
            DataDBSBagGem.Clear(false);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].Pos = i + 1;
                DataDBSBagGem.Insert(list[i].Pos, list[i]);
            }
        }
        break;

        case EBagType.CHIP:
        {
            list.Sort(MLBag.Instance.CompareBagChip);
            DataDBSBagChip.Clear(false);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].Pos = i + 1;
                DataDBSBagChip.Insert(list[i].Pos, list[i]);
            }
        }
        break;

        case EBagType.FASHION:
        {
            list.Sort(MLBag.Instance.CompareBagFashion);
            DataDBSBagFashion.Clear(false);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].Pos = i + 1;
                DataDBSBagFashion.Insert(list[i].Pos, list[i]);
            }
        }
        break;

        case EBagType.RUNE:
        {
            list.Sort(MLBag.Instance.CompareBagRune);
            DataDBSBagRune.Clear(false);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].Pos = i + 1;
                DataDBSBagRune.Insert(list[i].Pos, list[i]);
            }
        }
        break;
        }

        GTEventCenter.FireEvent(GTEventID.TYPE_BAG_SORT_BAG);
    }