protected override bool Process(SocketProxyWorker client, string args) { Entity player = client.World.GetPlayer(args); if (player == null) { client.SendText("*Error*", "Player not found!"); } var packet = NWriter.Write(writer => new EditAccountListPacket { AccountListId = 0, Add = true, ObjectId = player.ID }.Write(writer)); client.SendAsClient(client.PacketTable.EDITACCOUNTLIST, packet); packet = NWriter.Write(writer => new AccountListPacket { AccountListId = 0, AccountIds = new[] { player.Stats[StatsType.AccountId].ToString() } }.Write(writer)); client.SendAsServer(client.PacketTable.ACCOUNTLIST, packet); client.SendText("", "Added " + player.GetStats <string>(StatsType.Name) + " to starred list"); return(true); }
public bool Execute(SocketProxyWorker client, string args) { try { return(Process(client, args)); } catch { client.SendText("*Error*", "Error when executing the command."); client.SendText("", "Usage: " + Usage); return(false); } }
protected override bool Process(SocketProxyWorker client, string args) { Entity player = client.World[client.World.SelfID]; var playerData = client.Proxy.Tool.LoadXmlData(client.Version)[player.ObjectType]; foreach (var stat in stats) { var statLimitNode = playerData.Element(stat.XMLName); var statIncrNode = playerData.XPathSelectElement("LevelIncrease[text() = '" + stat.XMLName + "']"); int beginStat = int.Parse(statLimitNode.Value); int maxStat = int.Parse(statLimitNode.Attribute("max").Value); int minIncr = int.Parse(statIncrNode.Attribute("min").Value); int maxIncr = int.Parse(statIncrNode.Attribute("max").Value); float avgIncr = (minIncr + maxIncr) / 2f; float avgStat = beginStat + (player.GetStats <int>(StatsType.Level) - 1) * avgIncr; int playerStat = player.GetStats <int>(stat.StatType) - player.GetStats <int>(stat.StatBoostType); var avgDiff = (int)(playerStat - avgStat); client.SendText("", string.Format("{0}: {1} from average ({2} until max)", stat.StatName, avgDiff, maxStat - playerStat)); } return(true); }