Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Added Features:

Implemented Travel Restriction (js file): Introduced a new JavaScript file to manage travel restrictions within the game. This feature ensures that players adhere to specific limitations when moving between regions.

Reagent Check (js file): Added a JavaScript file to perform reagent checks during gameplay. This functionality enhances the game's mechanics by validating the availability and correct usage of reagents for specific actions.

Check Teleport (js file): Introduced a JavaScript file responsible for validating teleportation mechanics. This addition ensures that teleportation features operate smoothly and efficiently within the game environment.

Updated Dictionaries: Enhanced game dictionaries to improve data accuracy and provide a more seamless gaming experience. The updates include refined descriptions, optimized search functionalities, and improved data retrieval.

Acknowledgments:

Extended thanks to Xuri: Gratitude expressed to Xuri for contributions to the core C++ functionality. Specifically, Xuri's work on the core for GetRegionXY has significantly improved the overall performance and reliability of the game.
Bug Fixes:

[If applicable] Fixed Magic Weapons Damage Calculation (js Magic_Items): Resolved an issue where the damage calculation for Magic Weapons was not set correctly during generation. This fix ensures that Magic Weapons now accurately calculate damage based on the specified settings.
These changes aim to enhance the overall gaming experience, improve system functionalities, and address any existing issues reported by the community.
  • Loading branch information
DragonSlayer62 committed Dec 11, 2023
1 parent 89bf0e1 commit 4c533db
Show file tree
Hide file tree
Showing 19 changed files with 201 additions and 159 deletions.
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.CSY
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,9 @@
15058=Síla
15059=Hbitost
15060=Inteligence
15990=Nemáte povoleno tam cestovat.
15991=Nemůžete se odtud teleportovat do cíle.
15991=Nemůžete zde označit runu.
// 17000 - Nabídka nápovědy pro střepy
17000=Nabídka nápovědy
17001=Obecné otázky ke hře
Expand Down
4 changes: 4 additions & 0 deletions data/dictionaries/dictionary.ENG
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,10 @@
15058=Strength
15059=Dexterity
15060=Intelligence
//15990 Travel Restrictions
15990=You are not allowed to travel there.
15991=You cannot teleport from here to the destination.
15991=You can not mark a rune here.
// 17000 - Shard Help Menu
17000=Help Menu
17001=General Gameplay Questions
Expand Down
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.FRE
Original file line number Diff line number Diff line change
Expand Up @@ -5036,6 +5036,9 @@
15058=Force
15059=Dexterité
15060=Intelligence
15990=Vous n'êtes pas autorisé à y voyager.
15991=Vous ne pouvez pas vous téléporter d'ici vers la destination.
15991=Vous ne pouvez pas marquer une rune ici.
// 17000 - Shard Help Menu
17000=Menu Aide
17001=Questions générales sur le jeu
Expand Down
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.GER
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,9 @@
15058=Stärke
15059=Geschicklichkeit
15060=Intelligenz
15990=Sie dürfen nicht dorthin reisen.
15991=Sie können sich nicht von hier zum Ziel teleportieren.
15991=Sie können hier keine Rune markieren.
// 17000 - Shard Help Menu
17000=Menü "Hilfe
17001=Allgemeine Fragen zum Gameplay
Expand Down
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.ITA
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,9 @@
15058=Forza
15059=Destrezza
15060=Intelligenza
15990=Non ti è consentito viaggiare lì.
15991=Non puoi teletrasportarti da qui alla destinazione.
15991=Non puoi contrassegnare una runa qui.
// 17000 - Shard Help Menu
17000=Menu Aiuto
17001=Domande generali sul gioco
Expand Down
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.POL
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,9 @@
15058=Wytrzymałość
15059=Zręczność
15060=Inteligencja
15990=Nie wolno ci tam podróżować.
15991=Nie możesz się stąd teleportować do miejsca docelowego.
15991=Nie możesz tutaj zaznaczyć runy.
// 17000 - Shard Help Menu
17000=Menu Pomoc
17001=Ogólne pytania dotyczące rozgrywki
Expand Down
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.PTG
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,9 @@
15058=Força
15059=Dexteridade
15060=Intelligence
15990=Você não tem permissão para viajar para lá.
15991=Você não pode se teletransportar daqui para o destino.
15991=Você não pode marcar uma runa aqui.
// 17000 - Shard Help Menu
17000=Menu Ajuda
17001=Questões gerais de jogabilidade
Expand Down
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.SPA
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,9 @@
15058=Fuerza
15059=Destreza
15060=Inteligencia
15990=No tienes permitido viajar allí.
15991=No puedes teletransportarte desde aquí al destino.
15991=No puedes marcar una runa aquí.
// 17000 - Shard Help Menu
17000=Menú de ayuda
17001=Preguntas generales sobre el juego
Expand Down
3 changes: 3 additions & 0 deletions data/dictionaries/dictionary.ZRO
Original file line number Diff line number Diff line change
Expand Up @@ -4836,6 +4836,9 @@
15058=Strength
15059=Dexterity
15060=Intelligence
15990=You are not allowed to travel there.
15991=You cannot teleport from here to the destination.
15991=You can not mark a rune here.
// 17000 - Shard Help Menu
17000=Help Menu
17001=General Gameplay Questions
Expand Down
16 changes: 1 addition & 15 deletions data/js/item/moongate.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,21 +338,7 @@ function onGumpPress( srcSock, myButton )
return;
}

// Teleport player's followers
var followerList = srcChar.GetFollowerList();
for( var i = 0; i < followerList.length; i++ )
{
var tempFollower = followerList[i];
// Only teleport pet if set to follow and within range
if( ValidateObject( tempFollower ) && tempFollower.wandertype == 1 && tempFollower.InRange( srcChar, 24 ))
{
tempFollower.Teleport( targetLocation[0], targetLocation[1], targetLocation[2], targetLocation[3] );
tempFollower.Follow( srcChar );
}
}

// Teleport player
srcChar.Teleport( targetLocation[0], targetLocation[1], targetLocation[2], targetLocation[3] );
TriggerEvent( 6003, "CheckTeleport", srcChar, targetLocation[0], targetLocation[1], targetLocation[2], targetLocation[3], 0 )
}

function DisplayTravelGump( srcSock, pUser )
Expand Down
105 changes: 25 additions & 80 deletions data/js/item/runebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Runebooks can either be crafted via the Inscription skill, or added by GMs using this command:
// 'add item runebook

var maxCharges = 10; // Default maximum amount of charges a runebook can hold
var maxCharges = 16; // Default maximum amount of charges a runebook can hold
const showCoords = true; // Show regular coordinates in tooltip above latitude/longitude values
const scriptID = 5029; // Script ID assigned to this script in jse_fileassociations.scp
const useDelay = 7000; // 7 seconds between each time a runebook can be used
Expand Down Expand Up @@ -644,6 +644,20 @@ function onGumpPress( pSocket, myButton, gumpData )

function CastSpell( pSocket, pUser, spellNum, checkReagentReq )
{
var runeBook = pSocket.tempObj2;
var runeNum = pSocket.tempInt2;
var runeData = runeBook.GetTag( "rune" + runeNum + "Data" );
var splitData = runeData.split( "," );
var targLocX = parseInt(splitData[2]);
var targLocY = parseInt(splitData[3]);
var targWorld = parseInt(splitData[5]);
var targInstanceID = 0;

if( splitData[6] )
{
targInstanceID = parseInt(splitData[6]);
}

// Are we already casting?
if( pUser.GetTimer( Timer.SPELLTIME ) != 0 )
{
Expand All @@ -666,6 +680,12 @@ function CastSpell( pSocket, pUser, spellNum, checkReagentReq )
return;
}

//Checks if they can travell in the region.
if( TriggerEvent( 6002, "CheckTravelRestrictions", pUser, spellNum, targLocX, targLocY, targWorld, targInstanceID ))
{
return;
}

// Is the spell we're trying to cast enabled?
var mSpell = Spells[spellNum];
if( !mSpell.enabled )
Expand Down Expand Up @@ -697,7 +717,7 @@ function CastSpell( pSocket, pUser, spellNum, checkReagentReq )
}

// Does player have enough reagents to cast the spell?
if( checkReagentReq && !CheckReagents( pUser, mSpell ))
if( checkReagentReq && !TriggerEvent( 6004, "CheckReagents", pUser, mSpell))
return;

// Make sure player has enough of the required stats to cast the spell
Expand Down Expand Up @@ -764,7 +784,7 @@ function CastSpell( pSocket, pUser, spellNum, checkReagentReq )
pUser.TextMessage( mSpell.mantra );
if( checkReagentReq )
{
DeleteReagents( pUser, mSpell );
TriggerEvent( 6004, "DeleteReagents", pUser, mSpell );
}
pUser.SpellFail();
pUser.isCasting = false;
Expand All @@ -782,7 +802,7 @@ function CastSpell( pSocket, pUser, spellNum, checkReagentReq )
// Delete reagents if needed
if( checkReagentReq )
{
DeleteReagents( pUser, mSpell );
TriggerEvent( 6004, "DeleteReagents", pUser, mSpell );
}

pUser.TextMessage( mSpell.mantra );
Expand All @@ -791,67 +811,6 @@ function CastSpell( pSocket, pUser, spellNum, checkReagentReq )
pUser.StartTimer( delay, spellNum, true );
}

function CheckReagents( pUser, mSpell )
{
var failedCheck = 0;
if( mSpell.ash > 0 && pUser.ResourceCount( 0x0F8C ) < mSpell.ash )
{
failedCheck = 1;
}
if( mSpell.drake > 0 && pUser.ResourceCount( 0x0F86 ) < mSpell.drake )
{
failedCheck = 1;
}
if( mSpell.garlic > 0 && pUser.ResourceCount( 0x0F84 ) < mSpell.garlic )
{
failedCheck = 1;
}
if( mSpell.ginseng > 0 && pUser.ResourceCount( 0x0F85 ) < mSpell.ginseng )
{
failedCheck = 1;
}
if( mSpell.moss > 0 && pUser.ResourceCount( 0x0F7B ) < mSpell.moss )
{
failedCheck = 1;
}
if( mSpell.pearl > 0 && pUser.ResourceCount( 0x0F7A ) < mSpell.pearl )
{
failedCheck = 1;
}
if( mSpell.shade > 0 && pUser.ResourceCount( 0x0F88 ) < mSpell.shade )
{
failedCheck = 1;
}
if( mSpell.silk > 0 && pUser.ResourceCount( 0x0F8D ) < mSpell.silk )
{
failedCheck = 1;
}
if( failedCheck == 1 )
{
if( pUser.socket != null )
{
pUser.socket.SysMessage( GetDictionaryEntry( 702, pUser.socket.language )); // You do not have enough reagents to cast that spell.
}
return false;
}
else
{
return true;
}
}

function DeleteReagents( pUser, mSpell )
{
pUser.UseResource( mSpell.pearl, 0x0F7A );
pUser.UseResource( mSpell.moss, 0x0F7B );
pUser.UseResource( mSpell.garlic, 0x0F84 );
pUser.UseResource( mSpell.ginseng, 0x0F85 );
pUser.UseResource( mSpell.drake, 0x0F86 );
pUser.UseResource( mSpell.shade, 0x0F88 );
pUser.UseResource( mSpell.ash, 0x0F8C );
pUser.UseResource( mSpell.silk, 0x0F8D );
}

function onTimer( timerObj, timerID )
{
if( timerID == 100 )
Expand Down Expand Up @@ -909,21 +868,7 @@ function onTimer( timerObj, timerID )
// Handle effect of spell
if( spellNum == 32 ) // Recall spell
{
// Teleport player's followers
var followerList = timerObj.GetFollowerList();
for( var i = 0; i < followerList.length; i++ )
{
var tempFollower = followerList[i];
// Only teleport player's pets if they are set to follow
if( ValidateObject( tempFollower ) && tempFollower.wandertype == 1 && tempFollower.InRange( timerObj, 24 ))
{
tempFollower.Teleport( targLocX, targLocY, targLocZ, targWorld, targInstanceID );
tempFollower.Follow( timerObj );
}
}

// Teleport player
timerObj.Teleport( targLocX, targLocY, targLocZ, targWorld, targInstanceID );
TriggerEvent( 6003, "CheckTeleport", timerObj, targLocX, targLocY, targLocZ, targWorld, targInstanceID )
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions data/js/jse_fileassociations.scp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@
//-------------------------------------------
6000=magic/helper/check_resist.js
6001=magic/helper/calc_final_spell_damage.js
6002=magic/helper/check_travel_restrictions.js
6003=magic/helper/check_teleport.js
6004=magic/helper/check_reagents.js

//-------------------------------------------
// Combat Scripts [7000-7499]
Expand Down
67 changes: 3 additions & 64 deletions data/js/magic/clumsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum )
{
//Check for enough reagents
// type == 0 -> SpellBook
if( spellType == 0 && !CheckReagents( mChar, mSpell ))
if( spellType == 0 && !TriggerEvent( 6004, "CheckReagents", pUser, mSpell))
{
mChar.SetTimer( Timer.SPELLTIME, 0 );
mChar.isCasting = false;
Expand Down Expand Up @@ -194,7 +194,7 @@ function onSpellCast( mSock, mChar, directCast, spellNum )

if( spellType == 0 )
{
DeleteReagents( mChar, mSpell );
TriggerEvent( 6004, "DeleteReagents", pUser, mSpell );
mChar.SpellFail();
mChar.SetTimer( Timer.SPELLTIME, 0 );
mChar.isCasting = false;
Expand Down Expand Up @@ -246,67 +246,6 @@ function onSpellCast( mSock, mChar, directCast, spellNum )
return true;
}

function CheckReagents( mChar, mSpell )
{
var failedCheck = 0;
if( mSpell.ash > 0 && mChar.ResourceCount( 0x0F8C ) < mSpell.ash )
{
failedCheck = 1;
}
if( mSpell.drake > 0 && mChar.ResourceCount( 0x0F86 ) < mSpell.drake )
{
failedCheck = 1;
}
if( mSpell.garlic > 0 && mChar.ResourceCount( 0x0F84 ) < mSpell.garlic )
{
failedCheck = 1;
}
if( mSpell.ginseng > 0 && mChar.ResourceCount( 0x0F85 ) < mSpell.ginseng )
{
failedCheck = 1;
}
if( mSpell.moss > 0 && mChar.ResourceCount( 0x0F7B ) < mSpell.moss )
{
failedCheck = 1;
}
if( mSpell.pearl > 0 && mChar.ResourceCount( 0x0F7A ) < mSpell.pearl )
{
failedCheck = 1;
}
if( mSpell.shade > 0 && mChar.ResourceCount( 0x0F88 ) < mSpell.shade )
{
failedCheck = 1;
}
if( mSpell.silk > 0 && mChar.ResourceCount( 0x0F8D ) < mSpell.silk )
{
failedCheck = 1;
}
if( failedCheck == 1 )
{
if( mChar.socket != null )
{
mChar.socket.SysMessage( GetDictionaryEntry( 702, mChar.socket.language )); // You do not have enough reagents to cast that spell.
}
return false;
}
else
{
return true;
}
}

function DeleteReagents( mChar, mSpell )
{
mChar.UseResource( mSpell.pearl, 0x0F7A );
mChar.UseResource( mSpell.moss, 0x0F7B );
mChar.UseResource( mSpell.garlic, 0x0F84 );
mChar.UseResource( mSpell.ginseng, 0x0F85 );
mChar.UseResource( mSpell.drake, 0x0F86 );
mChar.UseResource( mSpell.shade, 0x0F88 );
mChar.UseResource( mSpell.ash, 0x0F8C );
mChar.UseResource( mSpell.silk, 0x0F8D );
}

function onTimer( mChar, timerID )
{
mChar.isCasting = false;
Expand Down Expand Up @@ -379,7 +318,7 @@ function onSpellSuccess( mSock, mChar, ourTarg )
}
if( !mChar.npc && spellType == 0 )
{
DeleteReagents( mChar, mSpell );
TriggerEvent( 6004, "DeleteReagents", pUser, mSpell );
}

if( !mChar.InRange( ourTarg, 10 ))
Expand Down
Loading

0 comments on commit 4c533db

Please sign in to comment.