Esempio n. 1
0
        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);
            }
        }