public void OnNeedFullObjectInfo(P2PNetworkMessage netMsg) { byte[] array = netMsg.m_Reader.ReadGuidBytesTemporary(); GameObject gameObject = GuidManager.ResolveGuid(array); if (!gameObject) { if (P2PLogFilter.logError) { Debug.LogError("Cant send full object info - no object! " + new Guid(array)); } return; } ReplicationComponent replComponentForGameObject = this.GetReplComponentForGameObject(gameObject, true); if (P2PLogFilter.logPedantic) { Debug.Log(string.Format("OnNeedFullObjectInfo received for {0} guid: {1}", gameObject.name, replComponentForGameObject.GetGuidComponent.GetGuid())); } if (replComponentForGameObject != null && replComponentForGameObject.IsTransferringOwnershipTo(netMsg.m_Connection.m_Peer)) { this.SpawnForPeerAndGiveOwnership(gameObject, netMsg.m_Connection.m_Peer); return; } this.SpawnForPeer(gameObject, netMsg.m_Connection.m_Peer); }
public static Container CreateCorpse(Creature template, Position newPosition) { ushort wcidCorpse = 21; WeenieHeaderFlag weenie = WeenieHeaderFlag.ItemsCapacity | WeenieHeaderFlag.ContainersCapacity | WeenieHeaderFlag.Usable | WeenieHeaderFlag.UseRadius | WeenieHeaderFlag.Burden; ObjectDescriptionFlag objDesc = ObjectDescriptionFlag.Openable | ObjectDescriptionFlag.Stuck | ObjectDescriptionFlag.Attackable | ObjectDescriptionFlag.Corpse; // = bitfield 8213 string name = $"Corpse of {template.Name}"; Container wo = new Container(template.AceCorpse, GuidManager.NewItemGuid(), name, wcidCorpse, objDesc, weenie, newPosition); // TODO: Find the correct motionstate to create a corpse with. For now only the dead motionstate works // wo.CurrentMotionState = new GeneralMotion(MotionStance.Standing); wo.CurrentMotionState = new UniversalMotion(MotionStance.Standing, new MotionItem(MotionCommand.Dead)); wo.SoundTableId = 536871106; // SoundTableId in DB - constant value according to pcap wo.PhysicsTableId = 872415342; // phstableid in DB - constant value according to pcap wo.PhysicsDescriptionFlag = PhysicsDescriptionFlag.CSetup | PhysicsDescriptionFlag.MTable | PhysicsDescriptionFlag.ObjScale | PhysicsDescriptionFlag.STable | PhysicsDescriptionFlag.PeTable | PhysicsDescriptionFlag.Position | PhysicsDescriptionFlag.Movement; // 104579 - according to pcap wo.PhysicsState = PhysicsState.Ethereal | PhysicsState.IgnoreCollision | PhysicsState.Gravity; // 1044 - according to pcap uint tmpIcon = 100667504; wo.IconId = tmpIcon; wo.ItemCapacity = 120; // constant value according to pcap wo.ContainerCapacity = 10; // constant value according to pcap wo.Usable = Usable.ViewedRemote; // constant value according to pcap wo.UseRadius = 2.0f; // constant value according to pcap wo.Burden = 6000; // Testdata, has to be set as the sum of the spawned items in the corpse // Calculation of the TTL: 5 real time minutes * player level with a minimum of 1 hour, so we set the minimum here wo.DespawnTime = 360 + WorldManager.PortalYearTicks; return(wo); }
public static void Main(string[] args) { AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); var logRepository = LogManager.GetRepository(System.Reflection.Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); log.Info("Starting ACEmulator..."); Console.Title = @"ACEmulator"; ConfigManager.Initialize(); ServerManager.Initialize(); DatabaseManager.Initialize(); AssetManager.Initialize(); InboundMessageManager.Initialize(); DatabaseManager.Start(); DatManager.Initialize(); GuidManager.Initialize(); SocketManager.Initialize(); WorldManager.Initialize(); CommandManager.Initialize(); RecipeManager.Initialize(); DatabaseManager.Start(); }
public GameObject ReadGameObject() { GameObject gameObject = GuidManager.ResolveGuid(this.ReadGuidBytesInternal()); gameObject == null; return(gameObject); }
public void OneTimeSetup() { guidManager = new GuidManager(); guidManagerMock = new GuidManagerMock(); // set mock guid manager as singleton so guid components will not conflict it test cases. GuidManagerSingleton.SetInstance(guidManagerMock); }
public Monster(AceObject aceO) : base(aceO) { Guid = GuidManager.NewNonStaticGuid(); IsAlive = true; SetupVitals(); }
public WixDirectory(string name, string parentPath, string appRegFolder) : base("Directory") { this.Name = name; this.AppRegFolder = appRegFolder; if (!name.IsNullOrEmpty() && VariableConverter.VarToWixId.ContainsKey(name))//if it's a special folder, we just want to set the id verbatim { this.SetId(VariableConverter.VarToWixId[name]); this._path = name; } else//but if it's not a special folder, we need to create a unique ID for it using it's path { //make sure it's not too long, and sanitize it and make a removal component for it. if (parentPath.IsNullOrEmpty()) { throw new Exception(name + "'s parent path is null or empty!"); } this._path = System.IO.Path.Combine(parentPath, Name); this.SanitizeAndSetId(this._path); //if (parentPath != null) //{ // this._path = System.IO.Path.Combine(parentPath, Name); // this.SanitizeAndSetId(this._path); //} //else // this.SanitizeAndSetId(id); //now that our ID is set, let's create a removal component. string removeId = "Rmv_" + this.Id; WixComponent removeC = new WixComponent(removeId, GuidManager.GetGuid(removeId), AppRegFolder); removeC.AddRemoveFolder(new WixRemoveFolder(this.Id)); Objects.Add(removeC); removalComponent = removeC; } }
public static GameObject ResolveGuid(System.Guid guid) { if (Instance == null) { Instance = new GuidManager(); } return(Instance.ResolveGuidInternal(guid, null, null)); }
public void Guid_With_Same_Name_And_Different_Namespace_Are_Not_Equal(string firstNamespaceValue, string secondNamespaceValue) { string name = "dccf029b5c4b4031a3b943f9f745e35b"; Guid firstGuid = GuidManager.CreateDeterministicGuid(firstNamespaceValue, name); Guid secondGuid = GuidManager.CreateDeterministicGuid(secondNamespaceValue, name); Assert.NotEqual(firstGuid, secondGuid); }
// All the public API is static so you need not worry about creating an instance public static bool Add(GuidComponent guidComponent) { if (Instance == null) { Instance = new GuidManager(); } return(Instance.InternalAdd(guidComponent)); }
public static void Remove(Guid guid) { if (_instance == null) { _instance = new GuidManager(); } _instance.InternalRemove(guid); }
public static void Remove(System.Guid guid) { if (Instance == null) { Instance = new GuidManager(); } Instance.InternalRemove(guid); }
public static GameObject ResolveGuid(System.Guid guid, Action onDestroyCallback) { if (Instance == null) { Instance = new GuidManager(); } return(Instance.ResolveGuidInternal(guid, null, onDestroyCallback)); }
public static GameObject ResolveGuid(System.Guid guid, Action <GameObject> onAddCallback, Action onRemoveCallback) { if (Instance == null) { Instance = new GuidManager(); } return(Instance.ResolveGuidInternal(guid, onAddCallback, onRemoveCallback)); }
public void CreateTest() { for (int i = 0; i < 10; i++) { string result = GuidManager.Create(SequentialGuidType.SequentialAsBinary).ToString(); Debug.WriteLine(result); } Assert.True(true); }
public void Guid_With_Same_Namespace_And_Name_Are_Equal(string namespaceValue) { string name = "dccf029b5c4b4031a3b943f9f745e35b"; Guid firstGuid = GuidManager.CreateDeterministicGuid(namespaceValue, name); Guid secondGuid = GuidManager.CreateDeterministicGuid(namespaceValue, name); Guid thirdGuid = GuidManager.CreateDeterministicGuid(namespaceValue, name); Assert.Equal(firstGuid, secondGuid); Assert.Equal(firstGuid, thirdGuid); }
public GameObject ReadGameObjectAndGuid(out byte[] guid) { GameObject gameObject = GuidManager.ResolveGuid(this.ReadGuidBytesInternal()); if (gameObject == null && P2PLogFilter.logDebug) { Debug.Log("[ReadGameObject] guid not found!"); } guid = P2PNetworkReader.s_GuidBytesBuffer; return(gameObject); }
public static void Main(string[] args) { AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); var logRepository = LogManager.GetRepository(System.Reflection.Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); log.Info("Starting ACEmulator..."); Console.Title = @"ACEmulator"; log.Info("Initializing ConfigManager..."); ConfigManager.Initialize(); log.Info("Initializing ServerManager..."); ServerManager.Initialize(); log.Info("Initializing DatManager..."); DatManager.Initialize(ConfigManager.Config.Server.DatFilesDirectory); log.Info("Initializing DatabaseManager..."); DatabaseManager.Initialize(); log.Info("Starting DatabaseManager..."); DatabaseManager.Start(); log.Info("Initializing GuidManager..."); GuidManager.Initialize(); log.Info("Initializing InboundMessageManager..."); InboundMessageManager.Initialize(); log.Info("Initializing SocketManager..."); SocketManager.Initialize(); log.Info("Initializing WorldManager..."); WorldManager.Initialize(); log.Info("Initializing EventManager..."); EventManager.Initialize(); log.Info("Starting PropertyManager..."); PropertyManager.Initialize(); // This should be last log.Info("Initializing CommandManager..."); CommandManager.Initialize(); }
public static void CharacterCreate(ClientMessage message, Session session) { string account = message.Payload.ReadString16L(); if (account != session.Account) { return; } uint id = GuidManager.NewPlayerGuid().Full; CharacterCreateEx(message, session, id); }
/// <summary> /// This will create a new WorldObject with a new GUID. /// </summary> public static WorldObject CreateNewWorldObject(Weenie weenie) { var guid = GuidManager.NewDynamicGuid(); var worldObject = CreateWorldObject(weenie, guid); if (worldObject == null) { GuidManager.RecycleDynamicGuid(guid); } return(worldObject); }
public WixFile(string relativeParentFolder, string name, string source, string appRegFolder) : base("File") { this._path = Path.Combine(relativeParentFolder, name); this.SanitizeAndSetSource(source); this.SanitizeAndSetId(this._path); this.SanitizeAndSetName(name); this.DiskId = "1"; this.KeyPath = "no"; var compId = "comp_" + this._path; this._fileComponent = new WixComponent(compId, GuidManager.GetGuid(compId), appRegFolder); _fileComponent.AddFile(this); }
public static WorldObject CreateNewWorldObject(string weenieClassDescription, int palette = 0, float shade = 0, int stackSize = 1) { uint weenieClassId = DatabaseManager.World.GetWeenieClassIdByWeenieClassDescription(weenieClassDescription); if (weenieClassId < 1 && weenieClassId > AceObject.WEENIE_MAX) { return(null); } WorldObject wo = CreateWorldObject(weenieClassId, GuidManager.NewItemGuid(), palette, shade, stackSize); return(wo); }
public static void Main(string[] args) { AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); // Init our text encoding options. This will allow us to use more than standard ANSI text, which the client also supports. System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); var logRepository = LogManager.GetRepository(System.Reflection.Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); log.Info("Starting ACEmulator..."); Console.Title = @"ACEmulator"; log.Info("Initializing ConfigManager..."); ConfigManager.Initialize(); log.Info("Initializing ServerManager..."); ServerManager.Initialize(); log.Info("Initializing DatManager..."); DatManager.Initialize(ConfigManager.Config.Server.DatFilesDirectory); log.Info("Initializing DatabaseManager..."); DatabaseManager.Initialize(); log.Info("Starting DatabaseManager..."); DatabaseManager.Start(); log.Info("Initializing GuidManager..."); GuidManager.Initialize(); log.Info("Initializing InboundMessageManager..."); InboundMessageManager.Initialize(); log.Info("Initializing SocketManager..."); SocketManager.Initialize(); log.Info("Initializing WorldManager..."); WorldManager.Initialize(); log.Info("Initializing EventManager..."); EventManager.Initialize(); log.Info("Starting PropertyManager..."); PropertyManager.Initialize(); // This should be last log.Info("Initializing CommandManager..."); CommandManager.Initialize(); }
public void ForceGuid(Guid new_guid) { if (this.guid.CompareTo(new_guid) == 0) { return; } if (base.gameObject.activeSelf) { Debug.LogError("Object active when assigning guid!"); } this.serializedGuid = new_guid.ToByteArray(); this.guid = new_guid; GuidManager.Add(this); }
public void ForceGuid(byte[] new_guid_bytes) { if (base.gameObject.activeSelf) { Debug.LogError("Object active when assigning guid!"); } if (this.serializedGuid == null || this.serializedGuid.Length != GuidComponent.GUID_BYTES_CNT) { this.serializedGuid = new byte[GuidComponent.GUID_BYTES_CNT]; } new_guid_bytes.CopyTo(this.serializedGuid, 0); this.guid = new Guid(new_guid_bytes); GuidManager.Add(this); }
public void OnSpawnMessage(P2PNetworkMessage net_msg, bool take_ownership) { net_msg.ReadMessage <P2PObjectSpawnMessage>(Replicator.s_ObjectSpawnMessage); GameObject gameObject = GuidManager.ResolveGuid(Replicator.s_ObjectSpawnMessage.guid_bytes); if (P2PLogFilter.logDev) { Debug.Log(string.Format("OnSpawnMessage {0} channel: {1} take_ownership: {2}", new Guid(Replicator.s_ObjectSpawnMessage.guid_bytes), net_msg.m_ChannelId, take_ownership)); } if (!gameObject) { GameObject prefabById = P2PAssetIdCache.Instance.GetPrefabById(Replicator.s_ObjectSpawnMessage.assetId); if (prefabById) { bool activeSelf = prefabById.activeSelf; prefabById.SetActive(false); gameObject = UnityEngine.Object.Instantiate <GameObject>(prefabById, Replicator.s_ObjectSpawnMessage.position, Quaternion.identity); ReplicationComponent component = gameObject.GetComponent <ReplicationComponent>(); component.ReplOnChangedOwner(net_msg.m_Connection.m_Peer); gameObject.GetComponent <GuidComponent>().ForceGuid(Replicator.s_ObjectSpawnMessage.guid_bytes); prefabById.SetActive(activeSelf); gameObject.SetActive(activeSelf); component.ReplOnSpawned(); component.Deserialize(Replicator.s_ObjectSpawnMessage.payload, true); if (take_ownership) { component.ReplRequestOwnership(); return; } } else if (P2PLogFilter.logError) { Debug.LogError(string.Format("OnSpawnMessage no asset found {0}", Replicator.s_ObjectSpawnMessage.assetId)); return; } } else { if (P2PLogFilter.logWarn) { Debug.LogWarning(string.Format("OnSpawnMessage found target for supposedly new object to spawn {0} {1}", gameObject.name, new Guid(Replicator.s_ObjectSpawnMessage.guid_bytes))); } ReplicationComponent replComponentForGameObject = this.GetReplComponentForGameObject(gameObject, true); replComponentForGameObject.Deserialize(Replicator.s_ObjectSpawnMessage.payload, true); if (take_ownership) { replComponentForGameObject.ReplRequestOwnership(); } } }
/// <inheritdoc /> public override Guid NewGuid() { // The name is a combination of the instance ID, the current orchestrator date/time, and a counter. string guidNameValue = string.Concat( this.InstanceId, "_", this.innerContext.CurrentUtcDateTime.ToString("o"), "_", this.newGuidCounter.ToString()); this.newGuidCounter++; return(GuidManager.CreateDeterministicGuid(GuidManager.UrlNamespaceValue, guidNameValue)); }
public Transform ReadTransform() { GameObject gameObject = GuidManager.ResolveGuid(this.ReadGuidBytesInternal()); if (gameObject == null) { if (P2PLogFilter.logDebug) { Debug.Log("[ReadTransform] guid not found"); } return(null); } return(gameObject.transform); }
//------------------------------------------------------------------------- // Unity API //------------------------------------------------------------------------- private void Awake() { GuidComponent guid = GetComponent <GuidComponent>(); if (guid != null) { GuidManager.Add(guid); } else { Debug.LogWarning("Dialog Graph \"" + name + "\" is missing a GuidComponent! Add one in the unity editor."); } RefreshNodeList(); }
public void Send(Envelope email) { if (email == null) { throw new ArgumentNullException(nameof(email)); } Ensure.NotNullOrWhiteSpace(email.From.Name, nameof(email.From.Name)); Ensure.NotNullOrWhiteSpace(email.From.Address, nameof(email.From.Address)); Ensure.NotNullOrWhiteSpace(email.To[0].Name, nameof(email.To)); Ensure.NotNullOrWhiteSpace(email.To[0].Address, nameof(email.To)); var e = new NewOutgoingEmail(GuidManager.NewGuid(), email, DateTime.Now); this.connection.AppendToStreamAsync(this.queueStreamName, ExpectedVersion.Any, this.serializer.Serialize(e.EmailId, e.EmailId, e)).Wait(); }