mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 03:55:18 -04:00
Add creation date timestamp to bots
This commit is contained in:
parent
c76f2f49f7
commit
7417acad4c
@ -141,6 +141,7 @@ namespace MCGalaxy.Bots {
|
||||
[ConfigFloat] public float ScaleX;
|
||||
[ConfigFloat] public float ScaleY;
|
||||
[ConfigFloat] public float ScaleZ;
|
||||
[ConfigString] public string CreationDate;
|
||||
|
||||
public void FromBot(PlayerBot bot) {
|
||||
Owner = bot.Owner;
|
||||
@ -156,6 +157,8 @@ namespace MCGalaxy.Bots {
|
||||
RotX = bot.Rot.RotY; RotY = bot.Rot.HeadX;
|
||||
BodyX = bot.Rot.RotX; BodyZ = bot.Rot.RotZ;
|
||||
ScaleX = bot.ScaleX; ScaleY = bot.ScaleY; ScaleZ = bot.ScaleZ;
|
||||
|
||||
CreationDate = bot.CreationDate.ToString();
|
||||
}
|
||||
|
||||
public void ApplyTo(PlayerBot bot) {
|
||||
@ -175,6 +178,9 @@ namespace MCGalaxy.Bots {
|
||||
if (CurSpeed != 0) bot.movementSpeed = CurSpeed;
|
||||
bot.ClickedOnText = ClickedOnText; bot.DeathMessage = DeathMessage;
|
||||
bot.ScaleX = ScaleX; bot.ScaleY = ScaleY; bot.ScaleZ = ScaleZ;
|
||||
|
||||
long longCreationDate;
|
||||
if (!String.IsNullOrEmpty(CreationDate) && long.TryParse(CreationDate, out longCreationDate)) bot.CreationDate = longCreationDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,10 @@ namespace MCGalaxy {
|
||||
public Position TargetPos;
|
||||
public bool movement = false;
|
||||
public int movementSpeed = 3;
|
||||
internal int curJump = 0;
|
||||
|
||||
internal int curJump = 0;
|
||||
|
||||
public long CreationDate = 0;
|
||||
|
||||
public PlayerBot(string n, Level lvl) {
|
||||
name = n; DisplayName = n; SkinName = n;
|
||||
color = "&1";
|
||||
@ -296,6 +298,7 @@ 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" : p.FormatNick(Owner));
|
||||
if (CreationDate != 0) { p.Message(" Created: &f{0}", CreationDate.FromUnixTime().ToString("yyyy-MM-dd")); }
|
||||
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); }
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
using MCGalaxy.Blocks.Extended;
|
||||
using MCGalaxy.Bots;
|
||||
using System;
|
||||
|
||||
namespace MCGalaxy.Commands.Bots
|
||||
{
|
||||
@ -70,6 +71,7 @@ namespace MCGalaxy.Commands.Bots
|
||||
botName = botName.Replace(' ', '_');
|
||||
PlayerBot bot = new PlayerBot(botName, p.level);
|
||||
bot.Owner = p.name;
|
||||
bot.CreationDate = DateTime.UtcNow.ToUnixTime();
|
||||
TryAddBot(p, bot);
|
||||
}
|
||||
|
||||
@ -207,6 +209,7 @@ namespace MCGalaxy.Commands.Bots
|
||||
props.ApplyTo(clone);
|
||||
clone.Owner = p.name;
|
||||
clone.SetModel(clone.Model);
|
||||
clone.CreationDate = DateTime.UtcNow.ToUnixTime();
|
||||
BotsFile.LoadAi(props, clone);
|
||||
// Preserve custom name tag
|
||||
if (bot.DisplayName == bot.name) clone.DisplayName = newName;
|
||||
|
Loading…
x
Reference in New Issue
Block a user