I added some entries to the loot generation cfg files as well which are included as a separate patch. There are a few commented out entries in the loot-index file because I have not yet converted my magic item generation system to Distro yet. Hopefully that will come soon.
Lockpicking itemdesc.cfg
Code: Select all
Item 0x14FB
{
//Main Stuff
Name Lockpick
Desc lockpick%s
VendorBuysFor 4
VendorSellsFor 12
//Scripts
Script :lockpicking:lockpicking
}
Item 0x14FC
{
//Main Stuff
Name Lockpick2
Desc lockpick%s
VendorBuysFor 4
VendorSellsFor 12
//Scripts
Script :lockpicking:lockpicking
}
Container 0x69f8
{
//Main Stuff
Name testchest
Desc testchest
Graphic 0x0E43
Gump 0x0049
MinX 20
MaxX 60
MinY 20
MaxY 60
RequiresAttention 0
VendorSellsFor 0
VendorBuysFor 0
Weight 5
MaxWeight 1000
MaxItems 150
Movable 1
Lockable 1
Locked 1
CProp spawnchest i1
CProp lockpicking i4
}
Code: Select all
use cfgfile;
use util;
include ":attributes:attributeConstants";
include ":attributes:attributes";
include ":attributes:skillCheck";
include ":loot:lootParser";
include "include/sounds";
var item_config := ReadConfigFile(":*:itemdesc");
program use_Lockpick(who, tool)
// Checks to make sure we can access the necessary items to get the job done
if ( !ReserveItem(tool) )
SendSysMessage(who, "That is already in use.");
return 0;
elseif( (!tool.movable) || !ReserveItem(tool) )
SendSysMessage(who, "You cannot use that");
return 0;
elseif( !(tool in EnumerateItemsInContainer(who.backpack)) )
SendSysMessage(who, "That item is not in your backpack.");
return 0;
endif
// Ya can't heal and meditate if you're picking locks
EraseObjProperty(who, "#IsMeditating");
EraseObjProperty(who, "#HealTimer");
SendSysMessage(who, "Choose a lock to pick?");
var chest := Target(who);
if (!chest)
SendSysMessage(who,"canceled");
return;
endif
if ( (!Accessible(who,chest)) || (!Accessible(who,tool)) )
SendSysMessage(who, "Can't reach it!");
return;
endif
// The following checks provide flexibility between the different types of locked containers
// For example one might wish to add a spawn of a monster when successfully opening a "spawned" chest.
if (GetObjProperty(chest,"spawnchest"))
PickSpawnChest(who, tool, chest);
elseif (GetObjProperty(chest,"lockable"))
PickLockedItem(who, tool, chest);
elseif (GetObjProperty(chest,"level"))
PickTreasureChest(who, tool, chest);
else
SendSysMessage(who, "You have no chance of picking that lock!");
ReleaseItem(tool);
endif
endprogram
// No buried treasure yet either but this should work when that comes into being too.
// Take note of necessary CProps needed on the chest.
function PickTreasureChest(who, tool, chest)
var lvl := CInt(GetObjProperty(chest,"level" ));
if (!lvl)
DestroyItem(chest);
endif
if (!chest.locked)
SendSysMessage(who,"That doesn't appear to be locked");
return;
endif
PlaySoundEffect(chest,SFX_LOCKPICK);
sleep(2);
var diff := (lvl * 20)+10;
if ( SkillCheck(who, LOCKPICKING, diff) > 0 )
PlaySoundEffect(chest,SFX_UNLOCK);
PrintTextAbovePrivate(chest,"*Unlocked!*",who);
else
PrintTextAbovePrivate(chest,"You fail to pick the lock.",who);
if (diff < 10)
diff := 0;
else
diff := diff -10;
endif
if ((RandomDiceRoll(1d99)+1) >= GetAttribute(who, LOCKPICKING))
PlaySoundEffect(chest,0xef);
SendSysMessage(who,"Your pick breaks!");
SubtractAmount(tool,1);
endif
return;
endif
set_critical(1);
chest.locked := 0;
set_critical(0);
ReleaseItem(tool);
endfunction
// We don't have a chest spawner yet but this will work when we do.
// Take note of necessary CProps needed on the chest.
// See create a testchest to see it work.
function PickSpawnChest(who, tool, chest)
var lvl := CInt(GetObjProperty(chest,"lockpicking" ));
if (!lvl)
DestroyItem(chest);
endif
if (!chest.locked)
SendSysMessage(who,"That doesn't appear to be locked");
return;
endif
PlaySoundEffect(chest,SFX_LOCKPICK);
sleep(2);
var diff := (lvl * 10)+10;
if ( SkillCheck(who, LOCKPICKING, diff) > 0 )
PlaySoundEffect(chest,SFX_UNLOCK);
PrintTextAbovePrivate(chest,"*Unlocked!*",who);
else
PrintTextAbovePrivate(chest,"You fail to pick the lock.",who);
if (diff < 10)
diff := 0;
else
diff := diff -10;
endif
if ((RandomDiceRoll(1d99)+1) >= GetAttribute(who, LOCKPICKING))
PlaySoundEffect(chest,0xef);
SendSysMessage(who,"Your pick breaks!");
SubtractAmount(tool,1);
endif
return;
endif
set_critical(1);
SpawnTheChest(chest,lvl);
chest.locked := 0;
var allchests := GetGlobalProperty("unlockedchests");
if (!allchests)
allchests[1]:=chest.serial;
else
allchests[len(allchests)+1]:=chest.serial;
endif
SetGlobalProperty("unlockedchests",allchests);
set_critical(0);
ReleaseItem(tool);
endfunction
function SpawnTheChest(chest, lvl)
var loot_index := "Chestspawn" + CStr(lvl);
Loot_Generate(chest, loot_index);
endfunction
function PickLockedItem(who, tool, chest)
var lvl := CInt(GetObjProperty(chest,"lockable" ));
if (!lvl)
SendSysMessage(who,"That cannot be picked");
return;
endif
if (!chest.locked)
SendSysMessage(who,"That doesn't appear to be locked");
return;
endif
PlaySoundEffect(chest,SFX_LOCKPICK);
sleepms(1500);
var diff := (lvl+10);
if ( SkillCheck(who, LOCKPICKING, diff) > 0 )
PlaySoundEffect(chest,SFX_UNLOCK);
chest.locked := 0;
else
SendSysMessage(who,"You fail to pick the lock.");
if (diff < 10)
diff := 0;
else
diff := diff -10;
endif
if ((RandomDiceRoll(1d99)+1) >= GetAttribute(who, LOCKPICKING))
PlaySoundEffect(chest,0xef);
SendSysMessage(who,"Your pick breaks!");
SubtractAmount(tool,1);
endif
return;
endif
endfunction
Code: Select all
/*
* $Id: createchest.src $
*
*/
use uo;
program textcmd_Create(who, text)
if ( !text )
SendSysMessage(who, "Usage: .createchest <difficulty>");
return 0;
endif
var diff := CInt(text);
if( !diff)
SendSysMessage(who, "The difficulty defaults to 1.");
diff := 1;
endif
SendSysMessage(who, "Where would you like it placed?");
var targ := TargetCoordinates(who);
var chest := 0x69f8;
var created := CreateItemAtLocation(targ.x, targ.y, targ.z, chest, 1, who.realm);
SetObjProperty(chest, "lockpicking", diff );
SetObjProperty(chest,"spawnchest", 1);
created.locked :=1;
if ( !created )
SendSysMessage(who, "Error: Could not create the chest.");
return 0;
elseif ( !targ )
SendSysMessage(who, "Cancelled");
return 0;
endif
return 1;
endprogram
loot-index.cfg
Code: Select all
# $Id: loot-index.cfg 1452 2009-03-04 19:40:58Z muaddib_pol $
#
#
######################################################
#
# loot-index.cfg
#
# This is the index for the loot system.
# Options per element are specified below.
#
# [Chance] - This reflects a 100% chance. Default is 100%
# Chance can range from 0.1 to 100.0
# Example: Setting chance to '20' gives it a 20% chance of being generated / used.
#
# Dice - This is a dice string. XdY(+-)Z.
# Examples: 1d3+2 5d9-2
# Rolls X number of dice with Y sides. Modifies result by Z.
# To force a specific amount, put 0d0+Z
#
# LootIndex GroupName
# {
# Item <ItemName> <N Dice> [Chance] # Includes 'N' of ItemName
# Random <Group> <N Dice> [Chance] # Pick 'N' items from 'Group' randomly
# Group [GroupName] # Append another index group to the current one
#
# MagicTable [Table] [Amount] [Bias] # Not yet implemented.
# # Creates a magic item. [Table] can be set to a specific one or to Random.
# #Bias will affect things like damage and armor modifiers. You could set it to to +5 or -5.
# }
#
######################################################
LootGroup Dog
{
Item Bone 1 3
}
LootGroup ElementalFire
{
Item SulfurousAsh 1d6+4 100
}
LootGroup ElementalEarth
{
Item FertileDirt 2d5+5 100
}
LootGroup ElementalWater
{
Item BlackPearl 1d4 100
}
LootGroup ElementalAir
{
Item SpiderSilk 1d6+3 100
}
LootGroup Liche
{
Item GoldCoin 2d3+2 100
Item GoldCoin 1d8 30
Item GoldCoin 1d10 30
Item VialOfBlood 2d4 50
Item heartofevil 1 0.5
Item Bone 1d10 50
Random Reagents 2d10 100
Random Reagents 2d12+10 60
Random Writing 1d2 15
Random Jewelry 1 40
}
LootIndex Rabbit
{
Item Seeds 1 5
Item Carrot 1d3 5
Item Turnip 1d3 3
Item HeadOfLettuce 1d2 2
}
LootIndex TownChest1
{
Random GeneralWeapons 1d1 100
Random LeatherArmor 1d2 100
}
LootIndex TownChest2
{
Random GeneralWeapons 1d2 100
Random LeatherArmor 1d2 100
Random StuddedLeatherArmor 1d2 100
}
LootIndex TownChest3
{
Random GeneralWeapons 1d2 100
Random ChainmailArmor 1d2 100
Random StuddedLeatherArmor 1d2 100
}
LootIndex TownChest4
{
Random BigWeapons 1d2 100
Random RingmailArmor 1d2 100
Random GeneralWeapons 1d2 100
}
LootIndex TownChest5
{
Random GeneralWeapons 1d2 100
Random StuddedLeatherArmor 1d2 100
Random PlatemailArmor 1d1 100
Random PlateHelmArmor 1d1 100
Random BigWeapons 1d1 100
}
LootIndex Chestspawn1
{
Item GoldCoin 1d30
Random Gems 1d8 50
Random Potions 1d1 70
// MagicTable 30 Random 1 10
}
LootIndex Chestspawn2
{
Random Circle5Scrolls 1 40
Item GoldCoin 2d30
Random Gems 2d2
Random Reagents 2d3
Random Potions 1d1 50
// MagicTable 30 Random 1 10
}
LootIndex Chestspawn3
{
Item GoldCoin 3d30
Random Gems 2d4 50
Random Potions 1d1 50
Random Circle6Scrolls 1d1 25
Random Reagents 2d3
// MagicTable 30 Random 1 10
}
LootIndex Chestspawn4
{
Random Circle5Scrolls 1d2 50
Random Circle7Scrolls 1d1 15
Item GoldCoin 4d25
Random Gems 2d6
Random Reagents 2d6
// MagicTable 30 Random 1d2 10
}
LootIndex Chestspawn5
{
Random Circle5Scrolls 1d4 50
Random Circle6Scrolls 1d4 50
Random Circle7Scrolls 1d2 25
Random Circle8Scrolls 1d2 15
Item GoldCoin 50d300
Random Gems 30d6
Random Reagents 6d20
Random LesserNecromancyRegs 8d6 100
Random GreaterNecromancyRegs 2d6 100
// MagicTable 50 Random 1d4+1 10
}
Code: Select all
######################################################
#
# loot-groups.cfg
#
# These are groups where items can be randomly selected from.
# Amount can be a solid number or a dice string.
# ItemName can be an objtype number or an item name.
#
# LootGroup GroupName
# {
# Item <itemName> <Amount>
# }
#
######################################################
Group BigWeapons
{
Item LongBow 1
Item WarAxe 1
Item BattleAxe 1
Item LargeBattleAxe 1
Item TwoHandedAxe 1
Item WarHammer 1
Item WarMace 1
Item Bardiche 1
Item Halberd 1
Item BroadSword 1
Item BlackStaff 1
}
Group GeneralWeapons
{
Item longsword 1
Item Mace 1
Item Maul 1
Item ShortSpear 1
Item Spear 1
Item WarFork 1
Item BroadSword 1
Item Cutlass 1
Item Dagger 1
Item Katana 1
Item Kryss 1
Item Scimitar 1
}
Group LeatherArmor
{
Item LeatherGorget 1
Item LeatherSleeves 1
Item LeatherGloves 1
Item LeatherCap 1
Item LeatherLeggings 1
Item LeatherTunic 1
Item LeatherTunic2 1
Item LeatherSkirt 1
Item LeatherBustier 1
Item LeatherShorts 1
}
Group StuddedLeatherArmor
{
Item StuddedGorget 1
Item StuddedGloves 1
Item StuddedSleeves 1
Item StuddedLeggings 1
Item StuddedTunic 1
Item FemaleStudded 1
Item StuddedBustier 1
}
Group ChainmailArmor
{
Item ChainmailCoif 1
Item ChainmailLeggings 1
Item ChainmailTunic 1
}
Group PlateHelmArmor
{
Item CloseHelm 1
Item Helmet 1
Item Bascinet 1
Item NoseHelm 1
Item PlateHelm 1
}
Group Shields
{
Item BronzeShield 1
Item Buckler 1
Item KiteShield 1
Item HeaterShield 1
Item WooodenKiteShield 1
Item WoodenShield 1
Item MetalShield 1
}
Group RingmailArmor
{
Item RingmailTunic 1
Item RingmailSleeves 1
Item RingmailLeggings 1
Item RingmailGloves 1
}
Group PlatemailArmor
{
Item PlatemailBreastplate 1
Item PlatemailArms 1
Item PlatemailLegs 1
Item PlatemailGloves 1
Item PlatemailGorget 1
}
Group BoneArmor
{
Item Bonearms 1
Item Bonetunic 1
Item Bonegloves 1
Item Bonehelm 1
Item Bonelegs 1
Item OrcHelm 1
}
Group Booze
{
Item BottleOfLiquor 1d2
Item BottleOfAle 1d2
Item BottleOfWine 1d2
Item BottleOfRum 1d2
}
Group Potions
{
Item LesserHeal 1
Item LesserPoison 1
Item LesserExplosion 1
Item AgilityPotion 1
Item RefreshPotion 1
Item StrengthPotion 1
Item Nightsight 1
Item LesserCure 1
}
// This group here for Distro compatibility
Group Reagents
{
Item Batwing 1d6
Item Nightshade 1d6
Item Garlic 1d6
Item SpiderSilk 1d6
Item MandrakeRoot 1d6
Item SulphurousAsh 1d6
Item Ginseng 1d6
Item BloodMoss 1d6
Item Bone 1d6
Item VialOfBlood 1d6
Item EyeOfNewt 1d6
Item Pumice 1d6
Item SerpentScale 1d6
Item DeadWood 1d6
Item FertileDirt 1d6
Item ExecutionersCap 1d6
}
Group NormalReagents
{
Item BlackPearl 1d6
Item Nightshade 1d6
Item Garlic 1d6
Item SpiderSilk 1d6
Item MandrakeRoot 1d6
Item SulphurousAsh 1d6
Item Ginseng 1d6
Item BloodMoss 1d6
}
Group LesserNecromancyRegs
{
Item Brimstone 1
Item Bone 1
Item Batwing 1
Item Obsidian 1
Item PigIron 1
Item DeadWood 1
Item VolcanicAsh 1
Item SerpentScale 1
Item Pumice 1
Item EyeOfNewt 1
Item Bloodreagent 1
Item FertileDirt 1
}
Group GreaterNecromancyRegs
{
Item DaemonBone 1
Item DragonBlood 1
Item ExecutionersCap 1
Item Wyrmheart 1
Item Bloodspawn 1
Item Blackmoor 1
}
Group Circle1Scrolls
{
Item reactivearmorscroll 1
Item clumsyscroll 1
Item createfoodscroll 1
Item feeblemindscroll 1
Item healscroll 1
Item magicarrowscroll 1
Item nightsightscroll 1
Item weakenscroll 1
}
Group Circle2Scrolls
{
Item agilityscroll 1
Item cunningscroll 1
Item curescroll 1
Item harmscroll 1
Item magictrapscroll 1
Item magicuntrapscroll 1
Item protectionscroll 1
Item strengthscroll 1
}
Group Circle3Scrolls
{
Item blessscroll 1
Item fireballscroll 1
Item magiclockscroll 1
Item poisonscroll 1
Item telekinesisscroll 1
Item teleportscroll 1
Item magicunlockscroll 1
Item wallofstonescroll 1
}
Group Circle4Scrolls
{
Item archcurescroll 1
Item archprotectionscroll 1
Item cursecroll 1
Item firefieldscroll 1
Item greaterhealscroll 1
Item lightningscroll 1
Item manadrainscroll 1
Item recallscroll 1
}
Group Circle5Scrolls
{
Item bladespiritscroll 1
Item dispelfieldscroll 1
Item incognitoscroll 1
Item magicrelfectscroll 1
Item mindblastscroll 1
Item paralyzescroll 1
Item poisonfieldscroll 1
Item summoncreaturescroll 1
}
Group Circle6Scrolls
{
Item dispelscroll 1
Item energyboltscroll 1
Item explosionscroll 1
Item invisibilityscroll 1
Item markscroll 1
Item masscursescroll 1
Item paralyzefieldscroll 1
Item revealscroll 1
}
Group Circle7Scrolls
{
Item chainlightningscroll 1
Item energyfieldscroll 1
Item flamestrikescroll 1
Item gatetravelscroll 1
Item manavampirescroll 1
Item massdispelscroll 1
Item meteorswarmscroll 1
Item polymorphscroll 1
}
Group Circle8Scrolls
{
Item earthquakescroll 1
Item energyvortexscroll 1
Item resurrectionscroll 1
Item summonairelemscroll 1
Item summondemonscroll 1
Item summonearthelemscroll 1
Item summonfireelemscroll 1
Item summonwaterelemscroll 1
}
Group Gems
{
Item starsapphire 1d2
Item emerald 1d2
Item sapphire 1d2
Item ruby 1d2
Item citrine 1d2
Item amethyst 1d2
Item tourmaline 1d2
Item amber 1d2
Item diamond 1d2
}
Group Writing
{
Item book1 1
Item book2 1
Item book3 1
Item book4 1
Item book5 1
Item book6 1
Item PenAndInk 1
Item BlankScroll 1d10
}
Group Jewelry
{
Item Ring 1
Item Bracelet 1
Item Earrings 1
Item SolidNecklace 1
Item BeadedNecklace 1
}