Пример #1
0
        public static void Avatarcmd(User user, string playername = "")
        {
            Player targetplayer;
            User   targetuser;

            if (playername == "")
            {
                targetplayer = user.Player;
                targetuser   = user;
            }
            else
            {
                targetuser = UserManager.FindUserByName(playername);
                if (targetuser == null)
                {
                    user.Player.SendTemporaryErrorAlreadyLocalized("Player " + playername + " not found!");
                    return;
                }
                targetplayer = targetuser.Player;
            }

            string newline        = "<br>";
            string title          = "Stats for " + targetuser.Name;
            string skillsheadline = "<b>SKILLRATES:</b>" + newline;
            string housinginfo;
            string foodinfo;
            string totalsp;
            string onlineinfo;
            string superskillsinfo = string.Empty;
            string professioninfo;
            string currencyinfo = "<b>CURRENCIES:</b>" + newline;
            string propertyinfo;
            string admininfo = string.Empty;

            if (targetuser.IsAdmin)
            {
                admininfo = "<color=red><b>ADMIN</b></color> ";
            }


            /* old currencies (pre bank accounts)
             * foreach (Currency currency in EconomyManager.Currency.Currencies)
             * {
             *  if (currency.HasAccount(targetuser.Name))
             *  {
             *      if (currency.GetAccount(targetuser.Name).Val > 0f)
             *      {
             *          currencyinfo += currency.UILink(currency.GetAccount(targetuser.Name).Val) + newline;
             *      }
             *  }
             * }
             */
            foreach (BankAccount account in BankAccountManager.Obj.AccessibleAccounts(targetplayer))  //not yet working as expected
            {
                currencyinfo += account.UILink() + newline;
            }


            /* no superskills atm
             * List<Skill> superskills = SkillUtils.GetSuperSkills(targetuser);
             * if (superskills.Count > 0)
             * {
             *  superskillsinfo = "<b>SUPERSKILLS:</b>" + newline;
             *  foreach (Skill skill in superskills)
             *  {
             *      superskillsinfo += skill.UILink() + newline;
             *  }
             *  superskillsinfo += newline;
             * }
             */

            float foodsp  = targetuser.Stomach.NutrientSkillRate;
            float housesp = targetuser.CachedHouseValue.HousingSkillRate;

            professioninfo = newline + "<b>PROFESSION:</b> " + newline + SkillUtils.FindProfession(targetuser).UILink() + newline;
            housinginfo    = "House SP: " + targetuser.CachedHouseValue.UILink() + newline;
            foodinfo       = "Food SP: " + Math.Round(foodsp, 2) + newline;
            totalsp        = "Total SP: " + Math.Round(housesp + foodsp, 2) + newline;
            propertyinfo   = "<b>PROPERTY:</b>" + newline + MiscUtils.CountPlots(targetuser) * 25 + " sqm of land." + newline;
            onlineinfo     = targetuser.LoggedIn ? "is online. Located at " + new Vector3Tooltip(targetuser.Position).UILink() : "is offline. Last online " + TimeFormatter.FormatSpan(WorldTime.Seconds - targetuser.LogoutTime) + " ago";
            onlineinfo    += newline;

            user.Player.OpenInfoPanel(title, admininfo + targetuser.UILink() + " " + onlineinfo + newline + skillsheadline + foodinfo + housinginfo + totalsp + professioninfo + newline + propertyinfo + newline + superskillsinfo + currencyinfo);
        }