mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-03 02:21:53 -04:00
Add /BotInfo
This commit is contained in:
parent
7eeb3d6c53
commit
d52d08b4b2
@ -294,6 +294,27 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DisplayInfo(Player p) {
|
||||||
|
p.Message("Bot {0} %S({1}) has:", ColoredName, name);
|
||||||
|
p.Message(" Owner: %f{0}", string.IsNullOrEmpty(Owner) ? "no one" : PlayerInfo.GetColoredName(p, Owner));
|
||||||
|
if (!String.IsNullOrEmpty(AIName)) { p.Message(" AI: %f{0}", AIName); }
|
||||||
|
if (hunt || kill) { p.Message(" Hunt: %f{0}%S, Kill: %f{1}", hunt, kill); }
|
||||||
|
if (SkinName != name) { p.Message(" Skin: %f{0}", SkinName); }
|
||||||
|
if (Model != "humanoid") { p.Message(" Model: %f{0}", Model); }
|
||||||
|
if (!(ScaleX == 0 && ScaleY == 0 && ScaleZ == 0)) {
|
||||||
|
p.Message(" X scale: &a{0}%S, Y scale: &a{1}%S, Z scale: &a{2}",
|
||||||
|
ScaleX == 0 ? "none" : ScaleX.ToString(),
|
||||||
|
ScaleY == 0 ? "none" : ScaleY.ToString(),
|
||||||
|
ScaleZ == 0 ? "none" : ScaleZ.ToString()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (String.IsNullOrEmpty(ClickedOnText)) { return; }
|
||||||
|
ItemPerms perms = CommandExtraPerms.Find("About", 1);
|
||||||
|
perms = perms == null ? new ItemPerms(LevelPermission.AdvBuilder, null, null) : perms;
|
||||||
|
if (!perms.UsableBy(p.Rank)) { return; } //don't show bot's ClickedOnText if player isn't allowed to see message block contents
|
||||||
|
p.Message(" Clicked-on text: {0}", ClickedOnText);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Old water/lava swimming code - TODO: need to fix.
|
* Old water/lava swimming code - TODO: need to fix.
|
||||||
|
@ -26,7 +26,11 @@ namespace MCGalaxy.Commands.Bots {
|
|||||||
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
|
||||||
public override bool SuperUseable { get { return false; } }
|
public override bool SuperUseable { get { return false; } }
|
||||||
public override CommandAlias[] Aliases {
|
public override CommandAlias[] Aliases {
|
||||||
get { return new[] { new CommandAlias("BotAdd", "add"), new CommandAlias("BotRemove", "remove") }; }
|
get { return new[] {
|
||||||
|
new CommandAlias("BotAdd", "add"),
|
||||||
|
new CommandAlias("BotRemove", "remove"),
|
||||||
|
new CommandAlias("BotInfo", "info")
|
||||||
|
}; }
|
||||||
}
|
}
|
||||||
public override CommandPerm[] ExtraPerms {
|
public override CommandPerm[] ExtraPerms {
|
||||||
get { return new[] { new CommandPerm(LevelPermission.Operator, "can modify bots that do not belong to them") }; }
|
get { return new[] { new CommandPerm(LevelPermission.Operator, "can modify bots that do not belong to them") }; }
|
||||||
@ -35,6 +39,8 @@ namespace MCGalaxy.Commands.Bots {
|
|||||||
public override void Use(Player p, string message, CommandData data) {
|
public override void Use(Player p, string message, CommandData data) {
|
||||||
if (message.Length == 0) { Help(p); return; }
|
if (message.Length == 0) { Help(p); return; }
|
||||||
string[] args = message.SplitSpaces(3);
|
string[] args = message.SplitSpaces(3);
|
||||||
|
if (args[0].CaselessEq("info")) { BotInfo(p, args.Length < 2 ? "" : args[1]); return; }
|
||||||
|
|
||||||
if (args.Length < 2) { Help(p); return; }
|
if (args.Length < 2) { Help(p); return; }
|
||||||
|
|
||||||
if (!Formatter.ValidName(p, args[1], "bot")) return;
|
if (!Formatter.ValidName(p, args[1], "bot")) return;
|
||||||
@ -201,6 +207,24 @@ namespace MCGalaxy.Commands.Bots {
|
|||||||
TryAddBot(p, clone);
|
TryAddBot(p, clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BotInfo(Player p, string botName) {
|
||||||
|
if (botName.Length == 0) {
|
||||||
|
if (!p.Supports(CpeExt.PlayerClick)) {
|
||||||
|
p.Message("Your client does not support clicking on entities.");
|
||||||
|
p.Message("You must type either %T/botinfo [name] %Sor");
|
||||||
|
p.Message("%T/whonick bot [nickname] %Sto see bot info.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.checkingBotInfo = true;
|
||||||
|
p.Message("Left, right, or middle click a bot to display its information.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlayerBot bot = Matcher.FindBots(p, botName);
|
||||||
|
if (bot == null) return;
|
||||||
|
bot.DisplayInfo(p);
|
||||||
|
if (p.checkingBotInfo) { p.checkingBotInfo = false; p.Message("Note: pending click-to-check bot info has been cancelled."); }
|
||||||
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
p.Message("%T/Bot add [name] %H- Adds a new bot at your position");
|
p.Message("%T/Bot add [name] %H- Adds a new bot at your position");
|
||||||
p.Message("%T/Bot remove [name] %H- Removes the bot with that name");
|
p.Message("%T/Bot remove [name] %H- Removes the bot with that name");
|
||||||
@ -215,6 +239,8 @@ namespace MCGalaxy.Commands.Bots {
|
|||||||
p.Message("%T/Bot rename [name] [new name] %H- Renames a bot");
|
p.Message("%T/Bot rename [name] [new name] %H- Renames a bot");
|
||||||
p.Message("%H Note: To only change name tag of a bot, use %T/Nick bot");
|
p.Message("%H Note: To only change name tag of a bot, use %T/Nick bot");
|
||||||
p.Message("%T/Bot copy [name] [new name] %H- Clones an existing bot");
|
p.Message("%T/Bot copy [name] [new name] %H- Clones an existing bot");
|
||||||
|
p.Message("%T/Bot info %H- Displays info of the next bot you click");
|
||||||
|
p.Message("%T/Bot info [name] %H- Displays info of bot with that name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,8 @@ namespace MCGalaxy.Commands.Info {
|
|||||||
|
|
||||||
static void ForBot(Player p, string message) {
|
static void ForBot(Player p, string message) {
|
||||||
PlayerBot nick = FindBotNick(p, message);
|
PlayerBot nick = FindBotNick(p, message);
|
||||||
|
|
||||||
if (nick == null) return;
|
if (nick == null) return;
|
||||||
p.Message("This bot's real name is &1{0}%S, its nickname is {1}%S, its owner is {2} and its skin is {3}", nick.name, nick.DisplayName, string.IsNullOrEmpty(nick.Owner) ? "no one" : nick.Owner, nick.SkinName);
|
nick.DisplayInfo(p);
|
||||||
}
|
}
|
||||||
static PlayerBot FindBotNick(Player p, string nick) {
|
static PlayerBot FindBotNick(Player p, string nick) {
|
||||||
nick = Colors.Strip(nick);
|
nick = Colors.Strip(nick);
|
||||||
|
@ -27,6 +27,7 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
public override void Use(Player p, string message, CommandData data) {
|
public override void Use(Player p, string message, CommandData data) {
|
||||||
p.ClearBlockchange();
|
p.ClearBlockchange();
|
||||||
p.painting = false;
|
p.painting = false;
|
||||||
|
p.checkingBotInfo = false;
|
||||||
p.cmdTimer = false;
|
p.cmdTimer = false;
|
||||||
p.staticCommands = false;
|
p.staticCommands = false;
|
||||||
p.deleteMode = false;
|
p.deleteMode = false;
|
||||||
|
@ -92,12 +92,17 @@ namespace MCGalaxy.Core {
|
|||||||
PlayerBot[] bots = p.level.Bots.Items;
|
PlayerBot[] bots = p.level.Bots.Items;
|
||||||
for (int i = 0; i < bots.Length; i++) {
|
for (int i = 0; i < bots.Length; i++) {
|
||||||
if (bots[i].EntityID != entity) continue;
|
if (bots[i].EntityID != entity) continue;
|
||||||
if (bots[i].ClickedOnText == null) return false;
|
if (bots[i].ClickedOnText == null && !p.checkingBotInfo) return false;
|
||||||
|
|
||||||
Vec3F32 delta = p.Pos.ToVec3F32() - bots[i].Pos.ToVec3F32();
|
Vec3F32 delta = p.Pos.ToVec3F32() - bots[i].Pos.ToVec3F32();
|
||||||
float reachSq = p.ReachDistance * p.ReachDistance;
|
float reachSq = p.ReachDistance * p.ReachDistance;
|
||||||
if (delta.LengthSquared > (reachSq + 1)) return false;
|
if (delta.LengthSquared > (reachSq + 1)) return false;
|
||||||
|
|
||||||
|
if (p.checkingBotInfo) {
|
||||||
|
bots[i].DisplayInfo(p);
|
||||||
|
p.checkingBotInfo = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
string message = bots[i].ClickedOnText;
|
string message = bots[i].ClickedOnText;
|
||||||
MessageBlock.Execute(p, message, bots[i].Pos.FeetBlockCoords);
|
MessageBlock.Execute(p, message, bots[i].Pos.FeetBlockCoords);
|
||||||
return true;
|
return true;
|
||||||
|
@ -62,6 +62,7 @@ namespace MCGalaxy {
|
|||||||
public LevelPermission hideRank = LevelPermission.Banned;
|
public LevelPermission hideRank = LevelPermission.Banned;
|
||||||
public bool hidden;
|
public bool hidden;
|
||||||
public bool painting;
|
public bool painting;
|
||||||
|
public bool checkingBotInfo;
|
||||||
public bool muted;
|
public bool muted;
|
||||||
public bool jailed;
|
public bool jailed;
|
||||||
public bool agreed = true;
|
public bool agreed = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user