1. These forums are still being retired! Please use GitHub discussions or Discord. You cannot create new threads or new accounts now. If you need to contact some user of the forums, you should do it sooner, rather than later. This notice was last updated on May 30th, 2021.

I need some help! The modded server issue. (Players doesn't move in real-time)

Discussion in 'Help and Support' started by SamemaS, Apr 20, 2014.

  1. SamemaS

    SamemaS Level 1

    Joined:
    Apr 20, 2014
    Messages:
    7
    My (internet)friend has built a "Modded server", and we've tested out how it's going. and all functions was 'Flawless'...
    until that issues. When we testing with some of players and the players are not moving. it's like- the player's computer is frozen, but the testing player's response was it's computer is running with flawless. so then, i need your help. and below is the problem code.

    [EDIT : we've decompiled Tshock's TerrariaServer.exe and this is code of StreamGenericExt.cs ]

    -- <The problem code sent by the server's admin>--
    Code:
    // Type: System.IO.Streams.Generic.StreamGenericExt
     
    // Assembly: TerrariaServer, Version=1.15.0.0, Culture=neutral, PublicKeyToken=null
     
    // MVID: FDC658C9-8AD9-46A5-9678-C7F63543B64F
     
    // Assembly location: C:\Users\Renard\Downloads\TShock.4.2.2.0224\TerrariaServer.exe
     
     
     
    using System;
     
    using System.Collections.Generic;
     
    using System.IO;
     
    using System.IO.Streams;
     
     
     
    namespace System.IO.Streams.Generic
     
    {
     
      public static class StreamGenericExt
     
      {
     
        private static Dictionary<Type, Action<Stream, object>> WriteFuncs = new Dictionary<Type, Action<Stream, object>>()
     
        {
     
          {
     
            typeof (bool),
     
            (Action<Stream, object>) ((s, o) => StreamExt.WriteBoolean(s, (bool) o))
     
          },
     
          {
     
            typeof (byte),
     
            (Action<Stream, object>) ((s, o) => StreamExt.WriteInt8(s, (byte) o))
     
          },
     
          {
     
            typeof (short),
     
            (Action<Stream, object>) ((bw, data) => StreamExt.WriteInt16(bw, (short) data))
     
          },
     
          {
     
            typeof (int),
     
            (Action<Stream, object>) ((bw, data) => StreamExt.WriteInt32(bw, (int) data))
     
          },
     
          {
     
            typeof (long),
     
            (Action<Stream, object>) ((bw, data) => StreamExt.WriteInt64(bw, (long) data))
     
          },
     
          {
     
            typeof (float),
     
            (Action<Stream, object>) ((bw, data) => StreamExt.WriteSingle(bw, (float) data))
     
          },
     
          {
     
            typeof (double),
     
            (Action<Stream, object>) ((bw, data) => StreamExt.WriteDouble(bw, (double) data))
     
          },
     
          {
     
            typeof (byte[]),
     
            (Action<Stream, object>) ((s, o) => StreamExt.WriteBytesWithLength(s, (byte[]) o))
     
          },
     
          {
     
            typeof (string),
     
            (Action<Stream, object>) ((s, o) => StreamExt.WriteString(s, (string) o))
     
          }
     
        };
     
        private static Dictionary<Type, Func<Stream, object>> ReadFuncs;
     
     
     
        static StreamGenericExt()
     
        {
     
            Dictionary<Type, Func<Stream, object>> dictionary1 = new Dictionary<Type, Func<Stream, object>>();
     
            dictionary1.Add(typeof(bool), (Func<Stream, object>)(s => StreamExt.ReadBoolean(s) ? (object)true : (object)false));
     
            dictionary1.Add(typeof(byte), (Func<Stream, object>)(s => (object)StreamExt.ReadInt8(s)));
     
            dictionary1.Add(typeof(short), (Func<Stream, object>)(br => (object)StreamExt.ReadInt16(br)));
     
            dictionary1.Add(typeof(int), (Func<Stream, object>)(br => (object)StreamExt.ReadInt32(br)));
     
            dictionary1.Add(typeof(long), (Func<Stream, object>)(br => (object)StreamExt.ReadInt64(br)));
     
            dictionary1.Add(typeof(float), (Func<Stream, object>)(br => (object)StreamExt.ReadSingle(br)));
     
            dictionary1.Add(typeof(double), (Func<Stream, object>)(br => (object)StreamExt.ReadDouble(br)));
     
            Dictionary<Type, Func<Stream, object>> dictionary2 = dictionary1;
     
     
     
            Type key1 = typeof (byte[]);
     
            // ISSUE: reference to a compiler-generated field
     
            if (StreamGenericExt.cache7 == null)
     
            {
     
              // ISSUE: reference to a compiler-generated field
     
              StreamGenericExt.cache7 = new Func<Stream, object>(StreamExt.ReadBytesWithLength);
     
            }
     
            // ISSUE: reference to a compiler-generated field
     
            Func<Stream, object> func1 = StreamGenericExt.cache7;
     
            dictionary2.Add(key1, func1);
     
            Dictionary<Type, Func<Stream, object>> dictionary3 = dictionary1;
     
            Type key2 = typeof (string);
     
            // ISSUE: reference to a compiler-generated field
     
            if (StreamGenericExt.cache8 == null)
     
            {
     
              // ISSUE: reference to a compiler-generated field
     
              StreamGenericExt.cache8 = new Func<Stream, object>(StreamExt.ReadString);
     
            }
     
            // ISSUE: reference to a compiler-generated field
     
            Func<Stream, object> func2 = StreamGenericExt.cache8;
     
            dictionary3.Add(key2, func2);
     
          StreamGenericExt.ReadFuncs = dictionary1;
     
        }
     
     
     
        public static void Write<T>(this Stream stream, T obj)
     
        {
     
          if (!StreamGenericExt.WriteFuncs.ContainsKey(typeof (T)))
     
            throw new NotImplementedException();
     
          StreamGenericExt.WriteFuncs[typeof (T)](stream, (object) obj);
     
        }
     
     
     
        public static T Read<T>(this Stream stream)
     
        {
     
          if (StreamGenericExt.ReadFuncs.ContainsKey(typeof (T)))
     
            return (T) StreamGenericExt.ReadFuncs[typeof (T)](stream);
     
          else
     
            throw new NotImplementedException();
     
        }
     
      }
     
    }
     
    
    (And i'm really sorry about my bad English.)
     
  2. Ancientgods

    Plugin Developer Zero Day Plugin Author

    Joined:
    Sep 15, 2013
    Messages:
    712
    So is this a TShock issue or what? because it doesn't look like it is
     
  3. SamemaS

    SamemaS Level 1

    Joined:
    Apr 20, 2014
    Messages:
    7
    I've edited it. sorry
     
  4. Ancientgods

    Plugin Developer Zero Day Plugin Author

    Joined:
    Sep 15, 2013
    Messages:
    712
  5. SamemaS

    SamemaS Level 1

    Joined:
    Apr 20, 2014
    Messages:
    7
  6. Ancientgods

    Plugin Developer Zero Day Plugin Author

    Joined:
    Sep 15, 2013
    Messages:
    712
    How is it not the latest version lol? I'm pretty sure it's 1.2.3.1
     
  7. SamemaS

    SamemaS Level 1

    Joined:
    Apr 20, 2014
    Messages:
    7
    Aaaand.. there's also not 1.2.3.1. any answers?
     
  8. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,598
    The source on Github is the latest version.
    If you modified the ServerAPI or TShock, then we cannot help you.
    If you modify things and break it in such a way that it does not work and you cannot fix it, you should not be modifying things
     
    • Like Like x 1
  9. SamemaS

    SamemaS Level 1

    Joined:
    Apr 20, 2014
    Messages:
    7
    then how do i perform the thing?
    and can i do it with pure tshock and serverAPI to "Mod server" like avalon mod?(or custom mod)
     
  10. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,598
    I have no idea which thing you want to perform, nor do I have any knowledge of custom mods or the avalon mod.
    If you modify the TShock or TerrariaServerAPI in a non-standard way, we cannot offer you support.

    Consider this analogy:
    If I installed a hamster cage into my PS3, and the hamster's byproducts destroyed my PS3, the help and support people would not help and support me because I've modified my PS3 in a non-standard way.
     
    • Like Like x 1
  11. SamemaS

    SamemaS Level 1

    Joined:
    Apr 20, 2014
    Messages:
    7

    Then can you help me with adding items in our server? i'm wondering how.
     
  12. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,598
    Adding new items that are not in the game requires modifying your Terraria client, and the client of anyone else who wishes to use said items. This cannot be done server side
    You may be better off looking at tAPI (search for it on http://www.terrariaonline.com)
     
  13. SamemaS

    SamemaS Level 1

    Joined:
    Apr 20, 2014
    Messages:
    7
    and how do i make tshock (or server) read mod items ?
     
  14. Ancientgods

    Plugin Developer Zero Day Plugin Author

    Joined:
    Sep 15, 2013
    Messages:
    712
    Same way you import sprites into an xna game? And if you don't know how to do that I honestly don't think you should be trying to make a mod for this game.
     
  15. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,598
    Look at how it handles the items currently in-game and build upon that