Jump to content
  • 0

[Help] Looking for Achievement engine


Question

6 answers to this question

Recommended Posts

  • 0
Posted

i found this:

http://pastebin.com/3vLUrLjU

 

L2AchievementManagerInstance

 

Index: java/com/l2jserver/gameserver/model/actor/instance/L2AchievementsManagerInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2AchievementsManagerInstance.java	(revision 0)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2AchievementsManagerInstance.java	(revision 0)
@@ -0,0 +1,283 @@
+package com.l2jserver.gameserver.model.actor.instance;
+
+import java.util.StringTokenizer;
+
+import javolution.text.TextBuilder;
+
+import com.l2jserver.gameserver.model.L2ItemInstance;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.entity.AchievmentsEngine.AchievementsManager;
+import com.l2jserver.gameserver.model.entity.AchievmentsEngine.base.Achievement;
+import com.l2jserver.gameserver.model.entity.AchievmentsEngine.base.Condition;
+import com.l2jserver.gameserver.model.itemcontainer.Inventory;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
+
+/**
+ * @author Matim
+ * @version 1.0
+ */
+@SuppressWarnings("unused")
+public class L2AchievementsManagerInstance extends L2Npc
+{
+        public L2AchievementsManagerInstance(int objectId, L2NpcTemplate template)
+        {
+                super(objectId, template);
+        }
+        
+        @Override
+        public void onBypassFeedback(L2PcInstance player, String command)
+        {
+                if (player == null || player.getLastFolkNPC() == null || player.getLastFolkNPC().getObjectId() != this.getObjectId()) 
+                {
+                        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());
+                        AchievementsManager.getInstance().rewardForAchievement(id, player);
+                        player.saveAchievementData(id);
+                        showMyAchievements(player);
+                }
+                else if (command.startsWith ("showMyStats"))
+                {
+                        showMyStatsWindow(player);
+                }
+                else if (command.startsWith("showHelpWindow"))
+                {
+                        showHelpWindow(player);
+                }
+        }
+
+        @Override
+        public void showChatWindow(L2PcInstance player, int val)
+        {
+                TextBuilder tb = new TextBuilder();
+                tb.append("<html><title>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 Achievements\" action=\"bypass -h npc_%objectId%_showMyAchievements\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
+                tb.append("<button value=\"Statistics\" action=\"bypass -h npc_%objectId%_showMyStats\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
+                tb.append("<button value=\"Top List\" action=\"bypass -h npc_%objectId%_topList\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
+                tb.append("<button value=\"Help\" action=\"bypass -h npc_%objectId%_showHelpWindow\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
+                
+                NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+                msg.setHtml(tb.toString());
+                msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        
+                player.sendPacket(msg);
+        }
+        
+        private void showMyAchievements(L2PcInstance player)
+        {
+                TextBuilder tb = new TextBuilder();
+                tb.append("<html><title>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\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+                }
+                
+                NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+                msg.setHtml(tb.toString());
+                msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        
+                player.sendPacket(msg);
+        }
+        
+        private void showAchievementInfo(int achievementID, L2PcInstance player)
+        {
+                Achievement a = AchievementsManager.getInstance().getAchievementList().get(achievementID);
+                
+                TextBuilder tb = new TextBuilder();
+                tb.append("<html><title>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(achievementID))
+                {
+                        tb.append("<button value=\"Receive Reward!\" action=\"bypass -h npc_%objectId%_getReward " 
+                        + a.getID() + "\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
+                }
+                
+                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=\"right\">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\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+                
+                NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+                msg.setHtml(tb.toString());
+                msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        
+                player.sendPacket(msg);
+        }
+        
+        private void showMyStatsWindow(L2PcInstance player)
+        {
+                TextBuilder tb = new TextBuilder();
+                tb.append("<html><title>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\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+                
+                NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+                msg.setHtml(tb.toString());
+                msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        
+                player.sendPacket(msg);
+        }
+        
+        private void showTopListWindow(L2PcInstance player)
+        {
+                TextBuilder tb = new TextBuilder();
+                tb.append("<html><title>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\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+                
+                NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+                msg.setHtml(tb.toString());
+                msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        
+                player.sendPacket(msg);
+        }
+        
+        private void showHelpWindow(L2PcInstance player)
+        {
+                TextBuilder tb = new TextBuilder();
+                tb.append("<html><title>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("You can check status of your achievements, receive reward if every condition of achievement is meet, if not you can check which condition is still not meet, by using info button");
+                tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1s\"><br>");
+                tb.append("<font color=\"FF0000\">Not Completed</font> - you did not meet the achivement requirements.<br>");
+                tb.append("<font color=\"LEVEL\">Get Reward</font> - you may receive reward, click info.<br>");
+                tb.append("<font color=\"5EA82E\">Completed</font> - achievement completed, reward received.<br>");
+                
+                tb.append("Achievements Engine by <font color=\"LEVEL\">Matim</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\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+                
+                NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+                msg.setHtml(tb.toString());
+                msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        
+                player.sendPacket(msg);
+        }
+        
+        private String getStatusString(int achievementID, L2PcInstance player)
+        {
+                if (player.getCompletedAchievements().contains(achievementID))
+                {
+                        return "<font color=\"5EA82E\">Completed</font>";
+                }
+                else
+                {
+                        if (AchievementsManager.getInstance().getAchievementList().get(achievementID).meetAchievementRequirements(player))
+                        {
+                                return "<font color=\"LEVEL\">Get Reward</font>";
+                        }
+                        else
+                        {
+                                return "<font color=\"FF0000\">Not Completed</font>";
+                        }
+                }
+        }
+        
+        private String getTableColor(int i)
+        {
+                if (i % 2 == 0)
+                        return "<table width=270 border=0 bgcolor=\"444444\">";
+                else
+                        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(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+= getTableColor(i);
+                        s+= "<tr><td width=270 align=\"left\">Level</td><td width=50 align=\"right\">" + c.getValue() + "</td><td width=200 align=\"center\">";
+                        i++;
+                        
+                        if (c.meetConditionRequirements(player))
+                                s+= completed;
+                        else
+                                s+= notcompleted;
+                }
+                return s;
+        }
+}

 

for L2PcInstance

 

+private List<Integer> _completedAchievements = new FastList<Integer>();
+      
+       public boolean readyAchievementsList()
+       {
+               if (_completedAchievements.isEmpty())
+                       return false;
+               else
+                       return true;
+       }
+      
+       public void saveAchievemntData()
+       {
+              
+       }
+      
+       public void getAchievemntData()
+       {
+               Connection con = null;
+               try
+               {                      
+                       PreparedStatement statement;
+                       PreparedStatement insertStatement;
+                       ResultSet rs;
+                       con = L2DatabaseFactory.getInstance().getConnection();
+                      
+                       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)
+                                                       _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("[ACHIEVEMENTS ENGINE GETDATA]" + e);
+               }
+               finally
+               {
+                       L2DatabaseFactory.close(con);
+               }
+       }
+      
+       public void saveAchievementData(int achievementID)
+       {
+               Connection con = null;
+               try
+               {                      
+                       con = L2DatabaseFactory.getInstance().getConnection();
+                       Statement statement = con.createStatement();
+                       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("[ACHIEVEMENTS SAVE GETDATA]" + e);
+               }
+               finally
+               {
+                       L2DatabaseFactory.close(con);
+               }
+       }
+      
+       public List<Integer> getCompletedAchievements()
+       {
+               return _completedAchievements;
+       }
+

everything seems fine, but when I talk with the NPC and give "My achievements" nothing happens

  • 0
Posted

bypass looks good. have changed a little html

 

+        private void showMyAchievements(L2PcInstance player)
+        {
+                TextBuilder tb = new TextBuilder();
+                tb.append("<html><title>Achievements Manager</title><body><br>");
+                
+                tb.append("<center><font color=\"LEVEL\">My achievements</font>:</center><br>");
+                
+                NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
+                msg.setHtml(tb.toString());
+                msg.replace("%objectId%", String.valueOf(this.getObjectId()));
+        
+                player.sendPacket(msg);
+        }

 

Edit: changed html to that and when i press my achievements i see html (ofc just simple message "achievements manager and my achievements, nothing else)

 

 

maybe is something wrong in here:

 

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\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+                }

?

 

Edit: it looks like inside html code is broken cuz npc not show me. ;/

Guest
This topic is now closed to further replies.


  • Posts

    • me ayudas a montar ese pack por que no entiendo tanto es para tener de prueba
    • GX-C4 pack, its ok...just used it.
    • This post originally appeared on MmoGah. Arena Breakout: Infinite is a hardcore tactical extraction shooter that demands precision, patience, and strategy. This guide will walk you through everything a beginner needs to know—from gear and combat to survival and extraction.     What Is Arena Breakout: Infinite? Arena Breakout: Infinite (ABI) is a free-to-play online extraction shooter developed by MoreFun Studios and released on Steam in September 2025. Unlike traditional battle royales, ABI focuses on risk vs. reward rather than being the last one standing. Players enter instanced maps called "raids," where they must scavenge loot, survive enemy encounters, and extract safely.   Core Gameplay Mechanics 1. Raids and Extraction Each raid features 4–6 teams (solo or squad) dropped into a map. The goal is to loot valuable items and extract through designated points. Extraction is not exclusive—multiple teams can leave the map alive. 2. PvPvE Combat You'll face both human players and AI enemies. AI can be unpredictable and deadly, especially in high-tier zones. 3. No Hand-Holding ABI offers no tutorials or guidance. You learn by dying—and surviving.   Gear and Loadouts 1. Choose Wisely Your gear determines your survivability. Armor, helmets, and medical supplies are essential. Weapons vary in recoil, damage, and handling. Start with low-cost rifles like the AKS-74U or MP5. 2. Insurance System You can insure gear to recover it if you die and it isn't looted. Use insurance for expensive items, but don't rely on it blindly. 3. Backpacks and Storage Larger backpacks allow more loot but make you a bigger target. Organize your inventory to quickly access meds and ammo during combat.   Tactical Tips for Beginners 1. Know What to Loot Prioritize high-value items like weapon parts, medical kits, and rare electronics. Learn loot hotspots on each map—warehouses, bunkers, and military zones often yield better gear. 2. Sound Is Everything Footsteps, gunfire, and reloads are loud. Use headphones and move cautiously. Crouch-walking and slow peeking reduce noise and improve stealth. 3. Map Knowledge Study maps offline or in low-risk raids. Learn extraction points, choke zones, and sniper nests. 4. Stamina Management Sprinting drains stamina, which affects aim and movement. Rest in safe zones and avoid overexertion during firefights.   Combat and Survival 1. Engage Smartly Don't chase kills—survival and extraction are the real goals. Use cover, lean mechanics, and suppressive fire to control fights. 2. Healing and Damage ABI features a detailed health system: limbs can be fractured, bleeding, or disabled. Carry splints, bandages, and painkillers. Know how to treat each condition. 3. Death Is a Lesson You will die—a lot. Use each death to learn positioning, gear value, and enemy behavior.   Progression and Economy 1. Free-to-Play Friendly ABI is generous with starter gear and daily rewards. You can earn the currency Arena Breakout: Infinite Koens through successful raids and selling loot. 2. Marketplace Trade gear with other players or sell to vendors. Prices fluctuate—learn market trends to maximize profit. 3. No Skill Trees Unlike similar games, ABI doesn't use operator skills. Progression is gear-based and tactical, not RPG-style.   Settings and Optimization 1. Graphics and Performance Lower shadows and post-processing for better visibility. Use high FPS settings for smoother combat. 2. Keybinds Customize controls for quick access to healing, leaning, and inventory. Practice muscle memory in offline raids. 3. Audio Settings Maximize footstep and gunfire volume. Reduce ambient noise to focus on threats.   Beginner Loadout Recommendation Slot Item Notes Primary Gun AKS-74U or MP5 Low recoil, easy to handle Secondary Pistol (optional) Backup for emergencies Armor Basic Vest Better than nothing Helmet Light Helmet Protects against headshots Backpack Medium Balance between space and size Meds Bandages, Splints Treat bleeding and fractures Ammo 2–3 extra mags Always reload before fights         Final Advice for New Players Start slow: Don't rush into high-tier zones. Learn the basics in low-risk areas. Play with friends: Squad play improves survival and makes learning easier. Watch and learn: Study streamers and guides to understand advanced tactics. Don't hoard: Use your gear. Hoarding leads to stagnation and fear of loss. Extract often: Surviving and extracting builds confidence and resources. Arena Breakout: Infinite is brutal, but deeply rewarding. With patience and practice, you'll evolve from a terrified scavenger to a confident operator. Every raid is a story—make yours one of survival and triumph.
    • Hola , quería montar un c4 off l2 no custom , me podrían recomendar datapacks y que funcione con windows servers modernos o en una máquina virtual , ya que no tengo plat para comprar y solo lo usare para jugar solo ya que soy un fanático del c4  
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock