-
Posts
7,281 -
Credits
0 -
Joined
-
Last visited
-
Days Won
2 -
Feedback
0%
Content Type
Articles
Profiles
Forums
Store
Everything posted by Fanky
-
Project Excalibur [To Server Devs Only]
Fanky replied to dony's topic in Server Development Discussion [L2J]
big ego. -
thanks.
-
req dev help gr l2j http://maxcheaters.com/forum/index.php?topic=249937.new#new
-
Paidia EPEIGON PLEASE
Fanky replied to falcone2's question in Request Server Development Help [Greek]
και να το είχε κάνεις πιστεύεις ότι θα στο έδεινε τζάμπα; κάποιοι έχουνε ρίξει πολύ δουλειά πάνω σε αυτό,και εσύ το ζητάς τζάμπα; bitch,please. -
[SHARE]Command for buffs like .fighterbuff or .magebuff
Fanky replied to SkySkase's topic in Server Shares & Files [L2J]
he didn't meant that oO -
[REQUEST] Adapt /change this code
Fanky replied to GsL's question in Request Server Development Help [L2J]
Ιt would be nice if you share the code with us instead of giving us a link to download it. are we supposed to download it in order to help you?:P post it here,please. -
Geisas ligw help se l2jfrozen
Fanky replied to billys160cc's question in Request Server Development Help [Greek]
Καλά ναι το έχετε βρει όλοι τώρα αυτό το ποιηματάκι. -
req dev help gr l2j http://maxcheaters.com/forum/index.php?topic=249930.0
-
Geisas ligw help se l2jfrozen
Fanky replied to billys160cc's question in Request Server Development Help [Greek]
υπάρχει στα config του φροζεν,κάτσε και ψάξε το. -
what proofs; lol. his work is placed here,search for. gl anyway
-
[Request] Event Engine
Fanky replied to pirama's question in Request Server Development Help [Greek]
Το event engine δεν είναι σαν να λες 'θέλω ένα pvp code'. Θέλει αρκετή δουλειά,πάρα πολλά τεστς,και φυσικά γνώση. Απο όσο ξέρω και του Rizel έχει κάποια bugs,ίσως για αυτό το έκανε share επειδή δεν μπορούσε πια να τα κάνει μόνος του όλα. -
True,thanks. About accesslevel,they can change it depens on their pack ;p
-
It should work. I coded from scrath,dunno if i miss something >.> but seems that I didnt. whatever,just report it here if it doesn't workin' properly.
-
It should work. I coded from scrath,dunno if i miss something >.> but seems that I didnt. whatever,just report it here if it doesn't workin' properly.
-
It should work. I coded from scrath,dunno if i miss something >.> but seems that I didnt. whatever,just report it here if it doesn't workin' properly.
-
Alright,I thought an idea today based on what I read some days ago in this forum(dunno where I read it,but somewhere in l2j sections). So I made a simple engine. About this engine: It's an npc which if you got x a-beep-t of pvps(configurable) you'll be able to vote for someone in order to be famous player. Famous player got(everything is configurable): [*]Color name [*]Announce when they are loggin' in game [*]Different tittle(stupid,but ok :P). In order to become famous you'll have to reach X votes(configurable),if you reach X votes then you'll become famous.Votes are saved in db,so don't worry. It got the basic checks,if you wanna add moar. It also includes an admincommand (//setfamous) but by this way if you grant someone with famous status after restarted he status will be removed(I did that on purpose,because I thought that in a pvp server you'll need some cool prizes but not permanent ones :P) So,here you are(excuse me for any mistake,I did that fast and I didn't test it at all). coded on clean l2j svn. gameserver: ### Eclipse Workspace Patch 1.0 #P L2_GameServer_It Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5585) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -36,6 +36,7 @@ import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.GameTimeController; import net.sf.l2j.gameserver.GeoData; import net.sf.l2j.gameserver.GmListTable; @@ -159,6 +160,7 @@ import net.sf.l2j.gameserver.serverpackets.ObservationReturn; import net.sf.l2j.gameserver.serverpackets.PartySmallWindowUpdate; import net.sf.l2j.gameserver.serverpackets.PetInventoryUpdate; import net.sf.l2j.gameserver.serverpackets.PledgeShowInfoUpdate; import net.sf.l2j.gameserver.serverpackets.PledgeShowMemberListDelete; import net.sf.l2j.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=?"; @@ -212,8 +253,8 @@ private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)"; private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC"; private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?"; - 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=?,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=? 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 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=?,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=?,,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, 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,famousplayer,famousplayervotes FROM characters WHERE obj_id=?"; private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC"; private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; @@ -257,6 +298,7 @@ 62 }; + /** * The Class AIAccessor. */ @@ -5484,7 +5526,10 @@ { // Add karma to attacker and increase its PK counter setPvpKills(getPvpKills() + 1); - // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter sendPacket(new UserInfo(this)); } @@ -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(54, getClanCreateExpiryTime()); statement.setString(55, getName()); statement.setLong(56, getDeathPenaltyBuffLevel()); - statement.setInt(57, getObjectId()); + statement.setString(57, getFamousPlayer()); + statement.setInt(58, getFamousPlayerVotes()); + statement.setInt(59, getObjectId()); + statement.execute(); statement.close(); @@ -9985,6 +10037,35 @@ return _duelState; } /** * Sets up the duel state using a non 0 duelId. * @param duelId 0=not in a duel Index: java/net/sf/l2j/gameserver/model/actor/instance/L2FamousPlayerInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2FamousPlayerInstance.java (revision 0) +++ java/net/sf/l2j/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 net.sf.l2j.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 net.sf.l2j.Config; +import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.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 (target.getAccessLevel() > 100) + { + 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: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 5585) +++ java/net/sf/l2j/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_SAMESEX = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False")); L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True")); L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20")); - + FAMOUS_PLAYER_TITTLE = L2JModSettings.getProperty("FamousPlayerTittle","Famous Player"); + FAMOUS_PLAYER_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("FamousPlayerNameColor", "FFF000")); + PVP_REQUIRED_TO_VOTE = Integer.parseInt(L2JModSettings.getProperty("PvPRequiredToVoteForFamous","1")); + VOTES_REQUIRED_TO_BECOME_FAMOUS = Integer.parseInt(L2JModSettings.getProperty("VotesRequiredToBecomeFamous","50")); + ANNOUNCE_FAMOUS_PLAYER = Boolean.parseBoolean(L2JModSettings.getProperty("AnnounceFamousPlayers","True")); + + if (TVT_EVENT_PARTICIPATION_NPC_ID == 0) { TVT_EVENT_ENABLED = false; Index: java/config/l2jmods.properties =================================================================== --- java/config/l2jmods.properties (revision 5585) +++ java/config/l2jmods.properties (working copy) @@ -132,3 +132,21 @@ # ex.: 1;2;3;4;5;6 # no ";" at the start or end TvTEventDoorsCloseOpenOnStartEnd = +#--------------------------------------------------------------- +# 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 Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminFamousPlayer.java =================================================================== --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminFamousPlayer.java (revision 0) +++ java/net/sf/l2j/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 net.sf.l2j.gameserver.handler.admincommandhandlers; + +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.handler.IAdminCommandHandler; +import net.sf.l2j.gameserver.model.L2Object; +import net.sf.l2j.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: java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 5585) +++ java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (working copy) @@ -251,6 +251,7 @@ SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar); Announcements.getInstance().showAnnouncements(activeChar); + Quest.playerEnter(activeChar); activeChar.sendPacket(new QuestList()); @@ -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); datapack: ### Eclipse Workspace Patch 1.0 #P IT_Datapack Index: datapack_development/sql/characters.sql =================================================================== --- datapack_development/sql/characters.sql (revision 9107) +++ datapack_development/sql/characters.sql (working copy) @@ -79,6 +79,8 @@ clan_join_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0, clan_create_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0, death_penalty_level int(2) NOT NULL DEFAULT 0, + famousplayer varchar(35) default NULL, + famousplayerVotes decimal(11,0) default NULL, PRIMARY KEY (obj_Id), KEY `clanid` (`clanid`) ) ; Index: datapack_development/data/html/65536.htm =================================================================== --- datapack_development/data/html/65536.htm (revision 0) +++ datapack_development/data/html/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 SQL: INSERT INTO npc (`id`, `idTemplate`, `name`, `serverSideName`, `title`, `serverSideTitle`, `class`, `collision_radius`, `collision_height`, `level`, `sex`, `type`, `attackrange`, `hp`, `mp`, `hpreg`, `mpreg`, `str`, `con`, `dex`, `int`, `wit`, `men`, `exp`, `sp`, `patk`, `pdef`, `matk`, `mdef`, `atkspd`, `aggro`, `matkspd`, `rhand`, `lhand`, `armor`, `walkspd`, `runspd`, `faction_id`, `faction_range`, `isUndead`, `absorb_level`, `absorb_type`) VALUES (65536, 31812, 'Famous Manager', 1, 'fanky', 1, 'NPC.a_casino_FDarkElf', 8.00, 23.00, 71, 'Female', 'L2Npc', 40, 3862, 1593, 21.00, 3.00, 40, 43, 35, 22, 24, 16, 0, 0, 1324, 471, 782, 383, 279, 0, 343, 0, 0, 0, 28, 132, '', 0, 0, 0, 'LAST_HIT'); if someone could test it and feedback me I would be grateful. kkthnxbb
-
Alright,I thought an idea today based on what I read some days ago in this forum(dunno where I read it,but somewhere in l2j sections). So I made a simple engine. About this engine: It's an npc which if you got x a-beep-t of pvps(configurable) you'll be able to vote for someone in order to be famous player. Famous player got(everything is configurable): [*]Color name [*]Announce when they are loggin' in game [*]Different tittle(stupid,but ok :P). In order to become famous you'll have to reach X votes(configurable),if you reach X votes then you'll become famous.Votes are saved in db,so don't worry. It got the basic checks,if you wanna add moar. It also includes an admincommand (//setfamous) but by this way if you grant someone with famous status after restarted he status will be removed(I did that on purpose,because I thought that in a pvp server you'll need some cool prizes but not permanent ones :P) So,here you are(excuse me for any mistake,I did that fast and I didn't test it at all). coded on clean l2j svn. gameserver: ### Eclipse Workspace Patch 1.0 #P L2_GameServer_It Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5585) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -36,6 +36,7 @@ import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.GameTimeController; import net.sf.l2j.gameserver.GeoData; import net.sf.l2j.gameserver.GmListTable; @@ -159,6 +160,7 @@ import net.sf.l2j.gameserver.serverpackets.ObservationReturn; import net.sf.l2j.gameserver.serverpackets.PartySmallWindowUpdate; import net.sf.l2j.gameserver.serverpackets.PetInventoryUpdate; import net.sf.l2j.gameserver.serverpackets.PledgeShowInfoUpdate; import net.sf.l2j.gameserver.serverpackets.PledgeShowMemberListDelete; import net.sf.l2j.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=?"; @@ -212,8 +253,8 @@ private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)"; private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC"; private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?"; - 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=?,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=? 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 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=?,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=?,,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, 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,famousplayer,famousplayervotes FROM characters WHERE obj_id=?"; private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC"; private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; @@ -257,6 +298,7 @@ 62 }; + /** * The Class AIAccessor. */ @@ -5484,7 +5526,10 @@ { // Add karma to attacker and increase its PK counter setPvpKills(getPvpKills() + 1); - // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter sendPacket(new UserInfo(this)); } @@ -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(54, getClanCreateExpiryTime()); statement.setString(55, getName()); statement.setLong(56, getDeathPenaltyBuffLevel()); - statement.setInt(57, getObjectId()); + statement.setString(57, getFamousPlayer()); + statement.setInt(58, getFamousPlayerVotes()); + statement.setInt(59, getObjectId()); + statement.execute(); statement.close(); @@ -9985,6 +10037,35 @@ return _duelState; } /** * Sets up the duel state using a non 0 duelId. * @param duelId 0=not in a duel Index: java/net/sf/l2j/gameserver/model/actor/instance/L2FamousPlayerInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2FamousPlayerInstance.java (revision 0) +++ java/net/sf/l2j/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 net.sf.l2j.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 net.sf.l2j.Config; +import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.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 (target.getAccessLevel() > 100) + { + 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: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 5585) +++ java/net/sf/l2j/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_SAMESEX = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False")); L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True")); L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20")); - + FAMOUS_PLAYER_TITTLE = L2JModSettings.getProperty("FamousPlayerTittle","Famous Player"); + FAMOUS_PLAYER_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("FamousPlayerNameColor", "FFF000")); + PVP_REQUIRED_TO_VOTE = Integer.parseInt(L2JModSettings.getProperty("PvPRequiredToVoteForFamous","1")); + VOTES_REQUIRED_TO_BECOME_FAMOUS = Integer.parseInt(L2JModSettings.getProperty("VotesRequiredToBecomeFamous","50")); + ANNOUNCE_FAMOUS_PLAYER = Boolean.parseBoolean(L2JModSettings.getProperty("AnnounceFamousPlayers","True")); + + if (TVT_EVENT_PARTICIPATION_NPC_ID == 0) { TVT_EVENT_ENABLED = false; Index: java/config/l2jmods.properties =================================================================== --- java/config/l2jmods.properties (revision 5585) +++ java/config/l2jmods.properties (working copy) @@ -132,3 +132,21 @@ # ex.: 1;2;3;4;5;6 # no ";" at the start or end TvTEventDoorsCloseOpenOnStartEnd = +#--------------------------------------------------------------- +# 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 Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminFamousPlayer.java =================================================================== --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminFamousPlayer.java (revision 0) +++ java/net/sf/l2j/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 net.sf.l2j.gameserver.handler.admincommandhandlers; + +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.handler.IAdminCommandHandler; +import net.sf.l2j.gameserver.model.L2Object; +import net.sf.l2j.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: java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 5585) +++ java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (working copy) @@ -251,6 +251,7 @@ SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar); Announcements.getInstance().showAnnouncements(activeChar); + Quest.playerEnter(activeChar); activeChar.sendPacket(new QuestList()); @@ -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); datapack: ### Eclipse Workspace Patch 1.0 #P IT_Datapack Index: datapack_development/sql/characters.sql =================================================================== --- datapack_development/sql/characters.sql (revision 9107) +++ datapack_development/sql/characters.sql (working copy) @@ -79,6 +79,8 @@ clan_join_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0, clan_create_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0, death_penalty_level int(2) NOT NULL DEFAULT 0, + famousplayer varchar(35) default NULL, + famousplayerVotes decimal(11,0) default NULL, PRIMARY KEY (obj_Id), KEY `clanid` (`clanid`) ) ; Index: datapack_development/data/html/65536.htm =================================================================== --- datapack_development/data/html/65536.htm (revision 0) +++ datapack_development/data/html/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 SQL: INSERT INTO npc (`id`, `idTemplate`, `name`, `serverSideName`, `title`, `serverSideTitle`, `class`, `collision_radius`, `collision_height`, `level`, `sex`, `type`, `attackrange`, `hp`, `mp`, `hpreg`, `mpreg`, `str`, `con`, `dex`, `int`, `wit`, `men`, `exp`, `sp`, `patk`, `pdef`, `matk`, `mdef`, `atkspd`, `aggro`, `matkspd`, `rhand`, `lhand`, `armor`, `walkspd`, `runspd`, `faction_id`, `faction_range`, `isUndead`, `absorb_level`, `absorb_type`) VALUES (65536, 31812, 'Famous Manager', 1, 'fanky', 1, 'NPC.a_casino_FDarkElf', 8.00, 23.00, 71, 'Female', 'L2Npc', 40, 3862, 1593, 21.00, 3.00, 40, 43, 35, 22, 24, 16, 0, 0, 1324, 471, 782, 383, 279, 0, 343, 0, 0, 0, 28, 132, '', 0, 0, 0, 'LAST_HIT'); if someone could test it and feedback me I would be grateful. kkthnxbb
-
Alright,I thought an idea today based on what I read some days ago in this forum(dunno where I read it,but somewhere in l2j sections). So I made a simple engine. About this engine: It's an npc which if you got x a-beep-t of pvps(configurable) you'll be able to vote for someone in order to be famous player. Famous player got(everything is configurable): [*]Color name [*]Announce when they are loggin' in game [*]Different tittle(stupid,but ok :P). In order to become famous you'll have to reach X votes(configurable),if you reach X votes then you'll become famous.Votes are saved in db,so don't worry. It got the basic checks,if you wanna add moar. It also includes an admincommand (//setfamous) but by this way if you grant someone with famous status after restarted he status will be removed(I did that on purpose,because I thought that in a pvp server you'll need some cool prizes but not permanent ones :P) So,here you are(excuse me for any mistake,I did that fast and I didn't test it at all). coded on clean l2j svn. gameserver: ### Eclipse Workspace Patch 1.0 #P L2_GameServer_It Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5585) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -36,6 +36,7 @@ import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.GameTimeController; import net.sf.l2j.gameserver.GeoData; import net.sf.l2j.gameserver.GmListTable; @@ -159,6 +160,7 @@ import net.sf.l2j.gameserver.serverpackets.ObservationReturn; import net.sf.l2j.gameserver.serverpackets.PartySmallWindowUpdate; import net.sf.l2j.gameserver.serverpackets.PetInventoryUpdate; import net.sf.l2j.gameserver.serverpackets.PledgeShowInfoUpdate; import net.sf.l2j.gameserver.serverpackets.PledgeShowMemberListDelete; import net.sf.l2j.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=?"; @@ -212,8 +253,8 @@ private static final String ADD_SKILL_SAVE = "INSERT INTO character_skills_save (char_obj_id,skill_id,skill_level,effect_count,effect_cur_time,reuse_delay,restore_type,class_index,buff_index) VALUES (?,?,?,?,?,?,?,?,?)"; private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC"; private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?"; - 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=?,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=? 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 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=?,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=?,,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, 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,famousplayer,famousplayervotes FROM characters WHERE obj_id=?"; private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC"; private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)"; private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?"; @@ -257,6 +298,7 @@ 62 }; + /** * The Class AIAccessor. */ @@ -5484,7 +5526,10 @@ { // Add karma to attacker and increase its PK counter setPvpKills(getPvpKills() + 1); - // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter sendPacket(new UserInfo(this)); } @@ -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(54, getClanCreateExpiryTime()); statement.setString(55, getName()); statement.setLong(56, getDeathPenaltyBuffLevel()); - statement.setInt(57, getObjectId()); + statement.setString(57, getFamousPlayer()); + statement.setInt(58, getFamousPlayerVotes()); + statement.setInt(59, getObjectId()); + statement.execute(); statement.close(); @@ -9985,6 +10037,35 @@ return _duelState; } /** * Sets up the duel state using a non 0 duelId. * @param duelId 0=not in a duel Index: java/net/sf/l2j/gameserver/model/actor/instance/L2FamousPlayerInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2FamousPlayerInstance.java (revision 0) +++ java/net/sf/l2j/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 net.sf.l2j.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 net.sf.l2j.Config; +import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.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 (target.getAccessLevel() > 100) + { + 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: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 5585) +++ java/net/sf/l2j/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_SAMESEX = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False")); L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True")); L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20")); - + FAMOUS_PLAYER_TITTLE = L2JModSettings.getProperty("FamousPlayerTittle","Famous Player"); + FAMOUS_PLAYER_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("FamousPlayerNameColor", "FFF000")); + PVP_REQUIRED_TO_VOTE = Integer.parseInt(L2JModSettings.getProperty("PvPRequiredToVoteForFamous","1")); + VOTES_REQUIRED_TO_BECOME_FAMOUS = Integer.parseInt(L2JModSettings.getProperty("VotesRequiredToBecomeFamous","50")); + ANNOUNCE_FAMOUS_PLAYER = Boolean.parseBoolean(L2JModSettings.getProperty("AnnounceFamousPlayers","True")); + + if (TVT_EVENT_PARTICIPATION_NPC_ID == 0) { TVT_EVENT_ENABLED = false; Index: java/config/l2jmods.properties =================================================================== --- java/config/l2jmods.properties (revision 5585) +++ java/config/l2jmods.properties (working copy) @@ -132,3 +132,21 @@ # ex.: 1;2;3;4;5;6 # no ";" at the start or end TvTEventDoorsCloseOpenOnStartEnd = +#--------------------------------------------------------------- +# 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 Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminFamousPlayer.java =================================================================== --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminFamousPlayer.java (revision 0) +++ java/net/sf/l2j/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 net.sf.l2j.gameserver.handler.admincommandhandlers; + +import net.sf.l2j.gameserver.Announcements; +import net.sf.l2j.gameserver.handler.IAdminCommandHandler; +import net.sf.l2j.gameserver.model.L2Object; +import net.sf.l2j.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: java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 5585) +++ java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (working copy) @@ -251,6 +251,7 @@ SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar); Announcements.getInstance().showAnnouncements(activeChar); + Quest.playerEnter(activeChar); activeChar.sendPacket(new QuestList()); @@ -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); datapack: ### Eclipse Workspace Patch 1.0 #P IT_Datapack Index: datapack_development/sql/characters.sql =================================================================== --- datapack_development/sql/characters.sql (revision 9107) +++ datapack_development/sql/characters.sql (working copy) @@ -79,6 +79,8 @@ clan_join_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0, clan_create_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0, death_penalty_level int(2) NOT NULL DEFAULT 0, + famousplayer varchar(35) default NULL, + famousplayerVotes decimal(11,0) default NULL, PRIMARY KEY (obj_Id), KEY `clanid` (`clanid`) ) ; Index: datapack_development/data/html/65536.htm =================================================================== --- datapack_development/data/html/65536.htm (revision 0) +++ datapack_development/data/html/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 SQL: INSERT INTO npc (`id`, `idTemplate`, `name`, `serverSideName`, `title`, `serverSideTitle`, `class`, `collision_radius`, `collision_height`, `level`, `sex`, `type`, `attackrange`, `hp`, `mp`, `hpreg`, `mpreg`, `str`, `con`, `dex`, `int`, `wit`, `men`, `exp`, `sp`, `patk`, `pdef`, `matk`, `mdef`, `atkspd`, `aggro`, `matkspd`, `rhand`, `lhand`, `armor`, `walkspd`, `runspd`, `faction_id`, `faction_range`, `isUndead`, `absorb_level`, `absorb_type`) VALUES (65536, 31812, 'Famous Manager', 1, 'fanky', 1, 'NPC.a_casino_FDarkElf', 8.00, 23.00, 71, 'Female', 'L2Npc', 40, 3862, 1593, 21.00, 3.00, 40, 43, 35, 22, 24, 16, 0, 0, 1324, 471, 782, 383, 279, 0, 343, 0, 0, 0, 28, 132, '', 0, 0, 0, 'LAST_HIT'); if someone could test it and feedback me I would be grateful. kkthnxbb
-
[Share]Announcements some members of server!!!
Fanky replied to Mit-sos's topic in Server Shares & Files [L2J]
yep. -
[Share]Announcements some members of server!!!
Fanky replied to Mit-sos's topic in Server Shares & Files [L2J]
yep. -
[Share]Announcements some members of server!!!
Fanky replied to Mit-sos's topic in Server Shares & Files [L2J]
yep. -
'hello members of mxc,i want you tell me if i can make some npcs's tittle green'
-
'hello members of mxc,i want you tell me if i can make some npcs's tittle green'
-
'hello members of mxc,i want you tell me if i can make some npcs's tittle green'
-
you are more random than a usual random