PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
All Name PacketHook (0x98)

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Custom Script Releases
Display posts from previous:   

Author Message
Danielle



Joined: 07 Feb 2006
Posts: 97
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Mar 13, 2006 8:48 pm    Post subject: All Name PacketHook (0x98) Reply with quote

Not sure when this was added to the 2D client, but it exists in at least version 4.0.6a.

Here is the code (you can download it below as well)

NOTE: This feature is now built into all POL versions/builds after "097-2007-01-04-RC2-Coregina". For previous versions/builds you'll still need this packet hook. Regardless though, using the packet hook will allow you greater customization on how this feature is handled. You decide.

Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  Name:    All Names Hook
//  Version: 1.0
//  Author:  Danielle Elora
//
//  Purpose: Responds to the "all names" packet (0x98) sent by the client when pressing Ctrl+Shift.
//
//   PACKET DETAILS:
//
//   BYTE[1] cmd
//   BYTE[2] blocksize
//   BYTE[4] ID
//   If (server-reply)
//   BYTE[30] name (0 terminated)
//
//   Client request has 7 bytes, server-reply 37. Client already knows item names, and only
//   askes for mobiles names, hence ID is always a mobile serial.
//
////////////////////////////////////////////////////////////////////////////////////////////////////

use uo;
use polsys;

const OFFSET_MSGTYPE := 0;
const OFFSET_MSGLEN := 1;
const OFFSET_ID := 3;
const OFFSET_NAME := 7;

program all_names()
  Print("PacketHook: Hooking Incoming All Names Shortcut...");
  return 1;
endprogram

exported function handle_allnames(who, byref packet)

   // Pull the mobile id from the incoming packet.
   var mobile_id := packet.GetInt32(OFFSET_ID);

   // Lookup the mobile referenced in the packet...
   var mobile := SystemFindObjectBySerial(mobile_id);

   // Initialize the packet
   var new_packet := CreatePacket(0x98, 37);
   
   // Set the packet length
   new_packet.SetInt16(OFFSET_MSGLEN, 37);

   // Set the mobile id
   new_packet.SetInt32(OFFSET_ID, mobile_id);

   // Set the mobile name
   new_packet.SetString(OFFSET_NAME, mobile.name, 1);

   // Send the packet back to the player
   new_packet.SendPacket(who);

  // Since the core doesn't understand this packet, might as well block it from the core anyway.
  return 1;

endfunction



all_names.rar
 Description:
All Names Packethook (0x98) -- POL 96 REQUIRED!

Download
 Filename:  all_names.rar
 Filesize:  1.51 KB
 Downloaded:  98 Time(s)


Post new topic   Reply to topic    PenUltima Online Forum Index -> Custom Script Releases All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty