示例#1
0
    // Token: 0x060007F4 RID: 2036 RVA: 0x0003EA27 File Offset: 0x0003CC27
    public static ZDO Create(ZDOMan man, ZDOID id, Vector3 position)
    {
        ZDO zdo = ZDOPool.Get();

        zdo.Initialize(man, id, position);
        return(zdo);
    }
示例#2
0
 private static void HandleDestroyedZDO_Prefix(ZDOMan __instance, ZDOID uid)
 {
     // This will happen when a portal is actually destroyed, not when it is simply unloaded. In this case,
     // remove the entry from our dictionary because it is never coming back.
     // Note: Every ZDO getting destroyed will call this function. We only care about ZDOs we are tracking.
     sPortals.Remove(uid);
 }
示例#3
0
 private static void Prefix(ref ZDOMan __instance, ref int ___m_dataPerSec)
 {
     if (Configuration.Current.Server.IsEnabled && Configuration.Current.Server.dataRate >= 60)
     {
         ___m_dataPerSec = Configuration.Current.Server.dataRate * 1024;
     }
 }
示例#4
0
    // Token: 0x060007F5 RID: 2037 RVA: 0x0003EA37 File Offset: 0x0003CC37
    public static ZDO Create(ZDOMan man)
    {
        ZDO zdo = ZDOPool.Get();

        zdo.Initialize(man);
        return(zdo);
    }
示例#5
0
 // Token: 0x0600075A RID: 1882 RVA: 0x0003AC3F File Offset: 0x00038E3F
 public void Initialize(ZDOMan man, ZDOID id, Vector3 position)
 {
     this.m_zdoMan   = man;
     this.m_uid      = id;
     this.m_position = position;
     this.m_sector   = ZoneSystem.instance.GetZone(this.m_position);
     this.m_zdoMan.AddToSector(this, this.m_sector);
 }
示例#6
0
 private static void Prefix(ref ZDOMan __instance, ref int ___m_dataPerSec)
 {
     if (Configuration.Current.Server.IsEnabled && Configuration.Current.Server.dataRate != ___m_dataPerSec && Configuration.Current.Server.dataRate > 0)
     {
         ___m_dataPerSec = Configuration.Current.Server.dataRate * 1024;
         Debug.Log("Server Data Rate has been set to " + ___m_dataPerSec);
     }
 }
示例#7
0
        public static void ZDOMan_Update_Postfix(ref ZDOMan __instance)
        {
            if (PortalManager.Instance.PortalPrefab == null)
            {
                return;
            }

            List <ZDO> portals = new List <ZDO>();

            __instance.GetAllZDOsWithPrefab(PortalManager.Instance.PortalPrefab.name, portals);

            PortalManager.Instance.UpdatePortals(portals);
        }
示例#8
0
        private static void Prefix(ref ZDOMan __instance, ref int ___m_dataPerSec)
        {
            // If we dont limit this to a reasonable value you will get packet pipe problems
            if (Configuration.Current.Server.dataRate > 512)
            {
                Configuration.Current.Server.dataRate = 512;
            }

            if (Configuration.Current.Server.IsEnabled && Configuration.Current.Server.dataRate >= 60)
            {
                ___m_dataPerSec = Configuration.Current.Server.dataRate * 1024;
            }
        }
示例#9
0
        public static void Postfix(ZDOMan __instance)
        {
            // proof of concept persistence, don't want to include or test it now
            return;

            var fileName     = ZNet.m_world.m_name + ".armorstands.db";
            var fullFilePath = World.GetWorldSavePath() + "/" + fileName;

            Plugin.Logger.LogInfo($"Trying to load save file at {fullFilePath}");
            if (!File.Exists(fullFilePath))
            {
                return;
            }

            try {
                using (BinaryReader reader = new BinaryReader(File.Open(fullFilePath, FileMode.Open))) {
                    var worldVersion = reader.ReadInt32();
                    Plugin.Logger.LogInfo($"World version: ${worldVersion}");
                    var zdoCount = reader.ReadInt32();
                    Plugin.Logger.LogInfo($"{zdoCount} zdos in file");

                    for (var i = 0; i < zdoCount; i++)
                    {
                        var zdo = new ZDO();
                        zdo.m_uid = new ZDOID(reader);

                        var packageSize = reader.ReadInt32();
                        var zpkg        = new ZPackage(reader.ReadBytes(packageSize));
                        zdo.Load(zpkg, worldVersion);

                        Plugin.Logger.LogInfo($"Loaded zdo {zdo.m_uid}.");
                        if (__instance.GetZDO(zdo.m_uid) == null)
                        {
                            Plugin.Logger.LogInfo("zdo not found, adding to database.");
                            __instance.m_objectsByID.Add(zdo.m_uid, zdo);
                            __instance.AddToSector(zdo, zdo.GetSector());
                        }
                        else
                        {
                            Plugin.Logger.LogInfo("zdo found in database, skipping.");
                        }
                    }
                }
            }catch (Exception exc) {
                Plugin.Logger.LogInfo(exc);
            }
        }
示例#10
0
    // Token: 0x06000877 RID: 2167 RVA: 0x00041208 File Offset: 0x0003F408
    private void Awake()
    {
        ZNetScene.m_instance = this;
        foreach (GameObject gameObject in this.m_prefabs)
        {
            this.m_namedPrefabs.Add(gameObject.name.GetStableHashCode(), gameObject);
        }
        foreach (GameObject gameObject2 in this.m_nonNetViewPrefabs)
        {
            this.m_namedPrefabs.Add(gameObject2.name.GetStableHashCode(), gameObject2);
        }
        ZDOMan instance = ZDOMan.instance;

        instance.m_onZDODestroyed = (Action <ZDO>)Delegate.Combine(instance.m_onZDODestroyed, new Action <ZDO>(this.OnZDODestroyed));
        this.m_netSceneRoot       = new GameObject("_NetSceneRoot");
        ZRoutedRpc.instance.Register <Vector3, Quaternion, int>("SpawnObject", new Action <long, Vector3, Quaternion, int>(this.RPC_SpawnObject));
    }
示例#11
0
        public static void ZNet_LoadWorld_Postfix(ref ZNet __instance, ref ZDOMan ___m_zdoMan)
        {
            if (Game.instance == null)
            {
                LogManager.Instance.Log(BepInEx.Logging.LogLevel.Error, $"[LoadWorld] Game.instance == null");
                return;
            }
            if (Game.instance.m_portalPrefab == null)
            {
                LogManager.Instance.Log(BepInEx.Logging.LogLevel.Error, $"[LoadWorld] Game.instance.m_portalPrefab == null");
                return;
            }
            if (___m_zdoMan == null)
            {
                LogManager.Instance.Log(BepInEx.Logging.LogLevel.Error, $"[LoadWorld] this.m_zdoMan == null");
                return;
            }
            GameObject portalPrefab         = Game.instance.m_portalPrefab;
            int        portalPrefabHashcode = portalPrefab.name.GetStableHashCode();

            PortalInformation?.Invoke(null, new PortalInformationEventArgs(portalPrefab, portalPrefabHashcode));
        }
示例#12
0
 public void Reset()
 {
     this.m_uid              = ZDOID.None;
     this.m_persistent       = false;
     this.m_owner            = 0L;
     this.m_timeCreated      = 0L;
     this.m_ownerRevision    = 0U;
     this.m_dataRevision     = 0U;
     this.m_pgwVersion       = 0;
     this.m_distant          = false;
     this.m_tempSortValue    = 0.0f;
     this.m_tempHaveRevision = false;
     this.m_prefab           = 0;
     this.m_sector           = Vector2i.zero;
     this.m_position         = Vector3.zero;
     this.m_rotation         = Quaternion.identity;
     this.ReleaseFloats();
     this.ReleaseVec3();
     this.ReleaseQuats();
     this.ReleaseInts();
     this.ReleaseLongs();
     this.ReleaseStrings();
     this.m_zdoMan = (ZDOMan)null;
 }
示例#13
0
 // Token: 0x0600075B RID: 1883 RVA: 0x0003AC7E File Offset: 0x00038E7E
 public void Initialize(ZDOMan man)
 {
     this.m_zdoMan = man;
 }