Moved EventDropManager and EventShrineManager to events package.

This commit is contained in:
MobiusDevelopment
2022-04-04 22:57:38 +00:00
parent f81a139ab2
commit 12ad015551
165 changed files with 2943 additions and 2943 deletions

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -114,7 +114,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -142,6 +141,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AbsorberInfo;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -118,7 +118,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -146,6 +145,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -118,7 +118,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -146,6 +145,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -118,7 +118,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -146,6 +145,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -120,7 +120,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -148,6 +147,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -120,7 +120,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -148,6 +147,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -121,7 +121,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -149,6 +148,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -123,7 +123,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -152,6 +151,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -123,7 +123,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -152,6 +151,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -124,7 +124,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -153,6 +152,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -126,7 +126,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -155,6 +154,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;

View File

@@ -19,7 +19,7 @@ package events;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.zone.ZoneType;

View File

@@ -126,7 +126,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -155,6 +154,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;

View File

@@ -118,7 +118,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import org.l2jmobius.gameserver.instancemanager.GraciaSeedsManager;
@@ -144,6 +143,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -42,9 +42,9 @@ import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.DamageDoneInfo;

View File

@@ -39,8 +39,8 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.EventShrineManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.events.EventShrineManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player;

View File

@@ -118,7 +118,6 @@ import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.FakePlayerChatManager;
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import org.l2jmobius.gameserver.instancemanager.GraciaSeedsManager;
@@ -144,6 +143,7 @@ import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.events.EventDispatcher;

View File

@@ -1,104 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

View File

@@ -0,0 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.EventDropHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @author Mobius
*/
public class EventDropManager
{
private static final Map<LongTimeEvent, List<EventDropHolder>> EVENT_DROPS = new ConcurrentHashMap<>(1);
public void addDrops(LongTimeEvent longTimeEvent, List<EventDropHolder> dropList)
{
EVENT_DROPS.put(longTimeEvent, dropList);
}
public void removeDrops(LongTimeEvent longTimeEvent)
{
EVENT_DROPS.remove(longTimeEvent);
}
public void doEventDrop(Creature attacker, Attackable attackable)
{
if (EVENT_DROPS.isEmpty())
{
return;
}
// Event items drop only for players.
if ((attacker == null) || !attacker.isPlayable() || attackable.isFakePlayer())
{
return;
}
// Event items drop only within a default 9 level difference.
final Player player = attacker.getActingPlayer();
if ((player.getLevel() - attackable.getLevel()) > Config.EVENT_ITEM_MAX_LEVEL_DIFFERENCE)
{
return;
}
for (List<EventDropHolder> eventDrops : EVENT_DROPS.values())
{
DROPS: for (EventDropHolder drop : eventDrops)
{
if (!drop.getMonsterIds().isEmpty() && !drop.getMonsterIds().contains(attackable.getId()))
{
continue DROPS;
}
final int monsterLevel = attackable.getLevel();
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{
final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
}
else
{
attackable.dropItem(player, itemId, itemCount); // Drop the item on the ground.
}
}
}
}
}
public static EventDropManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventDropManager INSTANCE = new EventDropManager();
}
}

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager.events;
/**
* @author Mobius
*/
public class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
public static EventShrineManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final EventShrineManager INSTANCE = new EventShrineManager();
}
}

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