Explorar el Código

BETA: Replaced `L2SiegeSummonInstance` with `NpcRace.SIEGE_WEAPON`.

Reviewed by: !UnAfraid
Nos hace 11 años
padre
commit
efb74e90d0

+ 2 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/CharSummonTable.java

@@ -34,7 +34,6 @@ import com.l2jserver.gameserver.model.L2PetData;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
 import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSummon;
@@ -220,19 +219,8 @@ public class CharSummonTable
 					}
 					
 					final int id = IdFactory.getInstance().getNextId();
-					if (summonTemplate.isType("L2SiegeSummon"))
-					{
-						summon = new L2SiegeSummonInstance(id, summonTemplate, activeChar, skill);
-					}
-					else if (summonTemplate.isType("L2MerchantSummon"))
-					{
-						// TODO: Confirm L2Merchant summon = new L2MerchantSummonInstance(id, summonTemplate, activeChar, skill);
-						summon = new L2ServitorInstance(id, summonTemplate, activeChar, skill);
-					}
-					else
-					{
-						summon = new L2ServitorInstance(id, summonTemplate, activeChar, skill);
-					}
+					
+					summon = new L2ServitorInstance(id, summonTemplate, activeChar, skill);
 					
 					summon.setName(summonTemplate.getName());
 					summon.setTitle(activeChar.getName());

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

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

+ 2 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Summon.java

@@ -41,7 +41,6 @@ import com.l2jserver.gameserver.model.L2WorldRegion;
 import com.l2jserver.gameserver.model.actor.events.SummonEvents;
 import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
 import com.l2jserver.gameserver.model.actor.knownlist.SummonKnownList;
 import com.l2jserver.gameserver.model.actor.stat.SummonStat;
 import com.l2jserver.gameserver.model.actor.status.SummonStatus;
@@ -1107,12 +1106,12 @@ public abstract class L2Summon extends L2Playable
 			return false;
 		}
 		
-		// TODO: Unhardcode it.
 		// Siege golems AI doesn't support attacking other than doors/walls at the moment.
-		if (!target.isDoor() && ((npcId == L2SiegeSummonInstance.SWOOP_CANNON_ID) || (npcId == L2SiegeSummonInstance.SIEGE_GOLEM_ID)))
+		if (target.isDoor() && (getTemplate().getRace() != NpcRace.SIEGE_WEAPON))
 		{
 			return false;
 		}
+		
 		return true;
 	}
 	

+ 8 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2DoorInstance.java

@@ -30,6 +30,7 @@ import com.l2jserver.gameserver.ai.L2CharacterAI;
 import com.l2jserver.gameserver.ai.L2DoorAI;
 import com.l2jserver.gameserver.datatables.DoorTable;
 import com.l2jserver.gameserver.enums.InstanceType;
+import com.l2jserver.gameserver.enums.NpcRace;
 import com.l2jserver.gameserver.instancemanager.CastleManager;
 import com.l2jserver.gameserver.instancemanager.ClanHallManager;
 import com.l2jserver.gameserver.instancemanager.FortManager;
@@ -675,7 +676,13 @@ public class L2DoorInstance extends L2Character
 	@Override
 	public void reduceCurrentHp(double damage, L2Character attacker, boolean awake, boolean isDOT, L2Skill skill)
 	{
-		if (isWall() && !(attacker instanceof L2SiegeSummonInstance) && (getInstanceId() == 0))
+		if (isWall() && !attacker.isServitor() && (getInstanceId() == 0))
+		{
+			return;
+		}
+		
+		L2ServitorInstance servitor = (L2ServitorInstance) attacker;
+		if (servitor.getTemplate().getRace() != NpcRace.SIEGE_WEAPON)
 		{
 			return;
 		}

+ 0 - 36
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeSummonInstance.java

@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2004-2014 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 com.l2jserver.gameserver.enums.InstanceType;
-import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
-import com.l2jserver.gameserver.model.skills.L2Skill;
-
-public class L2SiegeSummonInstance extends L2ServitorInstance
-{
-	public static final int SIEGE_GOLEM_ID = 14737;
-	public static final int HOG_CANNON_ID = 14768;
-	public static final int SWOOP_CANNON_ID = 14839;
-	
-	public L2SiegeSummonInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2Skill skill)
-	{
-		super(objectId, template, owner, skill);
-		setInstanceType(InstanceType.L2SiegeSummonInstance);
-	}
-}

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

@@ -26,7 +26,6 @@ import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
 import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 
@@ -90,17 +89,7 @@ public class L2SkillSummon extends L2Skill
 			return; // npcID doesn't exist
 		}
 		
-		final int id = IdFactory.getInstance().getNextId();
-		L2ServitorInstance summon;
-		if (summonTemplate.isType("L2SiegeSummon"))
-		{
-			summon = new L2SiegeSummonInstance(id, summonTemplate, activeChar, this);
-		}
-		else
-		{
-			summon = new L2ServitorInstance(id, summonTemplate, activeChar, this);
-		}
-		
+		final L2ServitorInstance summon = new L2ServitorInstance(IdFactory.getInstance().getNextId(), summonTemplate, activeChar, this);
 		summon.setName(summonTemplate.getName());
 		summon.setTitle(activeChar.getName());
 		summon.setExpPenalty(_expPenalty);

+ 0 - 11
L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2SiegeZone.java

@@ -28,7 +28,6 @@ import com.l2jserver.gameserver.instancemanager.ZoneManager;
 import com.l2jserver.gameserver.model.TeleportWhereType;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
 import com.l2jserver.gameserver.model.entity.Fort;
 import com.l2jserver.gameserver.model.entity.FortSiege;
 import com.l2jserver.gameserver.model.entity.Siegable;
@@ -232,11 +231,6 @@ public class L2SiegeZone extends L2ZoneType
 				}
 			}
 		}
-		
-		if (character instanceof L2SiegeSummonInstance)
-		{
-			((L2SiegeSummonInstance) character).unSummon(((L2SiegeSummonInstance) character).getOwner());
-		}
 	}
 	
 	@Override
@@ -299,11 +293,6 @@ public class L2SiegeZone extends L2ZoneType
 						player.exitedNoLanding();
 					}
 				}
-				if (character instanceof L2SiegeSummonInstance)
-				{
-					((L2SiegeSummonInstance) character).unSummon(((L2SiegeSummonInstance) character).getOwner());
-				}
-				
 			}
 		}
 	}