Addition of pet target type.

Contributed by manax182.
This commit is contained in:
MobiusDevelopment
2021-05-21 23:27:14 +00:00
parent 80d9daf414
commit 4da31e6e01
7 changed files with 100 additions and 2 deletions

View File

@@ -263,6 +263,7 @@ import handlers.targethandlers.NpcBody;
import handlers.targethandlers.Others; import handlers.targethandlers.Others;
import handlers.targethandlers.OwnerPet; import handlers.targethandlers.OwnerPet;
import handlers.targethandlers.PcBody; import handlers.targethandlers.PcBody;
import handlers.targethandlers.Pet;
import handlers.targethandlers.Self; import handlers.targethandlers.Self;
import handlers.targethandlers.Summon; import handlers.targethandlers.Summon;
import handlers.targethandlers.Target; import handlers.targethandlers.Target;
@@ -626,6 +627,7 @@ public class MasterHandler
Others.class, Others.class,
OwnerPet.class, OwnerPet.class,
PcBody.class, PcBody.class,
Pet.class,
Self.class, Self.class,
Summon.class, Summon.class,
Target.class, Target.class,

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 handlers.targethandlers;
import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.skills.targets.TargetType;
/**
* @author Manax
*/
public class Pet implements ITargetTypeHandler
{
@Override
public Enum<TargetType> getTargetType()
{
return TargetType.PET;
}
@Override
public WorldObject getTarget(Creature creature, WorldObject selectedTarget, Skill skill, boolean forceUse, boolean dontMove, boolean sendMessage)
{
if (creature.isPet())
{
return creature.getPet();
}
return null;
}
}

View File

@@ -64,4 +64,6 @@ public enum TargetType
MY_PARTY, MY_PARTY,
/** Pet's owner. */ /** Pet's owner. */
OWNER_PET, OWNER_PET,
/** Pet Target */
PET,
} }

View File

@@ -263,6 +263,7 @@ import handlers.targethandlers.NpcBody;
import handlers.targethandlers.Others; import handlers.targethandlers.Others;
import handlers.targethandlers.OwnerPet; import handlers.targethandlers.OwnerPet;
import handlers.targethandlers.PcBody; import handlers.targethandlers.PcBody;
import handlers.targethandlers.Pet;
import handlers.targethandlers.Self; import handlers.targethandlers.Self;
import handlers.targethandlers.Summon; import handlers.targethandlers.Summon;
import handlers.targethandlers.Target; import handlers.targethandlers.Target;
@@ -626,6 +627,7 @@ public class MasterHandler
Others.class, Others.class,
OwnerPet.class, OwnerPet.class,
PcBody.class, PcBody.class,
Pet.class,
Self.class, Self.class,
Summon.class, Summon.class,
Target.class, Target.class,

View File

@@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 handlers.targethandlers;
import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.skills.targets.TargetType;
/**
* @author Manax
*/
public class Pet implements ITargetTypeHandler
{
@Override
public Enum<TargetType> getTargetType()
{
return TargetType.PET;
}
@Override
public WorldObject getTarget(Creature creature, WorldObject selectedTarget, Skill skill, boolean forceUse, boolean dontMove, boolean sendMessage)
{
if (creature.isPet())
{
return creature.getPet();
}
return null;
}
}

View File

@@ -64,4 +64,6 @@ public enum TargetType
MY_PARTY, MY_PARTY,
/** Pet's owner. */ /** Pet's owner. */
OWNER_PET, OWNER_PET,
/** Pet Target */
PET,
} }

View File

@@ -44,8 +44,8 @@ public class RelationChanged implements IClientOutgoingPacket
public static final int RELATION_ENEMY = 0x8000; // true when red icon, doesn't matter with blue public static final int RELATION_ENEMY = 0x8000; // true when red icon, doesn't matter with blue
public static final int RELATION_ALLY_MEMBER = 0x10000; // clan is in alliance public static final int RELATION_ALLY_MEMBER = 0x10000; // clan is in alliance
public static final int RELATION_TERRITORY_WAR = 0x80000; // show Territory War icon public static final int RELATION_TERRITORY_WAR = 0x80000; // show Territory War icon
public static final long RELATION_DECLARED_WAR = 0x40000000L; // single sword 0x4E200000L public static final long RELATION_DECLARED_WAR = 0x40000000L; // single sword
public static final long RELATION_MUTUAL_WAR = 0x4E200000L; // double swords 0x40000000L public static final long RELATION_MUTUAL_WAR = 0x4E200000L; // double swords?
// Masks // Masks
public static final byte SEND_DEFAULT = 0x01; public static final byte SEND_DEFAULT = 0x01;
public static final byte SEND_ONE = 0x02; public static final byte SEND_ONE = 0x02;