 |
 |
 |
 |
|
 |
 |
|
 |
 |
| Author |
Message |
lokaum
Joined: 25 Dec 2006 Posts: 29
|
Posted: Thu Dec 28, 2006 10:18 am Post subject: |
|
|
yes...
pkg\opt\loot\antiloot.src
| Code: | use uo;
use os;
include "include/areas";
include "include/constants/propids";
program antilooting( who, corpse, item )
var serial := GetObjProperty( corpse, PROPID_CORPSE_CORPSE_OF );
if( !serial )
return 1;
elseif( who.cmdlevel )
return 1;
elseif( serial = who.serial )
return 1;
elseif( GetObjProperty( corpse, PROPID_MOBILE_CANT_BE_LOOTED ) )
return 0;
elseif( GetObjProperty( corpse, PROPID_MOBILE_GUARD_KILLED ) )
return AddLooter( who, corpse );
elseif( IsInAntiLootingArea(who) )
SendSysMessage( who, "You can't loot here." );
return 0;
else
var guild1 := GetObjProperty( who, "guild_id" );
if( guild1 )
var guild2 := GetObjProperty( who, "guild_id" );
if( guild2 )
if( guild1 = guild2 )
return AddLooter( who, corpse );
else
guild1 := FindGuild( guild1 );
guild2 := FindGuild( guild2 );
if( guild1.IsEnemyGuild(guild2) )
return AddLooter( who, corpse );
elseif( guild1.IsAllyGuild(guild2) )
return AddLooter( who, corpse );
endif
endif
endif
endif
if( IsInAntiLootingArea(who) )
SendSysMessage( who, "You can't loot here." );
return 0;
elseif( GetObjProperty( corpse, PROPID_CORPSE_IS_BLUE ) )
who.setCriminal(1);
return AddLooter( who, corpse );
endif
endif
return 1;
endprogram
function AddLooter( looter, object )
var looters := GetObjProperty(object, PROPID_CORPSE_LOOTED_BY);
if( !looters )
looters := dictionary;
endif
if( !looters.exists(looter.serial) )
looters[looter.serial] := looter.name;
return SetObjProperty(object, PROPID_CORPSE_LOOTED_BY, looters);
else
return 1;
endif
endfunction |
want that i post the antilootingarea.src too?
thanks |
|
 |
|
|
 |
 |
| Author |
Message |
tekproxy Distro Developer
Joined: 06 Apr 2006 Posts: 350 Location: Nederland, Texas
|
Posted: Thu Dec 28, 2006 10:43 am Post subject: |
|
|
Add "debug prints" in all those IF, ELSEIF portions. Here's an example:
| Code: | var serial := GetObjProperty( corpse, PROPID_CORPSE_CORPSE_OF );
Print("antiloot - serial:"+serial+" cmdlevel:"+who.cmdlevel+" who.serial:"+who.serial);
if( !serial )
return 1;
elseif( who.cmdlevel )
return 1;
elseif( serial = who.serial )
return 1;
elseif( GetObjProperty( corpse, PROPID_MOBILE_CANT_BE_LOOTED ) )
Print("antiloot - Found can't be looted prop, no looting!");
return 0;
elseif( GetObjProperty( corpse, PROPID_MOBILE_GUARD_KILLED ) )
Print("antiloot - Found killed by guard prop, AddLooter()!");
return AddLooter( who, corpse );
elseif( IsInAntiLootingArea(who) )
Print("antiloot - IsInAntiLootingArea()! No looting!");
SendSysMessage( who, "You can't loot here." );
return 0;
else
Print("antiloot - checking guild stuff...");
var guild1 := GetObjProperty( who, "guild_id" ); |
I'd also need to see the code for the function IsInAntiLootingArea(who) and how PROPID_MOBILE_CANT_BE_LOOTED is defined. You could probably figure it out on your own with the above debug messages. |
|
 |
|
|
 |
 |
| Author |
Message |
lokaum
Joined: 25 Dec 2006 Posts: 29
|
Posted: Thu Dec 28, 2006 5:02 pm Post subject: |
|
|
antilootingareas.src
| Code: | use uo;
use os;
use cfgfile;
include "include/areas";
program antimagicareas( who )
var cfg := ReadConfigFile(":areas:areas");
var areas := GetConfigStringArray( cfg[1], "Area" );
var disabled := GetGlobalProperty("AntiLootAreas");
if( !disabled )
disabled := array;
endif
var layout := array( "page 0",
"nodispose",
"resizepic 50 0 2600 250 325",
"resizepic 100 280 5100 150 25",
"text 110 30 5 0" );
var data := array( "Anti-Looting Areas" );
var name;
var splited;
var count := 0;
var done := 0;
var page := 1;
var perpage := 10;
var y := 70;
var i;
var j;
layout.append( "page " + page );
if( areas.size() > perpage )
layout.append( "button 200 281 5540 5542 0 " + (page + 1) );
endif
for( i := 1; i <= areas.size(); i := i + 1 )
if( done = perpage )
done := 0;
page := page + 1;
y := 70;
layout.append( "page " + page );
layout.append( "button 125 281 5537 5538 0 " + (page - 1) );
if( areas.size() > (count + perpage) )
layout.append( "button 200 281 5540 5542 0 " + (page + 1) );
endif
endif
if( disabled[i] )
layout.append( "checkbox 250 " + y + " 210 211 1 " + i );
else
layout.append( "checkbox 250 " + y + " 210 211 0 " + i );
endif
splited := SplitWords( areas[i] );
name := splited[5];
j := 6;
while( splited[j] )
name := name + " " + splited[j];
j := j + 1;
endwhile
layout.append( "text 85 " + y + " 0 " + data.size() );
data.append( name );
y := y + 20;
done := done + 1;
count := count + 1;
Sleepms(1);
endfor
var save;
var result := SendDialogGump( who, layout, data );
for( i := 1; i <= areas.size(); i := i + 1 )
disabled[i] := result[i];
endfor
for( i := 1; i <= areas.size(); i := i + 1 )
if( result[i] )
disabled[i] := 1;
save := 1;
else
disabled[i] := 0;
endif
endfor
if( save )
if( SetGlobalProperty( "AntiLootAreas", disabled ) )
SendSysMessage( who, "Data saved" );
return 1;
endif
else
if( EraseGlobalProperty( "AntiLootAreas" ) )
SendSysMessage( who, "Data saved" );
return 1;
endif
endif
SendSysMessage( who, "Error occured" );
return 0;
endprogram |
hmm |
|
 |
|
|
 |
 |
|