From 80ef79d694f05d3f0a7a13f777ad41ff97c9e1d7 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Mon, 30 Oct 2023 19:27:30 -0500 Subject: [PATCH 1/3] Spell Channeling Property --- source/CPacketSend.cpp | 5 +++++ source/cPlayerAction.cpp | 3 +++ source/enums.h | 1 + source/magic.cpp | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/CPacketSend.cpp b/source/CPacketSend.cpp index 7d3963143..f01b2ff6b 100644 --- a/source/CPacketSend.cpp +++ b/source/CPacketSend.cpp @@ -7465,6 +7465,11 @@ void CPToolTip::CopyItemData( CItem& cItem, size_t &totalStringLen, bool addAmou tempEntry.ourText = oldstrutil::number( cItem.GetTempVar( CITV_MOREZ )); FinalizeData( tempEntry, totalStringLen ); } + if( cItem.GetType() == IT_SPELLCHANNELING ) + { + tempEntry.stringNum = 1060482; // spell channeling + FinalizeData( tempEntry, totalStringLen ); + } bool hideMagicItemStats = cwmWorldState->ServerData()->HideStatsForUnknownMagicItems(); if( !cwmWorldState->ServerData()->BasicTooltipsOnly() && ( !hideMagicItemStats || ( hideMagicItemStats && ( !cItem.GetName2().empty() && cItem.GetName2() == "#")))) diff --git a/source/cPlayerAction.cpp b/source/cPlayerAction.cpp index 9fc561431..d667a6598 100644 --- a/source/cPlayerAction.cpp +++ b/source/cPlayerAction.cpp @@ -2853,6 +2853,8 @@ bool HandleDoubleClickTypes( CSocket *mSock, CChar *mChar, CItem *iUsed, ItemTyp } } return true; + case IT_SPELLCHANNELING: // Spell Channeling + return true; case IT_MAP: // Map { CPMapMessage m1; @@ -3389,6 +3391,7 @@ void InitTagToItemType( void ) tagToItemType["CLOCK"] = IT_CLOCK; tagToItemType["SEXTANT"] = IT_SEXTANT; tagToItemType["HAIRDYE"] = IT_HAIRDYE; + tagToItemType["SPELLCHANNELING"] = IT_SPELLCHANNELING; } ItemTypes FindItemTypeFromTag( const std::string &strToFind ) diff --git a/source/enums.h b/source/enums.h index e38028176..75e8786ae 100644 --- a/source/enums.h +++ b/source/enums.h @@ -530,6 +530,7 @@ enum ItemTypes IT_ZEROKILLSGATE = 111, IT_PLANK = 117, IT_FIREWORKSWAND = 118, + IT_SPELLCHANNELING = 119, IT_ESCORTNPCSPAWNER = 125, IT_RENAMEDEED = 186, IT_LEATHERREPAIRTOOL = 190, diff --git a/source/magic.cpp b/source/magic.cpp index 9d4aa2dec..daf0bf3e4 100644 --- a/source/magic.cpp +++ b/source/magic.cpp @@ -4114,7 +4114,7 @@ bool CMagic::SelectSpell( CSocket *mSock, SI32 num ) { CItem *itemRHand = mChar->GetItemAtLayer( IL_RIGHTHAND ); CItem *itemLHand = mChar->GetItemAtLayer( IL_LEFTHAND ); - if( itemLHand != nullptr || ( itemRHand != nullptr && itemRHand->GetType() != IT_SPELLBOOK )) + if(( itemLHand != nullptr && itemLHand->GetType() != IT_SPELLCHANNELING ) || ( itemRHand != nullptr && itemRHand->GetType() != IT_SPELLBOOK && itemRHand->GetType() != IT_SPELLCHANNELING )) { mSock->SysMessage( 708 ); // You cannot cast with a weapon equipped. mChar->StopSpell(); From ab51fcd8418a393a66e7b9e762de4750e85603c3 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Fri, 10 Nov 2023 09:20:18 -0600 Subject: [PATCH 2/3] Update Js spells Update JS spells with spell channeling and runebook. --- data/js/item/runebook.js | 2 +- data/js/magic/clumsy.js | 2 +- data/js/magic/createfood.js | 2 +- data/js/magic/level1targ.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/js/item/runebook.js b/data/js/item/runebook.js index 813743c7e..6b1d1a5dd 100644 --- a/data/js/item/runebook.js +++ b/data/js/item/runebook.js @@ -690,7 +690,7 @@ function CastSpell( pSocket, pUser, spellNum, checkReagentReq ) // Is the player casting recall holding any objects? var itemRHand = pUser.FindItemLayer( 0x01 ); var itemLHand = pUser.FindItemLayer( 0x02 ); - if( ValidateObject( itemLHand ) || ( ValidateObject( itemRHand ) && itemRHand.type != 9 )) // Spellbook + if( ValidateObject( itemLHand ) && itemLHand.type != 119 || ( ValidateObject( itemRHand ) && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook //spell channeling { pSocket.SysMessage( GetDictionaryEntry( 708, pSocket.language )); // You cannot cast with a weapon equipped. return; diff --git a/data/js/magic/clumsy.js b/data/js/magic/clumsy.js index 0588924d2..4904bb2f2 100644 --- a/data/js/magic/clumsy.js +++ b/data/js/magic/clumsy.js @@ -110,7 +110,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { var itemRHand = mChar.FindItemLayer( 0x01 ); var itemLHand = mChar.FindItemLayer( 0x02 ); - if( itemLHand || ( itemRHand && itemRHand.type != 9 )) // Spellbook + if(( itemLHand && itemLHand.type != 119 ) || (itemRHand && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook { if( mSock != null ) { diff --git a/data/js/magic/createfood.js b/data/js/magic/createfood.js index 62e9f1dbe..b3226ef64 100644 --- a/data/js/magic/createfood.js +++ b/data/js/magic/createfood.js @@ -83,7 +83,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { var itemRHand = mChar.FindItemLayer( 0x01 ); var itemLHand = mChar.FindItemLayer( 0x02 ); - if( itemLHand || ( itemRHand && itemRHand.type != 9 )) // Spellbook + if(( itemLHand && itemLHand.type != 119 ) || ( itemRHand && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook { if( mSock ) { diff --git a/data/js/magic/level1targ.js b/data/js/magic/level1targ.js index 28d627698..2d958cd64 100644 --- a/data/js/magic/level1targ.js +++ b/data/js/magic/level1targ.js @@ -67,7 +67,7 @@ function ItemInHandCheck( mChar, mSock, spellType ) { var itemRHand = mChar.FindItemLayer( 0x01 ); var itemLHand = mChar.FindItemLayer( 0x02 ); - if( itemLHand || ( itemRHand && itemRHand.type != 9 )) // Spellbook + if(( itemLHand && itemLHand.type != 119 ) || ( itemRHand && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook { if( mSock ) { From 24e1c5ea6aa0ac5262d7c6e67fc2406033fa2037 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Sat, 11 Nov 2023 11:44:58 -0600 Subject: [PATCH 3/3] Spellbook line changes --- data/js/item/runebook.js | 2 +- data/js/magic/clumsy.js | 2 +- data/js/magic/createfood.js | 2 +- data/js/magic/level1targ.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/js/item/runebook.js b/data/js/item/runebook.js index 6b1d1a5dd..1716c9730 100644 --- a/data/js/item/runebook.js +++ b/data/js/item/runebook.js @@ -690,7 +690,7 @@ function CastSpell( pSocket, pUser, spellNum, checkReagentReq ) // Is the player casting recall holding any objects? var itemRHand = pUser.FindItemLayer( 0x01 ); var itemLHand = pUser.FindItemLayer( 0x02 ); - if( ValidateObject( itemLHand ) && itemLHand.type != 119 || ( ValidateObject( itemRHand ) && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook //spell channeling + if( ValidateObject( itemLHand ) && itemLHand.type != 119 || ( ValidateObject( itemRHand ) && ( itemRHand.type != 9 || itemRHand.type != 119 ))) // Spellbook //spell channeling { pSocket.SysMessage( GetDictionaryEntry( 708, pSocket.language )); // You cannot cast with a weapon equipped. return; diff --git a/data/js/magic/clumsy.js b/data/js/magic/clumsy.js index 4904bb2f2..5eb21c8cb 100644 --- a/data/js/magic/clumsy.js +++ b/data/js/magic/clumsy.js @@ -110,7 +110,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { var itemRHand = mChar.FindItemLayer( 0x01 ); var itemLHand = mChar.FindItemLayer( 0x02 ); - if(( itemLHand && itemLHand.type != 119 ) || (itemRHand && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook + if(( itemLHand && itemLHand.type != 119 ) || ( itemRHand && ( itemRHand.type != 9 || itemRHand.type != 119 ))) // Spellbook { if( mSock != null ) { diff --git a/data/js/magic/createfood.js b/data/js/magic/createfood.js index b3226ef64..5dcfa06eb 100644 --- a/data/js/magic/createfood.js +++ b/data/js/magic/createfood.js @@ -83,7 +83,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { var itemRHand = mChar.FindItemLayer( 0x01 ); var itemLHand = mChar.FindItemLayer( 0x02 ); - if(( itemLHand && itemLHand.type != 119 ) || ( itemRHand && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook + if(( itemLHand && itemLHand.type != 119 ) || ( itemRHand && ( itemRHand.type != 9 || itemRHand.type != 119 ))) // Spellbook { if( mSock ) { diff --git a/data/js/magic/level1targ.js b/data/js/magic/level1targ.js index 2d958cd64..e33beacc9 100644 --- a/data/js/magic/level1targ.js +++ b/data/js/magic/level1targ.js @@ -67,7 +67,7 @@ function ItemInHandCheck( mChar, mSock, spellType ) { var itemRHand = mChar.FindItemLayer( 0x01 ); var itemLHand = mChar.FindItemLayer( 0x02 ); - if(( itemLHand && itemLHand.type != 119 ) || ( itemRHand && itemRHand.type != 9 || itemRHand.type != 119 )) // Spellbook + if(( itemLHand && itemLHand.type != 119 ) || ( itemRHand && ( itemRHand.type != 9 || itemRHand.type != 119 ))) // Spellbook { if( mSock ) {