123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- /*
- * 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.l2jserver.gameserver.model;
- import java.util.Arrays;
- /**
- /*
- *
- * Special thanks to nuocnam
- * Author: LittleVexy
- *
- * @version $Revision: 1.1.4.4 $ $Date: 2005/03/29 23:15:15 $
- */
- public class L2DropData
- {
- public static final int MAX_CHANCE = 1000000;
-
- private int _itemId;
- private int _minDrop;
- private int _maxDrop;
- private double _chance;
- private String _questID = null;
- private String[] _stateID = null;
-
- /**
- * Returns the ID of the item dropped
- * @return int
- */
- public int getItemId()
- {
- return _itemId;
- }
-
- /**
- * Sets the ID of the item dropped
- * @param itemId : int designating the ID of the item
- */
- public void setItemId(int itemId)
- {
- _itemId = itemId;
- }
-
- /**
- * Returns the minimum quantity of items dropped
- * @return int
- */
- public int getMinDrop()
- {
- return _minDrop;
- }
-
- /**
- * Returns the maximum quantity of items dropped
- * @return int
- */
- public int getMaxDrop()
- {
- return _maxDrop;
- }
-
- /**
- * Returns the chance of having a drop
- * @return int
- */
- public double getChance()
- {
- return _chance;
- }
-
- /**
- * Sets the value for minimal quantity of dropped items
- * @param mindrop : int designating the quantity
- */
- public void setMinDrop(int mindrop)
- {
- _minDrop = mindrop;
- }
-
- /**
- * Sets the value for maximal quantity of dopped items
- * @param maxdrop : int designating the quantity of dropped items
- */
- public void setMaxDrop(int maxdrop)
- {
- _maxDrop = maxdrop;
- }
-
- /**
- * Sets the chance of having the item for a drop
- * @param chance : int designating the chance
- */
- public void setChance(double chance)
- {
- _chance = chance;
- }
- /**
- * Returns the stateID.
- * @return String[]
- */
- public String[] getStateIDs()
- {
- return _stateID;
- }
-
- /**
- * Adds states of the dropped item
- * @param list : String[]
- */
- public void addStates(String[] list)
- {
- _stateID = list;
- }
-
- /**
- * Returns the questID.
- * @return String designating the ID of the quest
- */
- public String getQuestID()
- {
- return _questID;
- }
-
- /**
- * Sets the questID
- * @param String designating the questID to set.
- */
- public void setQuestID(String questID)
- {
- _questID = questID;
- }
-
- /**
- * Returns if the dropped item is requested for a quest
- * @return boolean
- */
- public boolean isQuestDrop()
- {
- return _questID != null && _stateID != null;
- }
-
- /**
- * Returns a report of the object
- * @return String
- */
- @Override
- public String toString()
- {
- String out = "ItemID: " + getItemId() + " Min: " + getMinDrop() +
- " Max: " + getMaxDrop() + " Chance: " + (getChance() / 10000.0) + "%";
- if (isQuestDrop())
- {
- out += " QuestID: " + getQuestID() + " StateID's: " + Arrays.toString(getStateIDs());
- }
-
- return out;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + _itemId;
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof L2DropData))
- return false;
- final L2DropData other = (L2DropData) obj;
- if (_itemId != other._itemId)
- return false;
- return true;
- }
- }
|