RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ProfileViewer.java
1package com.osroyale.content;
2
3import com.osroyale.content.achievement.AchievementHandler;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.entity.mob.player.PlayerRight;
6import com.osroyale.game.world.entity.skill.Skill;
7import com.osroyale.net.packet.out.SendMessage;
8import com.osroyale.net.packet.out.SendPlayerIndex;
9import com.osroyale.net.packet.out.SendString;
10import com.osroyale.net.packet.out.SendTooltip;
11import com.osroyale.util.Utility;
12
13import java.util.Optional;
14
42
43public class ProfileViewer {
44
46 public static String[] string(Player player) {
47 return new String[]{
48 "Created: ", player.created,
49 "Total play time:", Utility.getTime(player.playTime),
50 "Networth:", "" + Utility.formatPrice(player.playerAssistant.networth()),
51 "Clan:", player.clanChannel == null ? "None" : player.clanChannel.getName(),
52 "Total level:", "" + Utility.formatDigits(player.skills.getTotalLevel()),
53 "Kills/Deaths/KDR", "" + player.kill + "/" + player.death + "/" + player.playerAssistant.kdr() + "",
54 "Current KC:", "" + player.killstreak.streak,
55 "Vote Points:", "" + Utility.formatDigits(player.votePoints),
56 "Total Votes:", "" + Utility.formatDigits(player.totalVotes),
57 "Skilling Points:", "" + Utility.formatDigits(player.skillingPoints),
58 "Mage's Arena Points:", "" + Utility.formatDigits(player.mageArenaPoints),
59 "Pest Control Points:", "" + Utility.formatDigits(player.pestPoints),
60 "Achievements Completed:", "" + AchievementHandler.getTotalCompleted(player) + "",
61 };
62 }
63
65 public static void open(Player player, Player other) {
66 if (!other.getPosition().isWithinDistance(player.getPosition(), 26)) {
67 player.message("You must get closer to that player if you want to view their profile!");
68 return;
69 }
70
71 if (player.getCombat().inCombat()) {
72 player.send(new SendMessage("You can't view profiles whilst in combat!"));
73 return;
74 }
75
76 for (int index = 0, string = 51832; index < Skill.SKILL_COUNT; index++, string += 2) {
77 Skill skill = other.skills.get(index);
78 String color = Integer.toHexString(other.prestige.getPrestigeColor(index));
79 player.send(new SendString(skill.getMaxLevel() + "<col=" + color + "></col>/<col=" + color + ">" + skill.getMaxLevel(), string));
80 }
81
82 int string = 51902;
83 for (String context : string(other)) {
84 player.send(new SendString(context, string));
85 string += 2;
86 }
87
88 if (PlayerRight.isModerator(player) && !player.equals(other)) {
89 player.send(new SendString("Manage Player: " + other.getName(), 51811));
90 player.send(new SendTooltip("Manage Player: " + other.getName(), 51811));
91 player.managing = Optional.of(other);
92 } else {
93 player.send(new SendString("", 51811));
94 player.send(new SendTooltip("", 51811));
95 }
96
97 player.send(new SendPlayerIndex(other.getIndex()));
98 player.send(new SendString("", 51810));
99 player.send(new SendString("</col>Name: <col=FFB83F>" + other.getName(), 51807));
100 player.send(new SendString("</col>Rank: <col=FFB83F>" + PlayerRight.getCrown(other) + " " + other.right.getName(), 51808));
101 player.send(new SendString("</col>Level: <col=FFB83F>" + other.skills.getCombatLevel(), 51809));
102 player.send(new SendMessage("You are now viewing " + other.getName() + "'s profile."));
103 player.interfaceManager.open(51800);
104 }
105}
static void open(Player player, Player other)
static String[] string(Player player)
boolean isWithinDistance(Position other, int radius)
static String formatDigits(final int amount)
Definition Utility.java:78
static String getTime()
Definition Utility.java:178
static String formatPrice(final long amount)
Definition Utility.java:93