diff --git a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/access_levels.sql b/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/access_levels.sql deleted file mode 100644 index f0b11c44ff..0000000000 --- a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/access_levels.sql +++ /dev/null @@ -1,78 +0,0 @@ --- How to configure the SQL based access level system : --- --- There are two tables. --- --- First one is named acess_levels and it's meant to define the different possible --- groups a GM can belong to. --- --- You can see in this table six predefined GM groups. Each group has a different --- accessLevel, and GM's access_level in the characters table should match with --- one of these. You could define as many groups as needed and give them whatever --- number you wanted to, from 1 to 255. Nevertheless please note the fact that --- there is one group that will be reserved for allmighty administrators, and this --- group is bound to the following rules: --- --- * There's no need/way to restrict the commands this group is able to run, its --- members will be able to perform ANY admin_command. --- --- * One number must be reserved for this group, and by default it is set to 127. --- --- * In order to change this default group number or its name/title colors, --- you should look at the Character.ini configuration file and --- change the value of MasterAccessLevel, MasterNameColor and MasterTitleColor --- respectively. --- --- * You should better not use this group as a part of any childs hierarchy. --- --- In our predefined set of examples, access_level=1 is for the highest admin, --- and access_level=3 is for Event GMs. --- --- The rest of the access_levels table columns are expected to be self explanatory. --- --- And there is a second table named admin_command_access_rights and in this table --- administrators should add every command they wanted GMs to use. --- --- We left just one query here to show how commands should be added to the table: --- --- INSERT IGNORE INTO `admin_command_access_rights` VALUES ('admin_admin','6'); --- --- If an administrator wanted to grant his GMs from group 4 the usage of the //para --- command, he should just copy our example and replace values like this: --- --- INSERT IGNORE INTO `admin_command_access_rights` VALUES ('admin_para','4'); --- --- So on, for each command there should be a record in this table. And it would be --- advisable to use one query per command to avoid messups ;) - --- --------------------------------- --- Table structure for access_levels --- --------------------------------- -CREATE TABLE IF NOT EXISTS `access_levels` ( - `accessLevel` MEDIUMINT(9) NOT NULL, - `name` VARCHAR(255) NOT NULL DEFAULT '', - `nameColor` CHAR(6) NOT NULL DEFAULT 'FFFFFF', - `useNameColor` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `titleColor` CHAR(6) NOT NULL DEFAULT 'FFFFFF', - `useTitleColor` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `isGm` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `allowPeaceAttack` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `allowFixedRes` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `allowTransaction` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `allowAltg` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `giveDamage` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `takeAggro` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `gainExp` TINYINT(1) unsigned NOT NULL DEFAULT '0', - `canDisableGmStatus` TINYINT(1) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`accessLevel`) -) DEFAULT CHARSET=utf8; --- ------------------------------- --- Records for table access_levels --- ------------------------------- - -INSERT IGNORE INTO `access_levels` VALUES -(1, 'Master Access', '0099FF', 1, '0099FF', 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), -(2, 'Head GM', '00FFFF', 1, '00FFFF', 0, 1, 1, 1, 1, 1, 1, 1, 1, 1), -(3, 'Event GM', '00FFFF', 1, '00FFFF', 0, 1, 1, 1, 0, 1, 0, 0, 0, 0), -(4, 'Support GM', '00FFFF', 1, '00FFFF', 0, 1, 0, 1, 0, 1, 0, 0, 0, 0), -(5, 'General GM', '00FFFF', 1, '00FFFF', 0, 1, 0, 1, 0, 1, 0, 0, 0, 0), -(6, 'Test GM', 'FFFFFF', 1, 'FFFFFF', 0, 0, 0, 1, 0, 1, 0, 0, 0, 0); \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/admin_command_access_rights.sql b/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/admin_command_access_rights.sql deleted file mode 100644 index e73a4514c2..0000000000 --- a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/admin_command_access_rights.sql +++ /dev/null @@ -1,641 +0,0 @@ --- ----------------------------------------------- --- Table structure for admin_command_access_rights --- ----------------------------------------------- -DROP TABLE IF EXISTS admin_command_access_rights; -CREATE TABLE IF NOT EXISTS `admin_command_access_rights` ( - `adminCommand` varchar(255) NOT NULL DEFAULT 'admin_', - `accessLevels` varchar(255) NOT NULL, - PRIMARY KEY (`adminCommand`) -) DEFAULT CHARSET=utf8; --- --------------------------------------------- --- Records for table admin_command_access_rights --- --------------------------------------------- - -INSERT IGNORE INTO `admin_command_access_rights` VALUES --- Section: Admin -('admin_admin','3'), -('admin_admin1','3'), -('admin_admin2','3'), -('admin_admin3','3'), -('admin_admin4','3'), -('admin_admin5','3'), -('admin_gmliston','3'), -('admin_gmlistoff','3'), -('admin_silence','3'), -('admin_diet','3'), -- means that player dnt take weight penalty -('admin_set','1'), -- Config.setParameterValue(pName, pValue) -('admin_set_menu','1'), -- Not Implemented -('admin_set_mod','3'), -('admin_saveolymp','2'), -('admin_manualhero','2'), - --- Section: Announcements -('admin_list_announcements','3'), -('admin_reload_announcements','3'), -('admin_announce_announcements','3'), -('admin_add_announcement','3'), -('admin_del_announcement','3'), -('admin_announce','3'), -('admin_critannounce','1'), -('admin_announce_menu','3'), -('admin_list_autoannouncements','3'), -('admin_add_autoannouncement','3'), -('admin_del_autoannouncement','3'), -('admin_autoannounce','3'), - --- Section: Ban -('admin_ban','2'), -('admin_unban','2'), -('admin_jail','3'), -('admin_unjail','3'), - --- Section: BanChat -('admin_banchat','3'), -('admin_unbanchat','3'), - --- Section: Buffs -('admin_getbuffs','3'), -- show all player buffs -('admin_stopbuff','3'), -- cancel just 1 buff -('admin_stopallbuffs','3'), -- cancel all player buffs -('admin_areacancel','3'), -- Cancel all area players buffs - --- Section: Cache -('admin_cache_htm_rebuild','1'), -('admin_cache_htm_reload','1'), -- reload all htmls cache -('admin_cache_reload_path','1'), -- reload just 1 html path -('admin_cache_reload_file','1'), -- reload just 1 html file -('admin_cache_crest_rebuild','1'), -- CrestCache.getInstance().reload(); -('admin_cache_crest_reload','1'), -- CrestCache.getInstance().reload(); -('admin_cache_crest_fix','1'), -- CrestCache.getInstance().convertOldPedgeFiles(); - --- Section: ChangeLevel -('admin_changelvl','2'), - --- Section: Christmas -('admin_christmas_start','3'), -('admin_christmas_end','3'), - --- Section: CreateItem -('admin_itemcreate','3'), -- itemcreation.htm -('admin_create_item','3'), -- lvl 3: item just on yourself, lvl 2-1: item on other too - --- Section: CTF -('admin_ctf','3'), -('admin_ctf_name','3'), -('admin_ctf_desc','3'), -('admin_ctf_join_loc','3'), -('admin_ctf_edit','3'), -('admin_ctf_control','3'), -('admin_ctf_minlvl','3'), -('admin_ctf_maxlvl','3'), -('admin_ctf_tele_npc','3'), -('admin_ctf_tele_team','3'), -('admin_ctf_tele_flag','3'), -('admin_ctf_npc','3'), -('admin_ctf_npc_pos','3'), -('admin_ctf_reward','3'), -('admin_ctf_reward_amount','3'), -('admin_ctf_team_add','3'), -('admin_ctf_team_remove','3'), -('admin_ctf_team_pos','3'), -('admin_ctf_team_color','3'), -('admin_ctf_team_flag','3'), -('admin_ctf_join','3'), -('admin_ctf_teleport','3'), -('admin_ctf_start','3'), -('admin_ctf_abort','3'), -('admin_ctf_finish','3'), -('admin_ctf_sit','3'), -('admin_ctf_dump','3'), -('admin_ctf_save','3'), -('admin_ctf_load','3'), -('admin_ctf_jointime','3'), -('admin_ctf_eventtime','3'), -('admin_ctf_autoevent','3'), -('admin_ctf_minplayers','3'), -('admin_ctf_maxplayers','3'), -('admin_ctf_interval','3'), - --- Section: CursedWeapons -('admin_cw_info','2'), -('admin_cw_remove','2'), -('admin_cw_goto','2'), -('admin_cw_reload','2'), -('admin_cw_add','2'), -('admin_cw_info_menu','3'), - --- Section: Delete -('admin_delete','3'), - --- Section: Disconnect -('admin_character_disconnect','2'), - --- Section: DMEngine -('admin_dmevent','3'), -('admin_dmevent_name','3'), -('admin_dmevent_desc','3'), -('admin_dmevent_join_loc','3'), -('admin_dmevent_minlvl','3'), -('admin_dmevent_maxlvl','3'), -('admin_dmevent_npc','3'), -('admin_dmevent_npc_pos','3'), -('admin_dmevent_reward','3'), -('admin_dmevent_reward_amount','3'), -('admin_dmevent_spawnpos','3'), -('admin_dmevent_color','3'), -('admin_dmevent_join','3'), -('admin_dmevent_teleport','3'), -('admin_dmevent_start','3'), -('admin_dmevent_abort','3'), -('admin_dmevent_finish','3'), -('admin_dmevent_sit','3'), -('admin_dmevent_dump','3'), -('admin_dmevent_save','3'), -('admin_dmevent_load','3'), - --- Section: Donator -('admin_setdonator','1'), - --- Section: DoorControl -('admin_open','3'), -('admin_close','3'), -('admin_openall','3'), -('admin_closeall','3'), - --- Section: EditChar -('admin_changename','2'), -('admin_edit_character','2'), -('admin_current_player','3'), -('admin_nokarma','2'), -('admin_setkarma','2'), -('admin_character_list','3'), -('admin_character_info','3'), -('admin_show_characters','3'), -('admin_find_character','3'), -('admin_find_dualbox','3'), -('admin_find_ip','3'), -('admin_find_account','3'), -('admin_save_modifications','2'), -('admin_rec','2'), -('admin_setclass','2'), -('admin_settitle','2'), -('admin_setsex','2'), -('admin_setcolor','2'), -('admin_fullfood','2'), -('admin_remclanwait','2'), -('admin_setcp','2'), -('admin_sethp','2'), -('admin_setmp','2'), -('admin_setchar_cp','2'), -('admin_setchar_hp','2'), -('admin_setchar_mp','2'), - --- Section: EditChar -('admin_edit_npc','2'), -('admin_save_npc','2'), -('admin_show_droplist','3'), -('admin_edit_drop','2'), -('admin_add_drop','2'), -('admin_del_drop','2'), -('admin_showShop','3'), -('admin_showShopList','3'), -('admin_addShopItem','2'), -('admin_delShopItem','2'), -('admin_box_access','2'), -('admin_editShopItem','2'), -('admin_close_window','3'), - --- Section: Effects -('admin_invis','3'), -('admin_invisible','3'), -('admin_vis','3'), -('admin_visible','3'), -('admin_invis_menu','3'), -('admin_invis_menu_main','3'), -('admin_earthquake','3'), -('admin_earthquake_menu','3'), -('admin_bighead','3'), -('admin_shrinkhead','3'), -('admin_gmspeed','3'), -('admin_superhaste','3'), -('admin_superhaste_menu','3'), -('admin_speed','3'), -('admin_speed_menu','3'), -('admin_hide','3'), -('admin_unpara_all','3'), -('admin_para_all','3'), -('admin_unpara','3'), -('admin_para','3'), -('admin_unpara_all_menu','3'), -('admin_para_all_menu','3'), -('admin_unpara_menu','3'), -('admin_para_menu','3'), -('admin_polyself','3'), -('admin_unpolyself','3'), -('admin_polyself_menu','3'), -('admin_unpolyself_menu','3'), -('admin_clearteams','3'), -('admin_setteam_close','3'), -- set all Gm close players to val team -('admin_setteam','3'), -('admin_social','3'), -('admin_effect','3'), -('admin_social_menu','3'), -('admin_effect_menu','3'), -('admin_abnormal','3'), -('admin_abnormal_menu','3'), -('admin_play_sounds','3'), -('admin_play_sound','3'), -('admin_shrinkhead','3'), -('admin_atmosphere','3'), -('admin_atmosphere_menu','3'), -('admin_npc_say','3'), -('admin_debuff','3'), - --- Section: Enchant -('admin_seteh','2'), -('admin_setec','2'), -('admin_seteg','2'), -('admin_setel','2'), -('admin_seteb','2'), -('admin_setew','2'), -('admin_setes','2'), -('admin_setle','2'), -('admin_setre','2'), -('admin_setlf','2'), -('admin_setrf','2'), -('admin_seten','2'), -('admin_setun','2'), -('admin_setba','2'), -('admin_enchant','2'), - --- Section: EventEngine -('admin_event','3'), -('admin_event_new','3'), -('admin_event_choose','3'), -('admin_event_store','3'), -('admin_event_set','3'), -('admin_event_change_teams_number','3'), -('admin_event_announce','3'), -('admin_event_panel','3'), -('admin_event_control_begin','3'), -('admin_event_control_teleport','3'), -('admin_add','3'), -('admin_event_see','3'), -('admin_event_del','3'), -('admin_delete_buffer','3'), -('admin_event_control_sit','3'), -('admin_event_name','3'), -('admin_event_control_kill','3'), -('admin_event_control_res','3'), -('admin_event_control_poly','3'), -('admin_event_control_unpoly','3'), -('admin_event_control_prize','3'), -('admin_event_control_chatban','3'), -('admin_event_control_finish','3'), - --- Section: ExpSp -('admin_add_exp_sp_to_character','2'), -('admin_add_exp_sp','2'), -('admin_remove_exp_sp','2'), - --- Section: FightCalculator -('admin_fight_calculator','3'), -('admin_fight_calculator_show','3'), -('admin_fcs','3'), - --- Section: FortSiege -('admin_fortsiege','2'), -('admin_add_fortattacker','2'), -('admin_add_fortdefender','2'), -('admin_add_fortguard','2'), -('admin_list_fortsiege_clans','3'), -('admin_clear_fortsiege_list','2'), -('admin_move_fortdefenders','2'), -('admin_spawn_fortdoors','2'), -('admin_endfortsiege','2'), -('admin_startfortsiege','2'), -('admin_setfort','2'), -('admin_removefort','2'), - --- Section: Geodata -('admin_geo_z','3'), -('admin_geo_type','3'), -('admin_geo_nswe','3'), -('admin_geo_los','3'), -('admin_geo_position','3'), -('admin_geo_bug','3'), -('admin_geo_load','3'), -('admin_geo_unload','3'), - --- Section: Gm -('admin_gm','1'), - --- Section: GmChat -('admin_gmchat','3'), -('admin_snoop','3'), -('admin_gmchat_menu','3'), - --- Section: Heal -('admin_heal','2'), - --- Section: HelpPage -('admin_help','3'), - --- Section: Hero -('admin_sethero','2'), - --- Section: Invul -('admin_invul','3'), -('admin_invul_main_menu','3'), -('admin_setinvul','2'), - --- Section: Kick -('admin_kick','2'), -('admin_kick_non_gm','1'), - --- Section: Kill -('admin_kill','3'), -('admin_kill_monster','2'), - --- Section: Level -('admin_add_level','2'), -('admin_set_level','2'), - --- Section: Login -('admin_server_gm_only','1'), -('admin_server_all','1'), -('admin_server_max_player','1'), -('admin_server_list_clock','1'), -('admin_server_login','1'), - --- Section: Mammon -('admin_mammon_find','2'), -('admin_mammon_respawn','2'), -('admin_list_spawns','2'), -('admin_msg','2'), - --- Section: Manor -('admin_manor','2'), -('admin_manor_reset','2'), -('admin_manor_save','2'), -('admin_manor_disable','2'), - --- Section: MassControl -('admin_masskill','3'), -('admin_massress','3'), - --- Section: MassRecall -('admin_recallclan','3'), -('admin_recallparty','3'), -('admin_recallally','3'), - --- Section: Menu -('admin_char_manage','2'), -('admin_teleport_character_to_menu','3'), -('admin_recall_char_menu','3'), -('admin_recall_party_menu','3'), -('admin_recall_clan_menu','3'), -('admin_goto_char_menu','3'), -('admin_kick_menu','2'), -('admin_kill_menu','3'), -('admin_ban_menu','2'), -('admin_unban_menu','2'), - --- Section: MobMenu -('admin_mobmenu','2'), -('admin_mobgroup_list','2'), -('admin_mobgroup_create','2'), -('admin_mobgroup_remove','2'), -('admin_mobgroup_delete','2'), -('admin_mobgroup_spawn','2'), -('admin_mobgroup_unspawn','2'), -('admin_mobgroup_kill','2'), -('admin_mobgroup_idle','2'), -('admin_mobgroup_attack','2'), -('admin_mobgroup_rnd','2'), -('admin_mobgroup_return','2'), -('admin_mobgroup_follow','2'), -('admin_mobgroup_casting','2'), -('admin_mobgroup_nomove','2'), -('admin_mobgroup_attackgrp','2'), -('admin_mobgroup_invul','2'), -('admin_mobinst','2'), - --- Section: MonsterRace -('admin_mons','2'), - --- Section: Noble -('admin_setnoble','2'), - --- Section: Petitions -('admin_view_petitions','3'), -('admin_view_petition','3'), -('admin_accept_petition','3'), -('admin_reject_petition','3'), -('admin_reset_petitions','3'), - --- Section: PForge -- forge packets -('admin_forge','1'), -('admin_forge2','1'), -('admin_forge3','1'), - --- Section: Pledge -('admin_pledge','2'), -- Manage Clan - --- Section: Polymorph -('admin_polymorph','2'), -('admin_unpolymorph','2'), -('admin_polymorph_menu','2'), -('admin_unpolymorph_menu','2'), - --- Section: Quest -('admin_quest_reload','2'), - --- Section: Reload -('admin_reload','2'), - --- Section: RepairChar -('admin_restore','2'), -('admin_repair','2'), - --- Section: Res -('admin_res','3'), -('admin_res_monster','3'), - --- Section: RideWyvern -('admin_ride_wyvern','3'), -('admin_ride_strider','3'), -('admin_unride_wyvern','3'), -('admin_unride_strider','3'), -('admin_unride','3'), - --- Section: Script -('admin_load_script','2'), - --- Section: Shop -- Must be modified the Trade option.. -('admin_buy','3'), -('admin_gmshop','3'), - --- Section: Shutdown -('admin_server_shutdown','2'), -('admin_server_restart','2'), -('admin_server_abort','2'), - --- Section: Siege -('admin_siege','2'), -('admin_add_attacker','2'), -('admin_add_defender','2'), -('admin_add_guard','2'), -('admin_list_siege_clans','2'), -('admin_clear_siege_list','2'), -('admin_move_defenders','2'), -('admin_spawn_doors','2'), -('admin_endsiege','2'), -('admin_startsiege','2'), -('admin_setcastle','2'), -('admin_removecastle','2'), -('admin_clanhall','2'), -('admin_clanhallset','2'), -('admin_clanhalldel','2'), -('admin_clanhallopendoors','2'), -('admin_clanhallclosedoors','2'), -('admin_clanhallteleportself','2'), - --- Section: Skills -('admin_show_skills','3'), -('admin_remove_skills','3'), -('admin_skill_list','3'), -('admin_skill_index','3'), -('admin_add_skill','3'), -('admin_remove_skill','3'), -('admin_get_skills','3'), -('admin_reset_skills','3'), -('admin_give_all_skills','3'), -('admin_remove_all_skills','3'), -('admin_add_clan_skill','3'), - --- Section: Spawn -('admin_show_spawns','3'), -('admin_spawn','3'), -('admin_spawn_monster','3'), -('admin_spawn_index','3'), -('admin_unspawnall','3'), -('admin_respawnall','3'), -('admin_spawn_reload','3'), -('admin_npc_index','3'), -('admin_spawn_once','3'), -('admin_show_npcs','3'), -('admin_teleport_reload','3'), -('admin_spawnnight','3'), -('admin_spawnday','3'), -('admin_topspawncount','3'), -('admin_top_spawn_count','3'), - --- Section: Target -('admin_target','3'), - --- Section: Teleport -('admin_show_moves','3'), -('admin_show_moves_other','3'), -('admin_show_teleport','3'), -('admin_teleport_to_character','3'), -('admin_teleportto','3'), -('admin_move_to','3'), -('admin_teleport_character','3'), -('admin_recall','3'), -('admin_walk','3'), -('admin_recall_npc','3'), -('admin_gonorth','3'), -('admin_gosouth','3'), -('admin_goeast','3'), -('admin_gowest','3'), -('admin_goup','3'), -('admin_godown','3'), -('admin_tele','3'), -('admin_teleto','3'), - --- Section: Teleport -('admin_test','3'), -('admin_stats','3'), -('admin_skill_test','3'), -('admin_st','3'), -('admin_mp','3'), - --- Section: TownWar -('admin_townwar_start','3'), -('admin_townwar_end','3'), - --- Section: TvTEngine -('admin_tvt','3'), -('admin_tvt_name','3'), -('admin_tvt_desc','3'), -('admin_tvt_join_loc','3'), -('admin_tvt_minlvl','3'), -('admin_tvt_maxlvl','3'), -('admin_tvt_npc','3'), -('admin_tvt_npc_pos','3'), -('admin_tvt_reward','3'), -('admin_tvt_reward_amount','3'), -('admin_tvt_team_add','3'), -('admin_tvt_team_remove','3'), -('admin_tvt_team_pos','3'), -('admin_tvt_team_color','3'), -('admin_tvt_join','3'), -('admin_tvt_teleport','3'), -('admin_tvt_start','3'), -('admin_tvt_abort','3'), -('admin_tvt_finish','3'), -('admin_tvt_sit','3'), -('admin_tvt_dump','3'), -('admin_tvt_save','3'), -('admin_tvt_load','3'), -('admin_tvt_jointime','3'), -('admin_tvt_eventtime','3'), -('admin_tvt_autoevent','3'), -('admin_tvt_minplayers','3'), -('admin_tvt_maxplayers','3'), -('admin_tvtkick','3'), - --- Section: UnblockIp -('admin_unblockip','2'), - --- Section: VIPEngine -('admin_vip','3'), -('admin_vip_setteam','3'), -('admin_vip_randomteam','3'), -('admin_vip_settime','3'), -('admin_vip_endnpc','3'), -('admin_vip_setdelay','3'), -('admin_vip_joininit','3'), -('admin_vip_joinnpc','3'), -('admin_vip_joinlocxyz','3'), -('admin_vip_setarea','3'), -('admin_vip_vipreward','3'), -('admin_vip_viprewardamount','3'), -('admin_vip_thevipreward','3'), -('admin_vip_theviprewardamount','3'), -('admin_vip_notvipreward','3'), -('admin_vip_notviprewardamount','3'), - --- Section: Walker -('admin_walker_setmessage','3'), -('admin_walker_menu','3'), -('admin_walker_setnpc','3'), -('admin_walker_setpoint','3'), -('admin_walker_setmode','3'), -('admin_walker_addpoint','3'), - --- Section: Zone -('admin_zone_check','2'), -('admin_zone_reload','2'), - --- Section: Fences -('admin_addfence','1'), -('admin_setfencestate','1'), -('admin_removefence','1'), -('admin_listfence','1'), -('admin_gofence','1'), - --- Section: AIO -('admin_setaio','2'), -('admin_removeaio','2'); diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/AccessLevels.xml b/L2J_Mobius_C6_Interlude/dist/game/config/AccessLevels.xml new file mode 100644 index 0000000000..4d0a6639ef --- /dev/null +++ b/L2J_Mobius_C6_Interlude/dist/game/config/AccessLevels.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml b/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml new file mode 100644 index 0000000000..af04d45f4f --- /dev/null +++ b/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml @@ -0,0 +1,630 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/xsd/AccessLevels.xsd b/L2J_Mobius_C6_Interlude/dist/game/data/xsd/AccessLevels.xsd new file mode 100644 index 0000000000..c95b4c3336 --- /dev/null +++ b/L2J_Mobius_C6_Interlude/dist/game/data/xsd/AccessLevels.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/xsd/AdminCommands.xsd b/L2J_Mobius_C6_Interlude/dist/game/data/xsd/AdminCommands.xsd new file mode 100644 index 0000000000..c89f32e154 --- /dev/null +++ b/L2J_Mobius_C6_Interlude/dist/game/data/xsd/AdminCommands.xsd @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/GmListTable.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/GmListTable.java deleted file mode 100644 index 9bc2a5cb6b..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/GmListTable.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * 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 . - */ -package org.l2jmobius.gameserver.datatables; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.serverpackets.GameServerPacket; -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; - -/** - * This class stores references to all online game masters. (access level > 100) - * @version $Revision: 1.2.2.1.2.7 $ $Date: 2005/04/05 19:41:24 $ - */ -public class GmListTable -{ - protected static final Logger LOGGER = Logger.getLogger(GmListTable.class.getName()); - private static GmListTable _instance; - - /** Set(PlayerInstance>) containing all the GM in game */ - private final Map _gmList; - - public static GmListTable getInstance() - { - if (_instance == null) - { - _instance = new GmListTable(); - } - - return _instance; - } - - public static void reload() - { - _instance = null; - getInstance(); - } - - public List getAllGms(boolean includeHidden) - { - final List tmpGmList = new ArrayList<>(); - - for (Entry n : _gmList.entrySet()) - { - if (includeHidden || !n.getValue()) - { - tmpGmList.add(n.getKey()); - } - } - return tmpGmList; - } - - public List getAllGmNames(boolean includeHidden) - { - final List tmpGmList = new ArrayList<>(); - - for (Entry n : _gmList.entrySet()) - { - if (!n.getValue()) - { - tmpGmList.add(n.getKey().getName()); - } - else if (includeHidden) - { - tmpGmList.add(n.getKey().getName() + " (invis)"); - } - } - return tmpGmList; - } - - private GmListTable() - { - LOGGER.info("GmListTable: initalized."); - _gmList = new ConcurrentHashMap<>(); - } - - /** - * Add a PlayerInstance player to the Set _gmList - * @param player - * @param hidden - */ - public void addGm(PlayerInstance player, boolean hidden) - { - _gmList.put(player, hidden); - } - - public void deleteGm(PlayerInstance player) - { - _gmList.remove(player); - } - - /** - * GM will be displayed on clients GM list. - * @param player the player - */ - public void showGm(PlayerInstance player) - { - if (_gmList.containsKey(player)) - { - _gmList.put(player, false); - } - } - - /** - * GM will no longer be displayed on clients GM list. - * @param player the player - */ - public void hideGm(PlayerInstance player) - { - if (_gmList.containsKey(player)) - { - _gmList.put(player, true); - } - } - - public boolean isGmOnline(boolean includeHidden) - { - for (boolean b : _gmList.values()) - { - if (includeHidden || !b) - { - return true; - } - } - - return false; - } - - public void sendListToPlayer(PlayerInstance player) - { - if (isGmOnline(player.isGM())) - { - SystemMessage sm = new SystemMessage(SystemMessageId.GM_LIST); - player.sendPacket(sm); - - for (String name : getAllGmNames(player.isGM())) - { - final SystemMessage sm1 = new SystemMessage(SystemMessageId.GM_S1); - sm1.addString(name); - player.sendPacket(sm1); - } - } - else - { - SystemMessage sm2 = new SystemMessage(SystemMessageId.NO_GM_PROVIDING_SERVICE_NOW); - player.sendPacket(sm2); - } - } - - public static void broadcastToGMs(GameServerPacket packet) - { - for (PlayerInstance gm : getInstance().getAllGms(true)) - { - gm.sendPacket(packet); - } - } - - public static void broadcastMessageToGMs(String message) - { - for (PlayerInstance gm : getInstance().getAllGms(true)) - { - // prevents a NPE. - if (gm != null) - { - gm.sendPacket(SystemMessage.sendString(message)); - } - } - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/sql/AccessLevels.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/sql/AccessLevels.java deleted file mode 100644 index 080cb0e123..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/sql/AccessLevels.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * 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 . - */ -package org.l2jmobius.gameserver.datatables.sql; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.database.DatabaseFactory; -import org.l2jmobius.gameserver.datatables.AccessLevel; - -/** - * @author FBIagent
- */ -public class AccessLevels -{ - private static final Logger LOGGER = Logger.getLogger(AccessLevels.class.getName()); - - private static AccessLevels _instance = null; - public AccessLevel _masterAccessLevel; - public AccessLevel _userAccessLevel; - private final Map _accessLevels = new HashMap<>(); - - private AccessLevels() - { - _masterAccessLevel = new AccessLevel(Config.MASTERACCESS_LEVEL, "Master Access", Config.MASTERACCESS_NAME_COLOR, Config.MASTERACCESS_TITLE_COLOR, true, true, true, true, true, true, true, true, true, true, true); - _userAccessLevel = new AccessLevel(Config.USERACCESS_LEVEL, "User", Integer.decode("0xFFFFFF"), Integer.decode("0xFFFFFF"), false, false, false, true, false, true, true, true, true, true, false); - - try (Connection con = DatabaseFactory.getConnection()) - { - final PreparedStatement stmt = con.prepareStatement("SELECT * FROM `access_levels` ORDER BY `accessLevel` DESC"); - final ResultSet rset = stmt.executeQuery(); - int accessLevel = 0; - String name = null; - int nameColor = 0; - int titleColor = 0; - boolean isGm = false; - boolean allowPeaceAttack = false; - boolean allowFixedRes = false; - boolean allowTransaction = false; - boolean allowAltG = false; - boolean giveDamage = false; - boolean takeAggro = false; - boolean gainExp = false; - - boolean useNameColor = true; - boolean useTitleColor = false; - boolean canDisableGmStatus = true; - - while (rset.next()) - { - accessLevel = rset.getInt("accessLevel"); - name = rset.getString("name"); - - if (accessLevel == Config.USERACCESS_LEVEL) - { - LOGGER.info("AccessLevels: Access level with name " + name + " is using reserved user access level " + Config.USERACCESS_LEVEL + ". Ignoring it..."); - continue; - } - else if (accessLevel == Config.MASTERACCESS_LEVEL) - { - LOGGER.info("AccessLevels: Access level with name " + name + " is using reserved master access level " + Config.MASTERACCESS_LEVEL + ". Ignoring it..."); - continue; - } - else if (accessLevel < 0) - { - LOGGER.info("AccessLevels: Access level with name " + name + " is using banned access level state(below 0). Ignoring it..."); - continue; - } - - try - { - nameColor = Integer.decode("0x" + rset.getString("nameColor")); - } - catch (NumberFormatException nfe) - { - LOGGER.warning(nfe.getMessage()); - - try - { - nameColor = Integer.decode("0xFFFFFF"); - } - catch (NumberFormatException nfe2) - { - LOGGER.warning(nfe.getMessage()); - } - } - - try - { - titleColor = Integer.decode("0x" + rset.getString("titleColor")); - } - catch (NumberFormatException nfe) - { - LOGGER.warning(nfe.getMessage()); - - try - { - titleColor = Integer.decode("0x77FFFF"); - } - catch (NumberFormatException nfe2) - { - LOGGER.warning(nfe.getMessage()); - } - } - - isGm = rset.getBoolean("isGm"); - allowPeaceAttack = rset.getBoolean("allowPeaceAttack"); - allowFixedRes = rset.getBoolean("allowFixedRes"); - allowTransaction = rset.getBoolean("allowTransaction"); - allowAltG = rset.getBoolean("allowAltg"); - giveDamage = rset.getBoolean("giveDamage"); - takeAggro = rset.getBoolean("takeAggro"); - gainExp = rset.getBoolean("gainExp"); - - useNameColor = rset.getBoolean("useNameColor"); - useTitleColor = rset.getBoolean("useTitleColor"); - canDisableGmStatus = rset.getBoolean("canDisableGmStatus"); - - _accessLevels.put(accessLevel, new AccessLevel(accessLevel, name, nameColor, titleColor, isGm, allowPeaceAttack, allowFixedRes, allowTransaction, allowAltG, giveDamage, takeAggro, gainExp, useNameColor, useTitleColor, canDisableGmStatus)); - } - - rset.close(); - stmt.close(); - } - catch (SQLException e) - { - LOGGER.warning("AccessLevels: Error loading from database " + e); - } - LOGGER.info("AccessLevels: Master Access Level is " + Config.MASTERACCESS_LEVEL + "."); - LOGGER.info("AccessLevels: User Access Level is " + Config.USERACCESS_LEVEL + "."); - } - - /** - * Returns the one and only instance of this class
- *
- * @return AccessLevels: the one and only instance of this class
- */ - public static AccessLevels getInstance() - { - return _instance == null ? (_instance = new AccessLevels()) : _instance; - } - - /** - * Returns the access level by characterAccessLevel
- *
- * @param accessLevelNum as int
- *
- * @return AccessLevel: AccessLevel instance by char access level
- */ - public AccessLevel getAccessLevel(int accessLevelNum) - { - AccessLevel accessLevel = null; - - synchronized (_accessLevels) - { - accessLevel = _accessLevels.get(accessLevelNum); - } - return accessLevel; - } - - public void addBanAccessLevel(int accessLevel) - { - synchronized (_accessLevels) - { - if (accessLevel > -1) - { - return; - } - - _accessLevels.put(accessLevel, new AccessLevel(accessLevel, "Banned", Integer.decode("0x000000"), Integer.decode("0x000000"), false, false, false, false, false, false, false, false, false, false, false)); - } - } - - public static void reload() - { - _instance = null; - getInstance(); - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/sql/AdminCommandAccessRights.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/sql/AdminCommandAccessRights.java deleted file mode 100644 index 0adfd305ee..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/sql/AdminCommandAccessRights.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * 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 . - */ -package org.l2jmobius.gameserver.datatables.sql; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.database.DatabaseFactory; -import org.l2jmobius.gameserver.datatables.AccessLevel; - -/** - * @author FBIagent
- */ -public class AdminCommandAccessRights -{ - protected static final Logger LOGGER = Logger.getLogger(AdminCommandAccessRights.class.getName()); - - private static AdminCommandAccessRights _instance = null; - private final Map adminCommandAccessRights = new HashMap<>(); - - private AdminCommandAccessRights() - { - try (Connection con = DatabaseFactory.getConnection()) - { - final PreparedStatement stmt = con.prepareStatement("SELECT * FROM admin_command_access_rights"); - final ResultSet rset = stmt.executeQuery(); - String adminCommand = null; - int accessLevels = 1; - - while (rset.next()) - { - adminCommand = rset.getString("adminCommand"); - accessLevels = rset.getInt("accessLevels"); - adminCommandAccessRights.put(adminCommand, accessLevels); - } - rset.close(); - stmt.close(); - } - catch (SQLException e) - { - LOGGER.warning("Admin Access Rights: Error loading from database " + e); - } - - LOGGER.info("Admin Access Rights: Loaded " + adminCommandAccessRights.size() + " Access Rigths from database."); - } - - /** - * Returns the one and only instance of this class
- *
- * @return AdminCommandAccessRights: the one and only instance of this class
- */ - public static AdminCommandAccessRights getInstance() - { - return _instance == null ? (_instance = new AdminCommandAccessRights()) : _instance; - } - - public static void reload() - { - _instance = null; - getInstance(); - } - - public int accessRightForCommand(String command) - { - int out = -1; - - if (adminCommandAccessRights.containsKey(command)) - { - out = adminCommandAccessRights.get(command); - } - - return out; - } - - public boolean hasAccess(String adminCommand, AccessLevel accessLevel) - { - if (accessLevel.getLevel() <= 0) - { - return false; - } - - if (!accessLevel.isGm()) - { - return false; - } - - if (accessLevel.getLevel() == Config.MASTERACCESS_LEVEL) - { - return true; - } - - String command = adminCommand; - if (adminCommand.indexOf(" ") != -1) - { - command = adminCommand.substring(0, adminCommand.indexOf(" ")); - } - - int acar = 0; - if (adminCommandAccessRights.get(command) != null) - { - acar = adminCommandAccessRights.get(command); - } - - if (acar == 0) - { - LOGGER.warning("Admin Access Rights: No rights defined for admin command " + command + "."); - return false; - } - else if (acar >= accessLevel.getLevel()) - { - return true; - } - else - { - return false; - } - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/xml/AdminData.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/xml/AdminData.java new file mode 100644 index 0000000000..ddf5070824 --- /dev/null +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/xml/AdminData.java @@ -0,0 +1,406 @@ +/* + * This file is part of the L2J Mobius project. + * + * 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 . + */ +package org.l2jmobius.gameserver.datatables.xml; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import org.l2jmobius.Config; +import org.l2jmobius.commons.util.IXmlReader; +import org.l2jmobius.gameserver.datatables.AccessLevel; +import org.l2jmobius.gameserver.model.StatsSet; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.SystemMessageId; +import org.l2jmobius.gameserver.network.serverpackets.GameServerPacket; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; + +/** + * Loads administrator access levels and commands. + * @author Mobius + */ +public class AdminData implements IXmlReader +{ + private static final Logger LOGGER = Logger.getLogger(AdminData.class.getName()); + + public AccessLevel _masterAccessLevel; + public AccessLevel _userAccessLevel; + private final Map _accessLevels = new HashMap<>(); + private final Map _adminCommandAccessRights = new HashMap<>(); + private final Map _gmList = new ConcurrentHashMap<>(); + + protected AdminData() + { + load(); + } + + @Override + public void load() + { + _accessLevels.clear(); + _masterAccessLevel = new AccessLevel(Config.MASTERACCESS_LEVEL, "Master Access", Config.MASTERACCESS_NAME_COLOR, Config.MASTERACCESS_TITLE_COLOR, true, true, true, true, true, true, true, true, true, true, true); + _userAccessLevel = new AccessLevel(Config.USERACCESS_LEVEL, "User", Integer.decode("0xFFFFFF"), Integer.decode("0xFFFFFF"), false, false, false, true, false, true, true, true, true, true, false); + parseDatapackFile("config/AccessLevels.xml"); + LOGGER.info(getClass().getSimpleName() + ": Loaded " + _accessLevels.size() + " access levels."); + LOGGER.info(getClass().getSimpleName() + ": Master access level is " + Config.MASTERACCESS_LEVEL + "."); + LOGGER.info(getClass().getSimpleName() + ": User access level is " + Config.USERACCESS_LEVEL + "."); + + _adminCommandAccessRights.clear(); + parseDatapackFile("config/AdminCommands.xml"); + LOGGER.info(getClass().getSimpleName() + ": Loaded " + _adminCommandAccessRights.size() + " access commands."); + } + + @Override + public void parseDocument(Document doc, File f) + { + StatsSet set = null; + String command = null; + int accessLevel = 0; + String name = null; + int nameColor = 0; + int titleColor = 0; + boolean isGm = false; + boolean allowPeaceAttack = false; + boolean allowFixedRes = false; + boolean allowTransaction = false; + boolean allowAltG = false; + boolean giveDamage = false; + boolean takeAggro = false; + boolean gainExp = false; + boolean useNameColor = true; + boolean useTitleColor = false; + boolean canDisableGmStatus = true; + + for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) + { + if ("list".equalsIgnoreCase(n.getNodeName())) + { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) + { + if ("access".equals(d.getNodeName())) + { + set = new StatsSet(parseAttributes(d)); + + accessLevel = set.getInt("level"); + name = set.getString("name"); + + if (accessLevel == Config.USERACCESS_LEVEL) + { + LOGGER.info(getClass().getSimpleName() + ": Access level with name " + name + " is using reserved user access level " + Config.USERACCESS_LEVEL + ". Ignoring it..."); + continue; + } + else if (accessLevel == Config.MASTERACCESS_LEVEL) + { + LOGGER.info(getClass().getSimpleName() + ": Access level with name " + name + " is using reserved master access level " + Config.MASTERACCESS_LEVEL + ". Ignoring it..."); + continue; + } + else if (accessLevel < 0) + { + LOGGER.info(getClass().getSimpleName() + ": Access level with name " + name + " is using banned access level state(below 0). Ignoring it..."); + continue; + } + + try + { + nameColor = Integer.decode("0x" + set.getString("nameColor")); + } + catch (NumberFormatException nfe) + { + LOGGER.warning(nfe.getMessage()); + + try + { + nameColor = Integer.decode("0xFFFFFF"); + } + catch (NumberFormatException nfe2) + { + LOGGER.warning(nfe.getMessage()); + } + } + + try + { + titleColor = Integer.decode("0x" + set.getString("titleColor")); + } + catch (NumberFormatException nfe) + { + LOGGER.warning(nfe.getMessage()); + + try + { + titleColor = Integer.decode("0x77FFFF"); + } + catch (NumberFormatException nfe2) + { + LOGGER.warning(nfe.getMessage()); + } + } + + isGm = set.getBoolean("isGm"); + allowPeaceAttack = set.getBoolean("allowPeaceAttack"); + allowFixedRes = set.getBoolean("allowFixedRes"); + allowTransaction = set.getBoolean("allowTransaction"); + allowAltG = set.getBoolean("allowAltg"); + giveDamage = set.getBoolean("giveDamage"); + takeAggro = set.getBoolean("takeAggro"); + gainExp = set.getBoolean("gainExp"); + + useNameColor = set.getBoolean("useNameColor"); + useTitleColor = set.getBoolean("useTitleColor"); + canDisableGmStatus = set.getBoolean("canDisableGmStatus"); + + _accessLevels.put(accessLevel, new AccessLevel(accessLevel, name, nameColor, titleColor, isGm, allowPeaceAttack, allowFixedRes, allowTransaction, allowAltG, giveDamage, takeAggro, gainExp, useNameColor, useTitleColor, canDisableGmStatus)); + } + else if ("admin".equals(d.getNodeName())) + { + set = new StatsSet(parseAttributes(d)); + + command = set.getString("command"); + accessLevel = set.getInt("accessLevel"); + _adminCommandAccessRights.put(command, accessLevel); + } + } + } + } + } + + /** + * Returns the access level by characterAccessLevel
+ *
+ * @param accessLevelNum as int
+ *
+ * @return AccessLevel: AccessLevel instance by char access level
+ */ + public AccessLevel getAccessLevel(int accessLevelNum) + { + AccessLevel accessLevel = null; + + synchronized (_accessLevels) + { + accessLevel = _accessLevels.get(accessLevelNum); + } + return accessLevel; + } + + public void addBanAccessLevel(int accessLevel) + { + synchronized (_accessLevels) + { + if (accessLevel > -1) + { + return; + } + + _accessLevels.put(accessLevel, new AccessLevel(accessLevel, "Banned", Integer.decode("0x000000"), Integer.decode("0x000000"), false, false, false, false, false, false, false, false, false, false, false)); + } + } + + public int accessRightForCommand(String command) + { + int out = -1; + if (_adminCommandAccessRights.containsKey(command)) + { + out = _adminCommandAccessRights.get(command); + } + return out; + } + + public boolean hasAccess(String adminCommand, AccessLevel accessLevel) + { + if (accessLevel.getLevel() <= 0) + { + return false; + } + + if (!accessLevel.isGm()) + { + return false; + } + + if (accessLevel.getLevel() == Config.MASTERACCESS_LEVEL) + { + return true; + } + + String command = adminCommand; + if (adminCommand.indexOf(" ") != -1) + { + command = adminCommand.substring(0, adminCommand.indexOf(" ")); + } + + int acar = 0; + if (_adminCommandAccessRights.get(command) != null) + { + acar = _adminCommandAccessRights.get(command); + } + + if (acar == 0) + { + LOGGER.warning("Admin Access Rights: No rights defined for admin command " + command + "."); + return false; + } + else if (acar >= accessLevel.getLevel()) + { + return true; + } + else + { + return false; + } + } + + public List getAllGms(boolean includeHidden) + { + final List tmpGmList = new ArrayList<>(); + + for (Entry n : _gmList.entrySet()) + { + if (includeHidden || !n.getValue()) + { + tmpGmList.add(n.getKey()); + } + } + return tmpGmList; + } + + public List getAllGmNames(boolean includeHidden) + { + final List tmpGmList = new ArrayList<>(); + + for (Entry n : _gmList.entrySet()) + { + if (!n.getValue()) + { + tmpGmList.add(n.getKey().getName()); + } + else if (includeHidden) + { + tmpGmList.add(n.getKey().getName() + " (invis)"); + } + } + return tmpGmList; + } + + public void addGm(PlayerInstance player, boolean hidden) + { + _gmList.put(player, hidden); + } + + public void deleteGm(PlayerInstance player) + { + _gmList.remove(player); + } + + /** + * GM will be displayed on clients GM list. + * @param player the player + */ + public void showGm(PlayerInstance player) + { + if (_gmList.containsKey(player)) + { + _gmList.put(player, false); + } + } + + /** + * GM will no longer be displayed on clients GM list. + * @param player the player + */ + public void hideGm(PlayerInstance player) + { + if (_gmList.containsKey(player)) + { + _gmList.put(player, true); + } + } + + public boolean isGmOnline(boolean includeHidden) + { + for (boolean b : _gmList.values()) + { + if (includeHidden || !b) + { + return true; + } + } + + return false; + } + + public void sendListToPlayer(PlayerInstance player) + { + if (isGmOnline(player.isGM())) + { + SystemMessage sm = new SystemMessage(SystemMessageId.GM_LIST); + player.sendPacket(sm); + + for (String name : getAllGmNames(player.isGM())) + { + final SystemMessage sm1 = new SystemMessage(SystemMessageId.GM_S1); + sm1.addString(name); + player.sendPacket(sm1); + } + } + else + { + SystemMessage sm2 = new SystemMessage(SystemMessageId.NO_GM_PROVIDING_SERVICE_NOW); + player.sendPacket(sm2); + } + } + + public static void broadcastToGMs(GameServerPacket packet) + { + for (PlayerInstance gm : getInstance().getAllGms(true)) + { + gm.sendPacket(packet); + } + } + + public static void broadcastMessageToGMs(String message) + { + for (PlayerInstance gm : getInstance().getAllGms(true)) + { + if (gm != null) + { + gm.sendPacket(SystemMessage.sendString(message)); + } + } + } + + /** + * Gets the single instance of AdminTable. + * @return AccessLevels: the one and only instance of this class
+ */ + public static AdminData getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final AdminData INSTANCE = new AdminData(); + } +} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAdmin.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAdmin.java index 5a182b66f5..31a40c3522 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAdmin.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAdmin.java @@ -20,7 +20,7 @@ import java.util.StringTokenizer; import java.util.logging.Logger; import org.l2jmobius.Config; -import org.l2jmobius.gameserver.datatables.GmListTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.entity.olympiad.Olympiad; @@ -100,14 +100,14 @@ public class AdminAdmin implements IAdminCommandHandler } case admin_gmliston: { - GmListTable.getInstance().showGm(activeChar); - BuilderUtil.sendSysMessage(activeChar, "Registerd into gm list"); + AdminData.getInstance().showGm(activeChar); + BuilderUtil.sendSysMessage(activeChar, "Registerd into gm list."); return true; } case admin_gmlistoff: { - GmListTable.getInstance().hideGm(activeChar); - BuilderUtil.sendSysMessage(activeChar, "Removed from gm list"); + AdminData.getInstance().hideGm(activeChar); + BuilderUtil.sendSysMessage(activeChar, "Removed from gm list."); return true; } case admin_silence: diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java index d7b9069610..c6fa8855a7 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java @@ -23,7 +23,7 @@ import java.util.logging.Logger; import org.l2jmobius.Config; import org.l2jmobius.commons.database.DatabaseFactory; -import org.l2jmobius.gameserver.datatables.GmListTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -193,7 +193,7 @@ public class AdminAio implements IAdminCommandHandler _player.broadcastUserInfo(); _player.sendPacket(new EtcStatusUpdate(_player)); _player.sendSkillList(); - GmListTable.broadcastMessageToGMs("GM " + activeChar.getName() + " set Aio stat for player " + _playername + " for " + _time + " day(s)"); + AdminData.broadcastMessageToGMs("GM " + activeChar.getName() + " set Aio stat for player " + _playername + " for " + _time + " day(s)"); _player.sendMessage("You are now an Aio, Congratulations!"); _player.broadcastUserInfo(); } @@ -226,7 +226,7 @@ public class AdminAio implements IAdminCommandHandler _player.broadcastUserInfo(); _player.sendPacket(new EtcStatusUpdate(_player)); _player.sendSkillList(); - GmListTable.broadcastMessageToGMs("GM " + activeChar.getName() + " remove Aio stat of player " + _playername); + AdminData.broadcastMessageToGMs("GM " + activeChar.getName() + " remove Aio stat of player " + _playername); _player.sendMessage("Now You are not an Aio.."); _player.broadcastUserInfo(); } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java index 2ae7cc0d9f..904d5757d7 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java @@ -21,7 +21,7 @@ import java.sql.PreparedStatement; import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; -import org.l2jmobius.gameserver.datatables.GmListTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -98,7 +98,7 @@ public class AdminDonator implements IAdminCommandHandler if (notifyGmList) { - GmListTable.broadcastMessageToGMs("Warn: " + gm.getName() + " has set " + player.getName() + " as Donator !"); + AdminData.broadcastMessageToGMs("Warn: " + gm.getName() + " has set " + player.getName() + " as Donator !"); } } else @@ -113,7 +113,7 @@ public class AdminDonator implements IAdminCommandHandler if (notifyGmList) { - GmListTable.broadcastMessageToGMs("Warn: " + gm.getName() + " has removed Donator Status of player" + player.getName()); + AdminData.broadcastMessageToGMs("Warn: " + gm.getName() + " has removed Donator Status of player" + player.getName()); } } } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java index 64116252a9..a454ac74fe 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java @@ -38,6 +38,7 @@ import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.DropCategory; import org.l2jmobius.gameserver.model.DropData; import org.l2jmobius.gameserver.model.Skill; +import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StoreTradeList; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.BoxInstance; @@ -45,7 +46,6 @@ import org.l2jmobius.gameserver.model.actor.instance.ItemInstance; import org.l2jmobius.gameserver.model.actor.instance.NpcInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; -import org.l2jmobius.gameserver.templates.StatsSet; import org.l2jmobius.gameserver.templates.creatures.NpcTemplate; import org.l2jmobius.gameserver.templates.item.Item; import org.l2jmobius.gameserver.util.BuilderUtil; @@ -1186,7 +1186,7 @@ public class AdminEditNpc implements IAdminCommandHandler LOGGER.warning("Error saving new npc value: " + e); } - final int npcId = newNpcData.getInteger("npcId"); + final int npcId = newNpcData.getInt("npcId"); final NpcTemplate old = NpcTable.getInstance().getTemplate(npcId); if (old.isCustom()) diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGm.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGm.java index fe239d5991..ad5ddaaa35 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGm.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGm.java @@ -16,7 +16,7 @@ */ package org.l2jmobius.gameserver.handler.admincommandhandlers; -import org.l2jmobius.gameserver.datatables.GmListTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.util.BuilderUtil; @@ -53,12 +53,12 @@ public class AdminGm implements IAdminCommandHandler { if (activeChar.isGM()) { - GmListTable.getInstance().deleteGm(activeChar); + AdminData.getInstance().deleteGm(activeChar); BuilderUtil.sendSysMessage(activeChar, "You no longer have GM status."); } else { - GmListTable.getInstance().addGm(activeChar, false); + AdminData.getInstance().addGm(activeChar, false); BuilderUtil.sendSysMessage(activeChar, "You now have GM status."); } } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGmChat.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGmChat.java index 423290d139..4c1454f639 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGmChat.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminGmChat.java @@ -16,7 +16,7 @@ */ package org.l2jmobius.gameserver.handler.admincommandhandlers; -import org.l2jmobius.gameserver.datatables.GmListTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.WorldObject; @@ -117,7 +117,7 @@ public class AdminGmChat implements IAdminCommandHandler text = command.substring(offset); CreatureSay cs = new CreatureSay(0, 9, activeChar.getName(), text); - GmListTable.broadcastToGMs(cs); + AdminData.broadcastToGMs(cs); } catch (StringIndexOutOfBoundsException e) { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java index 6c58d9922d..070b35684c 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java @@ -21,7 +21,7 @@ import java.sql.PreparedStatement; import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; -import org.l2jmobius.gameserver.datatables.GmListTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -92,7 +92,7 @@ public class AdminNoble implements IAdminCommandHandler if (notifyGmList) { - GmListTable.broadcastMessageToGMs("Warn: " + gm.getName() + " has set " + player.getName() + " as Noble !"); + AdminData.broadcastMessageToGMs("Warn: " + gm.getName() + " has set " + player.getName() + " as Noble !"); } } else @@ -102,7 +102,7 @@ public class AdminNoble implements IAdminCommandHandler if (notifyGmList) { - GmListTable.broadcastMessageToGMs("Warn: " + gm.getName() + " has removed Noble Status of player" + player.getName()); + AdminData.broadcastMessageToGMs("Warn: " + gm.getName() + " has removed Noble Status of player" + player.getName()); } } } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminSpawn.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminSpawn.java index 4d551a1642..9c76fedc03 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminSpawn.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminSpawn.java @@ -24,10 +24,10 @@ import java.util.StringTokenizer; import java.util.logging.Logger; import org.l2jmobius.Config; -import org.l2jmobius.gameserver.datatables.GmListTable; import org.l2jmobius.gameserver.datatables.sql.NpcTable; import org.l2jmobius.gameserver.datatables.sql.SpawnTable; import org.l2jmobius.gameserver.datatables.sql.TeleportLocationTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.instancemanager.DayNightSpawnManager; import org.l2jmobius.gameserver.instancemanager.GrandBossManager; @@ -178,7 +178,7 @@ public class AdminSpawn implements IAdminCommandHandler RaidBossSpawnManager.getInstance().cleanUp(); DayNightSpawnManager.getInstance().cleanUp(); World.getInstance().deleteVisibleNpcSpawns(); - GmListTable.broadcastMessageToGMs("NPC Unspawn completed!"); + AdminData.broadcastMessageToGMs("NPC Unspawn completed!"); } else if (command.startsWith("admin_spawnday")) { @@ -199,12 +199,12 @@ public class AdminSpawn implements IAdminCommandHandler SpawnTable.getInstance().reloadAll(); RaidBossSpawnManager.getInstance().load(); SevenSigns.getInstance().spawnSevenSignsNPC(); - GmListTable.broadcastMessageToGMs("NPC Respawn completed!"); + AdminData.broadcastMessageToGMs("NPC Respawn completed!"); } else if (command.startsWith("admin_teleport_reload")) { TeleportLocationTable.getInstance().reloadAll(); - GmListTable.broadcastMessageToGMs("Teleport List Table reloaded."); + AdminData.broadcastMessageToGMs("Teleport List Table reloaded."); } else if (command.startsWith("admin_topspawncount") || command.startsWith("admin_top_spawn_count")) { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminZone.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminZone.java index cb73674dd9..86e93aba7e 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminZone.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminZone.java @@ -18,8 +18,8 @@ package org.l2jmobius.gameserver.handler.admincommandhandlers; import java.util.StringTokenizer; -import org.l2jmobius.gameserver.datatables.GmListTable; import org.l2jmobius.gameserver.datatables.csv.MapRegionTable; +import org.l2jmobius.gameserver.datatables.xml.AdminData; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -93,7 +93,7 @@ public class AdminZone implements IAdminCommandHandler else if (actualCommand.equalsIgnoreCase("admin_zone_reload")) { // TODO: ZONETODO ZoneManager.getInstance().reload(); - GmListTable.broadcastMessageToGMs("Zones can not be reloaded in this version."); + AdminData.broadcastMessageToGMs("Zones can not be reloaded in this version."); } return true; diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java index ba9ec66c0b..ea66a175bb 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java @@ -23,7 +23,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; -import org.l2jmobius.gameserver.datatables.GmListTable; import org.l2jmobius.gameserver.instancemanager.PlayerCountManager; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PetInstance; @@ -182,16 +181,6 @@ public class World return _allObjects.size(); } - /** - * Return a table containing all GMs.
- *
- * @return the all g ms - */ - public List getAllGMs() - { - return GmListTable.getInstance().getAllGms(true); - } - /** * Return a collection containing all players in game.
*