22-06-2008, 01:37 AM
Cards
By Jsventor
Difficulty: 2/5 Should be easy to add
Start With Server Side!
In Mod Types, Add this stuff in the appropriate places.
Under;
Add;
Add this sun to the bottom of ModGameLogic;
Under;
Add;
In ModServerTCP Add;
In Sub Handledata add these to the top;
Add these packets in handledata;
Above CASE_ITEM_TYPE_SPELL in Handledata add;
Add this packet;
In ModDatabase add;
And;
Now, in your server folder, make a new Folder and call it "Cards"
[size=15pt]
Client Side![/size]
Put these in the apprpriate spots in ModTypes
In ModGlobals
Packets to put in Sub HandelData;
New Edit
Description, instead of making it load separate files from a folder, I made it work like the rest of the GFX, with this it will Blt from a surface
Ok, this is all Client side!
In sub InitDirectX Add this before the end sub,
Ok, now add this in sub DestroyDirectX
In the top of Mod DirectX under Option Explicit add these,
Ok now, change
To
In FrmCardEditor add a timer, name it whatever you want, set its interval to 50 and enabled = true, in it add this..
Now add this at the bottom of ModGameLogic
Now search for "displaycard" and replace that with this,
Now add this at the bottom of ModGameLogic
And last but not least, add these in modTypes
So now you can change the size of cards
Now add this image in your GFX folder!
![[Image: cardslg8.png]](http://img157.imageshack.us/img157/5741/cardslg8.png)
![[Image: cardshowoffmz2.png]](http://img505.imageshack.us/img505/2593/cardshowoffmz2.png)
![[Image: cardshowoof2pd5.png]](http://img88.imageshack.us/img88/5040/cardshowoof2pd5.png)
![[Image: showoof3uq7.png]](http://img507.imageshack.us/img507/3678/showoof3uq7.png)
![[Image: showoff4wk1.png]](http://img84.imageshack.us/img84/5914/showoff4wk1.png)
ENJOY!
By Jsventor
Difficulty: 2/5 Should be easy to add

Start With Server Side!
In Mod Types, Add this stuff in the appropriate places.
Code:
Public Const MAX_CARDS = 100
Code:
Public Const ITEM_TYPE_CARD = 14
Code:
Type CardRec
Name As String
Description As String
HPTake As Long
MPTake As Long
SPTake As Long
HPGive As Long
MPGive As Long
SPGive As Long
ExpGive As Long
ItemTake As Long
ItemTakeDur As Long
ItemTakeVal As Long
ItemGive As Long
ItemGiveDur As Long
ItemGiveVal As Long
Rarity As Long
Picture As Long
Map As Long
X As Long
Y As Long
End Type
Code:
Public Card(1 To MAX_CARDS) As CardRec
Under;
Code:
Call SendNpcs(Index)
Add;
Code:
Call SendCards(Index)
Add this sun to the bottom of ModGameLogic;
Code:
Sub UseCard(ByVal Index As Long, ByVal CardNum As Long, InvNum As Long)
Call PlayerMsg(Index, "You attempt to use card number " & CardNum & ", " & Card(CardNum).Name, Yellow)
Dim HP As Long
Dim MP As Long
Dim SP As Long
Dim EXP As Long
Dim HPTake As Long
Dim MPTake As Long
Dim SPTake As Long
Dim HPGive As Long
Dim MPGive As Long
Dim SPGive As Long
Dim MapNum As Long
Dim X As Long
Dim Y As Long
MapNum = Card(CardNum).Map
X = Card(CardNum).X
Y = Card(CardNum).Y
HP = GetPlayerHP(Index)
MP = GetPlayerMP(Index)
SP = GetPlayerSP(Index)
EXP = GetPlayerExp(Index)
HPTake = Card(CardNum).HPTake
HPGive = Card(CardNum).HPGive
MPTake = Card(CardNum).MPTake
MPGive = Card(CardNum).MPGive
SPTake = Card(CardNum).SPTake
SPGive = Card(CardNum).SPGive
If HP < HPTake Or MP < MPTake Or SP < SPTake Then
Call PlayerMsg(Index, "You do not have what it takes to use this card!", BrightRed)
Exit Sub
End If
If Card(CardNum).HPTake > 0 Then
Call SetPlayerHP(Index, HP - Card(CardNum).HPTake / 4)
Call PlayerMsg(Index, HPTake & " HP Has been taken away!", Red)
Call SendHP(Index)
End If
If Card(CardNum).HPGive > 0 Then
Call SetPlayerHP(Index, HP + Card(CardNum).HPGive / 4)
Call PlayerMsg(Index, HPGive & " HP Has been given!", Green)
Call SendHP(Index)
End If
If Card(CardNum).MPTake > 0 Then
Call SetPlayerMP(Index, MP - Card(CardNum).MPTake / 4)
Call PlayerMsg(Index, MPTake & " MP Has been taken away!", Red)
Call SendMP(Index)
End If
If Card(CardNum).MPGive > 0 Then
Call SetPlayerMP(Index, MP + Card(CardNum).MPGive / 4)
Call PlayerMsg(Index, MPGive & " MP Has been given!", Green)
Call SendMP(Index)
End If
If Card(CardNum).SPTake > 0 Then
Call SetPlayerSP(Index, SP - Card(CardNum).SPTake / 4)
Call PlayerMsg(Index, SPTake & " SP Has been taken away!", Red)
Call SendSP(Index)
End If
If Card(CardNum).SPGive > 0 Then
Call SetPlayerSP(Index, SP + Card(CardNum).SPGive / 4)
Call PlayerMsg(Index, SPGive & " SP Has been given!", Green)
Call SendSP(Index)
End If
If Card(CardNum).ExpGive > 0 Then
Call SetPlayerExp(Index, EXP + Card(CardNum).ExpGive)
Call PlayerMsg(Index, HPGive & " EXP Has been given!", Green)
End If
'Warping
If MapNum > 0 And X > 0 And Y > 0 Then
Call PlayerWarp(Index, MapNum, X, Y)
Call PlayerMsg(Index, "You have warped to " & Map(MapNum).Name, Blue)
End If
'Give Item
If Item(Card(CardNum).ItemGive).Type ITEM_TYPE_CURRENCY Then
Call Give_Item(Index, Card(CardNum).ItemGive, Card(CardNum).ItemGiveDur)
Call PlayerMsg(Index, "You have gained a " & Item(Card(CardNum).ItemGive).Name, Green)
Else
If Item(Card(CardNum).ItemGive).Type = ITEM_TYPE_CURRENCY Then
Call GiveItem(Index, Card(CardNum).ItemGive, Card(CardNum).ItemGiveVal)
Call PlayerMsg(Index, "You have gained " & Card(CardNum).ItemGiveVal & " Of " & Item(Card(CardNum).ItemGive).Name, Green)
End If
Call SendInventory(Index)
End If
'Take item
If Item(Card(CardNum).ItemTake).Type ITEM_TYPE_CURRENCY Then
Call TakeItem(Index, Card(CardNum).ItemTake, 1)
Call PlayerMsg(Index, "You have lost a " & Item(Card(CardNum).ItemTake).Name, Green)
Else
If Item(Card(CardNum).ItemGive).Type = ITEM_TYPE_CURRENCY Then
Call TakeItem(Index, Card(CardNum).ItemTake, Card(CardNum).ItemGiveVal)
Call PlayerMsg(Index, "You have glost " & Card(CardNum).ItemTakeVal & " Of " & Item(Card(CardNum).ItemTake).Name, Green)
End If
Call SendInventory(Index)
End If
Call TakeItem(Index, GetPlayerInvItemNum(Index, InvNum), 0)
Call CloseCard(Index)
End Sub
Under;
Code:
Call LoadNpcs
Add;
Code:
Call SetStatus("Loading Cards...")
Call LoadCards
In ModServerTCP Add;
Code:
Sub SendCards(ByVal Index As Long)
Dim Packet As String
Dim i As Long
For i = 1 To MAX_CARDS
If Trim(Card(i).Name) "" Then
Call SendUpdateCardTo(Index, i)
End If
Next i
End Sub
Code:
Sub SendUpdateCardToAll(ByVal CardNum As Long)
Dim Packet As String
Packet = "UPDATECARD" & SEP_CHAR & CardNum & SEP_CHAR & Trim(Card(CardNum).Name) & SEP_CHAR & Trim(Card(CardNum).Description) & SEP_CHAR & Card(CardNum).HPTake & SEP_CHAR & Card(CardNum).MPTake & SEP_CHAR & Card(CardNum).SPTake & SEP_CHAR & Card(CardNum).HPGive & SEP_CHAR & Card(CardNum).MPGive & SEP_CHAR & Card(CardNum).SPGive & SEP_CHAR & Card(CardNum).ExpGive & SEP_CHAR & Card(CardNum).ItemTake & SEP_CHAR & Card(CardNum).ItemTakeDur & SEP_CHAR & Card(CardNum).ItemTakeVal & SEP_CHAR & Card(CardNum).ItemGive & SEP_CHAR & Card(CardNum).ItemGiveDur & SEP_CHAR & Card(CardNum).ItemGiveVal & SEP_CHAR & Card(CardNum).Rarity & SEP_CHAR & Card(CardNum).Picture & SEP_CHAR & Card(CardNum).Map & SEP_CHAR & Card(CardNum).X & SEP_CHAR & Card(CardNum).Y & END_CHAR
Call SendDataToAll(Packet)
End Sub
Code:
Sub SendUpdateCardTo(ByVal Index As Long, ByVal CardNum As Long)
Dim Packet As String
Packet = "UPDATECARD" & SEP_CHAR & CardNum & SEP_CHAR & Trim(Card(CardNum).Name) & SEP_CHAR & Trim(Card(CardNum).Description) & SEP_CHAR & Card(CardNum).HPTake & SEP_CHAR & Card(CardNum).MPTake & SEP_CHAR & Card(CardNum).SPTake & SEP_CHAR & Card(CardNum).HPGive & SEP_CHAR & Card(CardNum).MPGive & SEP_CHAR & Card(CardNum).SPGive & SEP_CHAR & Card(CardNum).ExpGive & SEP_CHAR & Card(CardNum).ItemTake & SEP_CHAR & Card(CardNum).ItemTakeDur & SEP_CHAR & Card(CardNum).ItemTakeVal & SEP_CHAR & Card(CardNum).ItemGive & SEP_CHAR & Card(CardNum).ItemGiveDur & SEP_CHAR & Card(CardNum).ItemGiveVal & SEP_CHAR & Card(CardNum).Rarity & SEP_CHAR & Card(CardNum).Picture & SEP_CHAR & Card(CardNum).Map & SEP_CHAR & Card(CardNum).X & SEP_CHAR & Card(CardNum).Y & END_CHAR
Call SendDataTo(Index, Packet)
End Sub
Sub SendDisplayCard(ByVal Index As Long, ByVal CardNum As Long, InvNum As Long)
Dim Packet As String
Packet = "DISPLAYCARD" & SEP_CHAR & CardNum & SEP_CHAR & InvNum & SEP_CHAR & Trim(Card(CardNum).Name) & SEP_CHAR & Trim(Card(CardNum).Description) & SEP_CHAR & Card(CardNum).Rarity & SEP_CHAR & Card(CardNum).Picture & END_CHAR
Call SendDataTo(Index, Packet)
End Sub
Code:
Sub SendEditCardTo(ByVal Index As Long, ByVal CardNum As Long)
Dim Packet As String
Packet = "EDITCARD" & SEP_CHAR & CardNum & SEP_CHAR & Trim(Card(CardNum).Name) & SEP_CHAR & Trim(Card(CardNum).Description) & SEP_CHAR & Card(CardNum).HPTake & SEP_CHAR & Card(CardNum).MPTake & SEP_CHAR & Card(CardNum).SPTake & SEP_CHAR & Card(CardNum).HPGive & SEP_CHAR & Card(CardNum).MPGive & SEP_CHAR & Card(CardNum).SPGive & SEP_CHAR & Card(CardNum).ExpGive & SEP_CHAR & Card(CardNum).ItemTake & SEP_CHAR & Card(CardNum).ItemTakeDur & SEP_CHAR & Card(CardNum).ItemTakeVal & SEP_CHAR & Card(CardNum).ItemGive & SEP_CHAR & Card(CardNum).ItemGiveDur & SEP_CHAR & Card(CardNum).ItemGiveVal & SEP_CHAR & Card(CardNum).Rarity & SEP_CHAR & Card(CardNum).Picture & SEP_CHAR & Card(CardNum).Map & SEP_CHAR & Card(CardNum).X & SEP_CHAR & Card(CardNum).Y & END_CHAR
Call SendDataTo(Index, Packet)
End Sub
Code:
Sub CloseCard(ByVal Index As Long)
Dim Packet As String
Packet = "CLOSECARD" & END_CHAR
Call SendDataTo(Index, Packet)
End Sub
In Sub Handledata add these to the top;
Code:
Dim CardNum As Long
Dim HP As Long
Dim MP As Long
Dim SP As Long
Dim EXP As Long
Dim HPTake As Long
Dim MPTake As Long
Dim SPTake As Long
Dim HPGive As Long
Dim MPGive As Long
Dim SPGive As Long
Add these packets in handledata;
Code:
If LCase(Parse(0)) = "discardcard" Then
CardNum = Val(Parse(1))
InvNum = Val(Parse(2))
Call TakeItem(Index, GetPlayerInvItemNum(Index, InvNum), 0)
Call CloseCard(Index)
Call PlayerMsg(Index, "You have discarded " & Card(CardNum).Name, BrightRed)
Exit Sub
End If
' :::::::::::::::::::::
' :: Use card packet ::
' :::::::::::::::::::::
If LCase(Parse(0)) = "usecard" Then
CardNum = Val(Parse(1))
InvNum = Val(Parse(2))
' Prevent hacking
If CardNum MAX_CARDS Then
Call HackingAttempt(Index, "Invalid cardNum")
Exit Sub
End If
Call UseCard(Index, CardNum, InvNum)
Exit Sub
End If
Above CASE_ITEM_TYPE_SPELL in Handledata add;
Code:
Case ITEM_TYPE_CARD
' Get the Card num
n = Item(GetPlayerInvItemNum(Index, InvNum)).Data1
If n > 0 Then
Call PlayerMsg(Index, "You Have Set " & Card(n).Name & " As a card!", Yellow)
Call SendDisplayCard(Index, n, InvNum)
End If
Add this packet;
Code:
' ::::::::::::::::::::::::::::::
' :: Request edit Card packet ::
' ::::::::::::::::::::::::::::::
If LCase(Parse(0)) = "requesteditcard" Then
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
Call HackingAttempt(Index, "Admin Cloning")
Exit Sub
End If
Call SendDataTo(Index, "CARDEDITOR" & END_CHAR)
Exit Sub
End If
Code:
' ::::::::::::::::::::::
' :: Edit Card packet ::
' ::::::::::::::::::::::
If LCase(Parse(0)) = "editcard" Then
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
Call HackingAttempt(Index, "Admin Cloning")
Exit Sub
End If
' The card #
n = Val(Parse(1))
' Prevent hacking
If n < 0 Or n > MAX_CARDS Then
Call HackingAttempt(Index, "Invalid Card Index")
Exit Sub
End If
Call AddLog(GetPlayerName(Index) & " editing card #" & n & ".", ADMIN_LOG)
Call SendEditCardTo(Index, n)
End If
Code:
' ::::::::::::::::::::::
' :: Save card packet ::
' ::::::::::::::::::::::
If LCase(Parse(0)) = "savecard" Then
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
Call HackingAttempt(Index, "Admin Cloning")
Exit Sub
End If
n = Val(Parse(1))
If n < 0 Or n > MAX_CARDS Then
Call HackingAttempt(Index, "Invalid card Index")
Exit Sub
End If
' Update the item
Card(n).Name = Parse(2)
Card(n).Description = Parse(3)
Card(n).HPTake = Val(Parse(4))
Card(n).MPTake = Val(Parse(5))
Card(n).SPTake = Val(Parse(6))
Card(n).HPGive = Val(Parse(7))
Card(n).MPGive = Val(Parse(8))
Card(n).SPGive = Val(Parse(9))
Card(n).ExpGive = Val(Parse(10))
Card(n).ItemTake = Val(Parse(11))
Card(n).ItemTakeDur = Val(Parse(12))
Card(n).ItemTakeVal = Val(Parse(13))
Card(n).ItemGive = Val(Parse(14))
Card(n).ItemGiveDur = Val(Parse(15))
Card(n).ItemGiveVal = Val(Parse(16))
Card(n).Rarity = Val(Parse(17))
Card(n).Picture = Val(Parse(18))
Card(n).Map = Val(Parse(19))
Card(n).X = Val(Parse(20))
Card(n).Y = Val(Parse(21))
' Save it
Call SendUpdateCardToAll(n)
Call SaveCard(n)
Call AddLog(GetPlayerName(Index) & " saved card #" & n & ".", ADMIN_LOG)
Exit Sub
End If
In ModDatabase add;
Code:
Sub SaveCards()
Dim i As Long
For i = 1 To MAX_CARDS
Call SaveCard(i)
Next i
End Sub
And;
Code:
Sub SaveCard(ByVal CardNum As Long)
Dim FileName As String
Dim f As Long
FileName = App.Path & "\Cards\Card" & CardNum & ".GXL"
f = FreeFile
Open FileName For Binary As #f
Put #f, , Card(CardNum)
Close #f
End Sub
Code:
Sub CheckCards()
Dim i As Long
For i = 1 To MAX_CARDS
If Not FileExist("Cards\Card" & i & ".GXL") Then
Call SaveCards
End If
Next
End Sub
Code:
Sub LoadCards()
Dim FileName As String
Dim i As Long
Dim f As Long
Call CheckCards
For i = 1 To MAX_CARDS
Call SetStatus("Loading cards... " & Int((i / MAX_CARDS) * 100) & "%")
FileName = App.Path & "\Cards\Card" & i & ".GXL"
f = FreeFile
Open FileName For Binary As #f
Get #f, , Card(i)
Close #f
DoEvents
Next
End Sub
Now, in your server folder, make a new Folder and call it "Cards"
[size=15pt]
Client Side![/size]
Put these in the apprpriate spots in ModTypes
Code:
Public Const MAX_CARDS = 100
Code:
Public Const ITEM_TYPE_CARD = 14
In ModGlobals
Code:
Public InCardEditor As Boolean
Code:
Public Card(1 To MAX_CARDS) As CardRec
Packets to put in Sub HandelData;
Code:
If (LCase(Parse(0)) = "closecard") Then
frmMirage.lblCardInv.Caption = vbNullString
frmMirage.lblcardNum.Caption = vbNullString
frmMirage.CardName.Caption = vbNullString
frmMirage.Desc.Caption = vbNullString
frmMirage.lblrarity.Caption = vbNullString
frmMirage.picCard.Visible = False
Exit Sub
End If
'Display Card Packet
If (LCase(Parse(0)) = "displaycard") Then
n = Val(Parse(1))
If n MAX_CARDS Then
Exit Sub
End If
InvNum = Val(Parse(2))
Dim JPIC As Long
' Update the item
frmMirage.lblcardNum.Caption = n
frmMirage.lblCardInv.Caption = InvNum
frmMirage.CardName.Caption = Parse(3)
frmMirage.Desc.Caption = Parse(4)
frmMirage.lblrarity.Caption = Val(Parse(5))
JPIC = Val(Parse(6))
If FileExist("gfx\Cards\" & JPIC & ".bmp") Then
frmMirage.picCard.Picture = LoadPicture(App.Path & "\gfx\Cards\" & JPIC & ".bmp")
End If
frmMirage.picCard.Visible = True
Exit Sub
End If
' ::::::::::::::::::::::::
' :: card editor packet ::
' ::::::::::::::::::::::::
If (LCase(Parse(0)) = "cardeditor") Then
InCardEditor = True
frmIndex.Show
frmIndex.lstIndex.Clear
' Add the names
For i = 1 To MAX_CARDS
frmIndex.lstIndex.AddItem i & ": " & Trim(Card(i).Name)
Next i
frmIndex.lstIndex.ListIndex = 0
Exit Sub
End If
' ::::::::::::::::::::::::
' :: Update Card packet ::
' ::::::::::::::::::::::::
If (LCase(Parse(0)) = "updatecard") Then
n = Val(Parse(1))
' Update the card
Card(n).Name = Parse(2)
Card(n).Description = Parse(3)
Card(n).HPTake = Val(Parse(4))
Card(n).MPTake = Val(Parse(5))
Card(n).SPTake = Val(Parse(6))
Card(n).HPGive = Val(Parse(7))
Card(n).MPGive = Val(Parse(8))
Card(n).SPGive = Val(Parse(9))
Card(n).expGive = Val(Parse(10))
Card(n).ItemTake = Val(Parse(11))
Card(n).ItemTakeDur = Val(Parse(12))
Card(n).ItemTakeVal = Val(Parse(13))
Card(n).ItemGive = Val(Parse(14))
Card(n).ItemGiveDur = Val(Parse(15))
Card(n).ItemGiveVal = Val(Parse(16))
Card(n).Rarity = Val(Parse(17))
Card(n).Picture = Val(Parse(18))
Card(n).Map = Val(Parse(19))
Card(n).X = Val(Parse(20))
Card(n).Y = Val(Parse(21))
Exit Sub
End If
' ::::::::::::::::::::::
' :: Edit card packet :: 0 And X > 0 And Y > 0 Then
Call PlayerWarp(Index, MapNum, X, Y)
Call PlayerMsg(Index, "You have warped to " & Map(MapNum).Name, Blue)
End If
'Give Item
If Not HasItem(Index, Card(CardNum).ItemGive) And Card(CardNum).ItemGive = 0 Then
Call PlayerMsg(Index, "You do not have the proper item needed for this card!", BrightBlue)
Exit Sub
End If
If Item(Card(CardNum).ItemGive).Type ITEM_TYPE_CURRENCY Then
Call Give_Item(Index, Card(CardNum).ItemGive, Card(CardNum).ItemGiveDur)
Call PlayerMsg(Index, "You have gained a " & Item(Card(CardNum).ItemGive).Name, Green)
Else
If Item(Card(CardNum).ItemGive).Type = ITEM_TYPE_CURRENCY Then
Call GiveItem(Index, Card(CardNum).ItemGive, Card(CardNum).ItemGiveVal)
Call PlayerMsg(Index, "You have gained " & Card(CardNum).ItemGiveVal & " Of " & Item(Card(CardNum).ItemGive).Name, Green)
End If
Call SendInventory(Index)
End If
'Take item
If Not HasItem(Index, Card(CardNum).ItemTake) And Card(CardNum).ItemGive = 0 Then
Call PlayerMsg(Index, "You do not have the proper item needed for this card!", BrightBlue)
Exit Sub
End If
If Item(Card(CardNum).ItemTake).Type ITEM_TYPE_CURRENCY Then
Call TakeItem(Index, Card(CardNum).ItemTake, 1)
Call PlayerMsg(Index, "You have lost a " & Item(Card(CardNum).ItemTake).Name, Green)
Else
If Item(Card(CardNum).ItemGive).Type = ITEM_TYPE_CURRENCY Then
Call TakeItem(Index, Card(CardNum).ItemTake, Card(CardNum).ItemGiveVal)
Call PlayerMsg(Index, "You have glost " & Card(CardNum).ItemTakeVal & " Of " & Item(Card(CardNum).ItemTake).Name, Green)
End If
Call SendInventory(Index)
End If
Call TakeItem(Index, GetPlayerInvItemNum(Index, InvNum), 0)
Call CloseCard(Index)
If GetPlayerHP(Index) = 0 Then
Call KillPlayer(Index, "Card Number " & CardNum & ", " & Card(CardNum).Name)
End If
End Sub
Sub KillPlayer(ByVal Index As Long, Cause As String)
Dim EXP As Long
' Player is dead
Call PlayerMsg(Index, "You have been killed by " & Cause, BrightRed)
' Drop all worn items by Index
If GetPlayerWeaponSlot(Index) > 0 Then
Call PlayerMapDropItem(Index, GetPlayerWeaponSlot(Index), 0)
End If
If GetPlayerArmorSlot(Index) > 0 Then
Call PlayerMapDropItem(Index, GetPlayerArmorSlot(Index), 0)
End If
If GetPlayerHelmetSlot(Index) > 0 Then
Call PlayerMapDropItem(Index, GetPlayerHelmetSlot(Index), 0)
End If
If GetPlayerShieldSlot(Index) > 0 Then
Call PlayerMapDropItem(Index, GetPlayerShieldSlot(Index), 0)
End If
' Calculate exp to give attacker
EXP = Int(GetPlayerExp(Index) / 10)
' Make sure we dont get less then 0
If EXP < 0 Then
EXP = 0
End If
If EXP = 0 Then
Call PlayerMsg(Index, "You lost no experience points.", BrightRed)
Else
Call SetPlayerExp(Index, GetPlayerExp(Index) - EXP)
Call PlayerMsg(Index, "You lost " & EXP & " experience points.", BrightRed)
End If
' Warp player away
Call PlayerWarp(Index, START_MAP, START_X, START_Y)
' Restore vitals
Call SetPlayerHP(Index, GetPlayerMaxHP(Index))
Call SetPlayerMP(Index, GetPlayerMaxMP(Index))
Call SetPlayerSP(Index, GetPlayerMaxSP(Index))
Call SendHP(Index)
Call SendMP(Index)
Call SendSP(Index)
End Sub
New Edit
Description, instead of making it load separate files from a folder, I made it work like the rest of the GFX, with this it will Blt from a surface
Ok, this is all Client side!
In sub InitDirectX Add this before the end sub,
Code:
' Init Card ddsd type and load the bitmap
DDSD_Card.lFlags = DDSD_CAPS
DDSD_Card.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_SYSTEMMEMORY
Set DD_CardSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\cards.bmp", DDSD_Card)
DD_CardSurf.SetColorKey DDCKEY_SRCBLT, key
Ok, now add this in sub DestroyDirectX
Code:
Set DD_CardSurf = Nothing
In the top of Mod DirectX under Option Explicit add these,
Code:
Public DD_CardSurf As DirectDrawSurface7
Public DDSD_Card As DDSURFACEDESC2
Ok now, change
Code:
Private Sub ItemPic_Change()
To
Code:
Private Sub ItemPic_Change()
lblPic.Caption = ItemPic.Value
End Sub
In FrmCardEditor add a timer, name it whatever you want, set its interval to 50 and enabled = true, in it add this..
Code:
Call CardEditorBltCard(frmCardEditor.ItemPic.Value)
Now add this at the bottom of ModGameLogic
Code:
Public Sub CardEditorBltCard(ByVal PicNum As Long)
With rec
.top = ((PicNum) * CARD_Y)
.Bottom = .top + CARD_Y
.Left = 0
.Right = .Left + CARD_X
End With
With rec_pos
.top = 0
.Bottom = CARD_Y
.Left = 0
.Right = CARD_X
End With
DD_CardSurf.BltToDC frmCardEditor.picPic.hDC, rec, rec_pos
frmCardEditor.picPic.Refresh
' If you wanna use BitBlt instead
'Call BitBlt(frmCardEditor.picPic.hDC, 0, 0, CARD_X, CARD_Y, frmCardEditor.picCards.hDC, 0, frmCardEditor.ItemPic.Value * CARD_Y, SRCCOPY)
End Sub
Now search for "displaycard" and replace that with this,
Code:
If (LCase(Parse(0)) = "displaycard") Then
n = Val(Parse(1))
If n MAX_CARDS Then
Exit Sub
End If
InvNum = Val(Parse(2))
Dim JPIC As Long
' Update the item
frmMirage.lblcardNum.Caption = n
frmMirage.lblCardInv.Caption = InvNum
frmMirage.CardName.Caption = Parse(3)
frmMirage.Desc.Caption = Parse(4)
frmMirage.lblrarity.Caption = Val(Parse(5))
JPIC = Val(Parse(6))
frmMirage.picCard.Refresh
Call BltCard(JPIC)
Exit Sub
End If
Now add this at the bottom of ModGameLogic
Code:
Sub BltCard(ByVal PicNum As Long)
frmMirage.picCard.Visible = True
With rec
.top = ((PicNum) * CARD_Y)
.Bottom = .top + CARD_Y
.Left = 0
.Right = .Left + CARD_X
End With
With rec_pos
.top = 0
.Bottom = CARD_Y
.Left = 0
.Right = CARD_X
End With
DD_CardSurf.BltToDC frmMirage.picCard.hDC, rec, rec_pos
frmMirage.picCard.Refresh
End Sub
And last but not least, add these in modTypes
Code:
' card sizes
Public Const CARD_X = 161
Public Const CARD_Y = 225
So now you can change the size of cards

Now add this image in your GFX folder!
![[Image: cardslg8.png]](http://img157.imageshack.us/img157/5741/cardslg8.png)
![[Image: cardshowoffmz2.png]](http://img505.imageshack.us/img505/2593/cardshowoffmz2.png)
![[Image: cardshowoof2pd5.png]](http://img88.imageshack.us/img88/5040/cardshowoof2pd5.png)
![[Image: showoof3uq7.png]](http://img507.imageshack.us/img507/3678/showoof3uq7.png)
![[Image: showoff4wk1.png]](http://img84.imageshack.us/img84/5914/showoff4wk1.png)
ENJOY!