Moved spirit exp handler to item handlers.

This commit is contained in:
MobiusDevelopment 2021-01-07 10:53:30 +00:00
parent 75502e661d
commit 83e7fe26c8
31 changed files with 458 additions and 285 deletions

View File

@ -162,7 +162,6 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
EffectHandler.getInstance().registerHandler("Grow", Grow::new);
EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new);

View File

@ -184,6 +184,7 @@ import handlers.communityboard.HomepageBoard;
import handlers.communityboard.MailBoard;
import handlers.communityboard.MemoBoard;
import handlers.communityboard.RegionBoard;
import handlers.itemhandlers.AddSpiritExp;
import handlers.itemhandlers.Appearance;
import handlers.itemhandlers.BeastSoulShot;
import handlers.itemhandlers.BeastSpiritShot;
@ -531,6 +532,7 @@ public class MasterHandler
},
{
// Item Handlers
AddSpiritExp.class,
Appearance.class,
BeastSoulShot.class,
BeastSpiritShot.class,

View File

@ -1,68 +0,0 @@
/*
* 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.effecthandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Mobius
*/
public class GiveSpiritExp extends AbstractEffect
{
private final ElementalType _type;
private final int _amount;
public GiveSpiritExp(StatSet params)
{
_type = params.getEnum("type", ElementalType.class, ElementalType.NONE);
_amount = params.getInt("amount");
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
if (effected == null)
{
return;
}
final PlayerInstance player = effected.getActingPlayer();
if (player == null)
{
return;
}
final ElementalSpirit spirit = player.getElementalSpirit(_type);
if (spirit != null)
{
spirit.addExperience(_amount);
}
}
}

View File

@ -0,0 +1,95 @@
/*
* 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.itemhandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.handler.IItemHandler;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Mobius
*/
public class AddSpiritExp implements IItemHandler
{
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (!playable.isPlayer())
{
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
return false;
}
final PlayerInstance player = playable.getActingPlayer();
ElementalSpirit spirit = null;
switch (item.getId())
{
case 91999:
case 91035:
{
spirit = player.getElementalSpirit(ElementalType.WATER);
break;
}
case 92000:
case 91036:
{
spirit = player.getElementalSpirit(ElementalType.FIRE);
break;
}
case 92001:
case 91037:
{
spirit = player.getElementalSpirit(ElementalType.WIND);
break;
}
case 92002:
case 91038:
{
spirit = player.getElementalSpirit(ElementalType.EARTH);
break;
}
}
if ((spirit != null) && checkConditions(player, spirit))
{
player.destroyItem("AddSpiritExp item", item, 1, player, true);
spirit.addExperience(9300);
return true;
}
return false;
}
private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit)
{
if (player.isInBattle())
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE);
return false;
}
if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel()))
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL);
return false;
}
return true;
}
}

View File

@ -319,26 +319,38 @@
<item id="91035" name="Water Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Water Attribute XP points. -->
<set name="icon" val="icon.elemental_water_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91036" name="Fire Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Fire Attribute. Use it to acquire 9300 Fire Attribute XP points. -->
<set name="icon" val="icon.elemental_fire_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91037" name="Wind Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Wind Attribute XP points. -->
<set name="icon" val="icon.elemental_wind_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91038" name="Earth Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Earth Attribute. Use it to acquire 9300 Earth Attribute XP points. -->
<set name="icon" val="icon.elemental_earth_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91039" name="Water Attribute Fragment" type="EtcItem">
<!-- A material filled with the power of Water Attribute. Can be used to create equipment with the power of Water Attribute. -->

View File

@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius)
GiveXp: Gives a given amount of XP. (l2jmobius)
Grow: Sets NPC collision to its growth collision.
HairAccessorySet: See/Unsee hair accessory.

View File

@ -76,7 +76,6 @@ public class ElementalSpirit
final UserInfo userInfo = new UserInfo(_owner);
userInfo.addComponentType(UserInfoType.ATT_SPIRITS);
_owner.sendPacket(userInfo);
}
_owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience()));
}

View File

@ -162,7 +162,6 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
EffectHandler.getInstance().registerHandler("Grow", Grow::new);
EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new);

View File

@ -185,6 +185,7 @@ import handlers.communityboard.HomepageBoard;
import handlers.communityboard.MailBoard;
import handlers.communityboard.MemoBoard;
import handlers.communityboard.RegionBoard;
import handlers.itemhandlers.AddSpiritExp;
import handlers.itemhandlers.Appearance;
import handlers.itemhandlers.BeastSoulShot;
import handlers.itemhandlers.BeastSpiritShot;
@ -533,6 +534,7 @@ public class MasterHandler
},
{
// Item Handlers
AddSpiritExp.class,
Appearance.class,
BeastSoulShot.class,
BeastSpiritShot.class,

View File

@ -1,68 +0,0 @@
/*
* 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.effecthandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Mobius
*/
public class GiveSpiritExp extends AbstractEffect
{
private final ElementalType _type;
private final int _amount;
public GiveSpiritExp(StatSet params)
{
_type = params.getEnum("type", ElementalType.class, ElementalType.NONE);
_amount = params.getInt("amount");
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
if (effected == null)
{
return;
}
final PlayerInstance player = effected.getActingPlayer();
if (player == null)
{
return;
}
final ElementalSpirit spirit = player.getElementalSpirit(_type);
if (spirit != null)
{
spirit.addExperience(_amount);
}
}
}

View File

@ -0,0 +1,95 @@
/*
* 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.itemhandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.handler.IItemHandler;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Mobius
*/
public class AddSpiritExp implements IItemHandler
{
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (!playable.isPlayer())
{
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
return false;
}
final PlayerInstance player = playable.getActingPlayer();
ElementalSpirit spirit = null;
switch (item.getId())
{
case 91999:
case 91035:
{
spirit = player.getElementalSpirit(ElementalType.WATER);
break;
}
case 92000:
case 91036:
{
spirit = player.getElementalSpirit(ElementalType.FIRE);
break;
}
case 92001:
case 91037:
{
spirit = player.getElementalSpirit(ElementalType.WIND);
break;
}
case 92002:
case 91038:
{
spirit = player.getElementalSpirit(ElementalType.EARTH);
break;
}
}
if ((spirit != null) && checkConditions(player, spirit))
{
player.destroyItem("AddSpiritExp item", item, 1, player, true);
spirit.addExperience(9300);
return true;
}
return false;
}
private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit)
{
if (player.isInBattle())
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE);
return false;
}
if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel()))
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL);
return false;
}
return true;
}
}

View File

@ -319,26 +319,38 @@
<item id="91035" name="Water Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Water Attribute XP points. -->
<set name="icon" val="icon.elemental_water_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91036" name="Fire Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Fire Attribute. Use it to acquire 9300 Fire Attribute XP points. -->
<set name="icon" val="icon.elemental_fire_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91037" name="Wind Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Wind Attribute XP points. -->
<set name="icon" val="icon.elemental_wind_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91038" name="Earth Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Earth Attribute. Use it to acquire 9300 Earth Attribute XP points. -->
<set name="icon" val="icon.elemental_earth_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91039" name="Water Attribute Fragment" type="EtcItem">
<!-- A material filled with the power of Water Attribute. Can be used to create equipment with the power of Water Attribute. -->

View File

@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius)
GiveXp: Gives a given amount of XP. (l2jmobius)
Grow: Sets NPC collision to its growth collision.
HairAccessorySet: See/Unsee hair accessory.

View File

@ -76,7 +76,6 @@ public class ElementalSpirit
final UserInfo userInfo = new UserInfo(_owner);
userInfo.addComponentType(UserInfoType.ATT_SPIRITS);
_owner.sendPacket(userInfo);
}
_owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience()));
}

View File

@ -162,7 +162,6 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
EffectHandler.getInstance().registerHandler("Grow", Grow::new);
EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new);

View File

@ -185,6 +185,7 @@ import handlers.communityboard.HomepageBoard;
import handlers.communityboard.MailBoard;
import handlers.communityboard.MemoBoard;
import handlers.communityboard.RegionBoard;
import handlers.itemhandlers.AddSpiritExp;
import handlers.itemhandlers.Appearance;
import handlers.itemhandlers.BeastSoulShot;
import handlers.itemhandlers.BeastSpiritShot;
@ -533,6 +534,7 @@ public class MasterHandler
},
{
// Item Handlers
AddSpiritExp.class,
Appearance.class,
BeastSoulShot.class,
BeastSpiritShot.class,

View File

@ -1,68 +0,0 @@
/*
* 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.effecthandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Mobius
*/
public class GiveSpiritExp extends AbstractEffect
{
private final ElementalType _type;
private final int _amount;
public GiveSpiritExp(StatSet params)
{
_type = params.getEnum("type", ElementalType.class, ElementalType.NONE);
_amount = params.getInt("amount");
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
if (effected == null)
{
return;
}
final PlayerInstance player = effected.getActingPlayer();
if (player == null)
{
return;
}
final ElementalSpirit spirit = player.getElementalSpirit(_type);
if (spirit != null)
{
spirit.addExperience(_amount);
}
}
}

View File

@ -0,0 +1,95 @@
/*
* 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.itemhandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.handler.IItemHandler;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Mobius
*/
public class AddSpiritExp implements IItemHandler
{
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (!playable.isPlayer())
{
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
return false;
}
final PlayerInstance player = playable.getActingPlayer();
ElementalSpirit spirit = null;
switch (item.getId())
{
case 91999:
case 91035:
{
spirit = player.getElementalSpirit(ElementalType.WATER);
break;
}
case 92000:
case 91036:
{
spirit = player.getElementalSpirit(ElementalType.FIRE);
break;
}
case 92001:
case 91037:
{
spirit = player.getElementalSpirit(ElementalType.WIND);
break;
}
case 92002:
case 91038:
{
spirit = player.getElementalSpirit(ElementalType.EARTH);
break;
}
}
if ((spirit != null) && checkConditions(player, spirit))
{
player.destroyItem("AddSpiritExp item", item, 1, player, true);
spirit.addExperience(9300);
return true;
}
return false;
}
private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit)
{
if (player.isInBattle())
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE);
return false;
}
if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel()))
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL);
return false;
}
return true;
}
}

View File

@ -319,26 +319,38 @@
<item id="91035" name="Water Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Water Attribute XP points. -->
<set name="icon" val="icon.elemental_water_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91036" name="Fire Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Fire Attribute. Use it to acquire 9300 Fire Attribute XP points. -->
<set name="icon" val="icon.elemental_fire_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91037" name="Wind Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Wind Attribute XP points. -->
<set name="icon" val="icon.elemental_wind_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91038" name="Earth Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Earth Attribute. Use it to acquire 9300 Earth Attribute XP points. -->
<set name="icon" val="icon.elemental_earth_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91039" name="Water Attribute Fragment" type="EtcItem">
<!-- A material filled with the power of Water Attribute. Can be used to create equipment with the power of Water Attribute. -->

View File

@ -1323,10 +1323,13 @@
<item id="91999" name="Water Spirit Jewel Shard" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Water Attribute XP points. -->
<set name="icon" val="icon.elemental_water_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
</list>

View File

@ -3,29 +3,38 @@
<item id="92000" name="Fire Spirit Jewel Shard" type="EtcItem">
<!-- Rough Jewel with the power of Fire Attribute. Use it to acquire 9300 Fire Attribute XP points. -->
<set name="icon" val="icon.elemental_fire_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="92001" name="Wind Spirit Ore Fragment" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Wind Attribute XP points. -->
<set name="icon" val="icon.elemental_wind_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="92002" name="Earth Spirit Jewel Shard" type="EtcItem">
<!-- Rough Jewel with the power of Earth Attribute. Use it to acquire 9300 Earth Attribute XP points. -->
<set name="icon" val="icon.elemental_earth_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="92003" name="Special Shots Pack" type="EtcItem">
<!-- Double-click to obtain Sayha's Blessing (Event, required level: 1-75, 10 pcs.), 30 Soulshot Tickets (Event), 500 Spirit Ores. Can be used only once a day per account. -->

View File

@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius)
GiveXp: Gives a given amount of XP. (l2jmobius)
Grow: Sets NPC collision to its growth collision.
HairAccessorySet: See/Unsee hair accessory.

View File

@ -76,7 +76,6 @@ public class ElementalSpirit
final UserInfo userInfo = new UserInfo(_owner);
userInfo.addComponentType(UserInfoType.ATT_SPIRITS);
_owner.sendPacket(userInfo);
}
_owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience()));
}

View File

@ -162,7 +162,6 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
EffectHandler.getInstance().registerHandler("Grow", Grow::new);
EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new);

View File

@ -185,6 +185,7 @@ import handlers.communityboard.HomepageBoard;
import handlers.communityboard.MailBoard;
import handlers.communityboard.MemoBoard;
import handlers.communityboard.RegionBoard;
import handlers.itemhandlers.AddSpiritExp;
import handlers.itemhandlers.Appearance;
import handlers.itemhandlers.BeastSoulShot;
import handlers.itemhandlers.BeastSpiritShot;
@ -534,6 +535,7 @@ public class MasterHandler
},
{
// Item Handlers
AddSpiritExp.class,
Appearance.class,
BeastSoulShot.class,
BeastSpiritShot.class,

View File

@ -1,68 +0,0 @@
/*
* 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.effecthandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Mobius
*/
public class GiveSpiritExp extends AbstractEffect
{
private final ElementalType _type;
private final int _amount;
public GiveSpiritExp(StatSet params)
{
_type = params.getEnum("type", ElementalType.class, ElementalType.NONE);
_amount = params.getInt("amount");
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
if (effected == null)
{
return;
}
final PlayerInstance player = effected.getActingPlayer();
if (player == null)
{
return;
}
final ElementalSpirit spirit = player.getElementalSpirit(_type);
if (spirit != null)
{
spirit.addExperience(_amount);
}
}
}

View File

@ -0,0 +1,95 @@
/*
* 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.itemhandlers;
import org.l2jmobius.gameserver.enums.ElementalType;
import org.l2jmobius.gameserver.handler.IItemHandler;
import org.l2jmobius.gameserver.model.ElementalSpirit;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author Mobius
*/
public class AddSpiritExp implements IItemHandler
{
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (!playable.isPlayer())
{
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
return false;
}
final PlayerInstance player = playable.getActingPlayer();
ElementalSpirit spirit = null;
switch (item.getId())
{
case 91999:
case 91035:
{
spirit = player.getElementalSpirit(ElementalType.WATER);
break;
}
case 92000:
case 91036:
{
spirit = player.getElementalSpirit(ElementalType.FIRE);
break;
}
case 92001:
case 91037:
{
spirit = player.getElementalSpirit(ElementalType.WIND);
break;
}
case 92002:
case 91038:
{
spirit = player.getElementalSpirit(ElementalType.EARTH);
break;
}
}
if ((spirit != null) && checkConditions(player, spirit))
{
player.destroyItem("AddSpiritExp item", item, 1, player, true);
spirit.addExperience(9300);
return true;
}
return false;
}
private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit)
{
if (player.isInBattle())
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE);
return false;
}
if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel()))
{
player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL);
return false;
}
return true;
}
}

View File

@ -319,26 +319,38 @@
<item id="91035" name="Water Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Water Attribute XP points. -->
<set name="icon" val="icon.elemental_water_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91036" name="Fire Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Fire Attribute. Use it to acquire 9300 Fire Attribute XP points. -->
<set name="icon" val="icon.elemental_fire_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91037" name="Wind Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Wind Attribute XP points. -->
<set name="icon" val="icon.elemental_wind_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91038" name="Earth Spirit Rough Jewel" type="EtcItem">
<!-- Rough Jewel with the power of Earth Attribute. Use it to acquire 9300 Earth Attribute XP points. -->
<set name="icon" val="icon.elemental_earth_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="91039" name="Water Attribute Fragment" type="EtcItem">
<!-- A material filled with the power of Water Attribute. Can be used to create equipment with the power of Water Attribute. -->

View File

@ -3,29 +3,38 @@
<item id="92000" name="Fire Spirit Jewel Shard" type="EtcItem">
<!-- Rough Jewel with the power of Fire Attribute. Use it to acquire 9300 Fire Attribute XP points. -->
<set name="icon" val="icon.elemental_fire_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="92001" name="Wind Spirit Ore Fragment" type="EtcItem">
<!-- Rough Jewel with the power of Wind Attribute. Use it to acquire 9300 Wind Attribute XP points. -->
<set name="icon" val="icon.elemental_wind_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="92002" name="Earth Spirit Jewel Shard" type="EtcItem">
<!-- Rough Jewel with the power of Earth Attribute. Use it to acquire 9300 Earth Attribute XP points. -->
<set name="icon" val="icon.elemental_earth_stone_i00" />
<set name="default_action" val="PEEL" />
<set name="immediate_effect" val="true" />
<set name="material" val="STEEL" />
<set name="is_tradable" val="false" />
<set name="is_dropable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<set name="handler" val="AddSpiritExp" />
</item>
<item id="92003" name="Special Shots Pack" type="EtcItem">
<!-- Double-click to obtain Sayha's Blessing (Event, required level: 1-75, 10 pcs.), 30 Soulshot Tickets (Event), 500 Spirit Ores. Can be used only once a day per account. -->

View File

@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius)
GiveXp: Gives a given amount of XP. (l2jmobius)
Grow: Sets NPC collision to its growth collision.
HairAccessorySet: See/Unsee hair accessory.

View File

@ -76,7 +76,6 @@ public class ElementalSpirit
final UserInfo userInfo = new UserInfo(_owner);
userInfo.addComponentType(UserInfoType.ATT_SPIRITS);
_owner.sendPacket(userInfo);
}
_owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience()));
}