Page 1 of 2

Buff Icon Window

Posted: Tue May 20, 2014 9:40 am
by Harley
Tell me please, what is the name of this packet:
http://fantasiaserver.proboards.com/thr ... con-window

I didn't find in Edwards Fantasia server code. If anybody have it, please, upload!

Re: Buff Icon Window

Posted: Tue May 20, 2014 11:35 am
by Turley
http://docs.polserver.com/packets/index.php?Packet=0xDF

With some modifications in your cliloc and gumps you can completely use it for your own magery system, that's what I did. Pretty much straightforward the packet itself.

Re: Buff Icon Window

Posted: Tue May 20, 2014 2:08 pm
by Harley
Unfortunately I don't understand in packet hooks, and if you don't find it hard, upload please.
With best regards!

Re: Buff Icon Window

Posted: Tue May 20, 2014 11:30 pm
by RusseL

Code: Select all

function BuffOn(who, buff, amount, duration)
   var icon, cliloc1, cliloc2;
   if(who.isa(POLCLASS_NPC))
  	return;
   endif
  case(lower(buff))
	"reactivearmor":
		icon := 1028;
		cliloc1 := 1075812;
		cliloc2 := 1062495;
	"protection":
		icon := 1029;
		cliloc1 := 1075814;
		cliloc2 := 1062495;
	"magicreflection":
		icon := 1031;
		cliloc1 := 1075817;
		cliloc2 := 1062495;
	"polymorph":
		icon := 1035;
		cliloc1 := 1075824;
		cliloc2 := 1062495;
	"paralyze":
		icon := 1037;
		cliloc1 := 1075827;
		cliloc2 := 1075828;
	"clumsy":
		icon := 1040;
		cliloc1 := 1075831;
		cliloc2 := 1062495;
	"feeblemind":
		icon := 1041;
		cliloc1 := 1075833;
		cliloc2 := 1062495;
	"weaken":
		icon := 1042;
		cliloc1 := 1075837;
		cliloc2 := 1062495;
	"curse":
		icon := 1043;
		cliloc1 := 1075835;
		cliloc2 := 1062495;
	"agility":
		icon := 1045;
		cliloc1 := 1075841;
		cliloc2 := 1062495;
	"cunning":
		icon := 1046;
		cliloc1 := 1075843;
		cliloc2 := 1062495;
	"strength":
		icon := 1047;
		cliloc1 := 1075845;
		cliloc2 := 1062495;
	"bless":
		icon := 1048;
		cliloc1 := 1075847;
		cliloc2 := 1062495;
	"regeneration":
		icon := 1009;
		cliloc1 := 1044106;
		cliloc2 := 1075106;
	"nightsight":
		icon := 1005;
		cliloc1 := 1075643;
		cliloc2 := 1075644;
	"archprotection":
		icon := 1030;
		cliloc1 := 1075816;
		cliloc2 := 1075816;
	"incognito":
		icon := 1032;
		cliloc1 := 1075819;
		cliloc2 := 1075820;
	"invisibility":
		icon := 1036;
		cliloc1 := 1075825;
		cliloc2 := 1075826;
	"poison":
		icon := 1038;
		cliloc1 := 0x0F8627;
		cliloc2 := 0x1069B1;
   endcase
   SendBuffPacket(who, 1, CInt(amount), CInt(duration), icon, cliloc1, cliloc2);
   //TimeToBuffOff(who, buff, duration);
endfunction



function SendBuffPacket(who, turn, amount, duration, icon, cliloc1, cliloc2)
   const BUFF_CMD := 0xDF;
   const OFFSET_MSGLEN := 1;
   const OFFSET_SERIAL := 3;
   var str := "  " + CStr(CInt(amount));
   var outpkt2 := CreatePacket(BUFF_CMD, MSGLEN_VARIABLE);
   outpkt2.SetInt16(OFFSET_MSGLEN, outpkt2.GetSize());
   outpkt2.SetInt32(OFFSET_SERIAL, who.serial);
   outpkt2.SetInt16(7, icon); // Icon Nr.
   outpkt2.SetInt8(9, 0);
   outpkt2.SetInt8(10, turn); //2 additional data, 1 add, 0 remove
   outpkt2.SetInt32(11, 0);
   outpkt2.SetInt16(15, icon); // Icon Nr.
   outpkt2.SetInt8(17, 0);
   outpkt2.SetInt8(18, turn); //2 additional data, 1 add, 0 remove
   if(turn)
	outpkt2.SetInt32(19, 0); 
	outpkt2.SetInt16(23, duration);
	outpkt2.SetInt16(25, 0x0);
	outpkt2.SetInt8(27, 0x0);
	outpkt2.SetInt32(28, cliloc1); 
	outpkt2.SetInt32(32, cliloc2);
	outpkt2.SetInt32(36, 0x0);
	outpkt2.SetInt8(40, 0x0);
	outpkt2.SetInt8(41, 0x1);
	outpkt2.SetUnicodeStringFlipped(42,CAscZ(str),1);
   endif
   outpkt2.SendPacket(who);
endfunction

Re: Buff Icon Window

Posted: Wed May 21, 2014 3:05 am
by Harley
RusseL, thank u for the answer.
Tell me please, what I must add into uopacket.cfg?
And this function isn't exported?

Re: Buff Icon Window

Posted: Wed May 21, 2014 5:17 am
by RusseL
Just create an include file and call
BuffOn function from your script (protection spell for example)

Re: Buff Icon Window

Posted: Wed May 21, 2014 6:27 am
by Harley
RusseL, there is an error when I cast spell over self:

Code: Select all

 bufficonwindow.inc | !send_buff error{ errortext = "Object does not support mem
bers" }
 spellcast.inc | buff_icons.errortext error{ errortext = "Object does not suppor
t members" }
What I did:
I have added to Cast Script
var buff_icons := BuffOn(cast_on, spelldata.cfg_elem.name, mod_amount, duration);
before this:
DoTempMod(cast_on, str_mod, mod_amount, duration, mod_type);

spelldata.cfg_elem.name - is name of spell, example Agility

At thoose cast script and in function BuffOn() I have added check for it

Code: Select all

print(" spellcast.inc | spelldata.cfg_elem.name " + spelldata.cfg_elem.name );
        print(" bufficonwindow.inc | buff " + lower(buff) );
And when I cast over self this spell, there is:
bufficonwindow.inc | buff agility

I have added check to:

Code: Select all

   var send_buff := SendBuffPacket(who, 1, CInt(amount), CInt(duration), icon, cliloc1, cliloc2);
   if( !send_buff )
        print(" bufficonwindow.inc | !send_buff " + send_buff.errortext );
   endif
And there is same error.

Re: Buff Icon Window

Posted: Wed May 21, 2014 11:54 pm
by RusseL
Because BuffOn returns nothing, so your buff_icons variable is everytime false.


BuffOn is an example how it works. You should modify BuffOn function and add default case, return 0 or 1 etc.

Re: Buff Icon Window

Posted: Thu May 22, 2014 2:30 am
by Harley
I tried many variations.. nothing! Error, error... Argh!
I have added:
return array{icon, cliloc1, cliloc2};
or
return SendBuffPacket(who, 1, CInt(amount), CInt(duration), icon, cliloc1, cliloc2);
Nothing!

If not hard, laid out ready version please.

Re: Buff Icon Window

Posted: Thu May 22, 2014 2:57 am
by RusseL

Code: Select all

function BuffOn(who, buff, amount, duration)
   var icon, cliloc1, cliloc2;
   if(who.isa(POLCLASS_NPC))
     return 0;
   endif
   var cv := who.clientversion;
   var cvcheck := SplitWords(cv, ".");
   if(Cint(cvcheck[1]) < 5)
	return 0;
   else
	if(Cint(cvcheck[1]) == 5)
		if(Cint(cvcheck[2]) == 0)
			if(Cint(cvcheck[3][1]) < 2)
				return 0;
			endif
		endif
	endif
   endif
  case(lower(buff))
   "reactivearmor":
      icon := 1028;
      cliloc1 := 1075812;
      cliloc2 := 1062495;
   "protection":
      icon := 1029;
      cliloc1 := 1075814;
      cliloc2 := 1062495;
   "magicreflection":
      icon := 1031;
      cliloc1 := 1075817;
      cliloc2 := 1062495;
   "polymorph":
      icon := 1035;
      cliloc1 := 1075824;
      cliloc2 := 1062495;
   "paralyze":
      icon := 1037;
      cliloc1 := 1075827;
      cliloc2 := 1075828;
   "clumsy":
      icon := 1040;
      cliloc1 := 1075831;
      cliloc2 := 1062495;
   "feeblemind":
      icon := 1041;
      cliloc1 := 1075833;
      cliloc2 := 1062495;
   "weaken":
      icon := 1042;
      cliloc1 := 1075837;
      cliloc2 := 1062495;
   "curse":
      icon := 1043;
      cliloc1 := 1075835;
      cliloc2 := 1062495;
   "agility":
      icon := 1045;
      cliloc1 := 1075841;
      cliloc2 := 1062495;
   "cunning":
      icon := 1046;
      cliloc1 := 1075843;
      cliloc2 := 1062495;
   "strength":
      icon := 1047;
      cliloc1 := 1075845;
      cliloc2 := 1062495;
   "bless":
      icon := 1048;
      cliloc1 := 1075847;
      cliloc2 := 1062495;
   "regeneration":
      icon := 1009;
      cliloc1 := 1044106;
      cliloc2 := 1075106;
   "nightsight":
      icon := 1005;
      cliloc1 := 1075643;
      cliloc2 := 1075644;
   "archprotection":
      icon := 1030;
      cliloc1 := 1075816;
      cliloc2 := 1075816;
   "incognito":
      icon := 1032;
      cliloc1 := 1075819;
      cliloc2 := 1075820;
   "invisibility":
      icon := 1036;
      cliloc1 := 1075825;
      cliloc2 := 1075826;
   "poison":
      icon := 1038;
      cliloc1 := 0x0F8627;
      cliloc2 := 0x1069B1;
   default:
      return error{"errortext" := "Spell not found"};
   endcase
   SendBuffPacket(who, 1, CInt(amount), CInt(duration), icon, cliloc1, cliloc2);
   TimeToBuffOff(who, buff, duration);
   return 1;
endfunction

function SendBuffPacket(who, turn, amount, duration, icon, cliloc1, cliloc2)
   const BUFF_CMD := 0xDF;
   const OFFSET_MSGLEN := 1;
   const OFFSET_SERIAL := 3;
   var str := "  " + CStr(CInt(amount));
   var outpkt2 := CreatePacket(BUFF_CMD, MSGLEN_VARIABLE);
   outpkt2.SetInt16(OFFSET_MSGLEN, outpkt2.GetSize());
   outpkt2.SetInt32(OFFSET_SERIAL, who.serial);
   outpkt2.SetInt16(7, icon); // Icon Nr.
   outpkt2.SetInt8(9, 0);
   outpkt2.SetInt8(10, turn); //2 additional data, 1 add, 0 remove
   outpkt2.SetInt32(11, 0);
   outpkt2.SetInt16(15, icon); // Icon Nr.
   outpkt2.SetInt8(17, 0);
   outpkt2.SetInt8(18, turn); //2 additional data, 1 add, 0 remove
   if(turn)
   outpkt2.SetInt32(19, 0); 
   outpkt2.SetInt16(23, duration);
   outpkt2.SetInt16(25, 0x0);
   outpkt2.SetInt8(27, 0x0);
   outpkt2.SetInt32(28, cliloc1); 
   outpkt2.SetInt32(32, cliloc2);
   outpkt2.SetInt32(36, 0x0);
   outpkt2.SetInt8(40, 0x0);
   outpkt2.SetInt8(41, 0x1);
   outpkt2.SetUnicodeStringFlipped(42,CAscZ(str),1);
   endif
   outpkt2.SendPacket(who);
endfunction

function BuffOff(who, buff)
   var icon, cliloc1, cliloc2;
   if(who.isa(POLCLASS_NPC))
	return 0;
   endif
   var cv := who.clientversion;
   var cvcheck := SplitWords(cv, ".");
   if(Cint(cvcheck[1]) < 5)
	return 0;
   else
	if(Cint(cvcheck[1]) == 5)
		if(Cint(cvcheck[2]) == 0)
			if(Cint(cvcheck[3][1]) < 2)
				return 0;
			endif
		endif
	endif
   endif
   case(lower(buff))
	"reactivearmor":
		icon := 1028;
		cliloc1 := 1075812;
		cliloc2 := 1062495;
	"protection":
		icon := 1029;
		cliloc1 := 1075814;
		cliloc2 := 1062495;
	"magicreflection":
		icon := 1031;
		cliloc1 := 1075817;
		cliloc2 := 1062495;
	"polymorph":
		icon := 1035;
		cliloc1 := 1075824;
		cliloc2 := 1062495;
	"paralyze":
		icon := 1037;
		cliloc1 := 1075827;
		cliloc2 := 1075828;
	"clumsy":
		icon := 1040;
		cliloc1 := 1075831;
		cliloc2 := 1062495;
	"feeblemind":
		icon := 1041;
		cliloc1 := 1075833;
		cliloc2 := 1062495;
	"weaken":
		icon := 1042;
		cliloc1 := 1075837;
		cliloc2 := 1062495;
	"curse":
		icon := 1043;
		cliloc1 := 1075835;
		cliloc2 := 1062495;
	"agility":
		icon := 1045;
		cliloc1 := 1075841;
		cliloc2 := 1062495;
	"cunning":
		icon := 1046;
		cliloc1 := 1075843;
		cliloc2 := 1062495;
	"strength":
		icon := 1047;
		cliloc1 := 1075845;
		cliloc2 := 1062495;
	"bless":
		icon := 1048;
		cliloc1 := 1075847;
		cliloc2 := 1062495;
	"regeneration":
		icon := 1009;
		cliloc1 := 1044106;
		cliloc2 := 1075106;
	"nightsight":
		icon := 1005;
		cliloc1 := 1075643;
		cliloc2 := 1075644;
	"archprotection":
		icon := 1030;
		cliloc1 := 1075816;
		cliloc2 := 1075816;
	"incognito":
		icon := 1032;
		cliloc1 := 1075819;
		cliloc2 := 1075820;
	"invisibility":
		icon := 1036;
		cliloc1 := 1075825;
		cliloc2 := 1075826;
	"poison":
		icon := 1038;
		cliloc1 := 0x0F8627;
		cliloc2 := 0x1069B1;
   default:
      return error{"errortext" := "Spell not found"};     
   endcase
   SendBuffPacket(who, 0, 0, 0, icon, cliloc1, cliloc2);
endfunction

function TimeToBuffOff(who, buff, duration)
   if (duration <= 0)
         duration := 0;
   endif
   detach();
   sleep(duration);
   BuffOff(who, buff);
endfunction

Re: Buff Icon Window

Posted: Fri May 23, 2014 2:00 am
by Harley
RusseL, thank u very much! I have tried to start it, but, in clientversion there is some trouble.
I use 7.0.3.0 client and when check goes, it's always return 0;
I have added /* */ to all code with client version, and added:

Code: Select all

   var send_buff := SendBuffPacket(who, 1, CInt(amount), CInt(duration), icon, cliloc1, cliloc2);
   if( !send_buff )
   print(" bufficon.inc | send_buff " + send_buff.errortext );
   print(" bufficon.inc | buff " + lower(buff) );
   print(" bufficon.inc | amount " + CInt(amount) );
   print(" bufficon.inc | duration " + CInt(duration) );
   print(" bufficon.inc | icon " + icon );
   print(" bufficon.inc | cliloc1 " + cliloc1 );
   print(" bufficon.inc | cliloc2 " + cliloc2 );
   endif
What we have:

Code: Select all

 bufficon.inc | cvcheck error{ errortext = "Object does not support members" }
 bufficon.inc | buff cunning
 bufficon.inc | amount 81
 bufficon.inc | duration 783
 bufficon.inc | icon 1046
 bufficon.inc | cliloc1 1075843
 bufficon.inc | cliloc2 1062495
And there is after when buff decreases
Buff.jpg

Re: Buff Icon Window

Posted: Fri May 23, 2014 2:05 am
by RusseL
You can just remove this version check code if you are sure every player using client > 5

Re: Buff Icon Window

Posted: Fri May 23, 2014 2:28 am
by Harley
Yes, I just have done this!

Re: Buff Icon Window

Posted: Fri May 23, 2014 4:09 am
by RusseL

Code: Select all

   var send_buff := SendBuffPacket(who, 1, CInt(amount), CInt(duration), icon, cliloc1, cliloc2);
   if( !send_buff )
What for is this check there?
It's just a nonsense.
Function SendBuffPacket returns FALSE everytime. It doesnt make any sense to check it.

Re: Buff Icon Window

Posted: Fri May 23, 2014 4:35 am
by Harley
RusseL wrote:

Code: Select all

   var send_buff := SendBuffPacket(who, 1, CInt(amount), CInt(duration), icon, cliloc1, cliloc2);
   if( !send_buff )
What for is this check there?
It's just a nonsense.
Function SendBuffPacket returns FALSE everytime. It doesnt make any sense to check it.
Understood, but how can I activate this buff? After cast on me, on my screen nothing appears..

Re: Buff Icon Window

Posted: Fri May 23, 2014 4:46 am
by RusseL
Turn on ToggleBuffIconWindow in your client. (Press STATUS @ Paperdoll, and then click at blue gem on the left side of status gump)
You must have this 'corner' gump on your screen.

Re: Buff Icon Window

Posted: Fri May 23, 2014 5:23 am
by Harley
At first step & have added
Buff4.jpg
Then I buffed myself and - Alt+A - nothing happened.
Then I clicked at
Buff2.jpg
Nothing..

Then at
Buff3.jpg
And nothing...
Maybe I don't have some packethook or some else.. please help!
And tell me please, how u use it?

Re: Buff Icon Window

Posted: Fri May 23, 2014 5:50 am
by Harley
Okay, after some experiments, I have //TimeToBuffOff(who, buff, duration); and what I have this:
Buff5.jpg
Buff5.jpg (25.4 KiB) Viewed 51778 times
and it appears or does not appear..
Any ideas?

Re: Buff Icon Window

Posted: Fri May 23, 2014 6:05 am
by RusseL
I would say you have problems with your client (muls)
It doesn't look like a screenshot from your first message :D

if you press at this blue gem, you must see this 'corner' gump somewhere.
If not - your client is broken.

Re: Buff Icon Window

Posted: Fri May 23, 2014 10:40 am
by Harley
RusseL, what packet hook do u use, that actived this button? Maybe some stats hook? Only thoose sendpacket that u have upload with function, or somebody else?

And I have check, yeap, this button works, but only 2 buffs displayed - cunning and agility.
But there is no that 2 small gold lines, like u have.
With best regards!

Re: Buff Icon Window

Posted: Sat May 24, 2014 12:17 am
by RusseL
Harley wrote:RusseL, what packet hook do u use, that actived this button? Maybe some stats hook? Only thoose sendpacket that u have upload with function, or somebody else?
It is completely clientside, you do not need any hook to open it.

Re: Buff Icon Window

Posted: Mon May 26, 2014 1:36 pm
by Harley
I'm trying to lead client files in order and after tests I'll write here. Thank u for ur answer!

Re: Buff Icon Window

Posted: Thu May 29, 2014 11:34 am
by Harley
RusseL, I have tried an original client of UO and there is same problem.
Buff5.jpg
Buff5.jpg (25.4 KiB) Viewed 51686 times
Maybe something wrong with packets?
I have found other Buff Function in Fantasia Server by Edwards:

Code: Select all

/*
        Created by *Edwards
        For FantasiaShard.com

        Edwards@FantasiaShard.com

        2010-09-26
*/
use uo;
use polsys;


function UpdateBuffIcon( mobile, byref cfg_elem, byref event )

        var buff_icon := CInt( cfg_elem.BuffIcon );
        if( buff_icon )
                var level := event.level,
                    amount := event.amount;
                
                SendBuffIcon( mobile, buff_icon, level, amount );
        endif
        
        return 1;
endfunction

function SendBuffIcon( mobile, icon, modifier, duration )

        if( mobile.IsA( POLCLASS_NPC ))
                return 0;
        endif

        var show := 0;
        if( duration )
                show := 1;
        endif

	var packet := CreatePacket( 0xDF, MSGLEN_VARIABLE );
	packet.SetInt32( 3, mobile.serial );
	packet.SetInt16( 7, icon );
	packet.SetInt16( 9, show );

        if( show )
                var clilocs := GetClilocsInfo( icon ),
	            cliloc_name := clilocs[1],
	            cliloc_desc := clilocs[2];
     
                packet.SetInt16( 15, icon );
                packet.SetInt16( 17, show );
                packet.SetInt16( 23, duration );
                packet.SetInt32( 28, cliloc_name );
                packet.SetInt32( 32, cliloc_desc );
                
                var text := "",
                    i;
                    
                for( i:=1; i<=3; i+=1 )
                        text := text+"\t";
                        text := text+CStr( modifier );
                        SleepMS(4);
                endfor

                packet.SetUnicodeStringFlipped( 42, CAscZ( text ), 1 );

                var Length_ID := packet.GetSize();
                packet.SetInt16( Length_ID, 0x1 );
        endif

        packet.SendPacket( mobile );

        return 1;
endfunction

function GetClilocsInfo( icon )

	var cliloc_name,
	    cliloc_desc;
             
        case( icon )
                1028:      //ReactiveArmor
                           cliloc_name := 1075812;
                           cliloc_desc := 1042971;
                           break;
                1029:      //Protection
                           cliloc_name := 1075814;
                           cliloc_desc := 1075815;
                           break;
                1035:      //Polymorph
                           cliloc_name := 1075824;
                           cliloc_desc := 1075820;
                           break;
                1040:      //Clumsy
                           cliloc_name := 0x106a77;
                           cliloc_desc := 0x106a78;
                           break;
                1041:      //Feeblemind
                           cliloc_name := 0x106a79;
                           cliloc_desc := 0x106a7a;
                           break;
                1042:      //Weaken
                           cliloc_name := 1075837;
                           cliloc_desc := 1075838;
                           break;
                1043:      //Curse
                           cliloc_name := 1075835;
                           cliloc_desc := 0x106a88;
                           break;
                1045:      //Agility
                           cliloc_name := 0x106a81;
                           cliloc_desc := 0x106a82;
                           break;
                1046:      //Cunning
                           cliloc_name := 0x106a83;
                           cliloc_desc := 0x106a84;
                           break;
                1047:      //Strength
                           cliloc_name := 0x106a85;
                           cliloc_desc := 0x106a86;
                           break;
                1048:      //Bless
                           cliloc_name := 0x106a87;
                           cliloc_desc := 0x106a88;
                           break;
                1037:      //Paralyze
                           cliloc_name := 1075827;
                           cliloc_desc := 1075828;
                           break;
                1036:      //Invisibility
                           cliloc_name := 1075825;
                           cliloc_desc := 1075826;
                           break;
        endcase
        
        return array{cliloc_name, cliloc_desc};
endfunction
This function is from package timedScripts.
There are full system of that buff packet, and I'm try to compile only subject functions, but not really lucky..

Re: Buff Icon Window

Posted: Thu May 29, 2014 12:10 pm
by Harley
Turley wrote:http://docs.polserver.com/packets/index.php?Packet=0xDF

With some modifications in your cliloc and gumps you can completely use it for your own magery system, that's what I did. Pretty much straightforward the packet itself.
Turley, maybe u will tell me that secret what have u did with cliloc & gumps? And maybe u'll share it?
And if it's not hard, share your functions please.
With best regards!

Re: Buff Icon Window

Posted: Fri May 30, 2014 1:50 am
by RusseL
Harley wrote:RusseL, I have tried an original client of UO and there is same problem.

Maybe something wrong with packets?
I have found other Buff Function in Fantasia Server by Edwards:
Everything is fine with packet.

Here is a video for you, i use the same function.
http://youtu.be/IK6b6sKlV7I