Removal of QuestItemHolder class.

This commit is contained in:
MobiusDevelopment
2022-01-29 00:15:02 +00:00
parent 853e48cd81
commit a849367e88
106 changed files with 603 additions and 1868 deletions

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder; import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -48,25 +48,25 @@ public class Alexandria extends AbstractNpcAI
new ItemHolder(9817, 50), new ItemHolder(9817, 50),
}; };
// Agathions // Agathions
private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_DEVILS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10321, 600, 1, 10408), new AdditionalItemChanceHolder(10321, 600, 1, 10408),
new QuestItemHolder(10322, 10), new ItemChanceHolder(10322, 10),
new QuestItemHolder(10323, 10), new ItemChanceHolder(10323, 10),
new QuestItemHolder(10324, 5), new ItemChanceHolder(10324, 5),
new QuestItemHolder(10325, 5), new ItemChanceHolder(10325, 5),
new QuestItemHolder(10326, 370), new ItemChanceHolder(10326, 370),
}; };
private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_ANGELS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10315, 600, 1, 10408), new AdditionalItemChanceHolder(10315, 600, 1, 10408),
new QuestItemHolder(10316, 10), new ItemChanceHolder(10316, 10),
new QuestItemHolder(10317, 10), new ItemChanceHolder(10317, 10),
new QuestItemHolder(10318, 5), new ItemChanceHolder(10318, 5),
new QuestItemHolder(10319, 5), new ItemChanceHolder(10319, 5),
new QuestItemHolder(10320, 370), new ItemChanceHolder(10320, 370),
}; };
private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); private static final Map<String, List<ItemChanceHolder>> AGATHIONS = new HashMap<>();
static static
{ {
@@ -94,7 +94,7 @@ public class Alexandria extends AbstractNpcAI
final int chance = getRandom(1000); final int chance = getRandom(1000);
int chance2 = 0; int chance2 = 0;
int chance3 = 0; int chance3 = 0;
for (QuestItemHolder agathion : AGATHIONS.get(event)) for (ItemChanceHolder agathion : AGATHIONS.get(event))
{ {
chance3 += agathion.getChance(); chance3 += agathion.getChance();
if ((chance >= chance2) && (chance2 < chance3)) if ((chance >= chance2) && (chance2 < chance3))
@@ -103,9 +103,9 @@ public class Alexandria extends AbstractNpcAI
{ {
giveItems(player, agathion); giveItems(player, agathion);
htmltext = "30098-03.html"; htmltext = "30098-03.html";
if (agathion instanceof AdditionalQuestItemHolder) if (agathion instanceof AdditionalItemChanceHolder)
{ {
giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); giveItems(player, ((AdditionalItemChanceHolder) agathion).getAdditionalId(), 1);
htmltext = "30098-03a.html"; htmltext = "30098-03a.html";
} }
} }
@@ -121,11 +121,11 @@ public class Alexandria extends AbstractNpcAI
return htmltext; return htmltext;
} }
private static class AdditionalQuestItemHolder extends QuestItemHolder private static class AdditionalItemChanceHolder extends ItemChanceHolder
{ {
private final int _additionalId; private final int _additionalId;
public AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) public AdditionalItemChanceHolder(int id, int chance, long count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;

View File

@@ -22,7 +22,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.enums.QuestSound; import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.util.Util; import org.l2jmobius.gameserver.util.Util;
@@ -101,15 +101,15 @@ public class Q00372_LegacyOfInsolence extends Quest
private static final int SEALED_MAJESTIC_CIRCLET_DESIGN = 5528; private static final int SEALED_MAJESTIC_CIRCLET_DESIGN = 5528;
// Monsters // Monsters
private static final int HALLATES_INSPECTOR = 20825; private static final int HALLATES_INSPECTOR = 20825;
private static final Map<Integer, QuestItemHolder> MONSTER_REWARDS = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MONSTER_REWARDS = new HashMap<>();
static static
{ {
MONSTER_REWARDS.put(20817, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 302, 1)); MONSTER_REWARDS.put(20817, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 302, 1));
MONSTER_REWARDS.put(20821, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 410, 1)); MONSTER_REWARDS.put(20821, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 410, 1));
MONSTER_REWARDS.put(HALLATES_INSPECTOR, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 447, 1)); MONSTER_REWARDS.put(HALLATES_INSPECTOR, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 447, 1));
MONSTER_REWARDS.put(20829, new QuestItemHolder(ANCIENT_BLUE_PAPYRUS, 451, 1)); MONSTER_REWARDS.put(20829, new ItemChanceHolder(ANCIENT_BLUE_PAPYRUS, 451, 1));
MONSTER_REWARDS.put(21062, new QuestItemHolder(ANCIENT_WHITE_PAPYRUS, 290, 1)); MONSTER_REWARDS.put(21062, new ItemChanceHolder(ANCIENT_WHITE_PAPYRUS, 290, 1));
MONSTER_REWARDS.put(21069, new QuestItemHolder(ANCIENT_BLACK_PAPYRUS, 280, 1)); MONSTER_REWARDS.put(21069, new ItemChanceHolder(ANCIENT_BLACK_PAPYRUS, 280, 1));
} }
// Misc // Misc
@@ -445,7 +445,7 @@ public class Q00372_LegacyOfInsolence extends Quest
@Override @Override
public String onKill(Npc npc, Player killer, boolean isSummon) public String onKill(Npc npc, Player killer, boolean isSummon)
{ {
final QuestItemHolder item = MONSTER_REWARDS.get(npc.getId()); final ItemChanceHolder item = MONSTER_REWARDS.get(npc.getId());
if (npc.getId() == HALLATES_INSPECTOR) if (npc.getId() == HALLATES_INSPECTOR)
{ {
if (getRandom(1000) < item.getChance()) if (getRandom(1000) < item.getChance())

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder; import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -48,25 +48,25 @@ public class Alexandria extends AbstractNpcAI
new ItemHolder(9817, 50), new ItemHolder(9817, 50),
}; };
// Agathions // Agathions
private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_DEVILS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10321, 600, 1, 10408), new AdditionalItemChanceHolder(10321, 600, 1, 10408),
new QuestItemHolder(10322, 10), new ItemChanceHolder(10322, 10),
new QuestItemHolder(10323, 10), new ItemChanceHolder(10323, 10),
new QuestItemHolder(10324, 5), new ItemChanceHolder(10324, 5),
new QuestItemHolder(10325, 5), new ItemChanceHolder(10325, 5),
new QuestItemHolder(10326, 370), new ItemChanceHolder(10326, 370),
}; };
private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_ANGELS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10315, 600, 1, 10408), new AdditionalItemChanceHolder(10315, 600, 1, 10408),
new QuestItemHolder(10316, 10), new ItemChanceHolder(10316, 10),
new QuestItemHolder(10317, 10), new ItemChanceHolder(10317, 10),
new QuestItemHolder(10318, 5), new ItemChanceHolder(10318, 5),
new QuestItemHolder(10319, 5), new ItemChanceHolder(10319, 5),
new QuestItemHolder(10320, 370), new ItemChanceHolder(10320, 370),
}; };
private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); private static final Map<String, List<ItemChanceHolder>> AGATHIONS = new HashMap<>();
static static
{ {
@@ -94,7 +94,7 @@ public class Alexandria extends AbstractNpcAI
final int chance = getRandom(1000); final int chance = getRandom(1000);
int chance2 = 0; int chance2 = 0;
int chance3 = 0; int chance3 = 0;
for (QuestItemHolder agathion : AGATHIONS.get(event)) for (ItemChanceHolder agathion : AGATHIONS.get(event))
{ {
chance3 += agathion.getChance(); chance3 += agathion.getChance();
if ((chance >= chance2) && (chance2 < chance3)) if ((chance >= chance2) && (chance2 < chance3))
@@ -103,9 +103,9 @@ public class Alexandria extends AbstractNpcAI
{ {
giveItems(player, agathion); giveItems(player, agathion);
htmltext = "30098-03.html"; htmltext = "30098-03.html";
if (agathion instanceof AdditionalQuestItemHolder) if (agathion instanceof AdditionalItemChanceHolder)
{ {
giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); giveItems(player, ((AdditionalItemChanceHolder) agathion).getAdditionalId(), 1);
htmltext = "30098-03a.html"; htmltext = "30098-03a.html";
} }
} }
@@ -121,11 +121,11 @@ public class Alexandria extends AbstractNpcAI
return htmltext; return htmltext;
} }
private static class AdditionalQuestItemHolder extends QuestItemHolder private static class AdditionalItemChanceHolder extends ItemChanceHolder
{ {
private final int _additionalId; private final int _additionalId;
public AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) public AdditionalItemChanceHolder(int id, int chance, long count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder; import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -48,25 +48,25 @@ public class Alexandria extends AbstractNpcAI
new ItemHolder(9817, 50), new ItemHolder(9817, 50),
}; };
// Agathions // Agathions
private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_DEVILS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10321, 600, 1, 10408), new AdditionalItemChanceHolder(10321, 600, 1, 10408),
new QuestItemHolder(10322, 10), new ItemChanceHolder(10322, 10),
new QuestItemHolder(10323, 10), new ItemChanceHolder(10323, 10),
new QuestItemHolder(10324, 5), new ItemChanceHolder(10324, 5),
new QuestItemHolder(10325, 5), new ItemChanceHolder(10325, 5),
new QuestItemHolder(10326, 370), new ItemChanceHolder(10326, 370),
}; };
private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_ANGELS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10315, 600, 1, 10408), new AdditionalItemChanceHolder(10315, 600, 1, 10408),
new QuestItemHolder(10316, 10), new ItemChanceHolder(10316, 10),
new QuestItemHolder(10317, 10), new ItemChanceHolder(10317, 10),
new QuestItemHolder(10318, 5), new ItemChanceHolder(10318, 5),
new QuestItemHolder(10319, 5), new ItemChanceHolder(10319, 5),
new QuestItemHolder(10320, 370), new ItemChanceHolder(10320, 370),
}; };
private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); private static final Map<String, List<ItemChanceHolder>> AGATHIONS = new HashMap<>();
static static
{ {
@@ -94,7 +94,7 @@ public class Alexandria extends AbstractNpcAI
final int chance = getRandom(1000); final int chance = getRandom(1000);
int chance2 = 0; int chance2 = 0;
int chance3 = 0; int chance3 = 0;
for (QuestItemHolder agathion : AGATHIONS.get(event)) for (ItemChanceHolder agathion : AGATHIONS.get(event))
{ {
chance3 += agathion.getChance(); chance3 += agathion.getChance();
if ((chance >= chance2) && (chance2 < chance3)) if ((chance >= chance2) && (chance2 < chance3))
@@ -103,9 +103,9 @@ public class Alexandria extends AbstractNpcAI
{ {
giveItems(player, agathion); giveItems(player, agathion);
htmltext = "30098-03.html"; htmltext = "30098-03.html";
if (agathion instanceof AdditionalQuestItemHolder) if (agathion instanceof AdditionalItemChanceHolder)
{ {
giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); giveItems(player, ((AdditionalItemChanceHolder) agathion).getAdditionalId(), 1);
htmltext = "30098-03a.html"; htmltext = "30098-03a.html";
} }
} }
@@ -121,11 +121,11 @@ public class Alexandria extends AbstractNpcAI
return htmltext; return htmltext;
} }
private static class AdditionalQuestItemHolder extends QuestItemHolder private static class AdditionalItemChanceHolder extends ItemChanceHolder
{ {
private final int _additionalId; private final int _additionalId;
public AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) public AdditionalItemChanceHolder(int id, int chance, long count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder; import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -48,25 +48,25 @@ public class Alexandria extends AbstractNpcAI
new ItemHolder(9817, 50), new ItemHolder(9817, 50),
}; };
// Agathions // Agathions
private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_DEVILS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10321, 600, 1, 10408), new AdditionalItemChanceHolder(10321, 600, 1, 10408),
new QuestItemHolder(10322, 10), new ItemChanceHolder(10322, 10),
new QuestItemHolder(10323, 10), new ItemChanceHolder(10323, 10),
new QuestItemHolder(10324, 5), new ItemChanceHolder(10324, 5),
new QuestItemHolder(10325, 5), new ItemChanceHolder(10325, 5),
new QuestItemHolder(10326, 370), new ItemChanceHolder(10326, 370),
}; };
private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_ANGELS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10315, 600, 1, 10408), new AdditionalItemChanceHolder(10315, 600, 1, 10408),
new QuestItemHolder(10316, 10), new ItemChanceHolder(10316, 10),
new QuestItemHolder(10317, 10), new ItemChanceHolder(10317, 10),
new QuestItemHolder(10318, 5), new ItemChanceHolder(10318, 5),
new QuestItemHolder(10319, 5), new ItemChanceHolder(10319, 5),
new QuestItemHolder(10320, 370), new ItemChanceHolder(10320, 370),
}; };
private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); private static final Map<String, List<ItemChanceHolder>> AGATHIONS = new HashMap<>();
static static
{ {
@@ -94,7 +94,7 @@ public class Alexandria extends AbstractNpcAI
final int chance = getRandom(1000); final int chance = getRandom(1000);
int chance2 = 0; int chance2 = 0;
int chance3 = 0; int chance3 = 0;
for (QuestItemHolder agathion : AGATHIONS.get(event)) for (ItemChanceHolder agathion : AGATHIONS.get(event))
{ {
chance3 += agathion.getChance(); chance3 += agathion.getChance();
if ((chance >= chance2) && (chance2 < chance3)) if ((chance >= chance2) && (chance2 < chance3))
@@ -103,9 +103,9 @@ public class Alexandria extends AbstractNpcAI
{ {
giveItems(player, agathion); giveItems(player, agathion);
htmltext = "30098-03.html"; htmltext = "30098-03.html";
if (agathion instanceof AdditionalQuestItemHolder) if (agathion instanceof AdditionalItemChanceHolder)
{ {
giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); giveItems(player, ((AdditionalItemChanceHolder) agathion).getAdditionalId(), 1);
htmltext = "30098-03a.html"; htmltext = "30098-03a.html";
} }
} }
@@ -121,11 +121,11 @@ public class Alexandria extends AbstractNpcAI
return htmltext; return htmltext;
} }
private static class AdditionalQuestItemHolder extends QuestItemHolder private static class AdditionalItemChanceHolder extends ItemChanceHolder
{ {
private final int _additionalId; private final int _additionalId;
public AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) public AdditionalItemChanceHolder(int id, int chance, long count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder; import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -48,25 +48,25 @@ public class Alexandria extends AbstractNpcAI
new ItemHolder(9817, 50), new ItemHolder(9817, 50),
}; };
// Agathions // Agathions
private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_DEVILS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10321, 600, 1, 10408), new AdditionalItemChanceHolder(10321, 600, 1, 10408),
new QuestItemHolder(10322, 10), new ItemChanceHolder(10322, 10),
new QuestItemHolder(10323, 10), new ItemChanceHolder(10323, 10),
new QuestItemHolder(10324, 5), new ItemChanceHolder(10324, 5),
new QuestItemHolder(10325, 5), new ItemChanceHolder(10325, 5),
new QuestItemHolder(10326, 370), new ItemChanceHolder(10326, 370),
}; };
private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_ANGELS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10315, 600, 1, 10408), new AdditionalItemChanceHolder(10315, 600, 1, 10408),
new QuestItemHolder(10316, 10), new ItemChanceHolder(10316, 10),
new QuestItemHolder(10317, 10), new ItemChanceHolder(10317, 10),
new QuestItemHolder(10318, 5), new ItemChanceHolder(10318, 5),
new QuestItemHolder(10319, 5), new ItemChanceHolder(10319, 5),
new QuestItemHolder(10320, 370), new ItemChanceHolder(10320, 370),
}; };
private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); private static final Map<String, List<ItemChanceHolder>> AGATHIONS = new HashMap<>();
static static
{ {
@@ -94,7 +94,7 @@ public class Alexandria extends AbstractNpcAI
final int chance = getRandom(1000); final int chance = getRandom(1000);
int chance2 = 0; int chance2 = 0;
int chance3 = 0; int chance3 = 0;
for (QuestItemHolder agathion : AGATHIONS.get(event)) for (ItemChanceHolder agathion : AGATHIONS.get(event))
{ {
chance3 += agathion.getChance(); chance3 += agathion.getChance();
if ((chance >= chance2) && (chance2 < chance3)) if ((chance >= chance2) && (chance2 < chance3))
@@ -103,9 +103,9 @@ public class Alexandria extends AbstractNpcAI
{ {
giveItems(player, agathion); giveItems(player, agathion);
htmltext = "30098-03.html"; htmltext = "30098-03.html";
if (agathion instanceof AdditionalQuestItemHolder) if (agathion instanceof AdditionalItemChanceHolder)
{ {
giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); giveItems(player, ((AdditionalItemChanceHolder) agathion).getAdditionalId(), 1);
htmltext = "30098-03a.html"; htmltext = "30098-03a.html";
} }
} }
@@ -121,11 +121,11 @@ public class Alexandria extends AbstractNpcAI
return htmltext; return htmltext;
} }
private static class AdditionalQuestItemHolder extends QuestItemHolder private static class AdditionalItemChanceHolder extends ItemChanceHolder
{ {
private final int _additionalId; private final int _additionalId;
public AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) public AdditionalItemChanceHolder(int id, int chance, long count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.model.holders; package org.l2jmobius.gameserver.model.holders;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.model.holders; package org.l2jmobius.gameserver.model.holders;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder public class ItemHolder

View File

@@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.model.holders; package org.l2jmobius.gameserver.model.holders;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.model.holders; package org.l2jmobius.gameserver.model.holders;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder public class ItemHolder

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder; import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -48,25 +48,25 @@ public class Alexandria extends AbstractNpcAI
new ItemHolder(9817, 50), new ItemHolder(9817, 50),
}; };
// Agathions // Agathions
private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_DEVILS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10321, 600, 1, 10408), new AdditionalItemChanceHolder(10321, 600, 1, 10408),
new QuestItemHolder(10322, 10), new ItemChanceHolder(10322, 10),
new QuestItemHolder(10323, 10), new ItemChanceHolder(10323, 10),
new QuestItemHolder(10324, 5), new ItemChanceHolder(10324, 5),
new QuestItemHolder(10325, 5), new ItemChanceHolder(10325, 5),
new QuestItemHolder(10326, 370), new ItemChanceHolder(10326, 370),
}; };
private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_ANGELS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10315, 600, 1, 10408), new AdditionalItemChanceHolder(10315, 600, 1, 10408),
new QuestItemHolder(10316, 10), new ItemChanceHolder(10316, 10),
new QuestItemHolder(10317, 10), new ItemChanceHolder(10317, 10),
new QuestItemHolder(10318, 5), new ItemChanceHolder(10318, 5),
new QuestItemHolder(10319, 5), new ItemChanceHolder(10319, 5),
new QuestItemHolder(10320, 370), new ItemChanceHolder(10320, 370),
}; };
private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); private static final Map<String, List<ItemChanceHolder>> AGATHIONS = new HashMap<>();
static static
{ {
AGATHIONS.put("littleAngel", Arrays.asList(LITTLE_ANGELS)); AGATHIONS.put("littleAngel", Arrays.asList(LITTLE_ANGELS));
@@ -93,7 +93,7 @@ public class Alexandria extends AbstractNpcAI
final int chance = getRandom(1000); final int chance = getRandom(1000);
int chance2 = 0; int chance2 = 0;
int chance3 = 0; int chance3 = 0;
for (QuestItemHolder agathion : AGATHIONS.get(event)) for (ItemChanceHolder agathion : AGATHIONS.get(event))
{ {
chance3 += agathion.getChance(); chance3 += agathion.getChance();
if ((chance2 <= chance) && (chance < chance3)) if ((chance2 <= chance) && (chance < chance3))
@@ -102,9 +102,9 @@ public class Alexandria extends AbstractNpcAI
{ {
giveItems(player, agathion); giveItems(player, agathion);
htmltext = "30098-03.html"; htmltext = "30098-03.html";
if (agathion instanceof AdditionalQuestItemHolder) if (agathion instanceof AdditionalItemChanceHolder)
{ {
giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); giveItems(player, ((AdditionalItemChanceHolder) agathion).getAdditionalId(), 1);
htmltext = "30098-03a.html"; htmltext = "30098-03a.html";
} }
} }
@@ -120,11 +120,11 @@ public class Alexandria extends AbstractNpcAI
return htmltext; return htmltext;
} }
private static class AdditionalQuestItemHolder extends QuestItemHolder private static class AdditionalItemChanceHolder extends ItemChanceHolder
{ {
private final int _additionalId; private final int _additionalId;
AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) AdditionalItemChanceHolder(int id, int chance, long count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent; import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/** /**
@@ -56,89 +56,89 @@ public class L2Day extends LongTimeEvent
private static final int T = 3887; private static final int T = 3887;
private static final int II = 3888; private static final int II = 3888;
// Rewards // Rewards
private static final QuestItemHolder[] L2_REWARDS = private static final ItemChanceHolder[] L2_REWARDS =
{ {
new QuestItemHolder(10260, 90, 3), // Alacrity Juice new ItemChanceHolder(10260, 90, 3), // Alacrity Juice
new QuestItemHolder(10261, 85, 3), // Accuracy Juice new ItemChanceHolder(10261, 85, 3), // Accuracy Juice
new QuestItemHolder(10262, 80, 3), // Critical Hit Juice new ItemChanceHolder(10262, 80, 3), // Critical Hit Juice
new QuestItemHolder(10263, 75, 3), // Critical Rate Juice new ItemChanceHolder(10263, 75, 3), // Critical Rate Juice
new QuestItemHolder(10264, 70, 3), // Casting Spd. Juice new ItemChanceHolder(10264, 70, 3), // Casting Spd. Juice
new QuestItemHolder(10265, 65, 3), // Evasion Juice new ItemChanceHolder(10265, 65, 3), // Evasion Juice
new QuestItemHolder(10266, 60, 3), // M. Atk. Juice new ItemChanceHolder(10266, 60, 3), // M. Atk. Juice
new QuestItemHolder(10267, 55, 3), // Power Juice new ItemChanceHolder(10267, 55, 3), // Power Juice
new QuestItemHolder(10268, 50, 3), // Speed Juice new ItemChanceHolder(10268, 50, 3), // Speed Juice
new QuestItemHolder(10269, 45, 3), // Defense Juice new ItemChanceHolder(10269, 45, 3), // Defense Juice
new QuestItemHolder(10270, 40, 3), // MP Consumption Juice new ItemChanceHolder(10270, 40, 3), // MP Consumption Juice
new QuestItemHolder(9546, 37, 2), // Fire Stone new ItemChanceHolder(9546, 37, 2), // Fire Stone
new QuestItemHolder(9547, 34, 2), // Water Stone new ItemChanceHolder(9547, 34, 2), // Water Stone
new QuestItemHolder(9548, 31, 2), // Earth Stone new ItemChanceHolder(9548, 31, 2), // Earth Stone
new QuestItemHolder(9549, 28, 2), // Wind Stone new ItemChanceHolder(9549, 28, 2), // Wind Stone
new QuestItemHolder(9550, 25, 2), // Dark Stone new ItemChanceHolder(9550, 25, 2), // Dark Stone
new QuestItemHolder(9551, 22, 2), // Holy Stone new ItemChanceHolder(9551, 22, 2), // Holy Stone
new QuestItemHolder(8947, 19, 1), // L2day - Rabbit Ears new ItemChanceHolder(8947, 19, 1), // L2day - Rabbit Ears
new QuestItemHolder(8948, 16, 1), // L2day - Little Angel Wings new ItemChanceHolder(8948, 16, 1), // L2day - Little Angel Wings
new QuestItemHolder(8949, 13, 1), // L2day - Fairy Antennae new ItemChanceHolder(8949, 13, 1), // L2day - Fairy Antennae
new QuestItemHolder(3959, 10, 2), // Blessed Scroll of Resurrection (Event) new ItemChanceHolder(3959, 10, 2), // Blessed Scroll of Resurrection (Event)
new QuestItemHolder(3958, 7, 2), // Blessed Scroll of Escape (Event) new ItemChanceHolder(3958, 7, 2), // Blessed Scroll of Escape (Event)
new QuestItemHolder(8752, 4, 2), // High-Grade Life Stone - Level 76 new ItemChanceHolder(8752, 4, 2), // High-Grade Life Stone - Level 76
new QuestItemHolder(8762, 1, 1), // Top-Grade Life Stone - Level 76 new ItemChanceHolder(8762, 1, 1), // Top-Grade Life Stone - Level 76
new QuestItemHolder(6660, 0, 1), // Ring of Queen Ant new ItemChanceHolder(6660, 0, 1), // Ring of Queen Ant
}; };
private static final QuestItemHolder[] NC_REWARDS = private static final ItemChanceHolder[] NC_REWARDS =
{ {
new QuestItemHolder(10260, 90, 2), // Alacrity Juice new ItemChanceHolder(10260, 90, 2), // Alacrity Juice
new QuestItemHolder(10261, 85, 2), // Accuracy Juice new ItemChanceHolder(10261, 85, 2), // Accuracy Juice
new QuestItemHolder(10262, 80, 2), // Critical Hit Juice new ItemChanceHolder(10262, 80, 2), // Critical Hit Juice
new QuestItemHolder(10263, 75, 2), // Critical Rate Juice new ItemChanceHolder(10263, 75, 2), // Critical Rate Juice
new QuestItemHolder(10264, 70, 2), // Casting Spd. Juice new ItemChanceHolder(10264, 70, 2), // Casting Spd. Juice
new QuestItemHolder(10265, 65, 2), // Evasion Juice new ItemChanceHolder(10265, 65, 2), // Evasion Juice
new QuestItemHolder(10266, 60, 2), // M. Atk. Juice new ItemChanceHolder(10266, 60, 2), // M. Atk. Juice
new QuestItemHolder(10267, 55, 2), // Power Juice new ItemChanceHolder(10267, 55, 2), // Power Juice
new QuestItemHolder(10268, 50, 2), // Speed Juice new ItemChanceHolder(10268, 50, 2), // Speed Juice
new QuestItemHolder(10269, 45, 2), // Defense Juice new ItemChanceHolder(10269, 45, 2), // Defense Juice
new QuestItemHolder(10270, 40, 2), // MP Consumption Juice new ItemChanceHolder(10270, 40, 2), // MP Consumption Juice
new QuestItemHolder(9546, 37, 1), // Fire Stone new ItemChanceHolder(9546, 37, 1), // Fire Stone
new QuestItemHolder(9547, 34, 1), // Water Stone new ItemChanceHolder(9547, 34, 1), // Water Stone
new QuestItemHolder(9548, 31, 1), // Earth Stone new ItemChanceHolder(9548, 31, 1), // Earth Stone
new QuestItemHolder(9549, 28, 1), // Wind Stone new ItemChanceHolder(9549, 28, 1), // Wind Stone
new QuestItemHolder(9550, 25, 1), // Dark Stone new ItemChanceHolder(9550, 25, 1), // Dark Stone
new QuestItemHolder(9551, 22, 1), // Holy Stone new ItemChanceHolder(9551, 22, 1), // Holy Stone
new QuestItemHolder(8948, 19, 1), // L2day - Little Angel Wings new ItemChanceHolder(8948, 19, 1), // L2day - Little Angel Wings
new QuestItemHolder(8949, 16, 1), // L2day - Fairy Antennae new ItemChanceHolder(8949, 16, 1), // L2day - Fairy Antennae
new QuestItemHolder(8950, 13, 1), // L2day - Feathered Hat new ItemChanceHolder(8950, 13, 1), // L2day - Feathered Hat
new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) new ItemChanceHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event)
new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) new ItemChanceHolder(3958, 7, 1), // Blessed Scroll of Escape (Event)
new QuestItemHolder(8742, 4, 2), // Mid-Grade Life Stone - Level 76 new ItemChanceHolder(8742, 4, 2), // Mid-Grade Life Stone - Level 76
new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 new ItemChanceHolder(8752, 1, 1), // High-Grade Life Stone - Level 76
new QuestItemHolder(6661, 0, 1), // Earring of Orfen new ItemChanceHolder(6661, 0, 1), // Earring of Orfen
}; };
private static final QuestItemHolder[] CH_REWARDS = private static final ItemChanceHolder[] CH_REWARDS =
{ {
new QuestItemHolder(10260, 90, 1), // Alacrity Juice new ItemChanceHolder(10260, 90, 1), // Alacrity Juice
new QuestItemHolder(10261, 85, 1), // Accuracy Juice new ItemChanceHolder(10261, 85, 1), // Accuracy Juice
new QuestItemHolder(10262, 80, 1), // Critical Hit Juice new ItemChanceHolder(10262, 80, 1), // Critical Hit Juice
new QuestItemHolder(10263, 75, 1), // Critical Rate Juice new ItemChanceHolder(10263, 75, 1), // Critical Rate Juice
new QuestItemHolder(10264, 70, 1), // Casting Spd. Juice new ItemChanceHolder(10264, 70, 1), // Casting Spd. Juice
new QuestItemHolder(10265, 65, 1), // Evasion Juice new ItemChanceHolder(10265, 65, 1), // Evasion Juice
new QuestItemHolder(10266, 60, 1), // M. Atk. Juice new ItemChanceHolder(10266, 60, 1), // M. Atk. Juice
new QuestItemHolder(10267, 55, 1), // Power Juice new ItemChanceHolder(10267, 55, 1), // Power Juice
new QuestItemHolder(10268, 50, 1), // Speed Juice new ItemChanceHolder(10268, 50, 1), // Speed Juice
new QuestItemHolder(10269, 45, 1), // Defense Juice new ItemChanceHolder(10269, 45, 1), // Defense Juice
new QuestItemHolder(10270, 40, 1), // MP Consumption Juice new ItemChanceHolder(10270, 40, 1), // MP Consumption Juice
new QuestItemHolder(9546, 37, 1), // Fire Stone new ItemChanceHolder(9546, 37, 1), // Fire Stone
new QuestItemHolder(9547, 34, 1), // Water Stone new ItemChanceHolder(9547, 34, 1), // Water Stone
new QuestItemHolder(9548, 31, 1), // Earth Stone new ItemChanceHolder(9548, 31, 1), // Earth Stone
new QuestItemHolder(9549, 28, 1), // Wind Stone new ItemChanceHolder(9549, 28, 1), // Wind Stone
new QuestItemHolder(9550, 25, 1), // Dark Stone new ItemChanceHolder(9550, 25, 1), // Dark Stone
new QuestItemHolder(9551, 22, 1), // Holy Stone new ItemChanceHolder(9551, 22, 1), // Holy Stone
new QuestItemHolder(8949, 19, 1), // L2day - Fairy Antennae new ItemChanceHolder(8949, 19, 1), // L2day - Fairy Antennae
new QuestItemHolder(8950, 16, 1), // L2day - Feathered Hat new ItemChanceHolder(8950, 16, 1), // L2day - Feathered Hat
new QuestItemHolder(8951, 13, 1), // L2day - Artisan's Goggles new ItemChanceHolder(8951, 13, 1), // L2day - Artisan's Goggles
new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) new ItemChanceHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event)
new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) new ItemChanceHolder(3958, 7, 1), // Blessed Scroll of Escape (Event)
new QuestItemHolder(8742, 4, 1), // Mid-Grade Life Stone - Level 76 new ItemChanceHolder(8742, 4, 1), // Mid-Grade Life Stone - Level 76
new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 new ItemChanceHolder(8752, 1, 1), // High-Grade Life Stone - Level 76
new QuestItemHolder(6662, 0, 1), // Ring of Core new ItemChanceHolder(6662, 0, 1), // Ring of Core
}; };
private L2Day() private L2Day()
@@ -166,7 +166,7 @@ public class L2Day extends LongTimeEvent
} }
else else
{ {
for (QuestItemHolder holder : L2_REWARDS) for (ItemChanceHolder holder : L2_REWARDS)
{ {
if (random >= holder.getChance()) if (random >= holder.getChance())
{ {
@@ -195,7 +195,7 @@ public class L2Day extends LongTimeEvent
} }
else else
{ {
for (QuestItemHolder holder : NC_REWARDS) for (ItemChanceHolder holder : NC_REWARDS)
{ {
if (random >= holder.getChance()) if (random >= holder.getChance())
{ {
@@ -224,7 +224,7 @@ public class L2Day extends LongTimeEvent
} }
else else
{ {
for (QuestItemHolder holder : CH_REWARDS) for (ItemChanceHolder holder : CH_REWARDS)
{ {
if (random >= holder.getChance()) if (random >= holder.getChance())
{ {

View File

@@ -22,7 +22,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.enums.Race; import org.l2jmobius.gameserver.enums.Race;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -53,11 +53,11 @@ public class Q00235_MimirsElixir extends Quest
// Skill // Skill
private static SkillHolder QUEST_MIMIRS_ELIXIR = new SkillHolder(4339, 1); private static SkillHolder QUEST_MIMIRS_ELIXIR = new SkillHolder(4339, 1);
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS = new HashMap<>();
static static
{ {
MOBS.put(20965, new QuestItemHolder(SAGES_STONE, 4, 1)); // chimera_piece MOBS.put(20965, new ItemChanceHolder(SAGES_STONE, 4, 1)); // chimera_piece
MOBS.put(21090, new QuestItemHolder(BLOOD_FIRE, 7, 1)); // bloody_guardian MOBS.put(21090, new ItemChanceHolder(BLOOD_FIRE, 7, 1)); // bloody_guardian
} }
public Q00235_MimirsElixir() public Q00235_MimirsElixir()
@@ -236,12 +236,12 @@ public class Q00235_MimirsElixir extends Quest
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null) if (luckyPlayer != null)
{ {
final QuestItemHolder item = MOBS.get(npc.getId()); final ItemChanceHolder item = MOBS.get(npc.getId());
if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), item.getCount(), 1.0, true)) if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), item.getCount(), 1.0, true))
{ {
final QuestState qs = luckyPlayer.getQuestState(getName()); final QuestState qs = luckyPlayer.getQuestState(getName());
qs.setMemoState(item.getChance()); qs.setMemoState((int) item.getChance());
qs.setCond(item.getChance()); qs.setCond((int) item.getChance());
} }
} }
} }

View File

@@ -23,7 +23,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -45,18 +45,18 @@ public class Q00299_GatherIngredientsForPie extends Quest
private static final int AVELLAN_SPICE = 7137; private static final int AVELLAN_SPICE = 7137;
private static final int HONEY_POUCH = 7138; private static final int HONEY_POUCH = 7138;
// Rewards // Rewards
private static final List<QuestItemHolder> REWARDS = new ArrayList<>(5); private static final List<ItemChanceHolder> REWARDS = new ArrayList<>(5);
// Misc // Misc
private static final int MIN_LEVEL = 34; private static final int MIN_LEVEL = 34;
static static
{ {
MONSTERS_CHANCES.put(20934, 700); // Wasp Worker MONSTERS_CHANCES.put(20934, 700); // Wasp Worker
MONSTERS_CHANCES.put(20935, 770); // Wasp Leader MONSTERS_CHANCES.put(20935, 770); // Wasp Leader
REWARDS.add(new QuestItemHolder(57, 400, 2500)); // Adena REWARDS.add(new ItemChanceHolder(57, 400, 2500)); // Adena
REWARDS.add(new QuestItemHolder(1865, 550, 50)); // Varnish REWARDS.add(new ItemChanceHolder(1865, 550, 50)); // Varnish
REWARDS.add(new QuestItemHolder(1870, 700, 50)); // Coal REWARDS.add(new ItemChanceHolder(1870, 700, 50)); // Coal
REWARDS.add(new QuestItemHolder(1869, 850, 50)); // Iron Ore REWARDS.add(new ItemChanceHolder(1869, 850, 50)); // Iron Ore
REWARDS.add(new QuestItemHolder(1871, 1000, 50)); // Charcoal REWARDS.add(new ItemChanceHolder(1871, 1000, 50)); // Charcoal
} }
public Q00299_GatherIngredientsForPie() public Q00299_GatherIngredientsForPie()
@@ -142,7 +142,7 @@ public class Q00299_GatherIngredientsForPie extends Quest
{ {
takeItems(player, FRUIT_BASKET, -1); takeItems(player, FRUIT_BASKET, -1);
final int chance = getRandom(1000); final int chance = getRandom(1000);
for (QuestItemHolder holder : REWARDS) for (ItemChanceHolder holder : REWARDS)
{ {
if (holder.getChance() > chance) if (holder.getChance() > chance)
{ {

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -198,7 +198,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -23,7 +23,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.QuestSound; import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.util.Util; import org.l2jmobius.gameserver.util.Util;
@@ -102,15 +102,15 @@ public class Q00372_LegacyOfInsolence extends Quest
private static final int SEALED_MAJESTIC_CIRCLET_DESIGN = 5528; private static final int SEALED_MAJESTIC_CIRCLET_DESIGN = 5528;
// Monsters // Monsters
private static final int HALLATES_INSPECTOR = 20825; private static final int HALLATES_INSPECTOR = 20825;
private static final Map<Integer, QuestItemHolder> MONSTER_REWARDS = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MONSTER_REWARDS = new HashMap<>();
static static
{ {
MONSTER_REWARDS.put(20817, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 302, 1)); MONSTER_REWARDS.put(20817, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 302, 1));
MONSTER_REWARDS.put(20821, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 410, 1)); MONSTER_REWARDS.put(20821, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 410, 1));
MONSTER_REWARDS.put(HALLATES_INSPECTOR, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 447, 1)); MONSTER_REWARDS.put(HALLATES_INSPECTOR, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 447, 1));
MONSTER_REWARDS.put(20829, new QuestItemHolder(ANCIENT_BLUE_PAPYRUS, 451, 1)); MONSTER_REWARDS.put(20829, new ItemChanceHolder(ANCIENT_BLUE_PAPYRUS, 451, 1));
MONSTER_REWARDS.put(21062, new QuestItemHolder(ANCIENT_WHITE_PAPYRUS, 290, 1)); MONSTER_REWARDS.put(21062, new ItemChanceHolder(ANCIENT_WHITE_PAPYRUS, 290, 1));
MONSTER_REWARDS.put(21069, new QuestItemHolder(ANCIENT_BLACK_PAPYRUS, 280, 1)); MONSTER_REWARDS.put(21069, new ItemChanceHolder(ANCIENT_BLACK_PAPYRUS, 280, 1));
} }
// Misc // Misc
@@ -446,7 +446,7 @@ public class Q00372_LegacyOfInsolence extends Quest
@Override @Override
public String onKill(Npc npc, Player killer, boolean isSummon) public String onKill(Npc npc, Player killer, boolean isSummon)
{ {
final QuestItemHolder item = MONSTER_REWARDS.get(npc.getId()); final ItemChanceHolder item = MONSTER_REWARDS.get(npc.getId());
if (npc.getId() == HALLATES_INSPECTOR) if (npc.getId() == HALLATES_INSPECTOR)
{ {
if (getRandom(1000) < item.getChance()) if (getRandom(1000) < item.getChance())

View File

@@ -17,8 +17,7 @@
package org.l2jmobius.gameserver.model.holders; package org.l2jmobius.gameserver.model.holders;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -19,8 +19,7 @@ package org.l2jmobius.gameserver.model.holders;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder; import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -48,25 +48,25 @@ public class Alexandria extends AbstractNpcAI
new ItemHolder(9817, 5), new ItemHolder(9817, 5),
}; };
// Agathions // Agathions
private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_DEVILS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10321, 600, 1, 10408), new AdditionalItemChanceHolder(10321, 600, 1, 10408),
new QuestItemHolder(10322, 10), new ItemChanceHolder(10322, 10),
new QuestItemHolder(10323, 10), new ItemChanceHolder(10323, 10),
new QuestItemHolder(10324, 5), new ItemChanceHolder(10324, 5),
new QuestItemHolder(10325, 5), new ItemChanceHolder(10325, 5),
new QuestItemHolder(10326, 370), new ItemChanceHolder(10326, 370),
}; };
private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] private static final ItemChanceHolder[] LITTLE_ANGELS = new ItemChanceHolder[]
{ {
new AdditionalQuestItemHolder(10315, 600, 1, 10408), new AdditionalItemChanceHolder(10315, 600, 1, 10408),
new QuestItemHolder(10316, 10), new ItemChanceHolder(10316, 10),
new QuestItemHolder(10317, 10), new ItemChanceHolder(10317, 10),
new QuestItemHolder(10318, 5), new ItemChanceHolder(10318, 5),
new QuestItemHolder(10319, 5), new ItemChanceHolder(10319, 5),
new QuestItemHolder(10320, 370), new ItemChanceHolder(10320, 370),
}; };
private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); private static final Map<String, List<ItemChanceHolder>> AGATHIONS = new HashMap<>();
static static
{ {
AGATHIONS.put("littleAngel", Arrays.asList(LITTLE_ANGELS)); AGATHIONS.put("littleAngel", Arrays.asList(LITTLE_ANGELS));
@@ -93,7 +93,7 @@ public class Alexandria extends AbstractNpcAI
final int chance = getRandom(1000); final int chance = getRandom(1000);
int chance2 = 0; int chance2 = 0;
int chance3 = 0; int chance3 = 0;
for (QuestItemHolder agathion : AGATHIONS.get(event)) for (ItemChanceHolder agathion : AGATHIONS.get(event))
{ {
chance3 += agathion.getChance(); chance3 += agathion.getChance();
if ((chance2 <= chance) && (chance < chance3)) if ((chance2 <= chance) && (chance < chance3))
@@ -102,9 +102,9 @@ public class Alexandria extends AbstractNpcAI
{ {
giveItems(player, agathion); giveItems(player, agathion);
htmltext = "30098-03.html"; htmltext = "30098-03.html";
if (agathion instanceof AdditionalQuestItemHolder) if (agathion instanceof AdditionalItemChanceHolder)
{ {
giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); giveItems(player, ((AdditionalItemChanceHolder) agathion).getAdditionalId(), 1);
htmltext = "30098-03a.html"; htmltext = "30098-03a.html";
} }
} }
@@ -120,11 +120,11 @@ public class Alexandria extends AbstractNpcAI
return htmltext; return htmltext;
} }
private static class AdditionalQuestItemHolder extends QuestItemHolder private static class AdditionalItemChanceHolder extends ItemChanceHolder
{ {
private final int _additionalId; private final int _additionalId;
AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) AdditionalItemChanceHolder(int id, int chance, long count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent; import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/** /**
@@ -56,89 +56,89 @@ public class L2Day extends LongTimeEvent
private static final int T = 3887; private static final int T = 3887;
private static final int II = 3888; private static final int II = 3888;
// Rewards // Rewards
private static final QuestItemHolder[] L2_REWARDS = private static final ItemChanceHolder[] L2_REWARDS =
{ {
new QuestItemHolder(10260, 90, 3), // Alacrity Juice new ItemChanceHolder(10260, 90, 3), // Alacrity Juice
new QuestItemHolder(10261, 85, 3), // Accuracy Juice new ItemChanceHolder(10261, 85, 3), // Accuracy Juice
new QuestItemHolder(10262, 80, 3), // Critical Hit Juice new ItemChanceHolder(10262, 80, 3), // Critical Hit Juice
new QuestItemHolder(10263, 75, 3), // Critical Rate Juice new ItemChanceHolder(10263, 75, 3), // Critical Rate Juice
new QuestItemHolder(10264, 70, 3), // Casting Spd. Juice new ItemChanceHolder(10264, 70, 3), // Casting Spd. Juice
new QuestItemHolder(10265, 65, 3), // Evasion Juice new ItemChanceHolder(10265, 65, 3), // Evasion Juice
new QuestItemHolder(10266, 60, 3), // M. Atk. Juice new ItemChanceHolder(10266, 60, 3), // M. Atk. Juice
new QuestItemHolder(10267, 55, 3), // Power Juice new ItemChanceHolder(10267, 55, 3), // Power Juice
new QuestItemHolder(10268, 50, 3), // Speed Juice new ItemChanceHolder(10268, 50, 3), // Speed Juice
new QuestItemHolder(10269, 45, 3), // Defense Juice new ItemChanceHolder(10269, 45, 3), // Defense Juice
new QuestItemHolder(10270, 40, 3), // MP Consumption Juice new ItemChanceHolder(10270, 40, 3), // MP Consumption Juice
new QuestItemHolder(9546, 37, 2), // Fire Stone new ItemChanceHolder(9546, 37, 2), // Fire Stone
new QuestItemHolder(9547, 34, 2), // Water Stone new ItemChanceHolder(9547, 34, 2), // Water Stone
new QuestItemHolder(9548, 31, 2), // Earth Stone new ItemChanceHolder(9548, 31, 2), // Earth Stone
new QuestItemHolder(9549, 28, 2), // Wind Stone new ItemChanceHolder(9549, 28, 2), // Wind Stone
new QuestItemHolder(9550, 25, 2), // Dark Stone new ItemChanceHolder(9550, 25, 2), // Dark Stone
new QuestItemHolder(9551, 22, 2), // Holy Stone new ItemChanceHolder(9551, 22, 2), // Holy Stone
new QuestItemHolder(8947, 19, 1), // L2day - Rabbit Ears new ItemChanceHolder(8947, 19, 1), // L2day - Rabbit Ears
new QuestItemHolder(8948, 16, 1), // L2day - Little Angel Wings new ItemChanceHolder(8948, 16, 1), // L2day - Little Angel Wings
new QuestItemHolder(8949, 13, 1), // L2day - Fairy Antennae new ItemChanceHolder(8949, 13, 1), // L2day - Fairy Antennae
new QuestItemHolder(3959, 10, 2), // Blessed Scroll of Resurrection (Event) new ItemChanceHolder(3959, 10, 2), // Blessed Scroll of Resurrection (Event)
new QuestItemHolder(3958, 7, 2), // Blessed Scroll of Escape (Event) new ItemChanceHolder(3958, 7, 2), // Blessed Scroll of Escape (Event)
new QuestItemHolder(8752, 4, 2), // High-Grade Life Stone - Level 76 new ItemChanceHolder(8752, 4, 2), // High-Grade Life Stone - Level 76
new QuestItemHolder(8762, 1, 1), // Top-Grade Life Stone - Level 76 new ItemChanceHolder(8762, 1, 1), // Top-Grade Life Stone - Level 76
new QuestItemHolder(6660, 0, 1), // Ring of Queen Ant new ItemChanceHolder(6660, 0, 1), // Ring of Queen Ant
}; };
private static final QuestItemHolder[] NC_REWARDS = private static final ItemChanceHolder[] NC_REWARDS =
{ {
new QuestItemHolder(10260, 90, 2), // Alacrity Juice new ItemChanceHolder(10260, 90, 2), // Alacrity Juice
new QuestItemHolder(10261, 85, 2), // Accuracy Juice new ItemChanceHolder(10261, 85, 2), // Accuracy Juice
new QuestItemHolder(10262, 80, 2), // Critical Hit Juice new ItemChanceHolder(10262, 80, 2), // Critical Hit Juice
new QuestItemHolder(10263, 75, 2), // Critical Rate Juice new ItemChanceHolder(10263, 75, 2), // Critical Rate Juice
new QuestItemHolder(10264, 70, 2), // Casting Spd. Juice new ItemChanceHolder(10264, 70, 2), // Casting Spd. Juice
new QuestItemHolder(10265, 65, 2), // Evasion Juice new ItemChanceHolder(10265, 65, 2), // Evasion Juice
new QuestItemHolder(10266, 60, 2), // M. Atk. Juice new ItemChanceHolder(10266, 60, 2), // M. Atk. Juice
new QuestItemHolder(10267, 55, 2), // Power Juice new ItemChanceHolder(10267, 55, 2), // Power Juice
new QuestItemHolder(10268, 50, 2), // Speed Juice new ItemChanceHolder(10268, 50, 2), // Speed Juice
new QuestItemHolder(10269, 45, 2), // Defense Juice new ItemChanceHolder(10269, 45, 2), // Defense Juice
new QuestItemHolder(10270, 40, 2), // MP Consumption Juice new ItemChanceHolder(10270, 40, 2), // MP Consumption Juice
new QuestItemHolder(9546, 37, 1), // Fire Stone new ItemChanceHolder(9546, 37, 1), // Fire Stone
new QuestItemHolder(9547, 34, 1), // Water Stone new ItemChanceHolder(9547, 34, 1), // Water Stone
new QuestItemHolder(9548, 31, 1), // Earth Stone new ItemChanceHolder(9548, 31, 1), // Earth Stone
new QuestItemHolder(9549, 28, 1), // Wind Stone new ItemChanceHolder(9549, 28, 1), // Wind Stone
new QuestItemHolder(9550, 25, 1), // Dark Stone new ItemChanceHolder(9550, 25, 1), // Dark Stone
new QuestItemHolder(9551, 22, 1), // Holy Stone new ItemChanceHolder(9551, 22, 1), // Holy Stone
new QuestItemHolder(8948, 19, 1), // L2day - Little Angel Wings new ItemChanceHolder(8948, 19, 1), // L2day - Little Angel Wings
new QuestItemHolder(8949, 16, 1), // L2day - Fairy Antennae new ItemChanceHolder(8949, 16, 1), // L2day - Fairy Antennae
new QuestItemHolder(8950, 13, 1), // L2day - Feathered Hat new ItemChanceHolder(8950, 13, 1), // L2day - Feathered Hat
new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) new ItemChanceHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event)
new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) new ItemChanceHolder(3958, 7, 1), // Blessed Scroll of Escape (Event)
new QuestItemHolder(8742, 4, 2), // Mid-Grade Life Stone - Level 76 new ItemChanceHolder(8742, 4, 2), // Mid-Grade Life Stone - Level 76
new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 new ItemChanceHolder(8752, 1, 1), // High-Grade Life Stone - Level 76
new QuestItemHolder(6661, 0, 1), // Earring of Orfen new ItemChanceHolder(6661, 0, 1), // Earring of Orfen
}; };
private static final QuestItemHolder[] CH_REWARDS = private static final ItemChanceHolder[] CH_REWARDS =
{ {
new QuestItemHolder(10260, 90, 1), // Alacrity Juice new ItemChanceHolder(10260, 90, 1), // Alacrity Juice
new QuestItemHolder(10261, 85, 1), // Accuracy Juice new ItemChanceHolder(10261, 85, 1), // Accuracy Juice
new QuestItemHolder(10262, 80, 1), // Critical Hit Juice new ItemChanceHolder(10262, 80, 1), // Critical Hit Juice
new QuestItemHolder(10263, 75, 1), // Critical Rate Juice new ItemChanceHolder(10263, 75, 1), // Critical Rate Juice
new QuestItemHolder(10264, 70, 1), // Casting Spd. Juice new ItemChanceHolder(10264, 70, 1), // Casting Spd. Juice
new QuestItemHolder(10265, 65, 1), // Evasion Juice new ItemChanceHolder(10265, 65, 1), // Evasion Juice
new QuestItemHolder(10266, 60, 1), // M. Atk. Juice new ItemChanceHolder(10266, 60, 1), // M. Atk. Juice
new QuestItemHolder(10267, 55, 1), // Power Juice new ItemChanceHolder(10267, 55, 1), // Power Juice
new QuestItemHolder(10268, 50, 1), // Speed Juice new ItemChanceHolder(10268, 50, 1), // Speed Juice
new QuestItemHolder(10269, 45, 1), // Defense Juice new ItemChanceHolder(10269, 45, 1), // Defense Juice
new QuestItemHolder(10270, 40, 1), // MP Consumption Juice new ItemChanceHolder(10270, 40, 1), // MP Consumption Juice
new QuestItemHolder(9546, 37, 1), // Fire Stone new ItemChanceHolder(9546, 37, 1), // Fire Stone
new QuestItemHolder(9547, 34, 1), // Water Stone new ItemChanceHolder(9547, 34, 1), // Water Stone
new QuestItemHolder(9548, 31, 1), // Earth Stone new ItemChanceHolder(9548, 31, 1), // Earth Stone
new QuestItemHolder(9549, 28, 1), // Wind Stone new ItemChanceHolder(9549, 28, 1), // Wind Stone
new QuestItemHolder(9550, 25, 1), // Dark Stone new ItemChanceHolder(9550, 25, 1), // Dark Stone
new QuestItemHolder(9551, 22, 1), // Holy Stone new ItemChanceHolder(9551, 22, 1), // Holy Stone
new QuestItemHolder(8949, 19, 1), // L2day - Fairy Antennae new ItemChanceHolder(8949, 19, 1), // L2day - Fairy Antennae
new QuestItemHolder(8950, 16, 1), // L2day - Feathered Hat new ItemChanceHolder(8950, 16, 1), // L2day - Feathered Hat
new QuestItemHolder(8951, 13, 1), // L2day - Artisan's Goggles new ItemChanceHolder(8951, 13, 1), // L2day - Artisan's Goggles
new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) new ItemChanceHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event)
new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) new ItemChanceHolder(3958, 7, 1), // Blessed Scroll of Escape (Event)
new QuestItemHolder(8742, 4, 1), // Mid-Grade Life Stone - Level 76 new ItemChanceHolder(8742, 4, 1), // Mid-Grade Life Stone - Level 76
new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 new ItemChanceHolder(8752, 1, 1), // High-Grade Life Stone - Level 76
new QuestItemHolder(6662, 0, 1), // Ring of Core new ItemChanceHolder(6662, 0, 1), // Ring of Core
}; };
private L2Day() private L2Day()
@@ -166,7 +166,7 @@ public class L2Day extends LongTimeEvent
} }
else else
{ {
for (QuestItemHolder holder : L2_REWARDS) for (ItemChanceHolder holder : L2_REWARDS)
{ {
if (random >= holder.getChance()) if (random >= holder.getChance())
{ {
@@ -195,7 +195,7 @@ public class L2Day extends LongTimeEvent
} }
else else
{ {
for (QuestItemHolder holder : NC_REWARDS) for (ItemChanceHolder holder : NC_REWARDS)
{ {
if (random >= holder.getChance()) if (random >= holder.getChance())
{ {
@@ -224,7 +224,7 @@ public class L2Day extends LongTimeEvent
} }
else else
{ {
for (QuestItemHolder holder : CH_REWARDS) for (ItemChanceHolder holder : CH_REWARDS)
{ {
if (random >= holder.getChance()) if (random >= holder.getChance())
{ {

View File

@@ -22,7 +22,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.enums.Race; import org.l2jmobius.gameserver.enums.Race;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -53,11 +53,11 @@ public class Q00235_MimirsElixir extends Quest
// Skill // Skill
private static SkillHolder QUEST_MIMIRS_ELIXIR = new SkillHolder(4339, 1); private static SkillHolder QUEST_MIMIRS_ELIXIR = new SkillHolder(4339, 1);
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS = new HashMap<>();
static static
{ {
MOBS.put(20965, new QuestItemHolder(SAGES_STONE, 4, 1)); // chimera_piece MOBS.put(20965, new ItemChanceHolder(SAGES_STONE, 4, 1)); // chimera_piece
MOBS.put(21090, new QuestItemHolder(BLOOD_FIRE, 7, 1)); // bloody_guardian MOBS.put(21090, new ItemChanceHolder(BLOOD_FIRE, 7, 1)); // bloody_guardian
} }
public Q00235_MimirsElixir() public Q00235_MimirsElixir()
@@ -236,12 +236,12 @@ public class Q00235_MimirsElixir extends Quest
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null) if (luckyPlayer != null)
{ {
final QuestItemHolder item = MOBS.get(npc.getId()); final ItemChanceHolder item = MOBS.get(npc.getId());
if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), item.getCount(), 1.0, true)) if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), item.getCount(), 1.0, true))
{ {
final QuestState qs = luckyPlayer.getQuestState(getName()); final QuestState qs = luckyPlayer.getQuestState(getName());
qs.setMemoState(item.getChance()); qs.setMemoState((int) item.getChance());
qs.setCond(item.getChance()); qs.setCond((int) item.getChance());
} }
} }
} }

View File

@@ -23,7 +23,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -45,18 +45,18 @@ public class Q00299_GatherIngredientsForPie extends Quest
private static final int AVELLAN_SPICE = 7137; private static final int AVELLAN_SPICE = 7137;
private static final int HONEY_POUCH = 7138; private static final int HONEY_POUCH = 7138;
// Rewards // Rewards
private static final List<QuestItemHolder> REWARDS = new ArrayList<>(5); private static final List<ItemChanceHolder> REWARDS = new ArrayList<>(5);
// Misc // Misc
private static final int MIN_LEVEL = 34; private static final int MIN_LEVEL = 34;
static static
{ {
MONSTERS_CHANCES.put(20934, 700); // Wasp Worker MONSTERS_CHANCES.put(20934, 700); // Wasp Worker
MONSTERS_CHANCES.put(20935, 770); // Wasp Leader MONSTERS_CHANCES.put(20935, 770); // Wasp Leader
REWARDS.add(new QuestItemHolder(57, 400, 2500)); // Adena REWARDS.add(new ItemChanceHolder(57, 400, 2500)); // Adena
REWARDS.add(new QuestItemHolder(1865, 550, 50)); // Varnish REWARDS.add(new ItemChanceHolder(1865, 550, 50)); // Varnish
REWARDS.add(new QuestItemHolder(1870, 700, 50)); // Coal REWARDS.add(new ItemChanceHolder(1870, 700, 50)); // Coal
REWARDS.add(new QuestItemHolder(1869, 850, 50)); // Iron Ore REWARDS.add(new ItemChanceHolder(1869, 850, 50)); // Iron Ore
REWARDS.add(new QuestItemHolder(1871, 1000, 50)); // Charcoal REWARDS.add(new ItemChanceHolder(1871, 1000, 50)); // Charcoal
} }
public Q00299_GatherIngredientsForPie() public Q00299_GatherIngredientsForPie()
@@ -142,7 +142,7 @@ public class Q00299_GatherIngredientsForPie extends Quest
{ {
takeItems(player, FRUIT_BASKET, -1); takeItems(player, FRUIT_BASKET, -1);
final int chance = getRandom(1000); final int chance = getRandom(1000);
for (QuestItemHolder holder : REWARDS) for (ItemChanceHolder holder : REWARDS)
{ {
if (holder.getChance() > chance) if (holder.getChance() > chance)
{ {

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -198,7 +198,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -23,7 +23,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.QuestSound; import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.util.Util; import org.l2jmobius.gameserver.util.Util;
@@ -102,15 +102,15 @@ public class Q00372_LegacyOfInsolence extends Quest
private static final int SEALED_MAJESTIC_CIRCLET_DESIGN = 5528; private static final int SEALED_MAJESTIC_CIRCLET_DESIGN = 5528;
// Monsters // Monsters
private static final int HALLATES_INSPECTOR = 20825; private static final int HALLATES_INSPECTOR = 20825;
private static final Map<Integer, QuestItemHolder> MONSTER_REWARDS = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MONSTER_REWARDS = new HashMap<>();
static static
{ {
MONSTER_REWARDS.put(20817, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 302, 1)); MONSTER_REWARDS.put(20817, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 302, 1));
MONSTER_REWARDS.put(20821, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 410, 1)); MONSTER_REWARDS.put(20821, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 410, 1));
MONSTER_REWARDS.put(HALLATES_INSPECTOR, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 447, 1)); MONSTER_REWARDS.put(HALLATES_INSPECTOR, new ItemChanceHolder(ANCIENT_RED_PAPYRUS, 447, 1));
MONSTER_REWARDS.put(20829, new QuestItemHolder(ANCIENT_BLUE_PAPYRUS, 451, 1)); MONSTER_REWARDS.put(20829, new ItemChanceHolder(ANCIENT_BLUE_PAPYRUS, 451, 1));
MONSTER_REWARDS.put(21062, new QuestItemHolder(ANCIENT_WHITE_PAPYRUS, 290, 1)); MONSTER_REWARDS.put(21062, new ItemChanceHolder(ANCIENT_WHITE_PAPYRUS, 290, 1));
MONSTER_REWARDS.put(21069, new QuestItemHolder(ANCIENT_BLACK_PAPYRUS, 280, 1)); MONSTER_REWARDS.put(21069, new ItemChanceHolder(ANCIENT_BLACK_PAPYRUS, 280, 1));
} }
// Misc // Misc
@@ -446,7 +446,7 @@ public class Q00372_LegacyOfInsolence extends Quest
@Override @Override
public String onKill(Npc npc, Player killer, boolean isSummon) public String onKill(Npc npc, Player killer, boolean isSummon)
{ {
final QuestItemHolder item = MONSTER_REWARDS.get(npc.getId()); final ItemChanceHolder item = MONSTER_REWARDS.get(npc.getId());
if (npc.getId() == HALLATES_INSPECTOR) if (npc.getId() == HALLATES_INSPECTOR)
{ {
if (getRandom(1000) < item.getChance()) if (getRandom(1000) < item.getChance())

View File

@@ -17,8 +17,7 @@
package org.l2jmobius.gameserver.model.holders; package org.l2jmobius.gameserver.model.holders;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -19,8 +19,7 @@ package org.l2jmobius.gameserver.model.holders;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -201,7 +201,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -201,7 +201,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -201,7 +201,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -201,7 +201,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -201,7 +201,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.State; import org.l2jmobius.gameserver.model.quest.State;
@@ -54,19 +54,19 @@ public class Q00325_GrimCollector extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 15; private static final int MIN_LEVEL = 15;
// Monsters // Monsters
private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); private static final Map<Integer, List<ItemChanceHolder>> MONSTER_DROPS = new HashMap<>();
static static
{ {
MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20026, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 50), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 30), new ItemChanceHolder(ZOMBIE_HEART, 52), new ItemChanceHolder(ZOMBIE_LIVER, 75)));
MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); MONSTER_DROPS.put(20035, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 15), new ItemChanceHolder(SPINE, 29), new ItemChanceHolder(THIGH_BONE, 79)));
MONSTER_DROPS.put(20042, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 19), new QuestItemHolder(ARM_BONE, 69), new QuestItemHolder(THIGH_BONE, 86))); MONSTER_DROPS.put(20042, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 19), new ItemChanceHolder(ARM_BONE, 69), new ItemChanceHolder(THIGH_BONE, 86)));
MONSTER_DROPS.put(20045, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(SPINE, 59), new QuestItemHolder(ARM_BONE, 77), new QuestItemHolder(THIGH_BONE, 97))); MONSTER_DROPS.put(20045, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(SPINE, 59), new ItemChanceHolder(ARM_BONE, 77), new ItemChanceHolder(THIGH_BONE, 97)));
MONSTER_DROPS.put(20051, Arrays.asList(new QuestItemHolder(SKULL, 9), new QuestItemHolder(RIB_BONE, 59), new QuestItemHolder(SPINE, 79), new QuestItemHolder(ARM_BONE, 100))); MONSTER_DROPS.put(20051, Arrays.asList(new ItemChanceHolder(SKULL, 9), new ItemChanceHolder(RIB_BONE, 59), new ItemChanceHolder(SPINE, 79), new ItemChanceHolder(ARM_BONE, 100)));
MONSTER_DROPS.put(20457, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 60), new QuestItemHolder(ZOMBIE_LIVER, 80))); MONSTER_DROPS.put(20457, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 60), new ItemChanceHolder(ZOMBIE_LIVER, 80)));
MONSTER_DROPS.put(20458, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 40), new QuestItemHolder(ZOMBIE_HEART, 70), new QuestItemHolder(ZOMBIE_LIVER, 100))); MONSTER_DROPS.put(20458, Arrays.asList(new ItemChanceHolder(ZOMBIE_HEAD, 40), new ItemChanceHolder(ZOMBIE_HEART, 70), new ItemChanceHolder(ZOMBIE_LIVER, 100)));
MONSTER_DROPS.put(20514, Arrays.asList(new QuestItemHolder(SKULL, 6), new QuestItemHolder(RIB_BONE, 21), new QuestItemHolder(SPINE, 30), new QuestItemHolder(ARM_BONE, 31), new QuestItemHolder(THIGH_BONE, 64))); MONSTER_DROPS.put(20514, Arrays.asList(new ItemChanceHolder(SKULL, 6), new ItemChanceHolder(RIB_BONE, 21), new ItemChanceHolder(SPINE, 30), new ItemChanceHolder(ARM_BONE, 31), new ItemChanceHolder(THIGH_BONE, 64)));
MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); MONSTER_DROPS.put(20515, Arrays.asList(new ItemChanceHolder(SKULL, 5), new ItemChanceHolder(RIB_BONE, 20), new ItemChanceHolder(SPINE, 31), new ItemChanceHolder(ARM_BONE, 33), new ItemChanceHolder(THIGH_BONE, 69)));
} }
public Q00325_GrimCollector() public Q00325_GrimCollector()
@@ -201,7 +201,7 @@ public class Q00325_GrimCollector extends Quest
} }
final int rnd = getRandom(100); final int rnd = getRandom(100);
for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) for (ItemChanceHolder drop : MONSTER_DROPS.get(npc.getId()))
{ {
if (rnd < drop.getChance()) if (rnd < drop.getChance())
{ {

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.QuestItemHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,15 +39,15 @@ public class Q00369_CollectorOfJewels extends Quest
// Misc // Misc
private static final int MIN_LEVEL = 25; private static final int MIN_LEVEL = 25;
// Mobs // Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>();
static static
{ {
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20609, new ItemChanceHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20612, new ItemChanceHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire MOBS_DROP_CHANCES.put(20749, new ItemChanceHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin MOBS_DROP_CHANCES.put(20616, new ItemChanceHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin MOBS_DROP_CHANCES.put(20619, new ItemChanceHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide MOBS_DROP_CHANCES.put(20747, new ItemChanceHolder(FREEZING_SHARD, 100, 2)); // roxide
} }
public Q00369_CollectorOfJewels() public Q00369_CollectorOfJewels()
@@ -113,7 +113,7 @@ public class Q00369_CollectorOfJewels extends Quest
@Override @Override
public String onKill(Npc npc, Player player, boolean isSummon) public String onKill(Npc npc, Player player, boolean isSummon)
{ {
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance()) if (getRandom(100) < item.getChance())
{ {
final Player luckyPlayer = getRandomPartyMember(player, npc); final Player luckyPlayer = getRandomPartyMember(player, npc);

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -21,8 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.commons.util.Rnd;
/** /**
* A DTO for items; contains item ID, count and chance.<br> * A DTO for items; contains item ID, count and chance.
* Complemented by {@link QuestItemHolder}.
* @author xban1x * @author xban1x
*/ */
public class ItemChanceHolder extends ItemHolder public class ItemChanceHolder extends ItemHolder

View File

@@ -20,8 +20,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/** /**
* A simple DTO for items; contains item ID and count.<br> * A simple DTO for items; contains item ID and count.
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid * @author UnAfraid
*/ */
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable

View File

@@ -1,53 +0,0 @@
/*
* 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.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

Some files were not shown because too many files have changed in this diff Show More