Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2jFrozen_GameServer
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Castle.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Castle.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Castle.java (working copy)
- @@ -0,0 +1,30 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Castle extends Condition
- +{
- + public Castle(Object value)
- + {
- + super(value);
- + setName("Have Castle");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.getClan() != null)
- + {
- + if ((player.isCastleLord(5)) || (player.isCastleLord(3)) || (player.isCastleLord(7)))
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Sub.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Sub.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Sub.java (working copy)
- @@ -0,0 +1,30 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Sub extends Condition
- +{
- + public Sub(Object value)
- + {
- + super(value);
- + setName("Subclass Count");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getSubClasses().size() >= val)
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/base/Achievement.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/base/Achievement.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/base/Achievement.java (working copy)
- @@ -0,0 +1,118 @@
- +/*
- + * 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.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base;
- +
- +import java.util.logging.Logger;
- +
- +import javolution.util.FastList;
- +import javolution.util.FastMap;
- +
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Achievement
- +{
- + private static Logger _log = Logger.getLogger(Achievement.class.getName());
- + private final int _id;
- + private final String _name;
- + private final String _reward;
- + private String _description = "No Description!";
- + private final boolean _repeatable;
- +
- + private final FastMap<Integer, Long> _rewardList;
- + private final FastList<Condition> _conditions;
- +
- + public Achievement(int id, String name, String description, String reward, boolean repeatable, FastList<Condition> conditions)
- + {
- + _rewardList = new FastMap<Integer, Long>();
- + _id = id;
- + _name = name;
- + _description = description;
- + _reward = reward;
- + _conditions = conditions;
- + _repeatable = repeatable;
- +
- + createRewardList();
- + }
- +
- + private void createRewardList()
- + {
- + for (String s : _reward.split(";"))
- + {
- + if (s == null || s.isEmpty())
- + continue;
- +
- + String[] split = s.split(",");
- + Integer item = 0;
- + Long count = new Long(0);
- + try
- + {
- + item = Integer.valueOf(split[0]);
- + count = Long.valueOf(split[1]);
- + }
- + catch (NumberFormatException nfe)
- + {
- + _log.warning("AchievementsEngine: Error wrong reward " + nfe);
- + }
- + _rewardList.put(item, count);
- + }
- + }
- +
- + public boolean meetAchievementRequirements(L2PcInstance player)
- + {
- + for (Condition c : getConditions())
- + {
- + if (!c.meetConditionRequirements(player))
- + {
- + return false;
- + }
- + }
- + return true;
- + }
- +
- + public int getID()
- + {
- + return _id;
- + }
- +
- + public String getName()
- + {
- + return _name;
- + }
- +
- + public String getDescription()
- + {
- + return _description;
- + }
- +
- + public String getReward()
- + {
- + return _reward;
- + }
- +
- + public boolean isRepeatable()
- + {
- + return _repeatable;
- + }
- +
- + public FastMap<Integer, Long> getRewardList()
- + {
- + return _rewardList;
- + }
- +
- + public FastList<Condition> getConditions()
- + {
- + return _conditions;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Crp.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Crp.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Crp.java (working copy)
- @@ -0,0 +1,32 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Crp extends Condition
- +{
- + public Crp(Object value)
- + {
- + super(value);
- + setName("Clan Reputation");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.getClan() != null)
- + {
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getClan().getReputationScore() >= val)
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/base/Condition.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/base/Condition.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/base/Condition.java (working copy)
- @@ -0,0 +1,45 @@
- +/*
- + * 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.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base;
- +
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public abstract class Condition
- +{
- + private final Object _value;
- + private String _name;
- +
- + public Condition(Object value)
- + {
- + this._value = value;
- + }
- +
- + public abstract boolean meetConditionRequirements(L2PcInstance paramL2PcInstance);
- +
- + public Object getValue()
- + {
- + return this._value;
- + }
- +
- + public void setName(String s)
- + {
- + this._name = s;
- + }
- +
- + public String getName()
- + {
- + return this._name;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Level.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Level.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Level.java (working copy)
- @@ -0,0 +1,30 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Level extends Condition
- +{
- + public Level(Object value)
- + {
- + super(value);
- + setName("Level");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getLevel() >= val)
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 1004)
- +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -24,6 +24,7 @@
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- +import java.sql.Statement;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Arrays;
- @@ -75,6 +76,7 @@
- import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
- import com.l2jfrozen.gameserver.datatables.sql.SkillTreeTable;
- import com.l2jfrozen.gameserver.datatables.xml.ExperienceData;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.AchievementsManager;
- import com.l2jfrozen.gameserver.geo.GeoData;
- import com.l2jfrozen.gameserver.handler.IItemHandler;
- import com.l2jfrozen.gameserver.handler.ItemHandler;
- @@ -20309,6 +20311,136 @@
- broadcastUserInfo();
- }
- + private final List<Integer> _completedAchievements = new FastList<Integer>();
- +
- + public long getOnlineTime()
- + {
- + return _onlineTime;
- + }
- +
- + public List<Integer> getCompletedAchievements()
- + {
- + return _completedAchievements;
- + }
- +
- + public boolean readyAchievementsList()
- + {
- + if (_completedAchievements.isEmpty())
- + return false;
- + return true;
- + }
- +
- + public void saveAchievemntData()
- + {
- +
- + }
- +
- + @SuppressWarnings("null")
- + public void getAchievemntData()
- + {
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement;
- + PreparedStatement insertStatement;
- + ResultSet rs;
- +
- + statement = con.prepareStatement("SELECT * FROM achievements WHERE owner_id=" + getObjectId());
- +
- + rs = statement.executeQuery();
- +
- + String values = "owner_id";
- + String in = Integer.toString(getObjectId());
- + String questionMarks = in;
- + int ilosc = AchievementsManager.getInstance().getAchievementList().size();
- +
- + if (rs.next())
- + {
- + _completedAchievements.clear();
- + for (int i = 1; i <= ilosc; i++)
- + {
- + int a = rs.getInt("a" + i);
- +
- + if (!_completedAchievements.contains(i))
- + if (a == 1 || String.valueOf(a).startsWith("1"))
- + {
- + _completedAchievements.add(i);
- + }
- + }
- + }
- + else
- + {
- + // Player hasnt entry in database, means we have to create it.
- + for (int i = 1; i <= ilosc; i++)
- + {
- + values += ", a" + i;
- + questionMarks += ", 0";
- + }
- +
- + String s = "INSERT INTO achievements(" + values + ") VALUES (" + questionMarks + ")";
- + insertStatement = con.prepareStatement(s);
- +
- + insertStatement.execute();
- + insertStatement.close();
- + }
- + }
- + catch (SQLException e)
- + {
- + _log.warning(new StringBuilder().append("[ACHIEVEMENTS SAVE GETDATA]").append(e).toString());
- + }
- + finally
- + {
- + try
- + {
- + con.close();
- + }
- + catch (Exception e)
- + {
- + }
- + }
- + }
- +
- + @SuppressWarnings("null")
- + public void saveAchievementData(int achievementID, int objid)
- + {
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + Statement statement = con.createStatement();
- + if (achievementID == 4 || achievementID == 6 || achievementID == 11 || achievementID == 13)
- + {
- + statement.executeUpdate("UPDATE achievements SET a" + achievementID + "=1" + objid + " WHERE owner_id=" + getObjectId());
- + }
- + else
- + {
- + statement.executeUpdate("UPDATE achievements SET a" + achievementID + "=1 WHERE owner_id=" + getObjectId());
- + }
- +
- + statement.close();
- +
- + if (!_completedAchievements.contains(achievementID))
- + {
- + _completedAchievements.add(achievementID);
- + }
- + }
- + catch (SQLException e)
- + {
- + _log.warning(new StringBuilder().append("[ACHIEVEMENTS SAVE GETDATA]").append(e).toString());
- + }
- + finally
- + {
- + try
- + {
- + con.close();
- + }
- + catch (Exception e)
- + {
- + }
- + }
- + }
- +
- public void setHero(boolean hero)
- {
- _hero = hero;
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/RaidPoints.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/RaidPoints.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/RaidPoints.java (working copy)
- @@ -0,0 +1,31 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.managers.RaidBossPointsManager;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class RaidPoints extends Condition
- +{
- + public RaidPoints(Object value)
- + {
- + super(value);
- + setName("Raid Points");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + RaidBossPointsManager.getInstance();
- + if (RaidBossPointsManager.getPointsByOwnerId(player.getObjectId()) >= val)
- + {
- + return true;
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Marry.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Marry.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Marry.java (working copy)
- @@ -0,0 +1,28 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Marry extends Condition
- +{
- + public Marry(Object value)
- + {
- + super(value);
- + setName("Married");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.isMarried())
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Pvp.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Pvp.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Pvp.java (working copy)
- @@ -0,0 +1,30 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Pvp extends Condition
- +{
- + public Pvp(Object value)
- + {
- + super(value);
- + setName("PvP Count");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getPvpKills() >= val)
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Adena.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Adena.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Adena.java (working copy)
- @@ -0,0 +1,31 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Adena extends Condition
- +{
- + public Adena(Object value)
- + {
- + super(value);
- + setName("Adena");
- + }
- +
- +@Override
- +public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + long val = Integer.parseInt(getValue().toString());
- +
- + if (player.getInventory().getAdena() >= val)
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/GameServer.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 1004)
- +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy)
- @@ -75,6 +75,7 @@
- import com.l2jfrozen.gameserver.datatables.xml.AugmentationData;
- import com.l2jfrozen.gameserver.datatables.xml.ExperienceData;
- import com.l2jfrozen.gameserver.datatables.xml.ZoneData;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.AchievementsManager;
- import com.l2jfrozen.gameserver.geo.GeoData;
- import com.l2jfrozen.gameserver.geo.geoeditorcon.GeoEditorListener;
- import com.l2jfrozen.gameserver.geo.pathfinding.PathFinding;
- @@ -227,6 +228,12 @@
- Util.printSection("World");
- L2World.getInstance();
- +
- + if (Config.ENABLE_EVENT_ACHIEVEMENT)
- + {
- + AchievementsManager.getInstance();
- + }
- +
- MapRegionTable.getInstance();
- Announcements.getInstance();
- AutoAnnouncementHandler.getInstance();
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Pk.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Pk.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Pk.java (working copy)
- @@ -0,0 +1,30 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Pk extends Condition
- +{
- + public Pk(Object value)
- + {
- + super(value);
- + setName("PK Count");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getPkKills() >= val)
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/AchievementsManager.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/AchievementsManager.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/AchievementsManager.java (working copy)
- @@ -0,0 +1,432 @@
- +/*
- + * 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.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine;
- +
- +import java.io.File;
- +import java.io.FileInputStream;
- +import java.io.InputStreamReader;
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.SQLException;
- +import java.sql.Statement;
- +import java.util.Map;
- +import java.util.logging.Logger;
- +
- +import javax.xml.parsers.DocumentBuilderFactory;
- +
- +import javolution.util.FastList;
- +import javolution.util.FastMap;
- +
- +import org.w3c.dom.Document;
- +import org.w3c.dom.NamedNodeMap;
- +import org.w3c.dom.Node;
- +import org.xml.sax.InputSource;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Achievement;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Adena;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Castle;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.ClanLeader;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.ClanLevel;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.CompleteAchievements;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Crp;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Hero;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.HeroCount;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.ItemsCount;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Karma;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Level;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Mage;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Marry;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.MinCMcount;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Noble;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.OnlineTime;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Pk;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Pvp;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.RaidKill;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.RaidPoints;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.SkillEnchant;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.Sub;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.WeaponEnchant;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.eventKills;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.eventWins;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions.events;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.util.database.L2DatabaseFactory;
- +
- +public class AchievementsManager
- +{
- + @SuppressWarnings(
- + {
- + "rawtypes",
- + "unchecked"
- + })
- + private final Map<Integer, Achievement> _achievementList = new FastMap();
- +
- + @SuppressWarnings(
- + {
- + "unchecked",
- + "rawtypes"
- + })
- + private final FastList<String> _binded = new FastList();
- +
- + private static Logger _log = Logger.getLogger(AchievementsManager.class.getName());
- +
- + public AchievementsManager()
- + {
- + loadAchievements();
- + }
- +
- + private void loadAchievements()
- + {
- + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- + factory.setValidating(false);
- + factory.setIgnoringComments(true);
- +
- + File file = new File(Config.DATAPACK_ROOT, "data/achievements.xml");
- +
- + if (!file.exists())
- + {
- + _log.warning("AchievementsEngine: Error achievements xml file does not exist, check directory!");
- + }
- + try
- + {
- + InputSource in = new InputSource(new InputStreamReader(new FileInputStream(file), "UTF-8"));
- + in.setEncoding("UTF-8");
- + Document doc = factory.newDocumentBuilder().parse(in);
- +
- + for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
- + {
- + if (n.getNodeName().equalsIgnoreCase("list"))
- + {
- + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
- + {
- + if (d.getNodeName().equalsIgnoreCase("achievement"))
- + {
- + int id = checkInt(d, "id");
- +
- + String name = String.valueOf(d.getAttributes().getNamedItem("name").getNodeValue());
- + String description = String.valueOf(d.getAttributes().getNamedItem("description").getNodeValue());
- + String reward = String.valueOf(d.getAttributes().getNamedItem("reward").getNodeValue());
- + boolean repeat = checkBoolean(d, "repeatable");
- +
- + FastList<Condition> conditions = conditionList(d.getAttributes());
- +
- + this._achievementList.put(Integer.valueOf(id), new Achievement(id, name, description, reward, repeat, conditions));
- + alterTable(id);
- + }
- + }
- + }
- + }
- +
- + _log.info("AchievementsEngine: loaded " + getAchievementList().size() + " achievements from xml!");
- + }
- + catch (Exception e)
- + {
- + _log.warning("AchievementsEngine: Error " + e);
- + e.printStackTrace();
- + }
- + }
- +
- + public void rewardForAchievement(int achievementID, L2PcInstance player)
- + {
- + Achievement achievement = this._achievementList.get(Integer.valueOf(achievementID));
- +
- + for (Integer integer : achievement.getRewardList().keySet())
- + {
- + int id = integer.intValue();
- +
- + int count = achievement.getRewardList().get(Integer.valueOf(id)).intValue();
- + player.addItem(achievement.getName(), id, count, player, true);
- + }
- + }
- +
- + private static boolean checkBoolean(Node d, String nodename)
- + {
- + boolean b = false;
- + try
- + {
- + b = Boolean.valueOf(d.getAttributes().getNamedItem(nodename).getNodeValue()).booleanValue();
- + }
- + catch (Exception e)
- + {
- + }
- +
- + return b;
- + }
- +
- + private int checkInt(Node d, String nodename)
- + {
- + int i = 0;
- + try
- + {
- + i = Integer.valueOf(d.getAttributes().getNamedItem(nodename).getNodeValue()).intValue();
- + }
- + catch (Exception e)
- + {
- + }
- +
- + return i;
- + }
- +
- + @SuppressWarnings("null")
- + private static void alterTable(int fieldID)
- + {
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + Statement statement = con.createStatement();
- + statement.executeUpdate("ALTER TABLE achievements ADD a" + fieldID + " INT DEFAULT 0");
- + statement.close();
- + }
- + catch (SQLException e)
- + {
- + }
- + finally
- + {
- + try
- + {
- + con.close();
- + }
- + catch (Exception e)
- + {
- + }
- + }
- + }
- +
- + @SuppressWarnings("unchecked")
- + public FastList<Condition> conditionList(NamedNodeMap attributesList)
- + {
- + @SuppressWarnings("rawtypes")
- + FastList conditions = new FastList();
- +
- + for (int j = 0; j < attributesList.getLength(); j++)
- + {
- + addToConditionList(attributesList.item(j).getNodeName(), attributesList.item(j).getNodeValue(), conditions);
- + }
- +
- + return conditions;
- + }
- +
- + public Map<Integer, Achievement> getAchievementList()
- + {
- + return this._achievementList;
- + }
- +
- + public FastList<String> getBinded()
- + {
- + return this._binded;
- + }
- +
- + public boolean isBinded(int obj, int ach)
- + {
- + for (String binds : this._binded)
- + {
- + String[] spl = binds.split("@");
- + if ((spl[0].equals(String.valueOf(obj))) && (spl[1].equals(String.valueOf(ach))))
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- +
- + public static AchievementsManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static void addToConditionList(String nodeName, Object value, FastList<Condition> conditions)
- + {
- + if (nodeName.equals("minLevel"))
- + {
- + conditions.add(new Level(value));
- + }
- + else if (nodeName.equals("minPvPCount"))
- + {
- + conditions.add(new Pvp(value));
- + }
- + else if (nodeName.equals("minPkCount"))
- + {
- + conditions.add(new Pk(value));
- + }
- + else if (nodeName.equals("minClanLevel"))
- + {
- + conditions.add(new ClanLevel(value));
- + }
- + else if (nodeName.equals("mustBeHero"))
- + {
- + conditions.add(new Hero(value));
- + }
- + else if (nodeName.equals("mustBeNoble"))
- + {
- + conditions.add(new Noble(value));
- + }
- + else if (nodeName.equals("minWeaponEnchant"))
- + {
- + conditions.add(new WeaponEnchant(value));
- + }
- + else if (nodeName.equals("minKarmaCount"))
- + {
- + conditions.add(new Karma(value));
- + }
- + else if (nodeName.equals("minAdenaCount"))
- + {
- + conditions.add(new Adena(value));
- + }
- + else if (nodeName.equals("minClanMembersCount"))
- + {
- + conditions.add(new MinCMcount(value));
- + }
- + else if (nodeName.equals("mustBeClanLeader"))
- + {
- + conditions.add(new ClanLeader(value));
- + }
- + else if (nodeName.equals("mustBeMarried"))
- + {
- + conditions.add(new Marry(value));
- + }
- + else if (nodeName.equals("itemAmmount"))
- + {
- + conditions.add(new ItemsCount(value));
- + }
- + else if (nodeName.equals("crpAmmount"))
- + {
- + conditions.add(new Crp(value));
- + }
- + else if (nodeName.equals("lordOfCastle"))
- + {
- + conditions.add(new Castle(value));
- + }
- + else if (nodeName.equals("mustBeMageClass"))
- + {
- + conditions.add(new Mage(value));
- + }
- + else if (nodeName.equals("minSubclassCount"))
- + {
- + conditions.add(new Sub(value));
- + }
- + else if (nodeName.equals("CompleteAchievements"))
- + {
- + conditions.add(new CompleteAchievements(value));
- + }
- + else if (nodeName.equals("minSkillEnchant"))
- + {
- + conditions.add(new SkillEnchant(value));
- + }
- + else if (nodeName.equals("minOnlineTime"))
- + {
- + conditions.add(new OnlineTime(value));
- + }
- + else if (nodeName.equals("minHeroCount"))
- + {
- + conditions.add(new HeroCount(value));
- + }
- + else if (nodeName.equals("raidToKill"))
- + {
- + conditions.add(new RaidKill(value));
- + }
- + else if (nodeName.equals("raidToKill1"))
- + {
- + conditions.add(new RaidKill(value));
- + }
- + else if (nodeName.equals("raidToKill2"))
- + {
- + conditions.add(new RaidKill(value));
- + }
- + else if (nodeName.equals("minRaidPoints"))
- + {
- + conditions.add(new RaidPoints(value));
- + }
- + else if (nodeName.equals("eventKills"))
- + {
- + conditions.add(new eventKills(value));
- + }
- + else if (nodeName.equals("events"))
- + {
- + conditions.add(new events(value));
- + }
- + else if (nodeName.equals("eventWins"))
- + {
- + conditions.add(new eventWins(value));
- + }
- + }
- +
- + @SuppressWarnings("null")
- + public void loadUsed()
- + {
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + String sql = "SELECT ";
- + for (int i = 1; i <= getAchievementList().size(); i++)
- + {
- + if (i != getAchievementList().size())
- + {
- + sql = sql + "a" + i + ",";
- + }
- + else
- + {
- + sql = sql + "a" + i;
- + }
- +
- + }
- +
- + sql = sql + " FROM achievements";
- + PreparedStatement statement = con.prepareStatement(sql);
- +
- + ResultSet rs = statement.executeQuery();
- + while (rs.next())
- + {
- + for (int i = 1; i <= getAchievementList().size(); i++)
- + {
- + String ct = rs.getString(i);
- + if ((ct.length() > 1) && (ct.startsWith("1")))
- + {
- + this._binded.add(ct.substring(ct.indexOf("1") + 1) + "@" + i);
- + }
- + }
- + }
- + statement.close();
- + rs.close();
- + }
- + catch (SQLException e)
- + {
- + _log.warning("[ACHIEVEMENTS SAVE GETDATA]");
- + if (Config.DEVELOPER)
- + {
- + e.printStackTrace();
- + }
- + }
- + finally
- + {
- + try
- + {
- + con.close();
- + }
- + catch (Exception e)
- + {
- + }
- + }
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final AchievementsManager _instance = new AchievementsManager();
- + }
- +}
- \ No newline at end of file
- Index: config/functions/l2jfrozen.properties
- ===================================================================
- --- config/functions/l2jfrozen.properties (revision 1004)
- +++ config/functions/l2jfrozen.properties (working copy)
- @@ -280,4 +280,14 @@
- ProtectorSkillLevel = 13
- ProtectorSkillTime = 600
- # Npc Protector Message
- -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
- \ No newline at end of file
- +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
- +
- +# --------------------------------------------------
- +# Achievements Event
- +# --------------------------------------------------
- +# Enable this event
- +# Default: False
- +AllowAchievement = True
- +
- +# Next configs in datapack section
- +# --> xml folder
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/eventKills.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/eventKills.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/eventKills.java (working copy)
- @@ -0,0 +1,26 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class eventKills extends Condition
- +{
- + public eventKills(Object value)
- + {
- + super(value);
- + setName("Event Kills");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + @SuppressWarnings("unused")
- + int val = Integer.parseInt(getValue().toString());
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/HeroCount.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/HeroCount.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/HeroCount.java (working copy)
- @@ -0,0 +1,43 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.entity.Hero;
- +import com.l2jfrozen.gameserver.templates.StatsSet;
- +
- +public class HeroCount extends Condition
- +{
- + public HeroCount(Object value)
- + {
- + super(value);
- + setName("Hero Count");
- + }
- +
- + @Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- + for (Integer integer : Hero.getInstance().getHeroes().keySet())
- + {
- + int hero = integer.intValue();
- +
- + if (hero == player.getObjectId())
- + {
- + StatsSet sts = Hero.getInstance().getHeroes().get(Integer.valueOf(hero));
- + if (sts.getString("char_name").equals(player.getName()))
- + {
- + if (sts.getInteger(Hero.COUNT) >= val)
- + {
- + return true;
- + }
- + }
- + }
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/Config.java
- ===================================================================
- --- head-src/com/l2jfrozen/Config.java (revision 1004)
- +++ head-src/com/l2jfrozen/Config.java (working copy)
- @@ -2398,7 +2398,7 @@
- public static String FARM2_CUSTOM_MESSAGE;
- public static String PVP1_CUSTOM_MESSAGE;
- public static String PVP2_CUSTOM_MESSAGE;
- -
- + public static boolean ENABLE_EVENT_ACHIEVEMENT;
- //============================================================
- public static void loadL2JFrozenConfig()
- {
- @@ -2517,6 +2517,8 @@
- FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
- PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
- PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
- + // Achievment configurations
- + ENABLE_EVENT_ACHIEVEMENT = Boolean.parseBoolean(L2JFrozenSettings.getProperty("AllowAchievement", "False"));
- }
- catch(Exception e)
- {
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Noble.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Noble.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Noble.java (working copy)
- @@ -0,0 +1,28 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Noble extends Condition
- +{
- + public Noble(Object value)
- + {
- + super(value);
- + setName("Noble");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.isNoble())
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/events.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/events.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/events.java (working copy)
- @@ -0,0 +1,26 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class events extends Condition
- +{
- + public events(Object value)
- + {
- + super(value);
- + setName("Events played");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + @SuppressWarnings("unused")
- + int val = Integer.parseInt(getValue().toString());
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/RaidKill.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/RaidKill.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/RaidKill.java (working copy)
- @@ -0,0 +1,39 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import java.util.Map;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.managers.RaidBossPointsManager;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class RaidKill extends Condition
- +{
- + public RaidKill(Object value)
- + {
- + super(value);
- + setName("Raid Kill");
- + }
- +
- + @Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + return false;
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + Map<Integer, Integer> list = RaidBossPointsManager.getList(player);
- + if (list != null)
- + {
- + for (int bid : list.keySet())
- + {
- + if (bid == val)
- + {
- + if (RaidBossPointsManager.getList(player).get(bid) > 0)
- + return true;
- + }
- + }
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/CompleteAchievements.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/CompleteAchievements.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/CompleteAchievements.java (working copy)
- @@ -0,0 +1,30 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class CompleteAchievements extends Condition
- +{
- + public CompleteAchievements(Object value)
- + {
- + super(value);
- + setName("Complete Achievements");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getCompletedAchievements().size() >= val)
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/SkillEnchant.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/SkillEnchant.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/SkillEnchant.java (working copy)
- @@ -0,0 +1,39 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.L2Skill;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class SkillEnchant extends Condition
- +{
- + public SkillEnchant(Object value)
- + {
- + super(value);
- + setName("Skill Enchant");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + for (L2Skill s : player.getAllSkills())
- + {
- + String lvl = String.valueOf(s.getLevel());
- + if (lvl.length() > 2)
- + {
- + int sklvl = Integer.parseInt(lvl.substring(1));
- + if (sklvl >= val)
- + {
- + return true;
- + }
- + }
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/OnlineTime.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/OnlineTime.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/OnlineTime.java (working copy)
- @@ -0,0 +1,29 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class OnlineTime extends Condition
- +{
- + public OnlineTime(Object value)
- + {
- + super(value);
- + setName("Online Time");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getOnlineTime() >= val * 24 * 60 * 60 * 1000)
- + {
- + return true;
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ClanLeader.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ClanLeader.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ClanLeader.java (working copy)
- @@ -0,0 +1,31 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class ClanLeader extends Condition
- +{
- + public ClanLeader(Object value)
- + {
- + super(value);
- + setName("Be Clan Leader");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.getClan() != null)
- + {
- + if (player.isClanLeader())
- + {
- + return true;
- + }
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Karma.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Karma.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Karma.java (working copy)
- @@ -0,0 +1,30 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Karma extends Condition
- +{
- + public Karma(Object value)
- + {
- + super(value);
- + setName("Karma Count");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getKarma() >= val)
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/WeaponEnchant.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/WeaponEnchant.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/WeaponEnchant.java (working copy)
- @@ -0,0 +1,36 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.Inventory;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class WeaponEnchant extends Condition
- +{
- + public WeaponEnchant(Object value)
- + {
- + super(value);
- + setName("Weapon Enchant");
- + }
- + @Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + int val = Integer.parseInt(getValue().toString());
- +
- + L2ItemInstance weapon = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
- +
- + if (weapon != null)
- + {
- + if (weapon.getEnchantLevel() >= val)
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2AchievementsInstance.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2AchievementsInstance.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2AchievementsInstance.java (working copy)
- @@ -0,0 +1,345 @@
- +/*
- + * 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.l2jfrozen.gameserver.model.actor.instance;
- +
- +import java.util.StringTokenizer;
- +
- +import javolution.text.TextBuilder;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.AchievementsManager;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Achievement;
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- +import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
- +
- +public class L2AchievementsInstance extends L2NpcInstance
- +{
- + private boolean first = true;
- +
- + public L2AchievementsInstance(int objectId, L2NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance player, String command)
- + {
- + if (player == null)
- + {
- + return;
- + }
- + if (command.startsWith("showMyAchievements"))
- + {
- + player.getAchievemntData();
- + showMyAchievements(player);
- + }
- + else if (command.startsWith("achievementInfo"))
- + {
- + StringTokenizer st = new StringTokenizer(command, " ");
- + st.nextToken();
- + int id = Integer.parseInt(st.nextToken());
- +
- + showAchievementInfo(id, player);
- + }
- + else if (command.startsWith("topList"))
- + {
- + showTopListWindow(player);
- + }
- + else if (command.startsWith("showMainWindow"))
- + {
- + showChatWindow(player, 0);
- + }
- + else if (command.startsWith("getReward"))
- + {
- + StringTokenizer st = new StringTokenizer(command, " ");
- + st.nextToken();
- + int id = Integer.parseInt(st.nextToken());
- + if (id == 10)
- + {
- + player.destroyItemByItemId("", 8787, 200, this, true);
- + AchievementsManager.getInstance().rewardForAchievement(id, player);
- + }
- + else if ((id == 4) || (id == 19))
- + {
- + L2ItemInstance weapon = player.getInventory().getPaperdollItem(5);
- + if (weapon != null)
- + {
- + int objid = weapon.getObjectId();
- + if (AchievementsManager.getInstance().getAchievementList().get(Integer.valueOf(id)).meetAchievementRequirements(player))
- + {
- + if (!AchievementsManager.getInstance().isBinded(objid, id))
- + {
- + AchievementsManager.getInstance().getBinded().add(objid + "@" + id);
- + player.saveAchievementData(id, objid);
- + AchievementsManager.getInstance().rewardForAchievement(id, player);
- + }
- + else
- + {
- + player.sendMessage("This item was already used to earn this achievement.");
- + }
- + }
- + else
- + {
- + player.sendMessage("Seems you don't meet the achievements requirements now.");
- + }
- + }
- + else
- + {
- + player.sendMessage("You must equip your weapon in order to get rewarded.");
- + }
- + }
- + else if ((id == 6) || (id == 18))
- + {
- + int clid = player.getClan().getClanId();
- +
- + if (!AchievementsManager.getInstance().isBinded(clid, id))
- + {
- + AchievementsManager.getInstance().getBinded().add(clid + "@" + id);
- + player.saveAchievementData(id, clid);
- + AchievementsManager.getInstance().rewardForAchievement(id, player);
- + }
- + else
- + {
- + player.sendMessage("Current clan was already rewarded for this achievement.");
- + }
- + }
- + else
- + {
- + player.saveAchievementData(id, 0);
- + AchievementsManager.getInstance().rewardForAchievement(id, player);
- + }
- + showMyAchievements(player);
- + }
- + else if (command.startsWith("showMyStats"))
- + {
- + showMyStatsWindow(player);
- + }
- + else if (command.startsWith("showHelpWindow"))
- + {
- + showHelpWindow(player);
- + }
- + }
- +
- + @Override
- + public void showChatWindow(L2PcInstance player, int val)
- + {
- + if (this.first)
- + {
- + AchievementsManager.getInstance().loadUsed();
- + this.first = false;
- + }
- + TextBuilder tb = new TextBuilder();
- + tb.append("<html><title>ByCaFi Achievements Manager</title><body><center><br>");
- + tb.append("Hello <font color=\"LEVEL\">" + player.getName() + "</font><br>Are you looking for challenge?");
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1\"><br>");
- + tb.append("<button value=\"My Achievems\" action=\"bypass -h npc_%objectId%_showMyAchievements\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21>");
- + tb.append("<button value=\"Statistics\" action=\"bypass -h npc_%objectId%_showMyStats\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21>");
- + tb.append("<button value=\"Help\" action=\"bypass -h npc_%objectId%_showHelpWindow\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21>");
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());
- + msg.setHtml(tb.toString());
- + msg.replace("%objectId%", String.valueOf(getObjectId()));
- +
- + player.sendPacket(msg);
- + }
- +
- + private void showMyAchievements(L2PcInstance player)
- + {
- + TextBuilder tb = new TextBuilder();
- + tb.append("<html><title>L2DeathForce Achievements Manager</title><body><br>");
- +
- + tb.append("<center><font color=\"LEVEL\">My achievements</font>:</center><br>");
- +
- + if (AchievementsManager.getInstance().getAchievementList().isEmpty())
- + {
- + tb.append("There are no Achievements created yet!");
- + }
- + else
- + {
- + int i = 0;
- +
- + tb.append("<table width=270 border=0 bgcolor=\"33FF33\">");
- + tb.append("<tr><td width=270 align=\"left\">Name:</td><td width=60 align=\"right\">Info:</td><td width=200 align=\"center\">Status:</td></tr></table>");
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1\"><br>");
- +
- + for (Achievement a : AchievementsManager.getInstance().getAchievementList().values())
- + {
- + tb.append(getTableColor(i));
- + tb.append("<tr><td width=270 align=\"left\">" + a.getName() + "</td><td width=50 align=\"right\"><a action=\"bypass -h npc_%objectId%_achievementInfo " + a.getID() + "\">info</a></td><td width=200 align=\"center\">" + getStatusString(a.getID(), player) + "</td></tr></table>");
- + i++;
- + }
- +
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- + tb.append("<center><button value=\"Back\" action=\"bypass -h npc_%objectId%_showMainWindow\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21></center>");
- + }
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());
- + msg.setHtml(tb.toString());
- + msg.replace("%objectId%", String.valueOf(getObjectId()));
- +
- + player.sendPacket(msg);
- + }
- +
- + private void showAchievementInfo(int achievementID, L2PcInstance player)
- + {
- + Achievement a = AchievementsManager.getInstance().getAchievementList().get(Integer.valueOf(achievementID));
- +
- + TextBuilder tb = new TextBuilder();
- + tb.append("<html><title>ByCaFi Achievements Manager</title><body><br>");
- +
- + tb.append("<table width=270 border=0 bgcolor=\"33FF33\">");
- + tb.append("<tr><td width=270 align=\"center\">" + a.getName() + "</td></tr></table><br>");
- + tb.append("<center>Status: " + getStatusString(achievementID, player));
- +
- + if ((a.meetAchievementRequirements(player)) && (!player.getCompletedAchievements().contains(Integer.valueOf(achievementID))))
- + {
- + tb.append("<button value=\"Receive Reward!\" action=\"bypass -h npc_%objectId%_getReward " + a.getID() + "\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21>");
- + }
- +
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- +
- + tb.append("<table width=270 border=0 bgcolor=\"33FF33\">");
- + tb.append("<tr><td width=270 align=\"center\">Description</td></tr></table><br>");
- + tb.append(a.getDescription());
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- +
- + tb.append("<table width=270 border=0 bgcolor=\"33FF33\">");
- + tb.append("<tr><td width=270 align=\"left\">Condition:</td><td width=100 align=\"left\">Value:</td><td width=200 align=\"center\">Status:</td></tr></table>");
- + tb.append(getConditionsStatus(achievementID, player));
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- + tb.append("<center><button value=\"Back\" action=\"bypass -h npc_%objectId%_showMyAchievements\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21></center>");
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());
- + msg.setHtml(tb.toString());
- + msg.replace("%objectId%", String.valueOf(getObjectId()));
- +
- + player.sendPacket(msg);
- + }
- +
- + private void showMyStatsWindow(L2PcInstance player)
- + {
- + TextBuilder tb = new TextBuilder();
- + tb.append("<html><title>ByCaFi Achievements Manager</title><body><center><br>");
- + tb.append("Check your <font color=\"LEVEL\">Achievements </font>statistics:");
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1\"><br>");
- +
- + player.getAchievemntData();
- + int completedCount = player.getCompletedAchievements().size();
- +
- + tb.append("You have completed: " + completedCount + "/<font color=\"LEVEL\">" + AchievementsManager.getInstance().getAchievementList().size() + "</font>");
- +
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- + tb.append("<center><button value=\"Back\" action=\"bypass -h npc_%objectId%_showMainWindow\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21></center>");
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());
- + msg.setHtml(tb.toString());
- + msg.replace("%objectId%", String.valueOf(getObjectId()));
- +
- + player.sendPacket(msg);
- + }
- +
- + private void showTopListWindow(L2PcInstance player)
- + {
- + TextBuilder tb = new TextBuilder();
- + tb.append("<html><title>ByCaFi Achievements Manager</title><body><center><br>");
- + tb.append("Check your <font color=\"LEVEL\">Achievements </font>Top List:");
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1\"><br>");
- +
- + tb.append("Not implemented yet!");
- +
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- + tb.append("<center><button value=\"Back\" action=\"bypass -h npc_%objectId%_showMainWindow\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21></center>");
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());
- + msg.setHtml(tb.toString());
- + msg.replace("%objectId%", String.valueOf(getObjectId()));
- +
- + player.sendPacket(msg);
- + }
- +
- + private void showHelpWindow(L2PcInstance player)
- + {
- + TextBuilder tb = new TextBuilder();
- + tb.append("<html><title>ByCaFi Achievements Manager</title><body><center><br>");
- + tb.append("Achievements <font color=\"LEVEL\">Help </font>page:");
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1\"><br>");
- +
- + tb.append("<table><tr><td>You can check the status of your achievements,</td></tr><tr><td>receive reward if every condition of the achievement is meet,</td></tr><tr><td>if not you can check which condition is still not met, by using info button</td></tr></table>");
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- + tb.append("<table><tr><td><font color=\"FF0000\">Not Completed</font> - you did not meet the achivement requirements.</td></tr>");
- + tb.append("<tr><td><font color=\"LEVEL\">Get Reward</font> - you may receive reward, click info.</td></tr>");
- + tb.append("<tr><td><font color=\"5EA82E\">Completed</font> - achievement completed, reward received.</td></tr></table>");
- +
- + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
- + tb.append("<center><button value=\"Back\" action=\"bypass -h npc_%objectId%_showMainWindow\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" width=95 height=21></center>");
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());
- + msg.setHtml(tb.toString());
- + msg.replace("%objectId%", String.valueOf(getObjectId()));
- +
- + player.sendPacket(msg);
- + }
- +
- + private String getStatusString(int achievementID, L2PcInstance player)
- + {
- + if (player.getCompletedAchievements().contains(Integer.valueOf(achievementID)))
- + {
- + return "<font color=\"5EA82E\">Completed</font>";
- + }
- +
- + if (AchievementsManager.getInstance().getAchievementList().get(Integer.valueOf(achievementID)).meetAchievementRequirements(player))
- + {
- + return "<font color=\"LEVEL\">Get Reward</font>";
- + }
- +
- + return "<font color=\"FF0000\">Not Completed</font>";
- + }
- +
- + private String getTableColor(int i)
- + {
- + if ((i % 2) == 0)
- + {
- + return "<table width=270 border=0 bgcolor=\"444444\">";
- + }
- +
- + return "<table width=270 border=0>";
- + }
- +
- + private String getConditionsStatus(int achievementID, L2PcInstance player)
- + {
- + int i = 0;
- + String s = "</center>";
- + Achievement a = AchievementsManager.getInstance().getAchievementList().get(Integer.valueOf(achievementID));
- + String completed = "<font color=\"5EA82E\">Completed</font></td></tr></table>";
- + String notcompleted = "<font color=\"FF0000\">Not Completed</font></td></tr></table>";
- +
- + for (Condition c : a.getConditions())
- + {
- + s = s + getTableColor(i);
- + s = s + "<tr><td width=270 align=\"left\">" + c.getName() + "</td><td width=100 align=\"left\">" + c.getValue() + "</td><td width=200 align=\"center\">";
- + i++;
- +
- + if (c.meetConditionRequirements(player))
- + {
- + s = s + completed;
- + }
- + else
- + {
- + s = s + notcompleted;
- + }
- + }
- + return s;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Hero.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Hero.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Hero.java (working copy)
- @@ -0,0 +1,28 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Hero extends Condition
- +{
- + public Hero(Object value)
- + {
- + super(value);
- + setName("Hero");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.isHero())
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/managers/RaidBossPointsManager.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/managers/RaidBossPointsManager.java (revision 1004)
- +++ head-src/com/l2jfrozen/gameserver/managers/RaidBossPointsManager.java (working copy)
- @@ -262,4 +262,14 @@
- return tmpRanking;
- }
- +
- + public static final RaidBossPointsManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final RaidBossPointsManager _instance = new RaidBossPointsManager();
- + }
- }
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/MinCMcount.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/MinCMcount.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/MinCMcount.java (working copy)
- @@ -0,0 +1,32 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class MinCMcount extends Condition
- +{
- + public MinCMcount(Object value)
- + {
- + super(value);
- + setName("Clan Members Count");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.getClan() != null)
- + {
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getClan().getMembersCount() >= val)
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Mage.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Mage.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/Mage.java (working copy)
- @@ -0,0 +1,28 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class Mage extends Condition
- +{
- + public Mage(Object value)
- + {
- + super(value);
- + setName("Be Mage");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.isMageClass())
- + {
- + return true;
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ItemsCount.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ItemsCount.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ItemsCount.java (working copy)
- @@ -0,0 +1,43 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import java.util.StringTokenizer;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class ItemsCount extends Condition
- +{
- + public ItemsCount(Object value)
- + {
- + super(value);
- + setName("Items Count");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + String s = getValue().toString();
- + StringTokenizer st = new StringTokenizer(s, ",");
- + int id = 0;
- + int ammount = 0;
- + try
- + {
- + id = Integer.parseInt(st.nextToken());
- + ammount = Integer.parseInt(st.nextToken());
- + if (player.getInventory().getInventoryItemCount(id, 0) >= ammount)
- + {
- + return true;
- + }
- + }
- + catch (NumberFormatException nfe)
- + {
- + nfe.printStackTrace();
- + }
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/eventWins.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/eventWins.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/eventWins.java (working copy)
- @@ -0,0 +1,26 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class eventWins extends Condition
- +{
- + public eventWins(Object value)
- + {
- + super(value);
- + setName("Event Wins");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + @SuppressWarnings("unused")
- + int val = Integer.parseInt(getValue().toString());
- +
- + return false;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ClanLevel.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ClanLevel.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/eventsmanager/AchievmentsEngine/conditions/ClanLevel.java (working copy)
- @@ -0,0 +1,32 @@
- +package com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.conditions;
- +
- +import com.l2jfrozen.gameserver.eventsmanager.AchievmentsEngine.base.Condition;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +
- +public class ClanLevel extends Condition
- +{
- + public ClanLevel(Object value)
- + {
- + super(value);
- + setName("Clan Level");
- + }
- +@Override
- + public boolean meetConditionRequirements(L2PcInstance player)
- + {
- + if (getValue() == null)
- + {
- + return false;
- + }
- +
- + if (player.getClan() != null)
- + {
- + int val = Integer.parseInt(getValue().toString());
- +
- + if (player.getClan().getLevel() >= val)
- + {
- + return true;
- + }
- + }
- + return false;
- + }
- +}
- \ No newline at end of file
- -------------------------------------------------------------------------------------------------------------------
- sql
- CREATE TABLE `achievements` (
- `owner_id` int(11) NOT NULL DEFAULT '0',
- `a1` int(11) DEFAULT '0',
- `a2` int(11) DEFAULT '0',
- `a3` int(11) DEFAULT '0',
- `a4` int(11) DEFAULT '0',
- `a5` int(11) DEFAULT '0',
- `a6` int(11) DEFAULT '0',
- `a7` int(11) DEFAULT '0',
- `a8` int(11) DEFAULT '0',
- `a9` int(11) DEFAULT '0',
- `a10` int(11) DEFAULT '0',
- `a11` int(11) DEFAULT '0',
- `a12` int(11) DEFAULT '0',
- `a13` int(11) DEFAULT '0',
- `a14` int(11) DEFAULT '0',
- `a15` int(11) DEFAULT '0',
- `a16` int(11) DEFAULT '0',
- `a17` int(11) DEFAULT '0',
- `a18` int(11) DEFAULT '0',
- `a19` int(11) DEFAULT '0',
- `a20` int(11) DEFAULT '0',
- `a21` int(11) DEFAULT '0',
- `a22` int(11) DEFAULT '0',
- `a23` int(11) DEFAULT '0',
- `a24` int(11) DEFAULT '0',
- PRIMARY KEY (`owner_id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- INSERT INTO `custom_npc` VALUES ('10000', '32226', 'Achievement', '1', 'L2jServer', '1', 'LineageNPC2.K_F1_grand', '11.00', '22.25', '70', 'male', 'L2Achievements', '40', '2444.000000000000000', '2444.000000000000000', '0.000000000000000', '0.000000000000000', '10', '10', '10', '10', '10', '10', '0', '0', '500.00000', '500.00000', '500.00000', '500.00000', '278', '1', '333', '0', '0', '0', '28.00000', '120.00000', '0', '0');
- -----------------------------------------------------------------------------------------------------------------------------------
- xml
- <?xml version='1.0' encoding='UTF-8'?>
- <!-- Achievements -->
- <!-- Max achievements recommended is 60 more will cause client to crash (big html) -->
- <!-- Possible Conditions are: -->
- <!-- minLevel -->
- <!-- minPvPCount -->
- <!-- minPkCount -->
- <!-- minClanLevel -->
- <!-- mustBeHero -->
- <!-- mustBeNoble -->
- <!-- minWeaponEnchant -->
- <!-- minKarmaCount -->
- <!-- minAdenaCount -->
- <!-- minClanMembersCount -->
- <!-- mustBeClanLeader -->
- <!-- mustBeMarried -->
- <!-- itemAmmount -->
- <!-- crpAmmount -->
- <!-- lordOfCastle -->
- <!-- mustBeMageClass -->
- <!-- minSubclassCount -->
- <!-- CompleteAchievements -->
- <!-- minSkillEnchant -->
- <!-- minOnlineTime -->
- <!-- minHeroCount -->
- <!-- raidToKill -->
- <!-- raidToKill1 -->
- <!-- raidToKill2 -->
- <!-- minRaidPoints -->
- <!-- eventKills -->
- <!-- events -->
- <!-- eventWins -->
- <list>
- <achievement id="1" name="Champion" description="Gain level 80" reward="9142,5" minLevel="80"/>
- <achievement id="2" name="Hero" description="Gain hero status" reward="9142,10" mustBeHero="true"/>
- <achievement id="3" name="Noble" description="Gain noblesse status" reward="9142,10" mustBeNoble="true"/>
- <achievement id="4" name="Zaishen" description="Gain a +16 weapon" reward="9142,15" minWeaponEnchant="16" />
- <achievement id="5" name="Norn" description="Gain 4,000 PvPs" reward="9142,15" minPvPCount="4000"/>
- <achievement id="6" name="Commander" description="Be a clan leader of a level 8 clan" reward="9142,10" mustBeClanLeader="true" minClanLevel="8"/>
- <achievement id="7" name="Darkbringer" description="Gain 1,500 PKs" reward="9142,15" minPkCount="1500"/>
- <achievement id="8" name="Bravery" description="Have 3 subclasses" reward="9142,5" minSubclassCount="3"/>
- <achievement id="9" name="Dealer" description="Bring 200 Sprignant fruits" reward="9142,15" itemAmmount="8787,200"/>
- <achievement id="10" name="Gamer" description="Be online for 100 days" reward="9142,10" minOnlineTime="100"/>
- <achievement id="11" name="Conqueror" description="Be clan leader of a clan level 8 that owns a castle" reward="9142,10" lordOfCastle="true" minClanLevel="8" mustBeClanLeader="true"/>
- <achievement id="12" name="Codex" description="Have a +15 skill" reward="9142,15" minSkillEnchant="15"/>
- <achievement id="13" name="Famous" description="Be clean leader of a level 8 clan with 100,000 clan reputation points" reward="9142,15" minClanLevel="8" crpAmmount="100000" mustBeClanLeader="true"/>
- <achievement id="14" name="Myth" description="Have hero status for 15 periods" reward="9142,15" minHeroCount="15"/>
- <achievement id="15" name="Wisdom" description="Kill Hallate, Kernon and Golkonda within 24hours" reward="9142,5" raidToKill="25220" raidToKill1="25054" raidToKill2="25126"/>
- <achievement id="16" name="Slayer" description="Kill Baium and be level 80" reward="9142,5" raidToKill="29020" minLevel="80" />
- <achievement id="17" name="Joker" description="Kill Antharas and be level 80" reward="9142,5" raidToKill="29019" minLevel="80" />
- <achievement id="18" name="Legend" description="Kill Valakas and be level 80" reward="9142,10" raidToKill="29028" minLevel="80" />
- <achievement id="19" name="Lightbringer" description="Claim 1,200 Raid points and be lvl 78" reward="9142,10" minRaidPoints="1200" minLevel="78" />
- <achievement id="20" name="Dominator" description="get 1,500 event kills" reward="9142,15" eventKills="1500" />
- <achievement id="21" name="Winner" description="get 250 event wins" reward="9142,15" eventWins="250" />
- <achievement id="22" name="Eventor" description="play in 250 events" reward="9142,10" events="250" />
- <achievement id="23" name="Vanquisher" description="Complete all personal achievements" reward="9142,40" CompleteAchievements="8" />
- <achievement id="24" name="Tycoon" description="Complete all achievements" reward="9142,60" CompleteAchievements="10" />
- </list>
Advertisement
Add Comment
Please, Sign In to add comment