Request: Adapt Mod
Good afternoon !
Could someone experienced adapt to lisvus 749?
Thanks in advance.
Good afternoon !
Could someone experienced adapt to lisvus 749?
Thanks in advance.
- SellBuffs:
- ### Eclipse Workspace Patch 1.0
#P aCis_gameserver
diff --git java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
index e77f468..131c6d5 100644
--- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
+++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
@@ -1,44 +1,46 @@
package net.sf.l2j.gameserver.handler;
import java.util.HashMap;
import java.util.Map;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.EventCommand;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Menu;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.OfflinePlayer;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Online;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.PremiumStatus;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.SellBuff;
public class VoicedCommandHandler
{
private final Map<Integer, IVoicedCommandHandler> _entries = new HashMap<>();
protected VoicedCommandHandler()
{
registerHandler(new Online());
registerHandler(new Menu());
registerHandler(new OfflinePlayer());
registerHandler(new PremiumStatus());
registerHandler(new EventCommand());
+ registerHandler(new SellBuff());
}
public void registerHandler(IVoicedCommandHandler handler)
{
String[] ids = handler.getVoicedCommandList();
for (int i = 0; i < ids.length; i++)
_entries.put(ids[i].hashCode(), handler);
}
public IVoicedCommandHandler getHandler(String voicedCommand)
{
String command = voicedCommand;
if (voicedCommand.indexOf(" ") != -1)
command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
return _entries.get(command.hashCode());
}
public int size()
{
diff --git java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/SellBuff.java
new file mode 100644
index 0000000..36af6d8
--- /dev/null
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/SellBuff.java
@@ -0,0 +1,74 @@
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.enums.ZoneId;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.Player;
+import net.sf.l2j.gameserver.model.entity.events.capturetheflag.CTFEvent;
+import net.sf.l2j.gameserver.model.entity.events.deathmatch.DMEvent;
+import net.sf.l2j.gameserver.model.entity.events.lastman.LMEvent;
+import net.sf.l2j.gameserver.model.entity.events.teamvsteam.TvTEvent;
+import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+
+/**
+ *
+ * @author Iratus
+ */
+public class SellBuff implements IVoicedCommandHandler
+{
+ private static final String[] VOICED_COMMANDS = {"sellbuffs"};
+
+ @Override
+ public boolean useVoicedCommand(String command, Player activeChar, String target)
+ {
+ if(activeChar == null)
+ return false;
+
+ if(activeChar.isDead() || activeChar.isAlikeDead())
+ {
+ activeChar.sendMessage("You are dead , you can't sell at the moment");
+ return false;
+ }
+ else if(activeChar.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(activeChar))
+ {
+ activeChar.sendMessage("You are in olympiad , you can't sell at the moment");
+ return false;
+ }
+ final int charId = activeChar.getObjectId();
+ if (CTFEvent.isPlayerParticipant(charId) || DMEvent.isPlayerParticipant(charId) || LMEvent.isPlayerParticipant(charId) || TvTEvent.isPlayerParticipant(charId))
+ {
+ activeChar.sendMessage("You can't join Start Buffs while participating on Event.");
+ return false;
+ }
+ else if(!activeChar.isInsideZone(ZoneId.PEACE))
+ {
+ activeChar.sendMessage("You are not in peacefull zone , you can sell only in peacefull zones");
+ return false;
+ }
+ else if(activeChar.getClassId().getId() != 98)
+ {
+ activeChar.sendMessage("You must be a buffer class to sell buffs");
+ return false;
+ }
+
+ StringBuilder tb = new StringBuilder(0);
+ tb.append("<html><body>");
+ tb.append("Hello , by completing this form you will be able to sell buffs.");
+ tb.append("<br>Players will be able , targeting you to take your buff services<br>");
+ tb.append("<br>You will be rewarded with adenas for each buff a player takes.");
+ tb.append("<br><center>Now choose the prize:</center><br>");
+ tb.append("<edit var=\"pri\" width=120 height=15>");
+ tb.append("<center><button value=\"Confirm\" action=\"bypass -h actr $pri\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">");
+ tb.append("</body></html>");
+ NpcHtmlMessage n = new NpcHtmlMessage(0);
+ n.setHtml(tb.toString());
+ activeChar.sendPacket(n);
+ return true;
+ }
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return VOICED_COMMANDS;
+ }
+
+}
\ No newline at end of file
diff --git java/net/sf/l2j/gameserver/model/actor/Player.java
index 588d728..9fa12d3 100644
--- java/net/sf/l2j/gameserver/model/actor/Player.java
+++ java/net/sf/l2j/gameserver/model/actor/Player.java
@@ -68,44 +68,45 @@
import net.sf.l2j.gameserver.enums.SpawnType;
import net.sf.l2j.gameserver.enums.StatusType;
import net.sf.l2j.gameserver.enums.TeamType;
import net.sf.l2j.gameserver.enums.TeleportMode;
import net.sf.l2j.gameserver.enums.ZoneId;
import net.sf.l2j.gameserver.enums.actors.ClassId;
import net.sf.l2j.gameserver.enums.actors.ClassRace;
import net.sf.l2j.gameserver.enums.actors.ClassType;
import net.sf.l2j.gameserver.enums.actors.MoveType;
import net.sf.l2j.gameserver.enums.actors.OperateType;
import net.sf.l2j.gameserver.enums.actors.Sex;
import net.sf.l2j.gameserver.enums.actors.WeightPenalty;
import net.sf.l2j.gameserver.enums.bbs.ForumAccess;
import net.sf.l2j.gameserver.enums.bbs.ForumType;
import net.sf.l2j.gameserver.enums.items.ActionType;
import net.sf.l2j.gameserver.enums.items.EtcItemType;
import net.sf.l2j.gameserver.enums.items.ItemLocation;
import net.sf.l2j.gameserver.enums.items.ItemState;
import net.sf.l2j.gameserver.enums.items.ShotType;
import net.sf.l2j.gameserver.enums.items.WeaponType;
import net.sf.l2j.gameserver.enums.skills.EffectFlag;
import net.sf.l2j.gameserver.enums.skills.EffectType;
+import net.sf.l2j.gameserver.enums.skills.SkillType;
import net.sf.l2j.gameserver.enums.skills.Stats;
import net.sf.l2j.gameserver.geoengine.GeoEngine;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.handler.ItemHandler;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditChar;
import net.sf.l2j.gameserver.handler.skillhandlers.SummonFriend;
import net.sf.l2j.gameserver.model.AccessLevel;
import net.sf.l2j.gameserver.model.PetDataEntry;
import net.sf.l2j.gameserver.model.World;
import net.sf.l2j.gameserver.model.WorldObject;
import net.sf.l2j.gameserver.model.actor.ai.type.PlayerAI;
import net.sf.l2j.gameserver.model.actor.attack.PlayerAttack;
import net.sf.l2j.gameserver.model.actor.cast.PlayerCast;
import net.sf.l2j.gameserver.model.actor.container.npc.RewardInfo;
import net.sf.l2j.gameserver.model.actor.container.player.Appearance;
import net.sf.l2j.gameserver.model.actor.container.player.BlockList;
import net.sf.l2j.gameserver.model.actor.container.player.CubicList;
import net.sf.l2j.gameserver.model.actor.container.player.FishingStance;
import net.sf.l2j.gameserver.model.actor.container.player.HennaList;
import net.sf.l2j.gameserver.model.actor.container.player.MacroList;
import net.sf.l2j.gameserver.model.actor.container.player.Punishment;
import net.sf.l2j.gameserver.model.actor.container.player.QuestList;
@@ -282,44 +283,46 @@
public static final int REQUEST_TIMEOUT = 15;
private static final Comparator<GeneralSkillNode> COMPARE_SKILLS_BY_MIN_LVL = Comparator.comparing(GeneralSkillNode::getMinLvl);
private static final Comparator<GeneralSkillNode> COMPARE_SKILLS_BY_LVL = Comparator.comparing(GeneralSkillNode::getValue);
private long _offlineShopStart;
private GameClient _client;
private final Map<Integer, String> _chars = new HashMap<>();
private final String _accountName;
private long _deleteTimer;
private boolean _isOnline;
private long _onlineTime;
private long _onlineBeginTime;
private long _lastAccess;
private long _uptime;
protected int _baseClass;
protected int _activeClass;
protected int _classIndex;
+ private boolean _sellbuff = false;
+ private int _buffprize = 0;
private final Map<Integer, SubClass> _subClasses = new ConcurrentSkipListMap<>();
private final ReentrantLock _subclassLock = new ReentrantLock();
private final Appearance _appearance;
private long _expBeforeDeath;
private int _karma;
private int _pvpKills;
private int _pkKills;
private byte _pvpFlag;
private int _siegeState;
private WeightPenalty _weightPenalty = WeightPenalty.NONE;
private int _lastCompassZone; // the last compass zone update send to the client
private boolean _isIn7sDungeon;
private final Punishment _punishment = new Punishment(this);
private final RecipeBook _recipeBook = new RecipeBook(this);
private boolean _isInOlympiadMode;
@@ -1552,44 +1555,47 @@
}, 2500);
// Broadcast the packet.
broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_SITTING));
// Tutorial
final QuestState qs = _questList.getQuestState("Tutorial");
if (qs != null)
qs.getQuest().notifyEvent("CE8388608", null, this);
return true;
}
/**
* Stand the {@link Player} up. The player retrieves control after a 2.5s delay.
* <ul>
* <li>Schedules the STOOD_UP event</li>
* <li>Broadcast {@link ChangeWaitType} packet</li>
* </ul>
*/
public void standUp()
{
+ if(isSellBuff())
+ return;
_isStandingNow = true;
_isSitting = false;
// Schedule a stand up task to wait for the animation to finish
ThreadPool.schedule(() ->
{
_isStandingNow = false;
_isStanding = true;
getAI().notifyEvent(AiEventType.STOOD_UP, null, null);
}, 2500);
// Broadcast the packet.
broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_STANDING));
}
/**
* @return The PcWarehouse object of the Player.
*/
public PcWarehouse getWarehouse()
{
@@ -2657,44 +2663,84 @@
su.addAttribute(StatusType.MAX_HP, target.getStatus().getMaxHp());
su.addAttribute(StatusType.CUR_HP, (int) target.getStatus().getHp());
sendPacket(su);
broadcastPacket(new TargetSelected(getObjectId(), newTarget.getObjectId(), getX(), getY(), getZ()), false);
}
if (newTarget instanceof Folk)
setCurrentFolk((Folk) newTarget);
else if (newTarget == null)
{
sendPacket(ActionFailed.STATIC_PACKET);
if (getTarget() != null)
{
broadcastPacket(new TargetUnselected(this));
setCurrentFolk(null);
}
}
// Target the new WorldObject
super.setTarget(newTarget);
+ Player t = null;
+ if(newTarget instanceof Player)
+ t = (Player) newTarget;
+
+ if(t != null)
+ {
+ if(t.isSellBuff() && t != this)
+ {
+ StringBuilder tb = new StringBuilder();
+ NpcHtmlMessage n = new NpcHtmlMessage(0);
+
+ tb.append("<html><body>");
+ tb.append("<br><br>");
+ tb.append("<center>Hi, I am "+t.getName()+" and i sell my buffs</center>");
+ tb.append("<br><center>Buffs Prize:"+t.getBuffPrize()+"</center>");
+
+ Collection<L2Skill> skills = t.getSkills().values();
+ ArrayList<L2Skill> ba = new ArrayList<L2Skill>();
+
+ for(L2Skill s : skills)
+ {
+ if(s == null)
+ continue;
+
+ if(s.getSkillType() == SkillType.BUFF && s.isActive())
+ ba.add(s);
+ }
+
+ for(L2Skill p : ba)
+ {
+ tb.append("<center><button value=\""+p.getName()+"\" action=\"bypass -h buff"+p.getId()+"\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\"></center>");
+ }
+
+ tb.append("</body></html>");
+
+ n.setHtml(tb.toString());
+ sendPacket(n);
+ }
+ }
}
@Override
public ItemInstance getActiveWeaponInstance()
{
return getInventory().getItemFrom(Paperdoll.RHAND);
}
@Override
public Weapon getActiveWeaponItem()
{
final ItemInstance item = getActiveWeaponInstance();
return (item == null) ? getTemplate().getFists() : (Weapon) item.getItem();
}
@Override
public WeaponType getAttackType()
{
return getActiveWeaponItem().getItemType();
}
@Override
@@ -7969,36 +8015,54 @@
}
var = _manufactureStoreList.get();
if (var != null)
{
String[] items = var.split(";");
for (String item : items)
{
if (item.equals(""))
continue;
String[] values = item.split(",");
if (values.length < 2)
continue;
int recId = Integer.parseInt(values[0]);
int price = Integer.parseInt(values[1]);
_manufactureList.add(new ManufactureItem(recId, price));
}
}
}
+ public boolean isSellBuff()
+ {
+ return _sellbuff;
+ }
+
+ public void setSellBuff(boolean j)
+ {
+ _sellbuff = j;
+ }
+
+ public int getBuffPrize()
+ {
+ return _buffprize;
+ }
+
+ public void setBuffPrize(int x)
+ {
+ _buffprize = x;
+ }
/**
* Added to other GMs, test also this {@link Player} instance. If GM, set it.
*/
@Override
public List<Player> getSurroundingGMs()
{
final List<Player> gms = super.getSurroundingGMs();
if (isGM())
gms.add(this);
return gms;
}
}
\ No newline at end of file
diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
index ccab125..b558d5b 100644
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
@@ -1,39 +1,40 @@
package net.sf.l2j.gameserver.network.clientpackets;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import net.sf.l2j.commons.data.Pagination;
import net.sf.l2j.commons.lang.StringUtil;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.communitybbs.CommunityBoard;
import net.sf.l2j.gameserver.data.DropCalc;
+import net.sf.l2j.gameserver.data.SkillTable;
import net.sf.l2j.gameserver.data.manager.BotsPreventionManager;
import net.sf.l2j.gameserver.data.manager.HeroManager;
import net.sf.l2j.gameserver.data.manager.SpawnManager;
import net.sf.l2j.gameserver.data.xml.AdminData;
import net.sf.l2j.gameserver.data.xml.ItemData;
import net.sf.l2j.gameserver.enums.DropType;
import net.sf.l2j.gameserver.enums.FloodProtector;
import net.sf.l2j.gameserver.enums.actors.NpcSkillType;
import net.sf.l2j.gameserver.enums.skills.ElementType;
import net.sf.l2j.gameserver.enums.skills.SkillType;
import net.sf.l2j.gameserver.handler.AdminCommandHandler;
import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
import net.sf.l2j.gameserver.model.World;
import net.sf.l2j.gameserver.model.WorldObject;
import net.sf.l2j.gameserver.model.actor.Attackable;
import net.sf.l2j.gameserver.model.actor.Npc;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.model.actor.container.attackable.AggroList;
import net.sf.l2j.gameserver.model.actor.container.npc.AggroInfo;
import net.sf.l2j.gameserver.model.actor.instance.GrandBoss;
@@ -168,44 +169,102 @@
}
else if (_command.startsWith("Quest "))
{
if (!player.validateBypass(_command))
return;
String[] str = _command.substring(6).trim().split(" ", 2);
if (str.length == 1)
player.getQuestList().processQuestEvent(str[0], "");
else
player.getQuestList().processQuestEvent(str[0], str[1]);
}
else if (_command.startsWith("_match"))
{
String params = _command.substring(_command.indexOf("?") + 1);
StringTokenizer st = new StringTokenizer(params, "&");
int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
int heroid = HeroManager.getInstance().getHeroByClass(heroclass);
if (heroid > 0)
HeroManager.getInstance().showHeroFights(player, heroclass, heroid, heropage);
}
+ else if(_command.startsWith("buff"))
+ {
+ String x = _command.substring(4);
+ int id = Integer.parseInt(x);
+ Player target = null;
+
+ if(player.getTarget() instanceof Player)
+ target = (Player) player.getTarget();
+
+ if(target == null)
+ {
+ return;
+ }
+
+ if(player.getInventory().getItemByItemId(57).getCount() < ((Player) player.getTarget()).getBuffPrize())
+ {
+ player.sendMessage("not enought adena");
+ }
+
+ try
+ {
+ L2Skill s = SkillTable.getInstance().getInfo(id, 2);
+ s.getEffects(player, player);
+ player.sendMessage("You buyed: "+s.getName());
+ player.getInventory().destroyItemByItemId("", 57, target.getBuffPrize(), target, null);
+ target.getInventory().addItem("", 57, target.getBuffPrize(), target, null);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else if(_command.startsWith("actr"))
+ {
+ String l = _command.substring(5);
+
+ int p = 0;
+
+ p = Integer.parseInt(l);
+
+
+ if(p == 0)
+ return;
+
+ if(p > 2000000000)
+ {
+ player.sendMessage("Too big prize");
+ return;
+ }
+
+ player.setBuffPrize(p);
+ player.sitDown();
+ player.setSellBuff(true);
+ player.getAppearance().setNameColor(0x1111);
+ player.setTitle("=SELL BUFFS=");
+ player.broadcastUserInfo();
+ player.broadcastTitleInfo();
+ }
else if (_command.startsWith("_diary"))
{
String params = _command.substring(_command.indexOf("?") + 1);
StringTokenizer st = new StringTokenizer(params, "&");
int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
int heroid = HeroManager.getInstance().getHeroByClass(heroclass);
if (heroid > 0)
HeroManager.getInstance().showHeroDiary(player, heroclass, heroid, heropage);
}
else if (_command.startsWith("arenachange")) // change
{
final boolean isManager = player.getCurrentFolk() instanceof OlympiadManagerNpc;
if (!isManager)
{
// Without npc, command can be used only in observer mode on arena
if (!player.isInObserverMode() || player.isInOlympiadMode() || player.getOlympiadGameId() < 0)
return;
}
// Olympiad registration check.
if (OlympiadManager.getInstance().isRegisteredInComp(player))
@@ -303,44 +362,53 @@
catch (Exception e)
{
showNpcInfoEffects(player, (Npc) wo, html, 1);
}
break;
}
}
player.sendPacket(html);
}
}
catch (Exception e)
{
LOGGER.error("bypass user_npc_info error", e);
}
- Drop Itens Enchant:
- ### Eclipse Workspace Patch 1.0
Index: gameserver/head-src/com/l2jfrozen/gameserver/model/L2Attackable.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (working copy)
@@ -244,12 +244,22 @@
protected int _itemId;
protected int _count;
+ private int _enchant = -1;
+ private int _chance = 0;
+
public RewardItem(int itemId, int count)
{
_itemId = itemId;
_count = count;
}
+ public RewardItem(int itemId, int count, int enchant, int chance)
+ {
+ this(itemId, count);
+ _enchant = enchant;
+ _chance = chance;
+ }
+
public int getItemId()
{
return _itemId;
@@ -259,6 +269,9 @@
{
return _count;
}
+
+ public int getEnchant() { return _enchant; }
+ public int getEnchantChance() { return _chance; }
}
/**
@@ -1560,7 +1573,7 @@
}
if(itemCount > 0)
- return new RewardItem(drop.getItemId(), itemCount);
+ return new RewardItem(drop.getItemId(), itemCount, drop.getEnchant(), drop.getEnchantChance());
else if(itemCount == 0 && Config.DEBUG)
{
_log.fine("Roll produced 0 items to drop...");
@@ -1845,7 +1858,7 @@
}
if(itemCount > 0)
- return new RewardItem(drop.getItemId(), itemCount);
+ return new RewardItem(drop.getItemId(), itemCount, drop.getEnchant(), drop.getEnchantChance());
else if(itemCount == 0 && Config.DEBUG)
{
_log.fine("Roll produced 0 items to drop...");
@@ -2503,6 +2516,16 @@
// Init the dropped L2ItemInstance and add it in the world as a visible object at the position where mob was last
ditem = ItemTable.getInstance().createItem("Loot", item.getItemId(), item.getCount(), mainDamageDealer, this);
ditem.getDropProtection().protect(mainDamageDealer);
+ if(item.getEnchant() > 0)
+ {
+ if(ditem.getItem().getType1() == L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE
+ || ditem.getItem().getType1() == L2Item.TYPE1_SHIELD_ARMOR)
+ {
+ double chance = Rnd.get(1, 100);
+ if(chance <= item.getEnchantChance())
+ ditem.setEnchantLevel(item.getEnchant());
+ }
+ }
ditem.dropMe(this, newX, newY, newZ);
// Add drop to auto destroy item task
Index: gameserver/head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/datatables/sql/NpcTable.java (working copy)
@@ -247,7 +247,7 @@
{
statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[]
{
- "mobId", "itemId", "min", "max", "category", "chance"
+ "mobId", "itemId", "min", "max", "category", "chance", "enchant", "enchantChance"
}) + " FROM custom_droplist ORDER BY mobId, chance DESC");
ResultSet dropData = statement.executeQuery();
@@ -270,6 +270,8 @@
dropDat.setMinDrop(dropData.getInt("min"));
dropDat.setMaxDrop(dropData.getInt("max"));
dropDat.setChance(dropData.getInt("chance"));
+ dropDat.setEnchant(dropData.getInt("enchant"));
+ dropDat.setEnchantChance(dropData.getInt("enchantChance"));
int category = dropData.getInt("category");
@@ -295,7 +297,7 @@
{
statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[]
{
- "mobId", "itemId", "min", "max", "category", "chance"
+ "mobId", "itemId", "min", "max", "category", "chance", "enchant", "enchantChance"
}) + " FROM droplist ORDER BY mobId, chance DESC");
ResultSet dropData = statement.executeQuery();
L2DropData dropDat = null;
@@ -319,6 +321,8 @@
dropDat.setMinDrop(dropData.getInt("min"));
dropDat.setMaxDrop(dropData.getInt("max"));
dropDat.setChance(dropData.getInt("chance"));
+ dropDat.setEnchant(dropData.getInt("enchant"));
+ dropDat.setEnchantChance(dropData.getInt("enchantChance"));
int category = dropData.getInt("category");
Index: gameserver/head-src/com/l2jfrozen/gameserver/script/faenor/FaenorInterface.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/script/faenor/FaenorInterface.java (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/script/faenor/FaenorInterface.java (working copy)
@@ -82,6 +82,27 @@
addDrop(npc, drop, false);
}
+ public void addQuestDrop(int npcID, int itemID, int min, int max, int chance, String questID, String[] states,
+ int enchant, int enchantChance)
+ {
+ L2NpcTemplate npc = npcTable.getTemplate(npcID);
+ if (npc == null)
+ {
+ _log.info("FeanorInterface: Npc "+npcID+" is null..");
+ return;
+ }
+ L2DropData drop = new L2DropData();
+ drop.setItemId(itemID);
+ drop.setMinDrop(min);
+ drop.setMaxDrop(max);
+ drop.setEnchant(enchant);
+ drop.setEnchantChance(enchantChance);
+ drop.setChance(chance);
+ drop.setQuestID(questID);
+ drop.addStates(states);
+ addDrop(npc, drop, false);
+ }
+
/**
* Adds a new Drop to an NPC
*
@@ -106,7 +127,31 @@
addDrop(npc, drop, sweep);
}
+
+ public void addDrop(int npcID, int itemID, int min, int max, boolean sweep, int chance,
+ int enchant, int enchantChance) throws NullPointerException
+ {
+ L2NpcTemplate npc = npcTable.getTemplate(npcID);
+ if (npc == null)
+ {
+ if (Config.DEBUG)
+ {
+ _log.warning("Npc doesnt Exist");
+ }
+ throw new NullPointerException();
+ }
+ L2DropData drop = new L2DropData();
+ drop.setItemId(itemID);
+ drop.setMinDrop(min);
+ drop.setMaxDrop(max);
+ drop.setChance(chance);
+ drop.setEnchant(enchant);
+ drop.setEnchantChance(enchantChance);
+
+ addDrop(npc, drop, sweep);
+ }
+
/**
* Adds a new drop to an NPC. If the drop is sweep, it adds it to the NPC's Sweep category If the drop is non-sweep,
* it creates a new category for this drop.
Index: gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminEditNpc.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminEditNpc.java (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminEditNpc.java (working copy)
@@ -407,7 +407,7 @@
e.printStackTrace();
}
}
- else if(st.countTokens() == 6)
+ else if(st.countTokens() ==
{
try
{
@@ -417,8 +417,10 @@
int min = Integer.parseInt(st.nextToken());
int max = Integer.parseInt(st.nextToken());
int chance = Integer.parseInt(st.nextToken());
+ int enchant = Integer.parseInt(st.nextToken());
+ int enchantChance = Integer.parseInt(st.nextToken());
- updateDropData(activeChar, npcId, itemId, min, max, category, chance);
+ updateDropData(activeChar, npcId, itemId, min, max, category, chance, enchant, enchantChance);
}
catch(Exception e)
{
@@ -430,7 +432,7 @@
}
else
{
- activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance>]");
+ activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance> <enchant> <enchantChance>]");
}
st = null;
@@ -440,7 +442,7 @@
if(Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
- activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance>]");
+ activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance> <enchant> <enchantChance>]");
}
}
else if(command.startsWith("admin_add_drop "))
@@ -474,7 +476,7 @@
npcData = null;
}
}
- else if(st.countTokens() == 6)
+ else if(st.countTokens() ==
{
try
{
@@ -484,8 +486,10 @@
int min = Integer.parseInt(st.nextToken());
int max = Integer.parseInt(st.nextToken());
int chance = Integer.parseInt(st.nextToken());
+ int enchant = Integer.parseInt(st.nextToken());
+ int enchantChance = Integer.parseInt(st.nextToken());
- addDropData(activeChar, npcId, itemId, min, max, category, chance);
+ addDropData(activeChar, npcId, itemId, min, max, category, chance, enchant, enchantChance);
}
catch(Exception e)
{
@@ -497,7 +501,7 @@
}
else
{
- activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance>]");
+ activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance> <enchant> <enchantChance>]");
}
st = null;
@@ -507,7 +511,7 @@
if(Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
- activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance>]");
+ activeChar.sendMessage("Usage: //add_drop <npc_id> [<item_id> <category> <min> <max> <chance> <enchant> <enchantChance>]");
}
}
else if(command.startsWith("admin_del_drop "))
@@ -1323,7 +1327,7 @@
{
con = L2DatabaseFactory.getInstance().getConnection(false);
- PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance FROM droplist WHERE mobId=" + npcId + " AND itemId=" + itemId + " AND category=" + category);
+ PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance, enchant, enchantChance FROM droplist WHERE mobId=" + npcId + " AND itemId=" + itemId + " AND category=" + category);
ResultSet dropData = statement.executeQuery();
NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
@@ -1340,9 +1344,11 @@
replyMSG.append("<tr><td>MIN(" + dropData.getInt("min") + ")</td><td><edit var=\"min\" width=80></td></tr>");
replyMSG.append("<tr><td>MAX(" + dropData.getInt("max") + ")</td><td><edit var=\"max\" width=80></td></tr>");
replyMSG.append("<tr><td>CHANCE(" + dropData.getInt("chance") + ")</td><td><edit var=\"chance\" width=80></td></tr>");
+ replyMSG.append("<tr><td>ENC-VALUE(" + dropData.getInt("enchant") + ")</td><td><edit var=\"enchant\" width=80></td></tr>");
+ replyMSG.append("<tr><td>ENC-CHANCE(" + dropData.getInt("enchantChance") + ")</td><td><edit var=\"enchantChance\" width=80></td></tr>");
replyMSG.append("</table>");
replyMSG.append("<center>");
- replyMSG.append("<button value=\"Save Modify\" action=\"bypass -h admin_edit_drop " + npcId + " " + itemId + " " + category + " $min $max $chance\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
+ replyMSG.append("<button value=\"Save Modify\" action=\"bypass -h admin_edit_drop " + npcId + " " + itemId + " " + category + " $min $max $chance $enchant $enchantChance\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("<br><button value=\"DropList\" action=\"bypass -h admin_show_droplist " + dropData.getInt("mobId") + "\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("</center>");
}
@@ -1383,9 +1389,11 @@
replyMSG.append("<tr><td>MAX</td><td><edit var=\"max\" width=80></td></tr>");
replyMSG.append("<tr><td>CATEGORY(sweep=-1)</td><td><edit var=\"category\" width=80></td></tr>");
replyMSG.append("<tr><td>CHANCE(0-1000000)</td><td><edit var=\"chance\" width=80></td></tr>");
+ replyMSG.append("<tr><td>ENC-VALUE(0-65535)</td><td><edit var=\"enchant\" width=80></td></tr>");
+ replyMSG.append("<tr><td>ENC-CHANCE(0-100)</td><td><edit var=\"enchantChance\" width=80></td></tr>");
replyMSG.append("</table>");
replyMSG.append("<center>");
- replyMSG.append("<button value=\"SAVE\" action=\"bypass -h admin_add_drop " + npcData.npcId + " $itemId $category $min $max $chance\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
+ replyMSG.append("<button value=\"SAVE\" action=\"bypass -h admin_add_drop " + npcData.npcId + " $itemId $category $min $max $chance $enchant $enchantChance\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("<br><button value=\"DropList\" action=\"bypass -h admin_show_droplist " + npcData.npcId + "\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("</center>");
replyMSG.append("</body></html>");
@@ -1397,7 +1405,7 @@
replyMSG = null;
}
- private void updateDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance)
+ private void updateDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance, int enchant, int enchantChance)
{
Connection con = null;
@@ -1405,13 +1413,15 @@
{
con = L2DatabaseFactory.getInstance().getConnection(false);
- PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=? WHERE mobId=? AND itemId=? AND category=?");
+ PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=?, enchant=?, enchantChance=? WHERE mobId=? AND itemId=? AND category=?");
statement.setInt(1, min);
statement.setInt(2, max);
statement.setInt(3, chance);
statement.setInt(4, npcId);
statement.setInt(5, itemId);
statement.setInt(6, category);
+ statement.setInt(7, enchant);
+ statement.setInt(8, enchantChance);
statement.execute();
statement.close();
@@ -1464,7 +1474,7 @@
}
}
- private void addDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance)
+ private void addDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance, int enchant, int enchantChance)
{
Connection con = null;
@@ -1472,13 +1482,16 @@
{
con = L2DatabaseFactory.getInstance().getConnection(false);
- PreparedStatement statement = con.prepareStatement("INSERT INTO droplist(mobId, itemId, min, max, category, chance) values(?,?,?,?,?,?)");
+ PreparedStatement statement = con.prepareStatement("INSERT INTO droplist(mobId, itemId, min, max, category, chance, enchant, enchantChance) values(?,?,?,?,?,?,?,?)");
statement.setInt(1, npcId);
statement.setInt(2, itemId);
statement.setInt(3, min);
statement.setInt(4, max);
statement.setInt(5, category);
statement.setInt(6, chance);
+ statement.setInt(7, enchant);
+ statement.setInt(8, enchantChance);
+
statement.execute();
statement.close();
statement = null;
@@ -1573,7 +1586,7 @@
PreparedStatement statement = con.prepareStatement("SELECT " + L2DatabaseFactory.getInstance().safetyString(new String[]
{
- "mobId", "itemId", "min", "max", "category", "chance"
+ "mobId", "itemId", "min", "max", "category", "chance", "enchant", "enchantChance"
}) + " FROM droplist WHERE mobId=?");
statement.setInt(1, npcId);
ResultSet dropDataList = statement.executeQuery();
@@ -1586,6 +1599,8 @@
dropData.setMinDrop(dropDataList.getInt("min"));
dropData.setMaxDrop(dropDataList.getInt("max"));
dropData.setChance(dropDataList.getInt("chance"));
+ dropData.setEnchant(dropDataList.getInt("enchant"));
+ dropData.setEnchantChance(dropDataList.getInt("enchantChance"));
int category = dropDataList.getInt("category");
Index: gameserver/head-src/com/l2jfrozen/gameserver/model/L2DropData.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/model/L2DropData.java (revision 903)
+++ gameserver/head-src/com/l2jfrozen/gameserver/model/L2DropData.java (working copy)
@@ -33,6 +33,8 @@
private int _minDrop;
private int _maxDrop;
private int _chance;
+ private int _dropEnchant = -1;
+ private int _enchantChance = 0;
private String _questID = null;
private String[] _stateID = null;
@@ -55,7 +57,17 @@
{
_itemId = itemId;
}
-
+
+ public void setEnchant(final int enchant)
+ {
+ _dropEnchant = enchant;
+ }
+
+ public void setEnchantChance(final int chance)
+ {
+ _enchantChance = chance;
+ }
+
/**
* Returns the minimum quantity of items dropped
*
@@ -86,6 +98,16 @@
return _chance;
}
+ public int getEnchant()
+ {
+ return _dropEnchant;
+ }
+
+ public int getEnchantChance()
+ {
+ return _enchantChance;
+ }
+
/**
* Sets the value for minimal quantity of dropped items
*