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
Buff/debuff packet fixes

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Packet World
Display posts from previous:   

Author Message
Bracco



Joined: 28 Dec 2006
Posts: 80

PostPosted: Tue Jan 02, 2007 7:55 am    Post subject: Buff/debuff packet fixes Reply with quote

heya... i played a bit with the 0xDF packet, the one for buff/debuff show... and i found the data on packetguide incorrect

so i fired up runuo and investigated, this is what i came up with. (basically i adjusted this according to runuo packet, so its not really my own work, credits goes to them)

Packet Build:
BYTE[1] Cmd
BYTE[2] Length
BYTE[4] Serial of player
BYTE[2] Icon Number to show
BYTE[2] 0x1 = Show, 0x0 = Remove. On remove byte, packet ends here.
BYTE[4] 0x00000000
BYTE[2] Icon Number to show.
BYTE[2] 0x1 = Show
BYTE[4] 0x00000000
BYTE[2] Time in seconds (simple countdown without automatic remove)
BYTE[2] 0x0000
BYTE[1] 0x00
BYTE[4] Cliloc ID of title of icon.
BYTE[4] Cliloc ID for the Description of the icon. If no arguments for cliloc, then add 10 more bytes 0x00000000000000000000 and end packet
BYTE[4] 0x00000000
BYTE[2] 0x01
BYTE[2] 0x0000
BYTE[len(str)*2] Flipped Unicode String ("\t"+str) (To seperate the entrys add "\t")
BYTE[2] 0x01
BYTE[2] 0x0000

what i don't get is why there is 2 times the buff ID and show/remove oh dear also too many zeros here and there Neutral

Author Message
MuadDib
POL Developer


Joined: 13 Feb 2006
Posts: 830
Location: Indiana, USA

PostPosted: Tue Jan 02, 2007 2:20 pm    Post subject: Reply with quote

Info updated, will update the news section soon as I finish getting all my programs reinstalled since my pc crashed the other day, lol.

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Sun Oct 28, 2007 8:25 am    Post subject: Reply with quote

I've finally started playing with this packet.
One question I have - does the core ever send minimal packets for this or am I going to have to write a looping script to cycle through players and call this packet function?

I had hopes that UOFeatureEnable=0x1a0 in servspecopt.cfg would enable this and at least send a blank buff packet (a few bytes only), but it doesn't. The exported packethook I wrote never fires.

Failing that, anyone got any advice as to how often you would be sending these packets and updating the client?

Every 1 second? Every 5 or even 10?? I've not had the experience of ever seeing it in action before.

Author Message
MuadDib
POL Developer


Joined: 13 Feb 2006
Posts: 830
Location: Indiana, USA

PostPosted: Sun Oct 28, 2007 8:47 am    Post subject: Reply with quote

Since you are already probably using TimedScripts in Distro for the "buffs and debuffs" you are modifying the player with, why not use them to send the buff/defuff packet when adding or removing the buff? Smile

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Sun Oct 28, 2007 9:14 am    Post subject: Reply with quote

Well the packet is mostly working when I send it manually. So in case someone else is interested, MuadDib confirmed that POL never sends the DF packet.

Are you saying that the packet only needs to be sent ONCE when the buff is applied and ONCE when the buff expires? Or is it something that should be sent frequently?

Yep, if it only needs doing at start/stop then timed scripts would be perfect.

Author Message
MuadDib
POL Developer


Joined: 13 Feb 2006
Posts: 830
Location: Indiana, USA

PostPosted: Sun Oct 28, 2007 1:25 pm    Post subject: Reply with quote

iirc yes, beginning and end. However, at the end, it is only needed to be sent if expiring early, since the buffs SHOULD (iirc again) expire themselves if they run the full duration. Would need to test to be sure

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Mon Oct 29, 2007 2:13 am    Post subject: Reply with quote

I've done some more tests here with nightsight as my test subject.

Sending the packet displays it on the client, but the duration doesn't seem to count down automatically so you need to keep sending the packet to update the displayed duration. Sending it every 5 seconds seems to work okay and the tooltip even updates dynamically when your mouse hovers over the icon. So a really nice feature. It's all done with clilocs so the expected bandwidth is not great.

I will do more tests. The scripts themselves seem to be very simple but I've only tried it with one buff so far. If I use it with timed scripts it will not be a simple matter of starting a timer.

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Mon Oct 29, 2007 8:11 am    Post subject: Reply with quote

Some more tests and it seems that the DF packet integrates very well indeed into Timedscripts of the 097 distro.

All it needed was a couple of extra parameters in the timedScripts.cfg file to hold the icon and the cliloc numbers used, and an extra function in timedScripts.inc to send the packet. The packets are sent by two simple scripts in the subScript directory.

I was wrong about the timer not counting down automatically. It counts down in 5 second increments, by co-incidence exactly how often I was resending the packet. Embarassed

My simple example of nightsight works so well that I think I am ready to incorporate all buffs into the timedscripts. Since the packets are only sent at the start and end of the buff, I can safely say there is no significant bandwidth overhead.

Author Message
MuadDib
POL Developer


Joined: 13 Feb 2006
Posts: 830
Location: Indiana, USA

PostPosted: Tue Oct 30, 2007 7:33 pm    Post subject: Reply with quote

Handle accordingly for anything that lasts through logoff and logon. AKA, they cast Magic Resistance, get the Icon. Log off, log back on later, and still have it active, need the icon resent.

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Tue Oct 30, 2007 8:52 pm    Post subject: Reply with quote

I am fine tuning it as I go. Currently I am working through all the other conditions like restart, logoff and casting a second time.

But so far the changes to the timedscripts package is nicely minimal.

Having trouble getting the parameters for cliloc2 to display - so far it's a unicode character unrelated to what I'm sending!


Last edited by OldnGrey on Wed Oct 31, 2007 6:46 pm; edited 1 time in total

Author Message
tartaros



Joined: 27 Mar 2007
Posts: 24

PostPosted: Wed Oct 31, 2007 11:46 am    Post subject: Reply with quote

btw. since which client version is this thing supported?

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Wed Oct 31, 2007 6:48 pm    Post subject: Reply with quote

I understand it to be from v5. (5.0.2b according to one packet guide I have)
I'm not sure of the effects of sending this packet to v4 or earlier client but to be safe I am using .clientversion to determine whether or not to send the packet.

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Wed Oct 31, 2007 10:54 pm    Post subject: Reply with quote

This is a working dot command example of the packet. Something like this has been done in another topic, but for some reason I had trouble with it. Several versions of the DF packet have been published but to get it working was a little trial and error.

All this does is turn on and off the STRENGTH icon and tooltips on the buff/debuff gump.
(Must be v5 client or later. Bring up the status gump and click the button on there)

It will count down every 5 seconds.

In theory this is easily wrapped into timedScripts.inc to control the gump and actually do the buff. I am still have problems with logon/logoff with that though.

.dfpacket 1
turns it on

.dfpacket 0
turns it off


Code:
// Manually turns on and off the STRENGTH icon in the buff/debuff gump.
// Use:
// .dfpacket 1 to show
// .dfpacket 0 to remove


use uo;
use os;
use polsys;

program DFPacket(mobile, show)
   if ( show )
      show := CInt(show);
   else
      show := 0;
   endif
   var icon := 1047;
   var cliloc1 := 1015014;
   var cliloc2 := 1060485;
   var duration := 20;
   var str := " +20";   // the space at the start is important. Use cliloc parm rules for multiple parameters

   // define the offsets to make it easier
   var   OFFSET_SERIAL := 3;
   var   OFFSET_ICONNUMBER1 := 7;
   var   OFFSET_SHOW1 := 9;
   var   OFFSET_ICONNUMBER2 := 15;
   var   OFFSET_SHOW2 := 17;
   var   OFFSET_TIME := 23;
   var   OFFSET_CLILOC1 := 28;
   var   OFFSET_CLILOC2 := 32;
   var   OFFSET_CLILOC2PARMS := 42;

//   var   BLANK_CLILOC := 1005007;   // a cliloc number with blank text
//   var   ERROR_CLILOC := 500267;      // an cliloc showing an error


   var packet := CreatePacket(0xDF, MSGLEN_VARIABLE);
   packet.setint32(OFFSET_SERIAL, mobile.serial);
   packet.setint16(OFFSET_ICONNUMBER1, icon);
   packet.setint16(OFFSET_SHOW1, show);
   if ( show )
      packet.setint16(OFFSET_ICONNUMBER2, icon);
      packet.setint16(OFFSET_SHOW2, show);
      packet.setint16(OFFSET_TIME, duration);
      packet.setint32(OFFSET_CLILOC1, cliloc1);
      packet.setint32(OFFSET_CLILOC2, cliloc2);
      packet.SetUnicodeStringFlipped(OFFSET_CLILOC2PARMS, CAscZ(str), 1);
      var Length_ID := packet.GetSize();
      packet.setint16(Length_ID, 0x1);
   endif
   packet.sendpacket(mobile);
endprogram      

Author Message
gha



Joined: 06 Feb 2006
Posts: 6

PostPosted: Sat May 17, 2008 8:03 am    Post subject: Reply with quote

hi

where I can find the clicloc1 and clicloc2 constants? is it inside .mul files?

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 523

PostPosted: Sat May 17, 2008 9:58 am    Post subject: Reply with quote

Use localisation editor v2.1 I think. Older versions don't handle all the numbers of later clients.
Look for it on this excellent tools site:
http://ultima.lonet.cz/download.php

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

 




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