Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/CustomMods/Events/PcBangEvent.ini b/config/CustomMods/Events/PcBangEvent.ini
- index e69de29..a488caf 100644
- --- a/config/CustomMods/Events/PcBangEvent.ini
- +++ b/config/CustomMods/Events/PcBangEvent.ini
- @@ -0,0 +1,24 @@
- +#=============================================================
- +# Pc Bang Event
- +#=============================================================
- +#Enable Pc Bang events?
- +PcBangPointEnable = true
- +
- +#Min Level Adquired Pc Bang
- +PcBangPointMinLevel = 20
- +
- +#Minimum Reward Amount Pc Bang
- +PcBangPointMinCount = 10
- +
- +#Maximum Reward Amount Pc Bang
- +PcBangPointMaxCount = 10
- +
- +#Item ID Pc Bang Points, retail -> 65436
- +PCBCoinId = 65436
- +
- +#Chance To Double The Reward Pc Bang
- +PcBangPointDualChance = 0
- +
- +#How long to receive each reward Pc Bang
- +#Retail 3600 = 1 Hour
- +PcBangPointTimeStamp = 3600
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index 75b7cd9..95c380e 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -44,6 +44,7 @@
- public static final String OFFLINEMOD = "./config/CustomMods/OfflineShop.ini";
- public static final String PROTECTION_MODS = "./config/CustomMods/ProtectionMods.ini";
- public static final String DONATEMODS = "./config/CustomMods/Donate.ini";
- + public static final String PCBANGEVENT = "./config/CustomMods/Events/PcBangEvent.ini";
- // --------------------------------------------------
- // Clans settings
- // --------------------------------------------------
- @@ -74,6 +75,13 @@
- public static int BANKING_SYSTEM_ADENA;
- public static boolean ENABLE_COMMAND_GOLDBAR;
- public static boolean ENABLE_COMMAND_CASTLES;
- + public static int PCB_MIN_LEVEL;
- + public static int PCB_POINT_MIN;
- + public static int PCB_POINT_MAX;
- + public static int PCB_CHANCE_DUAL_POINT;
- + public static int PCB_INTERVAL;
- + public static int PCB_COIN_ID;
- + public static boolean PCB_ENABLE;
- /** Manor */
- public static int MANOR_REFRESH_TIME;
- public static int MANOR_REFRESH_MIN;
- @@ -1218,6 +1226,24 @@
- }
- + private static final void loadPcBangConfig()
- + {
- + final ExProperties PcBanG = initProperties(PCBANGEVENT);
- + PCB_ENABLE = Boolean.parseBoolean(PcBanG.getProperty("PcBangPointEnable", "true"));
- + PCB_MIN_LEVEL = Integer.parseInt(PcBanG.getProperty("PcBangPointMinLevel", "20"));
- + PCB_POINT_MIN = Integer.parseInt(PcBanG.getProperty("PcBangPointMinCount", "20"));
- + PCB_POINT_MAX = Integer.parseInt(PcBanG.getProperty("PcBangPointMaxCount", "1000000"));
- + PCB_COIN_ID = Integer.parseInt(PcBanG.getProperty("PCBCoinId", "0"));
- + if(PCB_POINT_MAX < 1)
- + {
- + PCB_POINT_MAX = Integer.MAX_VALUE;
- +
- + }
- + PCB_CHANCE_DUAL_POINT = Integer.parseInt(PcBanG.getProperty("PcBangPointDualChance", "20"));
- + PCB_INTERVAL = Integer.parseInt(PcBanG.getProperty("PcBangPointTimeStamp", "900"));
- +
- + }
- +
- private static final void loadDonate()
- {
- final ExProperties Donate = initProperties(DONATEMODS);
- @@ -1721,6 +1747,7 @@
- // NPCs/monsters settings
- loadNpcs();
- + loadPcBangConfig();
- loadSpecial();
- loadCommands();
- loadScheme();
- diff --git a/java/net/sf/l2j/gameserver/GameServer.java b/java/net/sf/l2j/gameserver/GameServer.java
- index fb95657..4c0ba28 100644
- --- a/java/net/sf/l2j/gameserver/GameServer.java
- +++ b/java/net/sf/l2j/gameserver/GameServer.java
- @@ -223,6 +223,13 @@
- RaidBossInfoManager.getInstance();
- IconTable.getInstance();
- + StringUtil.printSection("Events");
- + if(Config.PCB_ENABLE)
- + {
- + System.out.println("############PCB_ENABLE################");
- + ThreadPool.scheduleAtFixedRate(PcBang.getInstance(), Config.PCB_INTERVAL * 1000, Config.PCB_INTERVAL * 1000);
- + }
- +
- StringUtil.printSection("Auto Spawns");
- AutoSpawnTable.getInstance();
- diff --git a/java/net/sf/l2j/gameserver/PcBang.java b/java/net/sf/l2j/gameserver/PcBang.java
- new file mode 100644
- index 0000000..065127b
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/PcBang.java
- @@ -0,0 +1,64 @@
- +package net.sf.l2j.gameserver;
- +
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +
- +public class PcBang implements Runnable
- +{
- + Logger _log = Logger.getLogger(PcBang.class.getName());
- + private static PcBang _instance;
- +
- + public static PcBang getInstance()
- +
- + {
- + if(_instance == null)
- + {
- + _instance = new PcBang();
- + }
- +
- + return _instance;
- + }
- +
- + private PcBang()
- + {
- + _log.info("PcBang point event started.");
- + }
- +
- + @Override
- + public void run()
- + {
- +
- + int score = 0;
- + for (Player activeChar: World.getInstance().getPlayers())
- + {
- +
- + if(activeChar.getStatus().getLevel() > Config.PCB_MIN_LEVEL )
- + {
- + score = Rnd.get(Config.PCB_POINT_MIN, Config.PCB_POINT_MAX);
- +
- + if(Rnd.get(100) <= Config.PCB_CHANCE_DUAL_POINT)
- + {
- + score *= 2;
- +
- + activeChar.addPcBangScore(score);
- +
- + activeChar.sendMessage("Your PC Bang Point had doubled.");
- + activeChar.updatePcBangWnd(score, true, true);
- + }
- + else
- + {
- + activeChar.addPcBangScore(score);
- + activeChar.sendMessage("You recevied PC Bang Point.");
- + activeChar.updatePcBangWnd(score, true, false);
- + }
- + }
- +
- + activeChar = null;
- + }
- + }
- +}
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/gameserver/model/actor/Player.java b/java/net/sf/l2j/gameserver/model/actor/Player.java
- index 6c99cca..30d6a30 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/Player.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/Player.java
- @@ -160,6 +160,7 @@
- import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
- import net.sf.l2j.gameserver.network.serverpackets.ExAutoSoulShot;
- import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode;
- +import net.sf.l2j.gameserver.network.serverpackets.ExPCCafePointInfo;
- import net.sf.l2j.gameserver.network.serverpackets.ExServerPrimitive;
- import net.sf.l2j.gameserver.network.serverpackets.ExSetCompassZoneCode;
- import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
- @@ -238,7 +239,7 @@
- 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) 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=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,vip=?,vip_end=? WHERE obj_id=?";
- + 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=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,vip=?,vip_end=?,pc_point=? WHERE obj_id=?";
- private static final String RESTORE_CHARACTER = "SELECT * 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";
- @@ -4349,7 +4350,7 @@
- player.setDeathPenaltyBuffLevel(rs.getInt("death_penalty_level"));
- player.setVip(rs.getInt("vip") == 1 ? true : false);
- player.setVipEndTime(rs.getLong("vip_end"));
- -
- + player.setPcBang(rs.getInt("pc_point"));
- // Set the position of the Player.
- player.getPosition().set(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"), rs.getInt("heading"));
- @@ -4581,7 +4582,8 @@
- ps.setLong(46, getDeathPenaltyBuffLevel());
- ps.setInt(47, isVip() ? 1 : 0);
- ps.setLong(48, getVipEndTime());
- - ps.setInt(49, getObjectId());
- + ps.setInt(49, getPcBangScore());
- + ps.setInt(50, getObjectId());
- ps.execute();
- }
- @@ -7691,4 +7693,47 @@
- }
- }
- +
- + private int pcBangPoint = 0;
- + public int getPcBang()
- + {
- + return pcBangPoint;
- + }
- +
- + public void setPcBang(int val)
- + {
- + pcBangPoint = val;
- +
- + ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, 0, false, 24, false);
- + sendPacket(wnd);
- + }
- +
- +
- + public int getPcBangScore()
- + {
- + return pcBangPoint;
- + }
- +
- + public void reducePcBangScore(int to)
- + {
- + pcBangPoint -= to;
- + updatePcBangWnd(to, false, false);
- + }
- +
- + public void addPcBangScore(int to)
- + {
- + pcBangPoint += to;
- + }
- +
- + public void updatePcBangWnd(int score, boolean add, boolean duble)
- + {
- + ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, score, add, 24, duble);
- + sendPacket(wnd);
- + }
- +
- + public void showPcBangWindow()
- + {
- + ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, 0, false, 24, false);
- + sendPacket(wnd);
- + }
- }
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- index 9f6addd..be4efdf 100644
- --- a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- +++ b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- @@ -230,6 +230,11 @@
- player.sendPacket(SevenSignsManager.getInstance().getCurrentPeriod().getMessageId());
- AnnouncementData.getInstance().showAnnouncements(player, false);
- + if(Config.PCB_ENABLE)
- + {
- + player.showPcBangWindow();
- + }
- +
- if (Config.ALT_OLY_END_ANNOUNCE)
- {
- Olympiad.olympiadEnd(player);
- diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java b/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java
- index 04df5dc..12fe2db 100644
- --- a/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java
- +++ b/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java
- @@ -24,6 +24,7 @@
- // Special IDs.
- private static final int CLAN_REPUTATION = 65336;
- // private static final int PC_BANG_POINTS = 65436;
- + private static final int PC_BANG_POINTS = Config.PCB_COIN_ID;
- private int _listId;
- private int _entryId;
- @@ -192,6 +193,14 @@
- return;
- }
- }
- + else if (e.getItemId() == PC_BANG_POINTS)
- + {
- + if (player.getPcBang() < (e.getItemCount() * _amount))
- + {
- + player.sendMessage("You don't have enough Territory War Points.");
- + return;
- + }
- + }
- else
- {
- // if this is not a list that maintains enchantment, check the count of all items that have the given id.
- @@ -215,6 +224,11 @@
- player.getClan().takeReputationScore(amount);
- player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_DEDUCTED_FROM_CLAN_REP).addNumber(amount));
- }
- + else if (e.getItemId() == PC_BANG_POINTS)
- + {
- + int totalTWPoints = e.getItemCount() * _amount;
- + player.setPcBang(player.getPcBang()-totalTWPoints);
- + }
- else
- {
- ItemInstance itemToTake = inv.getItemByItemId(e.getItemId());
- @@ -299,6 +313,8 @@
- {
- if (e.getItemId() == CLAN_REPUTATION)
- player.getClan().addReputationScore(e.getItemCount() * _amount);
- + else if (e.getItemId() == PC_BANG_POINTS)
- + player.setPcBang(player.getPcBang()+(e.getItemCount()*_amount));
- else
- {
- if (e.isStackable())
- diff --git a/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java b/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java
- index 00458d2..4537420 100644
- --- a/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java
- +++ b/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java
- @@ -1,20 +1,41 @@
- package net.sf.l2j.gameserver.network.serverpackets;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +
- public class ExPCCafePointInfo extends L2GameServerPacket
- {
- - private final int _score;
- - private final int _modify;
- - private final int _remainingTime;
- - private final int _pointType;
- - private final int _periodType;
- + private Player _character;
- + private int m_AddPoint;
- + private int m_PeriodType;
- + private int RemainTime;
- + private int PointType;
- - public ExPCCafePointInfo(int score, int modify, boolean addPoint, boolean pointType, int remainingTime)
- + public ExPCCafePointInfo(Player user, int modify, boolean add, int hour, boolean _double)
- {
- - _score = score;
- - _modify = (addPoint) ? modify : modify * -1;
- - _remainingTime = remainingTime;
- - _pointType = (addPoint) ? (pointType ? 0 : 1) : 2;
- - _periodType = 1;
- + _character = user;
- + m_AddPoint = modify;
- +
- + if (add)
- + {
- + m_PeriodType = 1;
- + PointType = 1;
- + }
- + else
- + {
- + if (add && _double)
- + {
- + m_PeriodType = 1;
- + PointType = 0;
- + }
- + else
- + {
- + m_PeriodType = 2;
- + PointType = 2;
- + }
- + }
- +
- + RemainTime = hour;
- +
- }
- @Override
- @@ -22,10 +43,10 @@
- {
- writeC(0xFE);
- writeH(0x31);
- - writeD(_score);
- - writeD(_modify);
- - writeC(_periodType);
- - writeD(_remainingTime);
- - writeC(_pointType);
- + writeD(_character.getPcBangScore());
- + writeD(m_AddPoint);
- + writeC(m_PeriodType);
- + writeD(RemainTime);
- + writeC(PointType);
- }
- }
- \ No newline at end of file
- Datapack SQL executar no navicat na tabela characters
- + pc_point` int(5) NOT NULL DEFAULT '0',
Add Comment
Please, Sign In to add comment