Jump to content

Claim A Target System


Klay

Recommended Posts

Hello guys,

 

I decided to not sell anymore this system since no one is interested in buying it,so I decided it to share it instead :)

 

vdn2pd.jpg

npp3qp.jpg

2r7359e.jpg

4toz7r.jpg

 

Description:

 

There's one npc,and there you can type the player you wants to die,then you(as requester) lose X item(ID,amount configurable).Also,server(through announcement) let the other player know that you(requestor name) wants X player(target name) die.

whoever kills this the target name gains X item(ID,amount configurable).

Player target status are saved into database so target won't lose his target status in case of server restart/shutdown.

PS:

Τhe first picture is captured when I was testing this in my private source,but I decided to code it for acis since almost everyone is using this.The next 4 pictures are captured in acis,but I forgot to capture the npc chat as well,but anyway is the same like the 1st one,no changes at all.

coded on acis rev 330

 

datapack:

 

### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: sql/characters.sql
===================================================================
--- sql/characters.sql    (revision 1)
+++ sql/characters.sql    (working copy)
@@ -54,6 +54,7 @@
   `clan_join_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
   `clan_create_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
   `death_penalty_level` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
+  `publictarget` TINYINT UNSIGNED NOT NULL DEFAULT 0,
   PRIMARY KEY (obj_Id),
   KEY `clanid` (`clanid`)
 );
\ No newline at end of file
Index: data/xml/npcs/50000-50999.xml
===================================================================
--- data/xml/npcs/50000-50999.xml    (revision 1)
+++ data/xml/npcs/50000-50999.xml    (working copy)
@@ -72,4 +72,40 @@
             <skill id="4416" level="18"/>
         </skills>
     </npc>
+    <npc id="50009" idTemplate="30519" name="Haras" title="Claim a target">
+        <set name="level" val="70"/>
+        <set name="radius" val="7"/>
+        <set name="height" val="18"/>
+        <set name="rHand" val="0"/>
+        <set name="lHand" val="0"/>
+        <set name="type" val="L2KillTarget"/>
+        <set name="exp" val="0"/>
+        <set name="sp" val="0"/>
+        <set name="hp" val="2444.46819"/>
+        <set name="mp" val="1345.8"/>
+        <set name="hpRegen" val="7.5"/>
+        <set name="mpRegen" val="2.7"/>
+        <set name="pAtk" val="688.86373"/>
+        <set name="pDef" val="295.91597"/>
+        <set name="mAtk" val="470.40463"/>
+        <set name="mDef" val="216.53847"/>
+        <set name="crit" val="4"/>
+        <set name="atkSpd" val="253"/>
+        <set name="str" val="40"/>
+        <set name="int" val="21"/>
+        <set name="dex" val="30"/>
+        <set name="wit" val="20"/>
+        <set name="con" val="43"/>
+        <set name="men" val="20"/>
+        <set name="corpseTime" val="7"/>
+        <set name="walkSpd" val="50"/>
+        <set name="runSpd" val="120"/>
+        <set name="dropHerbGroup" val="0"/>
+        <set name="attackRange" val="40"/>
+        <ai type="default" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" canMove="true" seedable="false"/>
+        <skills>
+            <skill id="4045" level="1"/>
+            <skill id="4416" level="18"/>
+        </skills>
+    </npc>
 </list>
\ No newline at end of file
Index: data/html/killtarget/50009.htm
===================================================================
--- data/html/killtarget/50009.htm    (revision 0)
+++ data/html/killtarget/50009.htm    (working copy)
@@ -0,0 +1,23 @@
+<html>
+<body>
+       <center><font color="FF9900">Public Target Manager</font></center>
+       <table>
+               <tr>
+                       <td>Hello,I'm here to let the others players know the name of player that you want to <font color="FF9900">die</font>.<br1>
+                       <br></td>
+               </tr>
+               <tr>
+                       <td>If someone else has already targeted a specific player <font color="FF9900">you can't</font> target the same player.<br1>
+                       <br></td>
+               </tr>
+               <tr>
+                       <td>After your mark your <font color="FF9900">target</font>,there will be an <font color="FF9900">announcement</font> so every will know<br1>
+                       My services are <font color="FF9900">not</font> free of course.The <font color="FF9900">killer</font> of your targeted player will take the items you will spend.<br><br><br></td>
+               </tr>
+               <tr>
+                       <td>Player:<edit var="pname" width=80 height=20>
+                       <a action="bypass -h npc_%objectId%_killpl $pname">Claim a target</a></td>
+               </tr>
+       </table>
+</body>
+</html>
\ No newline at end of file

 

core

 

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: config/players.properties
===================================================================
--- config/players.properties    (revision 1)
+++ config/players.properties    (working copy)
@@ -288,4 +288,14 @@
 MaxBuffsAmount = 20
 
 # Store buffs/debuffs on user logout?
-StoreSkillCooltime = True
\ No newline at end of file
+StoreSkillCooltime = True
+
+#=============================================================
+#                        Public Target
+#=============================================================
+# player's who request someone else death (requestor) - settings
+RequiredItemId = 57
+RequiredItemAmount = 10000
+# player's who kill the requested player rewards - settings
+RewardKillerId = 57
+RewardKillerAmount = 2000000
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2KillTargetInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2KillTargetInstance.java    (revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2KillTargetInstance.java    (working copy)
@@ -0,0 +1,84 @@
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import java.util.StringTokenizer;
+
+
+
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.Announcements;
+
+
+
+public class L2KillTargetInstance extends L2NpcInstance{
+
+    int requestorItemId = Config.REQUESTOR_ITEM_ID;
+    int requestorItemAmount = Config.REQUESTOR_ITEM_AMOUNT;
+    
+    public L2KillTargetInstance(int objectId, NpcTemplate template) {
+        super(objectId, template);
+    }
+
+    public void onBypassFeedback(L2PcInstance player, String command)
+    {
+        if (command.startsWith("killpl"))
+                   {
+                        StringTokenizer st = new StringTokenizer(command);
+                        st.nextToken();
+                        
+                        if (st.countTokens() != 1)
+                        {
+                            player.sendMessage("Fill the box with a name,please");
+                            return;
+                        }
+                        if(player.getInventory().getItemByItemId(requestorItemId).getCount() <= requestorItemAmount)
+                        {
+                            player.sendMessage("You need more items to claim a target");
+                            return;
+                        }
+                                        
+                        String val = String.valueOf(st.nextToken());
+                        L2PcInstance target = L2World.getInstance().getPlayer(val);
+
+                        if (target == null)
+                        {
+                            player.sendMessage("Such player doesn't exist or it isn't online");
+                            return;
+                        }
+                        else if (target.equals(player))
+                        {
+                            player.sendMessage("You can't target yourself");
+                            return;
+                        }
+                        else if (target.isTargeted())
+                        {
+                            player.sendMessage("This player is already targeted by someone else,choose another");
+                            return;
+                        }
+                        
+                        target.setTargeted(true);
+                        player.destroyItemByItemId("Mark Target", requestorItemId, requestorItemAmount, player.getTarget(), true);
+                        Announcements.getInstance().announceToAll("Mission: Kill "+target.getName()+" for special reward");
+                        target.sendMessage("Player "+player.getName()+" targeted you and offers adena to whoever kill you");
+        
+                   }
+        
+    }
+    
+        public String getHtmlPath(int npcId, int val)
+        {
+            String pom = "";
+            if (val == 0)
+            {
+                pom = "" + npcId;
+            }
+            else
+            {
+                pom = npcId + "-" + val;
+            }
+    
+            return "data/html/killtarget/" + pom + ".htm";
+        }
+}
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -37,6 +37,7 @@
 
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
 import net.sf.l2j.gameserver.GameTimeController;
 import net.sf.l2j.gameserver.GeoData;
 import net.sf.l2j.gameserver.LoginServerThread;
@@ -252,6 +253,10 @@
  */
 public final class L2PcInstance extends L2Playable
 {
+    
+    public int killerRewardItemId = Config.KILLER_REWARD_ITEM_ID;
+    public int killerRewardAmount = Config.KILLER_REWARD_AMOUNT;
+    
     private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
     private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
     private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?";
@@ -262,9 +267,9 @@
     private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay, systime, restore_type FROM character_skills_save WHERE char_obj_id=? AND class_index=? ORDER BY buff_index ASC";
     private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
     
-    private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade,last_recom_date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
-    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
-    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
+    private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade,last_recom_date,publictarget) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,publictarget=? WHERE obj_id=?";
+    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,publictarget FROM characters WHERE obj_id=?";
     
     private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
     private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
@@ -485,6 +490,7 @@
     
     private boolean _noble = false;
     private boolean _hero = false;
+    public boolean _targeted = false;
     
     private L2Npc _currentFolkNpc = null;
     
@@ -4026,6 +4032,19 @@
         {
             L2PcInstance pk = killer.getActingPlayer();
             
+
+            if(killer instanceof L2PcInstance)
+            {
+                pk = (L2PcInstance) killer;
+                if(isTargeted())
+                {
+
+                    Announcements.getInstance().announceToAll("Targeted player "+getName()+" was killed by "+pk.getName()+",the player who killed targeted player rewarded with special item");
+                    setTargeted(false);
+                    sendMessage("Since you've been killed while you were public target,you are not public target anymore");
+                    pk.addItem("Public Target",killerRewardItemId,killerRewardAmount,pk,true);
+                }
+            }
             // Clear resurrect xp calculation
             setExpBeforeDeath(0);
             
@@ -5453,6 +5472,7 @@
             statement.setInt(32, isNoble() ? 1 : 0);
             statement.setLong(33, 0);
             statement.setLong(34, System.currentTimeMillis());
+            statement.setInt(35, isTargeted() ? 1 : 0);
             statement.executeUpdate();
             statement.close();
         }
@@ -5508,6 +5528,7 @@
                 player.setPkKills(rset.getInt("pkkills"));
                 player.setOnlineTime(rset.getLong("onlinetime"));
                 player.setNoble(rset.getInt("nobless") == 1, false);
+                player.setTargeted(rset.getInt("publictarget") == 1);
                 
                 player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
                 if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -5934,7 +5955,8 @@
             statement.setLong(47, getClanCreateExpiryTime());
             statement.setString(48, getName());
             statement.setLong(49, getDeathPenaltyBuffLevel());
-            statement.setInt(50, getObjectId());
+            statement.setInt(50, isTargeted() ? 1 : 0);
+            statement.setInt(51, getObjectId());
             
             statement.execute();
             statement.close();
@@ -8052,6 +8074,17 @@
         return _hero;
     }
     
+    public boolean isTargeted()
+    {
+        return _targeted;
+    }
+    
+    public void setTargeted(boolean val)
+    {
+        _targeted = val;
+    }
+
+    
     public boolean isInOlympiadMode()
     {
         return _inOlympiadMode;
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java    (revision 1)
+++ java/net/sf/l2j/Config.java    (working copy)
@@ -376,7 +376,11 @@
     // --------------------------------------------------
     // Players
     // --------------------------------------------------
-    
+    /** Target system */
+    public static int REQUESTOR_ITEM_ID;
+    public static int REQUESTOR_ITEM_AMOUNT;
+    public static int KILLER_REWARD_ITEM_ID;
+    public static int KILLER_REWARD_AMOUNT;
     /** Misc */
     public static int STARTING_ADENA;
     public static boolean EFFECT_CANCELING;
@@ -995,6 +999,11 @@
             
             // players
             ExProperties players = load(PLAYERS_FILE);
+            REQUESTOR_ITEM_ID = players.getProperty("RequiredItemId",57);
+            REQUESTOR_ITEM_AMOUNT = players.getProperty("RequiredItemAmount",10000);
+            KILLER_REWARD_ITEM_ID = players.getProperty("RewardKillerId",57);
+            KILLER_REWARD_AMOUNT = players.getProperty("RewardKillerAmount",100000);
+            
             STARTING_ADENA = players.getProperty("StartingAdena", 100);
             EFFECT_CANCELING = players.getProperty("CancelLesserEffect", true);
             HP_REGEN_MULTIPLIER = players.getProperty("HpRegenMultiplier", 1.);

 

 

 

have fun :D

 

 

Link to comment
Share on other sites

Hello guys,

I decided to not sell anymore this system since no one is interested in buying it,so I decided it to share it instead :)

 

that is because they arent original and have been shared before (hitman by setkeh)

Link to comment
Share on other sites

that is because they arent original and have been shared before (hitman by setkeh)

He's right, it's excactly the same system. (Not the code - didn't checked it - but the system itself)

Link to comment
Share on other sites

nice code but you should add more protection to this code.

smart players can create bugs from this code...

you should add protection to prevent olympiad system and the events you have.and to avoid error on gs..

Link to comment
Share on other sites

nice code but you should add more protection to this code.

smart players can create bugs from this code...

you should add protection to prevent olympiad system and the events you have.and to avoid error on gs..

Thanks for your kind comments.

 

well everyone can add few checks regarding events or olympiad,I guess >.>

Edited by Klay
Link to comment
Share on other sites

Thanks for your kind comments.

 

well everyone can add few checks regarding events or olympiad,I guess >.>

well everyone who has experience yes...but what about the newbies? 

maybe you should write it on the topic[for the newbies] ...

Link to comment
Share on other sites

if someone doesn't got the require knowledge to add those checks you were talking about,he can reply here and be sure that I will help him :)

i am sure for that man :) but it would be great to inform them when we share something :) 

Link to comment
Share on other sites

well everyone who has experience yes...but what about the newbies?

Newbie should NOT busy about any serious upgrade of the code, they should keep learning by adding diffs, adapting and such.

 

No instant newbie server, plox.

Link to comment
Share on other sites

i am sure for that man :) but it would be great to inform them when we share something :)

one day,newbies should be stop considered as newbies..

no offense,but everyone should try to learn few things on his own if he would like to continue in this l2j world,if you know what i mean.

 

unless they want to keep paying a shit load of money to devs.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...