From e3eb237a97749c39497526b8127f2b80f6c04a4f Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:10:16 -0600 Subject: [PATCH 1/6] Updated Smelting and unraveling Checking for health above 1 Checking if usesleft abive 1 added tongs/tinkering tools/scissors to metals. Updated skills.cpp with hp,maxhp,maxuses to set the to 1 --- data/js/server/data/material_types.js | 3 ++- data/js/skill/craft/blacksmithing.js | 20 +++++++++++++++++--- data/js/skill/craft/tailoring.js | 21 ++++++++++++++++++--- source/Changelog.txt | 6 ++++++ source/skills.cpp | 16 ++++++++-------- 5 files changed, 51 insertions(+), 15 deletions(-) diff --git a/data/js/server/data/material_types.js b/data/js/server/data/material_types.js index 1d44d7b07..d09336806 100644 --- a/data/js/server/data/material_types.js +++ b/data/js/server/data/material_types.js @@ -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, // Armor 0x13bb, 0x13be, 0x13bf, 0x13c0, 0x13c3, 0x13c4, 0x13eb, 0x13ec, 0x13ed, 0x13ee, 0x13ef, diff --git a/data/js/skill/craft/blacksmithing.js b/data/js/skill/craft/blacksmithing.js index 40285b483..e2ef59ee8 100644 --- a/data/js/skill/craft/blacksmithing.js +++ b/data/js/skill/craft/blacksmithing.js @@ -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 ); diff --git a/data/js/skill/craft/tailoring.js b/data/js/skill/craft/tailoring.js index 3ddde54d1..9c93a83c1 100644 --- a/data/js/skill/craft/tailoring.js +++ b/data/js/skill/craft/tailoring.js @@ -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 ); diff --git a/source/Changelog.txt b/source/Changelog.txt index 9e375d49e..cf0c0c4ab 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,3 +1,9 @@ +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) + 28/10/2023 - Dragon Slayer (0.99.6a) Added DFN entries for hallow pumpkins, jack o lanterns and halloween decorations. (dfn item/misc/halloween) Added DFN entrie for killerpumpkin in daemons.dfn. (dfn daemons) diff --git a/source/skills.cpp b/source/skills.cpp index d661a60d6..1342cfc5c 100644 --- a/source/skills.cpp +++ b/source/skills.cpp @@ -130,20 +130,20 @@ void CSkills::ApplyRank( CSocket *s, CItem *c, UI08 rank, UI08 maxrank ) c->SetResist( static_cast(( rank * c->GetResist( PHYSICAL )) / 10 ), PHYSICAL ); } if( c->GetHP() > 0 ) - { - c->SetHP( static_cast(( rank * c->GetHP() ) / 10 )); - } - if( c->GetMaxHP() > 0 ) - { - c->SetMaxHP( static_cast(( rank * c->GetMaxHP() ) / 10 )); - } + { + c->SetHP( std::max( static_cast( 1 ), static_cast(( rank * c->GetHP() ) / 10 ))); + } + if( c->GetMaxHP() > 0 ) + { + c->SetMaxHP( std::max( static_cast( 1 ), static_cast(( rank * c->GetMaxHP() ) / 10 ))); + } if( c->GetBuyValue() > 0 ) { c->SetBuyValue( static_cast(( rank * c->GetBuyValue() ) / 10 )); } if( c->GetMaxUses() > 0 ) { - c->SetUsesLeft( static_cast(( rank * c->GetMaxUses() ) / 10 )); + c->SetUsesLeft( std::max( static_cast( 1 ), static_cast(( rank * c->GetMaxUses() ) / 10 ))); } if( c->GetId() == 0x22c5 && c->GetMaxHP() > 0 ) // Runebook { From c38d008e14ce86c48cd61cd7fcc22aa2e2d617ad Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Sun, 12 Nov 2023 13:49:29 -0600 Subject: [PATCH 2/6] Add ton of missing items Added in dragonturtlescute type and tiger pelt type. --- data/js/server/data/material_types.js | 32 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/data/js/server/data/material_types.js b/data/js/server/data/material_types.js index d09336806..b9b282452 100644 --- a/data/js/server/data/material_types.js +++ b/data/js/server/data/material_types.js @@ -29,7 +29,7 @@ const itemTileIDList = [ 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, 0x0fbb, 0x0fbc, - 0x1EBC, 0x0f9e, 0x0f9f, + 0x1EBC, 0x0f9e, 0x0f9f, 0x08FD, // Armor 0x13bb, 0x13be, 0x13bf, 0x13c0, 0x13c3, 0x13c4, 0x13eb, 0x13ec, 0x13ed, 0x13ee, 0x13ef, @@ -40,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 @@ -60,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, @@ -78,7 +82,7 @@ const itemTileIDList = [ // Shields - 0x1b78, 0x1b79, 0x1b7a, 0x4200, 0x4207 + 0x1b78, 0x1b79, 0x1b7a, 0x4200, 0x4207, ]], [ "cloth", [ // Clothes @@ -93,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 @@ -116,6 +128,14 @@ const itemTileIDList = [ // Weapons 0x0905, 0x090c, 0x4070, 0x4073, ]] + ["dragonturtlescute", [ + // Armors + 0x782E, 0x782D, 0x782C, 0x782B, 0x782A, + ]] + ["tigerpelt", [ + // Armors + 0x7829, 0x7828, 0x7827, 0x7825, 0x7824, 0x7823, 0x7822, + ]] ]; function GetItemMaterialType( itemToCheck, idToCheck ) From 0c3ec8ae395bf6a45e6d0fc6457c8cabbea9662d Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Sun, 12 Nov 2023 15:28:00 -0600 Subject: [PATCH 3/6] Update material_types.js --- data/js/server/data/material_types.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/js/server/data/material_types.js b/data/js/server/data/material_types.js index b9b282452..c521293d2 100644 --- a/data/js/server/data/material_types.js +++ b/data/js/server/data/material_types.js @@ -105,7 +105,7 @@ const itemTileIDList = [ 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 + 0x26A2, 0x26A3, 0x26A4, 0x1F7B, 0x1F7C, // Armor 0x2794, 0x2797, 0x2798, 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066 @@ -126,15 +126,15 @@ const itemTileIDList = [ ]], [ "sand", [ // Weapons - 0x0905, 0x090c, 0x4070, 0x4073, - ]] + 0x0905, 0x090c, 0x4070, 0x4073 + ]], ["dragonturtlescute", [ // Armors - 0x782E, 0x782D, 0x782C, 0x782B, 0x782A, - ]] + 0x782E, 0x782D, 0x782C, 0x782B, 0x782A + ]], ["tigerpelt", [ // Armors - 0x7829, 0x7828, 0x7827, 0x7825, 0x7824, 0x7823, 0x7822, + 0x7829, 0x7828, 0x7827, 0x7825, 0x7824, 0x7823, 0x7822 ]] ]; From 9e96273e27536a9aa3d9e6165828eef0c12542fd Mon Sep 17 00:00:00 2001 From: Gameswarden Date: Tue, 14 Nov 2023 13:06:49 +0000 Subject: [PATCH 4/6] Updated crafting rank system --- source/skills.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/skills.cpp b/source/skills.cpp index d661a60d6..781e4ada4 100644 --- a/source/skills.cpp +++ b/source/skills.cpp @@ -117,38 +117,38 @@ void CSkills::ApplyRank( CSocket *s, CItem *c, UI08 rank, UI08 maxrank ) { c->SetRank( rank ); + const double MIN_MULTIPLIER = 0.5; // Minimum rank 1 multiplier + const double PER_RANK_MULTIPLIER = 0.10; // Increase stats for each rank + + double rankMultiplier = MIN_MULTIPLIER + (rank - 1) * PER_RANK_MULTIPLIER; + if( c->GetLoDamage() > 0 ) { - c->SetLoDamage( static_cast(( rank * c->GetLoDamage() ) / 10 )); + c->SetLoDamage( static_cast(c->GetLoDamage() * rankMultiplier)); } if( c->GetHiDamage() > 0 ) { - c->SetHiDamage( static_cast(( rank * c->GetHiDamage() ) / 10 )); + c->SetHiDamage( static_cast(c->GetHiDamage() * rankMultiplier)); } if( c->GetResist( PHYSICAL ) > 0 ) { - c->SetResist( static_cast(( rank * c->GetResist( PHYSICAL )) / 10 ), PHYSICAL ); + c->SetResist( static_cast(c->GetResist( PHYSICAL ) * rankMultiplier), PHYSICAL ); } if( c->GetHP() > 0 ) { - c->SetHP( static_cast(( rank * c->GetHP() ) / 10 )); + c->SetHP( static_cast(c->GetHP() * rankMultiplier)); } if( c->GetMaxHP() > 0 ) { - c->SetMaxHP( static_cast(( rank * c->GetMaxHP() ) / 10 )); + c->SetMaxHP( static_cast(c->GetMaxHP() * rankMultiplier)); } if( c->GetBuyValue() > 0 ) { - c->SetBuyValue( static_cast(( rank * c->GetBuyValue() ) / 10 )); + c->SetBuyValue( static_cast(c->GetBuyValue() * rankMultiplier)); } if( c->GetMaxUses() > 0 ) { - c->SetUsesLeft( static_cast(( 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( std::max( static_cast( 5 ), static_cast(( rank * c->GetMaxHP() ) / 10 )))); + c->SetUsesLeft( static_cast(c->GetMaxUses() * rankMultiplier)); } // Convert item's rank to a value between 1 and 10, to fit rank system messages From 51293f5910d5bfb5e529870b3920b14a7e0917d6 Mon Sep 17 00:00:00 2001 From: Gameswarden Date: Tue, 14 Nov 2023 13:06:49 +0000 Subject: [PATCH 5/6] Update changelog --- source/Changelog.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/Changelog.txt b/source/Changelog.txt index cbe169780..58a583922 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -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 50% 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 10%, meaning a Rank 10 crafted item will have 140% 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) From 06df76462780b2c171adfb87879bf8d42a210002 Mon Sep 17 00:00:00 2001 From: Gameswarden Date: Tue, 14 Nov 2023 17:31:40 +0000 Subject: [PATCH 6/6] Rebalanced rank scaling --- source/Changelog.txt | 4 ++-- source/skills.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/Changelog.txt b/source/Changelog.txt index 58a583922..9174e1722 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,8 +1,8 @@ 14/11/2023 - Warden Fixed crafting rank sytem modifiers. - Items crafted at Rank 1 will now have their stats multiplied by 50% of the DFN values for the following stats: + 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 10%, meaning a Rank 10 crafted item will have 140% DFN value for the above stats + 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. diff --git a/source/skills.cpp b/source/skills.cpp index 781e4ada4..dcffd1356 100644 --- a/source/skills.cpp +++ b/source/skills.cpp @@ -117,8 +117,8 @@ void CSkills::ApplyRank( CSocket *s, CItem *c, UI08 rank, UI08 maxrank ) { c->SetRank( rank ); - const double MIN_MULTIPLIER = 0.5; // Minimum rank 1 multiplier - const double PER_RANK_MULTIPLIER = 0.10; // Increase stats for each 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;