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
Party System
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Custom Script Releases
Display posts from previous:   

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Fri Apr 21, 2006 7:05 pm    Post subject: Party System Reply with quote

Code:
[ - What is this? -]
A package to handle party system packets. It can handle all client-based party commands and status window updates (mana, stamina). However, extended functionality such as karma/fame sharing, party corpse looting criminality, faction stuff and area effect spells not damaging party members is not easily packaged so it's up to you if you even want your shard to have this functionality and to code it.


[ - Changes - ]
1.3:
  Fixed careless bugs I missed after moving around a bunch in an effort to optimize.
  Fixed issues with parties >2 people. I was all alone while testing this and didn't want to run 3 or 4 clients.
  Note: I know of a few people (including Repsak) who use this with 096 and it works OK, so I'm changing core required to 096.
        Let me know if you have issues.
  Also note: I make mention of this in the source as well. No packet guide even documents the invite packet that I use so no guide
             has any mention of a decline invite, which I think is what I need. If someone invites you and it times out, and you type
             /accept, the client still thinks it's being invited but the script makes an additional check. If I knew a way to timeout
             the invite or decline the invite I wouldn't need to check anymore as it would be handled by the client.
  Thanks to Repsak for testing, reporting and suggesting fixes for this version.
       
1.2:
  UO.com says to use "/t#" for private messaging which is handled client-side so "/#" support was removed (stratics lied to me)
  Fixed a bug with private messages to someone in party position 10
  Changed spacing and variable names to make it more like the distro

1.1:
  Added support for /# private messanging
    # is position in the party of the player you want to message, ex: "/1 hello" will send "hello" to the party leader
  Added support for the /add client command
  Removed SendStatus hook, it is not really necessary, requires the attributes package and conflicts with another package in the 096 distro
  Fixed a recursion bug (the one Pierce mentions)
  Fixed lots of little small bugs
  Removed the dependency on the new attributes package
  Party messages now use specific party packets (instead of SendSysMessageUC())
  Tried to improve some of the comments...
  Removed my buggy and incomplete onCorpseRemove, since the 096 distro will handle this somewhere else

1.0:
  Crappy initial release :)
 

[ - Installation - ]
Copy the files over to your packages directory and compile.

On OSI, parties share fame and karma, can loot mobs together, may be able to loot each other's corpses, cannot compose of rival factions, and area effect spells do not damage other party members. I'll add this functionality if Austin says it's OK, but it would make the distro more dependant on the party package and would make it more specific to OSI. You can read more about it here:
http://guide.uo.com/combat_2.html

If you have corpse looting criminality checks then you can add code to check if the owner of the corpse has PARTY_LOOT_PROP set to true and the person looting is in the party. For refrence, on OSI, you can loot a corpse if it is:
 - your own corpse
 - your agressor's corpse (someone who attacks you and you kill them)
 - a criminal/murderer's
 - fellow/rival guild member

By default this package uses the party message packets (subsub commands 3 and 4) to send messages to other party members. If they have PartyMessageColor=0 in uo.cfg then they will not be able to read the messages. You can fix this by telling all of your players to set it to PartyMessageColor=368 or you can open config.inc in the include directory and change USE_PACKETED_MESSAGES to 0. This will substitute the packets for SendSysMessageUC(<message>, 3, 368).


[ - Considerations - ]
Thanks to Max Sherr for his initial help getting this moving, to Kinetix who posted some code on Folko's old forums, to Aeros, grak, Pierce and Repsak who posted on the forums when they found something wrong and a massive thanks to all of the POL devs, especially Austin for answering all of my questions.


[ - TODO - ]
Get a packet log of someone playing on OSI using the party system to double check everything.


[ - Note - ]
While coding this I came accross two undocumented subsub commands for the party system: 5 and 7. From what I can tell, 5 works exactly like 4, which is send party message. Subsub command 7 is an "invite" command, that I might not be using correctly. If anyone could tell me the precise messages OSI sends and when it sends them for the party system, or perhaps a UOLOG (my wildest dream) of a party session, I would be very greatful and could make this package more OSI-like. The below information is my best guess, but it may be wrong.

Command 0xBF, subcommand 6:
   Subsubcommand 5: Tell full party a message? (Variable # of bytes)
   · BYTE[4] id (of source)
   · BYTE[n][2] Null terminated Unicode message.
   Note: Server Message
   
   Subsubcommand 7: Send party invitation (4 bytes)
   · BYTE[4] id (of source)
   Note: Server Message


[ - Contact - ]
Please send me any comments, questions or bugs.
E-mail: tekproxy@gmail.com
AIM: tekproxy



PartySystem.zip
 Description:

Download
 Filename:  PartySystem.zip
 Filesize:  15.6 KB
 Downloaded:  261 Time(s)



Last edited by tekproxy on Thu Aug 24, 2006 5:20 pm; edited 13 times in total

Author Message
Aeros



Joined: 24 Apr 2006
Posts: 69

PostPosted: Wed Apr 26, 2006 8:02 am    Post subject: Reply with quote

Hi tekproxy,

Awesome script package, works fine, except:

Code:

[04/26 13:44:55] Script pkg/systems/partySystem/doPlayerStatus.ecl exceeded maximum call depth
Return path PCs: 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149
Client#28: Switching to queued data mode (1, 9 bytes)
Client#28: Leaving queued mode (792 bytes xmitted)


Gets spammed in the console until it crashes. Any idea why? I'm trying to isolate the problem, but no luck this side.
[/code]

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Wed Apr 26, 2006 10:53 am    Post subject: Reply with quote

What core is that? I never got that message. Also, try turning debugging on (in config.inc) so you'll know what function is being called that spams that message. I don't like function handleStatUpdate() where it loops through the player's party. I'm going to change a few lines here and there and upload it in a minute.

Author Message
Aeros



Joined: 24 Apr 2006
Posts: 69

PostPosted: Wed Apr 26, 2006 11:14 am    Post subject: Reply with quote

Hey tekproxy,

It's on core POL096-2006-03-17. Haven't done the debugging stuff yet, but let me know when you've uploaded the new file Smile Will give that a shot with debugging info on, and see what I get then.

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Wed Apr 26, 2006 11:48 am    Post subject: Reply with quote

Ok I uploaded the new version. I changed a number of things here and there that I didn't like. I just partially tested it and everything worked Ok, and I don't think I made any changes big enough to break the whole thing. Mostly I chanaged comments and spacing. I use TypeOf() to determine if the object property from the character is an array when looping through the party members to send a modified status update packet so that -might- make some difference as arrays can sometimes be tricky. Try turning debugging on and recompiling, that way I'd know for sure what function is doing that.

Author Message
Aeros



Joined: 24 Apr 2006
Posts: 69

PostPosted: Wed Apr 26, 2006 11:57 am    Post subject: Reply with quote

Will do - by the way:

In your party chat, I had to force-convert the unicode chat to strings, as the unicode refused to show up in the clients. Is it doing that on your side as well?

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Wed Apr 26, 2006 12:05 pm    Post subject: Reply with quote

No, my clients handle the unicode correctly. What client are you using? I used AoS and SE and they both worked.

Author Message
Aeros



Joined: 24 Apr 2006
Posts: 69

PostPosted: Wed Apr 26, 2006 12:08 pm    Post subject: Reply with quote

Hm, strange. I tested on the latest SE clients. This is what I had to do in order for it to work:

Code:

var themsg := "[Party] " + who.name + ": ";
         
var amsg := array;
amsg := CChrZ(msg);
themsg := themsg + amsg;
         
SendSysMessage( char, themsg, 3,90 );

Author Message
Aeros



Joined: 24 Apr 2006
Posts: 69

PostPosted: Wed Apr 26, 2006 12:15 pm    Post subject: Reply with quote

Refer to above post. The following code did NOT work on the latest SE clients:

Code:

var cmsg := CAscZ( "[Party] " + who.name + ": " );
   
cmsg := cmsg + msg;

SendSysMessageUC( char, cmsg, "ENU" );

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Wed Apr 26, 2006 12:26 pm    Post subject: Reply with quote

I deleted all .ecl files, recompiled and restarted the server before testing just to be sure.

I just now re-tested chat and messaging with two 5.0.1j UO:SE clients both ways multiple times and I could not simulate your problem.

What encryption are you using?
What language?
Have you tried printing cmsg out right before SendSysMessageUC() ?
Have you tried printing CChrZ(cmsg) right before SendSysMessageUC() ?

Author Message
Pierce



Joined: 02 Feb 2006
Posts: 259

PostPosted: Thu May 04, 2006 11:34 am    Post subject: Reply with quote

@Aeros:
I think you are using the "old" attributes.inc. Right?
If you change the doPlayerStatus.src with the following code, you should get rid of these exceeded maximum call depth errors.

Code:

use uo;

include "config";
include "packetInfo";

const OFFSET_UPDATE_STAT_PLAYERID := 1;

const OFFSET_SEND_STATUS_LENGTH := 1;
const OFFSET_SEND_STATUS_PLAYERID := 3;
const OFFSET_SEND_STATUS_CURRENT_HEALTH := 37;
const OFFSET_SEND_STATUS_MAX_HEALTH := 39;
const OFFSET_SEND_STATUS_NAME_CHANGE := 41;
const OFFSET_SEND_STATUS_VALID := 42;
const OFFSET_SEND_STATUS_SEX := 43;
const OFFSET_SEND_STATUS_STR := 44;
const OFFSET_SEND_STATUS_DEX := 46;
const OFFSET_SEND_STATUS_INT := 48;
const OFFSET_SEND_STATUS_CURRENT_STAMINA := 50;
const OFFSET_SEND_STATUS_MAX_STAMINA := 52;
const OFFSET_SEND_STATUS_CURRENT_MANA := 54;
const OFFSET_SEND_STATUS_MAX_MANA := 56;
const OFFSET_SEND_STATUS_GOLD := 58;
const OFFSET_SEND_STATUS_ARMOR := 62;
const OFFSET_SEND_STATUS_WEIGHT := 64;

program doPlayerStatus()
  print( "Hooking Party Status Update..." );
  return 1;
endprogram

exported function handleUpdateStat( character, byref packet )
  var id := packet.GetInt32( OFFSET_UPDATE_STAT_PLAYERID );
  var party := GetObjProperty( character, PARTY_PROP );
  var char;

  if ( party[1] )
    foreach member in party
      if ( member != id )
        char := SystemFindObjectBySerial( member );
        if ( char && (CoordinateDistance(char.x,char.y,character.x,character.y) <= PARTY_STATUS_UPDATE_DISTANCE))
          packet.SendPacket(char);
        endif
      endif
    endforeach
  endif
 
  return 0;
endfunction

exported function handleSendStatus( character, byref packet )
  var party := GetObjProperty( character, PARTY_PROP );

  if ( party[1] )
    var id := packet.GetInt32( OFFSET_SEND_STATUS_PLAYERID );
    if ((id in party) && (character.serial != id))
      var char := SystemFindObjectBySerial( id );
      if ( char )
        packet.SetInt16( OFFSET_SEND_STATUS_LENGTH, 66 );
        packet.SetInt16( OFFSET_SEND_STATUS_CURRENT_HEALTH, Cint(GetVital(char, "life")/ 100) );
        packet.SetInt16( OFFSET_SEND_STATUS_MAX_HEALTH, Cint(GetVitalMaximumValue(char, "life")/ 100) );
        packet.SetInt8( OFFSET_SEND_STATUS_NAME_CHANGE, 0 );
        packet.SetInt8( OFFSET_SEND_STATUS_VALID, 1 );
        packet.SetInt8( OFFSET_SEND_STATUS_SEX, char.gender );
        packet.SetInt16( OFFSET_SEND_STATUS_STR, GetAttribute(char, "strength"));
        packet.SetInt16( OFFSET_SEND_STATUS_DEX, GetAttribute(char, "dexterity"));
        packet.SetInt16( OFFSET_SEND_STATUS_INT, GetAttribute(char, "intelligence"));
        packet.SetInt16( OFFSET_SEND_STATUS_CURRENT_STAMINA, Cint(GetVital(char, "stamina")/100));
        packet.SetInt16( OFFSET_SEND_STATUS_MAX_STAMINA, Cint(GetVitalMaximumValue(char, "stamina")/100));
        packet.SetInt16( OFFSET_SEND_STATUS_CURRENT_MANA, CInt(GetVital(char, "mana")/100));
        packet.SetInt16( OFFSET_SEND_STATUS_MAX_MANA, Cint(GetVitalMaximumValue(char, "mana")/100));
        packet.SetInt32( OFFSET_SEND_STATUS_GOLD, 0 );
        packet.SetInt16( OFFSET_SEND_STATUS_ARMOR, 0 );
        packet.SetInt16( OFFSET_SEND_STATUS_WEIGHT, 0 );
      endif
    endif
  endif
 
  return 0;
endfunction

Author Message
Pierce



Joined: 02 Feb 2006
Posts: 259

PostPosted: Wed May 10, 2006 7:03 pm    Post subject: Reply with quote

Damn, i hate if i am wrong Laughing
Even with the above script you get a

Quote:

pkg/systems/partySystem/doPlayerStatus.ecl exceeded maximum call depth
Return path PCs: xxx


So if your standard in pol.cfg is: MaxCallDepth=100
You will get this error spawning your pol.log.
The code caused extremly lag to players who use it.
I changed it to the above using CoordinateDistance.
Don't know if that helps. We will see tomorrow Smile

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Thu May 11, 2006 12:01 am    Post subject: Reply with quote

It sounds like the party prop is not being cleared off of players or something strange is happening to make that loop happen more than 100 times, which should never happen. Normally I put sleepms(2); in my loops but that loop should never iterate more than 10 times... If you find out more about that problem, let me know. I plan to go through all of this code and make the messages more OSI-like and implement a few new things I've learned but I'm kind of busy with a lot of other things.

Thanks for your post. I'm glad someone is making use of it.

Author Message
qrak



Joined: 05 Feb 2006
Posts: 160
Location: Poland

PostPosted: Thu May 11, 2006 4:02 pm    Post subject: Reply with quote

this party system should be in new distro96. Autsin you should appreciate tekproxy work and include that system. I'm using that system on live shard. Tekproxy you made good work, take care.

Author Message
Austin
POL Developer


Joined: 30 Jan 2006
Posts: 355
Location: San Diego, California

PostPosted: Thu May 11, 2006 6:49 pm    Post subject: Reply with quote

Ill look into it very soon. Im not showing favoritism... Unreal's stuff got used first because I was working on something related to it and someone already did what I had to do... but yeah, after the Trogdor AI is done, ill look into it. Gotta do something funny ever so often to prevent burnout Razz

Post new topic   Reply to topic    PenUltima Online Forum Index -> Custom Script Releases All times are GMT - 4 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 




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