Example #1
0
        private void OnReload(ReloadEventArgs args)
        {
            NPCShopConfig config = NPCShopConfig.Read(Path.Combine(TShock.SavePath,
                                                                   "custom-NPC-shop-config.json"));

            TicksBetweenUpdate = (config.UpdateTimer / 16);
            Packets.Initialize(config);
            args.Player?.SendSuccessMessage("[Custom NPC Shops] Successfully reloaded config!");
        }
Example #2
0
 private void OnUpdate(EventArgs args)
 {
     if (++UpdateTick % TicksBetweenUpdate != 0)
     {
         return;
     }
     foreach (KeyValuePair <byte, short> pair in ActiveNPCs)
     {
         TSPlayer player = TShock.Players[pair.Key];
         if (player?.Active != true)
         {
             continue;
         }
         try
         {
             if (Packets.Get(Main.npc[pair.Value], out byte[][] packets))