How to make a custom droplist?
Page 1 of 1 • Share
How to make a custom droplist?
Well, my question is on topic title: as the database haven't a custom_droplist database how can I add custom drops in mobs without need to edit /data/xml/droplist XML files individually?
More deep question, probably an sollution: can I make a script where I create an array list of mob ID's with a custom droplist, like those "faenor" configs used on L2jServer?
More deep question, probably an sollution: can I make a script where I create an array list of mob ID's with a custom droplist, like those "faenor" configs used on L2jServer?
Anderuimm- Knight
- Posts : 56
Join date : 2014-08-04
Re: How to make a custom droplist?
- Code:
/*
* 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 events.March9;
import java.util.ArrayList;
import java.util.List;
import lineage2.commons.util.Rnd;
import lineage2.gameserver.Announcements;
import lineage2.gameserver.Config;
import lineage2.gameserver.cache.Msg;
import lineage2.gameserver.listener.actor.OnDeathListener;
import lineage2.gameserver.listener.actor.player.OnPlayerEnterListener;
import lineage2.gameserver.model.Creature;
import lineage2.gameserver.model.Player;
import lineage2.gameserver.model.SimpleSpawner;
import lineage2.gameserver.model.actor.listener.CharListenerList;
import lineage2.gameserver.model.instances.NpcInstance;
import lineage2.gameserver.network.serverpackets.components.CustomMessage;
import lineage2.gameserver.scripts.Functions;
import lineage2.gameserver.scripts.ScriptFile;
import lineage2.gameserver.utils.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Mobius
* @version $Revision: 1.0 $
*/
public class March9 extends Functions implements ScriptFile, OnDeathListener, OnPlayerEnterListener
{
/**
* Field _log.
*/
private static final Logger _log = LoggerFactory.getLogger(March9.class);
/**
* Field EVENT_NAME. (value is ""March9"")
*/
private static final String EVENT_NAME = "March9";
/**
* Field RECIPE_PRICE. (value is 50000)
*/
private static final int RECIPE_PRICE = 50000;
/**
* Field RECIPE_ID. (value is 20191)
*/
private static final int RECIPE_ID = 20191;
/**
* Field EVENT_MANAGER_ID. (value is 4301)
*/
private static final int EVENT_MANAGER_ID = 4301;
/**
* Field _spawns.
*/
private static final List<SimpleSpawner> _spawns = new ArrayList<>();
/**
* Field DROP.
*/
private static final int[] DROP =
{
6673,// อาเดนางานฉลอง
6633,// Dummy - General Item 1
6634,// Dummy - General Item 2
6635
// Dummy - General Item 3
// Mark of Cheers
};
/**
* Field _active.
*/
private static boolean _active = false;
/**
* Method spawnEventManagers.
*/
private void spawnEventManagers()
{
final int[][] EVENT_MANAGERS =
{
{
-113224,
-244936,
-15536,
8192
}
};
SpawnNPCs(EVENT_MANAGER_ID, EVENT_MANAGERS, _spawns);
}
/**
* Method unSpawnEventManagers.
*/
private void unSpawnEventManagers()
{
deSpawnNPCs(_spawns);
}
/**
* Method isActive.
* @return boolean
*/
private static boolean isActive()
{
return IsActive(EVENT_NAME);
}
/**
* Method startEvent.
*/
public void startEvent()
{
final Player player = getSelf();
if (!player.getPlayerAccess().IsEventGm)
{
return;
}
if (SetActive(EVENT_NAME, true))
{
spawnEventManagers();
System.out.println("Event: March 9 started.");
Announcements.getInstance().announceByCustomMessage("scripts.events.March9.AnnounceEventStarted", null);
}
else
{
player.sendMessage("Event 'March 9' already started.");
}
_active = true;
show("admin/events.htm", player);
}
/**
* Method stopEvent.
*/
public void stopEvent()
{
final Player player = getSelf();
if (!player.getPlayerAccess().IsEventGm)
{
return;
}
if (SetActive(EVENT_NAME, false))
{
unSpawnEventManagers();
System.out.println("Event: March 9 stopped.");
Announcements.getInstance().announceByCustomMessage("scripts.events.March9.AnnounceEventStoped", null);
}
else
{
player.sendMessage("Event 'March 9' not started.");
}
_active = false;
show("admin/events.htm", player);
}
/**
* Method buyrecipe.
*/
public void buyrecipe()
{
final Player player = getSelf();
if (!player.isQuestContinuationPossible(true))
{
return;
}
if (!NpcInstance.canBypassCheck(player, player.getLastNpc()))
{
return;
}
final long need_adena = (long) (RECIPE_PRICE * Config.EVENT_MARCH9_PRICE_RATE);
if (player.getAdena() < need_adena)
{
player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
return;
}
player.reduceAdena(need_adena, true);
Functions.addItem(player, RECIPE_ID, 1);
}
/**
* Method DialogAppend_4301.
* @param val Integer
* @return String
*/
public String DialogAppend_4301(Integer val)
{
if (val != 0)
{
return "";
}
final String price;
String append = "";
price = Util.formatAdena((long) (RECIPE_PRICE * Config.EVENT_MARCH9_PRICE_RATE));
append += "<br><a action=\"bypass -h scripts_events.March9.March9:buyrecipe\">";
append += new CustomMessage("scripts.events.March9.buyrecipe", getSelf()).addString(price);
append += "</a><br>";
return append;
}
/**
* Method onLoad.
* @see lineage2.gameserver.scripts.ScriptFile#onLoad()
*/
@Override
public void onLoad()
{
CharListenerList.addGlobal(this);
if (isActive())
{
_active = true;
spawnEventManagers();
_log.info("Loaded Event: March 9 [state: activated]");
}
else
{
_log.info("Loaded Event: March 9 [state: deactivated]");
}
}
/**
* Method onReload.
* @see lineage2.gameserver.scripts.ScriptFile#onReload()
*/
@Override
public void onReload()
{
unSpawnEventManagers();
}
/**
* Method onShutdown.
* @see lineage2.gameserver.scripts.ScriptFile#onShutdown()
*/
@Override
public void onShutdown()
{
unSpawnEventManagers();
}
/**
* Method onPlayerEnter.
* @param player Player
* @see lineage2.gameserver.listener.actor.player.OnPlayerEnterListener#onPlayerEnter(Player)
*/
@Override
public void onPlayerEnter(Player player)
{
if (_active)
{
Announcements.getInstance().announceToPlayerByCustomMessage(player, "scripts.events.March9.AnnounceEventStarted", null);
}
}
/**
* Method onDeath.
* @param cha Creature
* @param killer Creature
* @see lineage2.gameserver.listener.actor.OnDeathListener#onDeath(Creature, Creature)
*/
@Override
public void onDeath(Creature cha, Creature killer)
{
if (_active && SimpleCheckDrop(cha, killer) && Rnd.chance(Config.EVENT_MARCH9_DROP_CHANCE * killer.getPlayer().getRateItems() * ((NpcInstance) cha).getTemplate().rateHp))
{
((NpcInstance) cha).dropItem(killer.getPlayer(), DROP[Rnd.get(DROP.length)], 1);
}
}
}
darkillust- Vassal
- Posts : 9
Join date : 2014-07-19
Re: How to make a custom droplist?
@darkillust , thanks but this script is to a Global drop like Medals event, and it's not my intention. If I use this players @lvl99 will be able to drop from mobs above lvl 87, like those on Imperial Tomb (and there are a LOT of them, easely killable with AOE attacks for awakened characters. I want to, for example:
- Add Gold Bars (2-5 with 50% chance) to mobs on Dragon Valley
- Add Gold Bars (4-9 with 60% chance) to mobs on Fairy Settlement
- Add Golden Apiga (1-3 with 35% chance) to mobs on Guillotine Fortress
- Add Golden Apiga (5 stacks with 12-27 with 90% chance) to a pre-defined list of Raid Bosses.
PS.: I can use one script for each group of drops
- Add Gold Bars (2-5 with 50% chance) to mobs on Dragon Valley
- Add Gold Bars (4-9 with 60% chance) to mobs on Fairy Settlement
- Add Golden Apiga (1-3 with 35% chance) to mobs on Guillotine Fortress
- Add Golden Apiga (5 stacks with 12-27 with 90% chance) to a pre-defined list of Raid Bosses.
PS.: I can use one script for each group of drops
Anderuimm- Knight
- Posts : 56
Join date : 2014-08-04
Re: How to make a custom droplist?
can use old quest to make custom quest like evilspirit quest i has edit long time ago can select monster id in quest
darkillust- Vassal
- Posts : 9
Join date : 2014-07-19
Re: How to make a custom droplist?
darkillust wrote:can use old quest to make custom quest like evilspirit quest i has edit long time ago can select monster id in quest
I don't want to make a quest that's players get before "farm"... IDK why our rev haven't an custom_droplist table or XML file... if it had it'll be very usefull to improve farm systems and/or season events.
Anderuimm- Knight
- Posts : 56
Join date : 2014-08-04
Similar topics
» Update DROPLIST
» Wich one is the correct Droplist file?
» how to add custom drop to monster ?
» [HELP] How to Make GM
» [Question] How create a Custom Arena?
» Wich one is the correct Droplist file?
» how to add custom drop to monster ?
» [HELP] How to Make GM
» [Question] How create a Custom Arena?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|