ORIGINAL POST FOUND HERE
Original Poster: Damokles
Posted: Sun May 29, 2005 1:31 pm
Post Subject: list Hooks
Updated Proposed Hook NamesI wrote this little perl prog to find all hooks in functions.pl. Maybe someone wants to use it. Feel free to improve and configure it like you want.
Perl:Code: Select all
use strict; my $hook; my $temp = ''; my $line = 0; my $count; my $string; open IN ,'functions.pl'; open OUT,'>hooks.txt'; while (<IN>){ $line++; $temp .= $_; if ($temp =~ /(Plugins::callHook\(.*?\);)/isg) { $string = $1; $count = () = $string =~ /\n/g; print OUT 'Line:'.($line-$count)." $string\n\n"; $temp = ''; } } close IN; close OUT;
sli wrote:Code: Select all
Old Hook Names New Hook Names ----------------------------------------------------------------------- AI/lockMap -> AI::lockMap AI_post -> AI::post AI_pre -> AI::pre AI_pre/manual -> AI::pre::manual AI_sell_done -> AI::NPC::sell_done AI_storage_done -> AI::NPC::storage_done attack_start -> AI::attack_start avoidGM_near -> avoidGM::near avoidGM_talk -> avoidGM::talk changed_status -> Actor::changed_status charNameUpdate -> Server::charNameUpdate charSelectScreen -> Server::charSelectScreen ChatQueue::add -> Chat::Queue::add ChatQueue::processChatResponse -> Chat::Queue::processChatResponse checkMonsterCondition -> Actor::monster::checkCondition checkPlayerCondition -> Actor::player::checkCondition checkSelfCondition -> Actor::self::checkCondition Command_post -> Command::post Commands::cmdConf -> Command::conf Commands::run/post -> Command::run::post Commands::run/pre -> Command::run::pre configModify -> Bot::configModify disconnected -> Server::disconnected FileParsers::RODescLUT -> FileParsers::RO::DescLUT FileParsers::ROLUT -> FileParsers::RO::LUT hook1 -> Bot::hook1 hook2 -> Bot::hook2 initialized -> Bot::initialized is_casting -> Actor::is_casting item_skill -> Actor::item_skill mainLoop_pre -> Bot::mainLoop::pre mainLoop_post -> Bot::mainLoop::post mainLoop::setTitle -> Bot::mainLoop::setTitle map_loaded -> Server::map_loaded Network::Receive/mangle -> Network::Receive::Mangle Network::Receive/willMangle -> Network::Recieve::willMangle Network::Receive::map_changed -> Network::Recive::map_chaned Network::clientAlive -> Network::Client::alive Network::clientRecv -> Network::Client::Recv Network::clientSend -> Network::Client::Send Network::connectTo -> Network::connectTo Network::serverConnect/char -> Network::Server::Connect::char Network::serverConnect/charselect -> Network::Server::Connect::charselect Network::serverConnect/mapserver -> Network::Server::Connect::mapserver Network::serverConnect/master -> Network::Server::Connect::master Network::serverConnect/special -> Network::Server::Connect::special Network::serverRecv -> Network::Server::Recv Network::serverSend -> Network::Server::send Network::serverSend/pre -> Network::Server::send::pre Network::stateChanged -> Network::StateChanged npc_talk_done -> AI::NPC::talk_done objectAdded -> Actor::objectAdded objectRemoves -> Actor::objectRemoved packet/sendMapLoaded -> Packet::sendMapLoaded packet_areaSpell -> Packet::areaSpell packet_attack -> Packet::attack packet_cart -> Packet::cart packet_castCancelled -> Packet::castCancelled packet_charSkills -> Packet::Char::Skills packet_charStats -> Packet::Char::Stats packet_guildMsg -> Packet::Chat::Guild packet_homunSkills -> Packet::Homun::Skills packet_inventory -> Packet::Inventory packet_item_removed -> Packet::item_removed packet_mapChange -> Packet::map_changes packet_partyMsg -> Packet::Chat::Party packet_pre/sendAttack -> Packet::Pre::Attack packet_pre/sendSit -> Packet::Pre::Sit packet_pre/sendSkillUse -> Packet::Pre::SkillUse packet_pre/sendStand -> Packet::Pre::Stand packet_privMsg -> Packet::Chat::Private packet_pubMsg -> Packet::Chat::Public packet_selfChat -> Packet::Chat::Self packet_sentPM -> Packet::Chat::SentPM packet_skillfail -> Packet::Skill::Fail packet_skilluse -> Packet::Skill::Use packet_storage_close -> Packet::Storage::Close packet_storage_open -> Packet::Storage::Open packet_sysMsg -> Packet::sysMsh packet_useitem -> Packet::useItem packet_vender -> Packet::Vendor packet_vender_store -> Packet::Vendor::Store packet_vender_store2 -> Packet::Vendor::Store2 parseMsg/addPrivMsgUser -> Parse::addPrivMsgUser parseMsg/pre -> Parse::pre parseMsg/recvChars -> Parse::recvChars perfect_hidden_player -> Actor::Player::Hidden player -> Actor::Player player_connected -> Actor::Player::Connected player_exist -> Actor::Player::Exist Poseidon/client_authenticate -> Poseidon::Authenticate::Client Poseidon/server_authenticate -> Poseidon::Authenticate::Server pvp_mode -> Server::PvpMode RO_sendMsg_pre -> Server::sendMsg::pre start -> Bot::Start start2 -> Bot::Start2 start3 -> Bot::Start3 teleport_sent -> Packet::TeleportSend
sli wrote:There's a couple bugs in this (for some reason it skips a couple hooks, about 5-10), but the basic idea is there.Code: Select all
import os,re ignore = [] changeNames = 0 def visit(arg,dirname,names): global hList,ignore,changeNames for f in names: if os.path.isdir(f): continue #skip directories if f in ignore: continue #skip ignored files try: if not f.split('.')[-1] in ['pl','pm']: continue #skip stuff that's not perl except: continue f = dirname.replace('\\','/') + '/' + f print f + '...', src = open(f).read() if changeNames: new = open('new_' + f,'w') else: new = open(f,'w') for h in hList: src = re.sub(h[0],h[1],src) new.write(src) new.close() print 'Done.' hList = [] rawhList = open('newhooks.txt').read().rstrip().split('\n') for l in rawhList: l = l.split('\t') hList.append(['^%s$' % l[0],l[-1]]) x = os.path.walk('./src/',visit,None) x = os.path.walk('./plugins/',visit,None) print 'All done!'