PenUltima Online

It is currently Sat Sep 06, 2008 10:06 pm

All times are UTC - 8 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Close door, party system, skill lock
PostPosted: Wed Apr 19, 2006 6:00 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
If I coded the hook to handle the close door macro, a package to handle party systems and a package to handle the skill locks, could I then send you the code OR are you already working on these and they're laying around half finished not in the distro yet?

These are just some things I saw unfinished and I think I could do. I'll be sure to code them with propper documentatioin, spacing and naming and all that.

Madman isn't answering his e-mail so I've got to bother you MuadDib. :oops:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 7:49 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
Sorry to interfere.

I have some fully implemented party system script lying around here... would need to be adjusted to the packet hooks though.
(if anyone knows how to use the packethook this is won't take long I guess).

It's about 3 years old, since then i haven't scripted much for POL.

I could paste it here, if anyone's interested.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 8:39 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
Was it written by Kinetix? I found some of his old code on Folko's forums about a party system. If it works well post it and I'll try to get it working. If you don't know who wrote it or someone removed the Authors name, I'll compare the two and we'll find out.

Does anyone know anything about the Chat system?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 8:58 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
No it's completely written by me... but I remember someone doing it again...and I think folko wrote one at the same time I did.

(Max at Folkos forum = me.. you'll find a thread somewhere there.)

Chat system... yup, i also have a script for that (but it's limited to one global chatroom)

EDIT:

Ahh i found kinetix's script on folko's forum. Never tried it though.
Well I didn't know this was around... makes my offer kindof obsolete:-)
I suppose it works or he wouldn't have released it.


Last edited by Max Scherr on Wed Apr 19, 2006 9:53 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 9:04 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
Oooh, ok. I just read that thread, in fact. Cool!

So the party system would have to be rewritten for packet hooks? From what I can tell that wouldn't be that hard to do. If you want and you're feeling generous, post your code or e-mail it to me and I'll go over it and try to get it working and posted back up here. If you don't feel like it then don't worry I'll mess around with this other code and packet list, but I may bother you from time to time now that I know you already know how it's done. :twisted:

How difficult would it be to expand the chat system to be OSI-like? I don't even know how OSI handles their chat system. I've barely messed with it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 9:08 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
Well I can send you all the party system stuff I have and together with kinetix's you should have enough infosrmation if you encounter any problems.

I was quite bitchy back then about giving away my private shard code...
but by now I don't really care as I'm not active anymore.

Converting to the hooks is not really hard I think... I don't really know how they work so it stays an asumption;-)

OSI-Chatsystem: No idea how that works but I think there's more than one room/channel to talk in.

Actually I guess I was just too lazy to extend it t... but I might have missed packetinfos as well, I really don't remember.

EDIT: I need your email address;-)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 9:50 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
This is PartySystem.src

Code:
use uo;

include "include/PartySystem";

program PartySystem(ch, data)
  var dataarray := SplitWords(data);
  if (dataarray[1] = "ClientPacketbfSubcommand6")
    if (dataarray[2] = "Subsubcommand1")
      var pmserial := CInt(dataarray[3]);
      AddPartyMember(ch, pmserial);

    elseif (dataarray[2] = "Subsubcommand2")
      var pmserial := CInt(dataarray[3]);
      RemovePartyMember(ch, pmserial);

    elseif (dataarray[2] = "Subsubcommand3")
      var pmserial := CInt(dataarray[3]);
      var startind := len(dataarray[1]) + len(dataarray[2]) + len(dataarray[3]) + 4;
      SendMessageToPartyMember(ch, pmserial, data[startind, len(data)]);

    elseif (dataarray[2] = "Subsubcommand4")
      var startind := len(dataarray[1]) + len(dataarray[2]) + 3;
      SendMessageToParty(ch, data[startind, len(data)]);

    elseif (dataarray[2] = "Subsubcommand6")
      var pcanloot := CInt(dataarray[3]);
      if (GetObjProperty(ch, "parray"))
        SetObjProperty(ch, "pcanloot", pcanloot);
        if (pcanloot = 0)
          SendSysMessage(ch, "Your party cannot loot your corpse.");

        elseif (pcanloot = 1)
          SendSysMessage(ch, "Your party can loot your corpse.");
        endif
      endif

    elseif (dataarray[2] = "Subsubcommand8")
      var plserial := CInt(dataarray[3]);
      SetObjProperty(ch, "pinvitation", {plserial, "accepted"});

    elseif (dataarray[2] = "Subsubcommand9")
      var plserial := CInt(dataarray[3]);
      SetObjProperty(ch, "pinvitation", {plserial, "declined"});
    endif
  endif
endprogram


That's the whole interface to the party system. It's a textcmd.. I guess you know how that stuff was supposed to work;-)


PartySystem.inc:

Code:
use os;
use uo;

include "include/SendPacket";

function AddPartyMember(ch, pmserial)
  var pm := CheckPartyMember(ch, pmserial, 0);
  if (pm != 0)
    var pinvitation := InvitePartyMember(ch, pm);
    if (pinvitation = "declined")
      SendSysMessage(ch, pm.name +" has declined your offer.");
      SendSysMessage(pm, "You have declined "+ ch.name +"'s offer.");

    elseif (pinvitation = "accepted")
      SendSysMessage(ch, pm.name +" has accepted your offer.");
      SendSysMessage(pm, "You have accepted "+ ch.name +"'s offer.");
      var parray := GetObjProperty(ch, "parray");
      var parray2 := parray[2];
      if (!parray)
        SetObjProperty(ch, "parray", {ch.serial, {pm.serial}});
        SetObjProperty(ch, "pcanloot", 1);
        SendSysMessage(ch, "Your party can loot your corpse.");
        SetObjProperty(pm, "pcanloot", 1);
        SendSysMessage(pm, "Your party can loot your corpse.");
        UpdateParty(ch, pm, 0);
        SendSysMessage(pm, "You have joined the party.");

      elseif (parray)
        parray2.append(pm.serial);
        parray := {parray[1], parray2};
        SetObjProperty(ch, "parray", parray);
        SetObjProperty(pm, "pcanloot", 1);
        SendSysMessage(pm, "Your party can loot your corpse.");
        UpdateParty(ch, pm, 0);
        SendSysMessage(pm, "You have joined the party.");
      endif
    endif
  endif
endfunction

function RemovePartyMember(ch, pmserial)
  var pm := CheckPartyMember(ch, pmserial, 1);
  if (pm != 0)
    if (pm.serial != ch.serial)
      var pmparray := GetObjProperty(pm, "parray");
      var parray := ErasePartyMemberFromPartyArray(pm);
      SetObjProperty(ch, "parray", parray);
      UpdateParty(ch, pm, 1);
      SendSysMessage(pm, "You have been removed from the party.");
      parray := GetObjProperty(ch, "parray");
      if (parray[2] = {})
        DisbandParty(ch, pmparray);
      endif

    elseif (pm.serial = ch.serial)
      var parray := GetObjProperty(ch, "parray");
      if (parray[1] != ch.serial)
        var pmparray := GetObjProperty(ch, "parray");
        LeaveParty(ch);
        parray := GetObjProperty(pmparray[1], "parray");
        if (parray[2] = {})
          DisbandParty(SystemFindObjectBySerial(parray[1], SYSFIND_SEARCH_OFFLINE_MOBILES), pmparray);
        endif

      elseif (parray[1] = ch.serial)
        DisbandParty(ch, parray);
      endif
    endif
  endif
endfunction

function LeaveParty(ch)
  var parray := ErasePartyMemberFromPartyArray(ch);
  SetObjProperty(parray[1], "parray", parray);
  UpdateParty(SystemFindObjectBySerial(parray[1], SYSFIND_SEARCH_OFFLINE_MOBILES), ch, 1);
  SendSysMessage(ch, "You have left the party.");
endfunction

function DisbandParty(ch, parray)
  var parray2 := parray[2];
  var PacketHexStringPart1 := "BF"+ ConvertIntToHex(15 + len(parray[2]) * 4, 2);
  PacketHexStringPart1 := PacketHexStringPart1 + ConvertIntToHex(6, 2);
  PacketHexStringPart1 := PacketHexStringPart1 + ConvertIntToHex(2, 1);
  PacketHexStringPart1 := PacketHexStringPart1 + ConvertIntToHex(len(parray[2]) + 1, 1);
  var PacketHexStringPart2 := ConvertIntToHex(ch.serial, 4);
  foreach pmserial in parray2
    PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(pmserial, 4);
  endforeach
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(ch.serial, 4) + PacketHexStringPart2;
  EraseObjProperty(ch, "parray");
  EraseObjProperty(ch, "pcanloot");
  SendPacket(ch, FullPacketHexString);
  SendSysMessage(ch, "Your party has disbanded.");
  var pm;
  foreach pmserial in parray2
    pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
    FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(pmserial, 4) + PacketHexStringPart2;
    EraseObjProperty(pm, "parray");
    EraseObjProperty(pm, "pcanloot");
    SendPacket(pm, FullPacketHexString);
    SendSysMessage(pm, "Your party has disbanded.");
  endforeach
endfunction

function ErasePartyMemberFromPartyArray(pm)
  var parray := GetObjProperty(pm, "parray");
  var parray2 := parray[2];
  var parray2pmindex := 1;
  while (parray2[parray2pmindex] != pm.serial)
    parray2pmindex := parray2pmindex + 1;
  endwhile
  parray2.erase(parray2pmindex);
  parray := {parray[1], parray2};
  return parray;
endfunction

function UpdateParty(ch, pm, type)
  var parray := GetObjProperty(ch, "parray");
  var parray2 := parray[2];
  if (type = 0)
    var PacketHexString := "BF"+ ConvertIntToHex(11 + len(parray[2]) * 4, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(6, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(1, 1);
    PacketHexString := PacketHexString + ConvertIntToHex(len(parray[2]) + 1, 1);
    PacketHexString := PacketHexString + ConvertIntToHex(ch.serial, 4);
    foreach pmserial in parray2
      PacketHexString := PacketHexString + ConvertIntToHex(pmserial, 4);
    endforeach
    SendPacket(ch, PacketHexString);
    SendSysMessage(ch, pm.name +" has joined the party.");
    var pmname := pm.name;
    var pmexcludeserial := pm.serial;
    foreach pmserial in parray2
      pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
      SetObjProperty(pm, "parray", parray);
      SendPacket(pm, PacketHexString);
      if (pmserial != pmexcludeserial)
        SendSysMessage(pm, pmname +" has joined the party.");
      endif
    endforeach

  elseif (type = 1)
    var PacketHexString := "BF"+ ConvertIntToHex(15 + len(parray[2]) * 4, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(6, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(2, 1);
    PacketHexString := PacketHexString + ConvertIntToHex(len(parray[2]) + 1, 1);
    PacketHexString := PacketHexString + ConvertIntToHex(pm.serial, 4);
    PacketHexString := PacketHexString + ConvertIntToHex(ch.serial, 4);
    foreach pmserial in parray2
      PacketHexString := PacketHexString + ConvertIntToHex(pmserial, 4);
    endforeach
    SendPacket(ch, PacketHexString);
    SendSysMessage(ch, pm.name +" has left the party.");
    var pmname := pm.name;
    foreach pmserial in parray2
      pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
      SetObjProperty(pm, "parray", parray);
      SendPacket(pm, PacketHexString);
      SendSysMessage(pm, pmname +" has left the party.");
    endforeach
    parray := GetObjProperty(pm, "parray");
    parray2 := parray[2];
    PacketHexString := "BF"+ ConvertIntToHex(15 + len(parray[2]) * 4, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(6, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(2, 1);
    PacketHexString := PacketHexString + ConvertIntToHex(len(parray[2]) + 1, 1);
    PacketHexString := PacketHexString + ConvertIntToHex(pm.serial, 4);
    PacketHexString := PacketHexString + ConvertIntToHex(ch.serial, 4);
    foreach pmserial in parray2
      PacketHexString := PacketHexString + ConvertIntToHex(pmserial, 4);
    endforeach
    EraseObjProperty(pm, "parray");
    EraseObjProperty(pm, "pcanloot");
    SendPacket(pm, PacketHexString);
  endif
endfunction

function InvitePartyMember(ch, pm)
  SendSysMessage(ch, "You have invited "+ pm.name +" to join your party.");
  SendSysMessage(pm, "You have been invited to join "+ ch.name +"'s party. Type \"/accept\" to join or \"/decline\" to decline the offer.");
  var PacketHexString := "BF"+ ConvertIntToHex(14, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(6, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(7, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(ch.serial, 4);
  PacketHexString := PacketHexString +"00000000";
  EraseObjProperty(pm, "pinvitation");
  SendPacket(pm, PacketHexString);
  var pinvitationcounter := 0;
  while ((!GetObjProperty(pm, "pinvitation")) and (pinvitationcounter < 10))
    sleep(1);
    pinvitationcounter := pinvitationcounter + 1;
  endwhile
  var pinvitation := GetObjProperty(pm, "pinvitation");
  EraseObjProperty(pm, "pinvitation");
  if (!pinvitation)
    return "declined";

  elseif (pinvitation)
    if (pinvitation[1] = ch.serial)
      return pinvitation[2];

    else
      return "declined";
    endif
  endif
endfunction

function CheckPartyMember(ch, pmserial, type)
  if (type = 0)
    if (pmserial != 0)
      var parray := GetObjProperty(ch, "parray");
      if (!parray)
        var pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
        var pmparray := GetObjProperty(pm, "parray");
        if (pm.serial != ch.serial)
          if (!pmparray)
            if ((!pm.npctemplate) and (pm.ip))
              return pm;

            elseif ((pm.npctemplate) or (!pm.ip))
              SendSysMessage(ch, "You can only add online players to your party.");
              return 0;
            endif

          elseif (pmparray)
            SendSysMessage(ch, "This player has already joined a party.");
            return 0;
          endif

        elseif (pm.serial = ch.serial)
          SendSysMessage(ch, "Please choose another player.");
          return 0;
        endif

      elseif (parray)
        if (parray[1] != ch.serial)
          SendSysMessage(ch, "Only the party leader can do this.");
          return 0;

        elseif (parray[1] = ch.serial)
          if (len(parray[2]) < 9)
            var pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
            var pmparray := GetObjProperty(pm, "parray");
            if (pm.serial != ch.serial)
              if (!pmparray)
                if ((!pm.npctemplate) and (pm.ip))
                  return pm;

                elseif ((pm.npctemplate) or (!pm.ip))
                  SendSysMessage(ch, "You can only add online players to your party.");
                  return 0;
                endif

              elseif (pmparray)
                SendSysMessage(ch, "This player has already joined a party.");
                return 0;
              endif

            elseif (pm.serial = ch.serial)
              SendSysMessage(ch, "Please choose another player.");
              return 0;
            endif

          elseif (len(parray[2]) = 9)
            SendSysMessage(ch, "You can't add any more members to your party.");
            return 0;
          endif
        endif
      endif

    elseif (pmserial = 0)
      var parray := GetObjProperty(ch, "parray");
      if (!parray)
        SendSysMessage(ch, "Who would you like to add to your party?");
        var pm := Target(ch);
        if (!pm)
          SendSysMessage(ch, "Targetting cancelled.");
          return 0;
        endif
        var pmparray := GetObjProperty(pm, "parray");
        if (pm.serial != ch.serial)
          if (!pmparray)
            if ((!pm.npctemplate) and (pm.ip))
              return pm;

            elseif ((pm.npctemplate) or (!pm.ip))
              SendSysMessage(ch, "You can only add online players to your party.");
              return 0;
            endif

          elseif (pmparray)
            SendSysMessage(ch, "This player has already joined a party.");
            return 0;
          endif

        elseif (pm.serial = ch.serial)
          SendSysMessage(ch, "Please choose another player.");
          return 0;
        endif

      elseif (parray)
        if (parray[1] != ch.serial)
          SendSysMessage(ch, "Only the party leader can do this.");
          return 0;

        elseif (parray[1] = ch.serial)
          if (len(parray[2]) < 9)
            SendSysMessage(ch, "Who would you like to add to your party?");
            var pm := Target(ch);
            if (!pm)
              SendSysMessage(ch, "Targetting cancelled.");
              return 0;
            endif
            var pmparray := GetObjProperty(pm, "parray");
            if (pm.serial != ch.serial)
              if (!pmparray)
                if ((!pm.npctemplate) and (pm.ip))
                  return pm;

                elseif ((pm.npctemplate) or (!pm.ip))
                  SendSysMessage(ch, "You can only add online players to your party.");
                  return 0;
                endif

              elseif (pmparray)
                SendSysMessage(ch, "This player has already joined a party.");
                return 0;
              endif

            elseif (pm.serial = ch.serial)
              SendSysMessage(ch, "Please choose another player.");
              return 0;
            endif

          elseif (len(parray[2]) = 9)
            SendSysMessage(ch, "You can't add any more members to your party.");
            return 0;
          endif
        endif
      endif
    endif

  elseif (type = 1)
    if (pmserial != 0)
      var parray := GetObjProperty(ch, "parray");
      if (!parray)
        SendSysMessage(ch, "You are not a member of a party.");
        return 0;

      elseif (parray)
        if (parray[1] != ch.serial)
          if (pmserial != ch.serial)
            SendSysMessage(ch, "Only the party leader can do this.");
            return 0;

          elseif (pmserial = ch.serial)
            var pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
            return pm;
          endif

        elseif (parray[1] = ch.serial)
          var pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
          var pmparray := GetObjProperty(pm, "parray");
          if (!pmparray)
            SendSysMessage(ch, "This player is not a member of a party.");
            return 0;

          elseif (pmparray)
            if (pmparray[1] != parray[1])
              SendSysMessage(ch, "This player is not a member of your party.");
              return 0;

            elseif (pmparray[1] = parray[1])
              return pm;
            endif
          endif
        endif
      endif

    elseif(pmserial = 0)
      var parray := GetObjProperty(ch, "parray");
      if (!parray)
        SendSysMessage(ch, "You are not a member of a party.");
        return 0;

      elseif (parray)
        if (parray[1] != ch.serial)
          SendSysMessage(ch, "Who would you like to remove from your party?");
          var pm := Target(ch);
          if (!pm)
            SendSysMessage(ch, "Targetting cancelled.");
            return 0;
          endif
          var pmparray := GetObjProperty(pm, "parray");
          if (!pmparray)
            SendSysMessage(ch, "This player is not a member of a party.");
            return 0;

          elseif (pmparray)
            if (pm.serial != ch.serial)
              SendSysMessage(ch, "Only the party leader can do this.");
              return 0;

            elseif (pm.serial = ch.serial)
              return ch;
            endif
          endif

        elseif (parray[1] = ch.serial)
          SendSysMessage(ch, "Who would you like to remove from your party?");
          var pm := Target(ch);
          if (!pm)
            SendSysMessage(ch, "Targetting cancelled.");
            return 0;
          endif
          var pmparray := GetObjProperty(pm, "parray");
          if (!pmparray)
            SendSysMessage(ch, "This player is not a member of a party.");
            return 0;

          elseif (pmparray)
            if (pmparray[1] != parray[1])
              SendSysMessage(ch, "This player is not a member of your party.");
              return 0;

            elseif (pmparray[1] = parray[1])
              return pm;
            endif
          endif
        endif
      endif
    endif
  endif
endfunction

function SendMessageToPartyMember(ch, pmserial, pmmessage)
  var PacketHexString := "BF"+ ConvertIntToHex(10 + len(ConvertStrToHex(pmmessage, 1)) / 2, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(6, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(3, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(ch.serial, 4);
  PacketHexString := PacketHexString + ConvertStrToHex(pmmessage, 1);
  var pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
  SendPacket(pm, PacketHexString);
endfunction

function SendMessageToParty(ch, pmmessage)
  var parray := GetObjProperty(ch, "parray");
  if (parray)
    var parray2 := parray[2];
    var PacketHexString := "BF"+ ConvertIntToHex(10 + len(ConvertStrToHex(pmmessage, 1)) / 2, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(6, 2);
    PacketHexString := PacketHexString + ConvertIntToHex(4, 1);
    PacketHexString := PacketHexString + ConvertIntToHex(ch.serial, 4);
    PacketHexString := PacketHexString + ConvertStrToHex(pmmessage, 1);
    if (parray[1] != ch.serial)
      var pl := SystemFindObjectBySerial(parray[1], SYSFIND_SEARCH_OFFLINE_MOBILES);
      SendPacket(pl, PacketHexString);
      var pm;
      foreach pmserial in parray2
        pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
        SendPacket(pm, PacketHexString);
      endforeach

    elseif (parray[1] = ch.serial)
      SendPacket(ch, PacketHexString);
      var pm;
      foreach pmserial in parray2
        pm := SystemFindObjectBySerial(pmserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
        SendPacket(pm, PacketHexString);
      endforeach
    endif
  endif
endfunction


That's the main include.



SendPacket.inc

Code:
use uo;
use util;

function ConvertIntToHex(astring, alength)
  astring := Hex(astring);
  astring := CStr(astring);
  if (astring["0x"])
    astring := astring[3, len(astring)];
  endif
  if (len(astring) > alength * 2)
    return;
  endif
  while (len(astring) < alength * 2)
    astring := "0"+ astring;
  endwhile   
  return astring;
endfunction

function ConvertLetterToHex(bletter)
  bletter := CStr(bletter);
  case (bletter)
    "A": return "41";
    "Ä": return "C4";
    "B": return "42";
    "C": return "43";
    "D": return "44";
    "E": return "45";
    "F": return "46";
    "G": return "47";
    "H": return "48";
    "I": return "49";
    "J": return "4A";
    "K": return "4B";
    "L": return "4C";
    "M": return "4D";
    "N": return "4E";
    "O": return "4F";
    "Ö": return "D6";
    "P": return "50";
    "Q": return "51";
    "R": return "52";
    "S": return "53";
    "T": return "54";
    "U": return "55";
    "Ü": return "DC";
    "V": return "56";
    "W": return "57";
    "X": return "58";
    "Y": return "59";
    "Z": return "5A";
    "a": return "61";
    "ä": return "E4";
    "b": return "62";
    "c": return "63";
    "d": return "64";
    "e": return "65";
    "f": return "66";
    "g": return "67";
    "h": return "68";
    "i": return "69";
    "j": return "6A";
    "k": return "6B";
    "l": return "6C";
    "m": return "6D";
    "n": return "6E";
    "o": return "6F";
    "ö": return "F6";
    "p": return "70";
    "q": return "71";
    "r": return "72";
    "s": return "73";
    "t": return "74";
    "u": return "75";
    "ü": return "FC";
    "v": return "76";
    "w": return "77";
    "x": return "78";
    "y": return "79";
    "z": return "7A";
    "!": return "21";
    "/": return "2F";
    "[": return "5B";
    "]": return "5D";
    "@": return "40";
    "=": return "3D";
    "#": return "23";
    "'": return "27";
    "´": return "B4";
    "`": return "60";
    "{": return "7B";
    "}": return "7D";
    "_": return "5F";
    ",": return "2C";
    ".": return "2E";
    "<": return "3C";
    ">": return "3E";
    "|": return "7C";
    "^": return "5E";
    "ß": return "DF";
    "?": return "3F";
    ":": return "3A";
    ";": return "3B";
    "-": return "2D";
    "+": return "2B";
    "*": return "2A";
    "(": return "28";
    ")": return "29";
    "1": return "31";
    "2": return "32";
    "3": return "33";
    "4": return "34";
    "5": return "35";
    "6": return "36";
    "7": return "37";
    "8": return "38";
    "9": return "39";
    "0": return "30";
    " ": return "20";
    default: return "20";
  endcase
endfunction

function ConvertStrToHex(cstring, ctype := 0, clength := 0)
  if (ctype = 0)
    cstring := CStr(cstring);
    var convertedstring := "";
    var letter := 1;
    repeat
      convertedstring := convertedstring + ConvertLetterToHex(cstring[letter, 1]);
      letter := letter + 1;
    until (len(cstring) = len(convertedstring) / 2);
    return convertedstring;

  elseif (ctype = 1)
    cstring := CStr(cstring);
    var convertedstring := "";
    var letter := 1;
    repeat
      convertedstring := convertedstring + ConvertLetterToHex(cstring[letter, 1]) +"00";
      letter := letter + 1;
    until (len(cstring) = len(convertedstring) / 4);
    convertedstring := "00"+ convertedstring +"00";
    return convertedstring;

  elseif (ctype = 2)
    cstring := CStr(cstring);
    var convertedstring := "";
    var letter := 1;
    repeat
      convertedstring := convertedstring + ConvertLetterToHex(cstring[letter, 1]);
      letter := letter + 1;
    until (len(cstring) = len(convertedstring) / 2);
    if (len(convertedstring) > clength * 2)
      return;
    endif
    while (len(convertedstring) < clength * 2)
      convertedstring := convertedstring +"00";
    endwhile
    return convertedstring;
  endif
endfunction

function SetPlayerWarMode(who, dvalue)
  var PacketHexString;
  PacketHexString := "72"+ ConvertIntToHex(dvalue, 1);
  PacketHexString := PacketHexString +"003200";
  SendPacket(who, PacketHexString);
endfunction

function EnableChatButton(who)
  var PacketHexString;
  PacketHexString := "B90001";
  SendPacket(who, PacketHexString);
endfunction

function SendIdleWarning(who)
  var PacketHexString;
  PacketHexString := "5307";
  SendPacket(who, PacketHexString);
endfunction

function UpdatePlayer(etowhom, who, egraphic, ex, ey, ez, efacing)
  var PacketHexString;
  PacketHexString := "77"+ ConvertIntToHex(who.serial, 4);
  PacketHexString := PacketHexString + ConvertIntToHex(egraphic, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(ex, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(ey, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(ez, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(efacing, 1);
  PacketHexString := PacketHexString +"00000000";
  SendPacket(etowhom, PacketHexString);
endfunction

function PlayCharacterAnimation(ftowhom, who, fanimation, ffacing, frepeat, fdirection, frepeatflag, fframedelay)
  var PacketHexString;
  PacketHexString := "6E"+ ConvertIntToHex(who.serial, 4);
  PacketHexString := PacketHexString + ConvertIntToHex(fanimation, 2);
  PacketHexString := PacketHexString +"00";
  PacketHexString := PacketHexString + ConvertIntToHex(ffacing, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(frepeat, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(fdirection, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(frepeatflag, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(fframedelay, 1);
  SendPacket(ftowhom, PacketHexString);
endfunction

function SetQuestArrow(who, gvalue, gx, gy)
  var PacketHexString;
  PacketHexString := "BA"+ ConvertIntToHex(gvalue, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(gx, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(gy, 2);
  SendPacket(who, PacketHexString);
endfunction

function SetCursorHue(who, hvalue)
  var PacketHexString;
  PacketHexString := "BF"+ ConvertIntToHex(6, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(8, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(hvalue, 1);
  SendPacket(who, PacketHexString);
endfunction

function OpenWebBrowser(who, iaddress)
  var PacketHexStringPart1 := "A5";
  var PacketHexStringPart2 := ConvertStrToHex(iaddress);
  var FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  SendPacket(who, FullPacketHexString);
endfunction

function Play3DLightningBoltEffect(who)
  var PacketHexString := "C703"+ ConvertIntToHex(who.serial, 4);
  PacketHexString := PacketHexString +"0000000000000E260A15000E260A1500000000000000000000000000000013A700000000";
  PacketHexString := PacketHexString + ConvertIntToHex(who.serial, 4);
  PacketHexString := PacketHexString +"030000";
  foreach mobile in ListMobilesNearLocationEx(who.x, who.y, who.z, 20, LISTEX_FLAG_NORMAL + LISTEX_FLAG_HIDDEN + LISTEX_FLAG_GHOST)
    if ((mobile.ip) and (GetObjProperty(mobile, "3dclientversion")))
      SendPacket(mobile, PacketHexString);
    endif
  endforeach
endfunction

function DrawGamePlayer(who, jgraphic, jcolor)
  var PacketHexString := "20"+ ConvertIntToHex(who.serial, 4);
  PacketHexString := PacketHexString + ConvertIntToHex(jgraphic, 2);
  PacketHexString := PacketHexString +"00";
  PacketHexString := PacketHexString + ConvertIntToHex(jcolor, 2);
  PacketHexString := PacketHexString +"00";
  PacketHexString := PacketHexString + ConvertIntToHex(who.x, 2);
  PacketHexString := PacketHexString + ConvertIntToHex(who.y, 2);
  PacketHexString := PacketHexString +"0000";
  PacketHexString := PacketHexString + ConvertIntToHex(who.facing, 1);
  PacketHexString := PacketHexString + ConvertIntToHex(who.z, 1);
  SendPacket(who, PacketHexString);
endfunction

function DrawObject(ktowhom, kobj, kgraphic, kcolor, keqitrandcolor := 0)
  var PacketHexStringPart1 := "78";
  var PacketHexStringPart2 := ConvertIntToHex(kobj.serial, 4) + ConvertIntToHex(kgraphic, 2);
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(kobj.x, 2);
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(kobj.y, 2);
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(kobj.z, 1);
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(kobj.facing, 1);
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(kcolor, 2);
  PacketHexStringPart2 := PacketHexStringPart2 +"0000";
  if ((kobj.isa(POLCLASS_MOBILE)) and ((kobj.graphic = 400) or (kobj.graphic = 401)))
    var color;
    var graphic;
    foreach item in ListEquippedItems(kobj)
      PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(item.serial, 4);
      if (keqitrandcolor = 1)
        color := RandomInt(99) + 2;

      else
        color := item.color;
      endif
      if (color = 0)
        graphic := item.graphic;

      else
        graphic := item.graphic + 32768;
      endif
      PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(graphic, 2);
      PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(item.layer, 1);
      if (color != 0)
        PacketHexStringPart2 := PacketHexStringPart2 + ConvertIntToHex(color, 2);
      endif
    endforeach
  endif
  PacketHexStringPart2 := PacketHexStringPart2 +"00000000";
  var FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  SendPacket(ktowhom, FullPacketHexString);
endfunction

function DeleteObject(who, lobj)
  var PacketHexString := "1D"+ ConvertIntToHex(lobj.serial, 4);
  SendPacket(who, PacketHexString);
endfunction

function RequestClientVersionInformation(who)
  var PacketHexString := "BD0003";
  SendPacket(who, PacketHexString);
endfunction


...needed by PartySystem.inc


logoff.src

Code:
use uo;

include "include/PartySystem";

program logoff( character )
    EraseObjProperty(character, "#Online"); 


//party system begin
    EraseObjProperty(character, "pinvitation");
    var parray := GetObjProperty(character, "parray");
    if (parray)
      RemovePartyMember(SystemFindObjectBySerial(parray[1], SYSFIND_SEARCH_OFFLINE_MOBILES), character.serial);
    endif

//party system end;



    // print( "logoff: " + character.name );
    // SendSysMessage( character, "You just logged off!" );
   
    // online time counter
    var sessiontime := ReadGameClock() - GetObjProperty(character,"logontime");
    var timer := GetObjProperty(character,"onlinetimer");
    if(!timer)
       timer := 0;
    endif
    SetObjProperty(character,"onlinetimer",timer+sessiontime);
    // end online time counter

    if (!GetObjProperty(character, "private"))
      Broadcast(character.name +" has just logged off!");
    endif
   
endprogram


In the logoff script only the party system lines are important.


I think that's all.


Last edited by Max Scherr on Wed Apr 19, 2006 10:02 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 9:57 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
Now let's move on to Chat:


Chat.src:

Code:
include "include/Chat";

program Chat(ch, data)
  var dataarray := SplitWords(data);
  if (dataarray[1] = "ClientPacketb5")
    DisplayChatDialog(ch);
    CreateChannel(ch, "Chat");
    JoinChannel(ch, "Chat");

  elseif (dataarray[1] = "ClientPacketb3")
    var dataarray2 := dataarray[2];
    if (dataarray2[15, 2] = "61")
      var chatmessage := dataarray2[19, len(dataarray2) - 18];
      if (len(chatmessage) % 2 != 0)
        chatmessage := dataarray2[19, len(dataarray2) - 19];
      endif
      SendChatMessage(ch, ConvertHexToStr(dataarray2[5, 8]), ConvertHexToStr(chatmessage));

    elseif (dataarray2[15, 2] = "58")
      LeaveChannel(ch);
    endif
  endif
endprogram



Chat.inc

Code:
use uo;

include "include/SendPacket";
include "include/ReceivePacket";

function DisplayChatDialog(ch)
  var PacketHexStringPart1 := "B2";
  var PacketHexStringPart2 := "03ED00000000";
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertStrToHex(ch.name, 1);
  PacketHexStringPart2 := PacketHexStringPart2 +"00000000";
  var FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  SendPacket(ch, FullPacketHexString);
endfunction

function CreateChannel(ch, channelname)
  var PacketHexStringPart1 := "B2";
  var PacketHexStringPart2 := "03E800000000"+ ConvertStrToHex(channelname, 1);
  PacketHexStringPart2 := PacketHexStringPart2 +"000000300000";
  var FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  SendPacket(ch, FullPacketHexString);
endfunction

function JoinChannel(ch, channelname)
  var PacketHexStringPart1 := "B2";
  var PacketHexStringPart2 := "03F100000000"+ ConvertStrToHex(channelname, 1);
  PacketHexStringPart2 := PacketHexStringPart2 +"0000";
  var FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  SendPacket(ch, FullPacketHexString);
  PacketHexStringPart2 := "03EE00000000"+ ConvertStrToHex("0"+ ch.name, 1);
  PacketHexStringPart2 := PacketHexStringPart2 +"0000";
  FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  SetObjProperty(ch, "channelname", channelname);
  foreach chatter in EnumerateOnlineCharacters()
    if (GetObjProperty(chatter, "channelname") = channelname)
      SendPacket(chatter, FullPacketHexString);
    endif
  endforeach
  foreach chatter in EnumerateOnlineCharacters()
    if ((chatter.serial != ch.serial) and (GetObjProperty(chatter, "channelname") = channelname))
      PacketHexStringPart2 := "03EE00000000"+ ConvertStrToHex("0"+ chatter.name, 1);
      PacketHexStringPart2 := PacketHexStringPart2 +"0000";
      FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
      FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
      SendPacket(ch, FullPacketHexString);
    endif
  endforeach
endfunction

function SendChatMessage(ch, language, chatmessage)
  var PacketHexStringPart1 := "B2";
  var nullbytes := 4 - len(language);
  language := ConvertStrToHex(language);
  while (nullbytes != 0)
    language := language +"00";
    nullbytes := nullbytes - 1;
  endwhile
  var PacketHexStringPart2 := "0025"+ language;
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertStrToHex("0"+ ch.name, 1);
  PacketHexStringPart2 := PacketHexStringPart2 + ConvertStrToHex(chatmessage, 1);
  var FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  foreach chatter in EnumerateOnlineCharacters()
    if (GetObjProperty(chatter, "channelname") = GetObjProperty(ch, "channelname"))
      SendPacket(chatter, FullPacketHexString);
    endif
  endforeach
endfunction

function LeaveChannel(ch)
  var PacketHexStringPart1 := "B2";
  var PacketHexStringPart2 := "03EF00000000"+ ConvertStrToHex(ch.name, 1);
  PacketHexStringPart2 := PacketHexStringPart2 +"0000";
  var FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  var FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  var channelname := GetObjProperty(ch, "channelname");
  EraseObjProperty(ch, "channelname");
  foreach chatter in EnumerateOnlineCharacters()
    if (GetObjProperty(chatter, "channelname") = channelname)
      SendPacket(chatter, FullPacketHexString);
    endif
  endforeach
  PacketHexStringPart2 := "03E900000000"+ ConvertStrToHex(channelname, 1);
  PacketHexStringPart2 := PacketHexStringPart2 +"0000";
  FullPacketHexStringLength := (len(PacketHexStringPart1) + len(PacketHexStringPart2)) / 2 + 2;
  FullPacketHexString := PacketHexStringPart1 + ConvertIntToHex(FullPacketHexStringLength, 2) + PacketHexStringPart2;
  SendPacket(ch, FullPacketHexString);
endfunction



ReceivePacket.inc

Code:
function ConvertHexToInt(astring)
  astring := CStr(astring);
  while ((astring[1, 1] = "0") and (len(astring) > 1))
    astring := astring[2, len(astring)];
  endwhile
  astring := "0x"+ astring;
  astring := Hex(astring);
  astring := CInt(astring);
  return astring;
endfunction

function ConvertHexToLetter(bletter)
  bletter := lower(CStr(bletter));
  print(bletter);
  case (bletter)
    "41": return "A";
    "c4": return "Ä";
    "42": return "B";
    "43": return "C";
    "44": return "D";
    "45": return "E";
    "46": return "F";
    "47": return "G";
    "48": return "H";
    "49": return "I";
    "4a": return "J";
    "4b": return "K";
    "4c": return "L";
    "4d": return "M";
    "4e": return "N";
    "4f": return "O";
    "d6": return "Ö";
    "50": return "P";
    "51": return "Q";
    "52": return "R";
    "53": return "S";
    "54": return "T";
    "55": return "U";
    "dc": return "Ü";
    "56": return "V";
    "57": return "W";
    "58": return "X";
    "59": return "Y";
    "5a": return "Z";
    "61": return "a";
    "e4": return "ä";
    "62": return "b";
    "63": return "c";
    "64": return "d";
    "65": return "e";
    "66": return "f";
    "67": return "g";
    "68": return "h";
    "69": return "i";
    "6a": return "j";
    "6b": return "k";
    "6c": return "l";
    "6d": return "m";
    "6e": return "n";
    "6f": return "o";
    "f6": return "ö";
    "70": return "p";
    "71": return "q";
    "72": return "r";
    "73": return "s";
    "74": return "t";
    "75": return "u";
    "fc": return "ü";
    "76": return "v";
    "77": return "w";
    "78": return "x";
    "79": return "y";
    "7a": return "z";
    "21": return "!";
    "2f": return "/";
    "5b": return "[";
    "5d": return "]";
    "40": return "@";
    "3d": return "=";
    "23": return "#";
    "27": return "'";
    "b4": return "´";
    "60": return "`";
    "7b": return "{";
    "7d": return "}";
    "5f": return "_";
    "2c": return ",";
    "2e": return ".";
    "3c": return "<";
    "3e": return ">";
    "7c": return "|";
    "5e": return "^";
    "df": return "ß";
    "3f": return "?";
    "3a": return ":";
    "3b": return ";";
    "2d": return "-";
    "2b": return "+";
    "2a": return "*";
    "28": return "(";
    "29": return ")";
    "31": return "1";
    "32": return "2";
    "33": return "3";
    "34": return "4";
    "35": return "5";
    "36": return "6";
    "37": return "7";
    "38": return "8";
    "39": return "9";
    "30": return "0";
    "20": return " ";
    "00": return "";
    default: return " ";
  endcase
endfunction

function ConvertHexToStr(cstring)
  cstring := CStr(cstring);
  var convertedstring := "";
  var letter := 1;
  repeat
    convertedstring := convertedstring + ConvertHexToLetter(cstring[letter, 2]);
    letter := letter + 2;
  until (len(cstring) = letter - 1);
  return convertedstring;
endfunction




Both Chat and PartySystem are my creation... so if it's of any help a little bit of credit would be appreciated. But it's not necessary.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 10:20 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
I'm no heathen! I'll make sure you're noted. ;)

It will take me a while to pour over this code. Thank you very much for your help. If muad doesn't want this, at least I do. :)

Oh, do you know why no one ever uses the in-game gumps for the party system?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 10:29 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
What exactly do you mean with in-game gumps?

Those packets handled by my (and i also think kinetix's) script are also sent from those party system gumps (opened by this scroll in the pd next to the charprofile)

The client sends the same if you are using the partysystem gump or commands like /add /remove and so on.

But you might have meant something else...;-)

If you need any additional packet infos I can check the source of my client-proxy app I used for capturing the client info... I was too lazy to learn c back then so I couldn't use folko's hook ...


EDIT:

Oh well I just copy & pasted the packet editing functions:

Code:
function manipulpacketBF(packetstr: String): String;
var
  subcommand: Word;
  subsubcommand: Byte;

begin
  Move(packetstr[4], subcommand, SizeOf(Word));
  subcommand := SwapWord(subcommand);
  if subcommand = 6 then
    begin
      Move(packetstr[6], subsubcommand, SizeOf(Word));
      case subsubcommand of
        1: Result := manipulpacketBFsc6ssc1(packetstr);
        8: Result := manipulpacketBFsc6ssc8(packetstr);
        9: Result := manipulpacketBFsc6ssc9(packetstr);
        3: Result := manipulpacketBFsc6ssc3(packetstr);
        4: Result := manipulpacketBFsc6ssc4(packetstr);
        6: Result := manipulpacketBFsc6ssc6(packetstr);
        2: Result := manipulpacketBFsc6ssc2(packetstr);

      end;

    end

  else if subcommand = $15 then
    Result := manipulpacketBFsc15(packetstr)

  else if subcommand = $13 then
    Result := manipulpacketBFsc13(packetstr)

  else
    Result := packetstr;

end;

function manipulpacketBFsc6ssc1(packetstr: String): String;
var
  memserial: DWord;
  newpacketstr: String;

begin
  Move(packetstr[7], memserial, SizeOf(DWord));
  memserial := SwapDWord(memserial);
  newpacketstr := createspeechpacketstr('.PartySystem ClientPacketbfSubcommand6 Subsubcommand1 '+
                                        IntToStr(memserial));
  Form1.ListBox1.Items.Add('Manipulated packet $BF!');
  Result := newpacketstr;

end;

function manipulpacketBFsc6ssc8(packetstr: String): String;
var
  memserial: DWord;
  newpacketstr: String;

begin
  Move(packetstr[7], memserial, SizeOf(DWord));
  memserial := SwapDWord(memserial);
  newpacketstr := createspeechpacketstr('.PartySystem ClientPacketbfSubcommand6 Subsubcommand8 '+
                                        IntToStr(memserial));
  Form1.ListBox1.Items.Add('Manipulated packet $BF!');
  Result := newpacketstr;

end;

function manipulpacketBFsc6ssc9(packetstr: String): String;
var
  memserial: DWord;
  newpacketstr: String;

begin
  Move(packetstr[7], memserial, SizeOf(DWord));
  memserial := SwapDWord(memserial);
  newpacketstr := createspeechpacketstr('.PartySystem ClientPacketbfSubcommand6 Subsubcommand9 '+
                                        IntToStr(memserial));
  Form1.ListBox1.Items.Add('Manipulated packet $BF!');
  Result := newpacketstr;

end;

function manipulpacketBFsc6ssc3(packetstr: String): String;
var
  memserial: DWord;
  messagestr, newpacketstr: String;

begin
  Move(packetstr[7], memserial, SizeOf(DWord));
  memserial := SwapDWord(memserial);
  messagestr := ConvertBinToStr(packetstr, 11, (Length(packetstr) - 10) *
                                SizeOf(Char));
  newpacketstr := createspeechpacketstr('.PartySystem ClientPacketbfSubcommand6 Subsubcommand3 '+
                                        IntToStr(memserial) +' '+ messagestr);
  Form1.ListBox1.Items.Add('Manipulated packet $BF!');
  Result := newpacketstr;

end;

function manipulpacketBFsc6ssc4(packetstr: String): String;
var
  messagestr, newpacketstr: String;

begin
  messagestr := ConvertBinToStr(packetstr, 7, (Length(packetstr) - 6) *
                                SizeOf(Char));
  newpacketstr := createspeechpacketstr('.PartySystem ClientPacketbfSubcommand6 Subsubcommand4 '+ messagestr);
  Form1.ListBox1.Items.Add('Manipulated packet $BF!');
  Result := newpacketstr;

end;

function manipulpacketBFsc6ssc6(packetstr: String): String;
var
  canloot: Byte;
  newpacketstr: String;

begin
  Move(packetstr[7], canloot, SizeOf(Byte));
  newpacketstr := createspeechpacketstr('.PartySystem ClientPacketbfSubcommand6 Subsubcommand6 '+
                                        IntToStr(canloot));
  Form1.ListBox1.Items.Add('Manipulated packet $BF!');
  Result := newpacketstr;

end;

function manipulpacketBFsc6ssc2(packetstr: String): String;
var
  memserial: DWord;
  newpacketstr: String;

begin
  Move(packetstr[7], memserial, SizeOf(DWord));
  memserial := SwapDWord(memserial);
  newpacketstr := createspeechpacketstr('.PartySystem ClientPacketbfSubcommand6 Subsubcommand2 '+
                                        IntToStr(memserial));
  Form1.ListBox1.Items.Add('Manipulated packet $BF!');
  Result := newpacketstr;

end;


And for the chat:

Code:
function manipulpacketB5(packetstr: String): String;
var
  hexstr, newpacketstr: String;

begin
  hexstr := GenHexStr(Addr(packetstr[2]), Length(packetstr) - 1);
  newpacketstr := createspeechpacketstr('.Chat ClientPacketb5 '+ hexstr);
  Form1.ListBox1.Items.Add('Manipulated packet $B5!');
  Result := newpacketstr;

end;

function manipulpacketB3(packetstr: String): String;
var
  hexstr, newpacketstr: String;

begin
  hexstr := GenHexStr(Addr(packetstr[2]), Length(packetstr) - 1);
  newpacketstr := createspeechpacketstr('.Chat ClientPacketb3 '+ hexstr);
  Form1.ListBox1.Items.Add('Manipulated packet $B3!');
  Result := newpacketstr;

end;


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 8:29 pm 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
Thanks for posting this stuff. I worked on the party system all day and I got add, remove, accept and decline working. Most of the files are organized and I think I have 95% of the kinks worked out (on the code that works). I'm limited on how the party system is SUPOSED to work, so I'll need someone to correct any of my mistakes.

I should have the party system done in a few days. I use definitions present in the BFCommand package in the 096 distro, though. Hopefully this will make Muad's job of adding my scripts in easier...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 10:36 pm 
Offline
POL Core Developer

Joined: Mon Jan 30, 2006 9:28 am
Posts: 292
Location: Germany, Bavaria
...will ja nix sagen, aber noch umständlicher kann man die Packet-Zusammenbastelei net machen (vor allem, die Geschichte Buchstabe -> Hex)?

(bitte net zu negativ auffassen ;o)

Shinigami


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 1:07 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
Nichts fuer ungut, aber negatives kann man ja nur negativ auffassen :-P
Is nicht so tragisch;-)

Kritik ist ja immer gut, wobei sie hier halt fuer die lernenden Besucher des Forums wichtiger waere als fuer mich.

Das Zeug ist naemlich von 2002 oder so und da hatte ich wirklich kaum Ahnung von irgendwas :?

Es soll ja nicht als Top-Referenz dienen, sondern helfen falls es irgendwo Unklarheiten gibt, wann was zu senden ist etc.

Wegen den Umwandlungen... in sogut wie jeder Sprache gibts ja ne Umwandlung von Buchstabe zu Zahl... aber die hab ich damals wohl nicht gefunden in escript ;-) oder andere Theorie: "ich war zu faul" oder ich wusste das damals noch gar nicht... naja lange her, alles vergessen. Erstaunlich dass ich die Scripts ueberhaupt noch hab.

EDIT:

Gefunden :-) LOL

CAsc( str );
CChr( number );

Naja, wenn auch der Code etwas schlampig ist, immerhin hab ich die ganzen Sachen mit pol92 zum laufen gebracht. Das ist dann aber auch das einzige worauf ich stolz bin :roll:

To everyone who doesn't speak german: There's absolutely nothing important in this post :-)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 11:10 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
I should have paid more attention in german class.

Shini, ich liebe dich. Max Scherr, du auch.

(Is that correct? I would visit the pol forums more often if I got free german lessons...)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 11:48 am 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
"du auch" should be "dich auch" but besides that it's correct, although you might confuse people a bit with that :P

We were just talking about how stupidly I did all the packet "packing" especially the Hex <-> Character conversion. :?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 1:12 pm 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
Thank you. I didn't pay very good attention when the teacher went over that part.

Yes that code was a little scary. It has helped point me in the right direction though but I'm not using any of it. I might use some of the chat code or use it for more inspiration. I really appreciate it.

Since this is my first time coding packet hooks I had to learn a few things but I've been coding almost non-stop on this since I've started, so I'm no slacker.

Add, remove, accept and decline work, but I need to clean it up a bit and add in more comments. I was using strings to set the packet information, which I think is a little ugly and Racalc's guide uses Set functions, which I think look better and make more sense.

I also got party stats to update correctly so you can view the health, mana and stamina of your party. That was a little tricky for me... Chat and Message functions are almost done and I should have those finished by the end of the day.

What is the standard color for OSI party messages? I keep getting the feeling it was a nice green, or perhaps no color at all. I'll go with green if no one knows.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 1:32 pm 
Offline

Joined: Fri Apr 07, 2006 11:56 am
Posts: 16
Yup...I remember green but me playing on OSI ... that was 2000 I think (age 15)... :P


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 6:11 pm 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
Ok I finished, for the most part. Now it's time to hammer out any possible kinks I may have overlooked and optimize the source as best I can.

I have most settings stored in an include file where someone could set the constants however they wanted. The default font color is green :) It brings back memories.

Should I make liberal use of set_cri