This commit is contained in:
mobius
2015-01-01 20:02:50 +00:00
parent eeae660458
commit a6a3718849
17894 changed files with 2818932 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/*
* 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.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,38 @@
/*
* 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.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,38 @@
/*
* 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.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,39 @@
/*
* 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.holders;
import com.l2jserver.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,71 @@
/*
* 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.holders;
import com.l2jserver.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,54 @@
/*
* 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.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,55 @@
/*
* 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.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,61 @@
/*
* 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.holders;
import com.l2jserver.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,81 @@
/*
* 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.holders;
import com.l2jserver.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,73 @@
/*
* 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.holders;
import java.util.HashMap;
import java.util.Map;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.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)
{
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,39 @@
/*
* 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.holders;
import com.l2jserver.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,102 @@
/*
* 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.holders;
import java.util.List;
import javolution.util.FastList;
import com.l2jserver.gameserver.datatables.ClanTable;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.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 _karma;
private final List<L2PcInstance> _kills;
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();
_karma = player.getKarma();
_kills = new FastList<>();
_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.setKarma(_karma);
}
public void setSitForced(boolean sitForced)
{
_sitForced = sitForced;
}
public boolean isSitForced()
{
return _sitForced;
}
public List<L2PcInstance> getKills()
{
return _kills;
}
}

View File

@ -0,0 +1,88 @@
/*
* 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.holders;
import java.util.HashMap;
import java.util.Map;
import com.l2jserver.gameserver.datatables.SkillTreesData;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.interfaces.ISkillsHolder;
import com.l2jserver.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,93 @@
/*
* 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.holders;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.gameserver.model.punishment.PunishmentTask;
import com.l2jserver.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())
{
String key = String.valueOf(task.getKey());
if (!_holder.containsKey(key))
{
_holder.put(key, new ConcurrentHashMap<PunishmentType, PunishmentTask>());
}
_holder.get(key).put(task.getType(), task);
}
}
/**
* Removes previously stopped task from the Map.
* @param task
*/
public void stopPunishment(PunishmentTask task)
{
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,55 @@
/*
* 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.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,60 @@
/*
* 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.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,60 @@
/*
* 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.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,65 @@
/*
* 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.holders;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.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,47 @@
/*
* 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.holders;
import com.l2jserver.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,47 @@
/*
* 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.holders;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.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,53 @@
/*
* 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.holders;
import com.l2jserver.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();
}
}