Esempio n. 1
0
    private static void AddRewardItemsToInventory(GameSession session, RecipeMetadata recipe)
    {
        // award items
        List <RecipeItem> resultItems = recipe.RewardItems;

        foreach (RecipeItem resultItem in resultItems)
        {
            Item rewardItem = new(resultItem.ItemId)
            {
                Rarity = resultItem.Rarity,
                Amount = resultItem.Amount
            };
            session.Player.Inventory.AddItem(session, rewardItem, true);
            session.Send(MasteryPacket.GetCraftedItem((MasteryType)recipe.MasteryType, rewardItem));
        }

        // add mastery exp
        session.Player.Levels.GainMasteryExp((MasteryType)recipe.MasteryType, recipe.RewardMastery);

        // add player exp
        if (recipe.ExceptRewardExp)
        {
            // TODO: add metadata for common exp tables to be able to look up exp amount for masteries etc.
        }
    }
Esempio n. 2
0
        private static void AddRewardItemsToInventory(GameSession session, RecipeMetadata recipe)
        {
            // award items
            List <RecipeItem> result = recipe.GetResult();

            for (int i = 0; i < result.Count; i++)
            {
                Item rewardItem = new(result.ElementAt(i).Id)
                {
                    Rarity = result.ElementAt(i).Rarity,
                    Amount = result.ElementAt(i).Amount
                };
                InventoryController.Add(session, rewardItem, true);
                session.Send(MasteryPacket.GetCraftedItem((MasteryType)(recipe.MasteryType), rewardItem));
            }

            // add mastery exp
            session.Player.Levels.GainMasteryExp((MasteryType)recipe.MasteryType, recipe.RewardMastery);

            // add player exp
            if (recipe.ExceptRewardExp)
            {
                // TODO: add metadata for common exp tables to be able to look up exp amount for masteries etc.
            }
        }