Example #1
0
        public string GetJobDescriptionProgressText(PlayerMobile player)
        {
            string description = "";

            Societies.CheckCreateSocietiesPlayerSettings(player);

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

            double primaryNumber   = 0;
            double secondaryNumber = 0;

            if (jobPlayerProgress != null)
            {
                primaryNumber   = jobPlayerProgress.m_ProgressAmount;
                secondaryNumber = jobPlayerProgress.m_TurnedInAmount;
            }

            switch (m_JobType)
            {
            case JobType.CraftItem: description = primaryNumber.ToString() + " / " + m_TargetNumber.ToString() + " " + m_PrimaryTypeName + " Crafted"; break;

            case JobType.KillCreature: description = primaryNumber.ToString() + " / " + m_TargetNumber.ToString() + " " + m_PrimaryTypeName + " Killed"; break;

            case JobType.RetrieveFish: description = primaryNumber.ToString() + " / " + m_TargetNumber.ToString() + " " + m_PrimaryTypeName + " Caught"; break;

            case JobType.SinkShip: description = primaryNumber.ToString() + " / " + m_TargetNumber.ToString() + " " + m_PrimaryTypeName + " Sunk"; break;

            case JobType.StealItem: description = primaryNumber.ToString() + " / " + m_TargetNumber.ToString() + " " + m_PrimaryTypeName + " Stolen"; break;

            case JobType.TameCreature: description = primaryNumber.ToString() + " / " + m_TargetNumber.ToString() + " " + m_PrimaryTypeName + " Tamed"; break;
            }

            return(description);
        }
        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);
        }
Example #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);
            }
        }