Optional support for running longtime events yearly.
Contributed by Costykiller.
This commit is contained in:
parent
8515ed3ba9
commit
cf9d6e6838
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -16,12 +16,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="47385" /> <!-- Balthus Knight Mark -->
|
||||
<item id="47387" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="47399" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -37,9 +37,9 @@
|
||||
<add npc="34009" x="-80392" y="149896" z="-3040" heading="0" /> <!-- Gludin -->
|
||||
<add npc="34009" x="115384" y="75064" z="-2600" heading="0" /> <!-- Hunter Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -73,7 +74,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -108,7 +109,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -127,16 +128,41 @@ public class LongTimeEvent extends Quest
|
||||
final Document doc = db.parse(configFile);
|
||||
if (!doc.getDocumentElement().getNodeName().equalsIgnoreCase("event"))
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: bad config file!");
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -273,7 +299,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -287,11 +313,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -383,7 +409,7 @@ public class LongTimeEvent extends Quest
|
||||
_active = false;
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -399,11 +425,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
@ -422,7 +448,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
LOGGER.warning("Problem with LongTimeEvent: " + e.getMessage());
|
||||
LOGGER.warning(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -73,7 +74,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -108,7 +109,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -127,16 +128,41 @@ public class LongTimeEvent extends Quest
|
||||
final Document doc = db.parse(configFile);
|
||||
if (!doc.getDocumentElement().getNodeName().equalsIgnoreCase("event"))
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: bad config file!");
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -273,7 +299,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -287,11 +313,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -383,7 +409,7 @@ public class LongTimeEvent extends Quest
|
||||
_active = false;
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -399,11 +425,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
@ -422,7 +448,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
LOGGER.warning("Problem with LongTimeEvent: " + e.getMessage());
|
||||
LOGGER.warning(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -14,12 +14,12 @@
|
||||
<add npc="34262" x="147064" y="25928" z="-2008" heading="17863" /> <!-- Aden -->
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -14,12 +14,12 @@
|
||||
<add npc="34262" x="147064" y="25928" z="-2008" heading="17863" /> <!-- Aden -->
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -15,12 +15,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="147464" y="-56984" z="-2784" heading="11547" /> <!-- Goddard -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -15,12 +15,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="147464" y="-56984" z="-2784" heading="11547" /> <!-- Goddard -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -15,12 +15,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="147464" y="-56984" z="-2784" heading="11547" /> <!-- Goddard -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -14,12 +14,12 @@
|
||||
<add npc="34262" x="147064" y="25928" z="-2008" heading="17863" /> <!-- Aden -->
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -41,9 +41,9 @@
|
||||
<add npc="34009" x="10666" y="16259" z="-4575" heading="4156" /> <!-- Dark Elven Vilage -->
|
||||
<add npc="34009" x="46016" y="47863" z="-3061" heading="20213" /> <!-- Elven Vilage -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="21709" /> <!-- BRACELET_RUDOLPH -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Rudolph's Blessing: Event Ended!" />
|
||||
<add type="onEnter" text="Rudolph's blessing: The event continues!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -15,12 +15,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="147464" y="-56984" z="-2784" heading="11547" /> <!-- Goddard -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -15,12 +15,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="147464" y="-56984" z="-2784" heading="11547" /> <!-- Goddard -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
@ -15,12 +15,12 @@
|
||||
<add npc="34262" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34262" x="147464" y="-56984" z="-2784" heading="11547" /> <!-- Goddard -->
|
||||
</spawnlist>
|
||||
<destoyItemsOnEnd>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="49783" /> <!-- Sibi's Coin -->
|
||||
<item id="49784" /> <!-- Balthus Knight Mark -->
|
||||
<item id="49782" /> <!-- Balthus Knight Supply Box -->
|
||||
<item id="49800" /> <!-- Sibi's Coin Box -->
|
||||
</destoyItemsOnEnd>
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="Happy Hours: Event end!" />
|
||||
<add type="onEnter" text="Happy Hours: Event ongoing!" />
|
||||
|
@ -35,7 +35,7 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destoyItemsOnEnd" minOccurs="0">
|
||||
<xs:element name="destroyItemsOnEnd" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -72,7 +73,7 @@ public class LongTimeEvent extends Quest
|
||||
protected final List<EventDropHolder> _dropList = new ArrayList<>();
|
||||
|
||||
// Items to destroy when event ends.
|
||||
protected final List<Integer> _destoyItemsOnEnd = new ArrayList<>();
|
||||
protected final List<Integer> _destroyItemsOnEnd = new ArrayList<>();
|
||||
|
||||
protected class NpcSpawn
|
||||
{
|
||||
@ -107,7 +108,7 @@ public class LongTimeEvent extends Quest
|
||||
else
|
||||
{
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
LOGGER.info("Event " + _eventName + " has passed... Ignored ");
|
||||
}
|
||||
}
|
||||
@ -133,19 +134,44 @@ public class LongTimeEvent extends Quest
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
}
|
||||
final String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if ((doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null) && doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue().equalsIgnoreCase("true"))
|
||||
{
|
||||
_enableShrines = true;
|
||||
}
|
||||
if (period.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (period.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = period.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = period.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activePeriod = start.concat("-").concat(end);
|
||||
_eventPeriod = DateRange.parse(activePeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
|
||||
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
|
||||
{
|
||||
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
|
||||
if (dropPeriod.length() == 21)
|
||||
{
|
||||
// dd MM yyyy-dd MM yyyy
|
||||
_dropPeriod = DateRange.parse(dropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
else if (dropPeriod.length() == 11)
|
||||
{
|
||||
// dd MM-dd MM
|
||||
final String start = dropPeriod.split("-")[0].concat(" ").concat(currentYear);
|
||||
final String end = dropPeriod.split("-")[1].concat(" ").concat(currentYear);
|
||||
final String activeDropPeriod = start.concat("-").concat(end);
|
||||
_dropPeriod = DateRange.parse(activeDropPeriod, new SimpleDateFormat("dd MM yyyy", Locale.US));
|
||||
}
|
||||
// Check if drop period is within range of event period
|
||||
if (!_eventPeriod.isWithinRange(_dropPeriod.getStartDate()) || !_eventPeriod.isWithinRange(_dropPeriod.getEndDate()))
|
||||
{
|
||||
@ -159,7 +185,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
final Date today = new Date();
|
||||
@ -198,19 +224,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 0) || (finalChance > 100))
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
LOGGER.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -218,7 +244,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +266,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
LOGGER.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
LOGGER.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -248,7 +274,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +308,7 @@ public class LongTimeEvent extends Quest
|
||||
// Load destroy item list at all times.
|
||||
for (Node n = doc.getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equalsIgnoreCase("destoyItemsOnEnd"))
|
||||
if (n.getNodeName().equalsIgnoreCase("destroyItemsOnEnd"))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
@ -296,11 +322,11 @@ public class LongTimeEvent extends Quest
|
||||
LOGGER.warning(getScriptName() + " event: Item " + itemId + " does not exist.");
|
||||
continue;
|
||||
}
|
||||
_destoyItemsOnEnd.add(itemId);
|
||||
_destroyItemsOnEnd.add(itemId);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
LOGGER.warning("Wrong number format in config.xml destoyItemsOnEnd block for " + getScriptName() + " event");
|
||||
LOGGER.warning("Wrong number format in config.xml destroyItemsOnEnd block for " + getScriptName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +428,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Destroy items that must exist only on event period.
|
||||
destoyItemsOnEnd();
|
||||
destroyItemsOnEnd();
|
||||
|
||||
// Send message on end.
|
||||
if (!_endMsg.isEmpty())
|
||||
@ -418,11 +444,11 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
void destoyItemsOnEnd()
|
||||
void destroyItemsOnEnd()
|
||||
{
|
||||
if (!_destoyItemsOnEnd.isEmpty())
|
||||
if (!_destroyItemsOnEnd.isEmpty())
|
||||
{
|
||||
for (int itemId : _destoyItemsOnEnd)
|
||||
for (int itemId : _destroyItemsOnEnd)
|
||||
{
|
||||
// Remove item from online players.
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
|
Loading…
Reference in New Issue
Block a user