Не отображается процент создания

uter81

Знающий
Участник
Сообщения
293
Розыгрыши
0
Репутация
1
Реакции
11
Баллы
460
Хроники
  1. Master Class
Исходники
Присутствуют
Сборка
L2jmobius
Добрый день

в разделе создания предметов не отображается процент крафта.
Со стороны сервера проценты прописаны. Подскажите где поправить куда копать.

1728973825309.png
 

на стороне сервера...
там же не double, а Integer.
То-есть идёте в свою тему с "кристализаций" и берете решение от туда, попутно балуясь с количеством нулей в 100
 
У самого мобиуса сделано так:
ExPurchaseLimitShopItemListNew.java

Код:
/*
 * This file is part of the L2J Mobius project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.l2jmobius.gameserver.network.serverpackets.limitshop;

import java.util.Collection;

import org.l2jmobius.commons.network.WritableBuffer;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
import org.l2jmobius.gameserver.model.variables.AccountVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;

/**
 * @author Mobius
 */
public class ExPurchaseLimitShopItemListNew extends ServerPacket
{
    private final Player _player;
    private final int _shopType; // 3 Lcoin Store, 4 Special Craft, 100 Clan Shop
    private final int _page;
    private final int _totalPages;
    private final Collection<LimitShopProductHolder> _products;
    
    public ExPurchaseLimitShopItemListNew(Player player, int shopType, int page, int totalPages, Collection<LimitShopProductHolder> products)
    {
        _player = player;
        _shopType = shopType;
        _page = page;
        _totalPages = totalPages;
        _products = products;
    }
    
    @Override
    public void writeImpl(GameClient client, WritableBuffer buffer)
    {
        ServerPackets.EX_PURCHASE_LIMIT_SHOP_ITEM_LIST_NEW.writeId(this, buffer);
        buffer.writeByte(_shopType);
        buffer.writeByte(_page); // 311
        buffer.writeByte(_totalPages); // 311
        buffer.writeInt(_products.size());
        for (LimitShopProductHolder product : _products)
        {
            buffer.writeInt(product.getId());
            buffer.writeInt(product.getProductionId());
            buffer.writeInt(product.getIngredientIds()[0]);
            buffer.writeInt(product.getIngredientIds()[1]);
            buffer.writeInt(product.getIngredientIds()[2]);
            buffer.writeInt(product.getIngredientIds()[3]); // 306
            buffer.writeInt(product.getIngredientIds()[4]); // 306
            buffer.writeLong(product.getIngredientQuantities()[0]);
            buffer.writeLong(product.getIngredientQuantities()[1]);
            buffer.writeLong(product.getIngredientQuantities()[2]);
            buffer.writeLong(product.getIngredientQuantities()[3]); // 306
            buffer.writeLong(product.getIngredientQuantities()[4]); // 306
            buffer.writeShort(product.getIngredientEnchants()[0]);
            buffer.writeShort(product.getIngredientEnchants()[1]);
            buffer.writeShort(product.getIngredientEnchants()[2]);
            buffer.writeShort(product.getIngredientEnchants()[3]); // 306
            buffer.writeShort(product.getIngredientEnchants()[4]); // 306
            // Check limits.
            if (product.getAccountDailyLimit() > 0) // Sale period.
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountWeeklyLimit() > 0)
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_WEEKLY_COUNT + product.getProductionId(), 0) >= product.getAccountWeeklyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountWeeklyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_WEEKLY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountMonthlyLimit() > 0)
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_MONTHLY_COUNT + product.getProductionId(), 0) >= product.getAccountMonthlyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountMonthlyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_MONTHLY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountBuyLimit() > 0) // Count limit.
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountBuyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountBuyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
                }
            }
            else // No account limits.
            {
                buffer.writeInt(1);
            }
            buffer.writeInt(0); // nRemainSec
            buffer.writeInt(0); // nRemainServerItemAmount
            buffer.writeShort(0); // sCircleNum (311)
            
            // Chances (474).
            final float chance1 = product.getChance();
            final float chance2value = product.getChance2();
            final float chance3value = product.getChance3();
            final float chance4value = product.getChance4();
            final float chance2 = chance2value == 100f ? 100f - chance1 : chance2value;
            final float sum2 = chance1 + chance2;
            final float chance3 = chance3value == 100f ? 100f - sum2 : chance3value;
            final float sum3 = sum2 + chance3;
            final float chance4 = chance4value == 100f ? 100f - sum3 : chance4value;
            final float chance5 = chance4value != 100f ? 100f - (sum3 + chance4) : 0f;
            buffer.writeInt((int) (chance1 * 100000));
            buffer.writeInt((int) (chance2 * 100000));
            buffer.writeInt((int) (chance3 * 100000));
            buffer.writeInt((int) (chance4 * 100000));
            buffer.writeInt((int) (chance5 * 100000));
            
            buffer.writeInt(0); // nStartTime (464)
        }
    }
}


Это и есть шансы, которые берутся из LimitShopCraft.xml
Код:
            // Chances (474).
            final float chance1 = product.getChance();
            final float chance2value = product.getChance2();
            final float chance3value = product.getChance3();
            final float chance4value = product.getChance4();
            final float chance2 = chance2value == 100f ? 100f - chance1 : chance2value;
            final float sum2 = chance1 + chance2;
            final float chance3 = chance3value == 100f ? 100f - sum2 : chance3value;
            final float sum3 = sum2 + chance3;
            final float chance4 = chance4value == 100f ? 100f - sum3 : chance4value;
            final float chance5 = chance4value != 100f ? 100f - (sum3 + chance4) : 0f;
            buffer.writeInt((int) (chance1 * 100000));
            buffer.writeInt((int) (chance2 * 100000));
            buffer.writeInt((int) (chance3 * 100000));
            buffer.writeInt((int) (chance4 * 100000));
            buffer.writeInt((int) (chance5 * 100000));
 
У самого мобиуса сделано так:
ExPurchaseLimitShopItemListNew.java

Код:
/*
 * This file is part of the L2J Mobius project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.l2jmobius.gameserver.network.serverpackets.limitshop;

import java.util.Collection;

import org.l2jmobius.commons.network.WritableBuffer;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
import org.l2jmobius.gameserver.model.variables.AccountVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;

/**
 * @author Mobius
 */
public class ExPurchaseLimitShopItemListNew extends ServerPacket
{
    private final Player _player;
    private final int _shopType; // 3 Lcoin Store, 4 Special Craft, 100 Clan Shop
    private final int _page;
    private final int _totalPages;
    private final Collection<LimitShopProductHolder> _products;
   
    public ExPurchaseLimitShopItemListNew(Player player, int shopType, int page, int totalPages, Collection<LimitShopProductHolder> products)
    {
        _player = player;
        _shopType = shopType;
        _page = page;
        _totalPages = totalPages;
        _products = products;
    }
   
    @Override
    public void writeImpl(GameClient client, WritableBuffer buffer)
    {
        ServerPackets.EX_PURCHASE_LIMIT_SHOP_ITEM_LIST_NEW.writeId(this, buffer);
        buffer.writeByte(_shopType);
        buffer.writeByte(_page); // 311
        buffer.writeByte(_totalPages); // 311
        buffer.writeInt(_products.size());
        for (LimitShopProductHolder product : _products)
        {
            buffer.writeInt(product.getId());
            buffer.writeInt(product.getProductionId());
            buffer.writeInt(product.getIngredientIds()[0]);
            buffer.writeInt(product.getIngredientIds()[1]);
            buffer.writeInt(product.getIngredientIds()[2]);
            buffer.writeInt(product.getIngredientIds()[3]); // 306
            buffer.writeInt(product.getIngredientIds()[4]); // 306
            buffer.writeLong(product.getIngredientQuantities()[0]);
            buffer.writeLong(product.getIngredientQuantities()[1]);
            buffer.writeLong(product.getIngredientQuantities()[2]);
            buffer.writeLong(product.getIngredientQuantities()[3]); // 306
            buffer.writeLong(product.getIngredientQuantities()[4]); // 306
            buffer.writeShort(product.getIngredientEnchants()[0]);
            buffer.writeShort(product.getIngredientEnchants()[1]);
            buffer.writeShort(product.getIngredientEnchants()[2]);
            buffer.writeShort(product.getIngredientEnchants()[3]); // 306
            buffer.writeShort(product.getIngredientEnchants()[4]); // 306
            // Check limits.
            if (product.getAccountDailyLimit() > 0) // Sale period.
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountWeeklyLimit() > 0)
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_WEEKLY_COUNT + product.getProductionId(), 0) >= product.getAccountWeeklyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountWeeklyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_WEEKLY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountMonthlyLimit() > 0)
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_MONTHLY_COUNT + product.getProductionId(), 0) >= product.getAccountMonthlyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountMonthlyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_MONTHLY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountBuyLimit() > 0) // Count limit.
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountBuyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountBuyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
                }
            }
            else // No account limits.
            {
                buffer.writeInt(1);
            }
            buffer.writeInt(0); // nRemainSec
            buffer.writeInt(0); // nRemainServerItemAmount
            buffer.writeShort(0); // sCircleNum (311)
           
            // Chances (474).
            final float chance1 = product.getChance();
            final float chance2value = product.getChance2();
            final float chance3value = product.getChance3();
            final float chance4value = product.getChance4();
            final float chance2 = chance2value == 100f ? 100f - chance1 : chance2value;
            final float sum2 = chance1 + chance2;
            final float chance3 = chance3value == 100f ? 100f - sum2 : chance3value;
            final float sum3 = sum2 + chance3;
            final float chance4 = chance4value == 100f ? 100f - sum3 : chance4value;
            final float chance5 = chance4value != 100f ? 100f - (sum3 + chance4) : 0f;
            buffer.writeInt((int) (chance1 * 100000));
            buffer.writeInt((int) (chance2 * 100000));
            buffer.writeInt((int) (chance3 * 100000));
            buffer.writeInt((int) (chance4 * 100000));
            buffer.writeInt((int) (chance5 * 100000));
           
            buffer.writeInt(0); // nStartTime (464)
        }
    }
}


Это и есть шансы, которые берутся из LimitShopCraft.xml
Код:
            // Chances (474).
            final float chance1 = product.getChance();
            final float chance2value = product.getChance2();
            final float chance3value = product.getChance3();
            final float chance4value = product.getChance4();
            final float chance2 = chance2value == 100f ? 100f - chance1 : chance2value;
            final float sum2 = chance1 + chance2;
            final float chance3 = chance3value == 100f ? 100f - sum2 : chance3value;
            final float sum3 = sum2 + chance3;
            final float chance4 = chance4value == 100f ? 100f - sum3 : chance4value;
            final float chance5 = chance4value != 100f ? 100f - (sum3 + chance4) : 0f;
            buffer.writeInt((int) (chance1 * 100000));
            buffer.writeInt((int) (chance2 * 100000));
            buffer.writeInt((int) (chance3 * 100000));
            buffer.writeInt((int) (chance4 * 100000));
            buffer.writeInt((int) (chance5 * 100000));
поправил, спасибо большое !
 
У самого мобиуса сделано так:
ExPurchaseLimitShopItemListNew.java

Код:
/*
 * This file is part of the L2J Mobius project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.l2jmobius.gameserver.network.serverpackets.limitshop;

import java.util.Collection;

import org.l2jmobius.commons.network.WritableBuffer;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
import org.l2jmobius.gameserver.model.variables.AccountVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;

/**
 * @author Mobius
 */
public class ExPurchaseLimitShopItemListNew extends ServerPacket
{
    private final Player _player;
    private final int _shopType; // 3 Lcoin Store, 4 Special Craft, 100 Clan Shop
    private final int _page;
    private final int _totalPages;
    private final Collection<LimitShopProductHolder> _products;
   
    public ExPurchaseLimitShopItemListNew(Player player, int shopType, int page, int totalPages, Collection<LimitShopProductHolder> products)
    {
        _player = player;
        _shopType = shopType;
        _page = page;
        _totalPages = totalPages;
        _products = products;
    }
   
    @Override
    public void writeImpl(GameClient client, WritableBuffer buffer)
    {
        ServerPackets.EX_PURCHASE_LIMIT_SHOP_ITEM_LIST_NEW.writeId(this, buffer);
        buffer.writeByte(_shopType);
        buffer.writeByte(_page); // 311
        buffer.writeByte(_totalPages); // 311
        buffer.writeInt(_products.size());
        for (LimitShopProductHolder product : _products)
        {
            buffer.writeInt(product.getId());
            buffer.writeInt(product.getProductionId());
            buffer.writeInt(product.getIngredientIds()[0]);
            buffer.writeInt(product.getIngredientIds()[1]);
            buffer.writeInt(product.getIngredientIds()[2]);
            buffer.writeInt(product.getIngredientIds()[3]); // 306
            buffer.writeInt(product.getIngredientIds()[4]); // 306
            buffer.writeLong(product.getIngredientQuantities()[0]);
            buffer.writeLong(product.getIngredientQuantities()[1]);
            buffer.writeLong(product.getIngredientQuantities()[2]);
            buffer.writeLong(product.getIngredientQuantities()[3]); // 306
            buffer.writeLong(product.getIngredientQuantities()[4]); // 306
            buffer.writeShort(product.getIngredientEnchants()[0]);
            buffer.writeShort(product.getIngredientEnchants()[1]);
            buffer.writeShort(product.getIngredientEnchants()[2]);
            buffer.writeShort(product.getIngredientEnchants()[3]); // 306
            buffer.writeShort(product.getIngredientEnchants()[4]); // 306
            // Check limits.
            if (product.getAccountDailyLimit() > 0) // Sale period.
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountWeeklyLimit() > 0)
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_WEEKLY_COUNT + product.getProductionId(), 0) >= product.getAccountWeeklyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountWeeklyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_WEEKLY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountMonthlyLimit() > 0)
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_MONTHLY_COUNT + product.getProductionId(), 0) >= product.getAccountMonthlyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountMonthlyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_MONTHLY_COUNT + product.getProductionId(), 0));
                }
            }
            else if (product.getAccountBuyLimit() > 0) // Count limit.
            {
                if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountBuyLimit())
                {
                    buffer.writeInt(0);
                }
                else
                {
                    buffer.writeInt(product.getAccountBuyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
                }
            }
            else // No account limits.
            {
                buffer.writeInt(1);
            }
            buffer.writeInt(0); // nRemainSec
            buffer.writeInt(0); // nRemainServerItemAmount
            buffer.writeShort(0); // sCircleNum (311)
           
            // Chances (474).
            final float chance1 = product.getChance();
            final float chance2value = product.getChance2();
            final float chance3value = product.getChance3();
            final float chance4value = product.getChance4();
            final float chance2 = chance2value == 100f ? 100f - chance1 : chance2value;
            final float sum2 = chance1 + chance2;
            final float chance3 = chance3value == 100f ? 100f - sum2 : chance3value;
            final float sum3 = sum2 + chance3;
            final float chance4 = chance4value == 100f ? 100f - sum3 : chance4value;
            final float chance5 = chance4value != 100f ? 100f - (sum3 + chance4) : 0f;
            buffer.writeInt((int) (chance1 * 100000));
            buffer.writeInt((int) (chance2 * 100000));
            buffer.writeInt((int) (chance3 * 100000));
            buffer.writeInt((int) (chance4 * 100000));
            buffer.writeInt((int) (chance5 * 100000));
           
            buffer.writeInt(0); // nStartTime (464)
        }
    }
}


Это и есть шансы, которые берутся из LimitShopCraft.xml
Код:
            // Chances (474).
            final float chance1 = product.getChance();
            final float chance2value = product.getChance2();
            final float chance3value = product.getChance3();
            final float chance4value = product.getChance4();
            final float chance2 = chance2value == 100f ? 100f - chance1 : chance2value;
            final float sum2 = chance1 + chance2;
            final float chance3 = chance3value == 100f ? 100f - sum2 : chance3value;
            final float sum3 = sum2 + chance3;
            final float chance4 = chance4value == 100f ? 100f - sum3 : chance4value;
            final float chance5 = chance4value != 100f ? 100f - (sum3 + chance4) : 0f;
            buffer.writeInt((int) (chance1 * 100000));
            buffer.writeInt((int) (chance2 * 100000));
            buffer.writeInt((int) (chance3 * 100000));
            buffer.writeInt((int) (chance4 * 100000));
            buffer.writeInt((int) (chance5 * 100000));
ну у меня по хуже...
Java:
    private int getChance01(LimitShopProduct product)
    {
        if (product.getIngredientIds()[0] > 0 && product.getChance() > 0)
        {
            return getChance(product.getChance());
        }
        else if (product.getIngredientIds()[1] > 0 && product.getChance2() > 0)
        {
            return getChance(product.getChance2());
        }
        else if (product.getIngredientIds()[2] > 0 && product.getChance3() > 0)
        {
            return getChance(product.getChance3());
        }
        else if (product.getIngredientIds()[3] > 0 && product.getChance4() > 0)
        {
            return getChance(product.getChance4());
        }
        return getLastChance(product);
    }

    private int getChance02(LimitShopProduct product)
    {
        if (product.getIngredientIds()[1] > 0 && product.getChance2() > 0)
        {
            return getChance(product.getChance2());
        }
        else if (product.getIngredientIds()[2] > 0 && product.getChance3() > 0)
        {
            return getChance(product.getChance3());
        }
        else if (product.getIngredientIds()[3] > 0 && product.getChance4() > 0)
        {
            return getChance(product.getChance4());
        }
        return getLastChance(product);
    }

    private int getChance03(LimitShopProduct product)
    {
        if (product.getIngredientIds()[2] > 0 && product.getChance3() > 0)
        {
            return getChance(product.getChance3());
        }
        else if (product.getIngredientIds()[3] > 0 && product.getChance4() > 0)
        {
            return getChance(product.getChance4());
        }
        return getLastChance(product);
    }

    private int getChance04(LimitShopProduct product)
    {
        if (product.getIngredientIds()[3] > 0 && product.getChance4() > 0)
        {
            return getChance(product.getChance4());
        }
        return getLastChance(product);
    }

    private int getChance05(LimitShopProduct product)
    {
        return getLastChance(product);
    }

    private int getLastChance(LimitShopProduct product)
    {
        return getChance(100d - (product.getChance() + product.getChance2() + product.getChance3() + product.getChance4()));
    }

    private int getChance(double value)
    {
        return (int) Math.floor(100_000d * value);
    }
 
Назад
Сверху Снизу