public override void Action(CommandCaller caller, string input, string[] args) { int npcCount = UsefulThings.CalculateNPCCount(); int taxRate = ModHandler.parser.CalculateRate(); long rate = TaxWorld.serverConfig.TimeBetweenPaychecks; caller.Reply("Tax rate: " + UsefulThings.ValueToCoins(taxRate * npcCount) + " per " + TimeSpan.FromSeconds(rate / Main.dayRate).ToString(@"mm\:ss") + "\nUnadjusted tax rate: " + UsefulThings.ValueToCoins(taxRate) + " per " + TimeSpan.FromSeconds(rate).ToString(@"mm\:ss") + " per NPC\nHoused NPC Count: " + npcCount, Color.Yellow); }
private string RecursiveDFS(Tree <IToken, string> node) { if (node.IsLeaf) { return(node.Content); } var tag = node.Value; var tagContent = string.Join("", node.Children.Select(RecursiveDFS)); return(tag.IsClosed ? UsefulThings.ConverToHtml(tag.HtmlTag, tagContent) : $"{tag.MdTag}{tagContent}"); }
public override void OnChatButtonClicked(NPC npc, bool firstButton) { if (npc.type == NPCID.TaxCollector && !firstButton && TaxWorld.serverConfig.AddCustomDialog) { Main.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f); int rawTax = ModHandler.parser.CalculateRate(); int adjustedTax = rawTax * UsefulThings.CalculateNPCCount(); double rate = TaxWorld.serverConfig.TimeBetweenPaychecks / Main.dayRate; Main.npcChatText = Language.GetTextValue("Mods.BetterTaxes.Status.StatusMessage").Replace(@"%1", UsefulThings.ValueToCoinsWithColor(rawTax)).Replace(@"%2", UsefulThings.SecondsToHMSCasual((int)rate)).Replace(@"%3", UsefulThings.ValueToCoinsWithColor(adjustedTax * (3600 / rate))); } }
static void Main(string[] args) { Console.InputEncoding = Encoding.Unicode; Console.OutputEncoding = Encoding.Unicode; Console.WriteLine("Hello server!"); //Console.Write("Port: "); //int port = int.Parse(Console.ReadLine() ?? string.Empty); int port = 57650; Console.WriteLine($"Your ip is {UsefulThings.GetPublicIpAddress()}:{port}"); Socket socket = TcpSocketHelper.CreateSocket(); EndPoint localEndPoint = TcpSocketHelper.BindSocket(socket, IPAddress.Loopback, port); socket.Listen(10); while (true) { Client client = new Client(); client.Socket = socket.Accept(); Connections.Add(client); Task task = Receive(client); } }
public bool IsCorrectSurroundingsForClosingTag(char?prevSymbol, char?nextSymbol) { return(UsefulThings.IsCorrectPrevSymbolForClosingTag(prevSymbol) && UsefulThings.IsCorrectNextSymbolForClosingTag(nextSymbol)); }
private void nameOrExtensionChanged(object sender, TextChangedEventArgs e) { UsefulThings.controlLettersAndDigits(sender as TextBox); okBtn.IsEnabled = nameEdit.Text.Length > 0 && (fh.IsDirectory || extensionEdit.Text.Length > 0); }