Skip to content

Commit

Permalink
Merge pull request UOX3DevTeam#224 from danielshoun/tailor-bods
Browse files Browse the repository at this point in the history
Implement Tailoring BODs and fix minor BOD related issues.
  • Loading branch information
Xoduz authored Nov 12, 2023
2 parents efc8950 + d2a7ea3 commit 57ad72b
Show file tree
Hide file tree
Showing 9 changed files with 407 additions and 613 deletions.
17 changes: 15 additions & 2 deletions data/dfndata/items/deeds/misc_deeds.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,26 @@ id=0x14ef
id=0x2258
}

[smallbod]
[smallbod_blacksmith]
{
get=base_item
name=a bulk order deed
colour=0x44E//Blacksmith: 0x44E; Tailoring: 0x483
colour=0x44E
weight=100
script=5042
getlbr=smallbod_lbr
getaos=smallbod_aos
CUSTOMINTTAG=bodType 1
}

[smallbod_tailor]
{
get=base_item
name=a bulk order deed
colour=0x483
weight=100
script=5042
getlbr=smallbod_lbr
getaos=smallbod_aos
CUSTOMINTTAG=bodType 2
}
4 changes: 4 additions & 0 deletions data/dfndata/items/gear/clothing/footwear.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ decay=1
good=19
sectionid=0x170d
}
[sandals]
{
get=0x170d
}

// Sandals
[0x170e]
Expand Down
4 changes: 4 additions & 0 deletions data/dfndata/items/skills/resources/tailoring.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ dyeable=1
decay=1
good=49
}
[folded_cloth]
{
get=0x1763
}

[0x1764]
{
Expand Down
4 changes: 4 additions & 0 deletions data/dfndata/items/skills/tools/tailoring.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ maxuses=75
usesleft=25
script=2200// uses left tooltip
}
[sewing_kit]
{
get=0x0f9d
}

[0x0f9e]
{
Expand Down
13 changes: 10 additions & 3 deletions data/dfndata/npc/femalevendors.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ TACTICS=360 680
SHOPLIST=WeaponsmithShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 1
}

[f_baker]
Expand Down Expand Up @@ -231,6 +232,9 @@ EQUIPITEM=listobject54
COLORLIST=11
TAILORING=640 1000
SHOPLIST=TailorShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 2
CUSTOMINTTAG=bodSubtype 1
}

[f_bowyer]
Expand Down Expand Up @@ -394,7 +398,8 @@ ARMSLORE=640 1000
BLACKSMITHING=600 830
SHOPLIST=ArmorShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 2
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 2
}

[f_blacksmith]
Expand Down Expand Up @@ -424,7 +429,8 @@ SWORDSMANSHIP=600 830
TACTICS=600 830
SHOPLIST=BlacksmithShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 3
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 3
}

[f_architect]
Expand Down Expand Up @@ -1072,5 +1078,6 @@ SWORDSMANSHIP=600 830
TACTICS=600 830
SHOPLIST=BlacksmithShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 3
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 3
}
13 changes: 10 additions & 3 deletions data/dfndata/npc/malevendors.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ TACTICS=360 680
SHOPLIST=WeaponsmithShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 1
}

[m_baker]
Expand Down Expand Up @@ -268,6 +269,9 @@ EQUIPITEM=listobject46
COLORLIST=11
TAILORING=640 1000
SHOPLIST=TailorShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 2
CUSTOMINTTAG=bodSubtype 1
}

[m_bowyer]
Expand Down Expand Up @@ -447,7 +451,8 @@ ARMSLORE=640 1000
BLACKSMITHING=600 830
SHOPLIST=ArmorShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 2
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 2
}

[m_blacksmith]
Expand Down Expand Up @@ -479,7 +484,8 @@ SWORDSMANSHIP=600 830
TACTICS=600 830
SHOPLIST=BlacksmithShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 3
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 3
}

[m_architect]
Expand Down Expand Up @@ -1119,5 +1125,6 @@ SWORDSMANSHIP=600 830
TACTICS=600 830
SHOPLIST=BlacksmithShopping
SCRIPT=3214
CUSTOMINTTAG=bodType 3
CUSTOMINTTAG=bodType 1
CUSTOMINTTAG=bodSubtype 3
}
25 changes: 21 additions & 4 deletions data/js/item/smallbod.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
const BODTypesToSkillNames = {
1: "blacksmithing",
2: "tailoring"
};

const BODSubtypeMinMax = {
1: [1, 3],
2: [1, 1]
};

// Can also be triggered by creating BOD from admin menu or add command: 'add item smallbod
function onCreateDFN( objMade, objType )
{
if( !ValidateObject( objMade ))
return;

var bodEntry = TriggerEvent( 3214, "SelectBodEntry", null, false, 3 ); // 1 - weapon BODs, 2 - armor BODs, 3 - Either
var bodType = objMade.GetTag( "bodType" );
const bodSubtypeMinMax = BODSubtypeMinMax[bodType];
const bodSubtype = RandomNumber(bodSubtypeMinMax[0], bodSubtypeMinMax[1]);

var bodEntry = TriggerEvent( 3214, "SelectBodEntry", bodType, bodSubtype, false, 0 );
var itemName = bodEntry.name; // name of the create entry
var graphicID = bodEntry.id; // graphical id of item to craft
var sectionID = bodEntry.addItem; // section ID of item to craft
Expand All @@ -17,6 +31,7 @@ function onCreateDFN( objMade, objType )
objMade.SetTag( "graphicID", graphicID );
objMade.SetTag( "sectionID", sectionID );
objMade.SetTag( "materialColor", materialColor );
objMade.SetTag( "bodSubtype", 1 );
objMade.Refresh();
}
}
Expand Down Expand Up @@ -46,18 +61,20 @@ function onUseChecked( pUser, smallBOD )
var init = smallBOD.GetTag( "init" ) // just to make sure we dont set the bod over
if( init == false ) // Keep from resetting the amount needed.
{
const pSkill = pUser.skills[BODTypesToSkillNames[smallBOD.GetTag( "bodType" )]];

var amountMax = 0;
if( pUser.skills.blacksmithing >= 701 )
if( pSkill >= 701 )
{
if((( pUser.skills.blacksmithing + 800 ) / 2 ) > RandomNumber( 0, 1000 ))
if((( pSkill + 800 ) / 2 ) > RandomNumber( 0, 1000 ))
{
smallBOD.SetTag( "reqExceptional", true );
}

var values = [ 10, 15, 20, 20 ];
amountMax = values[Math.floor( Math.random() * values.length )];
}
else if( pUser.skills.blacksmithing >= 501 )
else if( pSkill >= 501 )
{
var values = [ 10, 15, 15, 20 ];
amountMax = values[Math.floor( Math.random() * values.length )];
Expand Down
Loading

0 comments on commit 57ad72b

Please sign in to comment.