Exemplo n.º 1
0
        public void CreateSocietyData()
        {
            int societyTypesCount = Enum.GetNames(typeof(SocietiesGroupType)).Length;

            for (int a = 0; a < societyTypesCount; a++)
            {
                SocietiesGroupType     societyGroupType  = (SocietiesGroupType)a;
                SocietyGroupPlayerData societyPlayerData = new SocietyGroupPlayerData(societyGroupType);

                m_SocietyPlayerData.Add(societyPlayerData);
            }
        }
Exemplo n.º 2
0
        public static List <KeyValuePair <PlayerMobile, int> > GetSocietyGroupLifetimeRanks(SocietiesGroupType societyGroupType)
        {
            Dictionary <PlayerMobile, int> dictPlayers = new Dictionary <PlayerMobile, int>();

            foreach (Mobile mobile in World.Mobiles.Values)
            {
                if (mobile == null)
                {
                    continue;
                }
                if (mobile.Deleted)
                {
                    continue;
                }
                if (!mobile.Player)
                {
                    continue;
                }

                PlayerMobile pm_Target = mobile as PlayerMobile;

                Societies.CheckCreateSocietiesPlayerSettings(pm_Target);
                SocietyGroupPlayerData societyGroupPlayerData = pm_Target.m_SocietiesPlayerSettings.GetSocietyGroupPlayerData(societyGroupType);

                if (societyGroupPlayerData == null)
                {
                    continue;
                }

                if (societyGroupPlayerData.m_MontlyPoints > 0)
                {
                    dictPlayers.Add(pm_Target, societyGroupPlayerData.m_LifetimePoints);
                }
            }

            List <KeyValuePair <PlayerMobile, int> > m_Results = new List <KeyValuePair <PlayerMobile, int> >();

            foreach (KeyValuePair <PlayerMobile, int> pair in dictPlayers.OrderByDescending(key => key.Value))
            {
                PlayerMobile pm_Target = pair.Key;
                int          points    = pair.Value;

                m_Results.Add(pair);
            }

            return(m_Results);
        }
Exemplo n.º 3
0
        public void Complete(PlayerMobile player)
        {
            SocietyJobPlayerProgress jobProgress = Societies.GetSocietiesJobPlayerProgress(player, this);

            if (jobProgress == null)
            {
                return;
            }

            if (!m_PlayersCompleted.Contains(player))
            {
                m_PlayersCompleted.Add(player);
            }

            SocietyGroupPlayerData societyGroupPlayerData = player.m_SocietiesPlayerSettings.GetSocietyGroupPlayerData(m_SocietiesGroupType);

            if (societyGroupPlayerData != null)
            {
                societyGroupPlayerData.m_PointsAvailable += m_PointValue;
                societyGroupPlayerData.m_MontlyPoints    += m_PointValue;
                societyGroupPlayerData.m_LifetimePoints  += m_PointValue;

                player.SendMessage(Societies.GetSocietyGroupTextHue(m_SocietiesGroupType), "You have been awarded " + m_PointValue.ToString() + " with the " + Societies.GetSocietyGroupName(m_SocietiesGroupType) + " for completion of a job contract.");
            }

            if (jobProgress.m_JobContract != null)
            {
                jobProgress.m_JobContract.JobStatus = SocietiesJobContract.JobStatusType.Completed;
            }

            player.m_SocietiesPlayerSettings.m_JobProgress.Remove(jobProgress);

            Account account = player.Account as Account;

            foreach (Mobile mobile in account.accountMobiles)
            {
                PlayerMobile pm_Target = mobile as PlayerMobile;

                if (pm_Target == null)
                {
                    continue;
                }
                if (pm_Target == player)
                {
                    continue;
                }

                Societies.CheckCreateSocietiesPlayerSettings(pm_Target);

                SocietyJobPlayerProgress otherPlayerJobProgress = Societies.GetSocietiesJobPlayerProgress(player, this);

                if (otherPlayerJobProgress == null)
                {
                    continue;
                }

                if (otherPlayerJobProgress.m_JobContract != null)
                {
                    otherPlayerJobProgress.m_JobContract.JobStatus = SocietiesJobContract.JobStatusType.Completed;
                }

                player.m_SocietiesPlayerSettings.m_JobProgress.Remove(otherPlayerJobProgress);
            }
        }