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

Huge problem with items and spells.


santa-clause
 Share

Recommended Posts

hello everyone,

So i'm having problem with my item stuff resetting all the time and it started when i made 2custom items.

So i found a Quickfix already for it but it works till i go to the editor then it crashes again.

So i've looked at the difference between server Sub SendUpdateSpellTo and the client Private Sub HandleUpdateSpell So i made at server that 

```
SpellSize = LenB(Spell(spellNum))
SpellSize = SpellSize + 12
```
But that was actually just a little test if that could fix that would be able to fix it but it only worked half :'(

ModTypes Client:

```
Option Explicit

' Public data structures
Public Map As MapRec
Public Bank As BankRec
Public Player(1 To MAX_PLAYERS) As PlayerRec
Public TempPlayer(1 To MAX_PLAYERS) As TempPlayerRec
Public Class(1 To MAX_CLASSES) As ClassRec
Public Item(1 To MAX_ITEMS) As ItemRec
Public NPC(1 To MAX_NPCS) As NpcRec
Public MapItem(1 To MAX_MAP_ITEMS) As MapItemRec
Public MapNpc(1 To MAX_MAP_NPCS) As MapNpcRec
Public TempMapNpc(1 To MAX_MAP_NPCS) As TempMapNpcRec
Public Shop(1 To MAX_SHOPS) As ShopRec
Public Spell(1 To MAX_SPELLS) As SpellRec
Public Resource(1 To MAX_RESOURCES) As ResourceRec
Public Animation(1 To MAX_ANIMATIONS) As AnimationRec
Public Switches(1 To MAX_SWITCHES) As String
Public Variables(1 To MAX_VARIABLES) As String
Public MapSounds() As MapSoundRec
Public MapSoundCount As Long
Public WeatherParticle(1 To MAX_WEATHER_PARTICLES) As WeatherParticleRec
Public Autotile() As AutotileRec
Public Auction(1 To 100) As AuctionHouseRec
Public BattleMsg(1 To MAX_BATTLEMSG) As BattleMsgRec

' client-side stuff
Public ActionMsg(1 To MAX_BYTE) As ActionMsgRec
Public BossMsg As BossMsgRec
Public Blood(1 To MAX_BYTE) As BloodRec
Public AnimInstance(1 To MAX_BYTE) As AnimInstanceRec

Public Party As PartyRec
Public GUIWindow() As GUIWindowRec
Public Buttons(1 To MAX_BUTTONS) As ButtonRec
Public Chat(1 To 20) As ChatRec
Public TheirTrade(1 To MAX_INV) As TheirTradeRec
Public CharData(1 To MAX_PLAYER_CHARACTERS) As CharDataRec
Public PlayerInfo As InfoRec
Public Hotbar(1 To MAX_HOTBAR) As HotbarRec
Public TradeYourOffer(1 To MAX_INV) As PlayerInvRec
Public MapResource() As MapResourceRec
Public PlayerInv(1 To MAX_INV) As PlayerInvRec ' Inventory
Public PlayerSpells(1 To MAX_PLAYER_SPELLS) As PlayerSpellRec
' autotiling
Public autoInner(1 To 4) As PointRec
Public autoNW(1 To 4) As PointRec
Public autoNE(1 To 4) As PointRec
Public autoSW(1 To 4) As PointRec
Public autoSE(1 To 4) As PointRec
Public chatBubble(1 To MAX_BYTE) As ChatBubbleRec
Public ProjectileList() As ProjectileRec

' options
Public Options As OptionsRec

Public Type RandInvRec
prefix As String * NAME_LENGTH
Suffix As String * NAME_LENGTH
Stat(1 To Stats.Stat_Count - 1) As Long
Rarity As Long
Damage As Long
speed As Long
End Type

'Evilbunnie's DrawnChat system
Private Type ChatRec
Text As String
Colour As Long
End Type

' Type recs
Private Type OptionsRec
Game_Name As String
savePass As Byte
Password As String * NAME_LENGTH
Username As String * ACCOUNT_LENGTH
IP As String
Port As Long
MenuMusic As String
Theme As String
Website As String
Music As Byte
sound As Byte
Debug As Byte
Windowed As Byte
End Type

Public Type AuctionHouseRec
Owner As String
Item As Long
Amount As Long
Price As Long
EndDate As Long
Date As String
ItemRand As RandInvRec
End Type

Public Type PartyRec
Leader As Long
Member(1 To MAX_PARTY_MEMBERS) As Long
MemberCount As Long
End Type

Public Type PlayerInvRec
Num As Long
Value As Long
End Type

Public Type PlayerSpellRec
Spell As Long
Uses As Long
End Type

Private Type BankRec
Item(1 To MAX_BANK) As PlayerInvRec
ItemRand(1 To MAX_BANK) As RandInvRec
End Type

Private Type SpellAnim
spellnum As Long
timer As Long
FramePointer As Long
End Type

Private Type PlayerRec
' General
Name As String
Class As Long
Sprite As Long
Level As Byte
Access As Byte
PK As Byte
IsMember As Byte
DateCount As String
PlayerQuest(1 To MAX_QUESTS) As PlayerQuestRec
' Vitals
Vital(1 To Vitals.Vital_Count - 1) As Long
MaxVital(1 To Vitals.Vital_Count - 1) As Long
' Stats
Stat(1 To Stats.Stat_Count - 1) As Byte
StatExp(1 To Stats.Stat_Count - 1) As Long
StatTNL(1 To Stats.Stat_Count - 1) As Long
' Worn equipment
Equipment(1 To Equipment.Equipment_Count - 1) As Long
' Position
Map As Long
X As Byte
y As Byte
Dir As Byte
' Random Items
RandInv(1 To MAX_INV) As RandInvRec
RandEq(1 To Equipment.Equipment_Count - 1) As RandInvRec
EventOpen(1 To MAX_EVENTS) As Byte
End Type

Private Type TempPlayerRec
xOffset As Integer
yOffset As Integer
Moving As Byte
Attacking As Byte
AttackTimer As Long
MapGetTimer As Long
Step As Byte
GuildColor As Long
GuildName As String
GuildTag As String * 3
SlashAnim As Byte
NextAnim As Long
Anim As Long
AnimTimer As Long
StartFlash As Long
End Type

Private Type TileDataRec
X As Long
y As Long
Tileset As Long
End Type

Public Type TileRec
layer(1 To MapLayer.Layer_Count - 1) As TileDataRec
Autotile(1 To MapLayer.Layer_Count - 1) As Byte
Type As Byte
Data1 As Long
Data2 As Long
Data3 As Long
Data4 As String
DirBlock As Byte
End Type

Private Type MapEventRec
Name As String
Dir As Long
X As Long
y As Long
GraphicType As Long
GraphicX As Long
GraphicY As Long
GraphicX2 As Long
GraphicY2 As Long
GraphicNum As Long
Moving As Long
MovementSpeed As Long
Position As Long
xOffset As Long
yOffset As Long
Step As Long
visible As Long
WalkAnim As Long
DirFix As Long
ShowDir As Long
WalkThrough As Long
ShowName As Long
End Type

Private Type MapRec
Name As String * NAME_LENGTH
Music As String * MUSIC_LENGTH
BGS As String * MUSIC_LENGTH

Revision As Long
Moral As Byte

Up As Long
Down As Long
Left As Long
Right As Long

BootMap As Long
BootX As Byte
BootY As Byte

Weather As Long
WeatherIntensity As Long

Fog As Long
FogSpeed As Long
FogOpacity As Long

Red As Long
Green As Long
Blue As Long
Alpha As Long

MaxX As Byte
MaxY As Byte

Tile() As TileRec
NPC(1 To MAX_MAP_NPCS) As Long
NpcSpawnType(1 To MAX_MAP_NPCS) As Long
IsMember As Byte
Panorama As Byte
DayNight As Byte
End Type

Private Type ClassRec
Name As String * NAME_LENGTH
Stat(1 To Stats.Stat_Count - 1) As Byte
MaleSprite() As Long
FemaleSprite() As Long
' For client use
Vital(1 To Vitals.Vital_Count - 1) As Long
Desc As String
End Type

Private Type ItemRec
Name As String * NAME_LENGTH
Desc As String * 255
sound As String * NAME_LENGTH
Pic As Long
Type As Byte
Data1 As Long
Data2 As Long
Data3 As Long
ClassReq(1 To MAX_CLASSES) As Byte
AccessReq As Long
LevelReq As Long
Price As Long
Add_Stat(1 To Stats.Stat_Count - 1) As Byte
Rarity As Byte
speed As Long
ConsumeItem As Long
Code As Long
QuestNum As Long
BindType As Byte
Stat_Req(1 To Stats.Stat_Count - 1) As Byte
Animation As Long
Paperdoll As Long
AddHP As Long
AddMP As Long
AddEXP As Long
EXPStat As Long
CastSpell As Long
instaCast As Byte
IsMember As Byte
a As Byte
R As Byte
G As Byte
B As Byte
PDef As Long
MDef As Long
RDef As Long
Random As Byte
ItemLevel As Byte
isTwoHanded As Byte
Projectile As Long
Range As Byte
Rotation As Integer
Ammo As Long
End Type

Private Type MapItemRec
playerName As String
Num As Long
Value As Long
Frame As Byte
X As Byte
y As Byte
End Type

Private Type NpcRec
Name As String * NAME_LENGTH
AttackSay As String * 100
sound As String * NAME_LENGTH

Sprite As Long
SpawnSecs As Long
Behaviour As Byte
Range As Byte
DropChance(1 To MAX_NPC_DROPS) As Double
DropItem(1 To MAX_NPC_DROPS) As Byte
DropItemValue(1 To MAX_NPC_DROPS) As Integer
Stat(1 To Stats.Stat_Count - 1) As Byte
HP As Long
Animation As Long
Damage As Long
Level As Long
PDef As Long
MDef As Long
RDef As Long
Quest As Byte
QuestNum As Long
a As Byte
R As Byte
G As Byte
B As Byte
SpawnAtDay As Byte
SpawnAtNight As Byte
Event As Long
isBoss As Byte
Moral As Byte
Projectile As Long
ProjectileRange As Byte
Rotation As Integer
End Type

Private Type MapNpcRec
Num As Long
target As Long
TargetType As Byte
Vital(1 To Vitals.Vital_Count - 1) As Long
Map As Long
X As Byte
y As Byte
Dir As Byte
End Type

Private Type TempMapNpcRec
xOffset As Long
yOffset As Long
Moving As Byte
Attacking As Byte
AttackTimer As Long
Step As Byte
StartFlash As Long
Anim As Long
AnimTimer As Long
End Type

Private Type TradeItemRec
Item As Long
ItemValue As Long
CostItem As Long
CostValue As Long
End Type

Private Type ShopRec
Name As String * NAME_LENGTH
BuyRate As Long
TradeItem(1 To MAX_TRADES) As TradeItemRec
End Type

Private Type SpellRec
Name As String * NAME_LENGTH
Desc As String * 255
sound As String * NAME_LENGTH

Type As Byte
MPCost As Long
LevelReq As Long
AccessReq As Long
ClassReq(1 To MAX_CLASSES) As Byte
CastTime As Long
CDTime As Long
Icon As Long
Map As Long
X As Long
y As Long
Dir As Byte
Vital As Long
Duration As Long
Interval As Long
Range As Byte
IsAoE As Boolean
AoE As Long
CastAnim As Long
SpellAnim As Long
StunDuration As Long
IsLinear As Boolean
BuffType As Byte
Sprite As Long
NextRank As Long
NextUses As Long
End Type

Public Type MapResourceRec
X As Long
y As Long
ResourceState As Byte
End Type

Private Type ResourceRec
Name As String * NAME_LENGTH
SuccessMessage As String * NAME_LENGTH
EmptyMessage As String * NAME_LENGTH
sound As String * NAME_LENGTH

ResourceType As Byte
ResourceImage As Long
ExhaustedImage As Long
ItemReward As Long
ToolRequired As Long
health As Long
RespawnTime As Long
WalkThrough As Boolean
Animation As Long
Exp As Long
LevelReq As Long
End Type

Private Type ActionMsgRec
Message As String
Created As Long
Type As Long
color As Long
Scroll As Long
X As Long
y As Long
Alpha As Byte
End Type

Private Type BossMsgRec
Message As String
Created As Long
color As Long
End Type

Private Type BloodRec
Sprite As Long
timer As Long
X As Long
y As Long
End Type

Private Type AnimationRec
Name As String * NAME_LENGTH
sound As String * NAME_LENGTH

Sprite(0 To 1) As Long
Frames(0 To 1) As Long
LoopCount(0 To 1) As Long
looptime(0 To 1) As Long
End Type

Private Type AnimInstanceRec
Animation As Long
X As Long
y As Long
' used for locking to players/npcs
lockindex As Long
LockType As Byte
' timing
timer(0 To 1) As Long
' rendering check
Used(0 To 1) As Boolean
' counting the loop
LoopIndex(0 To 1) As Long
frameIndex(0 To 1) As Long
End Type

Public Type HotbarRec
Slot As Long
sType As Byte
End Type

Public Type ButtonRec
state As Byte
X As Long
y As Long
width As Long
height As Long
visible As Boolean
PicNum As Long
End Type

Public Type GUIWindowRec
X As Long
y As Long
width As Long
height As Long
visible As Boolean
End Type
Public Type EventListRec
CommandList As Long
CommandNum As Long
End Type

Public Type MapSoundRec
X As Long
y As Long
SoundHandle As Long
InUse As Boolean
Channel As Long
End Type

Public Type WeatherParticleRec
Type As Long
X As Long
y As Long
Velocity As Long
InUse As Long
End Type

'Auto tiles "/
Public Type PointRec
X As Long
y As Long
End Type

Public Type QuarterTileRec
QuarterTile(1 To 4) As PointRec
RenderState As Byte
srcX(1 To 4) As Long
srcY(1 To 4) As Long
End Type

Public Type AutotileRec
layer(1 To MapLayer.Layer_Count - 1) As QuarterTileRec
End Type

Public Type ChatBubbleRec
Msg As String
Colour As Long
target As Long
TargetType As Byte
timer As Long
active As Boolean
End Type
Private Type TheirTradeRec
itemNum As Long
ItemValue As Long
Rand As RandInvRec
End Type

Public Type CharDataRec
Name As String * NAME_LENGTH
Level As Long
Class As Long
Sex As Long
Sprite As Long
End Type

Public Type InfoRec
CurrentWindow As Byte
AttackDamage As Long
ArcheryDamage As Long
PDef As Long
MDef As Long
RDef As Long
block As Long
Crit As Long
Dodge As Long
Parry As Long
End Type

''''''''''''''''''''''''''''''''
' ****** Battle Message ****** '
''''''''''''''''''''''''''''''''
Type BattleMsgRec
Msg As String
color As Long
Created As Long
dY As Long
End Type

Public Type ProjectileRec
X As Long
y As Long
tx As Long
ty As Long
RotateSpeed As Byte
Rotate As Single
Graphic As Long
End Type

```
Link to comment
Share on other sites

ModTypes (Server)

```
Option Explicit

' Public data structures
Public Map(1 To MAX_CACHED_MAPS) As MapRec
Public MapCache(1 To MAX_CACHED_MAPS) As Cache
Public PlayersOnMap(1 To MAX_CACHED_MAPS) As Long
Public ResourceCache(1 To MAX_CACHED_MAPS) As ResourceCacheRec
Public player(1 To MAX_PLAYERS) As PlayerRec
Public Bank(1 To MAX_PLAYERS) As BankRec
Public TempPlayer(1 To MAX_PLAYERS) As TempPlayerRec
Public Class(1 To MAX_CLASSES) As ClassRec
Public Item(1 To MAX_ITEMS) As ItemRec
Public NPC(1 To MAX_NPCS) As NpcRec
Public MapItem(1 To MAX_CACHED_MAPS, 1 To MAX_MAP_ITEMS) As MapItemRec
Public MapNpc(1 To MAX_CACHED_MAPS) As MapDataRec
Public Shop(1 To MAX_SHOPS) As ShopRec
Public Spell(1 To MAX_SPELLS) As SpellRec
Public Resource(1 To MAX_RESOURCES) As ResourceRec
Public Animation(1 To MAX_ANIMATIONS) As AnimationRec
Public Party(1 To MAX_PARTYS) As PartyRec
Public Options As OptionsRec
Public Switches(1 To MAX_SWITCHES) As String
Public Variables(1 To MAX_VARIABLES) As String
Public MapBlocks(1 To MAX_CACHED_MAPS) As MapBlockRec
Public Auction(1 To 100) As AuctionHouseRec
Public AEditor As PlayerRec

Public Type RandInvRec
Prefix As String * NAME_LENGTH
Suffix As String * NAME_LENGTH
Stat(1 To Stats.Stat_Count - 1) As Long
Rarity As Long
Damage As Long
Speed As Long
End Type

Private Type OptionsRec
Game_Name As String
MOTD As String
port As Long
Website As String
DayNight As Byte
End Type

Public Type AuctionHouseRec
Owner As String
Item As Long
Amount As Long
Price As Long
EndDate As Long
Date As String
ItemRand As RandInvRec
End Type

Public Type PartyRec
Leader As Long
Member(1 To MAX_PARTY_MEMBERS) As Long
MemberCount As Long
End Type

Public Type PlayerInvRec
num As Long
Value As Long
End Type

Private Type Cache
Data() As Byte
End Type

Private Type BankRec
Item(1 To MAX_BANK) As PlayerInvRec
ItemRand(1 To MAX_BANK) As RandInvRec
End Type

Public Type HotbarRec
slot As Long
sType As Byte
End Type

Private Type CharRec
' General
Name As String * ACCOUNT_LENGTH
Sex As Byte
Class As Long
Sprite As Long
Level As Byte
PK As Byte
IsMember As Byte
DateCount As String
GuildFileId As Long
GuildMemberId As Long
PlayerQuest(1 To MAX_QUESTS) As PlayerQuestRec

' Vitals
Vital(1 To Vitals.Vital_Count - 1) As Long

' Stats
Stat(1 To Stats.Stat_Count - 1) As Byte
StatExp(1 To Stats.Stat_Count - 1) As Long
StatTNL(1 To Stats.Stat_Count - 1) As Long

' Worn equipment
Equipment(1 To Equipment.Equipment_Count - 1) As Long

' Inventory
Inv(1 To MAX_INV) As PlayerInvRec
Spell(1 To MAX_PLAYER_SPELLS) As Long

' Hotbar
Hotbar(1 To MAX_HOTBAR) As HotbarRec

' Position
Map As Long
x As Byte
y As Byte
Dir As Byte

Switches(0 To MAX_SWITCHES) As Byte
Variables(0 To MAX_VARIABLES) As Long
BootMap As Long
BootX As Byte
BootY As Byte

' Random Items
RandInv(1 To MAX_INV) As RandInvRec
RandEq(1 To Equipment.Equipment_Count - 1) As RandInvRec
Spriteold As Long
SpellUses(1 To MAX_PLAYER_SPELLS) As Long

EventOpen(1 To MAX_EVENTS) As Byte
End Type

Private Type PlayerRec
' Account
Login As String * ACCOUNT_LENGTH
password As String * NAME_LENGTH

' Access
Access As Byte

' Characters
Char(1 To MAX_PLAYER_CHARACTERS) As CharRec
End Type

Public Type SpellBufferRec
Spell As Long
Timer As Long
Target As Long
tType As Byte
End Type

Public Type DoTRec
Used As Boolean
Spell As Long
Timer As Long
Caster As Long
StartTime As Long
End Type

Public Type TempPlayerRec
' Non saved local vars
Buffer As clsBuffer
InGame As Boolean
AttackTimer As Long
DataTimer As Long
DataBytes As Long
DataPackets As Long
targetType As Byte
Target As Long
GettingMap As Byte
SpellCD(1 To MAX_PLAYER_SPELLS) As Long
InShop As Long
StunTimer As Long
StunDuration As Long
InBank As Boolean
' trade
TradeRequest As Long
InTrade As Long
TradeOffer(1 To MAX_INV) As PlayerInvRec
AcceptTrade As Boolean
' dot/hot
DoT(1 To MAX_DOTS) As DoTRec
HoT(1 To MAX_DOTS) As DoTRec
' spell buffer
spellBuffer As SpellBufferRec
' regen
stopRegen As Boolean
stopRegenTimer As Long
' party
inParty As Long
partyInvite As Long

tmpGuildSlot As Long
tmpGuildInviteSlot As Long
tmpGuildInviteTimer As Long
tmpGuildInviteId As Long
Craft(1 To 2) As Byte
CurChar As Byte
Buffs(1 To MAX_BUFFS) As Long
BuffTimer(1 To MAX_BUFFS) As Long
BuffValue(1 To MAX_BUFFS) As Long
Transformed As Boolean
CurrentEvent As Long
inChatWith As Long
mapnum As Long
mapNpcNum As Long
SlotA As Long
SlotB As Long
inDevSuite As Byte
FreeAction As Boolean
End Type

Private Type TileDataRec
x As Long
y As Long
Tileset As Long
End Type

Public Type TileRec
Layer(1 To MapLayer.Layer_Count - 1) As TileDataRec
Autotile(1 To MapLayer.Layer_Count - 1) As Byte
Type As Byte
Data1 As Long
Data2 As Long
Data3 As Long
Data4 As String
DirBlock As Byte
End Type

Private Type MapRec
Name As String * NAME_LENGTH
Music As String * MUSIC_LENGTH
BGS As String * MUSIC_LENGTH

Revision As Long
Moral As Byte

Up As Long
Down As Long
Left As Long
Right As Long

BootMap As Long
BootX As Byte
BootY As Byte

Weather As Long
WeatherIntensity As Long

Fog As Long
FogSpeed As Long
FogOpacity As Long

Red As Long
Green As Long
Blue As Long
Alpha As Long

MaxX As Byte
MaxY As Byte

Tile() As TileRec
NPC(1 To MAX_MAP_NPCS) As Long
NpcSpawnType(1 To MAX_MAP_NPCS) As Long
IsMember As Byte
Panorama As Byte
DayNight As Byte
End Type

Private Type ClassRec
Name As String * NAME_LENGTH
Stat(1 To Stats.Stat_Count - 1) As Byte
MaleSprite() As Long
FemaleSprite() As Long

startItemCount As Long
StartItem() As Long
StartValue() As Long

startSpellCount As Long
StartSpell() As Long
Next As Byte
StartMap As Long
StartMapX As Long
StartMapY As Long
End Type

Private Type ItemRec
Name As String * NAME_LENGTH
Desc As String * 255
Sound As String * NAME_LENGTH
Pic As Long
Type As Byte
Data1 As Long
Data2 As Long
Data3 As Long
ClassReq(1 To MAX_CLASSES) As Byte
AccessReq As Long
LevelReq As Long
Price As Long
Add_Stat(1 To Stats.Stat_Count - 1) As Byte
Rarity As Byte
Speed As Long
ConsumeItem As Long
Code As Long
QuestNum As Long
BindType As Byte
Stat_Req(1 To Stats.Stat_Count - 1) As Byte
Animation As Long
Paperdoll As Long
AddHP As Long
AddMP As Long
AddEXP As Long
EXPStat As Long
CastSpell As Long
instaCast As Byte
IsMember As Byte
A As Byte
r As Byte
G As Byte
b As Byte
PDef As Long
MDef As Long
RDef As Long
Random As Byte
ItemLevel As Byte
isTwoHanded As Byte
Projectile As Long
Range As Byte
Rotation As Integer
Ammo As Long
End Type

Private Type MapItemRec
num As Long
Value As Long
x As Byte
y As Byte
' ownership + despawn
playerName As String
playerTimer As Long
canDespawn As Boolean
despawnTimer As Long
RandData As RandInvRec
End Type

Private Type NpcRec
Name As String * NAME_LENGTH
AttackSay As String * 100
Sound As String * NAME_LENGTH

Sprite As Long
SpawnSecs As Long
Behaviour As Byte
Range As Byte
DropChance(1 To MAX_NPC_DROPS) As Double
DropItem(1 To MAX_NPC_DROPS) As Byte
DropItemValue(1 To MAX_NPC_DROPS) As Integer
Stat(1 To Stats.Stat_Count - 1) As Byte
HP As Long
Animation As Long
Damage As Long
Level As Long
PDef As Long
MDef As Long
RDef As Long
Quest As Byte
QuestNum As Long
A As Byte
r As Byte
G As Byte
b As Byte
SpawnAtDay As Byte
SpawnAtNight As Byte
Event As Long
isBoss As Byte
Moral As Byte
Projectile As Long
ProjectileRange As Byte
Rotation As Integer
End Type

Private Type MapNpcRec
num As Long
Target As Long
targetType As Byte
Vital(1 To Vitals.Vital_Count - 1) As Long
x As Byte
y As Byte
Dir As Byte
End Type

Private Type TempMapNpcRec
SpawnWait As Long
AttackTimer As Long
StunDuration As Long
StunTimer As Long
' regen
stopRegen As Boolean
stopRegenTimer As Long
' dot/hot
DoT(1 To MAX_DOTS) As DoTRec
HoT(1 To MAX_DOTS) As DoTRec
lastDir As Byte
inChatWith As Long
End Type

Private Type TradeItemRec
Item As Long
ItemValue As Long
costitem As Long
costvalue As Long
End Type

Private Type ShopRec
Name As String * NAME_LENGTH
BuyRate As Long
TradeItem(1 To MAX_TRADES) As TradeItemRec
End Type

Private Type SpellRec
Name As String * NAME_LENGTH
Desc As String * 255
Sound As String * NAME_LENGTH

Type As Byte
MPCost As Long
LevelReq As Long
AccessReq As Long
ClassReq(1 To MAX_CLASSES) As Byte
CastTime As Long
CDTime As Long
Icon As Long
Map As Long
x As Long
y As Long
Dir As Byte
Vital As Long
Duration As Long
Interval As Long
Range As Byte
IsAoE As Boolean
AoE As Long
CastAnim As Long
SpellAnim As Long
StunDuration As Long
isLinear As Boolean
BuffType As Byte
Sprite As Long
NextRank As Long
NextUses As Long
End Type

Private Type MapDataRec
NPC() As MapNpcRec
TempNPC() As TempMapNpcRec
End Type

Private Type MapResourceRec
ResourceState As Byte
ResourceTimer As Long
x As Long
y As Long
cur_health As Long
End Type

Private Type ResourceCacheRec
Resource_Count As Long
ResourceData() As MapResourceRec
End Type

Private Type ResourceRec
Name As String * NAME_LENGTH
SuccessMessage As String * NAME_LENGTH
EmptyMessage As String * NAME_LENGTH
Sound As String * NAME_LENGTH

ResourceType As Byte
ResourceImage As Long
ExhaustedImage As Long
ItemReward As Long
ToolRequired As Long
health As Long
RespawnTime As Long
WalkThrough As Boolean
Animation As Long
Exp As Long
LevelReq As Long
End Type

Private Type AnimationRec
Name As String * NAME_LENGTH
Sound As String * NAME_LENGTH

Sprite(0 To 1) As Long
Frames(0 To 1) As Long
LoopCount(0 To 1) As Long
LoopTime(0 To 1) As Long
End Type

Public Type Vector
x As Long
y As Long
End Type

Public Type MapBlockRec
Blocks() As Long
End Type

```
Link to comment
Share on other sites

Client codes:

```
Private Sub HandleUpdateSpell(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 debug mode, handle error then exit out
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

' Update the spells on the pic
Set buffer = New clsBuffer
buffer.WriteLong CSpells
SendData buffer.ToArray()
Set buffer = Nothing

' Error handler
Exit Sub
errorhandler:
HandleError "HandleUpdateSpell", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub

```
```
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

```
```
Private Sub HandleUpdateItem(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim n As Long
Dim buffer As clsBuffer
Dim ItemSize As Long
Dim ItemData() As Byte

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

Set buffer = New clsBuffer
buffer.WriteBytes data()
n = buffer.ReadLong
' Update the item
ItemSize = LenB(Item(n))
ReDim ItemData(ItemSize - 1)
ItemData = buffer.ReadBytes(ItemSize)
CopyMemory ByVal VarPtr(Item(n)), ByVal VarPtr(ItemData(0)), ItemSize
Set buffer = Nothing
' changes to inventory, need to clear any drop menu
sDialogue = vbNullString
GUIWindow(GUI_CURRENCY).visible = False
inChat = False
tmpCurrencyItem = 0
CurrencyMenu = 0 ' clear

' Error handler
Exit Sub
errorhandler:
HandleError "HandleUpdateItem", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub

```
Link to comment
Share on other sites

> Is it actually saving the items? May want to look at that first.

I looked for that yesterday and i already sayd i don't know it started when i added the item and i've put everything i've done in the thread ;)

And i can't seem to fix it at all i've tried everything i know :(
Link to comment
Share on other sites

I know that the Stein posted this,

but actually check whether the data is being saved. You can create an application in VB6 and load the item into the item rec. Then check the values. (Use the immediate window or use form printing or print to the immediate window.)
Link to comment
Share on other sites

> I know that the Stein posted this,
>
> but actually check whether the data is being saved. You can create an application in VB6 and load the item into the item rec. Then check the values. (Use the immediate window or use form printing or print to the immediate window.)

It is being saved as far as i know cuz if i use dropbox and the server is saving the items then i see a message from dropbox item1.bat saved

If i put debug mode off it marks this line first:

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

In client

error = subscript out of range

```
CopyMemory ByVal VarPtr(Item(n)), ByVal VarPtr(ItemData(0)), ItemSize

```
n=1

Itemsize = 744

itemdata(0) = subscript out of range

```
Private Sub HandleUpdateItem(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim n As Long
Dim buffer As clsBuffer
Dim ItemSize As Long
Dim ItemData() As Byte

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

Set buffer = New clsBuffer
buffer.WriteBytes data()
n = buffer.ReadLong
' Update the item
ItemSize = LenB(Item(n))
ReDim ItemData(ItemSize - 1)
ItemData = buffer.ReadBytes(ItemSize)
CopyMemory ByVal VarPtr(Item(n)), ByVal VarPtr(ItemData(n)), ItemSize
Set buffer = Nothing
' changes to inventory, need to clear any drop menu
sDialogue = vbNullString
GUIWindow(GUI_CURRENCY).visible = False
inChat = False
tmpCurrencyItem = 0
CurrencyMenu = 0 ' clear

' Error handler
Exit Sub
errorhandler:
HandleError "HandleUpdateItem", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub

```
Link to comment
Share on other sites

> Have you tried it with a new source? also make sure to do breakpoints in the vb6 ide. they help a lot when fixing errors(imo).

I have tried breakpoints that's how i know there is a problem with the Spellsize because it's different but it normally has to be exactly the same for as far as i know.

So i think it has something to do with types tnx to frankenStein i know that ;)

I hope he also wants to help me more ;)
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...