Esempio n. 1
0
 public CultivationPlot(CultivationInterface cInterface, byte index)
 {
     _index          = index;
     _ownerInterface = cInterface;
 }
Esempio n. 2
0
        public void Harvest()
        {
            Player harvester = _ownerInterface.GetPlayer();

            if (_stage != STAGE_FLOWERED)
            {
                harvester.SendLocalizeString(ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CULTIVATION_PLOT_NOT_FINISHED_GROWING);
                return;
            }

            if (ItemService.GetItem_Info(_seedItemID).Rarity == 3)
            {
                harvester.ItmInterface.CreateItem(_seedItemID, 1, true);
            }

            Item_Info mainItem = ItemService.GetItem_Info(uint.Parse(ItemService.GetItem_Info(_seedItemID).Craftresult.Split(';')[0]));
            Item_Info subItem  = ItemService.GetItem_Info(uint.Parse(ItemService.GetItem_Info(_seedItemID).Craftresult.Split(';')[1]));

            if (harvester.ItmInterface.GetTotalFreeInventorySlot(mainItem) < 4)
            {
                harvester.SendLocalizeString(ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CULTIVATION_CANT_HARVEST_SEED_BACKPACK_FULL);
                return;
            }

            switch (_result)
            {
            case 0:
                if (harvester.ItmInterface.CreateItem(84918, 1, true) != ItemResult.RESULT_OK)
                {
                    return;
                }

                harvester.SendLocalizeString(ItemService.GetItem_Info(84918).Name, ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_RECIPE_CRITFAILURE);
                break;

            case 1:
                if (harvester.ItmInterface.CreateItem(mainItem, 2, 0, true) != ItemResult.RESULT_OK)
                {
                    return;
                }

                harvester.SendLocalizeString(new [] { "2", mainItem.Name }, ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_CULTIVATION_HARVEST);
                break;

            case 2:
                if (harvester.ItmInterface.CreateItem(mainItem, 3, 0, true) != ItemResult.RESULT_OK)
                {
                    return;
                }

                harvester.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_CRITICALSUCCESS);
                harvester.SendLocalizeString(new[] { "3", mainItem.Name }, ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_CULTIVATION_HARVEST);
                break;

            case 3:
                if (harvester.ItmInterface.CreateItem(uint.Parse(ItemService.GetItem_Info(_seedItemID).Craftresult.Split(';')[0]), 2, true) != ItemResult.RESULT_OK)
                {
                    return;
                }

                if (harvester.ItmInterface.CreateItem(subItem, 1, 0, true) != ItemResult.RESULT_OK)
                {
                    harvester.ItmInterface.DeleteItem(ushort.Parse(ItemService.GetItem_Info(_seedItemID).Craftresult.Split(';')[0]), 2);
                    return;
                }

                uint dyepigment = 199901;
                byte seedlvl    = CultivationInterface.GetCraft(9, ItemService.GetItem_Info(_seedItemID).Crafts);


                if (seedlvl < 50)
                {
                    harvester.ItmInterface.CreateItem(dyepigment, 1, true);
                }
                else if (seedlvl < 100)
                {
                    harvester.ItmInterface.CreateItem(dyepigment += 1, 1, true);
                }
                else if (seedlvl < 150)
                {
                    harvester.ItmInterface.CreateItem(dyepigment += 2, 1, true);
                }
                else if (seedlvl < 200)
                {
                    harvester.ItmInterface.CreateItem(dyepigment += 3, 1, true);
                }
                else
                {
                    if (50 > (float)StaticRandom.Instance.NextDouble() * 100f)
                    {
                        harvester.ItmInterface.CreateItem(dyepigment += 4, 1, true);
                    }
                    else
                    {
                        harvester.ItmInterface.CreateItem(dyepigment += 5, 1, true);
                    }
                }
                harvester.SendLocalizeString(new[] { "2", mainItem.Name }, ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_CULTIVATION_HARVEST);
                harvester.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_SPECIALMOMENT);
                harvester.SendLocalizeString(new[] { "1", subItem.Name }, ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_CULTIVATION_HARVEST);
                harvester.SendLocalizeString(new[] { "1", ItemService.GetItem_Info(dyepigment).Name }, ChatLogFilters.CHATLOGFILTERS_CRAFTING, Localized_text.TEXT_CRAFT_CULTIVATION_HARVEST);
                break;
            }

            Reset();
        }