private void OpenChoppingWindow() { var player = EntityManager.Get <IEntity>(Game.GameSession.Player.ObjectId); if (WorldObjectManager.ContainsWorldObject <ILocation>(player.CurrentLocation, GameObjects.WorldObjectBase.Objects.Tree)) { this.SwitchFocusMakeVisible(UserInterfaceManager.Get <ChoppingWindow>()); } }
private static void ChopWood() { var player = Game.GameSession.Player; var currentLocation = LocationManager.GetLocationByObjectId <ILocation>(player.CurrentLocation.ObjectId); if (WorldObjectManager.ContainsWorldObject(currentLocation, WorldObjectBase.Objects.Tree)) { var tree = WorldObjectManager.GetLocationWorldObjectsByObjectType <IWorldObject>(currentLocation, WorldObjectBase.Objects.Tree).FirstOrDefault(); var reward = tree.Items.FirstOrDefault(); InventoryManager.AddToInventory <PlayerInventory>(reward); MessageManager.AddItemObtained(reward.Name, 1); } }
private void UpdateKeybindingVisibility() { KeybindingManager.UpdateVisibility(Keybindings.Chop, WorldObjectManager.ContainsWorldObject(Game.GameSession.Player.CurrentLocation, GameObjects.WorldObjectBase.Objects.Tree) && this.IsFocused); }