· 6 years ago · Aug 08, 2019, 11:24 AM
1+++ b/aCis_datapack/data/xml/scripts.xml
2@@ -392,6 +392,7 @@
3 <script path="scripts.custom.HeroCirclet"/>
4 <script path="scripts.custom.HeroWeapon"/>
5 <script path="scripts.custom.BarakielNobless"/>
6+ <script path="scripts.custom.PcPoint"/>
7
8 <!-- Events -->
9
10+++ b/aCis_datapack/sql/characters.sql
11@@ -60,6 +60,7 @@ CREATE TABLE IF NOT EXISTS characters (
12 `lastNZvote` bigint(20) NOT NULL DEFAULT '0',
13 `pin` int(4) DEFAULT NULL,
14 `pinsubmited` int(1) DEFAULT '1',
15+ `pc_point` int (1) NOT NULL DEFAULT 0,
16 PRIMARY KEY (`obj_Id`),
17 KEY `clanid` (`clanid`)
18 );
19\ No newline at end of file
20
21+++ b/aCis_gameserver/config/customs/customs.properties
22@@ -111,4 +111,53 @@ AnnounceHeroLogin = True
23 # New Player Title config
24 PvpPkTitle = False
25 PvPTitlePrefix = PvP|
26 PkTitlePrefix = Pk
27
28+# -----------------------------------------------------
29+# Event PC Bang Point Per Mob -
30+# -----------------------------------------------------
31+# But the custom NPC ID to gain Bang Points
32+# Default: 21364 - Varka Silenos Seer
33+PCBangMobID = 21364
34+
35+# Amount of PC Bang Points gain on Kill Mob
36+# Default: 150
37+PCBangPointsPerMob = 150
38
39+++ b/aCis_gameserver/java/net/sf/l2j/Config.java
40@@ -900,6 +901,24 @@ public final class Config
41 public static int ZONE_TOWN;
42 public static boolean DISABLE_TUTORIAL;
43+
44+ /** PCBang Point peer mob */
45+ public static int PC_BANG_POINTS_MOB_ID;
46+ public static int PC_BANG_POINTS_PER_MOB;
47+
48 // --------------------------------------------------
49 // Those "hidden" settings haven't configs to avoid admins to fuck their server
50 // You still can experiment changing values here. But don't say I didn't warn you.
51@@ -1226,6 +1245,48 @@ public final class Config
52 PVP_PK_TITLE = Boolean.parseBoolean(customs.getProperty("PvpPkTitle", "True"));
53 PVP_TITLE_PREFIX = customs.getProperty("PvPTitlePrefix", " ");
54 PK_TITLE_PREFIX = customs.getProperty("PkTitlePrefix", " ");
55+
56+ PC_BANG_POINTS_MOB_ID = customs.getProperty("PCBangMobID", 21364);
57+ PC_BANG_POINTS_PER_MOB = customs.getProperty("PCBangPointsPerMob", 150);
58+
59+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Player.java
60@@ -164,6 +164,7 @@ import net.sf.l2j.gameserver.network.serverpackets.ExDuelUpdateUserInfo;
61 import net.sf.l2j.gameserver.network.serverpackets.ExFishingEnd;
62 import net.sf.l2j.gameserver.network.serverpackets.ExFishingStart;
63 import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode;
64+import net.sf.l2j.gameserver.network.serverpackets.ExPCCafePointInfo;
65 import net.sf.l2j.gameserver.network.serverpackets.ExSetCompassZoneCode;
66 import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
67 import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
68@@ -338,8 +339,8 @@ public final class Player extends Playable
69 private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
70
71 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
72- 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=?,color=? WHERE obj_id=?";
73- 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,color,pinsubmited,pin FROM characters WHERE obj_id=?";
74+ 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=?,color=?,pc_point=? WHERE obj_id=?";
75+ 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,color,pinsubmited,pin,pc_point FROM characters WHERE obj_id=?";
76
77 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";
78 private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
79@@ -406,6 +407,8 @@ public final class Player extends Playable
80
81 private PcAppearance _appearance;
82
83+ private int pcBangPoint = 0;
84+
85 private long _expBeforeDeath;
86 public int _tvtkills;
87 public int _killCount;
88@@ -5560,6 +5575,8 @@ public final class Player extends Playable
89 player.setOnlineTime(rset.getLong("onlinetime"));
90 player.setNoble(rset.getInt("nobless") == 1, false);
91
92+ player.pcBangPoint = rset.getInt("pc_point");
93+
94 player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
95 if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
96 player.setClanJoinExpiryTime(0);
97@@ -5986,7 +6003,8 @@ public final class Player extends Playable
98 statement.setString(48, getName());
99 statement.setLong(49, getDeathPenaltyBuffLevel());
100 statement.setInt(50, isColor());
101- statement.setInt(51, getObjectId());
102+ statement.setInt(51, getPcBangScore());
103+ statement.setInt(52, getObjectId());
104
105 statement.execute();
106 statement.close();
107@@ -11141,4 +11159,32 @@ public final class Player extends Playable
108 {
109 _lastTalkNpc = npc;
110 }
111+
112+ public int getPcBangScore()
113+ {
114+ return pcBangPoint;
115+ }
116+
117+ public void reducePcBangScore(int to)
118+ {
119+ pcBangPoint -= to;
120+ updatePcBangWnd(to, false, false);
121+ }
122+
123+ public void addPcBangScore(int to)
124+ {
125+ pcBangPoint += to;
126+ }
127+
128+ public void updatePcBangWnd(int score, boolean add, boolean duble)
129+ {
130+ ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, score, add, 24, duble);
131+ sendPacket(wnd);
132+ }
133+
134+ public void showPcBangWindow()
135+ {
136+ ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, 0, false, 24, false);
137+ sendPacket(wnd);
138+ }
139 }
140\ No newline at end of file
141
142+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
143@@ -457,6 +457,7 @@ public class EnterWorld extends L2GameClientPacket
144 AfkTaskManager.getInstance().add(activeChar);
145
146 activeChar.onPlayerEnter();
147+ activeChar.showPcBangWindow();
148 TvTEvent.onLogin(activeChar, activeChar);
149
150 sendPacket(new SkillCoolTime(activeChar));
151
152+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java
153@@ -1,21 +1,41 @@
154 package net.sf.l2j.gameserver.network.serverpackets;
155
156-/**
157- * Format: ch ddcdc
158- * @author KenM
159- */
160+import net.sf.l2j.gameserver.model.actor.instance.Player;
161+
162 public class ExPCCafePointInfo extends L2GameServerPacket
163 {
164- private final int _score, _modify, _periodType, _remainingTime;
165- private int _pointType = 0;
166+ private static final String _S__FE_31_EXPCCAFEPOINTINFO = "[S] FE:31 ExPCCafePointInfo";
167+ private Player _character;
168+ private int m_AddPoint;
169+ private int m_PeriodType;
170+ private int RemainTime;
171+ private int PointType;
172
173- public ExPCCafePointInfo(int score, int modify, boolean addPoint, boolean pointType, int remainingTime)
174+ public ExPCCafePointInfo(Player user, int modify, boolean add, int hour, boolean _double)
175 {
176- _score = score;
177- _modify = addPoint ? modify : modify * -1;
178- _remainingTime = remainingTime;
179- _pointType = addPoint ? (pointType ? 0 : 1) : 2;
180- _periodType = 1; // get point time
181+ _character = user;
182+ m_AddPoint = modify;
183+
184+ if (add)
185+ {
186+ m_PeriodType = 1;
187+ PointType = 1;
188+ }
189+ else
190+ {
191+ if (add && _double)
192+ {
193+ m_PeriodType = 1;
194+ PointType = 0;
195+ }
196+ else
197+ {
198+ m_PeriodType = 2;
199+ PointType = 2;
200+ }
201+ }
202+
203+ RemainTime = hour;
204 }
205
206 @Override
207@@ -23,10 +43,16 @@ public class ExPCCafePointInfo extends L2GameServerPacket
208 {
209 writeC(0xFE);
210 writeH(0x31);
211- writeD(_score);
212- writeD(_modify);
213- writeC(_periodType);
214- writeD(_remainingTime);
215- writeC(_pointType);
216+ writeD(_character.getPcBangScore());
217+ writeD(m_AddPoint);
218+ writeC(m_PeriodType);
219+ writeD(RemainTime);
220+ writeC(PointType);
221+ }
222+
223+ @Override
224+ public String getType()
225+ {
226+ return _S__FE_31_EXPCCAFEPOINTINFO;
227 }
228 }
229\ No newline at end of file
230
231+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/scripts/custom/PcPoint.java
232@@ -0,0 +1,61 @@
233+/*
234+ * Copyright (C) 2004-2014 L2J DataPack
235+ *
236+ * This file is part of L2J DataPack.
237+ *
238+ * L2J DataPack is free software: you can redistribute it and/or modify
239+ * it under the terms of the GNU General Public License as published by
240+ * the Free Software Foundation, either version 3 of the License, or
241+ * (at your option) any later version.
242+ *
243+ * L2J DataPack is distributed in the hope that it will be useful,
244+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
245+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
246+ * General Public License for more details.
247+ *
248+ * You should have received a copy of the GNU General Public License
249+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
250+ */
251+package net.sf.l2j.gameserver.scripting.scripts.custom;
252+
253+import net.sf.l2j.commons.random.Rnd;
254+
255+import net.sf.l2j.Config;
256+import net.sf.l2j.gameserver.datatables.NpcTable;
257+import net.sf.l2j.gameserver.model.actor.Npc;
258+import net.sf.l2j.gameserver.model.actor.instance.Player;
259+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
260+import net.sf.l2j.gameserver.scripting.Quest;
261+
262+public class PcPoint extends Quest
263+{
264+ public PcPoint()
265+ {
266+ super(-1, "custom");
267+ for (NpcTemplate t : NpcTable.getInstance().getTemplates(t -> t.getNpcId() == Config.PC_BANG_POINTS_MOB_ID))
268+ {
269+ addKillId(t.getIdTemplate());
270+ }
271+ }
272+
273+ @Override
274+ public String onKill(Npc npc, Player killer, boolean isPet)
275+ {
276+ if ((killer.getLevel() >= 75) && (npc.getLevel() < 60))
277+ {
278+ return "";
279+ }
280+ int score = 0;
281+ score = Rnd.get(Config.PC_BANG_POINTS_PER_MOB);
282+ killer.addPcBangScore(score);
283+ killer.updatePcBangWnd(score, true, false);
284+ killer.sendMessage("You have earned " + score + " PC Bang Points.");
285+ return super.onKill(npc, killer, isPet);
286+ }
287+
288+ public static void main(String[] arg)
289+ {
290+ new PcPoint();
291+ }
292+
293+}
294\ No newline at end of file