Project update.

This commit is contained in:
MobiusDev
2015-12-31 23:53:41 +00:00
parent e0d681a17e
commit ad2bcd79be
4084 changed files with 83696 additions and 86998 deletions

View File

@@ -0,0 +1,129 @@
/*
* 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 com.l2jmobius.gameserver.model.commission;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.gameserver.model.ItemInfo;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author NosBit
*/
public class CommissionItem
{
private final long _commissionId;
private final L2ItemInstance _itemInstance;
private final ItemInfo _itemInfo;
private final long _pricePerUnit;
private final Instant _startTime;
private final byte _durationInDays;
private ScheduledFuture<?> _saleEndTask;
public CommissionItem(long commissionId, L2ItemInstance itemInstance, long pricePerUnit, Instant startTime, byte durationInDays)
{
_commissionId = commissionId;
_itemInstance = itemInstance;
_itemInfo = new ItemInfo(_itemInstance);
_pricePerUnit = pricePerUnit;
_startTime = startTime;
_durationInDays = durationInDays;
}
/**
* Gets the commission id.
* @return the commission id
*/
public long getCommissionId()
{
return _commissionId;
}
/**
* Gets the item instance.
* @return the item instance
*/
public L2ItemInstance getItemInstance()
{
return _itemInstance;
}
/**
* Gets the item info.
* @return the item info
*/
public ItemInfo getItemInfo()
{
return _itemInfo;
}
/**
* Gets the price per unit.
* @return the price per unit
*/
public long getPricePerUnit()
{
return _pricePerUnit;
}
/**
* Gets the start time.
* @return the start time
*/
public Instant getStartTime()
{
return _startTime;
}
/**
* Gets the duration in days.
* @return the duration in days
*/
public byte getDurationInDays()
{
return _durationInDays;
}
/**
* Gets the end time.
* @return the end time
*/
public Instant getEndTime()
{
return _startTime.plus(_durationInDays, ChronoUnit.DAYS);
}
/**
* Gets the sale end task.
* @return the sale end task
*/
public ScheduledFuture<?> getSaleEndTask()
{
return _saleEndTask;
}
/**
* Sets the sale end task.
* @param saleEndTask the sale end task
*/
public void setSaleEndTask(ScheduledFuture<?> saleEndTask)
{
_saleEndTask = saleEndTask;
}
}

View File

@@ -0,0 +1,121 @@
/*
* 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 com.l2jmobius.gameserver.model.commission;
/**
* @author NosBit
*/
public enum CommissionItemType
{
// Weapon
ONE_HAND_SWORD(1),
ONE_HAND_MAGIC_SWORD(2),
DAGGER(3),
RAPIER(4),
TWO_HAND_SWORD(5),
ANCIENT_SWORD(6),
DUALSWORD(7),
DUAL_DAGGER(8),
BLUNT_WEAPON(9),
ONE_HAND_MAGIC_BLUNT_WEAPON(10),
TWO_HAND_BLUNT_WEAPON(11),
TWO_HAND_MAGIC_BLUNT_WEAPON(12),
DUAL_BLUNT_WEAPON(13),
BOW(14),
CROSSBOW(15),
FIST_WEAPON(16),
SPEAR(17),
OTHER_WEAPON(18),
// Armor
HELMET(19),
ARMOR_TOP(20),
ARMOR_PANTS(21),
FULL_BODY(22),
GLOVES(23),
FEET(24),
SHIELD(25),
SIGIL(26),
UNDERWEAR(27),
CLOAK(28),
// Accessory
RING(29),
EARRING(30),
NECKLACE(31),
BELT(32),
BRACELET(33),
HAIR_ACCESSORY(34),
// Supplies
POTION(35),
SCROLL_ENCHANT_WEAPON(36),
SCROLL_ENCHANT_ARMOR(37),
SCROLL_OTHER(38),
SOULSHOT(39),
SPIRITSHOT(40),
// Pet Goods
PET_EQUIPMENT(42),
PET_SUPPLIES(43),
// Misc.
CRYSTAL(44),
RECIPE(45),
MAJOR_CRAFTING_INGREDIENTS(46),
LIFE_STONE(47),
SOUL_CRYSTAL(48),
ATTRIBUTE_STONE(49),
WEAPON_ENCHANT_STONE(50),
ARMOR_ENCHANT_STONE(51),
SPELLBOOK(52),
GEMSTONE(53),
POUCH(54),
PIN(55),
MAGIC_RUNE_CLIP(56),
MAGIC_ORNAMENT(57),
DYES(58),
OTHER_ITEM(59);
private final int _clientId;
private CommissionItemType(int clientId)
{
_clientId = clientId;
}
/**
* Gets the client id.
* @return the client id
*/
public int getClientId()
{
return _clientId;
}
/**
* Finds the commission item type by the client id
* @param clientId the client id
* @return the commission item type if its found, {@code null} otherwise
*/
public static CommissionItemType findByClientId(int clientId)
{
for (CommissionItemType value : values())
{
if (value.getClientId() == clientId)
{
return value;
}
}
return null;
}
}

View File

@@ -0,0 +1,115 @@
/*
* 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 com.l2jmobius.gameserver.model.commission;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* @author NosBit
*/
public enum CommissionTreeType
{
WEAPON(
0,
CommissionItemType.ONE_HAND_SWORD,
CommissionItemType.ONE_HAND_MAGIC_SWORD,
CommissionItemType.DAGGER,
CommissionItemType.RAPIER,
CommissionItemType.TWO_HAND_SWORD,
CommissionItemType.ANCIENT_SWORD,
CommissionItemType.DUALSWORD,
CommissionItemType.DUAL_DAGGER,
CommissionItemType.BLUNT_WEAPON,
CommissionItemType.ONE_HAND_MAGIC_BLUNT_WEAPON,
CommissionItemType.TWO_HAND_BLUNT_WEAPON,
CommissionItemType.TWO_HAND_MAGIC_BLUNT_WEAPON,
CommissionItemType.DUAL_BLUNT_WEAPON,
CommissionItemType.BOW,
CommissionItemType.CROSSBOW,
CommissionItemType.FIST_WEAPON,
CommissionItemType.SPEAR,
CommissionItemType.OTHER_WEAPON),
ARMOR(1, CommissionItemType.HELMET, CommissionItemType.ARMOR_TOP, CommissionItemType.ARMOR_PANTS, CommissionItemType.FULL_BODY, CommissionItemType.GLOVES, CommissionItemType.FEET, CommissionItemType.SHIELD, CommissionItemType.SIGIL, CommissionItemType.UNDERWEAR, CommissionItemType.CLOAK),
ACCESSORY(2, CommissionItemType.RING, CommissionItemType.EARRING, CommissionItemType.NECKLACE, CommissionItemType.BELT, CommissionItemType.BRACELET, CommissionItemType.HAIR_ACCESSORY),
SUPPLIES(3, CommissionItemType.POTION, CommissionItemType.SCROLL_ENCHANT_WEAPON, CommissionItemType.SCROLL_ENCHANT_ARMOR, CommissionItemType.SCROLL_OTHER, CommissionItemType.SOULSHOT, CommissionItemType.SPIRITSHOT),
PET_GOODS(4, CommissionItemType.PET_EQUIPMENT, CommissionItemType.PET_SUPPLIES),
MISC(
5,
CommissionItemType.CRYSTAL,
CommissionItemType.RECIPE,
CommissionItemType.MAJOR_CRAFTING_INGREDIENTS,
CommissionItemType.LIFE_STONE,
CommissionItemType.SOUL_CRYSTAL,
CommissionItemType.ATTRIBUTE_STONE,
CommissionItemType.WEAPON_ENCHANT_STONE,
CommissionItemType.ARMOR_ENCHANT_STONE,
CommissionItemType.SPELLBOOK,
CommissionItemType.GEMSTONE,
CommissionItemType.POUCH,
CommissionItemType.PIN,
CommissionItemType.MAGIC_RUNE_CLIP,
CommissionItemType.MAGIC_ORNAMENT,
CommissionItemType.DYES,
CommissionItemType.OTHER_ITEM);
private final int _clientId;
private final Set<CommissionItemType> _commissionItemTypes;
private CommissionTreeType(int clientId, CommissionItemType... commissionItemTypes)
{
_clientId = clientId;
_commissionItemTypes = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(commissionItemTypes)));
}
/**
* Gets the client id.
* @return the client id
*/
public int getClientId()
{
return _clientId;
}
/**
* Gets the filter.
* @return the filter
*/
public Set<CommissionItemType> getCommissionItemTypes()
{
return _commissionItemTypes;
}
/**
* Finds the commission tree type by the client id
* @param clientId the client id
* @return the commission tree type if its found, {@code null} otherwise
*/
public static CommissionTreeType findByClientId(int clientId)
{
for (CommissionTreeType value : values())
{
if (value.getClientId() == clientId)
{
return value;
}
}
return null;
}
}