PenUltima Online

It is currently Sun Sep 07, 2008 12:39 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 18 posts ] 
Author Message
 Post subject: Buff/debuff packet fixes
PostPosted: Tue Jan 02, 2007 3:55 am 
Offline

Joined: Thu Dec 28, 2006 11:52 am
Posts: 80
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 O_o also too many zeros here and there :|


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 02, 2007 10:20 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
Info updated, will update the news section soon as I finish getting all my programs reinstalled since my pc crashed the other day, lol.

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 28, 2007 4:25 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 28, 2007 4:47 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
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? :)

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 28, 2007 5:14 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 28, 2007 9:25 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
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

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 28, 2007 10:13 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 29, 2007 4:11 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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. :oops:

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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 3:33 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
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.

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 4:52 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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 2:46 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 7:46 am 
Offline

Joined: Tue Mar 27, 2007 6:30 am
Posts: 24
btw. since which client version is this thing supported?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 2:48 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 6:54 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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      


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 17, 2008 4:03 am 
Offline

Joined: Mon Feb 06, 2006 4:01 am
Posts: 6
hi

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 17, 2008 5:58 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
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


Top
 Profile  
 
 Post subject: Re: Buff/debuff packet fixes
PostPosted: Fri Aug 22, 2008 5:47 am 
Offline

Joined: Mon Apr 02, 2007 1:13 pm
Posts: 4
Hi i have problem with this packet sometime it shows duration ( time of buff/debuff ) and sometimes not why?


Top
 Profile  
 
 Post subject: Re: Buff/debuff packet fixes
PostPosted: Fri Aug 22, 2008 7:16 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 549
I've implemented just about all the tempmods on my shard and they all show the duration reasonably correctly - within a few seconds.

I have no idea why you have a problem - not enough information.


Top
 Profile  
 
 Post subject: Re: Buff/debuff packet fixes
PostPosted: Fri Aug 22, 2008 11:37 am 
Offline

Joined: Mon Apr 02, 2007 1:13 pm
Posts: 4
i probaly found reason when i cast bless for example then logout and login in few seconds then cast bless it shows everything ok except duration so i have to remove 0xDF in logon.src and everything is fine


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl