private void ActionKeyMappingOpenBags_ActionTriggered(object sender, ActionTriggeredEventArgs e) { if (world.PlayerCharacter == null) { return; } if (world.PlayerCharacter.Inventory == null) { return; } if (world.PlayerCharacter.IsDead) { return; } List <Item> worldItems = world.WorldItemsInRange(world.PlayerCharacter.Id); ContainerItem worldItemsTempContainer = new BagClientItem(worldItems); ContainerItem playerContainer = (BagClientItem)world.PlayerCharacter.Inventory; InventoryScreen inventoryScreen = new InventoryScreen(world, worldItemsTempContainer, playerContainer); //inventoryScreen.Player = world.PlayerCharacter; //inventoryScreen.BaseContainer = (BagClientItem)world.PlayerCharacter.Inventory; //new ClientBagItem((BagItem)world.GetItem(world.PlayerCharacter.InventoryBagId)); //inventoryScreen.GroundItems = world.GroundItemsInRange(world.PlayerCharacter.Id); inventoryScreen.Initialize(this.Manager); inventoryScreen.Activate(); }
internal ClientCharacter CreateCharacter(CharacterModel charData) //, ItemData inventoryData) { ClientCharacter character = new ClientCharacter(charData.Id, charData.WorldLocation); character.Stats.Health = charData.Health; character.Stats.Energy = charData.Energy; foreach (var power in charData.Powers) { character.Learn((CharacterPowerIdentity)power); } if (charData.RightHandId.HasValue) { character.RightHand = (WeaponItem)this.GetItem(charData.RightHandId.Value); } if (charData.LeftHandId.HasValue) { character.LeftHand = (WeaponItem)this.GetItem(charData.RightHandId.Value); } if (charData.ArmorId.HasValue) { character.Armor = (ArmorItem)this.GetItem(charData.ArmorId.Value); } BagClientItem inventory = (BagClientItem)this.GetItem(charData.InventoryId); character.Inventory = inventory; //character.InventoryData = inventory.Data; //inventoryData; //dataContext.GetItem(charData.InventoryID); //if (character.InventoryData != null) // character.Inventory = inventory; //(BagClientItem)this.CreateItem(character.InventoryData); //world.AddCharacter(character); //this.AddItem(character.Inventory); return(character); }