Sync with L2JServer Jan 24th 2015.

This commit is contained in:
mobius
2015-01-24 20:02:32 +00:00
parent d349bd3924
commit 1c6301c46d
1012 changed files with 23069 additions and 6307 deletions

View File

@@ -39,9 +39,9 @@ import javolution.util.FastSet;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GameTimeController;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.datatables.DoorTable;
import com.l2jserver.gameserver.data.xml.impl.DoorData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.datatables.NpcData;
import com.l2jserver.gameserver.enums.QuestSound;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.CastleManager;
@@ -117,6 +117,7 @@ import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.interfaces.IPositionable;
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
import com.l2jserver.gameserver.model.items.L2EtcItem;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
@@ -2016,8 +2017,8 @@ public abstract class AbstractScript extends ManagedScript
return;
}
final L2ItemInstance _tmpItem = ItemTable.getInstance().createDummyItem(itemId);
if (_tmpItem == null)
final L2Item item = ItemTable.getInstance().getTemplate(itemId);
if (item == null)
{
return;
}
@@ -2030,9 +2031,9 @@ public abstract class AbstractScript extends ManagedScript
}
else if (Config.RATE_QUEST_REWARD_USE_MULTIPLIERS)
{
if (_tmpItem.isEtcItem())
if (item instanceof L2EtcItem)
{
switch (_tmpItem.getEtcItem().getItemType())
switch (((L2EtcItem) item).getItemType())
{
case POTION:
count *= Config.RATE_QUEST_REWARD_POTION;
@@ -2064,13 +2065,13 @@ public abstract class AbstractScript extends ManagedScript
}
// Add items to player's inventory
L2ItemInstance item = player.getInventory().addItem("Quest", itemId, count, player, player.getTarget());
if (item == null)
final L2ItemInstance itemInstance = player.getInventory().addItem("Quest", itemId, count, player, player.getTarget());
if (itemInstance == null)
{
return;
}
sendItemGetMessage(player, item, count);
sendItemGetMessage(player, itemInstance, count);
}
/**
@@ -2586,7 +2587,7 @@ public abstract class AbstractScript extends ManagedScript
L2DoorInstance door = null;
if (instanceId <= 0)
{
door = DoorTable.getInstance().getDoor(doorId);
door = DoorData.getInstance().getDoor(doorId);
}
else
{
@@ -2649,6 +2650,17 @@ public abstract class AbstractScript extends ManagedScript
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
/**
* Adds desire to move to the given NPC.
* @param npc the NPC
* @param loc the location
* @param desire the desire
*/
protected void addMoveToDesire(L2Npc npc, Location loc, int desire)
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc);
}
/**
* Instantly cast a skill upon the given target.
* @param npc the caster NPC

View File

@@ -34,6 +34,7 @@ import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcCreatureSee
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcEventReceived;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcFirstTalk;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcManorBypass;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcMenuSelect;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcMoveFinished;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcMoveNodeArrived;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcMoveRouteFinished;
@@ -168,6 +169,7 @@ public enum EventType
ON_NPC_TALK(null, void.class),
ON_NPC_TELEPORT(OnNpcTeleport.class, void.class),
ON_NPC_MANOR_BYPASS(OnNpcManorBypass.class, void.class),
ON_NPC_MENU_SELECT(OnNpcMenuSelect.class, void.class),
// Olympiad events
ON_OLYMPIAD_MATCH_RESULT(OnOlympiadMatchResult.class, void.class),

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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.
*
* L2J Server 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 com.l2jserver.gameserver.model.events.impl.character.npc;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.events.EventType;
import com.l2jserver.gameserver.model.events.impl.IBaseEvent;
/**
* @author St3eT
*/
public class OnNpcMenuSelect implements IBaseEvent
{
private final L2PcInstance _activeChar;
private final L2Npc _npc;
private final int _ask;
private final int _reply;
/**
* @param activeChar
* @param npc
* @param ask
* @param reply
*/
public OnNpcMenuSelect(L2PcInstance activeChar, L2Npc npc, int ask, int reply)
{
_activeChar = activeChar;
_npc = npc;
_ask = ask;
_reply = reply;
}
public L2PcInstance getTalker()
{
return _activeChar;
}
public L2Npc getNpc()
{
return _npc;
}
public int getAsk()
{
return _ask;
}
public int getReply()
{
return _reply;
}
@Override
public EventType getType()
{
return EventType.ON_NPC_MENU_SELECT;
}
}