Skip to content

Commit

Permalink
Merge branch 'develop' into UOR-Weapon-abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonSlayer62 committed Nov 15, 2023
2 parents ab943d1 + b6eb842 commit f89cfe8
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 25 deletions.
35 changes: 28 additions & 7 deletions data/js/server/data/material_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const itemTileIDList = [
0x4075, 0x4076, 0x48ae, 0x48af, 0x48b0, 0x48b1, 0x48b2, 0x48b3, 0x48b4, 0x48b5, 0x48b6,
0x48b7, 0x48ba, 0x48bb, 0x48bc, 0x48bd, 0x48be, 0x48bf, 0x48c0, 0x48c1, 0x48c2, 0x48c3,
0x48c4, 0x48c5, 0x48c6, 0x48c7, 0x48c8, 0x48c9, 0x48ca, 0x48cb, 0x48cc, 0x48cd, 0x48ce,
0x48cf, 0x48d0, 0x48d1, 0x48d2, 0x48d3, 0xa341, 0xa342, 0xa345, 0xa346,
0x48cf, 0x48d0, 0x48d1, 0x48d2, 0x48d3, 0xa341, 0xa342, 0xa345, 0xa346, 0x0fbb, 0x0fbc,
0x1EBC, 0x0f9e, 0x0f9f, 0x08FD,

// Armor
0x13bb, 0x13be, 0x13bf, 0x13c0, 0x13c3, 0x13c4, 0x13eb, 0x13ec, 0x13ed, 0x13ee, 0x13ef,
Expand All @@ -39,10 +40,12 @@ const itemTileIDList = [
0x27c2, 0x27c3, 0x27c4, 0x27c8, 0x27cb, 0x27cc, 0x27cf, 0x27d0, 0x27d3, 0x27d4, 0x27d8,
0x2b6e, 0x2b6f, 0x2b70, 0x3165, 0x3166, 0x3167, 0x404f, 0x4050, 0x4051, 0x4052, 0x4053,
0x4054, 0x4055, 0x4056, 0x4210, 0x4211, 0x4212, 0x4213, 0x42de, 0x42df, 0x4d0a, 0x4d0b,
0x9985, 0x9986, 0x236C, 0x236D, 0x2690, 0x268F,

// Shields
0x1b72, 0x1b73, 0x1b74, 0x1b75, 0x1b76, 0x1b77, 0x1b7b, 0x2b01, 0x4201, 0x4202, 0x4203,
0x4204, 0x4206, 0x4208, 0x4209, 0x420a
0x4204, 0x4206, 0x4208, 0x4209, 0x420a, 0xA649, 0xA64A, 0xA831, 0xA832, 0x7818, 0x7817,
0x4228, 0x4229, 0x422A
]],
[ "leather", [
// Armor
Expand All @@ -59,7 +62,9 @@ const itemTileIDList = [
0x316c, 0x316d, 0x316e, 0x316f, 0x3170, 0x3171, 0x3179, 0x317a, 0x317b, 0x317c, 0x317d,
0x317e, 0x317f, 0x3180, 0x3181, 0x4047, 0x4048, 0x4049, 0x404a, 0x404b, 0x404c, 0x404d,
0x404e, 0x450d, 0x450e, 0x7822, 0x7823, 0x7824, 0x7825, 0x7826, 0x7827, 0x7828, 0x7829,
0x782a, 0x782b, 0x782c, 0x782d, 0x782e, 0xa40c, 0xa40d, 0xa40e, 0xa40f,
0x782a, 0x782b, 0x782c, 0x782d, 0x782e, 0xa40c, 0xa40d, 0xa40e, 0xa40f, 0xAF05, 0x1F0B,
0x1F0C, 0x2307, 0x2308, 0x2309, 0x230A, 0x230B, 0x230C, 0x2659, 0x265A, 0x265B, 0x265C,
0x265D, 0x265E, 0x2691, 0x2692,

// Weapons
0xa289, 0xa28a, 0xa28b, 0xa291, 0xa292, 0xa293,
Expand All @@ -77,7 +82,7 @@ const itemTileIDList = [


// Shields
0x1b78, 0x1b79, 0x1b7a, 0x4200, 0x4207
0x1b78, 0x1b79, 0x1b7a, 0x4200, 0x4207,
]],
[ "cloth", [
// Clothes
Expand All @@ -92,14 +97,22 @@ const itemTileIDList = [
0x4001, 0x4002, 0x4003, 0x46b4, 0x46b5, 0x4b9d, 0x4b9e, 0x4b9f, 0x4ba0, 0x7816, 0x7819,
0x781a, 0x781b, 0x781c, 0x781e, 0x781f, 0x9eef, 0x9ef0, 0x9ef7, 0x9ef8, 0x9ef9, 0x9efa,
0x9efb, 0x9efc, 0x9f3f, 0x9f40, 0xa0ab, 0xa0ac, 0xa0ad, 0xa0ae, 0xa0af, 0xa28d, 0xa28e,
0xa294, 0xa295, 0xa28f, 0xa290, 0xa410, 0xa411, 0xa412, 0xa413,
0xa294, 0xa295, 0xa28f, 0xa290, 0xa410, 0xa411, 0xa412, 0xa413, 0xA42B, 0xA1F6, 0x7821,
0x781D, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040A, 0x172E, 0x1EFD,
0x1EFE, 0x1EFF, 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F9F, 0x1FA0, 0x1FA1, 0x1FA2,
0x1FFD, 0x1FFE, 0x2305, 0x2306, 0x230D, 0x230E, 0x230F, 0x2310, 0x25F2, 0x25F3, 0x25F1,
0x25F0, 0x25EF, 0x25EE, 0x2649, 0x264A, 0x264D, 0x264E, 0x264F, 0x2650, 0x2651, 0x2652,
0x2653, 0x2654, 0x2655, 0x2656, 0x265F, 0x2660, 0x2661, 0x2662, 0x2663, 0x2664, 0x2665,
0x2666, 0x2667, 0x2668, 0x266B, 0x266C, 0x266D, 0x266E, 0x2671, 0x2672, 0x2673, 0x2674,
0x2677, 0x2678, 0x2679, 0x267A, 0x2681, 0x2682, 0x268B, 0x268C, 0x269D, 0x269E, 0x26A1,
0x26A2, 0x26A3, 0x26A4, 0x1F7B, 0x1F7C,

// Armor
0x2794, 0x2797, 0x2798, 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066
]],
[ "scales", [
// Armor
0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647, 0x2648
0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647, 0x2648, 0x2657, 0x2658
]],
[ "granite", [
// Weapons
Expand All @@ -113,7 +126,15 @@ const itemTileIDList = [
]],
[ "sand", [
// Weapons
0x0905, 0x090c, 0x4070, 0x4073,
0x0905, 0x090c, 0x4070, 0x4073
]],
["dragonturtlescute", [
// Armors
0x782E, 0x782D, 0x782C, 0x782B, 0x782A
]],
["tigerpelt", [
// Armors
0x7829, 0x7828, 0x7827, 0x7825, 0x7824, 0x7823, 0x7822
]]
];

Expand Down
20 changes: 17 additions & 3 deletions data/js/skill/craft/blacksmithing.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,24 @@ function onCallback1( pSock, ourObj )
{
// Calculate amount of resources returned based on player's mining skill, item's wear and tear,
// and amount of resources that went into making the item in the first place
var itemHitpointsPercentage = Math.floor(( ourObj.health * 100 ) / ourObj.maxhp );
if ( ourObj.health >= 1 || ourObj.usesLeft >= 1 )
{
var healthPercentage = 0;
if( ourObj.health >= 1 )
{
healthPercentage = Math.floor( ( ourObj.health * 100) / ourObj.maxhp );
}

var usesPercentage = 0;
if( ourObj.usesLeft >= 1 )
{
usesPercentage = Math.floor( ( ourObj.usesLeft * 100 ) / ourObj.maxUses );
}

// Reduce amount of resources returned based on state of object's wear and tear
resourceAmount = Math.floor(( maxResourceAmount * itemHitpointsPercentage ) / 100 );
var itemPercentage = usesPercentage > 0 ? Math.min( healthPercentage, usesPercentage ) : healthPercentage;

resourceAmount = Math.floor( ( maxResourceAmount * itemPercentage ) / 100 );
}

// Halve the amount of resources returned
resourceAmount = Math.max( Math.floor( resourceAmount / 2 ), 1 );
Expand Down
21 changes: 18 additions & 3 deletions data/js/skill/craft/tailoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,25 @@ function onCallback2( pSock, ourObj )
{
// Calculate amount of resources returned based on player's mining skill, item's wear and tear,
// and amount of resources that went into making the item in the first place
var itemHitpointsPercentage = Math.floor(( ourObj.health * 100 ) / ourObj.maxhp );
if( ourObj.health >= 1 || ourObj.usesLeft >= 1 )
{
var healthPercentage = 0;
if( ourObj.health >= 1 )
{
healthPercentage = Math.floor( ( ourObj.health * 100 ) / ourObj.maxhp );
}

var usesPercentage = 0;
if( ourObj.usesLeft >= 1 )
{
usesPercentage = Math.floor( ( ourObj.usesLeft * 100 ) / ourObj.maxUses );
}

// Reduce amount of resources returned based on state of object's wear and tear
resourceAmount = Math.floor(( maxResourceAmount * itemHitpointsPercentage ) / 100 );
var itemPercentage = usesPercentage > 0 ? Math.min( healthPercentage, usesPercentage ) : healthPercentage;

// Reduce amount of resources returned based on state of object's wear and tear
resourceAmount = Math.floor( ( maxResourceAmount * itemPercentage ) / 100 );
}

// Halve the amount of resources returned
resourceAmount = Math.max( Math.floor( resourceAmount / 2 ), 1 );
Expand Down
15 changes: 15 additions & 0 deletions source/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
14/11/2023 - Warden
Fixed crafting rank sytem modifiers.
Items crafted at Rank 1 will now have their stats multiplied by 60% of the DFN values for the following stats:
Damage (both Lo and Hi), Resist (Physical), HP (and MaxHP), Buy Value, Max Uses
For each rank above 1, the stat multiplier is increased by 5%, meaning a Rank 10 crafted item will have 105% DFN value for the above stats

13/11/2023 - Warden
Fixed an issue in which the timer callback for spinning wool, flax, and thread lost context, causing the spinning wheel to spin endlessly.

11/11/2023 - Danny S.
Implemented tailoring BODs.
Blacksmiths, armorers, weaponsmiths, and ironworkers have had their bodType custom tag value changed to 1. (malevendors.dfn, femalevendors.dfn)
Expand Down Expand Up @@ -30,6 +39,12 @@
10/11/2023 - Dragon Slayer
Added IDs for stocking items to cItem::GetPackType() in items.cpp, so they can be used as containers

09/11/2023 - Dragon Slayer, Xuri
Fixed Smelting items with 0 hp (js blacksmithing)
Fixed Unraveling items with 0 hp (js tailoring)
Added Tongs, Scissors, Tinkering Tools to material types (js material_types)
Updated ApplyRank to set hp,maxhp and maxuses to 1. (cpp skills)

29/10/2023 - Dragon Slayer, Xuri
Added DFN entries for first aid belt. (dfn item/gear/clothing/ej_clothing)
Added First Aid Belt ID to backpack type. (cpp items)
Expand Down
24 changes: 12 additions & 12 deletions source/skills.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,38 +117,38 @@ void CSkills::ApplyRank( CSocket *s, CItem *c, UI08 rank, UI08 maxrank )
{
c->SetRank( rank );

const double MIN_MULTIPLIER = 0.6; // Minimum rank 1 multiplier
const double PER_RANK_MULTIPLIER = 0.05; // Increase stats for each rank

double rankMultiplier = MIN_MULTIPLIER + (rank - 1) * PER_RANK_MULTIPLIER;

if( c->GetLoDamage() > 0 )
{
c->SetLoDamage( static_cast<SI16>(( rank * c->GetLoDamage() ) / 10 ));
c->SetLoDamage( static_cast<SI16>(c->GetLoDamage() * rankMultiplier));
}
if( c->GetHiDamage() > 0 )
{
c->SetHiDamage( static_cast<SI16>(( rank * c->GetHiDamage() ) / 10 ));
c->SetHiDamage( static_cast<SI16>(c->GetHiDamage() * rankMultiplier));
}
if( c->GetResist( PHYSICAL ) > 0 )
{
c->SetResist( static_cast<UI16>(( rank * c->GetResist( PHYSICAL )) / 10 ), PHYSICAL );
c->SetResist( static_cast<UI16>(c->GetResist( PHYSICAL ) * rankMultiplier), PHYSICAL );
}
if( c->GetHP() > 0 )
{
c->SetHP( static_cast<SI16>(( rank * c->GetHP() ) / 10 ));
c->SetHP( static_cast<SI16>(c->GetHP() * rankMultiplier));
}
if( c->GetMaxHP() > 0 )
{
c->SetMaxHP( static_cast<SI16>(( rank * c->GetMaxHP() ) / 10 ));
c->SetMaxHP( static_cast<SI16>(c->GetMaxHP() * rankMultiplier));
}
if( c->GetBuyValue() > 0 )
{
c->SetBuyValue( static_cast<UI32>(( rank * c->GetBuyValue() ) / 10 ));
c->SetBuyValue( static_cast<UI32>(c->GetBuyValue() * rankMultiplier));
}
if( c->GetMaxUses() > 0 )
{
c->SetUsesLeft( static_cast<UI16>(( rank * c->GetMaxUses() ) / 10 ));
}
if( c->GetId() == 0x22c5 && c->GetMaxHP() > 0 ) // Runebook
{
// Max charges for runebook stored in maxHP property, defaults to 10, ranges from 5-10 based on rank
c->SetMaxHP( static_cast<UI16>( std::max( static_cast<UI16>( 5 ), static_cast<UI16>(( rank * c->GetMaxHP() ) / 10 ))));
c->SetUsesLeft( static_cast<UI16>(c->GetMaxUses() * rankMultiplier));
}

// Convert item's rank to a value between 1 and 10, to fit rank system messages
Expand Down

0 comments on commit f89cfe8

Please sign in to comment.