Jump to content

Rizel

Members
  • Posts

    271
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Rizel

  1. me too :) thats why my two favourite anime is Death Note and Code Geass..in these animes theres a lots of "strategy" and unexcepted turns :)
  2. again thanks for the answer Lavos Topic Locked to avoid spamming
  3. i think you will not find server host for free..nobody will share his server for free :\ however if you find one pm me:P
  4. thanks for the answer..we made a bet with one of my friend and i can't find the dates :S and i thought maybe someone interested too.
  5. hi all. when was the first lineage and the first world of warcraft release? :)
  6. i'm used to play on a low rate but now i prefer highrate becouse i'm bored of exp and haven't got much time to play
  7. my favourites are: Death Note and Code Geass.... ....and many others too xD
  8. it really looks very nice.. there's a lot of interesting custom features ;) if i'll have some time i'll take a look too :)
  9. if you set shuffle the players can't select between the two teams when you register to the event. the players will join randomly to the two teams when the event starts
  10. i'm waiting for the announcement too:) i'm interested who'll get the membergroup
  11. after i wrote the script i can't test it so i'm not sure if it works:S but if I'm right Intrepid tested it and it's worked for him but i'll look after it
  12. my code is long becouse the event,jail,siege etc. checks ,the SoE effect and the blockgoto function. this script is a modified .gotolove but here you not teleport to your partner but teleport to any player
  13. Hello. With this share (as the subject says) your players can teleport to other players for an item. Use the .goto <playername> command. You can set the item ID in teleportItem, the cost in teleportCost and the teleport time in the teleportTimer variables. You can allow/disallow players to teleport to you with the .blockgoto command. When you teleport to the player he/she got a system message about it. Tested on L2JFree 1.2.10. Credits to me. (but Intrepid helped a bit too:P) com.l2jfree.gameserver.handler.voicedcommandhandlers.GoToPlayer.java /* * 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 com.l2jfree.gameserver.handler.voicedcommandhandlers; import com.l2jfree.Config; import java.util.StringTokenizer; import com.l2jfree.gameserver.network.serverpackets.InventoryUpdate; import com.l2jfree.gameserver.GameTimeController; import com.l2jfree.gameserver.SevenSigns; import com.l2jfree.gameserver.ThreadPoolManager; import com.l2jfree.gameserver.ai.CtrlIntention; import com.l2jfree.gameserver.datatables.SkillTable; import com.l2jfree.gameserver.handler.IVoicedCommandHandler; import com.l2jfree.gameserver.instancemanager.CoupleManager; import com.l2jfree.gameserver.instancemanager.DimensionalRiftManager; import com.l2jfree.gameserver.instancemanager.SiegeManager; import com.l2jfree.gameserver.model.L2Character; import com.l2jfree.gameserver.model.L2FriendList; import com.l2jfree.gameserver.model.L2Skill; import com.l2jfree.gameserver.model.L2World; import com.l2jfree.gameserver.model.actor.instance.L2PcInstance; import com.l2jfree.gameserver.model.entity.Siege; import com.l2jfree.gameserver.model.zone.L2Zone; import com.l2jfree.gameserver.model.restriction.AvailableRestriction; import com.l2jfree.gameserver.model.restriction.ObjectRestrictions; import com.l2jfree.gameserver.network.SystemMessageId; import com.l2jfree.gameserver.network.serverpackets.ConfirmDlg; import com.l2jfree.gameserver.network.serverpackets.MagicSkillUse; import com.l2jfree.gameserver.network.serverpackets.SetupGauge; import com.l2jfree.gameserver.network.serverpackets.SystemMessage; import com.l2jfree.gameserver.util.Broadcast; /** * @author Rizel * */ public class GoToPlayer implements IVoicedCommandHandler { private static final String[] VOICED_COMMANDS = { "goto", "blockgoto" }; /* (non-Javadoc) * @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, com.l2jfree.gameserver.model.L2PcInstance), String) */ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String name) { if (command.startsWith("goto")) { return playerTeleport(activeChar, name); } if (command.startsWith("blockgoto")) { if ( activeChar._blockgoto == true ) { activeChar._blockgoto = false; activeChar.sendMessage("Players are now allowed to teleport to you!"); } if ( activeChar._blockgoto == false ) { activeChar._blockgoto = true; activeChar.sendMessage("Players are now not allowed to teleport to you!"); } return true; } return false; } public boolean playerTeleport(L2PcInstance activeChar, String name) { int teleportItem = 57; int teleportCost = 1000; if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted() || activeChar.isAlikeDead()) return false; Siege siege = SiegeManager.getInstance().getSiege(activeChar); // Check to see if the player is in olympiad. if (activeChar.isInOlympiadMode()) { activeChar.sendMessage("You are in Olympiad!"); return false; } // Check to see if the player is in observer mode else if (activeChar.inObserverMode()) { activeChar.sendMessage("You are in observer mode."); return false; } // Check to see if the player is in an event else if (activeChar.isInFunEvent()) { activeChar.sendMessage("You are in event now."); return false; } // Check to see if the player is in a festival. else if (activeChar.isFestivalParticipant()) { activeChar.sendMessage("You can't escape from a festival."); return false; } // Check to see if the player is in dimensional rift. else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift()) { activeChar.sendMessage("You are in the dimensional rift."); return false; } // Check to see if player is in jail else if (activeChar.isInJail() || activeChar.isInsideZone(L2Zone.FLAG_JAIL)) { activeChar.sendMessage("You can't escape from jail."); return false; } // Check if player is in Siege else if (siege != null && siege.getIsInProgress()) { activeChar.sendMessage("You are in siege, you can't go to your partner."); return false; } // Check if player is in Duel else if (activeChar.isInDuel()) { activeChar.sendMessage("You are in a duel!"); return false; } // Check if player is a Cursed Weapon owner else if (activeChar.isCursedWeaponEquipped()) { activeChar.sendMessage("You are currently holding a cursed weapon."); return false; } // Check if player is in a Monster Derby Track else if (activeChar.isInsideZone(L2Zone.FLAG_NOESCAPE)) { activeChar.sendMessage("You cannot escape from here."); return false; } L2PcInstance targetplayer = L2World.getInstance().getPlayer(name); if (targetplayer._blockgoto == true) { activeChar.sendMessage("Your target blocked the teleport to him/her."); return false; } if (targetplayer.isGM()) { activeChar.sendMessage("You can't teleport to GM."); return false; } if (targetplayer != null) { siege = SiegeManager.getInstance().getSiege(targetplayer); } else { activeChar.sendMessage("Your target is not online."); return false; } // Check to see if the player is in a instance. if (activeChar.getInstanceId() != targetplayer.getInstanceId()) { activeChar.sendMessage("Your target is in another World!"); return false; } else if (targetplayer.isInJail() || targetplayer.isInsideZone(L2Zone.FLAG_JAIL)) { activeChar.sendMessage("Your target is in jail."); return false; } else if (targetplayer.isInOlympiadMode()) { activeChar.sendMessage("Your target is in Olympiad now."); return false; } else if (targetplayer.inObserverMode()) { activeChar.sendMessage("Your target is in observer mode."); return false; } else if (targetplayer.isInDuel()) { activeChar.sendMessage("Your target is in a duel."); return false; } else if (targetplayer.isInFunEvent()) { activeChar.sendMessage("Your target is in an event."); return false; } else if (DimensionalRiftManager.getInstance().checkIfInRiftZone(targetplayer.getX(), targetplayer.getY(), targetplayer.getZ(), false)) { activeChar.sendMessage("Your target is in dimensional rift."); return false; } else if (targetplayer.isFestivalParticipant()) { activeChar.sendMessage("Your target is in a festival."); return false; } else if (siege != null && siege.getIsInProgress()) { if (targetplayer.getAppearance().getSex()) activeChar.sendMessage("Your target is in siege, you can't go to her."); else activeChar.sendMessage("Your target is in siege, you can't go to him."); return false; } else if (targetplayer.isCursedWeaponEquipped()) { activeChar.sendMessage("Your target is currently holding a cursed weapon."); return false; } else if (targetplayer.isInsideZone(L2Zone.FLAG_NOESCAPE)) { activeChar.sendMessage("Your target is in a unsuitable area for teleporting."); return false; } else if (targetplayer.isIn7sDungeon() && !activeChar.isIn7sDungeon()) { int playerCabal = SevenSigns.getInstance().getPlayerCabal(activeChar); boolean isSealValidationPeriod = SevenSigns.getInstance().isSealValidationPeriod(); int compWinner = SevenSigns.getInstance().getCabalHighestScore(); if (isSealValidationPeriod) { if (playerCabal != compWinner) { activeChar.sendMessage("Your target is in a Seven Signs Dungeon and you are not in the winner Cabal!"); return false; } } else { if (playerCabal == SevenSigns.CABAL_NULL) { activeChar.sendMessage("Your target is in a Seven Signs Dungeon and you are not registered!"); return false; } } } int teleportTimer = 10 * 1000; if (!activeChar.destroyItemByItemId("", teleportItem, teleportCost, activeChar, true)) { activeChar.sendMessage("You don't have enough item to teleport."); return false; } activeChar.sendMessage("After " + teleportTimer / 1000 + " sec. you will be teleported to " + name +"."); targetplayer.sendMessage("Player " + activeChar + "teleporting to you."); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); // SoE Animation section activeChar.setTarget(activeChar); activeChar.disableAllSkills(); MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, teleportTimer, 0); Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 810000/*900*/); SetupGauge sg = new SetupGauge(0, teleportTimer); activeChar.sendPacket(sg); // End SoE Animation section EscapeFinalizer ef = new EscapeFinalizer(activeChar, targetplayer.getX(), targetplayer.getY(), targetplayer.getZ(), targetplayer.isIn7sDungeon()); // Continue execution later activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, teleportTimer)); activeChar.forceIsCasting(GameTimeController.getGameTicks() + teleportTimer / GameTimeController.MILLIS_IN_TICK); return true; } private static class EscapeFinalizer implements Runnable { private L2PcInstance _activeChar; private int _partnerx; private int _partnery; private int _partnerz; private boolean _to7sDungeon; EscapeFinalizer(L2PcInstance activeChar, int x, int y, int z, boolean to7sDungeon) { _activeChar = activeChar; _partnerx = x; _partnery = y; _partnerz = z; _to7sDungeon = to7sDungeon; } public void run() { if (_activeChar.isDead()) return; _activeChar.setIsIn7sDungeon(_to7sDungeon); _activeChar.enableAllSkills(); _activeChar.setIsCastingNow(false); try { _activeChar.teleToLocation(_partnerx, _partnery, _partnerz); } catch (Exception e) { _log.error(e.getMessage(), e); } } } /* (non-Javadoc) * @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList() */ public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } com.l2jfree.gameserver.model.actor.instance.L2PcInstance.java public boolean _inEventTvT = false; public boolean _voteEvent = false; + public boolean _blockgoto = false; com.l2jfree.gameserver.handler.VoicedCommandHandler.java registerVoicedCommandHandler(new Banking()); + registerVoicedCommandHandler(new GoToPlayer());
  14. In L2JFree pack there is already exist a code to forbid resurrection in sieges: com.l2jfree.gameserver.handler.itemhandlers.ScrollOfResurrection.java if (targetPlayer != null || targetPet != null) { boolean condGood = true; // Check target is not in a active siege zone Siege siege = null; if (targetPlayer != null) siege = SiegeManager.getInstance().getSiege(targetPlayer); else siege = SiegeManager.getInstance().getSiege(targetPet); if (siege != null && siege.getIsInProgress()) { condGood = false; activeChar.sendPacket(SystemMessageId.CANNOT_BE_RESURRECTED_DURING_SIEGE); } siege = null;
  15. i don't see the point of unequiping jewels but i updated the post with jewels and underwear too
  16. I think you need to edit this part of the diff file: + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,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=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,trust_level=?,vote=? WHERE charId=?"; + private static final String RESTORE_CHARACTER = "SELECT account_name, charId, 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, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,trust_level,vote FROM characters WHERE charId=?"; in the last rev these 2 lines are different becouse the vitality system so the new lines: private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,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=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,trust_level=?,vitality_points=?,vote=? WHERE charId=?"; private static final String RESTORE_CHARACTER = "SELECT account_name, charId, 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, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,trust_level,vitality_points,vote FROM characters WHERE charId=?";
  17. i think it's work on IL too but it's not tested
  18. sorry i forgot to add this line to the post. post edited
  19. Hello. With this script ( as the subject says ) your players can vote for the next auto event. In the game you can use the .vote_tvt and .vote_ctf commands. I made it for L2JFree pack. / gameserver.model.entity.events.EventVoteVariable.java / /* * 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 com.l2jfree.gameserver.model.entity.events; /** * * @author Rizel * */ public class EventVoteVariable { public int _voteCountCTF = 0; public int _voteCountTvT = 0; private int _voteCount = 0; public int getVoteCount(String name) { if (name == "tvt") { _voteCount = _voteCountTvT; } if (name == "ctf") { _voteCount = _voteCountCTF; } return _voteCount; } public void increaseVoteCount(String name) { if (name == "tvt") { _voteCountTvT = _voteCountTvT+1; } if (name == "ctf") { _voteCountCTF = _voteCountCTF+1; } } } / gameserver.handler.voicedcommandhandlers.EventVote.java / /* * 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 com.l2jfree.gameserver.handler.voicedcommandhandlers; import com.l2jfree.Config; import com.l2jfree.gameserver.handler.IVoicedCommandHandler; import com.l2jfree.gameserver.model.actor.instance.L2PcInstance; import com.l2jfree.gameserver.model.entity.events.EventVoteVariable; import java.util.StringTokenizer; /** * * @author Rizel */ public class EventVote implements IVoicedCommandHandler { private static final String[] VOICED_COMMANDS = {"vote_tvt", "vote_ctf"}; /** * * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String) */ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { EventVoteVariable e = new EventVoteVariable(); if(command.startsWith("vote_tvt")) { if (activeChar._voteEvent == false) { e.increaseVoteCount("tvt"); activeChar._voteEvent = true; activeChar.sendMessage("You succesfully voted for the TvT event. TvT: " + e.getVoteCount("tvt") + " CTF: " + e.getVoteCount("ctf") + "."); } else { activeChar.sendMessage("You have already voted for an event."); } return true; } if(command.startsWith("vote_ctf")) { if (activeChar._voteEvent == false) { e.increaseVoteCount("ctf"); activeChar._voteEvent = true; activeChar.sendMessage("You succesfully voted for the CTF event. TvT: " + e.getVoteCount("tvt") + " CTF: " + e.getVoteCount("ctf") + "."); } else { activeChar.sendMessage("You have already voted for an event."); } return true; } return false; } /** * * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList() */ public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } / gameserver.model.entity.events.StartEvent.java / /* * 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 com.l2jfree.gameserver.model.entity.events; import com.l2jfree.tools.random.Rnd; import com.l2jfree.gameserver.model.entity.events.TvT; import com.l2jfree.gameserver.model.entity.events.CTF; import com.l2jfree.gameserver.model.entity.events.EventVoteVariable; /** * * @author Rizel * */ public class StartEvent { public static void startEvent() { EventVoteVariable e = new EventVoteVariable(); if (e.getVoteCount("tvt") > e.getVoteCount("ctf")) { TvT.loadData(); TvT.autoEvent(); } if (e.getVoteCount("ctf") > e.getVoteCount("tvt")) { CTF.loadData(); CTF.autoEvent(); } if (e.getVoteCount("tvt") == e.getVoteCount("ctf")) { if (Rnd.get(1) == 1) { TvT.loadData(); TvT.autoEvent(); } else { CTF.loadData(); CTF.autoEvent(); } } } } / gameserver.handler.VoicedCommandHandler.java / private VoicedCommandHandler() { _datatable = new FastMap<String, IVoicedCommandHandler>(); registerVoicedCommandHandler(new CastleDoors()); registerVoicedCommandHandler(new Hellbound()); registerVoicedCommandHandler(new Banking()); + registerVoicedCommandHandler(new EventVote()); / gameserver.model.entity.events.TvT.java / public static void cleanTvT() { _log.info("TvT : Cleaning players."); for (L2PcInstance player : _players) { if (player != null) { removePlayer(player); if (_savePlayers.contains(player.getName())) _savePlayers.remove(player.getName()); player._inEventTvT = false; + player._voteEvent = false; } } / gameserver.model.entity.events.CTF.java / public static void cleanCTF() { _log.info("CTF : Cleaning players."); for (L2PcInstance player : _players) { if (player != null) { if (player._haveFlagCTF) removeFlagFromPlayer(player); else player.getInventory().destroyItemByItemId("", CTF._FLAG_IN_HAND_ITEM_ID, 1, player, null); player._haveFlagCTF = false; removePlayer(player); if (_savePlayers.contains(player.getName())) _savePlayers.remove(player.getName()); player._inEventCTF = false; + player._voteEvent = false; } } / gameserver.model.actor.instance.L2PcInstance.java / /** TvT Engine parameters */ public String _teamNameTvT, _originalTitleTvT; public int _originalNameColorTvT, _countTvTkills, _countTvTdies, _originalKarmaTvT; public boolean _inEventTvT = false; + public boolean _voteEvent = false; / (server files) gameserver/data/scripts/cron/nextevent.py / import sys from com.l2jfree.gameserver.model.entity.events import StartEvent StartEvent.startEvent() / (server SQL) global_tasks / 4 jython TYPE_FIXED_SHEDULED 0 300000 3600000 nextevent.py Credits to me. Please reply if you find any bugs / errors.
  20. i don't really know how to write the php to be absolutely sure that the players really voted:S the php i used only asks the players name check when he last voted and brings up the topsite but i can't be sure that the player will enter the code and vote. if someone can write a php which solve this problem please post here:)
  21. If you want to prevent to some class use some kind of equipment (for example Titan with bow) you can use this script. You need to insert to network/clientpackets/UseItem.java the following lines: In this example the class is Duelist and the item type is robe armor. If you want the same with some kind of weapon you need to change the line if (item.getItemType() == L2ArmorType.MAGIC) to if (item.getItemType() == L2WeaponType.DAGGER) the available class-ids and item types are listed below. To prevent sub-class bugging i use this script to unequip all the armors/weapon/jewels on class changing: model/actor/instance/L2PcInstance.java [table][tr][td]Class ID-s:[/td][td]Item types[/td][/tr][tr][td]HUMANS -- 0=Human Fighter | 1=Warrior | 2=Gladiator | 3=Warlord | 4=Human Knight -- 5=Paladin | 6=Dark Avenger | 7=Rogue | 8=Treasure Hunter | 9=Hawkeye -- 10=Human Mystic | 11=Wizard | 12=Sorcerer/ss | 13=Necromancer | 14=Warlock -- 15=Cleric | 16=Bishop | 17=Prophet -- ELVES -- 18=Elven Fighter | 19=Elven Knight | 20=Temple Knight | 21=Swordsinger | 22=Elven Scout -- 23=Plainswalker | 24=Silver Ranger | 25=Elven Mystic | 26=Elven Wizard | 27=Spellsinger -- 28=Elemental Summoner | 29=Elven Oracle | 30=Elven Elder -- DARK ELVES -- 31=Dark Fighter | 32=Palus Knight | 33=Shillien Knight | 34=Bladedancer | 35=Assassin -- 36=Abyss Walker | 37=Phantom Ranger | 38=Dark Mystic | 39=Dark Wizard | 40=Spellhowler -- 41=Phantom Summoner | 42=Shillien Oracle | 43=Shillien Elder -- ORCS -- 44=Orc Fighter | 45=Orc Raider | 46=Destroyer | 47=Monk | 48=Tyrant -- 49=Orc Mystic | 50=Orc Shaman | 51=Overlord | 52=Warcryer -- DWARVES -- 53=Dwarven Fighter | 54=Scavenger | 55=Bounty Hunter | 56=Artisan | 57=Warsmith -- HUMANS 3rd Professions -- 88=Duelist | 89=Dreadnought | 90=Phoenix Knight | 91=Hell Knight | 92=Sagittarius -- 93=Adventurer | 94=Archmage | 95=Soultaker | 96=Arcana Lord | 97=Cardinal -- 98=Hierophant -- ELVES 3rd Professions -- 99=Evas Templar | 100=Sword Muse | 101=Wind Rider | 102=Moonlight Sentinel -- 103=Mystic Muse | 104=Elemental Master | 105=Evas Saint -- DARK ELVES 3rd Professions -- 106=Shillien Templar | 107=Spectral Dancer | 108=Ghost Hunter | 109=Ghost Sentinel -- 110=Storm Screamer | 111=Spectral Master | 112=Shillien Saint -- ORCS 3rd Professions -- 113=Titan | 114=Grand Khavatari -- 115=Dominator | 116=Doomcryer -- DWARVES 3rd Professions -- 117=Fortune Seeker | 118=Maestro -- KAMAELS -- 123=Male Soldier | 124=Female Soldier | 125=Trooper | 126=Warder -- 127=Berserker | 128=Male Soul Breaker | 129=Female Soul Breaker | 130=Arbalester -- 131=Doombringer | 132=Male Soul Hound | 133=Female Soul Hound | 134=Trickster -- 135=Inspector | 136=Judicator [/td][td]-Weapons- NONE (Shield) SWORD BLUNT DAGGER BOW POLE ETC FIST DUAL DUALFIST BIGSWORD (Two Handed Swords) PET ROD BIGBLUNT (Two handed blunt) ANCIENT_SWORD CROSSBOW RAPIER -Armors- HEAVY LIGHT MAGIC [/td][/tr][/table] Tested on L2JFree. I hope this share was usefull. and sorry for my bad english:P
  22. Hello. This is my first share on this forum:) This share is a 'simple' core mod to inspirate your players to vote to the server. I added a field to the characters table in the servers SQL. With Navicat (design table/ add field) the properties are: Name: 'vote' Type: 'int' Lenght: 10 Decimals: 0 Allow null:[ ] Default: 0 Unsigned: [x] After that apply the patch that i attached. This contains the diff file and 2 java files wich you have to copy to handler/voicedcommandhandlers/. After that compile the server core and you're done. You have to make a PHP script for your servers homepage for increase the character's vote field if he voted. In the game use the .vote voice command to see how many vote points you have and .change to change theese points to Glittering Medal. You can change the reward item-s id in VoteChange.java so you can give anything you want for the vote points. I use the Glittering Medal with a simple multisell NPC. Diff file: Index: D:/Eclipse/Core Version 1.2.6/src/main/java/com/l2jfree/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- D:/Eclipse/Core Version 1.2.6/src/main/java/com/l2jfree/gameserver/model/actor/instance/L2PcInstance.java (revision 4875) +++ D:/Eclipse/Core Version 1.2.6/src/main/java/com/l2jfree/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -267,8 +267,8 @@ private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE charId=? AND class_index=?"; // Character Character SQL String Definitions: - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,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=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,trust_level=? WHERE charId=?"; - private static final String RESTORE_CHARACTER = "SELECT account_name, charId, 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, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,trust_level FROM characters WHERE charId=?"; + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,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=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,trust_level=?,vote=? WHERE charId=?"; + private static final String RESTORE_CHARACTER = "SELECT account_name, charId, 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, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,trust_level,vote FROM characters WHERE charId=?"; // Character Subclass SQL String Definitions: private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE charId=? ORDER BY class_index ASC"; @@ -289,7 +289,9 @@ private static final String RESTORE_CHAR_RECOMS = "SELECT charId,target_id FROM character_recommends WHERE charId=?"; private static final String ADD_CHAR_RECOM = "INSERT INTO character_recommends (charId,target_id) VALUES (?,?)"; private static final String DELETE_CHAR_RECOMS = "DELETE FROM character_recommends WHERE charId=?"; - + private static final String RESTORE_CHAR_VOTE = "SELECT vote FROM characters WHERE charId=?"; + private static final String UPDATE_CHAR_VOTE = "UPDATE characters SET vote=? WHERE charId=?"; + // Character Transformation SQL String Definitions: private static final String SELECT_CHAR_TRANSFORM = "SELECT transform_id FROM characters WHERE charId=?"; private static final String UPDATE_CHAR_TRANSFORM = "UPDATE characters SET transform_id=? WHERE charId=?"; @@ -408,6 +410,10 @@ /** The number of player killed during a PvP (the player killed was PvP Flagged) */ private int _pvpKills; + + /** The number of the player's votes */ + + private int _voteCount; /** The PK counter of the L2PcInstance (= Number of non PvP Flagged player killed) */ private int _pkKills; @@ -2101,6 +2107,19 @@ return _pvpKills; } + + public int getVoteCount() + { + restoreVote(); + return _voteCount; + } + + public void setVoteCount(int vote) + { + _voteCount = vote; + updateVote(); + } + /** * Set the the PvP Kills of the L2PcInstance (Number of player killed during a PvP).<BR><BR> */ @@ -6794,7 +6813,8 @@ player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally")); player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level")); player.setTrustLevel(rset.getInt("trust_level")); - + player.setVoteCount(rset.getInt("vote")); + // Add the L2PcInstance object in _allObjects // L2World.getInstance().storeObject(player); @@ -7030,6 +7050,57 @@ finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } } + + private void restoreVote() + { + Connection con = null; + + try + { + con = L2DatabaseFactory.getInstance().getConnection(con); + PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_VOTE); + statement.setInt(1, getObjectId()); + ResultSet rset = statement.executeQuery(); + while (rset.next()) + { + _voteCount=(rset.getInt("vote")); + } + + rset.close(); + statement.close(); + } + catch (Exception e) + { + _log.error("could not restore vote: ", e); + } + finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } + } + + + private void updateVote() + { + + + + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(con); + PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_VOTE); + statement.setInt(1, _voteCount); + statement.setInt(2, getObjectId()); + + statement.execute(); + statement.close(); + } + catch (Exception e) + { + _log.fatal("Vote insert info: " + e); + } + finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } + } + + /** * Store recipe book data for this L2PcInstance, if not on an active sub-class. */ @@ -7203,7 +7274,8 @@ statement.setString(49, getName()); statement.setLong(50, getDeathPenaltyBuffLevel()); statement.setLong(51, getTrustLevel()); - statement.setInt(52, getObjectId()); + statement.setInt(52, getVoteCount()); + statement.setInt(53, getObjectId()); statement.execute(); statement.close(); } Index: D:/Eclipse/Core Version 1.2.6/src/main/java/com/l2jfree/gameserver/handler/VoicedCommandHandler.java =================================================================== --- D:/Eclipse/Core Version 1.2.6/src/main/java/com/l2jfree/gameserver/handler/VoicedCommandHandler.java (revision 4875) +++ D:/Eclipse/Core Version 1.2.6/src/main/java/com/l2jfree/gameserver/handler/VoicedCommandHandler.java (working copy) @@ -48,6 +48,8 @@ registerVoicedCommandHandler(new CastleDoors()); registerVoicedCommandHandler(new Hellbound()); registerVoicedCommandHandler(new VersionInfo()); + registerVoicedCommandHandler(new VoteCount()); + registerVoicedCommandHandler(new VoteChange()); if (Config.ALLOW_WEDDING) { registerVoicedCommandHandler(new Wedding()); handler/voicedcommandhandlers/VoteChange.java package com.l2jfree.gameserver.handler.voicedcommandhandlers; import com.l2jfree.gameserver.handler.IVoicedCommandHandler; import com.l2jfree.gameserver.model.actor.instance.L2PcInstance; /** * @author Rizel * */ public class VoteChange implements IVoicedCommandHandler { private static final String[] VOICED_COMMANDS = { "change" }; public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if (command.startsWith("change")) { if (activeChar.getVoteCount() == 0) { activeChar.sendMessage("You don't have any vote points."); return true; } else { activeChar.addItem("Loot", 6393, activeChar.getVoteCount(), activeChar, true); activeChar.sendMessage("You changed " + activeChar.getVoteCount() + " vote points to Medal!"); activeChar.setVoteCount(0); return true; } } return false; } public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } handler/voicedcommandhandlers/VoteCount.java package com.l2jfree.gameserver.handler.voicedcommandhandlers; import com.l2jfree.gameserver.handler.IVoicedCommandHandler; import com.l2jfree.gameserver.model.actor.instance.L2PcInstance; /** * @author Rizel * */ public class VoteCount implements IVoicedCommandHandler { private static final String[] VOICED_COMMANDS = { "vote" }; public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if (command.startsWith("vote")) { activeChar.sendMessage("Your vote points: " + activeChar.getVoteCount()); return true; } return false; } public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } The share tested on L2JFree. ::: Update ::: There was a few player who asked me to make a PHP for this system. Here are the .php files: http://www.4shared.com/file/89856652/81ab6709/votesystemphp.html You need to add a new column to characters table named votetime type int I can't test it so i'm not sure that it will work :S if you find any bugs pls reply
×
×
  • Create New...