Ejemplo n.º 1
0
        private bool CheckExistence(NpcPresenceInfo pInfo)
        {
            NpcPresenceInfo        result;
            List <NpcPresenceInfo> reslist;

            m_Log.Info("Check that entry exists by npcid 1");
            if (!m_PresenceService.ContainsKey(pInfo.Npc.ID))
            {
                return(false);
            }

            m_Log.Info("Check that entry exists by npcid 2");
            if (!m_PresenceService.TryGetValue(pInfo.Npc.ID, out result))
            {
                return(false);
            }

            m_Log.Info("Verify equality");
            if (!IsEqual(result, pInfo))
            {
                return(false);
            }

            m_Log.Info("Check that entry exists by regionid");
            reslist = m_PresenceService[pInfo.RegionID];
            if (reslist.Count != 1)
            {
                return(false);
            }

            m_Log.Info("Verify equality");
            if (!IsEqual(reslist[0], pInfo))
            {
                return(false);
            }

            m_Log.Info("Check that entry exists by firstname and lastname");
            if (!m_PresenceService.TryGetValue(pInfo.RegionID, pInfo.Npc.FirstName, pInfo.Npc.LastName, out result))
            {
                return(false);
            }

            m_Log.Info("Verify equality");
            if (!IsEqual(result, pInfo))
            {
                return(false);
            }

            m_Log.Info("Check that entry does not exist by firstname and lastname and other regionid");
            if (m_PresenceService.TryGetValue(UUID.RandomFixedFirst(0xFFFFFFFF), pInfo.Npc.FirstName, pInfo.Npc.LastName, out result))
            {
                return(false);
            }

            return(true);
        }