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 DrawChopping() { var player = EntityManager.Get <IEntity>(Game.GameSession.Player.ObjectId); var location = LocationManager.GetLocationByObjectId <ILocation>(player.CurrentLocation.ObjectId); var treeObjects = WorldObjectManager.GetLocationWorldObjectsByObjectType <IWorldObject>(location, WorldObjectBase.Objects.Tree); int _x = 0; int _y = 0; Print(_x, _y, "This forest consists of trees of type:"); _y++; foreach (var tree in treeObjects) { Print(_x, _y, tree.Name); _y++; } Print(_x, _y, $"Press H to chop wood."); }