Skip to content

Commit

Permalink
Added signserial CProp to the "builtdeed" for multi houses. This will…
Browse files Browse the repository at this point in the history
… be needed for the changeOwner script.

Fixed the owner transfer sign function from issue #69
Added the gotoserial command to /pkg/commands/developer
  • Loading branch information
Hope-Lives committed Oct 4, 2021
1 parent d21e173 commit b6daff9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
16 changes: 16 additions & 0 deletions pkg/commands/developer/gotoserial.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use uo;

program goto_serial(who, text)

if(!text)
SendSysMessage(who, "You must enter a serial.", color := 33);
return;
endif
var obj := SystemFindObjectBySerial(CInt(text));
if(!obj)
SendSysMessage(who, "No object exists with that serial.", color := 40);
return;
endif
MoveObjectToLocation(who, obj.x, obj.y, obj.z, obj.realm, MOVEOBJECT_FORCELOCATION);

endprogram
1 change: 1 addition & 0 deletions pkg/multis/house/multiDeed/use.src
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function Buildhouse(who, deed)
SetObjProperty(item, "owneracct", who.acctname);
SetObjProperty(item, "builtdeed", created.builtdeed.serial);
SetObjProperty(item, "decay", (ReadGameClock() + get_abandon_time()));
SetObjProperty(created.builtdeed, "signserial", item.serial);
endif
endforeach
else
Expand Down
59 changes: 26 additions & 33 deletions pkg/multis/house/multiSign/use.src
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ program Mulit_House_sign(who, sign)
13: if((oserial == who.serial) or (who.cmdlevel > 2)) //transfer ownership
var targetow := Target(who);
SendSysMessage(who, "Transfer the house to whom?");
if(ChangeHouseOwner(who, targetow, house, bank_region) == 1)
if(ChangeHouseOwner(who, targetow, sign, bank_region) == 1)
SendSysMessage(who, "House transfer was successful.", color := 66);
else
SendSysMessage(who, "House transfer was NOT successful.", color := 33);
Expand Down Expand Up @@ -1140,11 +1140,11 @@ function ListCoowner(sign, who)
return retval;
endfunction

function ChangeHouseOwner(oldowner, who, sign, bank_region)
function ChangeHouseOwner(oldowner, newowner, sign, bank_region)
var oldownerserial:=GetObjProperty(sign, "ownerserial");
if(oldownerserial == who.serial)
if(oldownerserial == newowner.serial)
return 0;
elseif(who.acctname)
elseif(newowner.acctname)
var chk;
var builtdeed := GetObjProperty(sign, "builtdeed");
if(builtdeed)
Expand All @@ -1156,32 +1156,36 @@ function ChangeHouseOwner(oldowner, who, sign, bank_region)
chk := SystemFindObjectBySerial(builtdeed, 2);
endif
if(!chk)
SendSysMessage(who, "Error: Could not find built deed. Page a GM.", color := 33);
SendSysMessage(newowner, "Error: Could not find built deed. Page a GM.", color := 33);
return 0;
endif
else
SendSysMessage(who, "Error: Could not find built deed. Page a GM.", color := 33);
SendSysMessage(newowner, "Error: Could not find built deed. Page a GM.", color := 33);
return 0;
endif
var hisbank := CP_GetStorageContainerForMobile( who, bank_region, CP_CREATE );
var hisbank := CP_GetStorageContainerForMobile( newowner, bank_region, CP_CREATE );
if(!hisbank)
SendSysMessage(who, "House transfer was NOT successful. I could not find your bank.", color := 33);
SendSysMessage(oldowner, "House transfer was NOT successful. I could not find the bank for " + who.name + ".", color := 33);
SendSysMessage(newowner, "House transfer was NOT successful. I could not find your bank.", color := 33);
SendSysMessage(oldowner, "House transfer was NOT successful. I could not find the bank for " + newowner.name + ".", color := 33);
return 0;
endif
if(!MoveItemToContainer(builtdeed, hisbank))
SendSysMessage(who, "House transfer was NOT successful.", color := 33);
SendSysMessage(newowner, "House transfer was NOT successful.", color := 33);
SendSysMessage(oldowner, "House transfer was NOT successful.", color := 33);
return 0;
endif
SetObjProperty(sign, "ownerserial", who.serial);
SetObjProperty(sign, "owneracct", who.acctname);
SendSysMessage(who, "House transfer was successful.", color := 66);
SendSysMessage(who, "It would be wise to change the locks soon.");
SetObjProperty(sign, "ownerserial", newowner.serial);
SetObjProperty(sign, "owneracct", newowner.acctname);
EraseObjProperty(sign, "coowners");
EraseObjProperty(sign, "friendlist");
EraseObjProperty(sign, "banlist");
EraseObjProperty(sign, "Public");
SendSysMessage(newowner, "House transfer was successful.", color := 66);
SendSysMessage(newowner, "It would be wise to change the locks soon.", color := 45);
SendSysMessage(oldowner, "House transfer was successful.", color := 66);
return 1;
endif
SendSysMessage(who, "House transfer was NOT successful.", color := 33);
SendSysMessage(newowner, "House transfer was NOT successful.", color := 33);
SendSysMessage(oldowner, "House transfer was NOT successful.", color := 33);
return 0;
endfunction
Expand Down Expand Up @@ -1274,24 +1278,8 @@ function checklists(hsign, who, list1, list2)
if(junk)
listb.erase(junk);
endif
// var newarray := {};
// if(who.serial in lista)
// foreach thing in lista
// if(thing != who.serial)
// newarray.append(thing);
// endif
// endforeach
SetObjProperty(hsign, list1, lista);
// endif
// newarray := {};
// if(who.serial in listb)
// foreach thing in listb
// if(thing != who.serial)
// newarray.append(thing);
// endif
// endforeach
SetObjProperty(hsign, list2, listb);
// endif
endfunction

function demolish(house, sign, who, bank_region)
Expand Down Expand Up @@ -1444,9 +1432,14 @@ function SetPlaqueName(sign, unused house)
endif
endfunction

function ChangeLocks(who,house)
function ChangeLocks(who, house)
SendSysMessage(who, "Target the new master key.", color := 88);
var addonitem,newkey:=Target(who);
var newkey:=Target(who);
if(!newkey)
SendSysMessageCL(who, 1042023, color := 33); // Cancelled.
return;
endif
var addonitem;
if((newkey.IsKey()) && (!newkey.IsKeyring()))
var LockID:=AllocateLockID();
newkey.SetLockId(LockID);
Expand Down

0 comments on commit b6daff9

Please sign in to comment.