From dcfd8baf88b94a6f9d71686cf4faa3953228e567 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:40:39 -0500 Subject: [PATCH 1/8] Small adjustments --- data/js/magic/clumsy.js | 15 ++++++++------- data/js/magic/createfood.js | 29 ++++++++++++++++------------- data/js/magic/level1targ.js | 26 +++++++++++++------------- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/data/js/magic/clumsy.js b/data/js/magic/clumsy.js index 0460b360e..37833e1a6 100644 --- a/data/js/magic/clumsy.js +++ b/data/js/magic/clumsy.js @@ -106,7 +106,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) // The following loop checks to see if any item is currently equipped (if not a GM) if( mChar.commandlevel < 2 ) { - if( spellType != 2 ) + if( spellType != 2 ) { var itemRHand = mChar.FindItemLayer( 0x01 ); var itemLHand = mChar.FindItemLayer( 0x02 ); @@ -228,6 +228,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) if( !GetServerSetting( "CastSpellsWhileMOving" )) { mChar.frozen = true; + mChar.Refresh(); } } else @@ -257,7 +258,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) mChar.TextMessage( tempString ); mChar.isCasting = true; - mChar.StartTimer( delay, spellNum, true ); + mChar.StartTimer( delay * 1000, spellNum, true ); return true; } @@ -266,6 +267,7 @@ function onTimer( mChar, timerID ) { mChar.isCasting = false; mChar.frozen = false; + mChar.Refresh(); if( mChar.npc ) { @@ -406,7 +408,7 @@ function onSpellSuccess( mSock, mChar, ourTarg ) } // Function to check if an equipped item allows casting -function isSpellCastingAllowed( item ) +function isSpellCastingAllowed( item ) { return item != null && ( item.type == 9 || item.type == 119 ); // Assuming type 9 is spellbook, and type 119 is spell channeling item } @@ -414,16 +416,15 @@ function isSpellCastingAllowed( item ) // Function to handle items function handleItem( itemLHand, itemRHand, mChar ) { - const UnEquipEnabled = GetServerSetting("AutoUnequippedCasting"); + const UnEquipEnabled = GetServerSetting( "AutoUnequippedCasting" ); var lHandBlocks = false; // Default to false var rHandBlocks = false; // Default to false - if( UnEquipEnabled && itemLHand != null && !isSpellCastingAllowed( itemLHand )) + if( UnEquipEnabled && itemLHand != null && !isSpellCastingAllowed( itemLHand )) { // Allow casting if item is spell channeling or type 9 spell book itemLHand.container = mChar.pack; lHandBlocks = true; // Set to true if item is blocking } - - if( UnEquipEnabled && itemRHand != null && !isSpellCastingAllowed( itemRHand )) + if( UnEquipEnabled && itemRHand != null && !isSpellCastingAllowed( itemRHand )) { // Allow casting if item is spell channeling or type 9 spell book itemRHand.container = mChar.pack; rHandBlocks = true; // Set to true if item is blocking diff --git a/data/js/magic/createfood.js b/data/js/magic/createfood.js index 8952e0944..7ddef7ffb 100644 --- a/data/js/magic/createfood.js +++ b/data/js/magic/createfood.js @@ -6,11 +6,11 @@ function SpellRegistration() function onSpellCast( mSock, mChar, directCast, spellNum ) { // Are we recovering from another spell that was just cast - if( mChar.GetTimer( Timer.SPELLRECOVERYTIME ) != 0 ) + if( mChar.GetTimer( Timer.SPELLRECOVERYTIME ) != 0 ) { - if( mChar.GetTimer( Timer.SPELLRECOVERYTIME ) > GetCurrentClock() ) + if( mChar.GetTimer( Timer.SPELLRECOVERYTIME ) > GetCurrentClock() ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 1638, mSock.language )); // You must wait a little while before casting } @@ -23,7 +23,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { if( mChar.isCasting ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 762, mSock.language )); // You are already casting a spell. } @@ -31,7 +31,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) } else if( mChar.GetTimer( Timer.SPELLTIME ) > GetCurrentClock() ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 1638, mSock.language )); // You must wait a little while before casting } @@ -53,7 +53,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) // Disallow spellcasting if character is in jail if( mChar.isJailed && mChar.commandlevel < 2 ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 704, mSock.language )); // You are in jail and cannot cast spells! } @@ -66,7 +66,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) // Is the spell actually enabled? if( !mSpell.enabled ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 707, mSock.language )); // That spell is currently not enabled. } @@ -120,7 +120,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) } // Break character's concentration (affects Meditation skill) - if( mSock ) + if( mSock != null ) { mChar.BreakConcentration( mSock ); } @@ -133,7 +133,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { if( mSpell.mana > mChar.mana ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 696, mSock.language )); // You have insufficient mana to cast that spell. } @@ -144,7 +144,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) } if( mSpell.stamina > mChar.stamina ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 697, mSock.language )); // You have insufficient stamina to cast that spell. } @@ -155,7 +155,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) } if( mSpell.health >= mChar.health ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 698, mSock.language )); // You have insufficient health to cast that spell. } @@ -177,6 +177,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) if( !GetServerSetting( "CastSpellsWhileMoving" )) { mChar.frozen = true; + mChar.Refresh(); } } else @@ -209,6 +210,8 @@ function onTimer( mChar, timerID ) { mChar.isCasting = false; mChar.frozen = false; + mChar.Refresh(); + var ourTarg = mChar; if( mChar.npc ) @@ -218,7 +221,7 @@ function onTimer( mChar, timerID ) else { var mSock = mChar.socket; - if( mSock ) + if( mSock != null ) { mChar.SetTimer( Timer.SPELLRECOVERYTIME, Spells[mChar.spellCast].recoveryDelay ); onSpellSuccess( mSock, mChar, ourTarg ); @@ -310,7 +313,7 @@ function onSpellSuccess( mSock, mChar, ourTarg ) ); var rndNum = RandomNumber( 0, foodItems.length - 1 ); - if( mSock ) + if( mSock != null ) { CreateDFNItem( mSock, mChar, foodItems[rndNum], 1, "ITEM", true ); } diff --git a/data/js/magic/level1targ.js b/data/js/magic/level1targ.js index 83d825df3..efe9a74d5 100644 --- a/data/js/magic/level1targ.js +++ b/data/js/magic/level1targ.js @@ -105,7 +105,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { if( mChar.GetTimer( Timer.SPELLRECOVERYTIME ) > GetCurrentClock() ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 1638, mSock.language )); // You must wait a little while before casting } @@ -135,7 +135,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) var ourRegion = mChar.region; if(( spellNum == 45 && ourRegion.canMark ) || ( spellNum == 52 && !ourRegion.canGate() ) || ( spellNum == 32 && !ourRegion.canRecall() )) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 705, mSock.language )); // This is not allowed here. } @@ -149,7 +149,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { if( ourRegion.isSafeZone ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 1799, mSock.language )); // Hostile actions are not permitted in this safe area. } @@ -161,7 +161,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) if( !ourRegion.canCastAggressive ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 706, mSock.language )); // This is not allowed in town. } @@ -183,7 +183,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) mChar.visible = 0; } - if( mSock ) + if( mSock != null ) { mChar.BreakConcentration( mSock ); } @@ -195,7 +195,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) { if( mSpell.mana > mChar.mana ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 696, mSock.language )); // You have insufficient mana to cast that spell. } @@ -206,7 +206,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) } if( mSpell.stamina > mChar.stamina ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 697, mSock.language )); // You have insufficient stamina to cast that spell. } @@ -217,7 +217,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) } if( mSpell.health >= mChar.health ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 698, mSock.language )); // You have insufficient health to cast that spell. } @@ -293,7 +293,7 @@ function onTimer( mChar, timerID ) else { var mSock = mChar.socket; - if( mSock ) + if( mSock != null ) { var cursorType = 0; var spellNum = mChar.spellCast; @@ -430,7 +430,7 @@ function onSpellSuccess( mSock, mChar, ourTarg, spellID ) if( !mChar.InRange( ourTarg, 10 ) ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 712, mSock.language )); // You can't cast on someone that far away! } @@ -445,7 +445,7 @@ function onSpellSuccess( mSock, mChar, ourTarg, spellID ) { if( targRegion.isSafeZone ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 1799, mSock.language )); // Hostile actions are not permitted in this safe area. } @@ -453,7 +453,7 @@ function onSpellSuccess( mSock, mChar, ourTarg, spellID ) } if( !targRegion.canCastAggressive ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 709, mSock.language )); // You can't cast in town! } @@ -461,7 +461,7 @@ function onSpellSuccess( mSock, mChar, ourTarg, spellID ) } if( !ourTarg.vulnerable || ourTarg.aiType == 17 ) { - if( mSock ) + if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 713, mSock.language )); // They are invulnerable merchants! } From 332dc974e7de2b49754d0318d1ce95d56df46ac4 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:09:07 -0500 Subject: [PATCH 2/8] Missing AOS Clothing --- .../items/gear/clothing/aos_clothing.dfn | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 data/dfndata/items/gear/clothing/aos_clothing.dfn diff --git a/data/dfndata/items/gear/clothing/aos_clothing.dfn b/data/dfndata/items/gear/clothing/aos_clothing.dfn new file mode 100644 index 000000000..0b43d075c --- /dev/null +++ b/data/dfndata/items/gear/clothing/aos_clothing.dfn @@ -0,0 +1,150 @@ +[0x2684] +{ +get=base_clothing +name=hooded shroud of shadows +id=0x2684 +colour=0x455 +newbie +weight=300 +value=68 34 +layer=0x16 +def=7 +hp=50 +orgin=aos +} + +[0x2683] +{ +get=0x2684 +id=0x2683 +} + +[hoodedshroudofshadows] +{ +get=0x2684 0x2683 +} + +[0x2310] +{ +get=base_clothing +name=formal shirt +id=0x2310 +weight=100 +value=55 27 +layer=0x5 +str=1 +hp=50 +orgin=aos +} + +[0x230F] +{ +get=0x2310 +id=0x230F +} + +[formalshirt] +{ +get=0x2310 0x230F +} + +[0x2307] +{ +get=base_clothing +name=fur boots +id=0x2307 +weight=300 +value=45 22 +layer=0x03 +def=6 +hp=30 +str=10 +dyeable=1 +decay=1 +good=19 +restock=10 +orgin=aos +} + +[0x2308] +{ +get=0x2307 +id=0x2308 +} + +[furboots] +{ +get=0x2307 0x2308 +} + +[0x230A] +{ +get=base_clothing +name=fur cap +id=0x230A +weight=500 +value=43 21 +layer=0x14 +def=5 +hp=50 +orgin=aos +} + +[0x2309] +{ +get=0x230A +id=0x2309 +} + +[furcap] +{ +get=0x230A 0x2309 +} + +[0x230C] +{ +get=base_clothing +name=fur sarong +id=0x230C +weight=200 +value=31 15 +layer=0x17 +def=3 +hp=50 +orgin=aos +} + +[0x230B] +{ +get=0x230C +id=0x230B +} + +[fursarong] +{ +get=0x230C 0x230B +} + +[0x230E] +{ +get=base_clothing +name=gilded dress +id=0x230E +weight=200 +value=56 28 +layer=0x11 +def=4 +hp=50 +orgin=aos +} + +[0x230D] +{ +get=0x230E +id=0x230D +} + +[gildeddress] +{ +get=0x230E 0x230D +} \ No newline at end of file From 74bffa2eabbebaa0ae5edb7bf7ce8b0200894fca Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Wed, 1 May 2024 00:07:11 -0500 Subject: [PATCH 3/8] Update level1targ.js --- data/js/magic/level1targ.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/js/magic/level1targ.js b/data/js/magic/level1targ.js index efe9a74d5..658cc306f 100644 --- a/data/js/magic/level1targ.js +++ b/data/js/magic/level1targ.js @@ -238,6 +238,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) if( !GetServerSetting( "CastSpellsWhileMoving" )) { mChar.frozen = true; + mChar.Refresh(); } } else @@ -281,6 +282,7 @@ function onTimer( mChar, timerID ) { mChar.isCasting = false; mChar.frozen = false; + mChar.Refresh(); if( mChar.npc ) { @@ -342,6 +344,7 @@ function onCallback0( mSock, ourTarg ) mChar.isCasting = false; mChar.spellCast = -1; mChar.frozen = false; + mChar.Refresh(); } } @@ -573,6 +576,7 @@ function MagicDamage( p, amount, attacker, mSock, element ) if( p.frozen && p.dexterity > 0 ) { p.frozen = false; + p.Refresh(); if( mSock != null ) { mSock.SysMessage( GetDictionaryEntry( 700, mSock.language )); // You are no longer frozen. From 62d11aedb9b7e6f1933f6ee130676dd0e2fe32bb Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Wed, 1 May 2024 03:17:32 -0500 Subject: [PATCH 4/8] fixed some more errors --- data/js/magic/clumsy.js | 38 ++++++++++++++++++---------- data/js/magic/createfood.js | 49 ++++++++++++++++++++++++++----------- data/js/magic/level1targ.js | 37 ++++++++++++++++++---------- 3 files changed, 84 insertions(+), 40 deletions(-) diff --git a/data/js/magic/clumsy.js b/data/js/magic/clumsy.js index 37833e1a6..ab9b262ff 100644 --- a/data/js/magic/clumsy.js +++ b/data/js/magic/clumsy.js @@ -114,9 +114,9 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) var rHandBlocks = false; // Evaluate blocking for left and right hand items - if( isSpellCastingAllowed( itemRHand ) || isSpellCastingAllowed( itemLHand )) + if( !isSpellCastingAllowed( itemRHand ) || !isSpellCastingAllowed( itemLHand )) { - var result = handleItem( itemLHand, itemRHand, mChar ); + var result = AutoUnequipAttempt( itemLHand, itemRHand, mChar ); lHandBlocks = result.lHandBlocks; rHandBlocks = result.rHandBlocks; } @@ -137,7 +137,6 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) return true; } } - return false; } if( mChar.visible == 1 || mChar.visible == 2 ) @@ -414,20 +413,33 @@ function isSpellCastingAllowed( item ) } // Function to handle items -function handleItem( itemLHand, itemRHand, mChar ) +function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) { - const UnEquipEnabled = GetServerSetting( "AutoUnequippedCasting" ); + const autoUnequip = GetServerSetting( "AutoUnequippedCasting" ); var lHandBlocks = false; // Default to false var rHandBlocks = false; // Default to false - if( UnEquipEnabled && itemLHand != null && !isSpellCastingAllowed( itemLHand )) - { // Allow casting if item is spell channeling or type 9 spell book - itemLHand.container = mChar.pack; - lHandBlocks = true; // Set to true if item is blocking + if( itemLHand != null ) + { + if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) + { + itemLHand.container = mChar.pack; + } + else + { + lHandBlocks = true; // Set to true if item is blocking + } } - if( UnEquipEnabled && itemRHand != null && !isSpellCastingAllowed( itemRHand )) - { // Allow casting if item is spell channeling or type 9 spell book - itemRHand.container = mChar.pack; - rHandBlocks = true; // Set to true if item is blocking + + if( itemRHand != null ) + { + if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) + { + itemRHand.container = mChar.pack; + } + else + { + rHandBlocks = true; // Set to true if item is blocking + } } return { lHandBlocks: lHandBlocks, rHandBlocks: rHandBlocks }; } diff --git a/data/js/magic/createfood.js b/data/js/magic/createfood.js index 7ddef7ffb..0194f3d6e 100644 --- a/data/js/magic/createfood.js +++ b/data/js/magic/createfood.js @@ -87,9 +87,9 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) var rHandBlocks = false; // Evaluate blocking for left and right hand items - if( isSpellCastingAllowed( itemRHand ) || isSpellCastingAllowed( itemLHand )) + if( !isSpellCastingAllowed( itemRHand ) || !isSpellCastingAllowed( itemLHand )) { - var result = handleItem( itemLHand, itemRHand, mChar ); + var result = AutoUnequipAttempt( itemLHand, itemRHand, mChar ); lHandBlocks = result.lHandBlocks; rHandBlocks = result.rHandBlocks; } @@ -110,7 +110,6 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) return true; } } - return false; } // Turn character visible @@ -128,6 +127,16 @@ function onSpellCast( mSock, mChar, directCast, spellNum ) // If player commandlevel is below GM-level, check for reagents if( mChar.commandlevel < 2 ) { + //Check for enough reagents + // type == 0 -> SpellBook + if( spellType == 0 && !TriggerEvent( 6004, "CheckReagents", mChar, mSpell )) + { + mChar.SetTimer( Timer.SPELLTIME, 0 ); + mChar.isCasting = false; + mChar.spellCast = -1; + return true; + } + // type == 2 - Wands if( spellType != 2 ) { @@ -307,7 +316,7 @@ function onSpellSuccess( mSock, mChar, ourTarg ) ourTarg.SpellStaticEffect( mSpell ); // List of foods to randomize between when casting the spell - foodItems = new Array ( + var foodItems = new Array ( "0x09d0", "0x09b7", "0x09f2", "0x097b", "0x0d1a", "0x09c9", "0x09eb", "0x09d2", "0x09c0", "0x097c" ); @@ -330,21 +339,33 @@ function isSpellCastingAllowed( item ) } // Function to handle items -function handleItem( itemLHand, itemRHand, mChar ) +function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) { - const UnEquipEnabled = GetServerSetting( "AutoUnequippedCasting" ); + const autoUnequip = GetServerSetting( "AutoUnequippedCasting" ); var lHandBlocks = false; // Default to false var rHandBlocks = false; // Default to false - if(UnEquipEnabled && itemLHand != null && !isSpellCastingAllowed( itemLHand )) - { // Allow casting if item is spell channeling or type 9 spell book - itemLHand.container = mChar.pack; - lHandBlocks = true; // Set to true if item is blocking + if( itemLHand != null ) + { + if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) + { + itemLHand.container = mChar.pack; + } + else + { + lHandBlocks = true; // Set to true if item is blocking + } } - if( UnEquipEnabled && itemRHand != null && !isSpellCastingAllowed( itemRHand )) - { // Allow casting if item is spell channeling or type 9 spell book - itemRHand.container = mChar.pack; - rHandBlocks = true; // Set to true if item is blocking + if( itemRHand != null ) + { + if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) + { + itemRHand.container = mChar.pack; + } + else + { + rHandBlocks = true; // Set to true if item is blocking + } } return { lHandBlocks: lHandBlocks, rHandBlocks: rHandBlocks }; } diff --git a/data/js/magic/level1targ.js b/data/js/magic/level1targ.js index 658cc306f..cbd457e27 100644 --- a/data/js/magic/level1targ.js +++ b/data/js/magic/level1targ.js @@ -71,9 +71,9 @@ function ItemInHandCheck( mChar, mSock, spellType ) var rHandBlocks = false; // Evaluate blocking for left and right hand items - if( isSpellCastingAllowed( itemRHand ) || isSpellCastingAllowed( itemLHand )) + if( !isSpellCastingAllowed( itemRHand ) || !isSpellCastingAllowed( itemLHand )) { - var result = handleItem( itemLHand, itemRHand, mChar ); + var result = AutoUnequipAttempt( itemLHand, itemRHand, mChar ); lHandBlocks = result.lHandBlocks; rHandBlocks = result.rHandBlocks; } @@ -94,7 +94,6 @@ function ItemInHandCheck( mChar, mSock, spellType ) return false; } } - return true; } } @@ -661,21 +660,33 @@ function isSpellCastingAllowed( item ) } // Function to handle items -function handleItem( itemLHand, itemRHand, mChar ) +function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) { - const UnEquipEnabled = GetServerSetting( "AutoUnequippedCasting" ); + const autoUnequip = GetServerSetting( "AutoUnequippedCasting" ); var lHandBlocks = false; // Default to false var rHandBlocks = false; // Default to false - if( UnEquipEnabled && itemLHand != null && !isSpellCastingAllowed( itemLHand )) - { // Allow casting if item is spell channeling or type 9 spell book - itemLHand.container = mChar.pack; - lHandBlocks = true; // Set to true if item is blocking + if( itemLHand != null ) + { + if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) + { + itemLHand.container = mChar.pack; + } + else + { + lHandBlocks = true; // Set to true if item is blocking + } } - if( UnEquipEnabled && itemRHand != null && !isSpellCastingAllowed( itemRHand )) - { // Allow casting if item is spell channeling or type 9 spell book - itemRHand.container = mChar.pack; - rHandBlocks = true; // Set to true if item is blocking + if( itemRHand != null ) + { + if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) + { + itemRHand.container = mChar.pack; + } + else + { + rHandBlocks = true; // Set to true if item is blocking + } } return { lHandBlocks: lHandBlocks, rHandBlocks: rHandBlocks }; } From 836560efad6ce822beb421497e8f5c2c9f991a44 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Wed, 1 May 2024 03:22:04 -0500 Subject: [PATCH 5/8] Update Changelog.txt --- source/Changelog.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/Changelog.txt b/source/Changelog.txt index 1d779c15f..3eb0b43b4 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,3 +1,7 @@ +1/05/2024 - Dragon Slayer/Xuri + Fixed AutoUnequipAttempt function in clumsy.js, createfood.js level1target.js, will no longer fail on casting and return to hardcode. + Fixed createfood to check for reagents on cast. + Fixed many places missing proper null checks and refresh checks in magic js scripts. 27/04/2024 - Dragon Slayer/Xuri Fixed an issue where non-corpse containers - including treasure chests in dungeons - would decay and leave all their contents on the ground. Converted LOOTDECAYSWITHCORPSE ini setting to two new settings, one for player corpses, one for NPC corpses: From 695f5981720aa56ffab79885052c62c91bb5005d Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Wed, 1 May 2024 03:51:12 -0500 Subject: [PATCH 6/8] adjustment --- data/js/magic/clumsy.js | 4 ++-- data/js/magic/createfood.js | 4 ++-- data/js/magic/level1targ.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/js/magic/clumsy.js b/data/js/magic/clumsy.js index ab9b262ff..fe41ffd92 100644 --- a/data/js/magic/clumsy.js +++ b/data/js/magic/clumsy.js @@ -418,7 +418,7 @@ function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) const autoUnequip = GetServerSetting( "AutoUnequippedCasting" ); var lHandBlocks = false; // Default to false var rHandBlocks = false; // Default to false - if( itemLHand != null ) + if( itemLHand != null && !isSpellCastingAllowed( itemLHand )) { if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) { @@ -430,7 +430,7 @@ function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) } } - if( itemRHand != null ) + if( itemRHand != null && !isSpellCastingAllowed( itemRHand )) { if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) { diff --git a/data/js/magic/createfood.js b/data/js/magic/createfood.js index 0194f3d6e..1fb11cebc 100644 --- a/data/js/magic/createfood.js +++ b/data/js/magic/createfood.js @@ -344,7 +344,7 @@ function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) const autoUnequip = GetServerSetting( "AutoUnequippedCasting" ); var lHandBlocks = false; // Default to false var rHandBlocks = false; // Default to false - if( itemLHand != null ) + if( itemLHand != null && !isSpellCastingAllowed( itemLHand )) { if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) { @@ -356,7 +356,7 @@ function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) } } - if( itemRHand != null ) + if( itemRHand != null && !isSpellCastingAllowed( itemRHand )) { if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) { diff --git a/data/js/magic/level1targ.js b/data/js/magic/level1targ.js index cbd457e27..a79f92a3c 100644 --- a/data/js/magic/level1targ.js +++ b/data/js/magic/level1targ.js @@ -665,7 +665,7 @@ function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) const autoUnequip = GetServerSetting( "AutoUnequippedCasting" ); var lHandBlocks = false; // Default to false var rHandBlocks = false; // Default to false - if( itemLHand != null ) + if( itemLHand != null && !isSpellCastingAllowed( itemLHand )) { if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) { @@ -677,7 +677,7 @@ function AutoUnequipAttempt( itemLHand, itemRHand, mChar ) } } - if( itemRHand != null ) + if( itemRHand != null && !isSpellCastingAllowed( itemRHand )) { if( autoUnequip && mChar.pack.totalItemCount < mChar.pack.maxItems ) { From cf8ad26dfedc453869fe6913b25522af98eab9b8 Mon Sep 17 00:00:00 2001 From: Geir Ove Alnes Date: Sun, 26 May 2024 12:05:05 +0800 Subject: [PATCH 7/8] Update Changelog.txt --- source/Changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Changelog.txt b/source/Changelog.txt index 3eb0b43b4..f64afbc32 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -2,6 +2,7 @@ Fixed AutoUnequipAttempt function in clumsy.js, createfood.js level1target.js, will no longer fail on casting and return to hardcode. Fixed createfood to check for reagents on cast. Fixed many places missing proper null checks and refresh checks in magic js scripts. + 27/04/2024 - Dragon Slayer/Xuri Fixed an issue where non-corpse containers - including treasure chests in dungeons - would decay and leave all their contents on the ground. Converted LOOTDECAYSWITHCORPSE ini setting to two new settings, one for player corpses, one for NPC corpses: From f6fc6f8eb79d7227c54cd00675dc8be06e0dd5fe Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Fri, 3 Jan 2025 23:53:51 -0600 Subject: [PATCH 8/8] ubuntu string fix --- source/StringUtility.cpp | 1 + source/StringUtility.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/source/StringUtility.cpp b/source/StringUtility.cpp index 6adb6c46c..54a379019 100644 --- a/source/StringUtility.cpp +++ b/source/StringUtility.cpp @@ -5,6 +5,7 @@ // #include "StringUtility.hpp" +#include #include #include #include diff --git a/source/StringUtility.hpp b/source/StringUtility.hpp index 2be725277..2cb94fe7a 100644 --- a/source/StringUtility.hpp +++ b/source/StringUtility.hpp @@ -7,6 +7,7 @@ #ifndef StringUtility_hpp #define StringUtility_hpp +#include #include #include #include