//****************************************************************************
// Saved in ANSI encoding
//****************************************************************************
// Drd Online
// Dragon & Dungeon - Extraction of sand and clay
// Create Golfin (Czech)
//****************************************************************************
// Last file update: Saturday, May 4, 2019
VERSION=0.56d
[DEFNAME skills_msgs]
/// mining ///
lopata_musi_byt "Shovel must be in the backpack!"
hodil "He threw"
hodila "She threw"
hornictvi "mining"
fatal_neuspech "Fatal Failure !!!"
chvili "For a moment ye are in the earth,"
nenachazis "but you don't find much."
znicena "it was destroyed."
poskozena "it was damaged."
fatal_uspech "Fatal success"
nasel "He found"
nasla "She found"
[DEFNAME Resources_type]
REGIONRESOURCE_mr_clay "clay"
REGIONRESOURCE_mr_sand "sand"
[TYPEDEF t_Mining_Sand]
ON=@Dclick
if ( !<Cont> ) && ( <TopObj> != <Src> )
// Shovel must be in the backpack
Src.f_Sys_Orange <Def.lopata_musi_byt>
return 1
endif
On=@Targon_Ground
// we target sand, grass and clay (clay roads and fields - modified scp sphere_types.scp)
If ( <Serv.map(<Src.TargP>).TYPE> == t_sand ) || (<Serv.map(<Src.TargP>).TYPE> == t_grass ) || (<Serv.map(<Src.TargP>).TYPE> == t_dirt )
// distance scoop from player by skill mining
If <Src.distance <Src.TargP>> <= <Serv.skill.skill_mining.range>
Serv.Newitem=i_memory
New.f_Harvest_Sand_Clay <Src.UID>,"<Src.TargP>"
EndIf
EndIf
[function f_Harvest_Sand_Clay]
Local.Harvest_Sand_Clay = 0
P = <Src.TargP>
Updatex
Foritems 0
// verify that worldgem_bit already exists
If ((<baseid> == i_worldgem_bit) && ( <type> == t_rock )
Local.Harvest_Sand_Clay = <UID>
EndIf
EndFor
// When worldgem_bit does not exist, a new dice roll is created per percent (According to D&D rules)
If <Local.Harvest_Sand_Clay> = 0
// Source selection by terrain type
// Here I had to place a skill condition because of the resources in the sphere_region file it doesn't work
If ( <Src.Mining> > 0.0 ) && ( (<Serv.map(<Src.TargP>).TYPE> = t_grass) || (<Serv.map(<Src.TargP>).TYPE> = t_dirt) )
Local.Regionresource = mr_clay
Local.Amount = <Serv.REGIONRESOURCE.<Local.Regionresource>.AMOUNT>
Local.Timer = <Serv.REGIONRESOURCE.<Local.Regionresource>.REGEN>
ElseIf ( <Src.Mining> > 4.9 ) && ( <Serv.map(<Src.TargP>).TYPE> = t_sand )
Local.Regionresource = mr_sand
Local.Amount = <Serv.REGIONRESOURCE.<Local.Regionresource>.AMOUNT>
Local.Timer = <Serv.REGIONRESOURCE.<Local.Regionresource>.REGEN>
EndIf
// 1K10 Dice Throw (1 to 100% Percent - According to D&D rules)
Local.desitka = <Eval rand(1, 100)>
If (<local.desitka> > 19)
Src.f_1k10_100
Serv.newitem i_worldgem_bit,<R<Local.Amount>>
New.Attr = Attr_decay|Attr_invis|Attr_move_never
New.TYPE = t_rock
New.More1 = <Local.Regionresource>
New.Timer = <DLocal.Timer>
New.P = <P>
Local.Harvest_Sand_Clay = <New.UID>
// Timerf 2 is needed due to delay - otherwise it would give the player material
// before creating the worldgembit
Src.Timerf 2,Src.skill 45
Src.f_Msg_Cyan <Src.Sex <Def.hodil>/<Def.hodila>> jsi na <Def.hornictvi> <Eval <Local.desitka>>
If (<local.desitka> = 100)
Src.f_Sys_Green <Def.fatal_uspech>
Tag0.Exp += f_1k10_100 // bonus exps per level per 1k10 at 100% - Fatal success
EndIf
ElseIf (<local.desitka> > 1) && (<local.desitka> < 20)
// Fail mining
Src.f_Msg_Cyan <Src.Sex <Def.hodil>/<Def.hodila>> jsi na <Def.hornictvi> <Eval <Local.desitka>>
Src.f_Msg_Gray <Def.chvili>
Src.f_Msg_Gray <Def.nenachazis>
ElseIf (<local.desitka> < 2)
// Fatal Failure
// Here I want to finish the bucket break when I set it in def files for equip
Src.f_Msg_Cyan <Src.Sex <Def.hodil>/<Def.hodila>> jsi na <Def.hornictvi> <Eval <Local.desitka>>
Src.f_Msg_Red <Def.fatal_neuspech>
Serv.Log Hrac hodil Fatalni neuspech v <Src.TargP.Region.Name> a zlamal si lopatu.
EndIf
EndIf
[ITEMDEF i_Shovel_Sand]
id=i_Shovel
name=Shovel for sand
TYPE=t_weapon_mace_pick
FLIP=1
VALUE=20
WEIGHT=6.0
RESOURCES=4 i_ingot_iron,2 i_Log
SKILLMAKE=Tinkering 20.0,t_tinker_tools
CATEGORY=Provisions - Tools D&D
SUBSECTION=Mining
DESCRIPTION=Shovel for sand
ReqStr=1
DUPELIST=0f3a
//CanUse=can_u_human|can_u_elf
TEVENTS=t_Mining_Sand
ON=@Create
HITPOINTS={150 250}
UsesMax=100
Color=color_o_mytheril
[Eof]