Exemplo n.º 1
0
            // Soft delete by assigning accountId to 0
            public bool DeleteCharacter(long characterId)
            {
                Maple2.Sql.Model.Character character = context.Character.Find(characterId);
                if (character == null)
                {
                    return(false);
                }

                character.AccountId = 0;
                return(context.TrySaveChanges());
            }
Exemplo n.º 2
0
            public long CreateCharacter(Character character)
            {
                using IDbContextTransaction transaction = context.Database.BeginTransaction();
                Maple2.Sql.Model.Character dbCharacter = storage.characterConverter.ToModel(character);
                dbCharacter.Id = 0;
                context.Character.Add(dbCharacter);
                if (!context.TrySaveChanges())
                {
                    return(-1);
                }

                var progress = new ProgressState();

                progress.Emotes.UnionWith(new [] {
                    90200001, 90200003, 90200004, 90200005, 90200006, 90200011,
                    90200022, 90200023, 90200024, 90200031, 90200041, 90200042
                });
                progress.Titles.Add(10000357);
                Maple2.Sql.Model.CharacterProgress dbProgress = storage.progressConverter.ToModel(progress);
                dbProgress.CharacterId = dbCharacter.Id;
                context.CharacterProgress.Add(dbProgress);

                var quests = new QuestState();

                // Lapenshard/Housing quests to skip
                // Lapenshard
                quests.StartQuest(20002391);
                quests.FinishQuest(20002391);
                // Housing
                quests.StartQuest(90000660);
                quests.FinishQuest(90000660);
                quests.StartQuest(90000661);
                quests.FinishQuest(90000661);
                quests.StartQuest(90000760);
                quests.FinishQuest(90000760);
                quests.StartQuest(90000762);
                quests.FinishQuest(90000762);
                quests.StartQuest(90000690);
                quests.FinishQuest(90000690);
                quests.StartQuest(90000692);
                quests.FinishQuest(90000692);
                quests.StartQuest(90000670);
                quests.FinishQuest(90000670);
                quests.StartQuest(90000680);
                quests.FinishQuest(90000680);
                StageQuests(dbCharacter.Id, quests);

                transaction.Commit();
                return(dbCharacter.Id);
            }
Exemplo n.º 3
0
 public void StageCharacter(Character character)
 {
     Maple2.Sql.Model.Character dbCharacter = context.Character.Find(character.Id);
     Debug.Assert(dbCharacter != null);
     storage.characterConverter.ToModel(character, dbCharacter);
 }