Jump to content

Gorion

Members
  • Posts

    89
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About Gorion

Contact Methods

  • Website URL
    http://www.lineage.votezone.eu/

Profile Information

  • Gender
    Not Telling
  • Country
    United Kingdom

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Gorion's Achievements

Newbie

Newbie (1/16)

1

Reputation

  1. List your server to become more visible and gain more players for the game you want. Website: VoteZone.eu
  2. Xmas Promotion - 50% off It's that time of the year once again. Use the code: XMAS to advertise your server on our website. Want more votes - be more visible! Add your server now!
  3. Website refreshed with new look Main: http://www.votezone.eu Lineage: http://www.lineage.votezone.eu Add your server and get discount on advert. First 5 members that register their new server will get free premium membership that is giving an access to many great features! Don't hesitate! JOIN NOW!
  4. Website: http://h5interlude.com Forum: http://h5interlude.com/forum/ Download: http://h5interlude.com/download/ Attention!!! We are glad to present you our new special server! This Server is made for all these players that love Interlude server and its features! We do love it as well, but we strongly believe that the Interlude client is far less enjoyable than High Five one. That is why we decided to merge the best of Interlude server site with the most practical client of High Five. Server is in BETA stage so all players wanted to test it are more than welcome!!! Some of the features below: General Server Rate: Experience: x1000 Spexperience: x1000 Party Experience: x1 Party Spexperience: x1 Adena: x1 Drop Item: x Safe Enchant + 3 Max Enchant + 16 Normal Scroll Chance: For Normal Scrolls we have progressive enchant system. You can enchant items using Normal Scrolls to max of +15, where on +1 your success rate is 100% and on +15 you have 25% chance. If your Scroll failed your enchant will be return to 0 and your item will be crystallization. If you want to enchant your item to +16, you MUST use Ancient Scroll Blessed Scroll Chance : 70% If you want to enchant your item to +16, you MUST use Ancient Scroll. When the enchant fails, it will stay on the level before last try to enchant. Ancient Scroll Chance : 30% You MUST use that scroll to enchant to +16 . When the enchant fails, it will stay on +15 Other features: H5 Weapons / Armors / Jewellery - All H5 Weapons and Armors including Jewellery are availableand have original High Five stats. Skills - Some of the skills have been disabled/removed for class balance. Also some skills from after Interlude have been removed Cloaks - No Stats added to Cloaks, they are purely for visual purpose only. No Shirts / No Belts / No Bracelets - They have been removed for balance. No Skill Transfer - They have been disabled for class balance. Server Buff System 32 Buff Slots + 4 Divine = 36 all together 16 Dance/Songs Slots 14 Triggered Slots Town Buff NPC: 2 Hour Buff Duration (You can choose between Normal Style and Scheme Style ) Custom NPC System Rank PvP System Rank System: Based on PvP System, it's mean, killer can earn exp for kill player, then he rise his rank too if earn 100%. (exp is based on current Rank Points [RP]). Default 42 ranks. Reward for rise up the Rank can be awarded for each level of Rank Points. Included images for ranks and exp bar Reward System: There is 2 reward types: for Legal Kill player, and for Legal Kill player with Rank. Each kill gives special currency called RPC, the RPC can be exchanged for items. Based on PvP System, killer can be rewarded for Legal Kill or not. Use .pvpinfo command on targeted player to find out all PvP/PK details Clan Reputatuin NPC - Easy to take clan reputation and up clan level Olympiad System: We use Retail like system Satrt - 18:00 End 12:00 Time Zone +0 Hero Period - 1 Weeks Anti feed/check olympiad system Subclass Features: No Quest Item request for Subclasses Max sub class per char = 3 Clan/Ally Features Clan/Ally/Clan Reputation sell in Custom Npc Max Clans in ally 3 No penalty when you leave or dismiss clan Banking System Wedding System Change Password Enables - type .changepassword voiced command which allows the players to change their account's password in game. Custom Command System .changepassword .pvpinfo Custom Features: All New Players will start level 85 All New Players will start with 100k Adena Custom Borad System - Give you extra information and few options Custom Farm Zone - The zone will give you farm coins exchange in Gm shop Augment Features: Mid-Grade Life Stone Skill Chance - 5% High-Grade Life Stone Skill Chance - 10% Top-Grade Life Stone Skill Chance - 15% Custom option for getting Augment of your choice Donation - We have implemented a new donate system Auto. You need just to login with your account,you choose the reward and you add the credits. Then go to shop/donation and choose reward. Remember your Char need to be offline to receive reward.
  5. Thanks, all is working fine for Freya l2j rev: 6291, l2jdp rev: 9641, just small adjustments I had to make to compile it. In L2MultiFunctionZone.java I had to change that: if ((items != null) && items.contains("" + item.getId())) to that: if ((items != null) && items.contains("" + item.getItemId())) and import some packets but eclipse fixed it :)
  6. I changed it to propertySplit1 but then I had other errors like below [javac] G:\workspace\L2J_Server\java\com\l2jserver\gameserver\model\actor\instance\L2PcInstance.java:5938: error: unreachable statement [javac] if (PkHunterEvent.isPk(killer) && !Config.DROP_PKHUNTEREVENT) [javac] ^ [javac] G:\workspace\L2J_Server\java\com\l2jserver\gameserver\GameServer.java:473: error: method load in class Config cannot be applied to given types; [javac] Config.load(); [javac] ^ [javac] required: String[] [javac] found: no arguments [javac] reason: actual and formal argument lists differ in length [javac] G:\workspace\L2J_Server\java\com\l2jserver\loginserver\L2LoginServer.java:94: error: method load in class Config cannot be applied to given types; [javac] Config.load(); [javac] ^ [javac] required: String[] [javac] found: no arguments [javac] reason: actual and formal argument lists differ in length [javac] G:\workspace\L2J_Server\java\com\l2jserver\tools\accountmanager\SQLAccountManager.java:55: error: method load in class Config cannot be applied to given types; [javac] Config.load(); [javac] ^ [javac] required: String[] [javac] found: no arguments [javac] reason: actual and formal argument lists differ in length [javac] G:\workspace\L2J_Server\java\com\l2jserver\tools\gsregistering\BaseGameServerRegister.java:306: error: method load in class Config cannot be applied to given types; [javac] Config.load(); [javac] ^ [javac] required: String[] [javac] found: no arguments [javac] reason: actual and formal argument lists differ in length [javac] Note: G:\workspace\L2J_Server\java\com\l2jserver\gameserver\instancemanager\AutoVoteRewardHandler.java uses or overrides a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] 5 errors
  7. this is from original file, see below. I tried to add "String[] propertySplit but it didnt work ENABLE_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePKHunterEvent", "True")); DROP_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("PKHunterEventDrop", "False")); PKHUNTEREVENT_CHANCE = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventChance", "20")); TIME_PKHUNTEREVENT = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventTime", "5")); if (PKHUNTEREVENT_CHANCE < 1) { PKHUNTEREVENT_CHANCE = 1; } PKHUNTEREVENT_REWARD = new ArrayList<>(); propertySplit = L2JModSettings.getProperty("PKHunterEventRewards", "14720,5;14721,2").split(";"); for (String reward : propertySplit) { String[] rewardSplit = reward.split(","); if (rewardSplit.length != 2) { _log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventRewards \"", reward, "\"")); } else { try { PKHUNTEREVENT_REWARD.add(new int[] { Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1]) }); } catch (NumberFormatException nfe) { if (!reward.isEmpty()) { _log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventRewards \"", reward, "\"")); } } } } PKHUNTEREVENT_PK_REWARD = new ArrayList<>(); propertySplit = L2JModSettings.getProperty("PKHunterEventPkRewards", "14720,5;14721,2").split(";"); for (String reward : propertySplit) { String[] rewardSplit = reward.split(","); if (rewardSplit.length != 2) { _log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventPkRewards \"", reward, "\"")); } else { try { PKHUNTEREVENT_PK_REWARD.add(new int[] { Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1]) }); } catch (NumberFormatException nfe) { if (!reward.isEmpty()) { _log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventPkRewards \"", reward, "\"")); } } } }
  8. I've got that error when compiling, any advise? Compiling 1667 source files to G:\workspace\L2J_Server\build\bin [javac] G:\workspace\L2J_Server\java\com\l2jserver\Config.java:2818: error: cannot assign a value to final variable propertySplit [javac] propertySplit = L2JModSettings.getProperty("PKHunterEventRewards", "14720,5;14721,2").split(";");
  9. Check that post, might help you, or use it because its working for both Topzone and Hopzone. http://www.maxcheaters.com/topic/126099-hi5-vote-reward-configurable-topzone-hopzone/page-4
  10. How can I modify ItemAuctionInstance.java to accept other currency than adena in H5? /* * Copyright (C) 2004-2013 L2J Server * * This file is part of L2J Server. * * L2J Server 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. * * L2J Server 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 com.l2jserver.gameserver.model.itemauction; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Date; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.logging.Logger; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import com.l2jserver.Config; import com.l2jserver.L2DatabaseFactory; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.datatables.CharNameTable; import com.l2jserver.gameserver.instancemanager.ItemAuctionManager; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance.ItemLocation; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.util.Rnd; import gnu.trove.map.hash.TIntObjectHashMap; public final class ItemAuctionInstance { protected static final Logger _log = Logger.getLogger(ItemAuctionInstance.class.getName()); private final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss dd.MM.yy"); private static final long START_TIME_SPACE = TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES); private static final long FINISH_TIME_SPACE = TimeUnit.MILLISECONDS.convert(10, TimeUnit.MINUTES); // SQL queries private static final String SELECT_AUCTION_ID_BY_INSTANCE_ID = "SELECT auctionId FROM item_auction WHERE instanceId = ?"; private static final String SELECT_AUCTION_INFO = "SELECT auctionItemId, startingTime, endingTime, auctionStateId FROM item_auction WHERE auctionId = ? "; private static final String DELETE_AUCTION_INFO_BY_AUCTION_ID = "DELETE FROM item_auction WHERE auctionId = ?"; private static final String DELETE_AUCTION_BID_INFO_BY_AUCTION_ID = "DELETE FROM item_auction_bid WHERE auctionId = ?"; private static final String SELECT_PLAYERS_ID_BY_AUCTION_ID = "SELECT playerObjId, playerBid FROM item_auction_bid WHERE auctionId = ?"; /** * Cached comparator to avoid initialization on each loop run. */ private static final Comparator<ItemAuction> itemAuctionComparator = new Comparator<ItemAuction>() { @Override public final int compare(final ItemAuction o1, final ItemAuction o2) { return Long.valueOf(o2.getStartingTime()).compareTo(Long.valueOf(o1.getStartingTime())); } }; private final int _instanceId; private final AtomicInteger _auctionIds; private final TIntObjectHashMap<ItemAuction> _auctions; private final ArrayList<AuctionItem> _items; private final AuctionDateGenerator _dateGenerator; private ItemAuction _currentAuction; private ItemAuction _nextAuction; private ScheduledFuture<?> _stateTask; public ItemAuctionInstance(final int instanceId, final AtomicInteger auctionIds, final Node node) throws Exception { _instanceId = instanceId; _auctionIds = auctionIds; _auctions = new TIntObjectHashMap<>(); _items = new ArrayList<>(); final NamedNodeMap nanode = node.getAttributes(); final StatsSet generatorConfig = new StatsSet(); for (int i = nanode.getLength(); i-- > 0;) { final Node n = nanode.item(i); if (n != null) { generatorConfig.set(n.getNodeName(), n.getNodeValue()); } } _dateGenerator = new AuctionDateGenerator(generatorConfig); for (Node na = node.getFirstChild(); na != null; na = na.getNextSibling()) { try { if ("item".equalsIgnoreCase(na.getNodeName())) { final NamedNodeMap naa = na.getAttributes(); final int auctionItemId = Integer.parseInt(naa.getNamedItem("auctionItemId").getNodeValue()); final int auctionLenght = Integer.parseInt(naa.getNamedItem("auctionLenght").getNodeValue()); final long auctionInitBid = Integer.parseInt(naa.getNamedItem("auctionInitBid").getNodeValue()); final int itemId = Integer.parseInt(naa.getNamedItem("itemId").getNodeValue()); final int itemCount = Integer.parseInt(naa.getNamedItem("itemCount").getNodeValue()); if (auctionLenght < 1) { throw new IllegalArgumentException("auctionLenght < 1 for instanceId: " + _instanceId + ", itemId " + itemId); } final StatsSet itemExtra = new StatsSet(); final AuctionItem item = new AuctionItem(auctionItemId, auctionLenght, auctionInitBid, itemId, itemCount, itemExtra); if (!item.checkItemExists()) { throw new IllegalArgumentException("Item with id " + itemId + " not found"); } for (final AuctionItem tmp : _items) { if (tmp.getAuctionItemId() == auctionItemId) { throw new IllegalArgumentException("Dublicated auction item id " + auctionItemId); } } _items.add(item); for (Node nb = na.getFirstChild(); nb != null; nb = nb.getNextSibling()) { if ("extra".equalsIgnoreCase(nb.getNodeName())) { final NamedNodeMap nab = nb.getAttributes(); for (int i = nab.getLength(); i-- > 0;) { final Node n = nab.item(i); if (n != null) { itemExtra.set(n.getNodeName(), n.getNodeValue()); } } } } } } catch (final IllegalArgumentException e) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction item", e); } } if (_items.isEmpty()) { throw new IllegalArgumentException("No items defined"); } try (Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID)) { ps.setInt(1, _instanceId); try (ResultSet rset = ps.executeQuery()) { while (rset.next()) { final int auctionId = rset.getInt(1); try { final ItemAuction auction = loadAuction(auctionId); if (auction != null) { _auctions.put(auctionId, auction); } else { ItemAuctionManager.deleteAuction(auctionId); } } catch (final SQLException e) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction: " + auctionId, e); } } } } catch (final SQLException e) { _log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed loading auctions.", e); return; } _log.log(Level.INFO, getClass().getSimpleName() + ": Loaded " + _items.size() + " item(s) and registered " + _auctions.size() + " auction(s) for instance " + _instanceId + "."); checkAndSetCurrentAndNextAuction(); } public final ItemAuction getCurrentAuction() { return _currentAuction; } public final ItemAuction getNextAuction() { return _nextAuction; } public final void shutdown() { final ScheduledFuture<?> stateTask = _stateTask; if (stateTask != null) { stateTask.cancel(false); } } private final AuctionItem getAuctionItem(final int auctionItemId) { for (int i = _items.size(); i-- > 0;) { final AuctionItem item = _items.get(i); if (item.getAuctionItemId() == auctionItemId) { return item; } } return null; } final void checkAndSetCurrentAndNextAuction() { final ItemAuction[] auctions = _auctions.values(new ItemAuction[0]); ItemAuction currentAuction = null; ItemAuction nextAuction = null; switch (auctions.length) { case 0: { nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE); break; } case 1: { switch (auctions[0].getAuctionState()) { case CREATED: { if (auctions[0].getStartingTime() < (System.currentTimeMillis() + START_TIME_SPACE)) { currentAuction = auctions[0]; nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE); } else { nextAuction = auctions[0]; } break; } case STARTED: { currentAuction = auctions[0]; nextAuction = createAuction(Math.max(currentAuction.getEndingTime() + FINISH_TIME_SPACE, System.currentTimeMillis() + START_TIME_SPACE)); break; } case FINISHED: { currentAuction = auctions[0]; nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE); break; } default: throw new IllegalArgumentException(); } break; } default: { Arrays.sort(auctions, itemAuctionComparator); // just to make sure we won`t skip any auction because of little different times final long currentTime = System.currentTimeMillis(); for (final ItemAuction auction : auctions) { if (auction.getAuctionState() == ItemAuctionState.STARTED) { currentAuction = auction; break; } else if (auction.getStartingTime() <= currentTime) { currentAuction = auction; break; // only first } } for (final ItemAuction auction : auctions) { if ((auction.getStartingTime() > currentTime) && (currentAuction != auction)) { nextAuction = auction; break; } } if (nextAuction == null) { nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE); } break; } } _auctions.put(nextAuction.getAuctionId(), nextAuction); _currentAuction = currentAuction; _nextAuction = nextAuction; if ((currentAuction != null) && (currentAuction.getAuctionState() != ItemAuctionState.FINISHED)) { if (currentAuction.getAuctionState() == ItemAuctionState.STARTED) { setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0L))); } else { setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0L))); } _log.log(Level.INFO, getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId); } else { setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0L))); _log.log(Level.INFO, getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId); } } public final ItemAuction getAuction(final int auctionId) { return _auctions.get(auctionId); } public final ItemAuction[] getAuctionsByBidder(final int bidderObjId) { final ItemAuction[] auctions = getAuctions(); final ArrayList<ItemAuction> stack = new ArrayList<>(auctions.length); for (final ItemAuction auction : getAuctions()) { if (auction.getAuctionState() != ItemAuctionState.CREATED) { final ItemAuctionBid bid = auction.getBidFor(bidderObjId); if (bid != null) { stack.add(auction); } } } return stack.toArray(new ItemAuction[stack.size()]); } public final ItemAuction[] getAuctions() { final ItemAuction[] auctions; synchronized (_auctions) { auctions = _auctions.values(new ItemAuction[0]); } return auctions; } private final class ScheduleAuctionTask implements Runnable { private final ItemAuction _auction; public ScheduleAuctionTask(final ItemAuction auction) { _auction = auction; } @Override public final void run() { try { runImpl(); } catch (final Exception e) { _log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed scheduling auction " + _auction.getAuctionId(), e); } } private final void runImpl() throws Exception { final ItemAuctionState state = _auction.getAuctionState(); switch (state) { case CREATED: { if (!_auction.setAuctionState(state, ItemAuctionState.STARTED)) { throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.STARTED.toString() + ", expected: " + state.toString()); } _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + _auction.getAuctionId() + " has started for instance " + _auction.getInstanceId()); checkAndSetCurrentAndNextAuction(); break; } case STARTED: { switch (_auction.getAuctionEndingExtendState()) { case EXTEND_BY_5_MIN: { if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL) { _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN); setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); return; } break; } case EXTEND_BY_3_MIN: { if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN) { _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN); setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); return; } break; } case EXTEND_BY_CONFIG_PHASE_A: { if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B) { _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B); setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); return; } break; } case EXTEND_BY_CONFIG_PHASE_B: { if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A) { _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A); setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); return; } } } if (!_auction.setAuctionState(state, ItemAuctionState.FINISHED)) { throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.FINISHED.toString() + ", expected: " + state.toString()); } onAuctionFinished(_auction); checkAndSetCurrentAndNextAuction(); break; } default: throw new IllegalStateException("Invalid state: " + state); } } } final void onAuctionFinished(final ItemAuction auction) { auction.broadcastToAllBiddersInternal(SystemMessage.getSystemMessage(SystemMessageId.S1_AUCTION_ENDED).addNumber(auction.getAuctionId())); final ItemAuctionBid bid = auction.getHighestBid(); if (bid != null) { final L2ItemInstance item = auction.createNewItemInstance(); final L2PcInstance player = bid.getPlayer(); if (player != null) { player.getWarehouse().addItem("ItemAuction", item, null, null); player.sendPacket(SystemMessageId.WON_BID_ITEM_CAN_BE_FOUND_IN_WAREHOUSE); _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + auction.getAuctionId() + " has finished. Highest bid by " + player.getName() + " for instance " + _instanceId); } else { item.setOwnerId(bid.getPlayerObjId()); item.setLocation(ItemLocation.WAREHOUSE); item.updateDatabase(); L2World.getInstance().removeObject(item); _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + auction.getAuctionId() + " has finished. Highest bid by " + CharNameTable.getInstance().getNameById(bid.getPlayerObjId()) + " for instance " + _instanceId); } // Clean all canceled bids auction.clearCanceledBids(); } else { _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + auction.getAuctionId() + " has finished. There have not been any bid for instance " + _instanceId); } } final void setStateTask(final ScheduledFuture<?> future) { final ScheduledFuture<?> stateTask = _stateTask; if (stateTask != null) { stateTask.cancel(false); } _stateTask = future; } private final ItemAuction createAuction(final long after) { final AuctionItem auctionItem = _items.get(Rnd.get(_items.size())); final long startingTime = _dateGenerator.nextDate(after); final long endingTime = startingTime + TimeUnit.MILLISECONDS.convert(auctionItem.getAuctionLength(), TimeUnit.MINUTES); final ItemAuction auction = new ItemAuction(_auctionIds.getAndIncrement(), _instanceId, startingTime, endingTime, auctionItem); auction.storeMe(); return auction; } private final ItemAuction loadAuction(final int auctionId) throws SQLException { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { int auctionItemId = 0; long startingTime = 0; long endingTime = 0; byte auctionStateId = 0; try (PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_INFO)) { ps.setInt(1, auctionId); try (ResultSet rset = ps.executeQuery()) { if (!rset.next()) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Auction data not found for auction: " + auctionId); return null; } auctionItemId = rset.getInt(1); startingTime = rset.getLong(2); endingTime = rset.getLong(3); auctionStateId = rset.getByte(4); } } if (startingTime >= endingTime) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Invalid starting/ending paramaters for auction: " + auctionId); return null; } final AuctionItem auctionItem = getAuctionItem(auctionItemId); if (auctionItem == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": AuctionItem: " + auctionItemId + ", not found for auction: " + auctionId); return null; } final ItemAuctionState auctionState = ItemAuctionState.stateForStateId(auctionStateId); if (auctionState == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Invalid auctionStateId: " + auctionStateId + ", for auction: " + auctionId); return null; } if ((auctionState == ItemAuctionState.FINISHED) && (startingTime < (System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(Config.ALT_ITEM_AUCTION_EXPIRED_AFTER, TimeUnit.DAYS)))) { _log.log(Level.INFO, getClass().getSimpleName() + ": Clearing expired auction: " + auctionId); try (PreparedStatement ps = con.prepareStatement(DELETE_AUCTION_INFO_BY_AUCTION_ID)) { ps.setInt(1, auctionId); ps.execute(); } try (PreparedStatement ps = con.prepareStatement(DELETE_AUCTION_BID_INFO_BY_AUCTION_ID)) { ps.setInt(1, auctionId); ps.execute(); } return null; } final ArrayList<ItemAuctionBid> auctionBids = new ArrayList<>(); try (PreparedStatement ps = con.prepareStatement(SELECT_PLAYERS_ID_BY_AUCTION_ID)) { ps.setInt(1, auctionId); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { final int playerObjId = rs.getInt(1); final long playerBid = rs.getLong(2); final ItemAuctionBid bid = new ItemAuctionBid(playerObjId, playerBid); auctionBids.add(bid); } } } return new ItemAuction(auctionId, _instanceId, startingTime, endingTime, auctionItem, auctionBids, auctionState); } } }
  11. adapted for High Five datapack rev. 9573, server rev. 5909 http://www.4shared.com/zip/UrLv3_Q-/AugmentShop.html? By the way, I tried to change it a bit so instead of destroying 1 Item for Augment, it will take 2 Items. But I had error: I made changes like below to AugmentShop.java Line 23 private final static int ITEM_ID = 50030; private final static int ITEM_COUNT = 10000; + private final static int ITEM_ID_2 = 50030; + private final static int ITEM_COUNT_2 = 500; private final static String qn = "AugmentShop"; private final static int NPC = 93000; ------------------------------------- Connection con = null; try { - player.destroyItemByItemId("Consume", ITEM_ID, ITEM_COUNT, player, true); + player.destroyItemByItemId("Consume", ITEM_ID, ITEM_ID_2, ITEM_COUNT, ITEM_COUNT_2, player, true); con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("REPLACE INTO item_attributes VALUES(?,?,?,?)"); statement.setInt(1, item.getObjectId()); statement.setInt(2, attribute*65536+1); statement.setInt(3, skill); statement.setInt(4, level); statement.executeUpdate(); player.sendMessage("Succesfully augmented. You have to relog now."); statement.close(); } but after that I'm getting error like that in the console and don't know how to make it work. I know what it means but not sure what and where should I add code in L2PcInstance.java or L2Object ---------- 1. ERROR in \custom\AugmentShop\AugmentShop.java (at line 110) player.destroyItemByItemId("Consume", ITEM_ID, ITEM_ID_2, ITEM_COUNT, IT EM_COUNT_2, player, true); ^^^^^^^^^^^^^^^^^^^ The method destroyItemByItemId(String, int, long, L2Object, boolean) in the type L2PcInstance is not applicable for the arguments (String, int, int, int, int, L 2PcInstance, boolean) ---------- 1 problem (1 error)The method destroyItemByItemId(java.lang.String, int, long, c om.l2jserver.gameserver.model.L2Object, boolean) in the type com.l2jserver.games erver.model.actor.instance.L2PcInstance is not applicable for the arguments (jav a.lang.String, int, int, int, int, com.l2jserver.gameserver.model.actor.instance .L2PcInstance, boolean) Failed executing script: G:\Test Server H5\game\data\scripts\custom\AugmentShop\ AugmentShop.java. See AugmentShop.java.error.log for details. I was thinking to add it here, but not sure: L2PcInstance.java: line 4036 * @return boolean informing if the action was successful */ @Override - public boolean destroyItemByItemId(String process, int itemId, long count, L2Object reference, boolean sendMessage) + public boolean destroyItemByItemId(String process, int itemId, long count, int itemId2, long count2, L2Object reference, boolean sendMessage) { if (itemId == PcInventory.ADENA_ID) { return reduceAdena(process, count, reference, sendMessage); } Any advise?
  12. For all that had a problem with this Vote Reward below is the proper code of AutoVoteRewardHandler.java that is working for both Topzone and Hopzone (rest of the files like in the 1st post: AutoVoteRewardHandler.java package com.l2jserver.gameserver.instancemanager; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import com.l2jserver.Config; import com.l2jserver.L2DatabaseFactory; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.clientpackets.Say2; import com.l2jserver.gameserver.network.serverpackets.CreatureSay; import com.l2jserver.gameserver.util.Broadcast; public class AutoVoteRewardHandler { private static Logger _log = Logger.getLogger(AutoVoteRewardHandler.class.getName()); private static final int initialCheck = 1 * 1000; private static final int delayForCheck = Config.DELAY_FOR_NEXT_REWARD * 1000; private static int lastVoteCount = 0; private AutoVoteRewardHandler() { _log.info("Vote Reward System: Vote reward system initiated."); if (Config.VOTE_REWARD_ENABLE) { load(); } ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck); } private class AutoReward implements Runnable { @Override public void run() { int votes = getVotes(Config.VOTE_HTML_PATCH); System.out.println("Server Votes: " + votes); if ((votes != 0) && (getLastVoteCount() != 0) && (votes >= (getLastVoteCount() + Config.VOTES_FOR_REWARD))) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT c.charId, c.char_name FROM characters AS c LEFT JOIN accounts AS a ON c.account_name = a.login WHERE c.online > 0 GROUP BY a.lastIP ORDER BY c.level DESC"); ResultSet rset = statement.executeQuery(); L2PcInstance player = null; L2ItemInstance item = null; L2ItemInstance item2 = null; while (rset.next()) { player = L2World.getInstance().getPlayer(rset.getInt("charId")); if ((player != null) && !player.getClient().isDetached()) { item = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID); if ((item == null) || (item.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM1)) { player.addItem("reward", Config.VOTE_REWARD1_ID, Config.VOTE_REWARD1_COUNT, player, true); } item2 = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID); if ((item2 == null) || (item2.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM1)) { player.addItem("reward", Config.VOTE_REWARD2_ID, Config.VOTE_REWARD2_COUNT, player, true); } } } setLastVoteCount(getLastVoteCount() + Config.VOTES_FOR_REWARD); statement.close(); _log.info("Vote Reward System: Reward for votes now!"); Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.CRITICAL_ANNOUNCE, "", "Vote Manager: Reward for players! Thanks for Vote.")); } catch (SQLException e) { e.printStackTrace(); } finally { L2DatabaseFactory.close(con); } setLastVoteCount(getLastVoteCount() + Config.VOTES_FOR_REWARD); } Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.CRITICAL_ANNOUNCE, "", "Vote Manager: Server votes: " + votes + " | Next Reward on " + (getLastVoteCount() + Config.VOTES_FOR_REWARD) + " Votes.")); if (getLastVoteCount() == 0) { setLastVoteCount(votes); } } } private int getVotes(String urlString) { URL url = null; InputStreamReader isr = null; BufferedReader in = null; try { url = new URL(urlString); URLConnection connection = url.openConnection(); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"); connection.connect(); InputStream response = connection.getInputStream(); isr = new InputStreamReader(response); in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { if (Config.VOTE_REWARD_TOPZONE_ENABLE) { // for TopZone // if (inputLine.contains("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\"")) if (inputLine.contains("Votes:")) { return Integer.valueOf(inputLine.split(">")[3].replace("</div", "")); } } if (Config.VOTE_REWARD_HOPZONE_ENABLE) { // for HopZone if (inputLine.contains("rank anonymous tooltip")) { @SuppressWarnings("unused") int Sub = 12; switch (inputLine.length()) { case 116: Sub = 13; break; case 117: Sub = 14; break; case 118: Sub = 15; break; case 119: Sub = 16; break; } return Integer.valueOf(inputLine.split(">")[2].replace("</span", "")); } } } } catch (IOException e) { _log.warning("Vote Reward System: " + e); } finally { try { in.close(); } catch (IOException e) { } try { isr.close(); } catch (IOException e) { } } return 0; } private void setLastVoteCount(int voteCount) { lastVoteCount = voteCount; } private int getLastVoteCount() { return lastVoteCount; } private void load() { int votes = 0; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT vote FROM votes LIMIT 1"); ResultSet rset = statement.executeQuery(); while (rset.next()) { votes = rset.getInt("vote"); } rset.close(); statement.close(); } catch (Exception e) { _log.log(Level.WARNING, "data error on vote: ", e); } finally { L2DatabaseFactory.close(con); } setLastVoteCount(votes); } public void save() { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE votes SET vote = ? WHERE id=1"); statement.setInt(1, getLastVoteCount()); statement.execute(); statement.close(); } catch (Exception e) { _log.log(Level.WARNING, "data error on vote: ", e); } finally { L2DatabaseFactory.close(con); } } public static AutoVoteRewardHandler getInstance() { return SingletonHolder._instance; } @SuppressWarnings("synthetic-access") private static class SingletonHolder { protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler(); } } Because the .sql file is dead I assume votes.sql shoul looks like that but not sure: -- ---------------------------- -- Table structure for `votes` -- ---------------------------- DROP TABLE IF EXISTS `votes`; CREATE TABLE `votes` ( `id` int(6) NOT NULL, `vote` int(6) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of votes -- ---------------------------- INSERT INTO votes VALUES ('1', '0');
  13. X-MAS PROMOTION !!! 50% discount, YES 50% DISCOUNT when you use this coupon code to place your server banner: DEC-DISC Promotion valid only till end of December!!! Place advert of your favourite server on L2VoteZone.eu Advert: http://www.ads.votezone.eu/lineage/ Lineage 2 Ranking: http://www.l2.votezone.eu/
×
×
  • Create New...