1. Dbl click the snooping gloves
2. Target the victim
3. Open their backpack containers within the pack also resulting in seperate skillchecks for each container opened via snooping
4. Using stealing to click the items and voila!
5. Feel free to remove the weird steal from guards/npc thingy I'd prefer it to be player interactionable to increase roleplay.
And here is my crappy messy coding.. goodluck and may god save your soul!
SNOOPING
Code: Select all
use uo;
use os;
use util;
include "include/client";
include "include/attributes";
include "../pkg/character/virtue/virtue";
include "include/class";
include "include/trainingskill";
program snooping( who )
var data := {};
data[1] := "snooping";
data[2] := ReadGameClock();
data[3] := 28;
SetObjProperty(who, "LastUsedSkill", data );
TrainingSkill(who, data);
SendSysMessage(who,"choose victim");
var victim := Target(who, TGTOPT_CHECK_LOS);
if (!victim)
SendSysMessage(who,"Canceled");
return;
endif
if (!CheckLosAt(who, victim.x, victim.y, victim.z))
SendSysMessage(who, "You can't see that.");
return 0;
endif
if ( Distance(who, victim) > 2 )
SendSysMessage(who,"A bit far away, don't you think?");
return;
endif
var diff := GetDiff(who, victim);
if (!CheckSkill(who, SKILLID_SNOOPING, diff, modify_points(who, SKILLID_SNOOPING, 100)))
endif
AddVirtue(who, -1);
endprogram
function GetDiff(who, victim)
var skill := GetEffectiveSkill( who, SKILLID_SNOOPING );
var whoskill := CInt(skill/4) + CInt(GetDexterity(who)/4); // max 60
var victimskill := CInt(GetDexterity(victim)/6) + CInt(GetIntelligence(victim)/4) + 10; // max 60
var chance := victimskill - whoskill + 50;
return chance;
endfunctionCode: Select all
use uo;
use os;
use util;
include "include/client";
include "include/attributes";
include "include/objtype";
include "include/eventid";
include "../pkg/character/virtue/virtue";
include "include/class";
include "include/trainingskill";
program textcmd_dmg( who )
var data := {};
data[1] := "stealing";
data[2] := ReadGameClock();
data[3] := 33;
SetObjProperty(who, "LastUsedSkill", data );
TrainingSkill(who, data);
SendSysMessage(who,"Steal from whom?");
var victim := Target(who, TGTOPT_CHECK_LOS);
if (!victim)
SendSysMessage(who,"Canceled");
return;
endif
if ( Distance(who,victim)>2 )
SendSysMessage(who,"A bit far away, don't you think?");
return;
endif
var diff := CanStealFrom(victim);
if ( (!diff) || ( diff > (GetEffectiveSkill(who, SKILLID_STEALING)+20) ) )
SendSysMessage(who,"You'd be caught red handed!");
SendSysMessage(who,"Canceled");
return;
endif
if (!CheckSkill(who,SKILLID_STEALING,diff,modify_points(who, SKILLID_STEALING, 0)))
Busted(who, victim);
return;
endif
if ( GetObjProperty(victim,"#robbed") )
if ( ReadGameClock() < GetObjProperty(victim,"#robbed") )
SendSysMessage(who,"Doesn't look like they have any money.");
return;
endif
endif
SetObjProperty( victim, "#robbed", ReadGameClock()+1800 );
AddVirtue(who,-2);
var lootbag := who.backpack;
if ( GetObjProperty(who,"grabbag") )
var bagserial := GetObjProperty(who,"grabbag");
foreach item in EnumerateItemsInContainer(who.backpack)
if ( item.serial == bagserial )
lootbag := item;
break;
endif
endforeach
endif
if (RandomInt(100) < diff )
SendSysMessage(who,"Ooh! Gems!");
var gem := gemtype(diff);
var amount := RandomInt(2) + 1;
foreach item in EnumerateItemsInContainer(who.backpack)
if (item.objtype == gem)
if (AddAmount(item, amount))
return;
endif
endif
endforeach
CreateItemInContainer(lootbag, gem, amount);
else
SendSysMessage(who,"You successfully pilfer a few coins.");
CreateItemInContainer(lootbag, UOBJ_GOLD_COIN, RandomInt(diff)+(diff*2));
endif
endprogram
function Busted(who, victim)
PrintTextAbove(victim,"Stop! Help! A thief!");
who.criminal := 1;
var ev := array;
ev.+type;
ev.+source;
ev.source := who;
ev.type := EVID_DAMAGED;
SendEvent(victim,ev);
foreach guard in ListMobilesNearLocation(victim.x, victim.y, victim.z, 20)
if ( guard.npctemplate == "townguard" )
SendEvent(guard,ev);
endif
endforeach
endfunction
function CanStealFrom(victim)
if (victim.npctemplate == "person")
return 20;
elseif (victim.npctemplate == "townperson")
return 40;
elseif (victim.npctemplate == "questie")
return 60;
elseif (victim.npctemplate == "warrior" && !GetObjProperty(victim, "master"))
return 80;
elseif (victim.npctemplate["townguard"] || victim.script["merchant"])
return 100;
else
return 0;
endif
endfunction
function gemtype(diff)
var d := RandomInt(2);
var tone, ttwo;
case (diff)
100:
tone := 0x0f30;//diamond
ttwo := 0x0f0f;//starsapphire
80:
tone := 0x0f10;//emerald
ttwo := 0x0f11;//sapphire
60:
tone := 0x0f13;//ruby
ttwo := 0x0f16;//amethyst
40:
tone := 0x0f15;//citrine
ttwo := 0x0f18;//tourmaline
default:
tone := 0x0f25;//amber
ttwo := 0x0f25;//amber
endcase
if (d)
return tone;
else
return ttwo;
endif
endfunction