Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 15)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -14,6 +14,8 @@
- */
- package net.sf.l2j.gameserver.network.clientpackets;
- +import java.util.Calendar;
- +
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.Announcements;
- import net.sf.l2j.gameserver.GameTimeController;
- @@ -233,6 +235,14 @@
- sendPacket(html);
- }
- + if (activeChar.getCustomHeroTime() == 0 || activeChar.getCustomHeroTime() > Calendar.getInstance().getTimeInMillis())
- + activeChar.setHero(true);
- + else
- + {
- + activeChar.setCustomHeroTime(-1);
- + activeChar.setHero(false);
- + }
- +
- PetitionManager.getInstance().checkPetitionMessages(activeChar);
- // no broadcast needed since the player will already spawn dead to others
- Index: java/devlin/custom/CustomHeroItem.java
- ===================================================================
- --- java/devlin/custom/CustomHeroItem.java (revision 0)
- +++ java/devlin/custom/CustomHeroItem.java (working copy)
- @@ -0,0 +1,45 @@
- +/*
- + * This program is free software: you can redistribute it and/or modify it under
- + * the terms of the GNU General Public License as published by the Free Software
- + * Foundation, either version 3 of the License, or (at your option) any later
- + * version.
- + *
- + * This program is distributed in the hope that it will be useful, but WITHOUT
- + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- + * details.
- + *
- + * You should have received a copy of the GNU General Public License along with
- + * this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package devlin.custom;
- +
- +import java.util.Calendar;
- +
- +import net.sf.l2j.gameserver.handler.IItemHandler;
- +import net.sf.l2j.gameserver.model.L2ItemInstance;
- +import net.sf.l2j.gameserver.model.actor.L2Playable;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + * @author Devlin
- + *
- + */
- +public class CustomHeroItem implements IItemHandler
- +{
- + @Override
- + public void useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
- + {
- + if (!(playable instanceof L2PcInstance))
- + return;
- + L2PcInstance player = (L2PcInstance) playable;
- +
- + // 86400000 = 1 Day.
- + long heroTime = Calendar.getInstance().getTimeInMillis() + 86400000;
- +
- + player.setCustomHeroTime(heroTime);
- + player.setHero(true);
- + player.broadcastUserInfo();
- + player.sendMessage("You have been blessed with the status of Hero.");
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 18)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -262,6 +262,18 @@
- _offlineShopStart = time;
- }
- + private long customHeroTime = -1;
- +
- + public long getCustomHeroTime()
- + {
- + return customHeroTime;
- + }
- +
- + public void setCustomHeroTime(long time)
- + {
- + customHeroTime = time;
- + }
- +
- // Character Skill SQL String Definitions:
- 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 (?,?,?,?)";
- @@ -276,8 +288,8 @@
- // Character SQL String Definitions:
- 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 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=?,custom_hero_time=? 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,custom_hero_time FROM characters WHERE obj_id=?";
- // Character Subclass SQL String Definitions:
- 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";
- @@ -5614,6 +5626,7 @@
- player.setPkKills(rset.getInt("pkkills"));
- player.setOnlineTime(rset.getLong("onlinetime"));
- player.setNoble(rset.getInt("nobless") == 1, false);
- + player.setCustomHeroTime(rset.getLong("custom_hero_time"));
- player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
- if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
- @@ -6054,7 +6067,8 @@
- statement.setLong(47, getClanCreateExpiryTime());
- statement.setString(48, getName());
- statement.setLong(49, getDeathPenaltyBuffLevel());
- - statement.setInt(50, getObjectId());
- + statement.setLong(50, getCustomHeroTime());
- + statement.setInt(51, getObjectId());
- statement.execute();
- statement.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement