private string _handleToonMessage(string[] sections)
        {
            switch (sections[1])
            {
            case "SETQUESTCOMPLETED":
                int                 questId  = Convert.ToInt32(sections[3]);
                string              toonName = sections[2];
                QuestDefinition     quest    = _questRepository.GetByRomId(questId);
                CharacterDefinition toon     = _characterRepository.FindByName(toonName);
                if (toon == null)
                {
                    toon      = new CharacterDefinition();
                    toon.Name = toonName;
                    LogManager.GetLogger(typeof(RomMessageProcessor)).Warn("Could not load character: " + toonName + " so created a new one.");
                }
                if (!toon.CompletedQuests.Contains(quest))
                {
                    toon.CompletedQuests.Add(quest);
                    _characterRepository.Update(toon);
                }
                break;
            }

            return(null);
        }
Esempio n. 2
0
        public void TestCanUpdateRemedial()
        {
            ISessionFactory fac     = RomViewContainer.Container.GetInstance <ISessionFactory>();
            ISession        session = fac.OpenSession();
            ITransaction    tx      = session.BeginTransaction();

            CallSessionContext.Bind(session);

            try
            {
                ICharacterRepository rep = RomViewContainer.Container.GetInstance <ICharacterRepository>();

                CharacterDefinition def = rep.FindByName("Remedial");
                def.PrimaryClass   = CharacterClass.Scout;
                def.PrimaryLevel   = 56;
                def.SecondaryLevel = 55;
                def.SecondayClass  = CharacterClass.Mage;
                def.Race           = "Human";
                def.Sex            = Sex.Female;

                rep.Update(def);
                tx.Commit();
            }
            finally
            {
                session.Close();
            }
        }
Esempio n. 3
0
        public void TestFindQuest()
        {
            ISessionFactory fac     = RomViewContainer.Container.GetInstance <ISessionFactory>();
            ISession        session = fac.OpenSession();

            //ITransaction tx = session.BeginTransaction();
            CallSessionContext.Bind(session);
            GoalSetter gs = RomViewContainer.Container.GetInstance <GoalSetter>();

            ICharacterRepository charRep = RomViewContainer.Container.GetInstance <ICharacterRepository>();
            CharacterDefinition  toon    = charRep.FindByName("Remedial");

            gs.Character      = toon;
            gs.State          = new CharacterState();
            gs.State.Location = new Vector3(6130, 137, 23169);

            var a = gs.DetermineNearestQuest();

            CallSessionContext.Unbind(fac);
        }