Advertisement
Guest User

Untitled

a guest
May 1st, 2010
3,359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 16.33 KB | None | 0 0
  1. Index: /Gs folder/java/l2justice/com/gameserver/services/FService.java
  2. ===================================================================
  3. --- /Gs folder/java/l2justice/com/gameserver/services/FService.java (revision 2928)
  4. +++ /Gs folder/java/l2justice/com/gameserver/services/FService.java (revision 2031)
  5. @@ -72,5 +72,5 @@
  6.  
  7. +   public static final String EVENT_PC_BANG_POINT_FILE = "./config/custom/pcBang.properties";
  8.  
  9.  
  10. Index: /Gs folder/java/l2justice/com/gameserver/PcPoint.java
  11. ===================================================================
  12. --- /Gs folder/java/l2justice/com/gameserver/PcPoint.java (revision 2031)
  13. +++ /Gs folder/java/l2justice/com/gameserver/PcPoint.java (revision `2031)
  14. @@ -0,0 +1,78 @@
  15. +package l2justice.com.gameserver;
  16. +
  17. +import java.util.logging.Logger;
  18. +
  19. +import net.sf.l2j.Config;
  20. +import net.sf.l2j.gameserver.model.L2World;
  21. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  22. +import net.sf.l2j.gameserver.network.SystemMessageId;
  23. +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  24. +import net.sf.l2j.util.Rnd;
  25. +
  26. +
  27. +/**
  28. + * @author Anumis
  29. + */
  30. +
  31. +public class PcPoint implements Runnable
  32. +{
  33. +   Logger _log = Logger.getLogger(PcPoint.class.getName());
  34. +   private static PcPoint _instance;
  35. +
  36. +   public static PcPoint getInstance()
  37. +   {
  38. +       if(_instance == null)
  39. +       {
  40. +           _instance = new PcPoint();
  41. +       }
  42. +
  43. +       return _instance;
  44. +   }
  45. +
  46. +   private PcPoint()
  47. +   {
  48. +       _log.info("PcBang point event started.");
  49. +   }
  50. +
  51. +   @Override
  52. +   public void run()
  53. +   {
  54. +
  55. +       int score = 0;
  56. +       for(L2PcInstance activeChar: L2World.getInstance().getAllPlayers())
  57. +       {
  58. +
  59. +           if(activeChar.getLevel() > Config.PCB_MIN_LEVEL )
  60. +           {
  61. +               score = Rnd.get(Config.PCB_POINT_MIN, Config.PCB_POINT_MAX);
  62. +
  63. +               if(Rnd.get(100) <= Config.PCB_CHANCE_DUAL_POINT)
  64. +               {
  65. +                   score *= 2;
  66. +
  67. +                   activeChar.addPcBangScore(score);
  68. +
  69. +                   SystemMessage sm = new SystemMessage(SystemMessageId.DOUBLE_POINTS_YOU_GOT_$51_GLASSES_PC);
  70. +                   sm.addNumber(score);
  71. +                   activeChar.sendPacket(sm);
  72. +                   sm = null;
  73. +
  74. +                   activeChar.updatePcBangWnd(score, true, true);
  75. +               }
  76. +               else
  77. +               {
  78. +                   activeChar.addPcBangScore(score);
  79. +
  80. +                   SystemMessage sm = new SystemMessage(SystemMessageId.YOU_RECEVIED_$51_GLASSES_PC);
  81. +                   sm.addNumber(score);
  82. +                   activeChar.sendPacket(sm);
  83. +                   sm = null;
  84. +
  85. +                   activeChar.updatePcBangWnd(score, true, false);
  86. +               }
  87. +           }
  88. +
  89. +           activeChar = null;
  90. +       }
  91. +   }
  92. +}
  93. Index: /Gs folder/java/net/sf/l2j/Config.java
  94. ===================================================================
  95. --- /Gs folder/java/net/sf/l2j/Config.java (revision 2028)
  96. +++ /Gs folder/java/net/sf/l2j/Config.java (revision 2031)
  97. @@ -1687,55 +1687,48 @@
  98.     public static int HPH_INTERVALOFDOOROFALTER;
  99.     public static int HPH_TIMEOFLOCKUPDOOROFALTAR;
  100. +       //============================================================
  101. +   public static boolean PCB_ENABLE;
  102. +   public static int PCB_MIN_LEVEL;
  103. +   public static int PCB_POINT_MIN;
  104. +   public static int PCB_POINT_MAX;
  105. +   public static int PCB_CHANCE_DUAL_POINT;
  106. +   public static int PCB_INTERVAL;
  107.  
  108.     //============================================================
  109. +   public static void loadPCBPointConfig()
  110.     {
  111.  
  112. +       final String PCB_POINT = FService.EVENT_PC_BANG_POINT_FILE;
  113.  
  114. +       _log.info("Loading: " + PCB_POINT + ".");
  115. +       try
  116. +       {
  117. +           Properties pcbpSettings = new Properties();
  118. +           InputStream is = new FileInputStream(new File(PCB_POINT));
  119. +           pcbpSettings.load(is);
  120. +           is.close();
  121.  
  122. +           PCB_ENABLE = Boolean.parseBoolean(pcbpSettings.getProperty("PcBangPointEnable", "true"));
  123. +           PCB_MIN_LEVEL = Integer.parseInt(pcbpSettings.getProperty("PcBangPointMinLevel", "20"));
  124. +           PCB_POINT_MIN = Integer.parseInt(pcbpSettings.getProperty("PcBangPointMinCount", "20"));
  125. +           PCB_POINT_MAX = Integer.parseInt(pcbpSettings.getProperty("PcBangPointMaxCount", "1000000"));
  126.  
  127. +           if(PCB_POINT_MAX < 1)
  128. +           {
  129. +               PCB_POINT_MAX = Integer.MAX_VALUE;
  130. +           }
  131.  
  132. +           PCB_CHANCE_DUAL_POINT = Integer.parseInt(pcbpSettings.getProperty("PcBangPointDualChance", "20"));
  133. +           PCB_INTERVAL = Integer.parseInt(pcbpSettings.getProperty("PcBangPointTimeStamp", "900"));
  134. +       }
  135. +       catch(Exception e)
  136. +       {
  137. +           e.printStackTrace();
  138. +           throw new Error("Failed to Load " + PCB_POINT + " File.");
  139. +       }
  140.  
  141. +   }
  142. +   //============================================================
  143. +  
  144.    
  145.  
  146. Index: /Gs folder/java/net/sf/l2j/gameserver/clientpackets/MultiSellChoose.java
  147. ===================================================================
  148. --- /Gs folder/java/net/sf/l2j/gameserver/clientpackets/MultiSellChoose.java (revision 107)
  149. +++ /Gs folder/java/net/sf/l2j/gameserver/clientpackets/MultiSellChoose.java (revision 2031)
  150. @@ -200,4 +200,9 @@
  151.                 {
  152.                     player.sendPacket(new SystemMessage(SystemMessageId.THE_CLAN_REPUTATION_SCORE_IS_TOO_LOW));
  153. +                   return;
  154. +               }
  155. +               if(e.getItemId() == 65436 && e.getItemCount() * _amount > player.getPcBangScore())
  156. +               {
  157. +                   player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
  158.                     return;
  159.                 }
  160. Index: /Gs folder/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
  161. ===================================================================
  162. --- /Gs folder/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 1726)
  163. +++ /Gs folder/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 2031)
  164. @@ -144,4 +144,5 @@
  165.             // activeChar.closeNetConnection();
  166.         }
  167. +  
  168.         if (activeChar.isGM())
  169.         {
  170. @@ -373,4 +374,5 @@
  171.             activeChar.checkAllowedSkills();
  172.         }
  173. +      
  174.         // send user info again .. just like the real client sendPacket(ui);
  175.         if ((activeChar.getClanId() != 0) && (activeChar.getClan() != null))
  176. @@ -396,4 +398,8 @@
  177.         notifyCastleOwner(activeChar);
  178.         activeChar.onPlayerEnter();
  179. +       if(Config.PCB_ENABLE)
  180. +       {
  181. +           activeChar.showPcBangWindow();
  182. +       }
  183.         TvTEvent.onLogin(activeChar);
  184.         PcColorTable.getInstance().process(activeChar);
  185. Index: /Gs folder/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java
  186. ===================================================================
  187. --- /Gs folder/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java (revision 7)
  188. +++ /Gs folder/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java (revision 2031)
  189. @@ -15,4 +15,6 @@
  190.  package net.sf.l2j.gameserver.network.serverpackets;
  191.  
  192. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  193. +
  194.  
  195.  
  196. @@ -25,13 +27,36 @@
  197.  {
  198.     private static final String _S__FE_31_EXPCCAFEPOINTINFO = "[S] FE:31 ExPCCafePointInfo";
  199. -   private int _unk1, _unk2, _unk3, _unk4, _unk5 = 0;
  200.  
  201. -   public ExPCCafePointInfo(int val1, int val2, int val3, int val4, int val5)
  202. +   private L2PcInstance _character;
  203. +   private int m_AddPoint;
  204. +   private int m_PeriodType;
  205. +   private int RemainTime;
  206. +   private int PointType;
  207. +
  208. +   public ExPCCafePointInfo(L2PcInstance user, int modify, boolean add, int hour, boolean _double)
  209.     {
  210. -       _unk1 = val1;
  211. -       _unk2 = val2;
  212. -       _unk3 = val3;
  213. -       _unk4 = val4;
  214. -       _unk5 = val5;
  215. +       _character = user;
  216. +       m_AddPoint = modify;
  217. +
  218. +       if(add)
  219. +       {
  220. +           m_PeriodType = 1;
  221. +           PointType = 1;
  222. +       }
  223. +       else
  224. +       {
  225. +           if(add && _double)
  226. +           {
  227. +               m_PeriodType = 1;
  228. +               PointType = 0;
  229. +           }
  230. +           else
  231. +           {
  232. +               m_PeriodType = 2;
  233. +               PointType = 2;
  234. +           }
  235. +       }
  236. +
  237. +       RemainTime = hour;
  238.     }
  239.  
  240. @@ -41,9 +66,9 @@
  241.         writeC(0xFE);
  242.         writeH(0x31);
  243. -       writeD(_unk1);
  244. -       writeD(_unk2);
  245. -       writeC(_unk3);
  246. -       writeD(_unk4);
  247. -       writeC(_unk5);
  248. +       writeD(_character.getPcBangScore());
  249. +       writeD(m_AddPoint);
  250. +       writeC(m_PeriodType);
  251. +       writeD(RemainTime);
  252. +       writeC(PointType);
  253.     }
  254.  
  255. @@ -56,3 +81,4 @@
  256.         return _S__FE_31_EXPCCAFEPOINTINFO;
  257.     }
  258. +
  259.  }
  260. Index: /Gs folder/java/net/sf/l2j/gameserver/network/SystemMessageId.java
  261. ===================================================================
  262. --- /Gs folder/java/net/sf/l2j/gameserver/network/SystemMessageId.java (revision 1926)
  263. +++ /Gs folder/java/net/sf/l2j/gameserver/network/SystemMessageId.java (revision 2031)
  264. @@ -3873,5 +3873,7 @@
  265.     DEATH_PENALTY_LIFTED(1917),
  266.     DUNGEON_EXPIRES_IN_S1_MINUTES(1918),
  267. -   S1(3000);
  268. +   S1(3000),
  269. +   DOUBLE_POINTS_YOU_GOT_$51_GLASSES_PC(3001),
  270. +   YOU_RECEVIED_$51_GLASSES_PC(3002);
  271.    
  272.     private int _id;
  273. Index: /Gs folder/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  274. ===================================================================
  275. --- /Gs folder/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 2029)
  276. +++ /Gs folder/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 2031)
  277. @@ -93,5 +93,4 @@
  278.  import net.sf.l2j.gameserver.model.L2Clan;
  279.  import net.sf.l2j.gameserver.model.L2ClanMember;
  280.  import net.sf.l2j.gameserver.model.L2Effect;
  281.  import net.sf.l2j.gameserver.model.L2Fishing;
  282. @@ -152,4 +151,5 @@
  283.  import net.sf.l2j.gameserver.network.L2GameClient;
  284.  import net.sf.l2j.gameserver.network.SystemMessageId;
  285. +import net.sf.l2j.gameserver.network.serverpackets.ExPCCafePointInfo;
  286.  import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket;
  287.  import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  288. @@ -234,6 +234,6 @@
  289.     private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC";
  290.     private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  291. -   private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,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=?,event_points=?,coupon=?,donator=?,death_penalty_level=?,koof=?,noob=?,idiot=? WHERE obj_id=?";
  292. -   private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,event_points,coupon,donator,death_penalty_level,koof,noob,idiot FROM characters WHERE obj_id=?";
  293. +   private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,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=?,event_points=?,coupon=?,donator=?,death_penalty_level=?,koof=?,noob=?,idiot=?,pc_point=? WHERE obj_id=?";
  294. +   private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,event_points,coupon,donator,death_penalty_level,koof,noob,idiot,pc_point FROM characters WHERE obj_id=?";
  295.     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";
  296.     private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
  297. @@ -382,4 +382,6 @@
  298.     /** The Experience of the L2PcInstance before the last Death Penalty */
  299.     private long _expBeforeDeath;
  300. +   /** PC BANG POINT */
  301. +   private int pcBangPoint = 0;
  302.     /**
  303.      * The Karma of the L2PcInstance (if higher than 0, the name of the L2PcInstance appears in red)
  304. @@ -6722,4 +6724,5 @@
  305.                 player.setCoupon(rset.getInt("coupon"));
  306.                 player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
  307. +               player.pcBangPoint = rset.getInt("pc_point");
  308.                 // Add the L2PcInstance object in _allObjects
  309.                 // L2World.getInstance().storeObject(player);
  310. @@ -7105,5 +7108,6 @@
  311.             statement.setInt(61, isNoob() ? 1 : 0);
  312.             statement.setInt(62, isIdiot() ? 1 : 0);
  313. -           statement.setInt(63, getObjectId());
  314. +           statement.setInt(63, getPcBangScore());
  315. +           statement.setInt(64, getObjectId());
  316.  
  317.  
  318. @@ -13002,9 +13006,32 @@
  319.         return (DM._started && _inEventDM) || (CTF._started && _inEventCTF) || (VIP._started && _inEventVIP) (Zombie._started && _ZombieZ) || && !isGM();
  320.     }*/
  321.  
  322. +       public int getPcBangScore()
  323. +       {
  324. +           return pcBangPoint;
  325. +       }
  326. +
  327. +       public void reducePcBangScore(int to)
  328. +       {
  329. +           pcBangPoint -= to;
  330. +           updatePcBangWnd(to, false, false);
  331. +       }
  332. +
  333. +       public void addPcBangScore(int to)
  334. +       {
  335. +           pcBangPoint += to;
  336. +       }
  337. +
  338. +       public void updatePcBangWnd(int score, boolean add, boolean duble)
  339. +       {
  340. +           ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, score, add, 24, duble);
  341. +           sendPacket(wnd);
  342. +       }
  343. +
  344. +       public void showPcBangWindow()
  345. +       {
  346. +           ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, 0, false, 24, false);
  347. +           sendPacket(wnd);
  348. +       }
  349.  }
  350. Index: /Gs folder/java/net/sf/l2j/gameserver/GameServer.java
  351. ===================================================================
  352. --- /Gs folder/java/net/sf/l2j/gameserver/GameServer.java (revision 1999)
  353. +++ /Gs folder/java/net/sf/l2j/gameserver/GameServer.java (revision 2031)
  354. @@ -24,7 +24,9 @@
  355.  import java.util.logging.Logger;
  356.  
  357. +import l2justice.com.gameserver.PcPoint;
  358.  import l2justice.com.gameserver.ai.special.manager.AILoader;
  359.  import l2justice.com.gameserver.powerpak.PowerPak;
  360.  import l2justice.com.gameserver.util.sql.SQLQueue;
  361. +
  362.  
  363.  import org.mmocore.network.*;
  364.  
  365. @@ -575,4 +572,9 @@
  366.         {
  367.             OnlinePlayers.getInstance();
  368. +       }
  369. +       if(Config.PCB_ENABLE)
  370. +       {
  371. +           System.out.println("############PCB_ENABLE################");
  372. +           ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(PcPoint.getInstance(), Config.PCB_INTERVAL * 1000, Config.PCB_INTERVAL * 1000);
  373.         }
  374.         Util.printSection("L2JJustice EventManager");
  375. @@ -612,4 +614,5 @@
  376.         // Initialize config
  377.         Config.load();
  378. +       Config.loadPCBPointConfig();
  379.         ExternalConfig.loadconfig();
  380.         gameServer = new GameServer();
  381. Index: /Gs folder/java/config/Custom/pcBang.properties
  382. ===================================================================
  383. --- /Gs folder/java/config/Custom/pcBang.properties (revision 2031)
  384. +++ /Gs folder/java/config/Custom/pcBang.properties (revision 2031)
  385. @@ -0,0 +1,17 @@                            
  386. +#============================================================#
  387. +# PC Bang Point                                        -#
  388. +#-------------------------------------------------------------#
  389. +BangPointEnable = True
  390. +
  391. +cBangPointMinLevel = 20
  392. +
  393. +PcBangPointMinCount = 20
  394. +PcBangPointMaxCount = 1000000
  395. +
  396. +PcBangPointDualChance = 20
  397. +
  398. +PcBangPointTimeStamp = 900
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement