/Server/src/modPlayer.bas
Visual Basic | 2456 lines | 1824 code | 386 blank | 246 comment | 1 complexity | 5775e0c6f7cd6d22f4d5d59121ca2904 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- Attribute VB_Name = "modPlayer"
- Option Explicit
- Sub HandleUseChar(ByVal index As Long)
- If Not IsPlaying(index) Then
- Call JoinGame(index)
- Call AddLog(GetPlayerLogin(index) & "/" & GetPlayerName(index) & " has began playing " & Options.Name & ".", "Player")
- Call TextAdd(GetPlayerLogin(index) & "/" & GetPlayerName(index) & " has began playing " & Options.Name & ".")
- Call UpdateCaption
- End If
- End Sub
- Sub JoinGame(ByVal index As Long)
- Dim i As Long
- Dim n As Long
- Dim Color As Long
- ' Set the flag so we know the person is in the game
- TempPlayer(index).InGame = True
- ' Update the log
- frmServer.lvwInfo.ListItems(index).SubItems(1) = GetPlayerIP(index)
- frmServer.lvwInfo.ListItems(index).SubItems(2) = GetPlayerLogin(index)
- frmServer.lvwInfo.ListItems(index).SubItems(3) = GetPlayerName(index)
-
- ' Send an ok to client to start receiving in game data
- Call SendLogin(index)
- TotalPlayersOnline = TotalPlayersOnline + 1
-
- ' Send data
- Call SendItems(index)
- Call SendAnimations(index)
- Call SendNPCs(index)
- Call SendShops(index)
- Call SendSpells(index)
- Call SendResources(index)
- Call SendInventory(index)
- Call SendWornEquipment(index)
- Call SendMapEquipment(index)
- Call CheckEquippedItems(index)
- Call SendHotbar(index)
- Call SendTitles(index)
- Call SendMorals(index)
- Call SendEmoticons(index)
- Call SendQuests(index)
-
- ' Spell Cooldowns
- For i = 1 To MAX_PLAYER_SPELLS
- If GetPlayerSpell(index, i) > 0 Then
- ' Check if the CD has expired
- If GetPlayerSpellCD(index, i) - timeGetTime < 1 Then Call SetPlayerSpellCD(index, i, 0)
- If GetPlayerSpellCD(index, i) - timeGetTime >= Spell(GetPlayerSpell(index, i)).CDTime * 1000 Then Call SetPlayerSpellCD(index, i, 0)
- If GetPlayerSpellCD(index, i) <= timeGetTime Then Call SetPlayerSpellCD(index, i, 0)
-
- ' Send it
- Call SendSpellCooldown(index, i)
- End If
- Next
-
- ' Check for glitches in the inventory
- Call UpdatePlayerItems(index)
-
- ' Check for glitches in equipment
- Call UpdatePlayerEquipmentItems(index)
-
- ' Send the player's data
- Call SendPlayerData(index)
-
- ' Send vitals to player of all other players online
- For n = 1 To Player_HighIndex
- For i = 1 To Vitals.Vital_Count - 1
- If IsPlaying(n) Then
- Call SendVitalTo(index, n, i) ' Sends all players to new player
-
- If Not index = n Then
- Call SendVitalTo(n, index, i) ' Sends new player to logged in players
- End If
- End If
- Next
- Next
-
- ' Send other data
- Call SendPlayerStatus(index)
- Call SendPlayerExp(index)
-
- ' Warp the player to their saved location
- Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index), True)
-
- ' Send welcome messages
- Call SendWelcome(index)
- ' Send Resource cache
- For i = 0 To ResourceCache(GetPlayerMap(index)).Resource_Count
- SendResourceCacheTo index, i
- Next
-
- Call UpdateClassData(index)
-
- ' Send a global message that they joined
- If GetPlayerAccess(index) <= STAFF_MODERATOR Then
- If Class(GetPlayerClass(index)).Color = Orange Then
- Color = RGB(255, 165, 0)
- Else
- Color = Class(GetPlayerClass(index)).Color
- End If
-
- Call GlobalMsg(GetPlayerName(index) & " has joined " & Options.Name & "!", Color)
- Else
- ' Color for access
- Select Case GetPlayerAccess(index)
- Case 0
- Color = 15
- Case 1
- Color = 3
- Case 2
- Color = 2
- Case 3
- Color = BrightBlue
- Case 4
- Color = Yellow
- Case 5
- Color = RGB(255, 165, 0)
- End Select
-
- Call GlobalMsg(GetPlayerName(index) & " has joined " & Options.Name & "!", Color)
- End If
- ' Send the flag so they know they can start doing stuff
- Call SendInGame(index)
-
- ' Refresh the friends list to all players online
- For i = 1 To Player_HighIndex
- Call UpdateFriendsList(i)
- Next
-
- ' Refresh the foes list to all players online
- For i = 1 To Player_HighIndex
- Call UpdateFoesList(i)
- Next
-
- ' Update guild list
- If GetPlayerGuild(index) > 0 Then
- Call SendPlayerGuildMembers(index)
- End If
- End Sub
- Sub LeftGame(ByVal index As Long)
- Dim n As Long, i As Long
- Dim TradeTarget As Long
- If TempPlayer(index).InGame Then
- TempPlayer(index).InGame = False
- ' Check if player was the only player on the map and stop npc processing if so
- If GetTotalMapPlayers(GetPlayerMap(index)) < 1 Then
- PlayersOnMap(GetPlayerMap(index)) = NO
- End If
-
- ' Clear any invites out
- If TempPlayer(index).TradeRequest > 0 Or TempPlayer(index).PartyInvite > 0 Or TempPlayer(index).GuildInvite > 0 Then
- If TempPlayer(index).TradeRequest > 0 Then
- Call DeclineTradeRequest(index)
- End If
-
- If TempPlayer(index).PartyInvite > 0 Then
- Call Party_InviteDecline(TempPlayer(index).PartyInvite, index)
- End If
-
- If TempPlayer(index).GuildInvite > 0 Then
- Call DeclineGuildInvite(index)
- End If
- End If
-
- ' Cancel any trade they're in
- If TempPlayer(index).InTrade > 0 Then
- TradeTarget = TempPlayer(index).InTrade
- PlayerMsg TradeTarget, Trim$(GetPlayerName(index)) & " has declined the trade!", BrightRed
-
- ' Clear out trade
- For i = 1 To MAX_INV
- TempPlayer(TradeTarget).TradeOffer(i).Num = 0
- TempPlayer(TradeTarget).TradeOffer(i).Value = 0
- Next
-
- TempPlayer(TradeTarget).InTrade = 0
- SendCloseTrade TradeTarget
- End If
-
- ' Leave party
- Party_PlayerLeave index
- ' Loop through entire map and purge npc targets from player
- For i = 1 To Map(GetPlayerMap(index)).NPC_HighIndex
- If MapNPC(GetPlayerMap(index)).NPC(i).Num > 0 Then
- If MapNPC(GetPlayerMap(index)).NPC(i).targetType = TARGET_TYPE_PLAYER Then
- If MapNPC(GetPlayerMap(index)).NPC(i).target = index Then
- MapNPC(GetPlayerMap(index)).NPC(i).target = 0
- MapNPC(GetPlayerMap(index)).NPC(i).targetType = TARGET_TYPE_NONE
- Call SendMapNPCTarget(GetPlayerMap(index), i, 0, 0)
- End If
- End If
- End If
- Next
-
- ' Refresh guild members
- For i = 1 To Player_HighIndex
- If IsPlaying(i) Then
- If Not i = index Then
- If GetPlayerGuild(i) = GetPlayerGuild(index) Then
- SendPlayerGuildMembers i, index
- End If
- End If
- End If
- Next
-
- ' Send a global message that they left
- If GetPlayerAccess(index) <= STAFF_MODERATOR Then
- Call GlobalMsg(GetPlayerName(index) & " has left " & Options.Name & "!", Grey)
- Else
- Call GlobalMsg(GetPlayerName(index) & " has left " & Options.Name & "!", DarkGrey)
- End If
-
- Call TextAdd(GetPlayerName(index) & " has disconnected from " & Options.Name & ".")
- Call SendLeftGame(index)
- TotalPlayersOnline = TotalPlayersOnline - 1
-
- ' Save and clear data
- Call SaveAccount(index)
- Call ClearAccount(index)
-
- ' Refresh the friends list of all players online
- For i = 1 To Player_HighIndex
- Call UpdateFriendsList(i)
- Next
-
- ' Refresh the foes list of all players online
- For i = 1 To Player_HighIndex
- Call UpdateFoesList(i)
- Next
- End If
- End Sub
- Sub PlayerWarp(ByVal index As Long, ByVal MapNum As Integer, ByVal X As Long, ByVal Y As Long, Optional ByVal NeedMap = False, Optional ByVal Dir As Integer = -1)
- Dim ShopNum As Long
- Dim OldMap As Long
- Dim i As Long
- Dim Buffer As clsBuffer
- ' Check for subscript out of range
- If IsPlaying(index) = False Or MapNum <= 0 Or MapNum > MAX_MAPS Then Exit Sub
- ' Check if you are out of bounds
- If X > Map(MapNum).MaxX Then X = Map(MapNum).MaxX
- If Y > Map(MapNum).MaxY Then Y = Map(MapNum).MaxY
- If X < 0 Then X = 0
- If Y < 0 Then Y = 0
-
- ' Save old map to send erase player data to
- OldMap = GetPlayerMap(index)
-
- If OldMap <> MapNum Then
- UpdateMapBlock OldMap, GetPlayerX(index), GetPlayerY(index), False
- End If
-
- Call SetPlayerX(index, X)
- Call SetPlayerY(index, Y)
- UpdateMapBlock MapNum, X, Y, True
-
- ' Set direction
- If Dir > -1 Then
- Call SetPlayerDir(index, Dir)
- End If
-
- ' if same map then just send their co-ordinates
- If MapNum = GetPlayerMap(index) And Not NeedMap Then
- Call SendPlayerPosition(index)
- ' Clear spell casting
- ClearAccountSpellBuffer index
- Exit Sub
- End If
-
- ' Clear events
- TempPlayer(index).EventProcessingCount = 0
- TempPlayer(index).EventMap.CurrentEvents = 0
-
- ' Clear target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- ' Loop through entire map and purge npc targets from player
- For i = 1 To Map(GetPlayerMap(index)).NPC_HighIndex
- If MapNPC(GetPlayerMap(index)).NPC(i).Num > 0 Then
- If MapNPC(GetPlayerMap(index)).NPC(i).targetType = TARGET_TYPE_PLAYER Then
- If MapNPC(GetPlayerMap(index)).NPC(i).target = index Then
- MapNPC(GetPlayerMap(index)).NPC(i).target = 0
- MapNPC(GetPlayerMap(index)).NPC(i).targetType = TARGET_TYPE_NONE
- Call SendMapNPCTarget(OldMap, i, 0, 0)
- End If
- End If
- End If
- Next
-
- ' Leave the old map
- If Not OldMap = MapNum Then
- Call SendLeaveMap(index, OldMap)
- End If
- If Not OldMap = MapNum Then
- ' Set the new map
- Call SetPlayerMap(index, MapNum)
- End If
-
- ' Send player's equipment to new map
- SendMapEquipment index
-
- ' Send equipment of all people on new map
- If GetTotalMapPlayers(MapNum) > 0 Then
- For i = 1 To Player_HighIndex
- If IsPlaying(i) Then
- If GetPlayerMap(i) = MapNum Then
- SendMapEquipmentTo i, index
- End If
- End If
- Next
- End If
-
- ' Now we check if there were any players left on the map the player just left, and if not stop processing npcs
- If GetTotalMapPlayers(OldMap) = 0 Then
- PlayersOnMap(OldMap) = NO
-
- ' Get all NPCs' vitals
- For i = 1 To Map(OldMap).NPC_HighIndex
- If MapNPC(OldMap).NPC(i).Num > 0 Then
- MapNPC(OldMap).NPC(i).Vital(Vitals.HP) = GetNPCMaxVital(MapNPC(OldMap).NPC(i).Num, Vitals.HP)
- End If
- Next
- End If
-
- ' Clear spell casting
- ClearAccountSpellBuffer index
-
- ' Sets it so we know to process npcs on the map
- PlayersOnMap(MapNum) = YES
- TempPlayer(index).GettingMap = YES
- Set Buffer = New clsBuffer
- Call SendCheckForMap(index, MapNum)
- End Sub
- Sub PlayerMove(ByVal index As Long, ByVal Dir As Long, ByVal movement As Long, Optional ByVal SendToSelf As Boolean = False)
- Dim Buffer As clsBuffer, MapNum As Integer
- Dim X As Long, Y As Long, i As Long
- Dim Moved As Byte, MovedSoFar As Boolean
- Dim TileType As Long, VitalType As Long, Color As Long, Amount As Long
- Dim NewMapY As Long, NewMapX As Long
- ' Check for subscript out of range
- If IsPlaying(index) = False Or Dir < DIR_UP Or Dir > DIR_DOWNRIGHT Or movement < 1 Or movement > 2 Then Exit Sub
-
- ' Don't allow them to move if they are transfering to a new map
- If TempPlayer(index).GettingMap = YES Then Exit Sub
-
- ' Don't let them move if an event is waiting for their response
- If TempPlayer(index).EventProcessingCount > 0 Then
- For i = 1 To TempPlayer(index).EventProcessingCount
- If TempPlayer(index).EventProcessing(i).WaitingForResponse > 0 Then
- Call SendPlayerPosition(index)
- Exit Sub
- End If
- Next
- End If
-
- ' Prevent player from moving if they are casting a spell
- If TempPlayer(index).SpellBuffer.Spell > 0 Then Exit Sub
-
- ' If stunned, stop them moving
- If TempPlayer(index).StunDuration > 0 Then Exit Sub
- Call SetPlayerDir(index, Dir)
-
- Moved = NO
- MapNum = GetPlayerMap(index)
-
- Select Case Dir
- Case DIR_UPLEFT
- ' Check to make sure not outside of boundries
- If GetPlayerY(index) > 0 Or GetPlayerX(index) > 0 Then
-
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_UP + 1) And Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_LEFT + 1) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerY(index, GetPlayerY(index) - 1)
- Call SetPlayerX(index, GetPlayerX(index) - 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
-
- Else
-
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Up > 0 And Map(GetPlayerMap(index)).Left > 0 Then
- NewMapY = Map(Map(GetPlayerMap(index)).Up).MaxY
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Up, GetPlayerX(index), NewMapY)
- Moved = YES
- ' clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
-
- Case DIR_UPRIGHT
- ' Check to make sure not outside of boundries
- If GetPlayerY(index) > 0 Or GetPlayerX(index) < Map(MapNum).MaxX Then
-
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_UP + 1) And Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_RIGHT + 1) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerY(index, GetPlayerY(index) - 1)
- Call SetPlayerX(index, GetPlayerX(index) + 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
-
- Else
-
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Up > 0 And Map(GetPlayerMap(index)).Right > 0 Then
- NewMapY = Map(Map(GetPlayerMap(index)).Up).MaxY
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Up, GetPlayerX(index), NewMapY)
- Moved = YES
- ' clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
-
- Case DIR_DOWNLEFT
- ' Check to make sure not outside of boundries
- If GetPlayerY(index) < Map(MapNum).MaxY Or GetPlayerX(index) > 0 Then
-
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_DOWN + 1) And Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_LEFT + 1) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerY(index, GetPlayerY(index) + 1)
- Call SetPlayerX(index, GetPlayerX(index) - 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
-
- Else
-
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Down > 0 And Map(GetPlayerMap(index)).Left > 0 Then
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Down, GetPlayerX(index), 0)
- Moved = YES
- ' clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
-
- Case DIR_DOWNRIGHT
- ' Check to make sure not outside of boundries
- If GetPlayerY(index) < Map(MapNum).MaxY Or GetPlayerX(index) < Map(MapNum).MaxX Then
-
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_DOWN + 1) And Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_RIGHT + 1) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerY(index, GetPlayerY(index) + 1)
- Call SetPlayerX(index, GetPlayerX(index) + 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
-
- Else
-
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Down > 0 And Map(GetPlayerMap(index)).Right > 0 Then
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Down, GetPlayerX(index), 0)
- Moved = YES
- ' clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
- Case DIR_UP
- ' Check to make sure not outside of boundries
- If GetPlayerY(index) > 0 Then
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_UP + 1) Then
- If Not IsPlayerBlocked(index, 0, -1) Then
- If Not IsEventBlocked(index, 0, -1) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerY(index, GetPlayerY(index) - 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
- End If
- End If
- Else
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Up > 0 Then
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Up, GetPlayerX(index), Map(MapNum).MaxY)
- Moved = YES
-
- ' Clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
- Case DIR_DOWN
- ' Check to make sure not outside of boundries
- If GetPlayerY(index) < Map(MapNum).MaxY Then
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_DOWN + 1) Then
- If Not IsPlayerBlocked(index, 0, 1) Then
- If Not IsEventBlocked(index, 0, 1) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) + 1).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) + 1).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerY(index, GetPlayerY(index) + 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
- End If
- End If
- Else
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Down > 0 Then
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Down, GetPlayerX(index), 0)
- Moved = YES
-
- ' Clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
- Case DIR_LEFT
- ' Check to make sure not outside of boundries
- If GetPlayerX(index) > 0 Then
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_LEFT + 1) Then
- If Not IsPlayerBlocked(index, -1, 0) Then
- If Not IsEventBlocked(index, -1, 0) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index)).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index)).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerX(index, GetPlayerX(index) - 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
- End If
- End If
- Else
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Left > 0 Then
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Left, Map(MapNum).MaxX, GetPlayerY(index))
- Moved = YES
-
- ' Clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
- Case DIR_RIGHT
- ' Check to make sure not outside of boundries
- If GetPlayerX(index) < Map(MapNum).MaxX Then
- ' Check to make sure that the tile is walkable
- If Not IsDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_RIGHT + 1) Then
- If Not IsPlayerBlocked(index, 1, 0) Then
- If Not IsEventBlocked(index, 1, 0) Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).Type <> TILE_TYPE_BLOCKED Then
- If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).Type <> TILE_TYPE_RESOURCE Then
- Call SetPlayerX(index, GetPlayerX(index) + 1)
- SendPlayerMove index, movement, SendToSelf
- Moved = YES
- End If
- End If
- End If
- End If
- End If
- Else
- ' Check to see if we can move them to the another map
- If Map(GetPlayerMap(index)).Right > 0 Then
- Call PlayerWarp(index, Map(GetPlayerMap(index)).Right, 0, GetPlayerY(index))
- Moved = YES
-
- ' Clear their target
- TempPlayer(index).target = 0
- TempPlayer(index).targetType = TARGET_TYPE_NONE
- SendPlayerTarget index
- End If
- End If
- End Select
-
- With Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index))
- ' Check to see if the tile is a warp tile, and if so warp them
- If .Type = TILE_TYPE_WARP Then
- MapNum = .Data1
- X = .Data2
- Y = .Data3
- Call PlayerWarp(index, MapNum, X, Y)
- Moved = YES
- End If
-
- ' Check for a shop, and if so open it
- If .Type = TILE_TYPE_SHOP Then
- X = .Data1
-
- If X > 0 Then ' Shop exists?
- If Len(Trim$(Shop(X).Name)) > 0 Then ' Name exists?
- SendOpenShop index, X
- TempPlayer(index).InShop = X ' Stops movement and the like
- End If
- End If
- End If
-
- ' Check to see if the tile is a bank, and if so send bank
- If .Type = TILE_TYPE_BANK Then
- SendBank index
- TempPlayer(index).InBank = True
- Moved = YES
- End If
-
- ' Check if it's a heal tile
- If .Type = TILE_TYPE_HEAL Then
- VitalType = .Data1
- Amount = .Data2
-
- If VitalType = Int(Vitals.HP) Then
- Color = BrightGreen
- ElseIf VitalType = Int(Vitals.MP) Then
- Color = BrightBlue
- End If
-
- If Not GetPlayerVital(index, VitalType) = GetPlayerMaxVital(index, VitalType) Then
- If GetPlayerVital(index, VitalType) + Amount > GetPlayerMaxVital(index, VitalType) Then
- Amount = GetPlayerMaxVital(index, VitalType) - GetPlayerVital(index, VitalType)
- End If
- SendActionMsg GetPlayerMap(index), "+" & Amount, Color, ACTIONMSG_SCROLL, GetPlayerX(index) * 32, GetPlayerY(index) * 32, 1
- SetPlayerVital index, VitalType, GetPlayerVital(index, VitalType) + Amount
- Call SendVital(index, VitalType)
- Else
- SendActionMsg GetPlayerMap(index), "+0", Color, ACTIONMSG_SCROLL, GetPlayerX(index) * 32, GetPlayerY(index) * 32, 1
- If TempPlayer(index).InParty > 0 Then SendPartyVitals TempPlayer(index).InParty, index
- End If
- Moved = YES
- End If
-
- ' Check if it's a trap tile
- If .Type = TILE_TYPE_TRAP Then
- VitalType = .Data1
- Amount = .Data2
-
- If VitalType = Int(Vitals.HP) Then
- Color = BrightRed
- ElseIf VitalType = Int(Vitals.MP) Then
- Color = Magenta
- End If
-
- If Not GetPlayerVital(index, VitalType) < 1 Then
- If GetPlayerVital(index, VitalType) - Amount < 1 Then
- Amount = GetPlayerVital(index, VitalType)
- End If
- SendActionMsg GetPlayerMap(index), "-" & Amount, Color, ACTIONMSG_SCROLL, GetPlayerX(index) * 32, GetPlayerY(index) * 32, 1
- If GetPlayerVital(index, HP) - Amount < 1 And VitalType = 1 Then
- KillPlayer index
- Call GlobalMsg(GetPlayerName(index) & " has been killed by a trap!", BrightRed)
- Else
- SetPlayerVital index, VitalType, GetPlayerVital(index, VitalType) - Amount
- Call SendVital(index, VitalType)
- End If
- Else
- SetPlayerVital index, HP, GetPlayerVital(index, HP) - Amount
- PlayerMsg index, "You're injured by a trap.", BrightRed
- Call SendVital(index, HP)
- ' Send vitals to party if in one
- If TempPlayer(index).InParty > 0 Then SendPartyVitals TempPlayer(index).InParty, index
- End If
- Moved = YES
- End If
-
- ' Checkpoint
- If .Type = TILE_TYPE_CHECKPOINT Then
- SetCheckpoint index, .Data1, .Data2, .Data3
- Moved = YES
- End If
-
- ' Slide
- If .Type = TILE_TYPE_SLIDE Then
- ForcePlayerMove index, MOVING_WALKING, GetPlayerDir(index)
- Moved = YES
- End If
- End With
-
- ' They tried to hack
- If Moved = NO Then
- Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index))
- Else
- X = GetPlayerX(index)
- Y = GetPlayerY(index)
-
- If Trim$(Account(index).Chars(GetPlayerChar(index)).Status) = "AFK" Then
- Account(index).Chars(GetPlayerChar(index)).Status = vbNullString
- Call SendPlayerStatus(index)
- End If
-
- ' Check to see if events are touched
- EventTouch index, X, Y
- End If
- End Sub
- Sub EventTouch(ByVal index As Long, ByVal X As Long, ByVal Y As Long)
- Dim EventTouched As Boolean, i As Long
-
- If TempPlayer(index).EventMap.CurrentEvents > 0 Then
- For i = 1 To TempPlayer(index).EventMap.CurrentEvents
- If Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Global = 1 Then
- If Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).X = X And Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Y = Y And Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).PageID).Trigger = 1 And TempPlayer(index).EventMap.EventPages(i).Visible = 1 Then EventTouched = True
- Else
- If TempPlayer(index).EventMap.EventPages(i).X = X And TempPlayer(index).EventMap.EventPages(i).Y = Y And Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).PageID).Trigger = 1 And TempPlayer(index).EventMap.EventPages(i).Visible = 1 Then EventTouched = True
- End If
-
- If EventTouched Then
- ' Process this event, it is on-touch and everything checks out.
- If Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).PageID).CommandListCount > 0 Then
- TempPlayer(index).EventProcessingCount = TempPlayer(index).EventProcessingCount + 1
- ReDim Preserve TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount)
- TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).ActionTimer = timeGetTime
- TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).CurList = 1
- TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).CurSlot = 1
- TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).eventID = TempPlayer(index).EventMap.EventPages(i).eventID
- TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).PageID = TempPlayer(index).EventMap.EventPages(i).PageID
- TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).WaitingForResponse = 0
- ReDim TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).ListLeftOff(0 To Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).PageID).CommandListCount)
- End If
-
- EventTouched = False
- End If
- Next
- End If
- End Sub
- Sub ForcePlayerMove(ByVal index As Long, ByVal movement As Long, ByVal Direction As Long)
- If Direction < DIR_UP Or Direction > DIR_DOWNRIGHT Then Exit Sub
- If movement < 1 Or movement > 2 Then Exit Sub
- Select Case Direction
- Case DIR_UP
- If GetPlayerY(index) = 0 Then Exit Sub
- Case DIR_LEFT
- If GetPlayerX(index) = 0 Then Exit Sub
- Case DIR_DOWN
- If GetPlayerY(index) = Map(GetPlayerMap(index)).MaxY Then Exit Sub
- Case DIR_RIGHT
- If GetPlayerX(index) = Map(GetPlayerMap(index)).MaxX Then Exit Sub
- Case DIR_UPLEFT
- If GetPlayerY(index) = 0 And GetPlayerX(index) = 0 Then Exit Sub
- Case DIR_UPRIGHT
- If GetPlayerY(index) = 0 And GetPlayerX(index) = Map(GetPlayerMap(index)).MaxX Then Exit Sub
- Case DIR_DOWNLEFT
- If GetPlayerY(index) = Map(GetPlayerMap(index)).MaxY And GetPlayerX(index) = 0 Then Exit Sub
- Case DIR_DOWNRIGHT
- If GetPlayerY(index) = Map(GetPlayerMap(index)).MaxY And GetPlayerX(index) = Map(GetPlayerMap(index)).MaxX Then Exit Sub
- End Select
- PlayerMove index, Direction, movement, True
- End Sub
- Sub CheckEquippedItems(ByVal index As Long)
- Dim Slot As Long
- Dim ItemNum As Integer
- Dim i As Long
- ' We want to check incase an admin takes away an object but they had it equipped
- For i = 1 To Equipment.Equipment_Count - 1
- ItemNum = GetPlayerEquipment(index, i)
- If ItemNum > 0 Then
- If Not Item(ItemNum).Type = ITEM_TYPE_EQUIPMENT Or Not Item(ItemNum).EquipSlot = i Then SetPlayerEquipment index, 0, i
- Else
- SetPlayerEquipment index, 0, i
- End If
- Next
- End Sub
- Function FindOpenInvSlot(ByVal index As Long, ByVal ItemNum As Long) As Long
- Dim i As Long
- ' Check for subscript out of range
- If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then Exit Function
- If Item(ItemNum).Stackable = 1 Then
- ' If currency then check to see if they already have an instance of the item and add it to that
- For i = 1 To MAX_INV
- If GetPlayerInvItemNum(index, i) = ItemNum Then
- FindOpenInvSlot = i
- Exit Function
- End If
- Next
- End If
- For i = 1 To MAX_INV
- ' Try to find an open free slot
- If GetPlayerInvItemNum(index, i) = 0 Then
- FindOpenInvSlot = i
- Exit Function
- End If
- Next
- End Function
- Function FindOpenBankSlot(ByVal index As Long, ByVal ItemNum As Integer) As Byte
- Dim i As Long
- ' Check for subscript out of range
- If Not IsPlaying(index) Or ItemNum < 1 Or ItemNum > MAX_ITEMS Then Exit Function
- If Not Item(ItemNum).Type = ITEM_TYPE_EQUIPMENT Then
- For i = 1 To MAX_BANK
- If GetPlayerBankItemNum(index, i) = ItemNum Then
- FindOpenBankSlot = i
- Exit Function
- End If
- Next
- End If
- For i = 1 To MAX_BANK
- If GetPlayerBankItemNum(index, i) = 0 Then
- FindOpenBankSlot = i
- Exit Function
- End If
- Next
- End Function
- Function HasItem(ByVal index As Long, ByVal ItemNum As Integer) As Long
- Dim i As Long
- ' Check for subscript out of range
- If IsPlaying(index) = False Or ItemNum < 1 Or ItemNum > MAX_ITEMS Then Exit Function
- For i = 1 To MAX_INV
- ' Check to see if the player has the item
- If GetPlayerInvItemNum(index, i) = ItemNum Then
- If Item(ItemNum).Stackable = 1 Then
- HasItem = GetPlayerInvItemValue(index, i)
- Exit Function
- End If
- End If
- Next
- End Function
- Function TakeInvItem(ByVal index As Long, ByVal ItemNum As Integer, ByVal ItemVal As Long, Optional Update As Boolean = True) As Boolean
- Dim i As Long, II As Long, NPCNum As Long
- Dim n As Long
- Dim Parse() As String
- ' Check for subscript out of range
- If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then Exit Function
- For i = 1 To MAX_INV
- ' Check to see if the player has the item
- If GetPlayerInvItemNum(index, i) = ItemNum Then
- If Item(ItemNum).Stackable = 1 Then
- ' Is what we are trying to take away more then what they have? If so just set it to zero
- If ItemVal >= GetPlayerInvItemValue(index, i) Then
- TakeInvItem = True
- Else
- Call SetPlayerInvItemValue(index, i, GetPlayerInvItemValue(index, i) - ItemVal)
-
- If Update Then Call SendInventoryUpdate(index, i)
-
- 'check quests
- For II = 1 To MAX_QUESTS
- Parse() = Split(HasQuestItems(index, II, True), "|")
- If UBound(Parse()) > 0 Then
- NPCNum = Parse(0)
- If NPCNum > 0 Then
- Call SendShowTaskCompleteOnNPC(index, NPCNum, False)
- End If
- End If
- Next II
-
- Exit Function
- End If
- Else
- TakeInvItem = True
- End If
- If TakeInvItem Then
- Call SetPlayerInvItemNum(index, i, 0)
- Call SetPlayerInvItemValue(index, i, 0)
- Call SetPlayerInvItemDur(index, i, 0)
- Call SetPlayerInvItemBind(index, i, 0)
- End If
- End If
- Next
-
- 'check quests
- For II = 1 To MAX_QUESTS
- Parse() = Split(HasQuestItems(index, II, True), "|")
- If UBound(Parse()) > 0 Then
- NPCNum = Parse(0)
- If NPCNum > 0 Then
- Call SendShowTaskCompleteOnNPC(index, NPCNum, False)
- End If
- End If
- Next II
-
- ' Send the inventory update
- If Update Then Call SendInventory(index)
- End Function
- Function TakeInvSlot(ByVal index As Long, ByVal InvSlot As Byte, ByVal ItemVal As Long, Optional ByVal Update As Boolean = True) As Boolean
- Dim i As Long
- Dim n As Long
- Dim ItemNum As Integer
- ' Check for subscript out of range
- If IsPlaying(index) = False Or InvSlot < 1 Or InvSlot > MAX_ITEMS Then Exit Function
-
- ItemNum = GetPlayerInvItemNum(index, InvSlot)
- ' Prevent subscript out of range
- If ItemNum < 1 Then Exit Function
-
- If Item(ItemNum).Stackable = 1 Then
- ' Is what we are trying to take away more then what they have? If so just set it to zero
- If ItemVal >= GetPlayerInvItemValue(index, InvSlot) Then
- TakeInvSlot = True
- Else
- Call SetPlayerInvItemValue(index, InvSlot, GetPlayerInvItemValue(index, InvSlot) - ItemVal)
-
- ' Send the inventory update
- If Update Then
- Call SendInventoryUpdate(index, InvSlot)
- End If
- Exit Function
- End If
- Else
- TakeInvSlot = True
- End If
- If TakeInvSlot Then
- Call SetPlayerInvItemNum(index, InvSlot, 0)
- Call SetPlayerInvItemValue(index, InvSlot, 0)
- Call SetPlayerInvItemDur(index, InvSlot, 0)
- Call SetPlayerInvItemBind(index, InvSlot, 0)
-
- ' Send the inventory update
- If Update Then
- Call SendInventoryUpdate(index, InvSlot)
- End If
- End If
- End Function
- Function GiveInvItem(ByVal index As Long, ByVal ItemNum As Integer, ByVal ItemVal As Long, Optional ByVal ItemDur As Integer = -1, Optional ByVal ItemBind As Integer = 0, Optional ByVal SendUpdate As Boolean = True) As Byte
- Dim i As Long, II As Long, NPCNum As Long
- ' Check for subscript out of range
- If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then Exit Function
- i = FindOpenInvSlot(index, ItemNum)
- ' Check to see if inventory is full
- If i > 0 And i <= MAX_INV Then
- If CDec(GetPlayerInvItemValue(index, i)) + CDec(ItemVal) > 2147483468 Then
- Call PlayerMsg(index, "Cannot give it to you - it exceeds maximum limit!", BrightRed)
- GiveInvItem = 0
- Exit Function
- Else
- Call SetPlayerInvItemNum(index, i, ItemNum)
- Call SetPlayerInvItemValue(index, i, GetPlayerInvItemValue(index, i) + ItemVal)
- End If
-
- If Item(GetPlayerInvItemNum(index, i)).Type = ITEM_TYPE_EQUIPMENT Then
- If ItemDur = -1 Then
- Call SetPlayerInvItemDur(index, i, Item(ItemNum).Data1)
- Else
- Call SetPlayerInvItemDur(index, i, ItemDur)
- End If
- End If
-
- If ItemBind = BIND_ON_PICKUP Or Item(GetPlayerInvItemNum(index, i)).BindType = BIND_ON_PICKUP Then
- Call SetPlayerInvItemBind(index, i, BIND_ON_PICKUP)
- ElseIf ItemBind = BIND_ON_EQUIP Or Item(GetPlayerInvItemNum(index, i)).BindType = BIND_ON_EQUIP Then
- Call SetPlayerInvItemBind(index, i, BIND_ON_EQUIP)
- Else
- Call SetPlayerInvItemBind(index, i, 0)
- End If
-
- If SendUpdate Then Call SendInventoryUpdate(index, i)
- GiveInvItem = True
-
- 'check quests
- For II = 1 To MAX_QUESTS
- NPCNum = HasQuestItems(index, II)
- If NPCNum > 0 Then
- Call SendShowTaskCompleteOnNPC(index, NPCNum, True)
- End If
- Next II
- Else
- Call PlayerMsg(index, "Your inventory is full!", BrightRed)
- End If
-
- GiveInvItem = i
- End Function
- Function HasSpell(ByVal index As Long, ByVal SpellNum As Long) As Boolean
- Dim i As Long
- For i = 1 To MAX_PLAYER_SPELLS
- If GetPlayerSpell(index, i) = SpellNum Then
- HasSpell = True
- Exit Function
- End If
- Next
- End Function
- Function FindOpenSpellSlot(ByVal index As Long) As Long
- Dim i As Long
- For i = 1 To MAX_PLAYER_SPELLS
- If GetPlayerSpell(index, i) = 0 Then
- FindOpenSpellSlot = i
- Exit Function
- End If
- Next
- End Function
- Sub PlayerMapGetItem(ByVal index As Long, ByVal i As Long)
- Dim n As Long
- Dim MapNum As Integer
- Dim Msg As String
- Dim tempVal As Variant
- Dim ItemNum As Long, Value As Long, Dur As Long, Bind As Long
-
- ' Check for subscript out of range
- If Not IsPlaying(index) Then Exit Sub
-
- MapNum = GetPlayerMap(index)
- ' See if there's even an item here
- If (MapItem(MapNum, i).Num > 0) And (MapItem(MapNum, i).Num <= MAX_ITEMS) Then
- ' Can we pick the item up?
- If CanPlayerPickupItem(index, i) Then
- ' Check if item is at the same location as the player
- If (MapItem(MapNum, i).X = GetPlayerX(index)) Then
- If (MapItem(MapNum, i).Y = GetPlayerY(index)) Then
- ItemNum = MapItem(MapNum, i).Num
- Value = MapItem(MapNum, i).Value
- Dur = MapItem(MapNum, i).Durability
- Bind = Item(ItemNum).BindType
- If Value > 0 Then
- Msg = Value & " " & Trim$(Item(ItemNum).Name)
- Else
- Msg = Trim$(Item(ItemNum).Name)
- End If
-
- 'sure made this a lot simpler than it was, removing roughly 30 lines of code in exchange for 5. It could be done in 1 line
- 'but I chose to make it pretty and easy to debug had something went wrong.
- Call GiveInvItem(index, ItemNum, Value, Dur, Bind, True)
-
- ' Erase the item from the map
- MapItem(MapNum, i).Num = 0
- MapItem(MapNum, i).Value = 0
- MapItem(MapNum, i).Durability = 0
- MapItem(MapNum, i).X = 0
- MapItem(MapNum, i).Y = 0
-
- Call SendInventoryUpdate(index, n)
- Call SpawnItemSlot(i, 0, 0, 0, GetPlayerMap(index), 0, 0)
- SendActionMsg GetPlayerMap(index), Msg, Yellow, 1, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32)
- End If
- End If
- End If
- End If
- End Sub
- Function CanPlayerPickupItem(ByVal index As Long, ByVal MapItemNum As Integer)
- Dim MapNum As Integer
- MapNum = GetPlayerMap(index)
-
- ' Check for subscript out of range
- If MapNum < 1 Or MapNum > MAX_MAPS Then Exit Function
-
- If Moral(Map(MapNum).Moral).CanPickupItem = 1 Then
- ' No lock or locked to player?
- If Trim$(MapItem(MapNum, MapItemNum).playerName) = vbNullString Or Trim$(MapItem(MapNum, MapItemNum).playerName) = GetPlayerName(index) Then
- CanPlayerPickupItem = True
- Exit Function
- End If
- End If
- End Function
- Sub PlayerMapDropItem(ByVal index As Long, ByVal InvNum As Byte, ByVal Amount As Long)
- Dim i As Long
- Dim Msg As String
-
- If (GetPlayerInvItemNum(index, InvNum) <= MAX_ITEMS) Then
- i = FindOpenMapItemSlot(GetPlayerMap(index))
- If Not i = 0 Then
- MapItem(GetPlayerMap(index), i).Num = GetPlayerInvItemNum(index, InvNum)
- MapItem(GetPlayerMap(index), i).X = GetPlayerX(index)
- MapItem(GetPlayerMap(index), i).Y = GetPlayerY(index)
- MapItem(GetPlayerMap(index), i).playerName = Trim$(GetPlayerName(index))
- MapItem(GetPlayerMap(index), i).PlayerTimer = timeGetTime + ITEM_SPAWN_TIME
- MapItem(GetPlayerMap(index), i).CanDespawn = True
- MapItem(GetPlayerMap(index), i).DespawnTimer = timeGetTime + ITEM_DESPAWN_TIME
- If Item(GetPlayerInvItemNum(index, InvNum)).Type = ITEM_TYPE_EQUIPMENT Then
- MapItem(GetPlayerMap(index), i).Durability = GetPlayerInvItemDur(index, InvNum)
- Else
- MapItem(GetPlayerMap(index), i).Durability = 0
- End If
-
- If Item(GetPlayerInvItemNum(index, InvNum)).Stackable = 1 Then
- ' Check if its more then they have and if so drop it all
- If Amount >= GetPlayerInvItemValue(index, InvNum) Then
- MapItem(GetPlayerMap(index), i).Value = GetPlayerInvItemValue(index, InvNum)
- Msg = GetPlayerInvItemValue(index, InvNum) & " " & Trim$(Item(GetPlayerInvItemNum(index, InvNum)).Name)
-
- Call TakeInvSlot(index, InvNum, GetPlayerInvItemValue(index, InvNum), True)
- Else
- MapItem(GetPlayerMap(index), i).Value = Amount
- Msg = Amount & " " & Trim$(Item(GetPlayerInvItemNum(index, InvNum)).Name)
- Call TakeInvSlot(index, InvNum, Amount, True)
- End If
- Else
- ' It's not a currency object so this is easy
- Msg = Trim$(Item(GetPlayerInvItemNum(index, InvNum)).Name)
- MapItem(GetPlayerMap(index), i).Value = 0
- Call TakeInvSlot(index, InvNum, Amount, True)
- End If
-
- ' Send message
- SendActionMsg GetPlayerMap(index), Msg, BrightRed, 1, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32)
- ' Spawn the item before we set the num or we'll get a different free map item slot
- Call SpawnItemSlot(i, MapItem(GetPlayerMap(index), i).Num, Amount, MapItem(GetPlayerMap(index), i).Durability, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index))
- Else
- Call PlayerMsg(index, "There are too many items on the ground to drop anything else.", BrightRed)
- End If
- End If
- End Sub
- Sub CheckPlayerLevelUp(ByVal index As Long)
- Dim i As Long
- Dim ExpRollOver As Long
- Dim Level_Count As Long
- If GetPlayerLeve…
Large files files are truncated, but you can click here to view the full file