Skip to content

Commit

Permalink
Merge branch 'develop' into Flipped-Skills
Browse files Browse the repository at this point in the history
  • Loading branch information
Xoduz authored Jan 25, 2025
2 parents 39b4a54 + 9d52d4d commit a3d9a00
Show file tree
Hide file tree
Showing 22 changed files with 730 additions and 44 deletions.
56 changes: 56 additions & 0 deletions data/js/combat/leechstats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
function onEquip( pEquipper, iEquipped )
{
pEquipper.AddScriptTrigger( 7003 );
}

// Remove script trigger on unequip
function onUnequip( pUnequipper, iUnequipped )
{
pUnequipper.RemoveScriptTrigger( 7003 );
}

function onDamageDeal( attacker, damaged, damageValue, damageType )
{
// Fetch weapon in main hand or secondary hand
var iWeapon = attacker.FindItemLayer( 0x01 );
if( !ValidateObject( iWeapon ))
{
iWeapon = attacker.FindItemLayer( 0x02 );
}

if( ValidateObject( iWeapon ))
{ // Apply leech effects based on weapon properties
ApplyLeech( attacker, damaged, damageValue, iWeapon, 'healthLeech', 30 );
ApplyLeech( attacker, damaged, damageValue, iWeapon, 'staminaLeech', 100 );
ApplyLeech( attacker, damaged, damageValue, iWeapon, 'manaLeech', 40 );
}

return true;
}

function ApplyLeech( attacker, damaged, damageValue, weapon, leechType, multiplier )
{
// Get the leech amount for the specified leech type from the weapon
var leechPercentVal = weapon[ leechType ];
if( leechPercentVal > 0 )
{
// Calculate the percent of health restored to the attacker
var leechAmt = Math.round( damageValue * ( leechPercentVal / 100 ) * ( multiplier/100 ));

// Apply the leech effect based on the leech type
switch( leechType )
{
case 'healthLeech':
attacker.Heal( leechAmt );
break;
case 'staminaLeech':
attacker.stamina += leechAmt;
break;
case 'manaLeech':
attacker.mana += leechAmt;
break;
}

attacker.SoundEffect( 0x44D, true );
}
}
36 changes: 26 additions & 10 deletions data/js/commands/targeting/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,30 +294,27 @@ function HandleGetItem( socket, ourItem, uKey )
case "DESC":
socket.SysMessage( ourItem.desc );
break;
case "DEF":
socket.SysMessage( ourItem.Resist( 1 ));
break;
case "DEF":
case "RESISTARMOR":
socket.SysMessage( ourObj.Resist( 1 ));
socket.SysMessage( ourItem.Resist( 1 ));
break;
case "RESISTLIGHT":
socket.SysMessage( ourObj.Resist( 2 ));
socket.SysMessage( ourItem.Resist( 2 ));
break;
case "RESISTWATER":
socket.SysMessage( ourObj.Resist( 3 ));
socket.SysMessage( ourItem.Resist( 3 ));
break;
case "RESISTCOLD":
socket.SysMessage( ourObj.Resist( 4 ));
socket.SysMessage( ourItem.Resist( 4 ));
break;
case "RESISTFIRE":
socket.SysMessage( ourObj.Resist( 5 ));
socket.SysMessage( ourItem.Resist( 5 ));
break;
case "RESISTENERGY":
socket.SysMessage( ourObj.Resist( 6 ));
socket.SysMessage( ourItem.Resist( 6 ));
break;
case "RESISTPOISON":
socket.SysMessage( ourObj.Resist( 7 ));
socket.SysMessage( ourItem.Resist( 7 ));
break;
case "ARMORCLASS":
case "ARMOURCLASS":
Expand Down Expand Up @@ -598,8 +595,27 @@ function HandleGetChar( socket, ourChar, uKey )
break;
case "ARMOUR":
case "ARMOR":
case "RESISTARMOR":
socket.SysMessage( ourChar.Resist( 1 ));
break;
case "RESISTLIGHT":
socket.SysMessage( ourChar.Resist( 2 ));
break;
case "RESISTWATER":
socket.SysMessage( ourChar.Resist( 3 ));
break;
case "RESISTCOLD":
socket.SysMessage( ourChar.Resist( 4 ));
break;
case "RESISTFIRE":
socket.SysMessage( ourChar.Resist( 5 ));
break;
case "RESISTENERGY":
socket.SysMessage( ourChar.Resist( 6 ));
break;
case "RESISTPOISON":
socket.SysMessage( ourChar.Resist( 7 ));
break;
case "MAXHP":
socket.SysMessage( ourChar.maxhp );
break;
Expand Down
1 change: 1 addition & 0 deletions data/js/jse_fileassociations.scp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
// Combat Scripts [7000-7499]
//-------------------------------------------
7000=combat/peacemake_effect.js
7003=combat/leechstats.js

//-------------------------------------------
// Misc Player Scripts [8000-8499]
Expand Down
2 changes: 2 additions & 0 deletions data/js/jse_objectassociations.scp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@
0x10a4=15007

// Swords
0x0EC2=5009 //cleaver
0x0EC3=5009 //cleaver
0x0EC4=5009 //skinning knife
0x0EC5=5009 //skinning knife
0x0F60=5009 //longsword
Expand Down
2 changes: 1 addition & 1 deletion data/js/npc/ai/vendor_bdo_dispenser.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function onSpeech( myString, pUser, myNPC )
{
if( CheckBodTimers( pUser, myNPC.GetTag( "bodType" ) ))
{
if( EraStringToNum( GetServerSetting( "CoreShardEra" )) <= EraStringToNum( "lbr" ))
if( EraStringToNum( GetServerSetting( "CoreShardEra" )) >= EraStringToNum( "lbr" ))
{
myNPC.SetTimer( Timer.MOVETIME, 1000 ); // Pause NPC in their tracks for a second
myNPC.TurnToward( pUser );
Expand Down
4 changes: 4 additions & 0 deletions data/js/server/data/weapontypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ function GetWeaponType( mChar, itemID )
case 0x48B3: //gargish axe - SA
weaponType = "TWOHND_AXES"; break;
// Default Maces
case 0x0DF2: // Wand
case 0x0DF3: // Wand
case 0x0DF4: // Wand
case 0x0DF5: // Wand
case 0x0FB4: //sledge hammer
case 0x0FB5: //sledge hammer
case 0x0F5C: //mace
Expand Down
11 changes: 10 additions & 1 deletion data/js/server/house/houseCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1522,8 +1522,17 @@ function DemolishHouse( pSocket, iMulti )
iMulti.RemoveTrashCont( itemInHouse );
itemInHouse.Delete();
}
else if( itemInHouse.movable == 2 ) // items placed as part of the house itself like forge/anvil in smithy
else if( itemInHouse.movable == 2 || itemInHouse.GetTag( "deed" )) // items placed as part of the house itself like forge/anvil in smithy or the addon deed
{
var addonDeed = itemInHouse.GetTag( "deed" );
if( addonDeed )
{
var newDeed = CreateDFNItem( pSocket, pSocket.currentChar, addonDeed, 1, "ITEM", true );
if( newDeed )
{
pSocket.SysMessage( GetDictionaryEntry( 1970, pSocket.language )); // A deed for the house add-on has been placed in your backpack.
}
}
itemInHouse.Delete();
}
else if( itemInHouse.isLockedDown )
Expand Down
95 changes: 76 additions & 19 deletions source/CPacketSend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ using namespace std::string_literals;
//| BYTE[2] unknown5 (0x0)
//| BYTE[4] unknown6 (0x0)
//|
//| Note: Only send once after login. It’s mandatory to send it once.
//| Note: Only send once after login. It’s mandatory to send it once.
//o------------------------------------------------------------------------------------------------o
void CPCharLocBody::Log( std::ostream &outStream, bool fullHeader )
{
Expand Down Expand Up @@ -1411,7 +1411,7 @@ CPPaperdoll &CPPaperdoll::operator = ( CChar &toCopy )
//|
//| Packet Build
//| BYTE cmd
//| BYTE type (0x00 – “It starts to rain”, 0x01 – “A fierce storm approaches.”, 0x02 – “It begins to snow”, 0x03 - “A storm is brewing.”, 0xFF – None (turns off sound effects), 0xFE (no effect?? Set temperature?)
//| BYTE type (0x00 – “It starts to rain”, 0x01 – “A fierce storm approaches.”, 0x02 – “It begins to snow”, 0x03 - “A storm is brewing.”, 0xFF – None (turns off sound effects), 0xFE (no effect?? Set temperature?)
//| BYTE num (number of weather effects on screen)
//| BYTE temperature
//|
Expand All @@ -1422,8 +1422,8 @@ CPPaperdoll &CPPaperdoll::operator = ( CChar &toCopy )
//| Note: Weather messages are only displayed when weather starts.
//| Note: Weather will end automatically after 6 minutes without any weather change packets.
//| Note: You can totally end weather (to display a new message) by teleporting.
//| I think it’s either the 0x78 or 0x20 messages that reset it, though I
//| haven’t checked to be sure (other possibilities, 0x4F or 0x4E)
//| I think it’s either the 0x78 or 0x20 messages that reset it, though I
//| haven’t checked to be sure (other possibilities, 0x4F or 0x4E)
//o------------------------------------------------------------------------------------------------o
void CPWeather::InternalReset( void )
{
Expand Down Expand Up @@ -2043,7 +2043,7 @@ void CPOpenGump::Serial( SERIAL toSet )
//| BYTE unknown (0x00)
//| BYTE click zLoc
//| BYTE[2] model # (if a static tile, 0 if a map/landscape tile)
//| Note: the model # shouldn’t be trusted.
//| Note: the model # shouldn’t be trusted.
//o------------------------------------------------------------------------------------------------o
CPTargetCursor::CPTargetCursor()
{
Expand Down Expand Up @@ -2601,7 +2601,7 @@ void CPStatWindow::TithingPoints( UI32 value )
//| 0x07 idle
//| 0x05 another character is online
//| "Another character from this account is currently online in this world.
//| You must either log in as that character or wait for it to time out.”
//| You must either log in as that character or wait for it to time out.”
//o------------------------------------------------------------------------------------------------o
void CPIdleWarning::InternalReset( void )
{
Expand Down Expand Up @@ -3107,12 +3107,12 @@ CPMultiPlacementView::CPMultiPlacementView( SERIAL toSet )
//| 0 neither T2A NOR LBR, equal to not sending it at all,
//| 1 is T2A, chatbutton,
//| 2 is LBR without chatbutton,
//| 3 is LBR with chatbutton…
//| 3 is LBR with chatbutton…
//| 8013 LBR + chatbutton + AOS enabled
//|
//| Note1: this message is send immediately after login.
//| Note2: on OSI servers this controls features OSI enables/disables via “upgrade codes.”
//| Note3: a 3 doesn’t seem to “hurt” older (NON LBR) clients.
//| Note2: on OSI servers this controls features OSI enables/disables via “upgrade codes.”
//| Note3: a 3 doesn’t seem to “hurt” older (NON LBR) clients.
//o------------------------------------------------------------------------------------------------o
CPEnableClientFeatures::CPEnableClientFeatures( CSocket *mSock )
{
Expand Down Expand Up @@ -6118,7 +6118,7 @@ void CPObjectInfo::Objects( CItem& mItem, CChar& mChar )
//| BYTE[2] Font
//| BYTE[4] Language
//| BYTE[30] Name
//| BYTE[?][2] Msg – Null Terminated (blockSize - 48)
//| BYTE[?][2] Msg – Null Terminated (blockSize - 48)
//|
//| The various types of text is as follows:
//| 0x00 - Normal
Expand Down Expand Up @@ -6294,7 +6294,7 @@ void CPUnicodeSpeech::GhostIt( [[maybe_unused]] UI08 method )
//| BYTE[2] Font
//| BYTE[4] Language
//| BYTE[30] Name
//| BYTE[?][2] Msg – Null Terminated (blockSize - 48)
//| BYTE[?][2] Msg – Null Terminated (blockSize - 48)
//|
//| The various types of text is as follows:
//| 0x00 - Normal
Expand Down Expand Up @@ -6572,7 +6572,7 @@ void CPSecureTrading::Name( const std::string& nameFollowing )
//o------------------------------------------------------------------------------------------------o
//| Purpose - Handles outgoing packet with server response to all names request
//o------------------------------------------------------------------------------------------------o
//| Notes - Packet: 0x98 (All-names “3D”)
//| Notes - Packet: 0x98 (All-names “3D”)
//| Size: Variable
//|
//| Packet Build
Expand All @@ -6588,7 +6588,7 @@ void CPSecureTrading::Name( const std::string& nameFollowing )
//| Client asks for name of object with ID x.
//| Server has to reply with ID + name
//| Client automatically knows names of items.
//| Hence it only asks only for NPC/Player names nearby, but shows bars of items plus NPC’s.
//| Hence it only asks only for NPC/Player names nearby, but shows bars of items plus NPC’s.
//|
//| Client request has 7 bytes, server-reply 37
//| Triggered by Crtl + Shift.
Expand Down Expand Up @@ -6641,7 +6641,7 @@ void CPAllNames3D::Object( CBaseObject& obj )
//| BYTE[var] null terminated line
//| Note:
//| server side: # of pages equals value given in 0x93/0xd4
//| EACH page # given. If empty: # lines: 0 + terminator (=3 0’s)
//| EACH page # given. If empty: # lines: 0 + terminator (=3 0’s)
//| client side: # of pages always 1. if 2 pages changed, client generates 2 packets.
//o------------------------------------------------------------------------------------------------o
void CPBookPage::IncLength( UI08 amount )
Expand Down Expand Up @@ -7009,7 +7009,7 @@ bool CPNewSpellBook::ClientCanReceive( CSocket *mSock )
//| BYTE[4] Serial
//| BYTE Damage // how much damage was done ?
//|
//| Note: displays damage above the npc/player’s head.
//| Note: displays damage above the npc/player’s head.
//o------------------------------------------------------------------------------------------------o
void CPDisplayDamage::InternalReset( void )
{
Expand Down Expand Up @@ -7473,6 +7473,28 @@ void CPToolTip::CopyItemData( CItem& cItem, size_t &totalStringLen, bool addAmou
tempEntry.ourText = oldstrutil::number( cItem.GetTempVar( CITV_MOREZ ));
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetManaLeech() > 0 )
{
tempEntry.stringNum = 1060427; // hit mana leech ~1_val~%
tempEntry.ourText = oldstrutil::number( cItem.GetManaLeech() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetStaminaLeech() > 0 )
{
tempEntry.stringNum = 1060430; // hit stamina leech ~1_val~%
tempEntry.ourText = oldstrutil::number( cItem.GetStaminaLeech() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetHealthLeech() > 0 )
{
tempEntry.stringNum = 1060422; // hit life leech ~1_val~%
tempEntry.ourText = oldstrutil::number( cItem.GetHealthLeech() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetType() == IT_SPELLCHANNELING )
{
tempEntry.stringNum = 1060482; // spell channeling
Expand Down Expand Up @@ -7665,6 +7687,41 @@ void CPToolTip::CopyItemData( CItem& cItem, size_t &totalStringLen, bool addAmou
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetHitChance() > 0 )
{
tempEntry.stringNum = 1060415; // hit chance increase ~1_val~%
tempEntry.ourText = oldstrutil::number( cItem.GetHitChance() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetDefenseChance() > 0 )
{
tempEntry.stringNum = 1060408; // defense chance increase ~1_val~%
tempEntry.ourText = oldstrutil::number( cItem.GetDefenseChance() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetHealthBonus() > 0 )
{
tempEntry.stringNum = 1060431; // hit point increase ~1_val~
tempEntry.ourText = oldstrutil::number( cItem.GetHealthBonus() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetStaminaBonus() > 0 )
{
tempEntry.stringNum = 1060484; // stamina increase ~1_val~
tempEntry.ourText = oldstrutil::number( cItem.GetStaminaBonus() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetManaBonus() > 0 )
{
tempEntry.stringNum = 1060439; // mana increase ~1_val~
tempEntry.ourText = oldstrutil::number( cItem.GetManaBonus() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetStrength() > 1 )
{
tempEntry.stringNum = 1061170; // strength requirement ~1_val~
Expand Down Expand Up @@ -8036,9 +8093,9 @@ bool CPSellList::CanSellItems( CChar &mChar, CChar &vendor )
//| BYTE[2] len
//| BYTE subcmd
//| BYTE[ len - 4 ] submessage
//| Submessage 0 – Display Bulletin Board
//| Submessage 0 – Display Bulletin Board
//| BYTE[4] Board serial
//| BYTE[22] board name (default is “bulletin board”, the rest nulls)
//| BYTE[22] board name (default is “bulletin board”, the rest nulls)
//| BYTE[4] unknown/ID?
//| BYTE[4] zero (0)
//o------------------------------------------------------------------------------------------------o
Expand Down Expand Up @@ -8118,7 +8175,7 @@ CPOpenMessageBoard::CPOpenMessageBoard( CSocket *mSock )
//| BYTE subjectLen
//| BYTE[subjectLen] subject (null terminated string)
//| BYTE timeLen
//| BYTE[timeLen] time (null terminated string with time of posting) (“Day 1 @ 11:28”)
//| BYTE[timeLen] time (null terminated string with time of posting) (“Day 1 @ 11:28”)
//o------------------------------------------------------------------------------------------------o
//| Subcommand: 0x2 (Message Summary)
//| Size: Variable
Expand All @@ -8135,7 +8192,7 @@ CPOpenMessageBoard::CPOpenMessageBoard( CSocket *mSock )
//| BYTE subjectLen
//| BYTE[subjectLen] subject (null terminated string)
//| BYTE timeLen
//| BYTE[timeLen] time (null terminated string with time of posting) (“Day 1 @ 11:28”)
//| BYTE[timeLen] time (null terminated string with time of posting) (“Day 1 @ 11:28”)
//| BYTE[5] Unknown (01 90 03 F7 00)
//| BYTE numlines
//| For each line:
Expand Down
Loading

0 comments on commit a3d9a00

Please sign in to comment.