Ver código fonte

BETA: Golem Trader is a merchant NPC, not a servitor.
* Removed useless code.
* Fixed hierarchy.
* Cleanup.

Zoey76 11 anos atrás
pai
commit
e3de8b2465

+ 1 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/CharSummonTable.java

@@ -31,7 +31,6 @@ import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.idfactory.IdFactory;
 import com.l2jserver.gameserver.model.L2PetData;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
@@ -255,11 +254,7 @@ public class CharSummonTable
 					summon.setCurrentMp(curMp);
 					summon.setHeading(activeChar.getHeading());
 					summon.setRunning();
-					if (!(summon instanceof L2MerchantSummonInstance))
-					{
-						activeChar.setPet(summon);
-					}
-					
+					activeChar.setPet(summon);
 					summon.setTimeRemaining(time);
 					
 					summon.spawnMe(activeChar.getX() + 20, activeChar.getY() + 20, activeChar.getZ());

+ 0 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/enums/InstanceType.java

@@ -41,7 +41,6 @@ public enum InstanceType
 	// Summons, Pets, Decoys and Traps
 	L2ServitorInstance(L2Summon),
 	L2SiegeSummonInstance(L2ServitorInstance),
-	L2MerchantSummonInstance(L2ServitorInstance),
 	L2PetInstance(L2Summon),
 	L2BabyPetInstance(L2PetInstance),
 	L2DecoyInstance(L2Decoy),

+ 19 - 26
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Summon.java

@@ -37,7 +37,6 @@ import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.L2WorldRegion;
 import com.l2jserver.gameserver.model.actor.L2Attackable.AggroInfo;
 import com.l2jserver.gameserver.model.actor.events.SummonEvents;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
@@ -126,25 +125,23 @@ public abstract class L2Summon extends L2Playable
 	public void onSpawn()
 	{
 		super.onSpawn();
-		if (!(this instanceof L2MerchantSummonInstance))
+		
+		if (Config.SUMMON_STORE_SKILL_COOLTIME && !isTeleporting())
 		{
-			if (Config.SUMMON_STORE_SKILL_COOLTIME && !isTeleporting())
-			{
-				restoreEffects();
-			}
-			
-			setFollowStatus(true);
-			updateAndBroadcastStatus(0);
-			sendPacket(new RelationChanged(this, getOwner().getRelation(getOwner()), false));
-			for (L2PcInstance player : getOwner().getKnownList().getKnownPlayersInRadius(800))
-			{
-				player.sendPacket(new RelationChanged(this, getOwner().getRelation(player), isAutoAttackable(player)));
-			}
-			L2Party party = getOwner().getParty();
-			if (party != null)
-			{
-				party.broadcastToPartyMembers(getOwner(), new ExPartyPetWindowAdd(this));
-			}
+			restoreEffects();
+		}
+		
+		setFollowStatus(true);
+		updateAndBroadcastStatus(0);
+		sendPacket(new RelationChanged(this, getOwner().getRelation(getOwner()), false));
+		for (L2PcInstance player : getOwner().getKnownList().getKnownPlayersInRadius(800))
+		{
+			player.sendPacket(new RelationChanged(this, getOwner().getRelation(player), isAutoAttackable(player)));
+		}
+		L2Party party = getOwner().getParty();
+		if (party != null)
+		{
+			party.broadcastToPartyMembers(getOwner(), new ExPartyPetWindowAdd(this));
 		}
 		setShowSummonAnimation(false); // addVisibleObject created the info packets with summon animation
 		// if someone comes into range now, the animation shouldn't show any more
@@ -348,12 +345,8 @@ public abstract class L2Summon extends L2Playable
 		{
 			return false;
 		}
-		if (this instanceof L2MerchantSummonInstance)
-		{
-			return true;
-		}
-		L2PcInstance owner = getOwner();
 		
+		final L2PcInstance owner = getOwner();
 		if (owner != null)
 		{
 			for (L2Character TgMob : getKnownList().getKnownCharacters())
@@ -918,7 +911,7 @@ public abstract class L2Summon extends L2Playable
 	{
 		for (L2PcInstance player : getKnownList().getKnownPlayers().values())
 		{
-			if ((player == null) || ((player == getOwner()) && !(this instanceof L2MerchantSummonInstance)))
+			if ((player == null) || (player == getOwner()))
 			{
 				continue;
 			}
@@ -951,7 +944,7 @@ public abstract class L2Summon extends L2Playable
 	public void sendInfo(L2PcInstance activeChar)
 	{
 		// Check if the L2PcInstance is the owner of the Pet
-		if (activeChar.equals(getOwner()) && !(this instanceof L2MerchantSummonInstance))
+		if (activeChar == getOwner())
 		{
 			activeChar.sendPacket(new PetInfo(this, 0));
 			// The PetInfo packet wipes the PartySpelled (list of active spells' icons). Re-add them

+ 0 - 263
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantSummonInstance.java

@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2004-2013 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.actor.instance;
-
-import java.util.StringTokenizer;
-
-import com.l2jserver.Config;
-import com.l2jserver.gameserver.ai.CtrlIntention;
-import com.l2jserver.gameserver.ai.L2CharacterAI;
-import com.l2jserver.gameserver.datatables.BuyListData;
-import com.l2jserver.gameserver.enums.InstanceType;
-import com.l2jserver.gameserver.model.L2Party;
-import com.l2jserver.gameserver.model.L2WorldRegion;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
-import com.l2jserver.gameserver.model.buylist.L2BuyList;
-import com.l2jserver.gameserver.model.skills.L2Skill;
-import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
-import com.l2jserver.gameserver.network.serverpackets.BuyList;
-import com.l2jserver.gameserver.network.serverpackets.ExBuySellList;
-import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
-import com.l2jserver.gameserver.network.serverpackets.SellList;
-
-/**
- * @author Kerberos
- */
-public class L2MerchantSummonInstance extends L2ServitorInstance
-{
-	public L2MerchantSummonInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2Skill skill)
-	{
-		super(objectId, template, owner, skill);
-		setInstanceType(InstanceType.L2MerchantSummonInstance);
-	}
-	
-	@Override
-	public boolean hasAI()
-	{
-		return false;
-	}
-	
-	@Override
-	public L2CharacterAI getAI()
-	{
-		return null;
-	}
-	
-	@Override
-	public void deleteMe(L2PcInstance owner)
-	{
-		
-	}
-	
-	@Override
-	public void unSummon(L2PcInstance owner)
-	{
-		if (isVisible())
-		{
-			stopAllEffects();
-			L2WorldRegion oldRegion = getWorldRegion();
-			decayMe();
-			if (oldRegion != null)
-			{
-				oldRegion.removeFromZones(this);
-			}
-			getKnownList().removeAllKnownObjects();
-			setTarget(null);
-			
-			if (_summonLifeTask != null)
-			{
-				_summonLifeTask.cancel(false);
-				_summonLifeTask = null;
-			}
-		}
-	}
-	
-	@Override
-	public void setFollowStatus(boolean state)
-	{
-		
-	}
-	
-	@Override
-	public boolean isAutoAttackable(L2Character attacker)
-	{
-		return false;
-	}
-	
-	@Override
-	public boolean isInvul()
-	{
-		return true;
-	}
-	
-	@Override
-	public L2Party getParty()
-	{
-		return null;
-	}
-	
-	@Override
-	public boolean isInParty()
-	{
-		return false;
-	}
-	
-	@Override
-	public boolean useMagic(L2Skill skill, boolean forceUse, boolean dontMove)
-	{
-		return false;
-	}
-	
-	@Override
-	public void doCast(L2Skill skill)
-	{
-		
-	}
-	
-	@Override
-	public boolean isInCombat()
-	{
-		return false;
-	}
-	
-	@Override
-	public final void sendDamageMessage(L2Character target, int damage, boolean mcrit, boolean pcrit, boolean miss)
-	{
-		
-	}
-	
-	@Override
-	public void reduceCurrentHp(double i, L2Character attacker, boolean awake, boolean isDOT, L2Skill skill)
-	{
-		
-	}
-	
-	@Override
-	public void updateAndBroadcastStatus(int val)
-	{
-		
-	}
-	
-	@Override
-	public void onAction(L2PcInstance player, boolean interact)
-	{
-		if (player.isOutOfControl())
-		{
-			player.sendPacket(ActionFailed.STATIC_PACKET);
-			return;
-		}
-		
-		// Check if the L2PcInstance already target the L2NpcInstance
-		if (this != player.getTarget())
-		{
-			// Set the target of the L2PcInstance player
-			player.setTarget(this);
-		}
-		else if (interact)
-		{
-			// Calculate the distance between the L2PcInstance and the L2NpcInstance
-			if (!isInsideRadius(player, 150, false, false))
-			{
-				// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
-				player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
-			}
-			else
-			{
-				showMessageWindow(player);
-			}
-		}
-		// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
-		player.sendPacket(ActionFailed.STATIC_PACKET);
-	}
-	
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		final StringTokenizer st = new StringTokenizer(command, " ");
-		final String actualCommand = st.nextToken(); // Get actual command
-		
-		if (actualCommand.equalsIgnoreCase("Buy"))
-		{
-			if (st.countTokens() < 1)
-			{
-				return;
-			}
-			
-			final int val = Integer.parseInt(st.nextToken());
-			showBuyWindow(player, val);
-		}
-		else if (actualCommand.equalsIgnoreCase("Sell"))
-		{
-			showSellWindow(player);
-		}
-	}
-	
-	protected final void showBuyWindow(L2PcInstance player, int val)
-	{
-		final L2BuyList buyList = BuyListData.getInstance().getBuyList(val);
-		if (buyList == null)
-		{
-			_log.warning("BuyList not found! BuyListId:" + val);
-			player.sendPacket(ActionFailed.STATIC_PACKET);
-			return;
-		}
-		
-		if (!buyList.isNpcAllowed(getId()))
-		{
-			_log.warning("Npc not allowed in BuyList! BuyListId:" + val + " NpcId:" + getId());
-			player.sendPacket(ActionFailed.STATIC_PACKET);
-			return;
-		}
-		
-		double taxRate = 0.50;
-		
-		player.setInventoryBlockingStatus(true);
-		
-		player.sendPacket(new BuyList(buyList, player.getAdena(), taxRate));
-		player.sendPacket(new ExBuySellList(player, false));
-		player.sendPacket(ActionFailed.STATIC_PACKET);
-	}
-	
-	protected final void showSellWindow(L2PcInstance player)
-	{
-		if (Config.DEBUG)
-		{
-			_log.fine("Showing selllist");
-		}
-		
-		player.sendPacket(new SellList(player));
-		
-		if (Config.DEBUG)
-		{
-			_log.fine("Showing sell window");
-		}
-		
-		player.sendPacket(ActionFailed.STATIC_PACKET);
-	}
-	
-	private void showMessageWindow(L2PcInstance player)
-	{
-		player.sendPacket(ActionFailed.STATIC_PACKET);
-		final String filename = "data/html/merchant/" + getId() + ".htm";
-		final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-		html.setFile(player.getHtmlPrefix(), filename);
-		html.replace("%objectId%", String.valueOf(getObjectId()));
-		player.sendPacket(html);
-	}
-}

+ 1 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillSummon.java

@@ -24,7 +24,6 @@ import com.l2jserver.gameserver.idfactory.IdFactory;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
@@ -100,10 +99,6 @@ public class L2SkillSummon extends L2Skill
 		{
 			summon = new L2SiegeSummonInstance(id, summonTemplate, activeChar, this);
 		}
-		else if (summonTemplate.isType("L2MerchantSummon"))
-		{
-			summon = new L2MerchantSummonInstance(id, summonTemplate, activeChar, this);
-		}
 		else
 		{
 			summon = new L2ServitorInstance(id, summonTemplate, activeChar, this);
@@ -129,10 +124,7 @@ public class L2SkillSummon extends L2Skill
 		summon.setCurrentMp(summon.getMaxMp());
 		summon.setHeading(activeChar.getHeading());
 		summon.setRunning();
-		if (!(summon instanceof L2MerchantSummonInstance))
-		{
-			activeChar.setPet(summon);
-		}
+		activeChar.setPet(summon);
 		summon.spawnMe(activeChar.getX() + 20, activeChar.getY() + 20, activeChar.getZ());
 	}
 	

+ 2 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestBuyItem.java

@@ -29,7 +29,6 @@ import com.l2jserver.gameserver.datatables.BuyListData;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.buylist.L2BuyList;
 import com.l2jserver.gameserver.model.buylist.Product;
@@ -105,21 +104,12 @@ public final class RequestBuyItem extends L2GameClientPacket
 		L2Character merchant = null;
 		if (!player.isGM())
 		{
-			if ((target == null) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
-				|| (player.getInstanceId() != target.getInstanceId()))
-			{
-				sendPacket(ActionFailed.STATIC_PACKET);
-				return;
-			}
-			if ((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance))
-			{
-				merchant = (L2Character) target;
-			}
-			else
+			if (!(target instanceof L2MerchantInstance) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) || (player.getInstanceId() != target.getInstanceId()))
 			{
 				sendPacket(ActionFailed.STATIC_PACKET);
 				return;
 			}
+			merchant = (L2Character) target;
 		}
 		
 		double castleTaxRate = 0;

+ 0 - 26
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java

@@ -37,7 +37,6 @@ import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.entity.Hero;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -227,31 +226,6 @@ public final class RequestBypassToServer extends L2GameClientPacket
 					_log.log(Level.WARNING, "NFE for command [" + _command + "]", nfe);
 				}
 			}
-			else if (_command.startsWith("summon_"))
-			{
-				int endOfId = _command.indexOf('_', 8);
-				String id;
-				
-				if (endOfId > 0)
-				{
-					id = _command.substring(7, endOfId);
-				}
-				else
-				{
-					id = _command.substring(7);
-				}
-				
-				if (Util.isDigit(id))
-				{
-					L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
-					
-					if ((object instanceof L2MerchantSummonInstance) && (endOfId > 0) && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
-					{
-						((L2MerchantSummonInstance) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1));
-					}
-				}
-				activeChar.sendPacket(ActionFailed.STATIC_PACKET);
-			}
 			else if (_command.startsWith("_bbs"))
 			{
 				if (Config.ENABLE_COMMUNITY_BOARD)

+ 2 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestRefundItem.java

@@ -25,7 +25,6 @@ import com.l2jserver.gameserver.datatables.BuyListData;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.buylist.L2BuyList;
 import com.l2jserver.gameserver.model.items.L2Item;
@@ -93,15 +92,14 @@ public final class RequestRefundItem extends L2GameClientPacket
 		}
 		
 		L2Object target = player.getTarget();
-		if (!player.isGM() && ((target == null) // No target (i.e. GM Shop)
-			|| !((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance)) || (player.getInstanceId() != target.getInstanceId()) || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false))) // Distance is too far
+		if (!player.isGM() && ((target == null) || !(target instanceof L2MerchantInstance) || (player.getInstanceId() != target.getInstanceId()) || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)))
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
 		
 		L2Character merchant = null;
-		if ((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance))
+		if (target instanceof L2MerchantInstance)
 		{
 			merchant = (L2Character) target;
 		}

+ 2 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestSellItem.java

@@ -29,7 +29,6 @@ import com.l2jserver.gameserver.datatables.BuyListData;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.buylist.L2BuyList;
 import com.l2jserver.gameserver.model.holders.ItemHolder;
@@ -114,13 +113,12 @@ public final class RequestSellItem extends L2GameClientPacket
 		L2Character merchant = null;
 		if (!player.isGM())
 		{
-			if ((target == null) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) // Distance is too far)
-				|| (player.getInstanceId() != target.getInstanceId()))
+			if ((target == null) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) || (player.getInstanceId() != target.getInstanceId()))
 			{
 				sendPacket(ActionFailed.STATIC_PACKET);
 				return;
 			}
-			if ((target instanceof L2MerchantInstance) || (target instanceof L2MerchantSummonInstance))
+			if (target instanceof L2MerchantInstance)
 			{
 				merchant = (L2Character) target;
 			}