예제 #1
0
        internal async Task DeleteFileMongo()
        {
            //Clear data
            EndEncounter();
            if (Party != null)
            {
                Party.RemoveAllPets(this);
                if (IsSolo)
                {
                    if (AreaInfo.TempAreaType)
                    {
                        await AMYPrototype.Program.data.database.DeleteRecord <Areas.AreaPartials.Area>("Dungeons",
                                                                                                        AreaInfo.path, "AreaId");
                    }

                    for (int i = 0; i < Party.NPCMembers.Count; i++)
                    {
                        Party.Remove(i, Area);
                    }
                    await PartyKey.Delete();
                }
                else
                {
                    await Party.Remove(this);
                }
            }
            if (ui?.type == MsgType.ConfirmTransaction)
            {
                Shopping.PendingTransaction.Cancel(this, ui.data);
            }

            ToolsKey?.Delete();
            EggPocketKey?.Delete();
            PetListKey?.Delete();
            ProgressDataKey?.Delete();
            FaithKey?.Delete();
            AdventureKey?.Delete();

            var dynastyData = await Dynasty.Load(this);

            if (dynasty != null)
            {
                await dynastyData.Item1.RemoveMember(this);
            }

            //Delete entries
            await AMYPrototype.Program.data.database.DeleteRecord <Player>("Character", _id, "_id");
        }
예제 #2
0
        //
        public void SaveFileMongo(bool saveEncounter = true)
        {
            if (Encounter != null && saveEncounter)
            {
                if (EncounterKey?._id != Encounter._id)
                {
                    EncounterKey = new DataBaseRelation <string, Encounter>(Encounter._id, Encounter);
                }
                else
                {
                    EncounterKey?.Save();
                }
            }

            ToolsKey?.Save();
            EggPocketKey?.Save();
            PetListKey?.Save();
            ProgressDataKey?.Save();
            FaithKey?.Save();
            AdventureKey?.Save();

            AMYPrototype.Program.data.database.UpdateRecord("Character",
                                                            "_id", _id, this);
        }