Search in sources :

Example 1 with SoliniaNPCMerchantEntry

use of com.solinia.solinia.Models.SoliniaNPCMerchantEntry in project solinia3-core by mixxit.

the class SoliniaNPCMerchantFactory method AddNPCMerchantItem.

public static void AddNPCMerchantItem(int merchantid, int itemid) {
    try {
        ISoliniaNPCMerchant merchant = StateManager.getInstance().getConfigurationManager().getNPCMerchant(merchantid);
        SoliniaNPCMerchantEntry merchantentry = new SoliniaNPCMerchantEntry();
        int id = 1;
        for (ISoliniaNPCMerchantEntry entry : merchant.getEntries()) {
            if (entry.getId() > id)
                id = entry.getId() + 1;
        }
        merchantentry.setId(id);
        merchantentry.setMerchantid(merchantid);
        merchantentry.setItemid(itemid);
        StateManager.getInstance().getConfigurationManager().getNPCMerchant(merchantid).getEntries().add(merchantentry);
    } catch (CoreStateInitException e) {
        e.printStackTrace();
    }
}
Also used : ISoliniaNPCMerchantEntry(com.solinia.solinia.Interfaces.ISoliniaNPCMerchantEntry) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaNPCMerchant(com.solinia.solinia.Interfaces.ISoliniaNPCMerchant) SoliniaNPCMerchantEntry(com.solinia.solinia.Models.SoliniaNPCMerchantEntry) ISoliniaNPCMerchantEntry(com.solinia.solinia.Interfaces.ISoliniaNPCMerchantEntry)

Aggregations

CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)1 ISoliniaNPCMerchant (com.solinia.solinia.Interfaces.ISoliniaNPCMerchant)1 ISoliniaNPCMerchantEntry (com.solinia.solinia.Interfaces.ISoliniaNPCMerchantEntry)1 SoliniaNPCMerchantEntry (com.solinia.solinia.Models.SoliniaNPCMerchantEntry)1