Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Having more than 23 spells flood server bug fix


blkcrow
 Share

Recommended Posts

This is a fix for a bug reported here [http://www.touchofde…em/#entry873441](http://www.touchofdeathforums.com/community/index.php?/topic/130858-spells-problem/#entry873441)

In server at modServerTCP copy paste this sub

```

Sub SendSpellTo(ByVal index As Long, ByVal spellnum As Long)

Dim buffer As clsBuffer

Dim SpellSize As Long

Dim SpellData() As Byte

Set buffer = New clsBuffer

SpellSize = LenB(Spell(spellnum))

ReDim SpellData(SpellSize - 1)

CopyMemory SpellData(0), ByVal VarPtr(Spell(spellnum)), SpellSize

buffer.WriteLong SSpell

buffer.WriteLong spellnum

buffer.WriteBytes SpellData

SendDataTo index, buffer.ToArray()

Set buffer = Nothing

End Sub

```

in both client and server at modEnumerations above

```
' Make sure SMSG_COUNT is below everything else
```
add

```
SSpell
```

in server replace sub SendSpells with

```

Sub SendSpells(ByVal index As Long)

Dim i As Long

For i = 1 To MAX_SPELLS

If LenB(Trim$(Spell(i).Name)) > 0 Then

Call SendSpellTo(index, i)

End If

Next

Call SendPlayerSpells(index)

End Sub

```

in client at modHandleData in sub InitMessages add

```

HandleDataSub(SSpell) = GetAddress(AddressOf HandleSpell)

```

and at the bottom of modHandleData add

```

Private Sub HandleSpell(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim spellnum As Long

Dim buffer As clsBuffer

Dim SpellSize As Long

Dim SpellData() As Byte

If Options.Debug = 1 Then On Error GoTo errorhandler

Set buffer = New clsBuffer

buffer.WriteBytes data()

spellnum = buffer.ReadLong

SpellSize = LenB(Spell(spellnum))

ReDim SpellData(SpellSize - 1)

SpellData = buffer.ReadBytes(SpellSize)

CopyMemory ByVal VarPtr(Spell(spellnum)), ByVal VarPtr(SpellData(0)), SpellSize

Set buffer = Nothing

Exit Sub

errorhandler:

HandleError "HandleSpell", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

thats all
Link to comment
Share on other sites

> Hmm but there is already sub SendUpdateSpellsTo, and this what you added is just same sub but renamed. I think this won´t fix anything.

this fixes everything. As i have explained in the topic i posted above every time the server updates a spell the client requests from the server all the spells the player has learned when the spells are more than 23 the server floods. What i have make is another sub that does the same thing but sends the spells the player has learned only once at the end
Link to comment
Share on other sites

this bug have been reported and fixed for the engines who use directX 8

**BUT** there is no reason why this wouldnt happen in the directX 7 version of the engine.

**DO NOT** use this fix if you arent experiencing this bug. To know for sure if this bug occurs in your version of the engine make 24 spells remove the admin rights from your character **log out and log in again** if you are unable to do anything (wraping, activating events, e.t.c.) exept for walking then and only then you should use this fix
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...