Jump to content

GomerSim

Members
  • Posts

    4
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About GomerSim

Profile Information

  • Gender
    Not Telling

GomerSim's Achievements

Newbie

Newbie (1/16)

0

Reputation

  1. when i put any name in npc textbox nothing happen(don't have error's but don't have messages like "Admins and gms don't need to become famous,they already are " or "There isn't such character") , in database line in famousplayer and famousplayerVote is null :'(
  2. fix this bug(and fix it in previousmessage), now database work good. But if i put everything to npc, they now work :o and not add +1 when vote. Npc HTML =================================================================== --- datapack\data\html\default\65536.htm (revision 0) +++ datapack\data\html\default\65536.htm (revision 0) @@ -0,0 +1,11 @@ +<html> +<title>Famous Manager +</title> +<head> +<tittle> +<center> +<br> +CharName:<edit var="pname" width=40 height=20> +<center><button value="Vote" action="bypass -h npc_%objectId%_voteFamousPlayer $pname" width=204 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></center> +</body> +</html> \ No newline at end of file datapack config: Index: /config/fun/wedding.properties =================================================================== --- /config/fun/wedding.properties (revision 5585) +++ /config/fun/wedding.properties (working copy) @@ -132,3 +132,21 @@ # Cost of Divorce, % of Adena WeddingDivorceCosts = 20 # Give Wedding Bow WeddingGiveBow = True +#--------------------------------------------------------------- +# Famous system by fanky - +#--------------------------------------------------------------- +# Famous player's tittle +FamousPlayerTittle = Famous Player +# Famous player's name color +# by default FF0000 red by default +FamousPlayerNameColor = FF0000 +# How many pvp a player will need in order to vote? +PvPRequiredToVoteForFamous = 1 +# How many votes need a player to become famous? +VotesRequiredToBecomeFamous = 50 +# Announce famous players when they enter in game? +AnnounceFamousPlayers = True \ No newline at end of file
  3. Yes , i manualy edit all code to compatible with database and other server files My code, but they have bugs =(: ### Eclipse Workspace Patch 1.0 #P L2_GameServer_It Index: head-src\com\l2jfrozen\gameserver\model\actor\instance\L2PcInstance.java =================================================================== --- head-src\com\l2jfrozen\gameserver\model\actor\instance\L2PcInstance.java (revision 5585) +++ head-src\com\l2jfrozen\gameserver\model\actor\instance\L2PcInstance.java (working copy) @@ -36,6 +36,7 @@ import com.l2jfrozen.Config; import com.l2jfrozen.L2DatabaseFactory; import com.l2jfrozen.gameserver.model.entity.Announcements; import com.l2jfrozen.gameserver.GameTimeController; import com.l2jfrozen.gameserver.GeoData; import com.l2jfrozen.gameserver.GmListTable; @@ -159,6 +160,7 @@ import com.l2jfrozen.gameserver.serverpackets.ObservationReturn; import com.l2jfrozen.gameserver.serverpackets.PartySmallWindowUpdate; import com.l2jfrozen.gameserver.serverpackets.PetInventoryUpdate; import com.l2jfrozen.gameserver.serverpackets.PledgeShowInfoUpdate; import com.l2jfrozen.gameserver.serverpackets.PledgeShowMemberListDelete; import com.l2jfrozen.gameserver.serverpackets.PledgeShowMemberListUpdate; @@ -204,6 +206,45 @@ */ public final class L2PcInstance extends L2PlayableInstance { + // famous player + private String famousplayer = null; + private int famousplayerVotes = 0; + + public String getFamousPlayer() + { + return famousplayer; + } + + public void setFamousPlayer(String famousPlayer) + { + this.famousplayer = famousPlayer; + } + + public int getFamousPlayerVotes() + { + return famousplayerVotes; + } + + public void setFamousPlayerVotes(int famousPlayerVotes) + { + this.famousplayerVotes = famousPlayerVotes; + } + + private boolean _famous = false; + public boolean isFamous() + { + return _famous; + } + public void setFamous(boolean famous) + { + setTitle(Config.FAMOUS_PLAYER_TITTLE); + getAppearance().setNameColor(Config.FAMOUS_PLAYER_NAME_COLOR); + + famous = _famous; + } 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,skill_name,class_index) VALUES (?,?,?,?,?)"; private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?"; @@ -512,8 +253,8 @@ /** UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=? ,face=?,hairStyle=?,hairColor =?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have =?,rec_left=?,clanid=?,maxload =?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs =?,wantspeace=?,base_class =?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date =?,lvl_joined_academy =?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=? ,char_name=?,death_penalty_level=?,good=?,evil=?,gve_kills=? WHERE obj_id=?. */ - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,pc_point=?,name_color=?,title_color=?,aio=?,aio_end=? WHERE obj_id=?"; /** SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,good,evil,gve_kills FROM characters WHERE obj_id=?. */ //private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pc_point,banchat_time,name_color,title_color,first_log,aio,aio_end FROM characters WHERE obj_id=?"; - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon,punish_level,punish_timer,"+/* in_jail, jail_timer,*/ "newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pc_point"+/*,banchat_time*/",name_color,title_color,first_log,aio,aio_end FROM characters WHERE obj_id=?"; + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,pc_point=?,name_color=?,title_color=?,aio=?,aio_end=?,famousplayer=?,famousplayervotes=? WHERE obj_id=?"; + private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon,punish_level,punish_timer,"+/* in_jail, jail_timer,*/ "newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pc_point"+/*,banchat_time*/",name_color,title_color,first_log,aio,aio_end,famousplayer,famousplayervotes FROM characters WHERE obj_id=?"; @@ -6864,6 +6909,10 @@ player.setNewbie(rset.getInt("newbie") == 1); player.setNoble(rset.getInt("nobless") == 1); + + player.setFamousPlayer(rset.getString("famousPlayer")); + player.setFamousPlayerVotes(rset.getInt("famousPlayerVotes")); + player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time")); if (player.getClanJoinExpiryTime() < System.currentTimeMillis()) { @@ -7411,7 +7460,10 @@ statement.setLong(61, getAioEndTime()); - statement.setInt(62, getObjectId()); + statement.setString(62, getFamousPlayer()); + statement.setInt(63, getFamousPlayerVotes()); + statement.setInt(64, getObjectId()); Index: head-src\com\l2jfrozen\gameserver\model\actor\instance\L2FamousPlayerInstance.java =================================================================== --- head-src\com\l2jfrozen\gameserver\model\actor\instance\L2FamousPlayerInstance.java (revision 0) +++ head-src\com\l2jfrozen\gameserver\model\actor\instance\L2FamousPlayerInstance.java (revision 0) @@ -0,0 +1,149 @@ +/* + * 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.l2jfrozen.gameserver.model.actor.instance; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.List; +import java.util.StringTokenizer; + +import javolution.util.FastList; + +import com.l2jfrozen.Config; +import com.l2jfrozen.util.database.L2DatabaseFactory; +import com.l2jfrozen.gameserver.model.entity.Announcements; +import com.l2jfrozen.gameserver.model.L2World; +import com.l2jfrozen.gameserver.templates.L2NpcTemplate; + +/** + * @author fanky + * + */ +public class L2FamousPlayerInstance extends L2NpcInstance +{ + + + /** + * @param objectId + * @param template + */ + public L2FamousPlayerInstance(int objectId, L2NpcTemplate template) + { + super(objectId, template); + } + + public void onByPassFeedBack(L2PcInstance player,String command) + { + if (command.startsWith("voteFamousPlayer")) + { + String val = command.substring(14); + StringTokenizer st = new StringTokenizer(val); + + if(st.countTokens() != 1) + { + return; + } + + if (player.getFamousPlayer() != null) + { + player.sendMessage("You have already voted for a player, "+player.getFamousPlayer()+"."); + return; + } + if (player.isFamous()) + { + player.sendMessage("You are famous player,u cant vote"); + return; + } + L2PcInstance target = L2World.getInstance().getPlayer(st.nextToken()); + + if (target == null) + { + player.sendMessage("There isn't such character"); + return; + } + if (player.getAccessLevel() != null) + { + player.sendMessage("Admins and gms don't need to become famous,they already are :P"); + return; + } + if (target.getPvpKills() > Config.PVP_REQUIRED_TO_VOTE) + { + + target.setFamousPlayerVotes(target.getFamousPlayerVotes()+1); + player.sendMessage("You have successfully voted for "+target.getName()+"."); + target.sendMessage(player.getName()+" has voted for you to be a famous player,you currently have "+target.getFamousPlayerVotes()+" votes"); + if (target.getFamousPlayerVotes() == Config.VOTES_REQUIRED_TO_BECOME_FAMOUS) + { + target.setFamous(true); + Announcements.getInstance().announceToAll(target.getName()+" has become Famous Player because he reached "+Config.VOTES_REQUIRED_TO_BECOME_FAMOUS+" vote"); + target.setFamousPlayerVotes(0); + cleanDatabase(target.getName()); + target.sendMessage("You've become Famous player."); + } + else + { + target.sendMessage("You need at least "+Config.PVP_REQUIRED_TO_VOTE+" pvp(s) in order to vote"); + } + } + } + } + + private void cleanDatabase(String pname) + { + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement st = con.prepareStatement("UPDATE characters SET famousplayer=null WHERE famousplayer="+pname); + st.execute(); + st.close(); + } + catch (SQLException sqle) + { + for (L2PcInstance gmchat : L2World.getInstance().getAllGMs()) + { + gmchat.sendMessage("There was a problem while updating database on famousplayer column,Noobs!"); + } + } + finally + { + try + { + con.close(); + } + catch (SQLException sqle2) + { + + } + } + } + + @Override + public String getHtmlPath(int npcId, int val) + { + String pom = ""; + if (val == 0) + { + pom = "" + npcId; + } + else + { + pom = npcId + "-" + val; + } + + return "data/html/famousplayer/" + pom + ".htm"; + } +} Index: head-src\com\l2jfrozen\Config.java =================================================================== --- head-src\com\l2jfrozen\Config.java (revision 5585) +++ head-src\com\l2jfrozen\Config.java (working copy) @@ -882,6 +882,19 @@ public static boolean L2JMOD_WEDDING_SAMESEX; public static boolean L2JMOD_WEDDING_FORMALWEAR; public static int L2JMOD_WEDDING_DIVORCE_COSTS; + + // famous engine + public static String FAMOUS_PLAYER_TITTLE; + public static int FAMOUS_PLAYER_NAME_COLOR; + public static int PVP_REQUIRED_TO_VOTE; + public static int VOTES_REQUIRED_TO_BECOME_FAMOUS; + public static boolean ANNOUNCE_FAMOUS_PLAYER; // Packet information /** Count the a-beep-t of packets per minute ? */ @@ -1859,7 +1872,15 @@ L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(WeddingSettings.getProperty("WeddingFormalWear", "True")); L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(WeddingSettings.getProperty("WeddingDivorceCosts", "20")); WEDDING_GIVE_CUPID_BOW = Boolean.parseBoolean(WeddingSettings.getProperty("WeddingGiveBow", "False")); ANNOUNCE_WEDDING = Boolean.parseBoolean(WeddingSettings.getProperty("AnnounceWedding", "True")); + FAMOUS_PLAYER_TITTLE = WeddingSettings.getProperty("FamousPlayerTittle","Famous Player"); + FAMOUS_PLAYER_NAME_COLOR = Integer.decode("0x" + WeddingSettings.getProperty("FamousPlayerNameColor", "FFF000")); + PVP_REQUIRED_TO_VOTE = Integer.parseInt(WeddingSettings.getProperty("PvPRequiredToVoteForFamous","1")); + VOTES_REQUIRED_TO_BECOME_FAMOUS = Integer.parseInt(WeddingSettings.getProperty("VotesRequiredToBecomeFamous","50")); + ANNOUNCE_FAMOUS_PLAYER = Boolean.parseBoolean(WeddingSettings.getProperty("AnnounceFamousPlayers","True"));)); + Index: head-src\com\l2jfrozen\gameserver\handler\admincommandhandlers\AdminFamousPlayer.java =================================================================== --- head-src\com\l2jfrozen\gameserver\handler\admincommandhandlers\AdminFamousPlayer.java (revision 0) +++ head-src\com\l2jfrozen\gameserver\handler\admincommandhandlers\AdminFamousPlayer.java (revision 0) @@ -0,0 +1,63 @@ +/* + * 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.l2jfrozen.gameserver.handler.admincommandhandlers; + + import com.l2jfrozen.gameserver.model.entity.Announcements; +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; +import com.l2jfrozen.gameserver.model.L2Object; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author fanky + * + */ +public class AdminFamousPlayer +{ + + public static class AdminSetTeam implements IAdminCommandHandler + { + private static String[] _adminCommands = + { + "admin_setfamous" + }; + + @Override + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + + L2Object target = activeChar.getTarget(); + + if(activeChar.getTarget() instanceof L2PcInstance) + { + activeChar.setFamous(true); + ((L2PcInstance) target).sendMessage("Admin granted you with Famous status,thank him!"); + Announcements.getInstance().announceToAll("Admin granted with Famous status "+target.getName()+""); + { + activeChar.sendMessage("Are you tryin' to grand with famous status minions or npcs?Noob."); + return false; + } + + } + return true; + } + + + @Override + public String[] getAdminCommandList() + { + return _adminCommands; + } + } +} Index: head-src\com\l2jfrozen\gameserver\network\clientpackets\EnterWorld.java =================================================================== --- head-src\com\l2jfrozen\gameserver\network\clientpackets\EnterWorld.java (revision 5585) +++ head-src\com\l2jfrozen\gameserver\network\clientpackets\EnterWorld.java (working copy) @@ -286,11 +287,14 @@ Hero.getInstance().getHeroes().containsKey(activeChar.getObjectId())) activeChar.setHero(true); setPledgeClass(activeChar); //add char to online characters activeChar.setOnlineStatus(true); + if (Config.ANNOUNCE_FAMOUS_PLAYER) + { + if (activeChar.isFamous() + { + Announcements.getInstance().announceToAll("Famous player "+activeChar.getName()+" is currently online"); + } + } notifyFriends(activeChar); notifyClanMembers(activeChar); notifySponsorOrApprentice(activeChar);
  4. some one do this code at L2jFrozen? because i have error in GS:
×
×
  • Create New...