Imports System.Data.SqlClient
Public Class Form
Dim conn As New SqlConnection
Dim cmd As New SqlCommand
Dim rst As SqlDataReader
Dim ItemAdi, SkillAdi As String
Dim i As Integer
Dim BolgeID, Bolge, X, Y, ReSpawn As String
Public Sub Baglan()
If Not conn.State = ConnectionState.Open Then
Try
conn.ConnectionString = "Data Source=(local);Initial Catalog=" & TextBox1.Text & ";MultipleActiveResultSets=True;Integrated Security=True"
conn.Open()
cmd.Connection = conn
Catch ex As Exception
MessageBox.Show("Veritabanına Bağlanılamıyor ! Hata Mesajı : " & vbCrLf & ex.Message)
Application.Exit()
End Try
End If
End Sub
Private Sub Form_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
Application.Exit()
End Sub
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Baglan()
cmd.CommandText = "SELECT * FROM K_NPC"
rst = cmd.ExecuteReader
While rst.Read()
ListBox1.Items.Add((rst("strName")))
End While
cmd.Dispose()
rst.Close()
P1.Value = "100"
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim NPC As String
NPC = ListBox1.Text
If NPC = vbNullString Then
MsgBox("Boş Bir NPC Nin Bilgilerini Okuyamazsınız !", MsgBoxStyle.Critical)
Exit Sub
End If
cmd.CommandText = "SELECT * FROM K_NPC WHERE strName = '" & NPC & "'"
rst = cmd.ExecuteReader()
rst.Read()
Label1.Text = "NPC Adı : " & rst("strName")
If rst("sSize") > "100" Then
Label3.Text = "NPC Boyutu : " & Int(rst("sSize") - 100) & " Daha Büyük"
ElseIf rst("sSize") = "100" Then
Label3.Text = "NPC Boyutu : " & "Normal"
ElseIf rst("sSize") < "100" Then
Label3.Text = "NPC Boyutu : " & Int(100 - rst("sSize")) & " Daha Küçük"
End If
If Not rst("iWeapon1") = "0" Then
SilahBul(rst("iWeapon1"))
Label2.Text = "NPC Silahı : " & ItemAdi
Else
Label2.Text = "NPC Silahı : " & "Silah Yok"
End If
Select Case rst("byGroup")
Case Is = "1"
Label4.Text = "NPC Irkı : Karus"
Case Is = "2"
Label4.Text = "NPC Irkı : El - Morad"
Case Is = "0"
Label4.Text = "NPC Irkı : Tarafsız"
End Select
Select Case rst("byActType")
Case Is = "7"
Label5.Text = "NPC Durumu : Agresif"
Case Is = "1"
Label5.Text = "NPC Durumu : Dost"
Case Is = "0"
Label5.Text = "NPC Durumu : Hareketsiz"
Case Is = "5"
Label5.Text = "NPC Durumu : Saldırgan"
End Select
Label23.Text = "NPC Görevi : EVT & ??"
Select Case rst("ByType")
Case Is = "22"
Label23.Text = "NPC Görevi : Sundries"
Case Is = "21"
Label23.Text = "NPC Görevi : Armor & Weapon & Accesory"
Case Is = "31"
Label23.Text = "NPC Görevi : Inn Hostess"
Case Is = "78"
Label23.Text = "NPC Görevi : Item Rental"
End Select
Label6.Text = "NPC National Point : " & rst("iLoyalty")
Label7.Text = "NPC Level : " & rst("sLevel")
Label8.Text = "NPC National Exp : " & rst("iExp")
Label9.Text = "NPC HP Point : " & rst("iHpPoint")
Label10.Text = "NPC MP Point : " & rst("sMpPoint")
Label11.Text = "NPC Atağı : " & rst("sAtk")
Label12.Text = "NPC Defansı : " & rst("sAc")
SkillAdi = "NPC Skilli : ???"
If Not rst("iMagic1") = "0" Then
SkillBul(rst("iMagic1"))
Label14.Text = "NPC Skilli : " & SkillAdi
Else
Label14.Text = "NPC Skilli : Yok"
End If
Label16.Text = "NPC Flame Resistance : " & rst("sFireR")
Label17.Text = "NPC Light Resistance : " & rst("sLightningR")
Label18.Text = "NPC Ice Resistance : " & rst("sColdR")
Label22.Text = "NPC Magic Resistance : " & rst("sMagicR")
DropDoldur(rst("sSid"))
NPCPos(rst("sSid"))
ZoneBul(BolgeID)
Label19.Text = "NPC Bölgesi : " & Bolge
cmd.Dispose()
rst.Close()
End Sub
Public Sub SilahBul(ByVal ItemKodu As String)
Dim cmd2 As New SqlCommand
Dim rst2 As SqlDataReader
conn.Close()
conn.Open()
cmd2.Connection = conn
cmd2.CommandText = "SELECT strName FROM ITEM WHERE Num = '" & ItemKodu & "'"
rst2 = cmd2.ExecuteReader
rst2.Read()
ItemAdi = rst2("strName")
cmd2.Dispose()
rst2.Close()
Kontrol()
End Sub
Public Sub SkillBul(ByVal SkillKodu As String)
Dim cmd3 As New SqlCommand
Dim rst3 As SqlDataReader
conn.Close()
conn.Open()
cmd3.Connection = conn
cmd3.CommandText = "SELECT EnName FROM MAGIC WHERE MagicNum = '" & SkillKodu & "'"
rst3 = cmd3.ExecuteReader
rst3.Read()
SkillAdi = rst3("EnName")
cmd3.Dispose()
rst3.Close()
Kontrol()
End Sub
Public Sub NPCPos(ByVal sSid As String)
Dim cmd4 As New SqlCommand
Dim rst4 As SqlDataReader
conn.Close()
conn.Open()
cmd4.Connection = conn
Try
cmd4.CommandText = "SELECT * FROM K_NPCPOS WHERE NPCID = '" & sSid & "'"
rst4 = cmd4.ExecuteReader
rst4.Read()
BolgeID = rst4("ZoneID")
X = rst4("LeftX")
Y = rst4("TopZ")
ReSpawn = rst4("RegTime")
Label20.Text = "NPC Kordinatları : " & X & "," & Y
Label21.Text = "NPC ReSpawn : " & ReSpawn & " Saniye"
cmd4.Dispose()
rst4.Close()
Kontrol()
Catch ex As Exception
Label19.Text = "NPC Bölgesi : ???"
Label20.Text = "NPC Kordinatları : ?,?"
Label21.Text = "NPC ReSpawn : ??"
End Try
Kontrol()
End Sub
Public Sub DropDoldur(ByVal sIndex As String)
Dim cmd5 As New SqlCommand
Dim rst5 As SqlDataReader
ListBox2.Items.Clear()
conn.Close()
conn.Open()
cmd5.Connection = conn
cmd5.CommandText = "SELECT * FROM K_NPC_ITEM WHERE sIndex = '" & sIndex & "'"
rst5 = cmd5.ExecuteReader
While rst5.Read
Try
If Not rst5("iItem01") = "0" Then
ListBox2.Items.Add(rst5("iItem01") & " - %" & Int(rst5("sPersent01") / 100))
End If
If Not rst5("iItem02") = "0" Then
ListBox2.Items.Add(rst5("iItem02") & " - %" & Int(rst5("sPersent02") / 100))
End If
If Not rst5("iItem03") = "0" Then
ListBox2.Items.Add(rst5("iItem03") & " - %" & Int(rst5("sPersent03") / 100))
End If
If Not rst5("iItem04") = "0" Then
ListBox2.Items.Add(rst5("iItem04") & " - %" & Int(rst5("sPersent04") / 100))
End If
If Not rst5("iItem05") = "0" Then
ListBox2.Items.Add(rst5("iItem05") & " - %" & Int(rst5("sPersent05") / 100))
End If
Catch ex As Exception
MsgBox("Droplar Okunurken Hata Olustu !", MsgBoxStyle.Critical)
End Try
End While
cmd5.Dispose()
rst5.Close()
Kontrol()
End Sub
Public Sub ZoneBul(ByVal ZoneID As String)
Dim cmd6 As New SqlCommand
Dim rst6 As SqlDataReader
conn.Close()
conn.Open()
Try
cmd6.CommandText = "SELECT * FROM ZONE_INFO WHERE ZoneNo = '" & ZoneID & "'"
cmd6.Connection = conn
rst6 = cmd6.ExecuteReader
rst6.Read()
Bolge = rst6("bz")
Catch ex As Exception
Bolge = "???"
End Try
cmd6.Dispose()
rst6.Close()
Kontrol()
End Sub
Public Sub Kontrol()
conn.Close()
conn.Open()
cmd.Connection = conn
rst = cmd.ExecuteReader
rst.Read()
End Sub
End Class
Kod:Imports System.Data.SqlClient Public Class Form Dim conn As New SqlConnection Dim cmd As New SqlCommand Dim rst As SqlDataReader Dim ItemAdi, SkillAdi As String Dim i As Integer Dim BolgeID, Bolge, X, Y, ReSpawn As String Public Sub Baglan() If Not conn.State = ConnectionState.Open Then Try conn.ConnectionString = "Data Source=(local);Initial Catalog=" & TextBox1.Text & ";MultipleActiveResultSets=True;Integrated Security=True" conn.Open() cmd.Connection = conn Catch ex As Exception MessageBox.Show("Veritabanına Bağlanılamıyor ! Hata Mesajı : " & vbCrLf & ex.Message) Application.Exit() End Try End If End Sub Private Sub Form_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed Application.Exit() End Sub Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Baglan() cmd.CommandText = "SELECT * FROM K_NPC" rst = cmd.ExecuteReader While rst.Read() ListBox1.Items.Add((rst("strName"))) End While cmd.Dispose() rst.Close() P1.Value = "100" End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Dim NPC As String NPC = ListBox1.Text If NPC = vbNullString Then MsgBox("Boş Bir NPC Nin Bilgilerini Okuyamazsınız !", MsgBoxStyle.Critical) Exit Sub End If cmd.CommandText = "SELECT * FROM K_NPC WHERE strName = '" & NPC & "'" rst = cmd.ExecuteReader() rst.Read() Label1.Text = "NPC Adı : " & rst("strName") If rst("sSize") > "100" Then Label3.Text = "NPC Boyutu : " & Int(rst("sSize") - 100) & " Daha Büyük" ElseIf rst("sSize") = "100" Then Label3.Text = "NPC Boyutu : " & "Normal" ElseIf rst("sSize") < "100" Then Label3.Text = "NPC Boyutu : " & Int(100 - rst("sSize")) & " Daha Küçük" End If If Not rst("iWeapon1") = "0" Then SilahBul(rst("iWeapon1")) Label2.Text = "NPC Silahı : " & ItemAdi Else Label2.Text = "NPC Silahı : " & "Silah Yok" End If Select Case rst("byGroup") Case Is = "1" Label4.Text = "NPC Irkı : Karus" Case Is = "2" Label4.Text = "NPC Irkı : El - Morad" Case Is = "0" Label4.Text = "NPC Irkı : Tarafsız" End Select Select Case rst("byActType") Case Is = "7" Label5.Text = "NPC Durumu : Agresif" Case Is = "1" Label5.Text = "NPC Durumu : Dost" Case Is = "0" Label5.Text = "NPC Durumu : Hareketsiz" Case Is = "5" Label5.Text = "NPC Durumu : Saldırgan" End Select Label23.Text = "NPC Görevi : EVT & ??" Select Case rst("ByType") Case Is = "22" Label23.Text = "NPC Görevi : Sundries" Case Is = "21" Label23.Text = "NPC Görevi : Armor & Weapon & Accesory" Case Is = "31" Label23.Text = "NPC Görevi : Inn Hostess" Case Is = "78" Label23.Text = "NPC Görevi : Item Rental" End Select Label6.Text = "NPC National Point : " & rst("iLoyalty") Label7.Text = "NPC Level : " & rst("sLevel") Label8.Text = "NPC National Exp : " & rst("iExp") Label9.Text = "NPC HP Point : " & rst("iHpPoint") Label10.Text = "NPC MP Point : " & rst("sMpPoint") Label11.Text = "NPC Atağı : " & rst("sAtk") Label12.Text = "NPC Defansı : " & rst("sAc") SkillAdi = "NPC Skilli : ???" If Not rst("iMagic1") = "0" Then SkillBul(rst("iMagic1")) Label14.Text = "NPC Skilli : " & SkillAdi Else Label14.Text = "NPC Skilli : Yok" End If Label16.Text = "NPC Flame Resistance : " & rst("sFireR") Label17.Text = "NPC Light Resistance : " & rst("sLightningR") Label18.Text = "NPC Ice Resistance : " & rst("sColdR") Label22.Text = "NPC Magic Resistance : " & rst("sMagicR") DropDoldur(rst("sSid")) NPCPos(rst("sSid")) ZoneBul(BolgeID) Label19.Text = "NPC Bölgesi : " & Bolge cmd.Dispose() rst.Close() End Sub Public Sub SilahBul(ByVal ItemKodu As String) Dim cmd2 As New SqlCommand Dim rst2 As SqlDataReader conn.Close() conn.Open() cmd2.Connection = conn cmd2.CommandText = "SELECT strName FROM ITEM WHERE Num = '" & ItemKodu & "'" rst2 = cmd2.ExecuteReader rst2.Read() ItemAdi = rst2("strName") cmd2.Dispose() rst2.Close() Kontrol() End Sub Public Sub SkillBul(ByVal SkillKodu As String) Dim cmd3 As New SqlCommand Dim rst3 As SqlDataReader conn.Close() conn.Open() cmd3.Connection = conn cmd3.CommandText = "SELECT EnName FROM MAGIC WHERE MagicNum = '" & SkillKodu & "'" rst3 = cmd3.ExecuteReader rst3.Read() SkillAdi = rst3("EnName") cmd3.Dispose() rst3.Close() Kontrol() End Sub Public Sub NPCPos(ByVal sSid As String) Dim cmd4 As New SqlCommand Dim rst4 As SqlDataReader conn.Close() conn.Open() cmd4.Connection = conn Try cmd4.CommandText = "SELECT * FROM K_NPCPOS WHERE NPCID = '" & sSid & "'" rst4 = cmd4.ExecuteReader rst4.Read() BolgeID = rst4("ZoneID") X = rst4("LeftX") Y = rst4("TopZ") ReSpawn = rst4("RegTime") Label20.Text = "NPC Kordinatları : " & X & "," & Y Label21.Text = "NPC ReSpawn : " & ReSpawn & " Saniye" cmd4.Dispose() rst4.Close() Kontrol() Catch ex As Exception Label19.Text = "NPC Bölgesi : ???" Label20.Text = "NPC Kordinatları : ?,?" Label21.Text = "NPC ReSpawn : ??" End Try Kontrol() End Sub Public Sub DropDoldur(ByVal sIndex As String) Dim cmd5 As New SqlCommand Dim rst5 As SqlDataReader ListBox2.Items.Clear() conn.Close() conn.Open() cmd5.Connection = conn cmd5.CommandText = "SELECT * FROM K_NPC_ITEM WHERE sIndex = '" & sIndex & "'" rst5 = cmd5.ExecuteReader While rst5.Read Try If Not rst5("iItem01") = "0" Then ListBox2.Items.Add(rst5("iItem01") & " - %" & Int(rst5("sPersent01") / 100)) End If If Not rst5("iItem02") = "0" Then ListBox2.Items.Add(rst5("iItem02") & " - %" & Int(rst5("sPersent02") / 100)) End If If Not rst5("iItem03") = "0" Then ListBox2.Items.Add(rst5("iItem03") & " - %" & Int(rst5("sPersent03") / 100)) End If If Not rst5("iItem04") = "0" Then ListBox2.Items.Add(rst5("iItem04") & " - %" & Int(rst5("sPersent04") / 100)) End If If Not rst5("iItem05") = "0" Then ListBox2.Items.Add(rst5("iItem05") & " - %" & Int(rst5("sPersent05") / 100)) End If Catch ex As Exception MsgBox("Droplar Okunurken Hata Olustu !", MsgBoxStyle.Critical) End Try End While cmd5.Dispose() rst5.Close() Kontrol() End Sub Public Sub ZoneBul(ByVal ZoneID As String) Dim cmd6 As New SqlCommand Dim rst6 As SqlDataReader conn.Close() conn.Open() Try cmd6.CommandText = "SELECT * FROM ZONE_INFO WHERE ZoneNo = '" & ZoneID & "'" cmd6.Connection = conn rst6 = cmd6.ExecuteReader rst6.Read() Bolge = rst6("bz") Catch ex As Exception Bolge = "???" End Try cmd6.Dispose() rst6.Close() Kontrol() End Sub Public Sub Kontrol() conn.Close() conn.Open() cmd.Connection = conn rst = cmd.ExecuteReader rst.Read() End Sub End Class
trayhoper npc info v1.0