private void OnCharacterSelected(object sender, CharacterSessionEventArgs e) { Logger.Debug("OnCharacterSelected: " + e.CharacterSession); var client = GetClientFromSession(e.CharacterSession.Session); Logger.Debug("Client: " + client.Name); this.comms.Event(CharacterEvents.Selected).ToClient(client).Emit(e.CharacterSession); }
protected void SpawnForPlayer(CharacterSessionEventArgs e) { lock (SpawnLock) { var vehiclesToSpawn = this.ActiveVehicles .Where(v => v.Handle == null && Vector3.Distance(v.Position.ToVector3().ToCitVector3(), e.CharacterSession.Character.Position.ToVector3().ToCitVector3()) < this.Configuration.DespawnDistance ); foreach (var vehicle in vehiclesToSpawn) { // TODO: Await client response to prevent races. this.comms.Event(VehicleEvents.Spawn).ToClient(this.clientList.Clients.First(c => c.Handle == e.CharacterSession.Session.Handle)).Emit(vehicle); } } }
private void OnCharacterSelect(object sender, CharacterSessionEventArgs e) { var characterInventories = this.CharacterManager.GetCharacterInventories(e.CharacterSession.CharacterId); this.Logger.Warn("Character Inventory: " + characterInventories.First().Items.First().ItemDefinition.Name); var containers = new List <Container>(); foreach (var characterInventory in characterInventories) { this.Logger.Warn($"container: {characterInventory.Id}"); foreach (var characterInventoryItem in characterInventory.Items) { this.Logger.Warn($"Item: {characterInventoryItem.Id}"); this.Logger.Warn($"Item Def: {characterInventoryItem.ItemDefinition.Id}"); } containers.Add(characterInventory.ToUiContainer()); } this.Rpc.Event(InventoryUiEvents.LoadCharacterInventories).Trigger(containers); }