Project update.

This commit is contained in:
MobiusDev
2015-12-31 23:53:41 +00:00
parent e0d681a17e
commit ad2bcd79be
4084 changed files with 83696 additions and 86998 deletions

View File

@@ -0,0 +1,36 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
/**
* @author UnAfraid
*/
public class AdditionalItemHolder extends ItemHolder
{
private final boolean _allowed;
public AdditionalItemHolder(int id, boolean allowed)
{
super(id, 0);
_allowed = allowed;
}
public boolean isAllowedToUse()
{
return _allowed;
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
/**
* @author UnAfraid
*/
public class AdditionalSkillHolder extends SkillHolder
{
private final int _minLevel;
public AdditionalSkillHolder(int skillId, int skillLevel, int minLevel)
{
super(skillId, skillLevel);
_minLevel = minLevel;
}
public int getMinLevel()
{
return _minLevel;
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
/**
* @author UnAfraid
*/
public class ArmorsetSkillHolder extends SkillHolder
{
private final int _minimumPieces;
public ArmorsetSkillHolder(int skillId, int skillLvl, int minimumPieces)
{
super(skillId, skillLvl);
_minimumPieces = minimumPieces;
}
public int getMinimumPieces()
{
return _minimumPieces;
}
}

View File

@@ -0,0 +1,46 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.enums.CastleSide;
import com.l2jmobius.gameserver.model.Location;
/**
* @author St3eT
*/
public class CastleSpawnHolder extends Location
{
private final int _npcId;
private final CastleSide _side;
public CastleSpawnHolder(int npcId, CastleSide side, int x, int y, int z, int heading)
{
super(x, y, z, heading);
_npcId = npcId;
_side = side;
}
public final int getNpcId()
{
return _npcId;
}
public final CastleSide getSide()
{
return _side;
}
}

View File

@@ -0,0 +1,91 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import java.util.List;
import java.util.Map;
/**
* @author Mobius
*/
public class DailyMissionHolder
{
private final int _id;
private final int _clientId;
private final String _type;
private final int _level;
private final List<Integer> _classes;
private final Map<Integer, Integer> _rewards;
public DailyMissionHolder(int id, int clientId, String type, int level, List<Integer> classes, Map<Integer, Integer> rewards)
{
_id = id;
_clientId = clientId;
_type = type;
_level = level;
_classes = classes;
_rewards = rewards;
}
/**
* @return the id
*/
public int getId()
{
return _id;
}
/**
* @return the clientId
*/
public int getClientId()
{
return _clientId;
}
/**
* @return the type
*/
public String getType()
{
return _type;
}
/**
* @return the level
*/
public int getLevel()
{
return _level;
}
/**
* @return the classes
*/
public List<Integer> getAvailableClasses()
{
return _classes;
}
/**
* @return the rewards
*/
public Map<Integer, Integer> getRewards()
{
return _rewards;
}
}

View File

@@ -0,0 +1,37 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
/**
* @author UnAfraid
*/
public class DoorRequestHolder
{
private final L2DoorInstance _target;
public DoorRequestHolder(L2DoorInstance door)
{
_target = door;
}
public L2DoorInstance getDoor()
{
return _target;
}
}

View File

@@ -0,0 +1,69 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Effect duration holder.
* @author Zoey76
*/
public class EffectDurationHolder
{
private final int _skillId;
private final int _skillLvl;
private final int _duration;
/**
* Effect duration holder constructor.
* @param skill the skill to get the data
* @param duration the effect duration
*/
public EffectDurationHolder(Skill skill, int duration)
{
_skillId = skill.getDisplayId();
_skillLvl = skill.getDisplayLevel();
_duration = duration;
}
/**
* Get the effect's skill Id.
* @return the skill Id
*/
public int getSkillId()
{
return _skillId;
}
/**
* Get the effect's skill level.
* @return the skill level
*/
public int getSkillLvl()
{
return _skillLvl;
}
/**
* Get the effect's duration.
* @return the duration in <b>seconds</b>
*/
public int getDuration()
{
return _duration;
}
}

View File

@@ -0,0 +1,67 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import java.time.DayOfWeek;
/**
* Simple class for storing Reenter Data for Instances.
* @author FallenAngel
*/
public final class InstanceReenterTimeHolder
{
private final DayOfWeek _day;
private final int _hour;
private final int _minute;
private final long _time;
public InstanceReenterTimeHolder(long time)
{
_time = time;
_day = null;
_hour = -1;
_minute = -1;
}
public InstanceReenterTimeHolder(DayOfWeek day, int hour, int minute)
{
_time = -1;
_day = day;
_hour = hour;
_minute = minute;
}
public final Long getTime()
{
return _time;
}
public final DayOfWeek getDay()
{
return _day;
}
public final int getHour()
{
return _hour;
}
public final int getMinute()
{
return _minute;
}
}

View File

@@ -0,0 +1,52 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author UnAfraid
*/
public class InvulSkillHolder extends SkillHolder
{
private final AtomicInteger _instances = new AtomicInteger(1);
public InvulSkillHolder(int skillId, int skillLevel)
{
super(skillId, skillLevel);
}
public InvulSkillHolder(SkillHolder holder)
{
super(holder.getSkill());
}
public int getInstances()
{
return _instances.get();
}
public int increaseInstances()
{
return _instances.incrementAndGet();
}
public int decreaseInstances()
{
return _instances.decrementAndGet();
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link QuestItemHolder}.
* @author xban1x
*/
public class ItemChanceHolder extends ItemHolder
{
private final double _chance;
public ItemChanceHolder(int id, double chance)
{
this(id, chance, 1);
}
public ItemChanceHolder(int id, double chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public double getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/**
* A simple DTO for items; contains item ID and count.<br>
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
* @author UnAfraid
*/
public class ItemHolder implements IIdentifiable
{
private final int _id;
private final long _count;
public ItemHolder(int id, long count)
{
_id = id;
_count = count;
}
/**
* @return the ID of the item contained in this object
*/
@Override
public int getId()
{
return _id;
}
/**
* @return the count of items contained in this object
*/
public long getCount()
{
return _count;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + _id + ", count: " + _count;
}
}

View File

@@ -0,0 +1,79 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
/**
* This class hold info needed for minions spawns<br>
* @author Zealar
*/
public class MinionHolder implements IIdentifiable
{
private final int _id;
private final int _count;
private final long _respawnTime;
private final int _weightPoint;
/**
* Constructs a minion holder.
* @param id the id
* @param count the count
* @param respawnTime the respawn time
* @param weightPoint the weight point
*/
public MinionHolder(final int id, final int count, final long respawnTime, final int weightPoint)
{
_id = id;
_count = count;
_respawnTime = respawnTime;
_weightPoint = weightPoint;
}
/**
* @return the Identifier of the Minion to spawn.
*/
@Override
public int getId()
{
return _id;
}
/**
* @return the count of the Minions to spawn.
*/
public int getCount()
{
return _count;
}
/**
* @return the respawn time of the Minions.
*/
public long getRespawnTime()
{
return _respawnTime;
}
/**
* @return the weight point of the Minion.
*/
public int getWeightPoint()
{
return _weightPoint;
}
}

View File

@@ -0,0 +1,58 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.network.NpcStringId;
/**
* @author Sdw
*/
public class NpcLogListHolder
{
private final int _id;
private final boolean _isNpcString;
private final int _count;
public NpcLogListHolder(NpcStringId npcStringId, int count)
{
_id = npcStringId.getId();
_isNpcString = true;
_count = count;
}
public NpcLogListHolder(int id, boolean isNpcString, int count)
{
_id = id;
_isNpcString = isNpcString;
_count = count;
}
public int getId()
{
return _id;
}
public boolean isNpcString()
{
return _isNpcString;
}
public int getCount()
{
return _count;
}
}

View File

@@ -0,0 +1,71 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.interfaces.ILocational;
/**
* Holds depending between NPC's spawn point and route
* @author GKR
*/
public final class NpcRoutesHolder
{
private final Map<String, String> _correspondences;
public NpcRoutesHolder()
{
_correspondences = new HashMap<>();
}
/**
* Add correspondence between specific route and specific spawn point
* @param routeName name of route
* @param loc Location of spawn point
*/
public void addRoute(String routeName, Location loc)
{
_correspondences.put(getUniqueKey(loc), routeName);
}
/**
* @param npc
* @return route name for given NPC.
*/
public String getRouteName(L2Npc npc)
{
if (npc.getSpawn() != null)
{
final String key = getUniqueKey(npc.getSpawn().getLocation());
return _correspondences.containsKey(key) ? _correspondences.get(key) : "";
}
return "";
}
/**
* @param loc
* @return unique text string for given Location.
*/
private String getUniqueKey(ILocational loc)
{
return (loc.getX() + "-" + loc.getY() + "-" + loc.getZ());
}
}

View File

@@ -0,0 +1,37 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author UnAfraid
*/
public class PetItemHolder
{
private final L2ItemInstance _item;
public PetItemHolder(L2ItemInstance item)
{
_item = item;
}
public L2ItemInstance getItem()
{
return _item;
}
}

View File

@@ -0,0 +1,98 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* Player event holder, meant for restoring player after event has finished.<br>
* Allows you to restore following information about player:
* <ul>
* <li>Name</li>
* <li>Title</li>
* <li>Clan</li>
* <li>Location</li>
* <li>PvP Kills</li>
* <li>PK Kills</li>
* <li>Karma</li>
* </ul>
* @author Nik, xban1x
*/
public final class PlayerEventHolder
{
private final L2PcInstance _player;
private final String _name;
private final String _title;
private final int _clanId;
private final Location _loc;
private final int _pvpKills;
private final int _pkKills;
private final int _reputation;
private final List<L2PcInstance> _kills = new CopyOnWriteArrayList<>();
private boolean _sitForced;
public PlayerEventHolder(L2PcInstance player)
{
this(player, false);
}
public PlayerEventHolder(L2PcInstance player, boolean sitForced)
{
_player = player;
_name = player.getName();
_title = player.getTitle();
_clanId = player.getClanId();
_loc = new Location(player);
_pvpKills = player.getPvpKills();
_pkKills = player.getPkKills();
_reputation = player.getReputation();
_sitForced = sitForced;
}
public void restorePlayerStats()
{
_player.setName(_name);
_player.setTitle(_title);
_player.setClan(ClanTable.getInstance().getClan(_clanId));
_player.teleToLocation(_loc, true);
_player.setPvpKills(_pvpKills);
_player.setPkKills(_pkKills);
_player.setReputation(_reputation);
}
public void setSitForced(boolean sitForced)
{
_sitForced = sitForced;
}
public boolean isSitForced()
{
return _sitForced;
}
public List<L2PcInstance> getKills()
{
return _kills;
}
}

View File

@@ -0,0 +1,86 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.interfaces.ISkillsHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class PlayerSkillHolder implements ISkillsHolder
{
private final Map<Integer, Skill> _skills = new HashMap<>();
public PlayerSkillHolder(L2PcInstance player)
{
for (Skill skill : player.getSkills().values())
{
// Adding only skills that can be learned by the player.
if (SkillTreesData.getInstance().isSkillAllowed(player, skill))
{
addSkill(skill);
}
}
}
/**
* @return the map containing this character skills.
*/
@Override
public Map<Integer, Skill> getSkills()
{
return _skills;
}
/**
* Add a skill to the skills map.<br>
* @param skill
*/
@Override
public Skill addSkill(Skill skill)
{
return _skills.put(skill.getId(), skill);
}
/**
* Return the level of a skill owned by the L2Character.
* @param skillId The identifier of the L2Skill whose level must be returned
* @return The level of the L2Skill identified by skillId
*/
@Override
public int getSkillLevel(int skillId)
{
final Skill skill = getKnownSkill(skillId);
return (skill == null) ? -1 : skill.getLevel();
}
/**
* @param skillId The identifier of the L2Skill to check the knowledge
* @return the skill from the known skill.
*/
@Override
public Skill getKnownSkill(int skillId)
{
return _skills.get(skillId);
}
}

View File

@@ -0,0 +1,87 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
/**
* @author UnAfraid
*/
public final class PunishmentHolder
{
private final Map<String, Map<PunishmentType, PunishmentTask>> _holder = new ConcurrentHashMap<>();
/**
* Stores the punishment task in the Map.
* @param task
*/
public void addPunishment(PunishmentTask task)
{
if (!task.isExpired())
{
final String key = String.valueOf(task.getKey());
_holder.computeIfAbsent(key, k -> new ConcurrentHashMap<>()).put(task.getType(), task);
}
}
/**
* Removes previously stopped task from the Map.
* @param task
*/
public void stopPunishment(PunishmentTask task)
{
final String key = String.valueOf(task.getKey());
if (_holder.containsKey(key))
{
task.stopPunishment();
final Map<PunishmentType, PunishmentTask> punishments = _holder.get(key);
punishments.remove(task.getType());
if (punishments.isEmpty())
{
_holder.remove(key);
}
}
}
/**
* @param key
* @param type
* @return {@code true} if Map contains the current key and type, {@code false} otherwise.
*/
public boolean hasPunishment(String key, PunishmentType type)
{
return getPunishment(key, type) != null;
}
/**
* @param key
* @param type
* @return {@link PunishmentTask} by specified key and type if exists, null otherwise.
*/
public PunishmentTask getPunishment(String key, PunishmentType type)
{
if (_holder.containsKey(key))
{
return _holder.get(key).get(type);
}
return null;
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
/**
* A DTO for items; contains item ID, count and chance.<br>
* Complemented by {@link ItemChanceHolder}.
* @author xban1x
*/
public class QuestItemHolder extends ItemHolder
{
private final int _chance;
public QuestItemHolder(int id, int chance)
{
this(id, chance, 1);
}
public QuestItemHolder(int id, int chance, long count)
{
super(id, count);
_chance = chance;
}
/**
* Gets the chance.
* @return the drop chance of the item contained in this object
*/
public int getChance()
{
return _chance;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", count: " + getCount() + ", chance: " + _chance;
}
}

View File

@@ -0,0 +1,58 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
/**
* @author UnAfraid
*/
public class RangeAbilityPointsHolder
{
private final int _min;
private final int _max;
private final long _sp;
public RangeAbilityPointsHolder(int min, int max, long sp)
{
_min = min;
_max = max;
_sp = sp;
}
/**
* @return minimum value.
*/
public int getMin()
{
return _min;
}
/**
* @return maximum value.
*/
public int getMax()
{
return _max;
}
/**
* @return the SP.
*/
public long getSP()
{
return _sp;
}
}

View File

@@ -0,0 +1,58 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
/**
* @author UnAfraid
*/
public class RangeChanceHolder
{
private final int _min;
private final int _max;
private final double _chance;
public RangeChanceHolder(int min, int max, double chance)
{
_min = min;
_max = max;
_chance = chance;
}
/**
* @return minimum value.
*/
public int getMin()
{
return _min;
}
/**
* @return maximum value.
*/
public int getMax()
{
return _max;
}
/**
* @return the chance.
*/
public double getChance()
{
return _chance;
}
}

View File

@@ -0,0 +1,63 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Simple class for storing skill id/level.
* @author BiggBoss
*/
public class SkillHolder
{
private final int _skillId;
private final int _skillLvl;
public SkillHolder(int skillId, int skillLvl)
{
_skillId = skillId;
_skillLvl = skillLvl;
}
public SkillHolder(Skill skill)
{
_skillId = skill.getId();
_skillLvl = skill.getLevel();
}
public final int getSkillId()
{
return _skillId;
}
public final int getSkillLvl()
{
return _skillLvl;
}
public final Skill getSkill()
{
return SkillData.getInstance().getSkill(_skillId, Math.max(_skillLvl, 1));
}
@Override
public String toString()
{
return "[SkillId: " + _skillId + " Level: " + _skillLvl + "]";
}
}

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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class SkillUseHolder extends SkillHolder
{
private final boolean _ctrlPressed;
private final boolean _shiftPressed;
public SkillUseHolder(Skill skill, boolean ctrlPressed, boolean shiftPressed)
{
super(skill);
_ctrlPressed = ctrlPressed;
_shiftPressed = shiftPressed;
}
public boolean isCtrlPressed()
{
return _ctrlPressed;
}
public boolean isShiftPressed()
{
return _shiftPressed;
}
}

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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class SummonRequestHolder
{
private final L2PcInstance _target;
private final Skill _skill;
public SummonRequestHolder(L2PcInstance destination, Skill skill)
{
_target = destination;
_skill = skill;
}
public L2PcInstance getTarget()
{
return _target;
}
public Skill getSkill()
{
return _skill;
}
}

View File

@@ -0,0 +1,51 @@
/*
* 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 com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.model.interfaces.IUniqueId;
/**
* A DTO for items; contains item ID, object ID and count.
* @author xban1x
*/
public class UniqueItemHolder extends ItemHolder implements IUniqueId
{
private final int _objectId;
public UniqueItemHolder(int id, int objectId)
{
this(id, objectId, 1);
}
public UniqueItemHolder(int id, int objectId, long count)
{
super(id, count);
_objectId = objectId;
}
@Override
public int getObjectId()
{
return _objectId;
}
@Override
public String toString()
{
return "[" + getClass().getSimpleName() + "] ID: " + getId() + ", object ID: " + _objectId + ", count: " + getCount();
}
}