Okay to further make things worse.. heres the scripts..
This script calls for the smiths hammer aswell as for the forge im not so worried about but I have added to the 3 or for itemdesc files I have in my Blacksmithy skills folder and it still seems to be givin me the same dead end..
Code: Select all
/////////////////
// make_blacksmith_items.src
//
// Use a smithy hammer to either repair arms & armor or
// to work with metal to create new items. You need to be
// skillful to work with the rarer metals.
//
// TODO: remove hardcoding of skill pointvalue
//
// Author: DreamWeaver:
// original
// Racalac:
// colored items
// Updates: Dream Weaver 6/3/99 handled item quality an HP to new specs
// Ignatius 99/06/10 added name of maker to exceptional items.
// S!tH 9/05/2001 All coloured mods run through ingots.cfg.
// -4 qualities.
// Updates: Repsak completedly changed the way mining works, now GM have to
// place vains (.makevein) for players to be able to find special ore.
// crap ore, like dull copper/copper/bronze, and iron can be found anywhere on the map.
// the higher skill in mining the more ore per chop.
////////////////
use uo;
use cfgfile;
use os;
use util;
use basicio;
include "include/client";
include "include/attributes";
include "include/objtype";
include "include/yesno";
include "include/string";
include "include/magicitems";
include "include/makemenu";
include "blacksmithy";
include "include/class";
include "include/trainingskill";
include "include/crafting";
include "gump";
Var primaryskill:=SKILLID_BLACKSMITHY;
var secondaryskill:=SKILLID_ARMSLORE;
var skillname:="Blacksmithy";
var menu_cfg_file := ReadConfigFile(":blacksmithy:menu");
var cfg_file := ReadConfigFile( "items" );
var resources_file := ReadConfigFile( ":blacksmithy:ingots" );
var itemcfg := ReadConfigFile(":combat:itemdesc");
var smith_cfg := ReadConfigFile( ":blacksmithy:items" ); //what can i make ?
var ingotscfg := ReadConfigFile( ":blacksmithy:ingots" ); //what ingots exists ?
var itemname,noncrafted;
var ingots;
// called when a player double-clicks a hammer or other blacksmith tool
program use_hammer( character, hammer )
if (GetObjProperty (character, "NoHit") > readgameclock() )
PrintTextAbovePrivate (character, "I feel disheartened and I am not in the mood to do so.", character);
return;
endif
var data := {};
data[1] := "blacksmithy";
data[2] := ReadGameClock();
data[3] := 7;
SetObjProperty(character, "LastUsedSkill", data );
TrainingSkill(character, data[3]);
EraseObjProperty(character, "StopCrafting");
var craftingbag := FindCraftingBag(character);
var mount := GetEquipmentByLayer( character, 25 );
if ( mount )
PrintTextAbovePrivate( character, "You cannot smith while mounted.", character );
return;
endif
if (! IsHammerEquipped(character, hammer) )
SendSysMessage(character, "You have to equip that to craft!");
return;
endif
SendSysMessage( character, "What would you like to use that on?" );
var use_on := Target( character );
if( !use_on )
SendSysMessage( character, "Targetting cancelled" );
return;
endif
if (!Accessible(character, use_on) )
SendSysMessage(character, "You can't reach that!");
return;
endif
if (!ReserveItem(use_on) )
SendSysMessage(character, "You can't use that right now.");
return;
endif
if( is_weapon_armor(use_on) )
var near_items := ListItemsNearLocation(character.x, character.y, character.z,2);
foreach item in near_items
if ((item.objtype == UOBJ_ANVIL1) || (item.objtype == UOBJ_ANVIL2))
RepairBlacksmithyItem( character, use_on, SKILLID_BLACKSMITHY );
return;
endif
endforeach
SendSysMessage( character, "You must be near an anvil to repair items!" );
return;
endif
if( !isIngot(use_on.objtype) )
SendSysMessage( character, "You can only use that on ingots!" );
return;
endif
if( !CheckSkillForDifferentMetals( character, use_on, hammer ) )
SendSysMessage( character, "You have no chance to successfully work with that metal." );
return;
endif
if (use_on.movable == 0 )
SendSysMessage(character, "Its locked down.");
return;
endif
var near_items := ListItemsNearLocation(character.x, character.y, character.z,2);
foreach item in near_items
if ((item.objtype == UOBJ_ANVIL1) || (item.objtype == UOBJ_ANVIL2))
MakeBlacksmithItems(character, use_on, craftingbag);
return;
endif
endforeach
SendSysMessage( character, "You must be near an anvil to smith items!" );
endprogram
function is_weapon_armor(what)
if ( IsMetalWeapon(what) || IsMetalArmor(what) || IsMetalShield(what) )
return 1;
else
return 0;
endif
endfunction
function MakeBlacksmithItems( character, ingots, craftingbag )
var skill, bonusskill; //skill needed to create the item
var element; // entry in smith_config
var material; //amount of material needed to create the item
var points, retval, maxhp, quality, itemname, time, hasquality;
if ( !Accessible( character, ingots))
SendSysMessage( character, "You don't have any ingots!" );
return;
endif
if (!smith_cfg)
SendSysMessage(character, "Could not open blacksmith.cfg");
return;
endif
//calls the SelectWhatToMakeFromMenu function found in makemenu.inc, in /scripts/include
var what := sendCraftGump(character, skillname, primaryskill, menu_cfg_file, "mainmenu", ingots.amount);
if (!what || CINT(what)==CINT(1025))
SendSysMessage(character, "Canceled.");
return;
endif
maxhp := (itemcfg[what].maxhp);
element := FindConfigElem( smith_cfg,what ); //need to make sure the key reflects the menu return value
if (element)
material := GetConfigInt( element, "material" );
skill := GetConfigInt( element, "skill" );
itemname := GetConfigString( element, "Name");
points := GetConfigInt( element, "points" );
time := GetConfigInt( element, "time" );
hasquality := GetConfigInt( element, "hasquality" );
else
print("Bad stuff goin on!");
endif
var metalelem, newcolour, bonuspoints, bonushp, prefix, suffix, enchantments, dmgmod, armmod, cashmod, baseskill;
metalelem := FindConfigElem( ingotscfg, ingots.objtype );
if( metalelem)
dmgmod := GetConfigInt( metalelem, "damageMod" );
armmod := GetConfigInt( metalelem, "armourMod" );
bonusskill := GetConfigInt( metalelem, "bonusSkill" );
newcolour := GetConfigInt( metalelem, "newColour" );
bonuspoints := GetConfigInt( metalelem, "bonusPoints" );
bonushp := GetConfigInt( metalelem, "bonusHp" );
prefix := GetConfigString( metalelem, "prefix" );
suffix := GetConfigString( metalelem, "suffix" );
enchantments := GetConfigString( metalelem, "enchantments" );
enchantments := SplitWords( enchantments );
points := CInt((points * bonuspoints) / 100);
skill := CInt(skill);
baseskill := CInt((skill * bonusskill) / 100);
cashmod := GetConfigInt( metalelem, "minSkill" ) / 50;
if( skill > 99.0 )
skill := 99.0;
endif
itemname := prefix + " " + itemname + " " + suffix;
endif
////////////////////////////////////////////////////////////////////////////////////////////
//This is something so that higher smiths find it easier to craft stuff.
//Uncomment & modify if you want.
////////////////////////////////////////////////////////////////////////////////////////////
// local noSkillSub := GetConfigInt( metalElem, "noSkillSub" );
// if( !noSkillSub )
// if( skill > 86 )
// local tSkill := GetSkill( character, SKILLID_BLACKSMITHY ) - 86;
// if( tSkill > 0 )
// skill := skill - tSkill;
// endif
// endif
// endif
////////////////////////////////////////////////////////////////////////////////////////////
if( !cashmod || cashmod < 1.0 )
cashmod := 1.0;
endif
////////////////////////////////////////////////////////////////////////////////////////////
//For AutoLoop: Uncomment this and the endwhile lower down.
////////////////////////////////////////////////////////////////////////////////////////////
var mx := character.x;
var my := character.y;
var doLoop := 1;
var calledLoopGump := 0;
noncrafted:= 0;
while( GetAmount(ingots)+1 > material && mx == character.x && my == character.y && doLoop && noncrafted==0 && !GetObjProperty (character,"StopCrafting"))
if( !calledLoopGump )
doLoop := YesNo( character, "Autoloop?" );
calledLoopGump := 1;
endif
////////////////////////////////////////////////////////////////////////////////////////////
if( GetAmount(ingots) < material )
PerformAction(character, ANIM_ATTACK_1HAND_DOWN);
retval := PlaySoundEffect(character, SFX_ANVIL);
sleepms(2100);
SendSysMessage( character, "You do not have enough ingots." );
return;
endif
if(character.cmdlevel < 3)
var i := 0;
for(i; i < time; i := i +1)
PerformAction(character, ANIM_ATTACK_1HAND_DOWN);
retval := PlaySoundEffect(character, SFX_ANVIL);
sleepms(2100);
endfor
endif
if( metalelem )
if(CheckSkill( character, SKILLID_BLACKSMITHY, baseskill, modify_points(character, SKILLID_BLACKSMITHY, points) ))
var theitem:= CreateItemInContainer(craftingbag, what, 1 );
if (!theitem)
theitem:=createitematlocation(character.x,character.y,character.z,what,1);
endif
if (theitem) //they sucessfully create the item
ReleaseItem( theitem );
//SetObjProperty( theitem, "cashMod", cashMod );
if( metalelem )
theitem.color := ingots.color;
if(!hasquality)
return;
endif
theitem.maxhp := theitem.maxhp + bonushp;
SetObjProperty( theitem, "Enchantments", enchantments );
SetObjProperty( theitem, "IngotType", ingots.objtype );
SetObjProperty( theitem, "Material", prefix + " ingots" );
if (character.cmdlevel>2)
SetObjProperty( theitem, "GMcrafted", character.acctname );
endif
endif
theitem.ar_mod := CInt(armmod);
theitem.dmg_mod := CInt(dmgmod);
//Exceptional Quality Etc
modifyQuality( character, points, quality, itemname, theitem, baseskill, ingots );
SubtractAmount( ingots, material );
else
PrintTextAbovePrivate(character, "*Your backpack is full!*", character);
noncrafted:=1;
return;
endif //theitem
else //checkskill
SubtractAmount( ingots, RandomInt(material) );
SendSysMessage( character, "You destroy some ingots." );
endif //checkskill
endif //metalElem
////////////////////////////////////////////////////////////////////////////////////////////
endwhile //autoloop
////////////////////////////////////////////////////////////////////////////////////////////
EraseObjProperty (character,"StopCrafting");
endfunction
function oldmodifyQuality( who, points, quality, itemname, theitem, skill, ingots )
var eskill := CInt( 100 - (((GetEffectiveSkill( who, SKILLID_BLACKSMITHY))+1 ) - skill));
if(eskill <= 50)
eskill := 50;
endif
var askill := CInt( 100 - (((GetEffectiveSkill( who, SKILLID_BLACKSMITHY))+21) - skill));
if(askill <= 30)
askill := 30;
endif
var nskill := CInt( 100 - (((GetEffectiveSkill( who, SKILLID_BLACKSMITHY))+56) - skill));
if(nskill <= 5)
nskill := 5;
endif
var rint := RandomInt(100)+1;
var armsskill := CInt(GetEffectiveSkill( who, SKILLID_ARMSLORE) / 3) - 15;
if(armsskill <= -6)
armsskill := -6;
endif
eskill := CInt(eskill - armsskill);
points := 0;
if(rint > eskill)
var bskill := GetEffectiveSkill( who, SKILLID_BLACKSMITHY);
if(bskill > 95)
var elitechance := bskill - 99;
if(elitechance > 25)
elitechance := 25;
endif
var reint := RandomInt(100)+1;
if(reint < elitechance)
//Elite Quality 130%
theitem.quality := 1.3;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 30;
add_special_ingot_bonus( who, theitem, ingots );
var newname := SendTextEntryGump( who, "Choose name for the elite item", 50);
if(newname)
SetName(theitem, "-" + newname + "-" );
else
SetName(theitem, "an elite " + itemname);
endif
SendSysMessage( who, "You create an elite " + itemname + "and place it in your pack." );
SetObjProperty(theitem, "craftedby", "crafted by " + who.name);
SetObjProperty(theitem, "elite", 1);
SetObjProperty(theitem, "name", itemname);
return;
else
endif
else
endif
//Exceptional Quality 120%
theitem.quality := 1.2;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 10;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "an exceptional " + itemname);
SendSysMessage( who, "You create an exceptional " + itemname + "and place it in your pack." );
SetObjProperty(theitem, "craftedby", "crafted by " + who.name);
elseif(rint > askill)
//Above Average Quality 100%
theitem.quality := 1;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 7;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "a quality " + itemname );
SendSysMessage( who, "You create a quality " + itemname + "and place it in your pack." );
elseif(rint > nskill)
//Normal Quality 90%
theitem.quality := 0.9;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 5;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "a " + itemname );
SetName(theitem, itemname );
SendSysMessage( who, "You create " + AddArticle(itemname) + "and place it in your pack." );
else
//Below Quality 70%
theitem.quality := 0.7;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 2;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "a below average quality " + itemname );
SendSysMessage( who, "You create a below average quality " + itemname + "and place it in your pack." );
endif
endfunction
function modifyQuality( who, points, quality, itemname, theitem, skill, ingots )
var elite_chance, exceptional_chance, quality_chance, normal_chance;
var playersskill:=GetEffectiveSkill( who, SKILLID_ARMSLORE);
var qualitychances:=Randomint(100)+1;
var players_blacksmithy:=GetEffectiveSkill( who, SKILLID_BLACKSMITHY);
if (playersskill>skill+20)
elite_chance:=10;
exceptional_chance:=100;
elseif (playersskill>skill+10)
elite_chance:=5;
exceptional_chance:=90;
quality_chance:=100;
elseif (playersskill>skill)
elite_chance:=2;
exceptional_chance:=30;
quality_chance:=60;
normal_chance:=100;
elseif (playersskill+10>skill)
elite_chance:=0;
exceptional_chance:=10;
quality_chance:=30;
normal_chance:=80;
elseif (playersskill+10<skill)
elite_chance:=0;
exceptional_chance:=1;
quality_chance:=10;
normal_chance:=30;
elseif (playersskill+20<skill)
elite_chance:=0;
exceptional_chance:=0;
quality_chance:=5;
normal_chance:=15;
endif
if (players_blacksmithy<90)
elite_chance:=0;
endif
if (who.cmdlevel>1)
sendsysmessage(who, "Skill: "+skill);
sendsysmessage(who, "Elite Chance: "+elite_chance);
sendsysmessage(who, "Exceptional Chance: "+exceptional_chance);
sendsysmessage(who, "Quality Chance: "+quality_chance);
sendsysmessage(who, "Normal Chance: "+normal_chance);
sendsysmessage(who, "Quality chance: "+qualitychances);
endif
if (qualitychances<elite_chance)
theitem.quality := 1.3;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 30;
add_special_ingot_bonus( who, theitem, ingots );
var newname := SendTextEntryGump( who, "Choose name for the elite item", 50);
if(newname)
SetName(theitem, "-" + newname + "-" );
else
SetName(theitem, "an elite " + itemname);
endif
SendSysMessage( who, "You create an elite " + itemname + "and place it in your pack." );
SetObjProperty(theitem, "craftedby", "crafted by " + who.name);
SetObjProperty(theitem, "elite", 1);
SetObjProperty(theitem, "name", itemname);
elseif (qualitychances<exceptional_chance)
theitem.quality := 1.2;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 10;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "an exceptional " + itemname);
SendSysMessage( who, "You create an exceptional " + itemname + "and place it in your pack." );
SetObjProperty(theitem, "craftedby", "crafted by " + who.name);
elseif (qualitychances<quality_chance)
theitem.quality := 1;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 7;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "a quality " + itemname );
SendSysMessage( who, "You create a quality " + itemname + "and place it in your pack." );
elseif (qualitychances<normal_chance)
theitem.quality := 0.9;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 5;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "a " + itemname );
SetName(theitem, itemname );
SendSysMessage( who, "You create " + AddArticle(itemname) + "and place it in your pack." );
else
theitem.quality := 0.7;
theitem.hp := theitem.maxhp;
theitem.hp := theitem.hp + 2;
add_special_ingot_bonus( who, theitem, ingots );
SetName(theitem, "a below average quality " + itemname );
SendSysMessage( who, "You create a below average quality " + itemname + "and place it in your pack." );
endif
endfunction
function CheckSkillForDifferentMetals( character, ingot, tool )
var ingotelem := FindConfigElem( ingotscfg, ingot.objtype );
var minskill := GetConfigInt( ingotelem, "minSkill" );
//Special Smithy Tool Requirements
var toolprop := GetConfigString( ingotelem, "reqProp" );
if( toolprop && toolprop != "error" );
if( !GetObjProperty( tool, toolprop ) )
SendSysMessage( character, "You require a special tool to work with these ingots." );
return 0;
endif
endif
var toolench := GetConfigString( ingotelem, "reqEnch" );
if( toolench && toolench != "error" )
var tenchantments := GetObjProperty( tool, "Enchantments" );
var hasench := 0;
foreach ench in tenchantments
if( ench == toolench )
hasench := 1;
endif
endforeach
if( !hasench )
SendSysMessage( character, "You require a specially enchanted tool to work with these ingots." );
return 0;
endif
endif
if( CheckHisSkill( character, minskill ) )
return 1;
else
return 0;
endif
endfunction
function CheckHisSkill( character, skill )
var his_skill := GetEffectiveSkill( character, SKILLID_BLACKSMITHY );
if( his_skill >= skill )
return 1;
else
return 0;
endif
endfunction
function IsHammerEquipped(me,hammer)
if ( (!Accessible(me, hammer)) || (Distance(me, hammer) > 1) )
return 0;
endif
if ( hammer.movable == 0 )
return 0;
endif
foreach item in ListEquippedItems(me)
if (hammer.serial == item.serial )
return 1;
endif
endforeach
return EquipItem(me, hammer );
endfunction
function add_special_ingot_bonus(who, theitem, ingots )
case( Hex(ingots.objtype))
"0x6550": b_DullCopper( theitem );
"0x6551": b_Copper( theitem );
"0x6552": b_bronze( theitem );
"0x6553": b_iron( theitem );
"0x6554": b_verite( theitem );
"0x6555": b_syntian( theitem );
"0x6556": b_azurite( theitem );
"0x6557": b_executor( theitem );
"0x6558": b_radlius( theitem );
"0x6559": b_aughlite( theitem );
"0x655A": b_spiritstone( theitem );
"0x655B": b_devilsclaw( theitem );
"0x655C": b_shadow( theitem );
"0x655D": b_gloom( theitem );
"0x655E": b_devilstooth( theitem );
"0x655F": b_pyrite( theitem );
"0x6560": b_agapite( theitem );
"0x6561": b_malachite( theitem );
"0x6562": b_kryztal( theitem );
"0x6563": b_gold( theitem );
"0x6564": b_velvite( theitem );
"0x6565": b_snograz( theitem );
"0x6566": b_valorite( theitem );
"0x6567": b_fatigue( theitem );
"0x6568": b_wraithsbone( theitem );
"0x6569": b_scarlelite( theitem );
"0x656A": b_onyx( theitem );
"0x656B": b_coral( theitem );
"0x657B": b_solar( theitem );
"0x657C": b_startear( theitem );
"0x657D": b_silver( theitem );
"0x657E": b_lunar( theitem );
"0x657F": b_royal( theitem );
// SPECIAL ORES
"0x656C": b_deamonsfear( theitem );
"0x656D": b_deamonrock( theitem );
"0x656E": b_molten( theitem );
// Specialist Ores [DWARVEN]
"0x656F": b_lhiolite( theitem );
"0x6570": b_gredstinuel( theitem );
"0x6571": b_glacial( theitem ); //Glacial for us
"0x6572": b_tekrhan( theitem );
"0x6573": b_hekhranish( theitem );
"0x6574": b_dwarfishorkanian( theitem );
"0x6575": b_aorkrhan( theitem );
"0x6576": b_auropian( theitem );
// Radlius Series [RADLIUS]
"0x6577": b_shalrius( theitem );
"0x6578": b_ghuronius( theitem );
"0x6579": b_keltrunius( theitem );
// Gargoyles
"0x657A": b_atrintium( theitem );
// Special Ores
"0x64F7": b_mithril( theitem );
"0x64F9": b_adamantium( theitem );
"0xF58": b_electrical( theitem );
"0xF59": b_magnetic ( theitem );
"0xF5B": b_winterite ( theitem );
"0xF5A": b_molten ( theitem );
"0x6580": b_rosesteel ( theitem );
"0x658A": b_crimsonite ( theitem );
"0xFFFD": b_phoenix ( theitem);
default: return( theitem ); //something funky has happened - return item unchanged
endcase
endfunction
function b_DullCopper( theitem )
SetObjProperty(theitem, "dca",1); //for special Abilitys Later
endfunction
function b_Copper( theitem )
SetObjProperty(theitem, "coa",1); //for special Abilitys Later
endfunction
function b_bronze( theitem )
SetObjProperty(theitem, "bro",1); //for special Abilitys Later
endfunction
function b_iron( theitem )
SetObjProperty(theitem, "iro",1); //for special Abilitys Later
endfunction
function b_verite( theitem )
SetObjProperty(theitem, "ver",1); //for special Abilitys Later
endfunction
function b_syntian( theitem )
SetObjProperty(theitem, "syn",1); //for special Abilitys Later
endfunction
function b_azurite( theitem )
SetObjProperty(theitem, "azu",1); //for special Abilitys Later
SetObjProperty(theitem, "dexdrain", 25);
endfunction
function b_executor( theitem )
SetObjProperty(theitem, "exe",1); //for special Abilitys Later
SetObjProperty(theitem, "ratmanslaying", 1);
endfunction
function b_radlius( theitem )
SetObjProperty(theitem, "rad",1); //for special Abilitys Later
SetObjProperty(theitem, "blocking", 6);
endfunction
function b_aughlite( theitem )
SetObjProperty(theitem, "aug",1); //for special Abilitys Later
SetObjProperty(theitem, "protdexdrain", 5);
endfunction
function b_spiritstone( theitem )
SetObjProperty(theitem, "spi",1); //for special Abilitys Later
SetObjProperty(theitem, "blocking", 3);
endfunction
function b_devilsclaw( theitem )
SetObjProperty(theitem, "dcl",1); //for special Abilitys Later
SetObjProperty(theitem, "ophidianslaying", 1);
endfunction
function b_shadow( theitem )
SetObjProperty(theitem, "sha",1); //for special Abilitys Later
endfunction
function b_gloom( theitem )
SetObjProperty(theitem, "glo",1); //for special Abilitys Later
SetObjProperty(theitem, "dismount", 1);
endfunction
function b_devilstooth( theitem )
SetObjProperty(theitem, "dto",1); //for special Abilitys Later
SetObjProperty(theitem, "lizardmanslaying", 1);
endfunction
function b_pyrite( theitem )
SetObjProperty(theitem, "pyr",1); //for special Abilitys Later
SetObjProperty(theitem, "orcslaying", 1);
endfunction
function b_agapite( theitem )
SetObjProperty(theitem, "aga",1); //for special Abilitys Later
SetObjProperty(theitem, "protparalyze", 15);
endfunction
function b_malachite( theitem )
SetObjProperty(theitem, "mal",1); //for special Abilitys Later
SetObjProperty(theitem, "poisonresist", 15);
endfunction
function b_kryztal( theitem )
SetObjProperty(theitem, "kry",1); //for special Abilitys Later
SetObjProperty(theitem, "weaponbreaking", 1);
endfunction
function b_gold( theitem )
SetObjProperty(theitem, "gol",1); //for special Abilitys Later
endfunction
function b_velvite( theitem )
SetObjProperty(theitem, "dsp",1); //for special Abilitys Later
SetObjProperty(theitem, "blocking", 10);
endfunction
function b_rosesteel( theitem )
SetObjProperty(theitem, "ros",1); //for special Abilitys Later
SetObjProperty(theitem, "blocking", 6);
endfunction
function b_mithril( theitem )
SetObjProperty(theitem, "mth",1); //for special Abilitys Later
SetObjProperty(theitem, "blocking", 30);
endfunction
function b_snograz( theitem )
SetObjProperty(theitem, "sno",1); //for special Abilitys Later
SetObjProperty(theitem, "poison", 5);
endfunction
function b_valorite( theitem )
SetObjProperty(theitem, "val",1); //for special Abilitys Later
endfunction
function b_fatigue( theitem )
SetObjProperty(theitem, "fat",1); //for special Abilitys Later
SetObjProperty(theitem, "protmanadrain", 15);
endfunction
function b_wraithsbone( theitem )
SetObjProperty(theitem, "wra",1); //for special Abilitys Later
SetObjProperty(theitem, "vampire", 5);
endfunction
function b_scarlelite( theitem )
SetObjProperty(theitem, "sca",1); //for special Abilitys Later
SetObjProperty(theitem, "damreflect", 10);
endfunction
function b_crimsonite( theitem )
SetObjProperty(theitem, "sca",1); //for special Abilitys Later
SetObjProperty(theitem, "damreflect", 5);
endfunction
function b_onyx( theitem )
SetObjProperty(theitem, "ony",1); //for special Abilitys Later
SetObjProperty(theitem, "allelement", 10);
SetObjProperty(theitem, "manadrain", 10);
endfunction
function b_empyrean( theitem )
SetObjProperty(theitem, "emp",1); //for special Abilitys Later
SetObjProperty(theitem, "allelement", 15);
SetObjProperty(theitem, "extra_damage", 5);
endfunction
function b_deamonsfear( theitem )
SetObjProperty(theitem, "dfe",1); //for special Abilitys Later
SetObjProperty(theitem, "deamonslaying", 1);
endfunction
function b_deamonrock( theitem )
SetObjProperty(theitem, "dro",1); //for special Abilitys Later
SetObjProperty(theitem, "damreflect", 15);
endfunction
function b_deamonskull( theitem )
SetObjProperty(theitem, "dsk",1); //for special Abilitys Later
endfunction
function b_lhiolite( theitem )
SetObjProperty(theitem, "lhi",1); //for special Abilitys Later
SetObjProperty(theitem, "fireresist", 25);
endfunction
function b_gredstinuel( theitem )
SetObjProperty(theitem, "gre",1); //for special Abilitys Later
SetObjProperty(theitem, "coldresist", 25);
endfunction
function b_winterite( theitem )
SetObjProperty(theitem, "win",1); //for special Abilitys Later
SetObjProperty(theitem, "coldresist", 20);
endfunction
function b_glacial( theitem )
SetObjProperty(theitem, "gla",1); //for special Abilitys Later
SetObjProperty(theitem, "cold", 5);
SetObjProperty(theitem, "coldresist", 5);
endfunction
function b_tekrhan( theitem )
SetObjProperty(theitem, "tek",1); //for special Abilitys Later
SetObjProperty(theitem, "terathanslaying", 1);
endfunction
function b_hekhranish( theitem )
SetObjProperty(theitem, "hek",1); //for special Abilitys Later
SetObjProperty(theitem, "dragonslaying", 1);
endfunction
function b_dwarfishorkanian( theitem )
SetObjProperty(theitem, "dor",1); //for special Abilitys Later
SetObjProperty(theitem, "trollslaying", 1);
endfunction
function b_aorkrhan( theitem )
SetObjProperty(theitem, "aor",1); //for special Abilitys Later
SetObjProperty(theitem, "manadrain", 10);
SetObjProperty(theitem, "protparalyze", 10);
endfunction
function b_auropian( theitem )
SetObjProperty(theitem, "aur",1); //for special Abilitys Later
SetObjProperty(theitem, "allelement", 25);
endfunction
function b_shalrius( theitem )
SetObjProperty(theitem, "sha",1); //for special Abilitys Later
SetObjProperty(theitem, "sha",1);
endfunction
function b_ghuronius( theitem )
SetObjProperty(theitem, "ghu",1); //for special Abilitys Later
SetObjProperty(theitem, "shock", 1);
endfunction
function b_keltrunius( theitem )
SetObjProperty(theitem, "kel",1); //for special Abilitys Later
SetObjProperty(theitem, "extra_damage", 20);
endfunction
function b_atrintium( theitem )
SetObjProperty(theitem, "atr",1); //for special Abilitys Later
SetObjProperty(theitem, "paralyze", 10);
endfunction
function b_solar( theitem )
SetObjProperty(theitem, "sol",1); //for special Abilitys Later
SetObjProperty(theitem, "fire", 3);
SetObjProperty(theitem, "fireresist", 3);
endfunction
function b_molten( theitem )
SetObjProperty(theitem, "sol",1); //for special Abilitys Later
SetObjProperty(theitem, "fire", 5);
SetObjProperty(theitem, "fireresist", 5);
endfunction
function b_volcanic( theitem )
SetObjProperty(theitem, "sol",1); //for special Abilitys Later
SetObjProperty(theitem, "fire", 1);
SetObjProperty(theitem, "fireresist", 1);
endfunction
function b_startear( theitem )
SetObjProperty(theitem, "sta",1); //for special Abilitys Later
SetObjProperty(theitem, "cold", 3);
SetObjProperty(theitem, "coldresist", 3);
endfunction
function b_coral( theitem )
SetObjProperty(theitem, "cor",1); //for special Abilitys Later
SetObjProperty(theitem, "cold", 1);
SetObjProperty(theitem, "coldresist", 1);
endfunction
function b_silver( theitem )
SetObjProperty(theitem, "sil",1); //for special Abilitys Later
SetObjProperty(theitem, "silver", 1);
endfunction
function b_lunar( theitem )
SetObjProperty(theitem, "lun",1); //for special Abilitys Later
SetObjProperty(theitem, "elec", 3);
SetObjProperty(theitem, "elecresist", 3);
endfunction
function b_electrical( theitem )
SetObjProperty(theitem, "ele",1); //for special Abilitys Later
SetObjProperty(theitem, "elec", 1);
SetObjProperty(theitem, "elecresist", 1);
endfunction
function b_magnetic( theitem )
SetObjProperty(theitem, "mag",1); //for special Abilitys Later
SetObjProperty(theitem, "elec", 5);
SetObjProperty(theitem, "elecresist", 5);
endfunction
function b_royal( theitem )
SetObjProperty(theitem, "roy",1); //for special Abilitys Later
SetObjProperty(theitem, "magicresist", 20);
endfunction
function b_adamantium( theitem )
SetObjProperty(theitem, "adm",1); //for special Abilitys Later
SetObjProperty(theitem, "damreflect", 30);
endfunction
function b_phoenix( theitem )
SetObjProperty(theitem, "pho",1); //for special Abilitys Later
SetObjProperty(theitem, "allelement", 35);
SetObjProperty(theitem, "fire", 35);
endfunction
Code: Select all
///////////////////
// Allows the user to try to repair a blacksmithy item
///////////////////
include "include/attributes";
function RepairBlacksmithyItem(byref character, byref item, repair_skill)
if (!item.maxhp || !item.quality)
SendSysMessage(character, "That item cannot be repaired.");
return;
endif
//if the item is in full repair, try to do special stuff
if (item.hp >= item.maxhp)
if ( GetObjProperty(item,"ownerserial") )
SendSysMessage(character, "That has an owner's mark!");
return;
endif
DoSpecialBlacksmithingStuff(character, item, repair_skill);
return;
endif
//make sure the item is good enough to be repairable
if (item.hp <= 10)
SendSysMessage(character, "The brittle material breaks when you handle it.");
DestroyItem(item);
return;
endif
//setup some variables
var item_damaged_amount := item.maxhp - item.hp;
//now determine how many ingots and how much skill it will take to repair this item
var ingots_needed := CInt(item_damaged_amount/15);
if (!ingots_needed)
ingots_needed := 1;
endif
//allow the use to pick which ingots to use
SendSysMessage(character, "You need " + ingots_needed + " ingot(s) to repair this item.");
SendSysMessage(character, "Target the same type of ingots to repair it");
var found_ingots := Target(character);
if (!found_ingots)
SendSysMessage(character, "Canceled.");
return;
endif
if (!IsIngot(found_ingots.objtype) )
SendSysMessage(character, "That's not an ingot!");
return;
endif
var hidetype := GetObjProperty( item, "IngotType");
if (hidetype != found_ingots.objtype)
SendSysMessage(character, "That is not the same type of ingots!");
return;
endif
if (!ReserveItem(found_ingots) )
SendSysMessage(character, "You cannot use that right now.");
return;
endif
if (!Accessible(character, found_ingots) )
SendSysMessage(character, "You can't reach that.");
return;
endif
if (found_ingots.amount < ingots_needed)
SendSysMessage(character, "You need " + ingots_needed + " ingots. That's only " + found_ingots.amount + "!");
return;
endif
PlaySoundEffect(character, SFX_ANVIL);
PerformAction(character, ANIM_ATTACK_1HAND_DOWN);
sleep(2);
PlaySoundEffect(character, SFX_ANVIL);
PerformAction(character, ANIM_ATTACK_1HAND_DOWN);
sleep(2);
PlaySoundEffect(character, SFX_ANVIL);
PerformAction(character, ANIM_ATTACK_1HAND_DOWN);
sleep(2);
SubtractAmount(found_ingots, ingots_needed);
var total_damage := GetObjProperty(item, "total_damage");
if (!total_damage)
total_damage := 0;
endif
if (total_damage + item_damaged_amount > item.maxhp)
DestroyItem(item);
SendSysMessage(character, "The brittle material breaks when you handle it.");
return;
endif
if (!CheckSkill(character, repair_skill, 80, 0) )
total_damage := total_damage + RandomInt(10);
SetObjProperty(item, "total_damage", total_damage);
if (total_damage + item_damaged_amount > item.maxhp)
DestroyItem(item);
SendSysMessage(character, "The brittle material breaks when you handle it.");
return;
endif
SendSysMessage(character, "You only manage to damage the item further...");
item.hp := item.hp - (RandomInt(10));
return;
endif
var skill_bonus := CInt(GetEffectiveSkill(character, SKILLID_BLACKSMITHY)/4);
if (item.name["fine"])
skill_bonus := skill_bonus + 5;
elseif (item.name["durable"])
skill_bonus := skill_bonus + 10;
elseif (item.name["rugged"])
skill_bonus := skill_bonus + 15;
elseif (item.name["tempered"])
skill_bonus := skill_bonus + 20;
elseif (item.name["indestructable"])
skill_bonus := skill_bonus + 25;
elseif (item.name["exceptional"])
skill_bonus := skill_bonus + 25;
endif
item_damaged_amount := CInt(item_damaged_amount * (100-skill_bonus)/100);
if (item_damaged_amount < 5)
item_damaged_amount := 5;
endif
total_damage := total_damage + item_damaged_amount;
SetObjProperty(item, "total_damage", total_damage);
item.hp := item.maxhp;
SendSysMessage(character, "You repair the item completely");
return;
endfunction
///////////////////
// checks what special options are available for upgrading a blacksmithy item
///////////////////
function DoSpecialBlacksmithingStuff(byref character, byref item, repair_skill)
if (getobjproperty(item, "elite"))
makelegendary(character,item);
return;
endif
//nothing we can do with player made items at the highest upgrade level
if (item.desc["exceptional"] || item.desc["Exceptional"])
SendSysMessage(character, "That item is in full repair.");
return;
endif
//if its a magic item and they're using blacksmithy, they can change the color of the item, or
//if its a breastplate, they can change its gender
if (IsMagicalItem(item))
// if (repair_skill != SKILLID_BLACKSMITHY)
SendSysMessage(character, "Magical items can not be repaired.");
return;
// endif
if (item.graphic == UOBJ_PLATE_BREASTPLATE || item.graphic == UOBJ_PLATE_BREASTPLATE2 ||
item.graphic == UOBJ_PLATE_FEMALE || item.graphic == UOBJ_PLATE_FEMALE2)
var menu := CreateMenu("Options:");
AddMenuItem(menu, 0, "Laminate");
AddMenuItem(menu, 0, "Change gender");
var selection := SelectMenuItem2(character, menu);
if (!selection)
SendSysMessage(character, "Canceled.");
return;
elseif (selection.index == 1)
DoColorCoating(character, item, repair_skill);
return;
elseif (selection.index == 2)
ChangeGenderOfMetalArmor(character, item, repair_skill);
return;
else
SendSysMessage(character, "You're not supposed to get this message. Whoops.");
return;
endif
return;
else
//DoColorCoating (character, item, repair_skill);
SendSysMessage(character, "That item is in full repair.");
return;
endif
//otherwise try to upgrade it
else
//DoBlacksmithyItemUpgrade (character, item, repair_skill);
SendSysMessage(character, "That item is in full repair.");
return;
endif
endfunction
///////////////////
// Tries to upgrade the item that was selected. This section only confirms the upgrade, then
// calls a seperate section of code
///////////////////
function DoBlacksmithyItemUpgrade(byref character, byref item, repair_skill)
var smith_cfg_file := ReadConfigFile( ":blacksmithy:blacksmithy" );
var elem := FindConfigElem(smith_cfg_file, item.objtype);
if (!elem)
SendSysMessage(character, "That item is in full repair.");
return;
endif
var material_needed := CInt(elem.material/2);
var time_delay := elem.time;
if (time_delay > 1)
time_delay := time_delay - 1;
endif;
var item_name := elem.name;
var item_skill := elem.skill + 15;
if (item.desc["quality"])
item_skill := item_skill + 10;
endif
if (item_skill > 110)
item_skill := 110;
endif
SendSysMessage(character, "That item is in full repair.");
SendSysMessage(character, "Upgrading that item will take " + material_needed + " ingots and " + item_skill + " skill.");
if (item_skill > GetEffectiveSkill(character, repair_skill) + 20)
SendSysMessage(character, "Your skill is too low to upgrade that item.");
return;
endif
//allow the use to pick which ingots to use
SendSysMessage(character, "Target the ingots to use:");
var found_ingots := Target(character);
if (!found_ingots)
SendSysMessage(character, "Canceled.");
return;
endif
if (!IsIngot(found_ingots.objtype) )
SendSysMessage(character, "That's not an ingot!");
return;
endif
if (!ReserveItem(found_ingots) )
SendSysMessage(character, "You cannot use that right now.");
return;
endif
if (!Accessible(character, found_ingots) )
SendSysMessage(character, "You can't reach that.");
return;
endif
if (found_ingots.amount < material_needed)
SendSysMessage(character, "You need " + material_needed + " ingots. That's only " + found_ingots.amount + "!");
return;
endif
PerformBlacksmithyItemUpgrade(character, item, found_ingots, material_needed, repair_skill, item_skill, time_delay, item_name);
endfunction
///////////////////
// this function does the actual item upgrade
///////////////////
function PerformBlacksmithyItemUpgrade(character, item, found_ingots, material_needed, repair_skill, item_skill, time_delay, prefix, item_name := 0, total_points := 0)
var sx := character.x;
var sy := character.y;
var blacksmithyskill := GetEffectiveSkill( character, SKILLID_BLACKSMITHY);
var armsloreskill := GetEffectiveSkill( character, SKILLID_ARMSLORE);
var eliteprobability := 0;
if(( blacksmithyskill > 95) && (armsloreskill > 95))
eliteprobability := CINT(((blacksmithyskill - 95)/2) + ((armsloreskill - 95)/2));
if(eliteprobability > 15)
eliteprobability := 15;
endif
endif
if (character.cmdlevel > 2)
SendSysMessage(character,"Chance for elite: " + eliteprobability,color := 0x89);
endif
repeat
for i := 1 to time_delay
PerformAction(character, ANIM_ATTACK_1HAND_DOWN);
PlaySoundEffect(character, SFX_ANVIL);
sleepms(2100);
endfor
if (!found_ingots || found_ingots.amount < material_needed)
SendSysMessage(character, "You don't have enough material to continue.");
SubtractAmount(found_ingots, RandomInt(material_needed));
return;
endif
if (CheckSkill(character, repair_skill, item_skill, modify_points(character, repair_skill, total_points)) )
SubtractAmount(found_ingots, material_needed);
SendSysMessage(character, "You succeed in upgrading the item!");
if (item.desc ["quality"])
if ((RandomInt(100)+ 1) <= eliteprobability)
if(prefix)
item.name := "an elite " + prefix + " " + item_name;
else
item.name := "an elite " + item_name;
endif
item.quality := 1.5;
item.hp := item.maxhp;
var newname := SendTextEntryGump( character, "Choose a name for the elite:", 50);
if(newname)
SetName(item, "-" + newname + "-" );
endif
SendSysMessage( character, "You craft an elite " + item_name + " and place it in your pack." );
SetObjProperty(item, "craftedby", "crafted by " + character.name);
SetObjProperty(item, "elite", 1);
return;
endif
if(prefix)
item.name := "an exceptional " + prefix + " " + item_name;
else
item.name := "an exceptional " + item_name;
endif
item.quality := 1.3;
item.hp := item.maxhp;
return;
else
if(prefix)
item.name := "a quality " + prefix + " " + item_name;
else
item.name := "a quality " + item_name;
endif
item.quality := 1.1;
item.hp := item.maxhp;
if (item_skill > 120)
item_skill := 120;
endif
if (item_skill > GetEffectiveSkill(character, repair_skill) + 20)
SendSysMessage(character, "Your skill is too low to upgrade the item any further.");
return;
endif
item_skill := item_skill + 10;
if (character.cmdlevel > 2)
SendSysMessage(character,"Skill for exceptional: " + item_skill,color := 0x89);
endif
endif
else
SubtractAmount(found_ingots, RandomInt(material_needed) );
if ((blacksmithyskill < 100) || (armsloreskill < 100))
if ((RandomInt(CINT((armsloreskill+blacksmithyskill)/4))+1)==1)
SendSysMessage(character, "You ruin the item trying to upgrade it.");
DestroyItem(item);
return 0;
else
SendSysMessage(character, "You destroy some material.");
endif
else
SendSysMessage(character, "You destroy some material.");
endif
endif
until (character.x != sx || character.y != sy);
endfunction
///////////////////
// allows the user to coat the given piece of equipment with another color
///////////////////
function DoColorCoating(byref character, byref item, repair_skill)
var smith_cfg_file := ReadConfigFile( ":blacksmithy:blacksmithy" );
var elem := FindConfigElem(smith_cfg_file, item.objtype);
if (!elem)
SendSysMessage(character, "That item is in full repair.");
return;
endif
var material_needed := CInt(elem.material/2);
var time_delay := elem.time;
if (time_delay > 1)
time_delay := time_delay - 1;
endif;
SendSysMessage(character, "That item is in full repair.");
SendSysMessage(character, "Laminating that item will take " + material_needed);
if (GetEffectiveSkill(character, repair_skill) < 90)
SendSysMessage(character, "Your skill is too low to laminate that item.");
return;
endif
SendSysMessage(character, "Target some ingots to laminate the item with.");
var found_ingots := Target(character);
if (!found_ingots)
SendSysMessage(character, "Canceled.");
return;
endif
if (!ReserveItem(found_ingots) )
SendSysMessage(character, "You cannot use that right now.");
return;
endif
if (!IsIngot(found_ingots.objtype) )
SendSysMessage(character, "That's not an ingot!");
return;
endif
if (!Accessible(character, found_ingots) )
SendSysMessage(character, "You can't reach that.");
return;
endif
if (found_ingots.amount < material_needed)
SendSysMessage(character, "You need " + material_needed + " ingots. That's only " + found_ingots.amount + "!");
return;
endif
var confirm_upgrade := YesNo(character, "Laminate?");
if (!confirm_upgrade)
SendSysMessage(character, "Canceled.");
return;
endif
for i := 1 to time_delay
PlaySoundEffect(character, SFX_ANVIL);
sleep(2);
endfor
PlaySoundEffect(character, SFX_ANVIL);
if (RandomInt(1000) == 0)
SendSysMessage(character, "You fail, destroying the item.");
DestroyItem(item);
return;
elseif ( RandomInt(100) < 10 )
SendSysMessage(character, "You fail, destroying some ingots.");
SubtractAmount(found_ingots, RandomInt(material_needed) );
return;
else
SendSysMessage(character, "You succeed in laminating the item.");
item.color := found_ingots.color;
SubtractAmount(found_ingots, material_needed);
return;
endif
endfunction
///////////////////
// changes the gender of plate armor from male to female and back again
///////////////////
function ChangeGenderOfMetalArmor(byref character, byref item, repair_skill)
var smith_cfg_file := ReadConfigFile( ":blacksmithy:blacksmithy" );
var elem := FindConfigElem(smith_cfg_file, item.objtype);
if (!elem)
SendSysMessage(character, "That item is in full repair.");
return;
endif
var material_needed := CInt(elem.material/2);
var time_delay := elem.time;
if (time_delay > 1)
time_delay := time_delay - 1;
endif;
SendSysMessage(character, "That item is in full repair.");
SendSysMessage(character, "Changing the gender of that item will take " + material_needed);
if (GetEffectiveSkill(character, repair_skill) < 90)
SendSysMessage(character, "Your skill is too low to do this.");
return;
endif
SendSysMessage(character, "Target the ingots to use:");
var found_ingots := Target(character);
if (!found_ingots)
SendSysMessage(character, "Canceled.");
return;
endif
if (!IsIngot(found_ingots.objtype) )
SendSysMessage(character, "That's not an ingot!");
return;
endif
if (!ReserveItem(found_ingots) )
SendSysMessage(character, "You cannot use that right now.");
return;
endif
if (!Accessible(character, found_ingots) )
SendSysMessage(character, "You can't reach that.");
return;
endif
if (found_ingots.amount < material_needed)
SendSysMessage(character, "You need " + material_needed + " ingots. That's only " + found_ingots.amount + "!");
return;
endif
var confirm_upgrade := YesNo(character, "Change gender?");
if (!confirm_upgrade)
SendSysMessage(character, "Canceled.");
return;
endif
for i := 1 to time_delay
PlaySoundEffect(character, SFX_ANVIL);
sleep(2);
endfor
PlaySoundEffect(character, SFX_ANVIL);
if (RandomInt(1000) == 0)
SendSysMessage(character, "You fail, destroying the item.");
DestroyItem(item);
return;
elseif ( RandomInt(100) < 10 )
SendSysMessage(character, "You fail, destroying some ingots.");
SubtractAmount(found_ingots, RandomInt(material_needed) );
return;
else
SendSysMessage(character, "You succeed in modifying the item.");
case (item.graphic)
UOBJ_PLATE_BREASTPLATE:
item.graphic := UOBJ_PLATE_FEMALE;
UOBJ_PLATE_BREASTPLATE2:
item.graphic := UOBJ_PLATE_FEMALE2;
UOBJ_PLATE_FEMALE:
item.graphic := UOBJ_PLATE_BREASTPLATE;
UOBJ_PLATE_FEMALE2:
item.graphic := UOBJ_PLATE_BREASTPLATE2;
default:
SendSysMessage(character, "Um, never mind. I was thinking of a different type of item, I guess.");
return;
endcase
SubtractAmount(found_ingots, material_needed);
return;
endif
endfunction
function makelegendary(byref character, weapon)
const SOUND_EFFECT_SPARKLE := 0x1e8;
const EFFECT_SPARKLE := 0x373a;
var diff,element,chargename;
if (!weapon.movable)
return;
endif
if (!ismetalweapon(weapon))
return;
endif
diff:=getobjproperty(weapon, "elite");
if (!diff)
Sendsysmessage (character, "This is not an elite weapon");
return;
endif
if (!Accessible(character,weapon))
return;
endif
SendSysMessage(character, "Select the gem to use.");
var thegem := Target(character);
if (!thegem)
return;
endif
if (!Accessible(character,thegem))
return;
endif
if (!thegem.movable)
return;
endif
case (thegem.objtype)
0x0f13://name Summon Daemon
element:= "dismount";
chargename := "ruby";
0x0f11://name Lightening
element:= "elec";
chargename := "sapphire";
0x0f30://name Flame Strike
element:= "fire";
chargename := "diamond";
0x0f0f://name Meteor Swarm
element:= "cold";
chargename := "star sapphire";
0x0f25://name Nightsight
element:= "sil";
chargename := "amber";
0x0f15://name Protection
element:= "dragonslaying";
chargename := "citrine";
0x0f16://name Venom
element:= "poison";
chargename := "amethyst";
0x0f10://name Resurrection
chargename := "emerald";
element:= "disarm";
0x0f18://name Magic Missile
chargename := "tourmaline";
element:= "vampire";
default:
SendSysMessage(character, "You can't charge that!");
return;
endcase
var fail_damage:=randomint(100)+20;
SubtractAmount(thegem,1);
for i := 1 to 10
PerformAction(character, ANIM_ATTACK_1HAND_DOWN);
PlaySoundEffect(character, SFX_ANVIL);
sleepms(2100);
endfor
PlaySoundEffect(character, SFX_ANVIL);
sleep(1);
if (!CheckSkill(character, SKILLID_ARMSLORE, 110, modify_points(character, SKILLID_ARMSLORE, 50)))
PlaySoundEffect(character, SFX_SPELL_EXPLOSION);
PlayObjectCenteredEffect(character, FX_EXPLODE_3, 7, 0x10);
PrintTextAbovePrivate(character,"*You destroy the weapon*",character);
applyrawdamage(character, fail_damage);
DestroyItem(weapon);
elseif (!CheckSkill(character, SKILLID_BLACKSMITHY, 110, modify_points(character, SKILLID_BLACKSMITHY, 50)))
PlaySoundEffect(character, SFX_SPELL_EXPLOSION);
PlayObjectCenteredEffect(character, FX_EXPLODE_3, 7, 0x10);
PrintTextAbovePrivate(character,"*You destroy the weapon*",character);
applyrawdamage(character, fail_damage);
DestroyItem(weapon);
else
if (randomint(5)<diff)
PlaySoundEffect(character, SFX_SPELL_EXPLOSION);
PlayObjectCenteredEffect(character, FX_EXPLODE_3, 7, 0x10);
PrintTextAbovePrivate(character,"*You destroy the weapon*",character);
applyrawdamage(character, fail_damage);
DestroyItem(weapon);
return;
endif
PlayObjectCenteredEffect(character, EFFECT_SPARKLE, 7,0x10);
PlaySoundEffect(character, SOUND_EFFECT_SPARKLE);
SetObjProperty(weapon,element,5);
if (diff==1)
PrintTextAbovePrivate(character,"*You created a legendary weapon!*",character);
else
PrintTextAbovePrivate(character,"*You enchanted the legendary weapon!*",character);
endif
var newname := SendTextEntryGump( character, "Choose name for the legendary item", 50);
var itemname:=Getobjproperty(weapon,"name");
if(newname)
SetName(weapon, "-" + newname + "-" );
else
SetName(weapon, "a legendary " + itemname);
endif
diff:=CINT(diff)+1;
SetObjProperty(weapon,"elite",diff);
endif
endfunction