* setting eol style to native

This commit is contained in:
false_genesis 2008-03-24 16:43:51 +00:00
parent a8ad601dca
commit 44739d3952
1119 changed files with 472046 additions and 471429 deletions

View File

@ -1,96 +1,96 @@
Microsoft Visual Studio Solution File, Format Version 8.00 Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PseuWoW", "src\PseuWoW.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PseuWoW", "src\PseuWoW.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F} {E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
{F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270} {F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270}
{262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480} {262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\zlib.vcproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\zlib.vcproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zthread", "src\zthread.vcproj", "{262199E8-EEDF-4700-A1D1-E9CC901CF480}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zthread", "src\zthread.vcproj", "{262199E8-EEDF-4700-A1D1-E9CC901CF480}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "src\shared.vcproj", "{F548FC51-24A4-45FF-A381-BEBC39F18270}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "src\shared.vcproj", "{F548FC51-24A4-45FF-A381-BEBC39F18270}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
{262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480} {262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "src\dep\src\irrlicht\Irrlicht7.1.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "src\dep\src\irrlicht\Irrlicht7.1.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StuffExtract", "src\tools\stuffextract.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StuffExtract", "src\tools\stuffextract.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
{F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270} {F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270}
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfiguration) = preSolution GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug Debug = Debug
Relase - Fast FPU = Relase - Fast FPU Relase - Fast FPU = Relase - Fast FPU
Release = Release Release = Release
Release - Fast FPU DebugInfo = Release - Fast FPU DebugInfo Release - Fast FPU DebugInfo = Release - Fast FPU DebugInfo
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution GlobalSection(ProjectConfiguration) = postSolution
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.ActiveCfg = Debug|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.ActiveCfg = Debug|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.Build.0 = Debug|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.Build.0 = Debug|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.Build.0 = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.Build.0 = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug.ActiveCfg = Debug|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug.ActiveCfg = Debug|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug.Build.0 = Debug|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug.Build.0 = Debug|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU.ActiveCfg = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU.Build.0 = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU.Build.0 = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release.ActiveCfg = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release.Build.0 = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release.Build.0 = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug.ActiveCfg = Debug|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug.ActiveCfg = Debug|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug.Build.0 = Debug|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug.Build.0 = Debug|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU.ActiveCfg = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU.ActiveCfg = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU.Build.0 = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU.Build.0 = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release.ActiveCfg = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release.ActiveCfg = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release.Build.0 = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release.Build.0 = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug.ActiveCfg = Debug|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug.ActiveCfg = Debug|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug.Build.0 = Debug|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug.Build.0 = Debug|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU.ActiveCfg = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU.ActiveCfg = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU.Build.0 = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU.Build.0 = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release.ActiveCfg = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release.ActiveCfg = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release.Build.0 = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release.Build.0 = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.ActiveCfg = Debug|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.Build.0 = Debug|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.ActiveCfg = Relase - Fast FPU|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.ActiveCfg = Relase - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.Build.0 = Relase - Fast FPU|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.Build.0 = Relase - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release.ActiveCfg = Release|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release.Build.0 = Release|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo.ActiveCfg = Release - Fast FPU DebugInfo|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo.ActiveCfg = Release - Fast FPU DebugInfo|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo.Build.0 = Release - Fast FPU DebugInfo|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo.Build.0 = Release - Fast FPU DebugInfo|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.ActiveCfg = Debug|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.ActiveCfg = Debug|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.Build.0 = Debug|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug.Build.0 = Debug|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU.Build.0 = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release.Build.0 = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,88 +1,88 @@
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PseuWoW_VC80", "src\PseuWoW_VC80.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PseuWoW_VC80", "src\PseuWoW_VC80.vcproj", "{EFFE60F4-DA39-41E8-9E53-E462000A2D91}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F} {E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
{F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270} {F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270}
{262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480} {262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\zlib_VC80.vcproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\zlib_VC80.vcproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zthread", "src\zthread_VC80.vcproj", "{262199E8-EEDF-4700-A1D1-E9CC901CF480}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zthread", "src\zthread_VC80.vcproj", "{262199E8-EEDF-4700-A1D1-E9CC901CF480}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "src\shared_VC80.vcproj", "{F548FC51-24A4-45FF-A381-BEBC39F18270}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "src\shared_VC80.vcproj", "{F548FC51-24A4-45FF-A381-BEBC39F18270}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
{262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480} {262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "src\dep\src\irrlicht\Irrlicht8.0.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "src\dep\src\irrlicht\Irrlicht8.0.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StuffExtract", "src\tools\stuffextract_VC80.vcproj", "{FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StuffExtract", "src\tools\stuffextract_VC80.vcproj", "{FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
{F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270} {F548FC51-24A4-45FF-A381-BEBC39F18270} = {F548FC51-24A4-45FF-A381-BEBC39F18270}
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Relase - Fast FPU|Win32 = Relase - Fast FPU|Win32 Relase - Fast FPU|Win32 = Relase - Fast FPU|Win32
Release - Fast FPU DebugInfo|Win32 = Release - Fast FPU DebugInfo|Win32 Release - Fast FPU DebugInfo|Win32 = Release - Fast FPU DebugInfo|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug|Win32.ActiveCfg = Debug|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug|Win32.ActiveCfg = Debug|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug|Win32.Build.0 = Debug|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Debug|Win32.Build.0 = Debug|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU|Win32.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Relase - Fast FPU|Win32.Build.0 = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release|Win32.ActiveCfg = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release|Win32.ActiveCfg = Release|Win32
{EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release|Win32.Build.0 = Release|Win32 {EFFE60F4-DA39-41E8-9E53-E462000A2D91}.Release|Win32.Build.0 = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.ActiveCfg = Debug|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.ActiveCfg = Debug|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.Build.0 = Debug|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.Build.0 = Debug|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU|Win32.Build.0 = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Relase - Fast FPU|Win32.Build.0 = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.ActiveCfg = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.Build.0 = Release|Win32 {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.Build.0 = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug|Win32.ActiveCfg = Debug|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug|Win32.ActiveCfg = Debug|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug|Win32.Build.0 = Debug|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Debug|Win32.Build.0 = Debug|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU|Win32.Build.0 = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Relase - Fast FPU|Win32.Build.0 = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release|Win32.ActiveCfg = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release|Win32.ActiveCfg = Release|Win32
{262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release|Win32.Build.0 = Release|Win32 {262199E8-EEDF-4700-A1D1-E9CC901CF480}.Release|Win32.Build.0 = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug|Win32.ActiveCfg = Debug|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug|Win32.ActiveCfg = Debug|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug|Win32.Build.0 = Debug|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Debug|Win32.Build.0 = Debug|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU|Win32.Build.0 = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Relase - Fast FPU|Win32.Build.0 = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release|Win32.ActiveCfg = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release|Win32.ActiveCfg = Release|Win32
{F548FC51-24A4-45FF-A381-BEBC39F18270}.Release|Win32.Build.0 = Release|Win32 {F548FC51-24A4-45FF-A381-BEBC39F18270}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU|Win32.ActiveCfg = Relase - Fast FPU|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU|Win32.ActiveCfg = Relase - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU|Win32.Build.0 = Relase - Fast FPU|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU|Win32.Build.0 = Relase - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release - Fast FPU DebugInfo|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release - Fast FPU DebugInfo|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release - Fast FPU DebugInfo|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU DebugInfo|Win32.Build.0 = Release - Fast FPU DebugInfo|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Debug|Win32.ActiveCfg = Debug|Win32 {FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Debug|Win32.ActiveCfg = Debug|Win32
{FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32 {FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Relase - Fast FPU|Win32.ActiveCfg = Release|Win32
{FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32 {FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Release - Fast FPU DebugInfo|Win32.ActiveCfg = Release|Win32
{FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Release|Win32.ActiveCfg = Release|Win32 {FBBE6172-CCDE-4ADD-94A6-55C91D700DB6}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,51 +1,51 @@
// PSEUWOW DEF_SCRIPT STARTUP FILE // PSEUWOW DEF_SCRIPT STARTUP FILE
// this is for debugging which scripts are loaded // this is for debugging which scripts are loaded
// set to false to disable output // set to false to disable output
SET,LoadDebug true SET,LoadDebug true
LOG *** DefScript StartUp [${@version_short}]... LOG *** DefScript StartUp [${@version_short}]...
// first, load all scripts in path 'scripts' with extension .def // first, load all scripts in path 'scripts' with extension .def
SET,fcount ?{LGETFILES,scriptlist,def scripts} SET,fcount ?{LGETFILES,scriptlist,def scripts}
LSORT scriptlist LSORT scriptlist
LOG *** Loading ${fcount} script files. LOG *** Loading ${fcount} script files.
// iterate over all files and load them; if counter i is equal to the amount of files we are done. // iterate over all files and load them; if counter i is equal to the amount of files we are done.
SET,i 0 SET,i 0
SET,errors 0 SET,errors 0
LOOP LOOP
IF ?{EQUAL,${i} ${fcount}} IF ?{EQUAL,${i} ${fcount}}
EXITLOOP EXITLOOP
ENDIF ENDIF
SET,fn ./scripts/?{LINDEX,scriptlist ${i}} SET,fn ./scripts/?{LINDEX,scriptlist ${i}}
IF ?{AND,?{IsSet LoadDebug} ${LoadDebug}} IF ?{AND,?{IsSet LoadDebug} ${LoadDebug}}
LOG * Loading script file [${fn}] LOG * Loading script file [${fn}]
ENDIF ENDIF
IF ?{NOT ?{LOADDEF ${fn}}} IF ?{NOT ?{LOADDEF ${fn}}}
LOGERROR * Error loading [${fn}] LOGERROR * Error loading [${fn}]
ADD,errors 1 ADD,errors 1
ENDIF ENDIF
ADD,i 1 ADD,i 1
ENDLOOP ENDLOOP
UNSET tmp UNSET tmp
UNSET fcount UNSET fcount
UNSET i UNSET i
UNSET fn UNSET fn
LDELETE scriptlist LDELETE scriptlist
IF ?{NOT ${errors}} IF ?{NOT ${errors}}
LOG *** All files loaded without errors. LOG *** All files loaded without errors.
ELSE ELSE
LOG *** All files loaded, ${errors} errors. LOG *** All files loaded, ${errors} errors.
ENDIF ENDIF
UNSET errors UNSET errors
// Load some SCP files // Load some SCP files
LOADALLSCP LOADALLSCP
// do more stuff here in future... // do more stuff here in future...
LOG * StartUp complete! LOG * StartUp complete!

View File

@ -1,125 +1,125 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// PseuWoW config file // PseuWoW config file
// //
// still under development :D // still under development :D
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// use // for comments (C++ style) // use // for comments (C++ style)
// its important to read & store the main conf variables UPPERCASED!! // its important to read & store the main conf variables UPPERCASED!!
[#uppercase] [#uppercase]
[#noprefix] [#noprefix]
// 3=max, 0=no debug output // 3=max, 0=no debug output
debug=0 debug=0
// defines if the program should quit on error/exception or stay opened (for debugging) // defines if the program should quit on error/exception or stay opened (for debugging)
exitonerror=0 exitonerror=0
// reconnect on failure/disconnect // reconnect on failure/disconnect
// 0 = dont't reconnect // 0 = dont't reconnect
// everything else: delay (in ms) until the next connection attempt. // everything else: delay (in ms) until the next connection attempt.
// default: 5000 ms (5 secs) // default: 5000 ms (5 secs)
reconnect=5000 reconnect=5000
// 0 - show none // 0 - show none
// 1 - show only known/handled // 1 - show only known/handled
// 2 - show only unknown/unhandled // 2 - show only unknown/unhandled
// 3 - show all // 3 - show all
showopcodes=0 showopcodes=0
// Hide opcodes which is coming very frequently? // Hide opcodes which is coming very frequently?
// Has only an effect if you have showopcodes > 0 // Has only an effect if you have showopcodes > 0
// 1 - yes // 1 - yes
// 0 - No // 0 - No
hidefreqopcodes=1 hidefreqopcodes=1
// Hide disabled (= unhandled, but known) opcodes? // Hide disabled (= unhandled, but known) opcodes?
// 1 - Yes // 1 - Yes
// 0 - No // 0 - No
HideDisabledOpcodes=0 HideDisabledOpcodes=0
// the IP or hostname the realm server is running on // the IP or hostname the realm server is running on
realmlist=localhost realmlist=localhost
// port on which the realm server is listening (default=3724) // port on which the realm server is listening (default=3724)
realmport=3724 realmport=3724
// PseuWoW will login on this realm // PseuWoW will login on this realm
// Case sensitive! // Case sensitive!
realmname=My WoW Realm realmname=My WoW Realm
// your account name // your account name
accname=test accname=test
// your account password // your account password
accpass=test accpass=test
// the character name PseuWoW should choose to enter the world. // the character name PseuWoW should choose to enter the world.
// case sensitive! // case sensitive!
charname=Pseuwow charname=Pseuwow
// Client emulation configuration // Client emulation configuration
ClientVersion=2.3.3 ClientVersion=2.3.3
ClientBuild=7799 ClientBuild=7799
ClientLanguage=enUS ClientLanguage=enUS
// or change to enGB, deDE, ... // or change to enGB, deDE, ...
// packets get fetched every xx msecs. default=50 // packets get fetched every xx msecs. default=50
// setting this to 0 will let PseuWoW eat up all CPU power // setting this to 0 will let PseuWoW eat up all CPU power
// 1 is a good setting for maximum network performance and lowest ping times // 1 is a good setting for maximum network performance and lowest ping times
NetworkSleepTime=1 NetworkSleepTime=1
// defines if players may say/yell/whisper commands to PseuWoW // defines if players may say/yell/whisper commands to PseuWoW
// set this to 0 and PseuWoW will not react to given commands // set this to 0 and PseuWoW will not react to given commands
allowgamecmd=1 allowgamecmd=1
// enable this if you plan to enter commands on the console // enable this if you plan to enter commands on the console
enablecli=1 enablecli=1
// enable's chat ai which makes you bot respond to simple senteces // enable's chat ai which makes you bot respond to simple senteces
// like "Hi" and "What do you think of x" etc. // like "Hi" and "What do you think of x" etc.
enablechatai=1 enablechatai=1
// show ping responses // show ping responses
notifyping=1 notifyping=1
// shows the opcodes pseuwow sends to the server // shows the opcodes pseuwow sends to the server
showmyopcodes=0 showmyopcodes=0
// disable the check for learned spells. // disable the check for learned spells.
// if you disable it, you can cast spells you do not have in your spellbook! // if you disable it, you can cast spells you do not have in your spellbook!
// WARNING: most servers will consider this as CHEATING! // WARNING: most servers will consider this as CHEATING!
// DO NOT put 1 here! // DO NOT put 1 here!
disablespellcheck=0 disablespellcheck=0
// will be used for all sendchatmessage calls. remove number/leave blank // will be used for all sendchatmessage calls. remove number/leave blank
// to use the default language for your race (defined in race.scp) // to use the default language for your race (defined in race.scp)
defaultlang=0 defaultlang=0
// set this to 1 if you want to have a 3D-window showing stuff // set this to 1 if you want to have a 3D-window showing stuff
// NOTE: this is only to activate the window for now, 3D-stuff will come later!! // NOTE: this is only to activate the window for now, 3D-stuff will come later!!
// until some frame-limiter is implemented, it will always use 100% CPU usage when // until some frame-limiter is implemented, it will always use 100% CPU usage when
// the GUI is enabled and activated. (if its in background - way less CPU load.) // the GUI is enabled and activated. (if its in background - way less CPU load.)
enablegui=0 enablegui=0
// options for remote control: // options for remote control:
// port beeing listened on. set to 0 do disable. // port beeing listened on. set to 0 do disable.
rmcontrolport=8101 rmcontrolport=8101
// IP or hostname that is allowed to connect. leave blank to allow connections from everywhere (dangerous!) // IP or hostname that is allowed to connect. leave blank to allow connections from everywhere (dangerous!)
rmcontrolhost=localhost rmcontrolhost=localhost
// if you have exported and copied data from your original client, // if you have exported and copied data from your original client,
// set this to 1 to enable movement and everything map related. // set this to 1 to enable movement and everything map related.
// PseuWoW will need more memory with maps enabled! // PseuWoW will need more memory with maps enabled!
useMaps=0 useMaps=0
// Addon language is usually not shown by client // Addon language is usually not shown by client
// Since addons are far from beeing used in PseuWoW, we can completely ignore addon chat messages. // Since addons are far from beeing used in PseuWoW, we can completely ignore addon chat messages.
// Sometimes they even cause problems, like make the console window beep... // Sometimes they even cause problems, like make the console window beep...
SkipAddonChat=1 SkipAddonChat=1

View File

@ -1,44 +1,44 @@
// this config file has no effect on the core. // this config file has no effect on the core.
// store variable definitions for scripts only! // store variable definitions for scripts only!
// ## GLOBAL SECTION ## // ## GLOBAL SECTION ##
[#uppercase] [#uppercase]
[#noprefix] [#noprefix]
// special char that is used to trigger server commands (for example ".goname Player") // special char that is used to trigger server commands (for example ".goname Player")
// (WoWEmu="." MaNGOS="." or "!") // (WoWEmu="." MaNGOS="." or "!")
// other servers might be different // other servers might be different
cmdchar=. cmdchar=.
// MaNGOS does also accept ! as cmd identifier. put here all identifiers that can trigger a server command! // MaNGOS does also accept ! as cmd identifier. put here all identifiers that can trigger a server command!
other_cmd_chars=.! other_cmd_chars=.!
// Set to 1 if PseuWoW should exit after the GUI is closed (if there is a GUI) // Set to 1 if PseuWoW should exit after the GUI is closed (if there is a GUI)
ExitOnGUIClose=0 ExitOnGUIClose=0
[#normal] [#normal]
// ## END OF GLOBAL SECTION ## // ## END OF GLOBAL SECTION ##
// -- section for individual scripts -- // -- section for individual scripts --
[autobroadcast] [autobroadcast]
enable=0 enable=0
// 20 mins by default // 20 mins by default
secs=1200 secs=1200
// the command the server uses to broadcast (.broadcast, .announce, .bc or whatever) // the command the server uses to broadcast (.broadcast, .announce, .bc or whatever)
// do NOT put a trailing "." or "!" , only the plain command name! // do NOT put a trailing "." or "!" , only the plain command name!
cmd=announce cmd=announce
// configure your texts here // configure your texts here
textcount=3 textcount=3
text1=This is PseuWoW autobroadcast #1 text1=This is PseuWoW autobroadcast #1
text2=And another one! Autobroadcast #2 text2=And another one! Autobroadcast #2
text3=The world is round, and so am I! text3=The world is round, and so am I!

View File

@ -1,24 +1,24 @@
[#uppercase] [#uppercase]
[GUI] [GUI]
// drivers: // drivers:
// 0: Nulldevice (no graphics) // 0: Nulldevice (no graphics)
// 1: fast but crappy software driver // 1: fast but crappy software driver
// 2: good software driver, but slower // 2: good software driver, but slower
// 3: OpenGL // 3: OpenGL
// 4: DirectX 8.1 // 4: DirectX 8.1
// 5: DirectX 9.0c // 5: DirectX 9.0c
driver=5 driver=5
// resolution and more // resolution and more
resx=1024 resx=1024
resy=768 resy=768
windowed=1 windowed=1
vsync=0 vsync=0
// use realtime shadows? // use realtime shadows?
// works only with DirectX or OpenGL // works only with DirectX or OpenGL
shadows=1 shadows=1
// color depth; 16 or 32 bit // color depth; 16 or 32 bit
depth=32 depth=32

View File

@ -1,18 +1,18 @@
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// Player Permission Configuration file // Player Permission Configuration file
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// Permission reaches from 0 to 255 // Permission reaches from 0 to 255
[USERS] [USERS]
Gamemaster=100 Gamemaster=100
Admin=255 Admin=255
Trusted=30 Trusted=30
Niceplayer=10 Niceplayer=10
Falsegenesis=150 Falsegenesis=150
//... //...
// Add your names here // Add your names here
// rest is 0 automatically // rest is 0 automatically

View File

@ -1,32 +1,32 @@
[1] [1]
name=Warrior name=Warrior
[2] [2]
name=Paladin name=Paladin
[3] [3]
name=Hunter name=Hunter
[4] [4]
name=Rogue name=Rogue
[5] [5]
name=Priest name=Priest
[6] [6]
name=UNKNOWN CLASS(6) name=UNKNOWN CLASS(6)
[7] [7]
name=Shaman name=Shaman
[8] [8]
name=Mage name=Mage
[9] [9]
name=Warlock name=Warlock
[10] [10]
name=UNKNOWN CLASS(10) name=UNKNOWN CLASS(10)
[11] [11]
name=Druid name=Druid

View File

@ -1,10 +1,10 @@
// define names of genders // define names of genders
[0] [0]
name=male name=male
[1] [1]
name=female name=female
[2] [2]
name=none name=none

View File

@ -1,41 +1,41 @@
[0] [0]
name=Global name=Global
[1] [1]
name=Orcish name=Orcish
[2] [2]
name=Darnassian name=Darnassian
[3] [3]
name=Taurahe name=Taurahe
[6] [6]
name=Dwarvish name=Dwarvish
[7] [7]
name=Common name=Common
[8] [8]
name=Demonic name=Demonic
[9] [9]
name=Titan name=Titan
[10] [10]
name=Thalassian name=Thalassian
[11] [11]
name=Draconic name=Draconic
[12] [12]
name=Kalimag name=Kalimag
[13] [13]
name=Gnomish name=Gnomish
[14] [14]
name=Troll name=Troll
[33] [33]
name=Gutterspeak name=Gutterspeak

View File

@ -1,321 +1,321 @@
#dbname=map #dbname=map
[0] [0]
name_general=Azeroth name_general=Azeroth
name=Eastern Kingdoms name=Eastern Kingdoms
[1] [1]
name_general=Kalimdor name_general=Kalimdor
name=Kalimdor name=Kalimdor
[13] [13]
name_general=test name_general=test
name=Testing name=Testing
[25] [25]
name_general=ScottTest name_general=ScottTest
name=Scott Test name=Scott Test
[29] [29]
name_general=Test name_general=Test
name=CashTest name=CashTest
[30] [30]
name_general=PVPZone01 name_general=PVPZone01
name=Alterac Valley name=Alterac Valley
[33] [33]
name_general=Shadowfang name_general=Shadowfang
name=Shadowfang Keep name=Shadowfang Keep
[34] [34]
name_general=StormwindJail name_general=StormwindJail
name=Stormwind Stockade name=Stormwind Stockade
[35] [35]
name_general=StormwindPrison name_general=StormwindPrison
name=<unused>StormwindPrison name=<unused>StormwindPrison
[36] [36]
name_general=DeadminesInstance name_general=DeadminesInstance
name=Deadmines name=Deadmines
[37] [37]
name_general=PVPZone02 name_general=PVPZone02
name=Azshara Crater name=Azshara Crater
[42] [42]
name_general=Collin name_general=Collin
name=Collin's Test name=Collin's Test
[43] [43]
name_general=WailingCaverns name_general=WailingCaverns
name=Wailing Caverns name=Wailing Caverns
[44] [44]
name_general=Monastery name_general=Monastery
name=<unused> Monastery name=<unused> Monastery
[47] [47]
name_general=RazorfenKraulInstance name_general=RazorfenKraulInstance
name=Razorfen Kraul name=Razorfen Kraul
[48] [48]
name_general=Blackfathom name_general=Blackfathom
name=Blackfathom Deeps name=Blackfathom Deeps
[70] [70]
name_general=Uldaman name_general=Uldaman
name=Uldaman name=Uldaman
[90] [90]
name_general=GnomeragonInstance name_general=GnomeragonInstance
name=Gnomeregan name=Gnomeregan
[109] [109]
name_general=SunkenTemple name_general=SunkenTemple
name=Sunken Temple name=Sunken Temple
[129] [129]
name_general=RazorfenDowns name_general=RazorfenDowns
name=Razorfen Downs name=Razorfen Downs
[169] [169]
name_general=EmeraldDream name_general=EmeraldDream
name=Emerald Dream name=Emerald Dream
[189] [189]
name_general=MonasteryInstances name_general=MonasteryInstances
name=Scarlet Monastery name=Scarlet Monastery
[209] [209]
name_general=TanarisInstance name_general=TanarisInstance
name=Zul'Farrak name=Zul'Farrak
[229] [229]
name_general=BlackRockSpire name_general=BlackRockSpire
name=Blackrock Spire name=Blackrock Spire
[230] [230]
name_general=BlackrockDepths name_general=BlackrockDepths
name=Blackrock Depths name=Blackrock Depths
[249] [249]
name_general=OnyxiaLairInstance name_general=OnyxiaLairInstance
name=Onyxia's Lair name=Onyxia's Lair
[269] [269]
name_general=CavernsOfTime name_general=CavernsOfTime
name=Opening of the Dark Portal name=Opening of the Dark Portal
[289] [289]
name_general=SchoolofNecromancy name_general=SchoolofNecromancy
name=Scholomance name=Scholomance
[309] [309]
name_general=Zul'gurub name_general=Zul'gurub
name=Zul'Gurub name=Zul'Gurub
[329] [329]
name_general=Stratholme name_general=Stratholme
name=Stratholme name=Stratholme
[349] [349]
name_general=Mauradon name_general=Mauradon
name=Maraudon name=Maraudon
[369] [369]
name_general=DeeprunTram name_general=DeeprunTram
name=Deeprun Tram name=Deeprun Tram
[389] [389]
name_general=OrgrimmarInstance name_general=OrgrimmarInstance
name=Ragefire Chasm name=Ragefire Chasm
[409] [409]
name_general=MoltenCore name_general=MoltenCore
name=Molten Core name=Molten Core
[429] [429]
name_general=DireMaul name_general=DireMaul
name=Dire Maul name=Dire Maul
[449] [449]
name_general=AlliancePVPBarracks name_general=AlliancePVPBarracks
name=Alliance PVP Barracks name=Alliance PVP Barracks
[450] [450]
name_general=HordePVPBarracks name_general=HordePVPBarracks
name=Horde PVP Barracks name=Horde PVP Barracks
[451] [451]
name_general=development name_general=development
name=Development Land name=Development Land
[469] [469]
name_general=BlackwingLair name_general=BlackwingLair
name=Blackwing Lair name=Blackwing Lair
[489] [489]
name_general=PVPZone03 name_general=PVPZone03
name=Warsong Gulch name=Warsong Gulch
[509] [509]
name_general=AhnQiraj name_general=AhnQiraj
name=Ruins of Ahn'Qiraj name=Ruins of Ahn'Qiraj
[529] [529]
name_general=PVPZone04 name_general=PVPZone04
name=Arathi Basin name=Arathi Basin
[530] [530]
name_general=Expansion01 name_general=Expansion01
name=Outland name=Outland
[531] [531]
name_general=AhnQirajTemple name_general=AhnQirajTemple
name=Ahn'Qiraj Temple name=Ahn'Qiraj Temple
[532] [532]
name_general=Karazahn name_general=Karazahn
name=Karazhan name=Karazhan
[533] [533]
name_general=Stratholme Raid name_general=Stratholme Raid
name=Naxxramas name=Naxxramas
[534] [534]
name_general=HyjalPast name_general=HyjalPast
name=The Battle for Mount Hyjal name=The Battle for Mount Hyjal
[540] [540]
name_general=HellfireMilitary name_general=HellfireMilitary
name=Hellfire Citadel: The Shattered Halls name=Hellfire Citadel: The Shattered Halls
[542] [542]
name_general=HellfireDemon name_general=HellfireDemon
name=Hellfire Citadel: The Blood Furnace name=Hellfire Citadel: The Blood Furnace
[543] [543]
name_general=HellfireRampart name_general=HellfireRampart
name=Hellfire Citadel: Ramparts name=Hellfire Citadel: Ramparts
[544] [544]
name_general=HellfireRaid name_general=HellfireRaid
name=Magtheridon's Lair name=Magtheridon's Lair
[545] [545]
name_general=CoilfangPumping name_general=CoilfangPumping
name=Coilfang: The Steamvault name=Coilfang: The Steamvault
[546] [546]
name_general=CoilfangMarsh name_general=CoilfangMarsh
name=Coilfang: The Underbog name=Coilfang: The Underbog
[547] [547]
name_general=CoilfangDraenei name_general=CoilfangDraenei
name=Coilfang: The Slave Pens name=Coilfang: The Slave Pens
[548] [548]
name_general=CoilfangRaid name_general=CoilfangRaid
name=Coilfang: Serpentshrine Cavern name=Coilfang: Serpentshrine Cavern
[550] [550]
name_general=TempestKeepRaid name_general=TempestKeepRaid
name=Tempest Keep name=Tempest Keep
[552] [552]
name_general=TempestKeepArcane name_general=TempestKeepArcane
name=Tempest Keep: The Arcatraz name=Tempest Keep: The Arcatraz
[553] [553]
name_general=TempestKeepAtrium name_general=TempestKeepAtrium
name=Tempest Keep: The Botanica name=Tempest Keep: The Botanica
[554] [554]
name_general=TempestKeepFactory name_general=TempestKeepFactory
name=Tempest Keep: The Mechanar name=Tempest Keep: The Mechanar
[555] [555]
name_general=AuchindounShadow name_general=AuchindounShadow
name=Auchindoun: Shadow Labyrinth name=Auchindoun: Shadow Labyrinth
[556] [556]
name_general=AuchindounDemon name_general=AuchindounDemon
name=Auchindoun: Sethekk Halls name=Auchindoun: Sethekk Halls
[557] [557]
name_general=AuchindounEthereal name_general=AuchindounEthereal
name=Auchindoun: Mana-Tombs name=Auchindoun: Mana-Tombs
[558] [558]
name_general=AuchindounDraenei name_general=AuchindounDraenei
name=Auchindoun: Auchenai Crypts name=Auchindoun: Auchenai Crypts
[559] [559]
name_general=PVPZone05 name_general=PVPZone05
name=Nagrand Arena name=Nagrand Arena
[560] [560]
name_general=HillsbradPast name_general=HillsbradPast
name=The Escape From Durnholde name=The Escape From Durnholde
[562] [562]
name_general=bladesedgearena name_general=bladesedgearena
name=Blade's Edge Arena name=Blade's Edge Arena
[564] [564]
name_general=BlackTemple name_general=BlackTemple
name=Black Temple name=Black Temple
[565] [565]
name_general=GruulsLair name_general=GruulsLair
name=Gruul's Lair name=Gruul's Lair
[566] [566]
name_general=NetherstormBG name_general=NetherstormBG
name=Eye of the Storm name=Eye of the Storm
[568] [568]
name_general=ZulAman name_general=ZulAman
name=Zul'Aman name=Zul'Aman
[572] [572]
name_general=PVPLordaeron name_general=PVPLordaeron
name=Ruins of Lordaeron name=Ruins of Lordaeron
[582] [582]
name_general=Transport176244 name_general=Transport176244
name=Transport: Rut'theran to Auberdine name=Transport: Rut'theran to Auberdine
[584] [584]
name_general=Transport176231 name_general=Transport176231
name=Transport: Menethil to Theramore name=Transport: Menethil to Theramore
[586] [586]
name_general=Transport181645 name_general=Transport181645
name=Transport: Exodar to Auberdine name=Transport: Exodar to Auberdine
[587] [587]
name_general=Transport177233 name_general=Transport177233
name=Transport: Feathermoon Ferry name=Transport: Feathermoon Ferry
[588] [588]
name_general=Transport176310 name_general=Transport176310
name=Transport: Menethil to Auberdine name=Transport: Menethil to Auberdine
[589] [589]
name_general=Transport175080 name_general=Transport175080
name=Transport: Orgrimmar to Grom'Gol name=Transport: Orgrimmar to Grom'Gol
[590] [590]
name_general=Transport176495 name_general=Transport176495
name=Transport: Grom'Gol to Undercity name=Transport: Grom'Gol to Undercity
[591] [591]
name_general=Transport164871 name_general=Transport164871
name=Transport: Undercity to Orgrimmar name=Transport: Undercity to Orgrimmar
[593] [593]
name_general=Transport20808 name_general=Transport20808
name=Transport: Booty Bay to Ratchet name=Transport: Booty Bay to Ratchet

View File

@ -1,129 +1,129 @@
#dbname=race #dbname=race
[1] [1]
model_m=49 model_m=49
model_f=50 model_f=50
name_short=Hu name_short=Hu
faction=7 faction=7
name_general=Human name_general=Human
name=Human name=Human
[2] [2]
model_m=51 model_m=51
model_f=52 model_f=52
name_short=Or name_short=Or
faction=1 faction=1
name_general=Orc name_general=Orc
name=Orc name=Orc
[3] [3]
model_m=53 model_m=53
model_f=54 model_f=54
name_short=Dw name_short=Dw
faction=7 faction=7
name_general=Dwarf name_general=Dwarf
name=Dwarf name=Dwarf
[4] [4]
model_m=55 model_m=55
model_f=56 model_f=56
name_short=Ni name_short=Ni
faction=7 faction=7
name_general=NightElf name_general=NightElf
name=Night Elf name=Night Elf
[5] [5]
model_m=57 model_m=57
model_f=58 model_f=58
name_short=Sc name_short=Sc
faction=1 faction=1
name_general=Scourge name_general=Scourge
name=Undead name=Undead
[6] [6]
model_m=59 model_m=59
model_f=60 model_f=60
name_short=Ta name_short=Ta
faction=1 faction=1
name_general=Tauren name_general=Tauren
name=Tauren name=Tauren
[7] [7]
model_m=1563 model_m=1563
model_f=1564 model_f=1564
name_short=Gn name_short=Gn
faction=7 faction=7
name_general=Gnome name_general=Gnome
name=Gnome name=Gnome
[8] [8]
model_m=1478 model_m=1478
model_f=1479 model_f=1479
name_short=Tr name_short=Tr
faction=1 faction=1
name_general=Troll name_general=Troll
name=Troll name=Troll
[9] [9]
model_m=6894 model_m=6894
model_f=6895 model_f=6895
name_short=Go name_short=Go
faction=7 faction=7
name_general=Goblin name_general=Goblin
name=Goblin name=Goblin
[10] [10]
model_m=15476 model_m=15476
model_f=15475 model_f=15475
name_short=Be name_short=Be
faction=1 faction=1
name_general=BloodElf name_general=BloodElf
name=Blood Elf name=Blood Elf
[11] [11]
model_m=16125 model_m=16125
model_f=16126 model_f=16126
name_short=Dr name_short=Dr
faction=7 faction=7
name_general=Draenei name_general=Draenei
name=Draenei name=Draenei
[12] [12]
model_m=16981 model_m=16981
model_f=16980 model_f=16980
name_short=Fo name_short=Fo
faction=7 faction=7
name_general=FelOrc name_general=FelOrc
name=Fel Orc name=Fel Orc
[13] [13]
model_m=17402 model_m=17402
model_f=17403 model_f=17403
name_short=Na name_short=Na
faction=7 faction=7
name_general=Naga_ name_general=Naga_
name=Naga name=Naga
[14] [14]
model_m=17576 model_m=17576
model_f=17577 model_f=17577
name_short=Br name_short=Br
faction=7 faction=7
name_general=Broken name_general=Broken
name=Broken name=Broken
[15] [15]
model_m=17578 model_m=17578
model_f=17579 model_f=17579
name_short=Sk name_short=Sk
faction=7 faction=7
name_general=Skeleton name_general=Skeleton
name=Skeleton name=Skeleton
[18] [18]
model_m=21963 model_m=21963
model_f=21964 model_f=21964
name_short=Ft name_short=Ft
faction=7 faction=7
name_general=ForestTroll name_general=ForestTroll
name=Forest Troll name=Forest Troll

View File

@ -1,229 +1,229 @@
//----------------------------------------------------------- //-----------------------------------------------------------
#script=chan #script=chan
//----------------------------------------------------------- //-----------------------------------------------------------
// Script to write on channels // Script to write on channels
// Arguments: // Arguments:
// ========== // ==========
// @def: text to write // @def: text to write
// @0: channel name // @0: channel name
// @1: language name/number // @1: language name/number
#permission=10 #permission=10
SET,lang ${@1} SET,lang ${@1}
DEFAULT,lang 0 DEFAULT,lang 0
SENDCHATMESSAGE,14,{${lang}},{${@def}},{${@0}} SENDCHATMESSAGE,14,{${lang}},{${@def}},{${@0}}
UNSET lang UNSET lang
//----------------------------------------------------------- //-----------------------------------------------------------
#script=cmd #script=cmd
#permission=255 #permission=255
//----------------------------------------------------------- //-----------------------------------------------------------
// purpose: send a server command. // purpose: send a server command.
// args: // args:
// @def: command to send // @def: command to send
SAY ${#CMDCHAR}${@def} SAY ${#CMDCHAR}${@def}
//----------------------------------------------------------- //-----------------------------------------------------------
#script=reply #script=reply
#permission=255 #permission=255
//----------------------------------------------------------- //-----------------------------------------------------------
// purpose: reply to the player that whispered last // purpose: reply to the player that whispered last
SET,player ${@thiswhisper_name} SET,player ${@thiswhisper_name}
SET,lang ${@0} SET,lang ${@0}
DEFAULT,lang 0 DEFAULT,lang 0
SET,msg ${@def} SET,msg ${@def}
WHISPER,{${player}},{${lang}} ${msg} WHISPER,{${player}},{${lang}} ${msg}
UNSET player UNSET player
UNSET lang UNSET lang
UNSET msg UNSET msg
//----------------------------------------------------------- //-----------------------------------------------------------
#script=s #script=s
#permission=0 #permission=0
//----------------------------------------------------------- //-----------------------------------------------------------
// is the char equal to the char we use for commands? does the player have a permission lvl below 255? // is the char equal to the char we use for commands? does the player have a permission lvl below 255?
IF ?{AND,?{string_is_command ${@def}} ?{SMALLER,?{GETPLAYERPERM ${@thiscmd_name}} 255}} IF ?{AND,?{string_is_command ${@def}} ?{SMALLER,?{GETPLAYERPERM ${@thiscmd_name}} 255}}
// yes: say a warning and the command the player wanted to use // yes: say a warning and the command the player wanted to use
SAY ${@thiscmd_name}: no permission to use commands [${@def}] SAY ${@thiscmd_name}: no permission to use commands [${@def}]
RETURN false RETURN false
ELSE ELSE
// no: say the text as usual. // no: say the text as usual.
SAY,{${@0}} ${@def} SAY,{${@0}} ${@def}
RETURN true RETURN true
ENDIF ENDIF
//----------------------------------------------------------- //-----------------------------------------------------------
#script=say #script=say
#permission=255 #permission=255
//----------------------------------------------------------- //-----------------------------------------------------------
// purpose: say something. @0: language ID or name, @def: text to say // purpose: say something. @0: language ID or name, @def: text to say
// setup some default values // setup some default values
SET,lang ${@0} SET,lang ${@0}
SET,msg ${@def} SET,msg ${@def}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction} DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG} DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Saying '${msg}' in lang ${lang} LOGDEBUG * Saying '${msg}' in lang ${lang}
SENDCHATMESSAGE,0,${lang},{${msg}} SENDCHATMESSAGE,0,${lang},{${msg}}
UNSET lang UNSET lang
UNSET msg UNSET msg
//----------------------------------------------------------- //-----------------------------------------------------------
#script=sayguild #script=sayguild
#permission=255 #permission=255
//----------------------------------------------------------- //-----------------------------------------------------------
// purpose: say something to guild channel // purpose: say something to guild channel
// setup some default values // setup some default values
SET,lang ${@0} SET,lang ${@0}
SET,msg ${@def} SET,msg ${@def}
default,lang 0 default,lang 0
LOGDEBUG * Saying '${msg}' in lang ${lang} to guild LOGDEBUG * Saying '${msg}' in lang ${lang} to guild
SENDCHATMESSAGE,3,${lang},{${msg}} SENDCHATMESSAGE,3,${lang},{${msg}}
UNSET lang UNSET lang
UNSET msg UNSET msg
//----------------------------------------------------------- //-----------------------------------------------------------
#script=sayitem #script=sayitem
#permission=0 #permission=0
//----------------------------------------------------------- //-----------------------------------------------------------
// example script to "say" a clickable item // example script to "say" a clickable item
SAY ?{getchatitem ${@def}} SAY ?{getchatitem ${@def}}
//----------------------------------------------------------- //-----------------------------------------------------------
#script=sayparty #script=sayparty
#permission=255 #permission=255
//----------------------------------------------------------- //-----------------------------------------------------------
// purpose: say something to party channel // purpose: say something to party channel
// setup some default values // setup some default values
SET,lang ${@0} SET,lang ${@0}
SET,msg ${@def} SET,msg ${@def}
default,lang 0 default,lang 0
LOGDEBUG * Saying '${msg}' in lang ${lang} to party LOGDEBUG * Saying '${msg}' in lang ${lang} to party
SENDCHATMESSAGE,1,${lang},{${msg}} SENDCHATMESSAGE,1,${lang},{${msg}}
UNSET lang UNSET lang
UNSET msg UNSET msg
//----------------------------------------------------------- //-----------------------------------------------------------
#script=sayred #script=sayred
//----------------------------------------------------------- //-----------------------------------------------------------
// example script how to output colored text // example script how to output colored text
#permission=0 #permission=0
SAY,{${@0}} |cffFF0000${@def} SAY,{${@0}} |cffFF0000${@def}
//----------------------------------------------------------- //-----------------------------------------------------------
#script=sayv #script=sayv
#permission=0 #permission=0
//----------------------------------------------------------- //-----------------------------------------------------------
// purpose: say the value of a variable // purpose: say the value of a variable
// args: @0: language ID or name, @def: var name // args: @0: language ID or name, @def: var name
SET,vn #${@caller}::${@def} SET,vn #${@caller}::${@def}
SET,vl ${@0} SET,vl ${@0}
DEFAULT,vl 0 DEFAULT,vl 0
IF ?{NOT ?{ISSET ${vn}}} IF ?{NOT ?{ISSET ${vn}}}
SAY,{${vl}} * Var '${@def}' not defined. SAY,{${vl}} * Var '${@def}' not defined.
ELSE ELSE
SET,vv ${${vn}} SET,vv ${${vn}}
SAY,{${vl}} * Var '${@def}' = '${vv}' SAY,{${vl}} * Var '${@def}' = '${vv}'
ENDIF ENDIF
UNSET vv UNSET vv
UNSET vn UNSET vn
UNSET vl UNSET vl
//----------------------------------------------------------- //-----------------------------------------------------------
#script=whisper #script=whisper
#permission=255 #permission=255
//----------------------------------------------------------- //-----------------------------------------------------------
// purpose: whisper text to a player. // purpose: whisper text to a player.
// args: @0: player name to whisper to; @1: language to use; @def: text // args: @0: player name to whisper to; @1: language to use; @def: text
// setup some default values // setup some default values
SET,msg ${@def} SET,msg ${@def}
SET,player ${@0} SET,player ${@0}
SET,lang ${@1} SET,lang ${@1}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction} DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG} DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Whisp to '{${player}}' '{${msg}}' in lang '${lang}' LOGDEBUG * Whisp to '{${player}}' '{${msg}}' in lang '${lang}'
SENDCHATMESSAGE,6,{${lang}},{${msg}},{${player}} SENDCHATMESSAGE,6,{${lang}},{${msg}},{${player}}
UNSET lang UNSET lang
UNSET msg UNSET msg
UNSET player UNSET player
//------------------------------------------------------------- //-------------------------------------------------------------
#script=yell #script=yell
#permission=255 #permission=255
//------------------------------------------------------------- //-------------------------------------------------------------
// purpose: SHOUT! // purpose: SHOUT!
// setup some default values // setup some default values
SET,lang ${@0} SET,lang ${@0}
SET,msg ${@def} SET,msg ${@def}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction} DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG} DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Yelling '${msg}' in lang ${lang} LOGDEBUG * Yelling '${msg}' in lang ${lang}
SENDCHATMESSAGE,5,${lang},{${msg}} SENDCHATMESSAGE,5,${lang},{${msg}}
UNSET lang UNSET lang
UNSET msg UNSET msg
//----------------------------------------------------------- //-----------------------------------------------------------
#script=y #script=y
#permission=0 #permission=0
//----------------------------------------------------------- //-----------------------------------------------------------
// is the char equal to the char we use for commands? does the player have a permission lvl below 255? // is the char equal to the char we use for commands? does the player have a permission lvl below 255?
IF ?{AND,?{string_is_command ${@def}} ?{SMALLER,?{GETPLAYERPERM ${@thiscmd_name}} 255}} IF ?{AND,?{string_is_command ${@def}} ?{SMALLER,?{GETPLAYERPERM ${@thiscmd_name}} 255}}
// yes: say a warning and the command the player wanted to use // yes: say a warning and the command the player wanted to use
YELL ${@thiscmd_name}: no permission to use commands [${@def}] YELL ${@thiscmd_name}: no permission to use commands [${@def}]
RETURN false RETURN false
ELSE ELSE
// no: say the text as usual. // no: say the text as usual.
YELL,{${@0}} ${@def} YELL,{${@0}} ${@def}
RETURN true RETURN true
ENDIF ENDIF
//---------------------------------------------------------- //----------------------------------------------------------
#script=me #script=me
#permission=0 #permission=0
//---------------------------------------------------------- //----------------------------------------------------------
// Send text emote. example: "me feels lolo" will result in "Pseuwow feels lolo" at other clients // Send text emote. example: "me feels lolo" will result in "Pseuwow feels lolo" at other clients
SET,lang ${@0} SET,lang ${@0}
SET,msg ${@def} SET,msg ${@def}
DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction} DEFAULT,#DEFAULTLANG ?{GETSCPVALUE,race,{${@myrace}} faction}
DEFAULT,lang ${#DEFAULTLANG} DEFAULT,lang ${#DEFAULTLANG}
LOGDEBUG * Me ${msg} (in lang ${lang}) LOGDEBUG * Me ${msg} (in lang ${lang})
SENDCHATMESSAGE,8,${lang},{${msg}} SENDCHATMESSAGE,8,${lang},{${msg}}
UNSET lang UNSET lang
UNSET msg UNSET msg

View File

@ -1,177 +1,177 @@
// ----------------------------------- // -----------------------------------
#script=FlushChatAI #script=FlushChatAI
#permission=255 #permission=255
// ----------------------------------- // -----------------------------------
// purpose: remove all registered chat AI scripts. usable as command. // purpose: remove all registered chat AI scripts. usable as command.
logdebug flushing chat AI scripts. logdebug flushing chat AI scripts.
lclean #processchatai::pattern_list lclean #processchatai::pattern_list
lclean #processchatai::script_list lclean #processchatai::script_list
lclean #processchatai::cond_list lclean #processchatai::cond_list
lclean #processchatai::register_list lclean #processchatai::register_list
// ---------------------------------- // ----------------------------------
#script=DropChatAIScript #script=DropChatAIScript
// ---------------------------------- // ----------------------------------
// purpose: drop all entries registered to call the script specified in @def // purpose: drop all entries registered to call the script specified in @def
set,amount 0 set,amount 0
loop loop
set,pos ?{lfind,#processchatai::script_list,true ${@def}} set,pos ?{lfind,#processchatai::script_list,true ${@def}}
if ?{not ?{strlen ${pos}}} if ?{not ?{strlen ${pos}}}
exitloop exitloop
endif endif
set,what_sc ?{lerase,#processchatai::script_list ${pos}} set,what_sc ?{lerase,#processchatai::script_list ${pos}}
set,what_cond ?{lerase,#processchatai::cond_list ${pos}} set,what_cond ?{lerase,#processchatai::cond_list ${pos}}
set,what_ptn ?{lerase,#processchatai::pattern_list ${pos}} set,what_ptn ?{lerase,#processchatai::pattern_list ${pos}}
lerase,#processchatai::register_list ${pos} lerase,#processchatai::register_list ${pos}
logdetail Dropped ChatAI for script '${what_sc}', cond [${what_cond}], pattern [${what_ptn}] logdetail Dropped ChatAI for script '${what_sc}', cond [${what_cond}], pattern [${what_ptn}]
add,amount 1 add,amount 1
endloop endloop
unset what_sc unset what_sc
unset what_cond unset what_cond
unset what_ptn unset what_ptn
unset pos unset pos
return ${amount} return ${amount}
// ---------------------------------- // ----------------------------------
#script=processchatai #script=processchatai
// ---------------------------------- // ----------------------------------
// purpose: iterate over registered AI scripts, test if the chat message matches a given condition, // purpose: iterate over registered AI scripts, test if the chat message matches a given condition,
// and execute appropriate script with predefined arguments. // and execute appropriate script with predefined arguments.
// returns: false if the incoming chatmessage was invalid, else true // returns: false if the incoming chatmessage was invalid, else true
// TODO: get object name (player or creature) and pass it to the called scripts // TODO: get object name (player or creature) and pass it to the called scripts
// if the list doesnt exist, it will return "", but this counts as false also // if the list doesnt exist, it will return "", but this counts as false also
if ?{not ?{llen pattern_list}} if ?{not ?{llen pattern_list}}
return return
endif endif
// filter out chat messages that came from us // filter out chat messages that came from us
if ?{equal,${@myguid} ${@2}} if ?{equal,${@myguid} ${@2}}
return false return false
endif endif
// filter out CHAT_MSG_WHISPER_INFORM ("whisper to ... : blah blah") // filter out CHAT_MSG_WHISPER_INFORM ("whisper to ... : blah blah")
if ?{equal,${@0} 7} if ?{equal,${@0} 7}
return false return false
endif endif
set,msg ?{lowercase ${@def}} set,msg ?{lowercase ${@def}}
default,filter { !?,;.:-_\\/<>()[]"$=+&#'*~`´^°} default,filter { !?,;.:-_\\/<>()[]"$=+&#'*~`´^°}
// split the msg into a list containing only words. remove special characters also. // split the msg into a list containing only words. remove special characters also.
lcsplit,wlist,{${filter}} ${msg} lcsplit,wlist,{${filter}} ${msg}
// remove empty entries // remove empty entries
lclean,wlist lclean,wlist
// obtain name of the language that was used // obtain name of the language that was used
set,langname ?{GetSCPValue,language,${@1} name} set,langname ?{GetSCPValue,language,${@1} name}
default,langname UNKNOWN default,langname UNKNOWN
set,i 0 set,i 0
set,len ?{llen pattern_list} set,len ?{llen pattern_list}
loop loop
if ?{bigger_eq,${i} ${len}} if ?{bigger_eq,${i} ${len}}
exitloop exitloop
endif endif
set,script ?{lindex,script_list ${i}} set,script ?{lindex,script_list ${i}}
set,cond ?{lindex,cond_list ${i}} set,cond ?{lindex,cond_list ${i}}
set,pattern ?{lindex,pattern_list ${i}} set,pattern ?{lindex,pattern_list ${i}}
set,call false set,call false
if ?{equal,NONE ${cond}} if ?{equal,NONE ${cond}}
set,call true set,call true
else else
if ?{equal,ANY ${cond}} if ?{equal,ANY ${cond}}
set,call ?{lcontains_ext,wlist,{ } ${pattern}} set,call ?{lcontains_ext,wlist,{ } ${pattern}}
else else
if ?{equal,EXACT ${cond}} if ?{equal,EXACT ${cond}}
set,call ?{equal,{${pattern}} ${msg}} set,call ?{equal,{${pattern}} ${msg}}
else else
if ?{equal,EXACT_PARTIAL ${cond}} if ?{equal,EXACT_PARTIAL ${cond}}
set,call ?{strlen ?{strfind,{${pattern}} ${msg}}} set,call ?{strlen ?{strfind,{${pattern}} ${msg}}}
else else
if ?{equal,ALL ${cond}} if ?{equal,ALL ${cond}}
// split the pattern into a list, then get its size. the amount of words matching the pattern list must be // split the pattern into a list, then get its size. the amount of words matching the pattern list must be
// equal or greater then the amount of words in the pattern list // equal or greater then the amount of words in the pattern list
lcsplit,tmpl,{${filter}} ${pattern} lcsplit,tmpl,{${filter}} ${pattern}
lclean,tmpl lclean,tmpl
set,pattln ?{llen tmpl} set,pattln ?{llen tmpl}
set,matched ?{lcontains_ext,wlist,{ } ${pattern}} set,matched ?{lcontains_ext,wlist,{ } ${pattern}}
set,call ?{greater_eq,${matched} ${pattln}} set,call ?{greater_eq,${matched} ${pattln}}
unset pattln unset pattln
unset matched unset matched
ldelete tmpl ldelete tmpl
endif endif
endif endif
endif endif
endif endif
endif endif
if ${call} if ${call}
// logdebug DEBUG: ChatAI: calling script ${script}, condition ${cond} matched. // logdebug DEBUG: ChatAI: calling script ${script}, condition ${cond} matched.
${script},{${@0}},{${@1}},{${@2}},{${@3}},{${langname}} ${@def} ${script},{${@0}},{${@1}},{${@2}},{${@3}},{${langname}} ${@def}
//else //else
// logdebug DEBUG: ChatAI: NOT called script ${script}, condition ${cond} not matched. // logdebug DEBUG: ChatAI: NOT called script ${script}, condition ${cond} not matched.
endif endif
add,i 1 add,i 1
endloop endloop
// cleanup // cleanup
ldelete wlist ldelete wlist
return true return true
// ---------------------------------- // ----------------------------------
#script=RegisterChatAIScript #script=RegisterChatAIScript
// ---------------------------------- // ----------------------------------
// purpose: registers a custom script to handle an incoming chat message if a condition is matched. // purpose: registers a custom script to handle an incoming chat message if a condition is matched.
// args: // args:
// @def: word pattern (words are delimited with spaces) // @def: word pattern (words are delimited with spaces)
// @0: script name that has to be called if the condition is matched // @0: script name that has to be called if the condition is matched
// @1: condition. allowed values are: // @1: condition. allowed values are:
// ALL - the chat message must contain all words provided // ALL - the chat message must contain all words provided
// ANY - the chat message must contain any word provided // ANY - the chat message must contain any word provided
// ALL_ORDER - same like all, but in the order provided -- NOT YET IMPLEMENTED // ALL_ORDER - same like all, but in the order provided -- NOT YET IMPLEMENTED
// ALL_CONSECUTIVE - same like ALL_ORDER, but the words must follow exactly one after another -- NOT YET IMPLEMENTED // ALL_CONSECUTIVE - same like ALL_ORDER, but the words must follow exactly one after another -- NOT YET IMPLEMENTED
// EXACT - the chat message must be exactly equal to the string supplied. // EXACT - the chat message must be exactly equal to the string supplied.
// EXACT_PARTIAL - the chat message must contain the string supplied. // EXACT_PARTIAL - the chat message must contain the string supplied.
// NONE - the script will be always called; no testing is done. its up to the user how to deal with it. (default) // NONE - the script will be always called; no testing is done. its up to the user how to deal with it. (default)
// note that @def is not case sensitive! // note that @def is not case sensitive!
if ?{not ?{strlen ${@0}}} if ?{not ?{strlen ${@0}}}
logerror Script error: RegisterChatAIScript: no function defined (called by '${@caller}') logerror Script error: RegisterChatAIScript: no function defined (called by '${@caller}')
return false return false
endif endif
set,pattern ?{lowercase ${@def}} set,pattern ?{lowercase ${@def}}
set,cond ?{uppercase ${@1}} set,cond ?{uppercase ${@1}}
default,cond NONE default,cond NONE
if ?{lcontains,#processchatai::register_list {[${@0};${pattern};${cond}]}} if ?{lcontains,#processchatai::register_list {[${@0};${pattern};${cond}]}}
logdebug Chat AI script already registered. script: '${@0}', condition: ${cond}, pattern: '${@def}' logdebug Chat AI script already registered. script: '${@0}', condition: ${cond}, pattern: '${@def}'
return false return false
endif endif
lpushback,#processchatai::pattern_list ${pattern} lpushback,#processchatai::pattern_list ${pattern}
lpushback,#processchatai::script_list ${@0} lpushback,#processchatai::script_list ${@0}
lpushback,#processchatai::cond_list ${cond} lpushback,#processchatai::cond_list ${cond}
lpushback,#processchatai::register_list {[${@0};${pattern};${cond}]} lpushback,#processchatai::register_list {[${@0};${pattern};${cond}]}
logdetail Chat AI script registered. script: '${@0}', condition: ${cond}, pattern: '${pattern}' [now ?{llen #processchatai::pattern_list} registered] logdetail Chat AI script registered. script: '${@0}', condition: ${cond}, pattern: '${pattern}' [now ?{llen #processchatai::pattern_list} registered]
return true return true

View File

@ -1,114 +1,114 @@
// ----==== CHAT MESSAGES ====---- // ----==== CHAT MESSAGES ====----
// ------------------------------------------- // -------------------------------------------
#script=_onchatmessage #script=_onchatmessage
// purpose: do something if specific chat messages are recieved. // purpose: do something if specific chat messages are recieved.
// args: // args:
// @def: chat message text // @def: chat message text
// @0: message type id (check ChatMsg enum in src/Client/SharedDefines.h) // @0: message type id (check ChatMsg enum in src/Client/SharedDefines.h)
// @1: language id (also defined in SharedDefines.h), alternatively look up bin/data/scp/language.scp // @1: language id (also defined in SharedDefines.h), alternatively look up bin/data/scp/language.scp
// @2: GUID of the player or creature this msg came from // @2: GUID of the player or creature this msg came from
// @3: channel name. empty string if the chat message was not sent in a channel (for example say, yell or whisper) // @3: channel name. empty string if the chat message was not sent in a channel (for example say, yell or whisper)
//-------------------------------------------- //--------------------------------------------
processchatai,{${@0}},{${@1}},{${@2}},{${@3}} ${@def} // this is required for the ChatAI script to work processchatai,{${@0}},{${@1}},{${@2}},{${@3}} ${@def} // this is required for the ChatAI script to work
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// ----==== TELEPORTATION ====---- // ----==== TELEPORTATION ====----
#script=_onteleport #script=_onteleport
// @def: [far teleport=true, else false] // @def: [far teleport=true, else false]
// @0: [far teleport: map ID, else teleported GUID] // @0: [far teleport: map ID, else teleported GUID]
// @1: X position // @1: X position
// @2: Y position // @2: Y position
// @3: Z position // @3: Z position
// @4: Orientation // @4: Orientation
//- script content here... //- script content here...
// ----==== GUI RELATED ====---- // ----==== GUI RELATED ====----
#script=_onguiclose #script=_onguiclose
// no args. gets called when the GUI is closed. // no args. gets called when the GUI is closed.
if ?{GetVar #EXITONGUICLOSE} if ?{GetVar #EXITONGUICLOSE}
exit exit
endif endif
// ----==== OBJECT HANDLING ====---- // ----==== OBJECT HANDLING ====----
#script=_onobjectcreate #script=_onobjectcreate
// @def: GUID of created object // @def: GUID of created object
// @0 TypeID of created object // @0 TypeID of created object
// The object can be accessed with GetName, GetEntry, GetObjectType, GetObjectValue, GetRace, GetClass, ... via the guid // The object can be accessed with GetName, GetEntry, GetObjectType, GetObjectValue, GetRace, GetClass, ... via the guid
//- script content here... //- script content here...
#script=_onobjectdelete #script=_onobjectdelete
// @def: GUID of deleted object // @def: GUID of deleted object
// @0: TypeID of deleted object // @0: TypeID of deleted object
// @1: [out of range object deletion=true, else false] // @1: [out of range object deletion=true, else false]
// The object can be accessed with the object handling functions listed above. // The object can be accessed with the object handling functions listed above.
// It will be deleted right after handling this script. // It will be deleted right after handling this script.
//- script content here... //- script content here...
// ----==== ENTERING/LEAVING WORLD ====---- // ----==== ENTERING/LEAVING WORLD ====----
#script=_leaveworld #script=_leaveworld
// no args. gets called when the world is left. // no args. gets called when the world is left.
//- script content here... //- script content here...
#script=_enterworld #script=_enterworld
// no args. called when the world is entered // no args. called when the world is entered
log * World entered! log * World entered!
say [${@version_short}] login successful. say [${@version_short}] login successful.
emote 126 // = TEXTEMOTE_READY emote 126 // = TEXTEMOTE_READY
joinchannel General joinchannel General
joinchannel Trade joinchannel Trade
joinchannel LookingForGroup joinchannel LookingForGroup
castspell 836 // LoginEffect castspell 836 // LoginEffect
// ----==== IN-GAME SCRIPT COMMANDS ====---- // ----==== IN-GAME SCRIPT COMMANDS ====----
#script=_nopermission #script=_nopermission
// this script gets executed if a player tries to give pseuwow a command but is not allowed to // this script gets executed if a player tries to give pseuwow a command but is not allowed to
// Arguments: // Arguments:
// ========== // ==========
// @0 : name of the player who wanted to execute a command // @0 : name of the player who wanted to execute a command
// @1 : permission level of this user // @1 : permission level of this user
// @2 : permission level needed to execute the script // @2 : permission level needed to execute the script
// @3 : name of the script that should get executed // @3 : name of the script that should get executed
SAY Forget it, ${@0}, you have only permission ${@1} but need ${@2} to run the script '${@3}' SAY Forget it, ${@0}, you have only permission ${@1} but need ${@2} to run the script '${@3}'
LOG Player '${@0}' (p:${@1}) wanted to execute '${@3}' (p:${@2}) LOG Player '${@0}' (p:${@1}) wanted to execute '${@3}' (p:${@2})
EMOTE 66 // say NO! EMOTE 66 // say NO!
// ----==== INTERNAL/MISC ====---- // ----==== INTERNAL/MISC ====----
#script=_onworldsessioncreate #script=_onworldsessioncreate
// no args. called when an instance of the WorldSession class is created // no args. called when an instance of the WorldSession class is created
//- script content here //- script content here
#script=_onworldsessiondelete #script=_onworldsessiondelete
// no args. called when an instance of the WorldSession class is deleted // no args. called when an instance of the WorldSession class is deleted
//- script content here //- script content here

View File

@ -1,176 +1,176 @@
// core functions. required by other scripts to run! // core functions. required by other scripts to run!
#onload #onload
log * Loading core scripts... log * Loading core scripts...
#/onload #/onload
//-------------------------------------------------------- //--------------------------------------------------------
#script=append #script=append
//-------------------------------------------------------- //--------------------------------------------------------
// usage: append text to a string. // usage: append text to a string.
// args: // args:
// @def: text to append // @def: text to append
// @0: variable to which the text should be appended // @0: variable to which the text should be appended
// get the var name if the original variable // get the var name if the original variable
SET,v #${@caller}::${@0} SET,v #${@caller}::${@0}
// if it has not been set before, init it now // if it has not been set before, init it now
DEFAULT,${v} DEFAULT,${v}
// append to the original var. inner ${..} gets the var name, outer ${..} get the value of the var name we just got. // append to the original var. inner ${..} gets the var name, outer ${..} get the value of the var name we just got.
SET,${v} ${${v}}${@def} SET,${v} ${${v}}${@def}
// remove the name placeholder // remove the name placeholder
UNSET v UNSET v
//-------------------------------------------------------- //--------------------------------------------------------
#script=exloadscp #script=exloadscp
#permission=255 #permission=255
//-------------------------------------------------------- //--------------------------------------------------------
if ?{fileexists ${@def}} if ?{fileexists ${@def}}
loadscp,{${@0}} ${@def} loadscp,{${@0}} ${@def}
else else
logdebug skipped loading of non-existent file '${@def}' logdebug skipped loading of non-existent file '${@def}'
endif endif
//-------------------------------------------------------- //--------------------------------------------------------
#script=loadallscp #script=loadallscp
#permission=255 #permission=255
//-------------------------------------------------------- //--------------------------------------------------------
LOG * Loading SCP data storages... LOG * Loading SCP data storages...
// example: // example:
// LOADSCP,test data/test.scp // LOADSCP,test data/test.scp
// load default databases // load default databases
LOADSCP,class data/scp/class.scp LOADSCP,class data/scp/class.scp
LOADSCP,gender data/scp/gender.scp LOADSCP,gender data/scp/gender.scp
LOADSCP,language data/scp/language.scp LOADSCP,language data/scp/language.scp
LOADSCP,map data/scp/map.scp LOADSCP,map data/scp/map.scp
LOADSCP,race data/scp/race.scp LOADSCP,race data/scp/race.scp
// load extended databases if present. // load extended databases if present.
EXLOADSCP,sound data/scp/sound.scp EXLOADSCP,sound data/scp/sound.scp
EXLOADSCP,emote data/scp/emote.scp EXLOADSCP,emote data/scp/emote.scp
EXLOADSCP,zone data/scp/zone.scp EXLOADSCP,zone data/scp/zone.scp
LOG * SCP loaded. LOG * SCP loaded.
//------------------------------------------------- //-------------------------------------------------
#script=string_is_command #script=string_is_command
//------------------------------------------------- //-------------------------------------------------
// purpose: detect if @def might be a server command. // purpose: detect if @def might be a server command.
// split all chars we have set in the config files to a list. // split all chars we have set in the config files to a list.
lsplit,#CMDCHARLIST ${#OTHER_CMD_CHARS} lsplit,#CMDCHARLIST ${#OTHER_CMD_CHARS}
// find out the first char of the string // find out the first char of the string
SET,c ?{SUBSTR,1 ${@def}} SET,c ?{SUBSTR,1 ${@def}}
// does the char list contain our first char? if yes it can trigger a server command. // does the char list contain our first char? if yes it can trigger a server command.
if ?{lcontains,#CMDCHARLIST ${c}} if ?{lcontains,#CMDCHARLIST ${c}}
unset c unset c
return true return true
endif endif
unset c unset c
return false return false
//-------------------------------------------------------- //--------------------------------------------------------
#script=normalize_name #script=normalize_name
//-------------------------------------------------------- //--------------------------------------------------------
// uppercases first char, lowercases rest // uppercases first char, lowercases rest
set,name ?{uppercase ?{substr,1 ${@def}}} set,name ?{uppercase ?{substr,1 ${@def}}}
set,len ?{strlen ${@def}} set,len ?{strlen ${@def}}
sub,len 1 sub,len 1
append,name ?{lowercase ?{substr,${len},1 ${@def}}} append,name ?{lowercase ?{substr,${len},1 ${@def}}}
return ${name} return ${name}
//--------------------------------------------------------- //---------------------------------------------------------
#script=globname #script=globname
//--------------------------------------------------------- //---------------------------------------------------------
// purpose: returns the global name of a variable // purpose: returns the global name of a variable
// args: @def: var name, @0 (optional): name of the intended parent func // args: @def: var name, @0 (optional): name of the intended parent func
set,c ?{substr,1 ${@def}} set,c ?{substr,1 ${@def}}
// it is a global var if the varname starts with # or there is no caller script // it is a global var if the varname starts with # or there is no caller script
if ?{or,?{equal,# ${c}} ?{not ${@caller}}} if ?{or,?{equal,# ${c}} ?{not ${@caller}}}
return ${@def} return ${@def}
endif endif
set,top ${@0} set,top ${@0}
default,top ${@caller} default,top ${@caller}
return #${top}::${@def} return #${top}::${@def}
//--------------------------------------------------------- //---------------------------------------------------------
#script=sclistname #script=sclistname
//--------------------------------------------------------- //---------------------------------------------------------
// purpose: returns the global name of a script list // purpose: returns the global name of a script list
// args: @def: script name // args: @def: script name
set,c ?{substr,1 ${@def}} set,c ?{substr,1 ${@def}}
// it is a global name already if the script name starts with # or there is no caller script // it is a global name already if the script name starts with # or there is no caller script
if ?{or,?{equal,# ${c}} ?{not ${@caller}}} if ?{or,?{equal,# ${c}} ?{not ${@caller}}}
return ${@def} return ${@def}
endif endif
return #DEFSCRIPT::SCRIPT::${@def} return #DEFSCRIPT::SCRIPT::${@def}
//--------------------------------------------------------- //---------------------------------------------------------
#script=getvar #script=getvar
//--------------------------------------------------------- //---------------------------------------------------------
// purpose: returns the value of a variable. if the variable hasnt been set return empty string. // purpose: returns the value of a variable. if the variable hasnt been set return empty string.
set,top ${@caller} set,top ${@caller}
default,top # default,top #
set,v ?{globname,${top} ${@def}} set,v ?{globname,${top} ${@def}}
unset top unset top
//out getvar: v=${v} -> ${${v}} //out getvar: v=${v} -> ${${v}}
if ?{isset ${v}} if ?{isset ${v}}
return ${${v}} return ${${v}}
endif endif
return return
//--------------------------------------------------------- //---------------------------------------------------------
#script=reverse #script=reverse
//--------------------------------------------------------- //---------------------------------------------------------
// purpose: reverse a srtring // purpose: reverse a srtring
// args: @def: string to reverse // args: @def: string to reverse
// returns: reversed string // returns: reversed string
set,outstr set,outstr
set,elems ?{lsplit,mylist ${@def}} set,elems ?{lsplit,mylist ${@def}}
set,i ${elems} set,i ${elems}
loop loop
sub,i 1 sub,i 1
if ?{equal,${i} -1} if ?{equal,${i} -1}
exitloop exitloop
endif endif
append,outstr ?{lindex,mylist ${i}} append,outstr ?{lindex,mylist ${i}}
endloop endloop
ldelete mylist ldelete mylist
return ${outstr} return ${outstr}
//-------------------------------------------------------- //--------------------------------------------------------
#script=appenddef #script=appenddef
//-------------------------------------------------------- //--------------------------------------------------------
// purpose: append a line of code to a script // purpose: append a line of code to a script
// args: @0: script name; @def: code // args: @0: script name; @def: code
// be sure that the code you append is valid and working DefScript code! (no if/loop block mismatches, etc) // be sure that the code you append is valid and working DefScript code! (no if/loop block mismatches, etc)
// if you need to use { or }, escape them: "appenddef,myscript log Myscript: finished, @def=$\{@def\}" // if you need to use { or }, escape them: "appenddef,myscript log Myscript: finished, @def=$\{@def\}"
set,sc ?{lowercase ${@0}} set,sc ?{lowercase ${@0}}
if ?{and,{?{strlen ${@def}}} ?{strlen ${sc}}} if ?{and,{?{strlen ${@def}}} ?{strlen ${sc}}}
if ?{not ?{ScriptExists ${sc}}} if ?{not ?{ScriptExists ${sc}}}
createdef ${sc} createdef ${sc}
endif endif
lpushback,{?{sclistname ${sc}}} ${@def} lpushback,{?{sclistname ${sc}}} ${@def}
unset cmd unset cmd
endif endif
//--------------------------------------------------------- //---------------------------------------------------------
#script=scripthasline #script=scripthasline
//--------------------------------------------------------- //---------------------------------------------------------
// purpose: check if a script has a certain line of code (exact match) // purpose: check if a script has a certain line of code (exact match)
// args: // args:
// @0: script name // @0: script name
// @def: line of text to look for // @def: line of text to look for
return ?{lcontains,{?{sclistname ?{lowercase ${@0}}}} ${@def}} return ?{lcontains,{?{sclistname ?{lowercase ${@0}}}} ${@def}}

View File

@ -1,125 +1,125 @@
//------------------------------------------------- //-------------------------------------------------
#script=slap #script=slap
#permission=255 #permission=255
//------------------------------------------------- //-------------------------------------------------
// purpose: let a player fly. (at least works on MaNGOS) // purpose: let a player fly. (at least works on MaNGOS)
// args: @def: player name // args: @def: player name
// returns: guid of the targeted player, else false. empty string if we are not in the world. // returns: guid of the targeted player, else false. empty string if we are not in the world.
// we can use this script only if we are in the world // we can use this script only if we are in the world
if ?{not ${@inworld}} if ?{not ${@inworld}}
logerror Can't slap anything if i am not in the world! logerror Can't slap anything if i am not in the world!
return return
endif endif
// normalize player name. first char uppercased, rest lowercased. // normalize player name. first char uppercased, rest lowercased.
set,name ?{normalize_name ${@def}} set,name ?{normalize_name ${@def}}
// target the player. if targeting was successful, cast spell "Knockback 500". // target the player. if targeting was successful, cast spell "Knockback 500".
set,t ?{target ${name}} set,t ?{target ${name}}
if ${t} if ${t}
logdebug slapping player '${name}' logdebug slapping player '${name}'
castspell 11027 castspell 11027
target target
else else
logerror Can't target player '${name}' logerror Can't target player '${name}'
endif endif
unset name unset name
return ${t} return ${t}
//------------------------------------------------ //------------------------------------------------
#script=toleet #script=toleet
//------------------------------------------------ //------------------------------------------------
// purpose: convert any text into leetspeak [1337sp34k] // purpose: convert any text into leetspeak [1337sp34k]
// args: @def: the text to convert // args: @def: the text to convert
// returns: leetspeak^^ // returns: leetspeak^^
#onload #onload
// this can be used by other scripts to check if we have loaded this script // this can be used by other scripts to check if we have loaded this script
set,#HAVE_LEET true set,#HAVE_LEET true
#endonload #endonload
// empty the string where the leet will be stored // empty the string where the leet will be stored
set,str set,str
// total length of the string to convert // total length of the string to convert
set,l ?{strlen ${@def}} set,l ?{strlen ${@def}}
// position counter // position counter
set,x 0 set,x 0
loop loop
// check if we have reached the end of the string // check if we have reached the end of the string
if ?{bigger,${x} ${l}} if ?{bigger,${x} ${l}}
exitloop exitloop
endif endif
// c stores current char (@def at position x); c2 is the same char but always lowercased // c stores current char (@def at position x); c2 is the same char but always lowercased
set,c ?{substr,1,${x} ${@def}} set,c ?{substr,1,${x} ${@def}}
set,c2 ?{lowercase ${c}} set,c2 ?{lowercase ${c}}
// conversion functions: // conversion functions:
// note that "+" is a variable name here! // note that "+" is a variable name here!
// it will store the "new" char if c/c2 could be converted // it will store the "new" char if c/c2 could be converted
if ?{equal,${c2} a} if ?{equal,${c2} a}
set,+ 4 set,+ 4
endif endif
if ?{equal,${c2} e} if ?{equal,${c2} e}
set,+ 3 set,+ 3
endif endif
if ?{equal,${c2} i} if ?{equal,${c2} i}
set,+ ! set,+ !
endif endif
if ?{equal,${c2} l} if ?{equal,${c2} l}
set,+ 1 set,+ 1
endif endif
if ?{equal,${c2} t} if ?{equal,${c2} t}
set,+ 7 set,+ 7
endif endif
if ?{equal,${c2} s} if ?{equal,${c2} s}
set,+ 5 set,+ 5
endif endif
if ?{equal,${c2} o} if ?{equal,${c2} o}
set,+ 0 set,+ 0
endif endif
if ?{equal,${c2} f} if ?{equal,${c2} f}
set,+ ph set,+ ph
endif endif
if ?{equal,${c2} h} if ?{equal,${c2} h}
set,+ # set,+ #
endif endif
if ?{equal,${c} Z} if ?{equal,${c} Z}
set,+ 7 set,+ 7
endif endif
if ?{equal,${c} R} if ?{equal,${c} R}
set,+ 2 set,+ 2
endif endif
if ?{equal,${c} B} if ?{equal,${c} B}
set,+ <3 set,+ <3
endif endif
// if var "+" is still empty, default it to our current char // if var "+" is still empty, default it to our current char
default,+ ${c} default,+ ${c}
// and append it to the final output // and append it to the final output
append,str ${+} append,str ${+}
// finally delete it again // finally delete it again
unset + unset +
// and increase the counter by 1 // and increase the counter by 1
add,x 1 add,x 1
endloop endloop
unset l unset l
unset x unset x
unset c unset c
unset c2 unset c2
return ${str} return ${str}

View File

@ -1,150 +1,150 @@
#script=hookhelper #script=hookhelper
#onload #onload
set,CurScript set,CurScript
#/onload #/onload
#script=IsHooked #script=IsHooked
// @def: script name // @def: script name
// [@0: hook name / name of script that hooked script in @def] // [@0: hook name / name of script that hooked script in @def]
set,sc ${@0} set,sc ${@0}
default,sc ${@caller} default,sc ${@caller}
return ?{ScriptHasLine,{${@def}} #tag:hook:${sc}} return ?{ScriptHasLine,{${@def}} #tag:hook:${sc}}
#script=HookStart #script=HookStart
// @def: script name // @def: script name
// [@0: calling script] // [@0: calling script]
set,c ${@0} set,c ${@0}
default,c ${@caller} default,c ${@caller}
appenddef,{${@def}} #tag:hook:${c} appenddef,{${@def}} #tag:hook:${c}
set,{#hookhelper::CurScript} ${@def} set,{#hookhelper::CurScript} ${@def}
#script=HookEnd #script=HookEnd
// [@def: name of script that was hooked] // [@def: name of script that was hooked]
// [@0: name of calling script] // [@0: name of calling script]
set,sc ${@def} set,sc ${@def}
default,sc ${#hookhelper::CurScript} default,sc ${#hookhelper::CurScript}
set,c ${@0} set,c ${@0}
default,c ${@caller} default,c ${@caller}
appenddef,{${sc}} #tag:hook-end appenddef,{${sc}} #tag:hook-end
set,#hookhelper::CurScript set,#hookhelper::CurScript
unset ${sc} unset ${sc}
unset sc unset sc
#script=HookAdd #script=HookAdd
// @def: script line // @def: script line
// [@0: script name. default: last script passed to HookStart] // [@0: script name. default: last script passed to HookStart]
set,sc ${@0} set,sc ${@0}
default,sc ${#hookhelper::CurScript} default,sc ${#hookhelper::CurScript}
if ?{not ?{strlen ${sc}}} if ?{not ?{strlen ${sc}}}
return return
endif endif
appenddef,{${sc}} ${@def} appenddef,{${sc}} ${@def}
unset sc unset sc
#script=HookAddList #script=HookAddList
// @def: list name // @def: list name
// [@0: script name. default: last script passed to HookStart] // [@0: script name. default: last script passed to HookStart]
// [@1: name of calling script] // [@1: name of calling script]
set,sc ${@0} set,sc ${@0}
set,c ${@1} set,c ${@1}
default,c ${@caller} default,c ${@caller}
set,l ?{globname,{${c}} ${@def}} set,l ?{globname,{${c}} ${@def}}
default,sc ${#hookhelper::CurScript} default,sc ${#hookhelper::CurScript}
if ?{not ?{strlen ${sc}}} if ?{not ?{strlen ${sc}}}
return return
endif endif
set,i 0 set,i 0
loop loop
if ?{bigger_eq,${i} ?{llen ${l}}} if ?{bigger_eq,${i} ?{llen ${l}}}
exitloop exitloop
endif endif
HookAdd,{${sc}} ?{lindex,{${l}} ${i}} HookAdd,{${sc}} ?{lindex,{${l}} ${i}}
add,i 1 add,i 1
endloop endloop
unset sc unset sc
#script=HookStartOpcode #script=HookStartOpcode
// @def: opcode name // @def: opcode name
// [@0: calling script] // [@0: calling script]
set,c ${@0} set,c ${@0}
default,c ${@caller} default,c ${@caller}
HookStart,{${c}} OPCODE::${@def} HookStart,{${c}} OPCODE::${@def}
#script=UnHook #script=UnHook
// @def: name of script where to remove hook from // @def: name of script where to remove hook from
// [@0: hook name (usually name of script that installed the hook). default: name of calling script] // [@0: hook name (usually name of script that installed the hook). default: name of calling script]
set,target ?{lowercase ${@def}} set,target ?{lowercase ${@def}}
if ?{not ?{scriptexists ${target}}} if ?{not ?{scriptexists ${target}}}
logerror UnHook called for nonexisting script '${target}' by '${@caller}' logerror UnHook called for nonexisting script '${target}' by '${@caller}'
endif endif
set,sc ${@0} set,sc ${@0}
default,sc ${@caller} default,sc ${@caller}
set,sc ?{lowercase ${sc}} set,sc ?{lowercase ${sc}}
set,sl ?{sclistname ${target}} set,sl ?{sclistname ${target}}
set,hn #tag:hook:${sc} set,hn #tag:hook:${sc}
set,hne #tag:hook-end set,hne #tag:hook-end
//logdebug -- sl='${sl}' hn='${hn}' hne='${hne}' //logdebug -- sl='${sl}' hn='${hn}' hne='${hne}'
loop loop
if ?{not ?{IsHooked,{${sc}} ${target}}} if ?{not ?{IsHooked,{${sc}} ${target}}}
//logdebug -- unhook done //logdebug -- unhook done
exitloop exitloop
endif endif
set,p ?{lfind,{${sl}} ${hn}} set,p ?{lfind,{${sl}} ${hn}}
set,line ?{lindex,{${sl}} ${p}} set,line ?{lindex,{${sl}} ${p}}
//logdebug -- line[${p}] = ${line} //logdebug -- line[${p}] = ${line}
if ?{strlen ${p}} // p is empty string if the line wasnt found if ?{strlen ${p}} // p is empty string if the line wasnt found
loop loop
set,line2 ?{lerase,{${sl}} ${p}} set,line2 ?{lerase,{${sl}} ${p}}
//logdebug -- removed: '${line2}' //logdebug -- removed: '${line2}'
if ?{equal,{${line2}} ${hne}} if ?{equal,{${line2}} ${hne}}
exitloop exitloop
endif endif
endloop endloop
endif endif
endloop endloop
unset sl unset sl
unset hn unset hn
unset hne unset hne
unset sc unset sc
#script=UnHookOpcode #script=UnHookOpcode
// @def: opcode name // @def: opcode name
// [@0: name of calling script] // [@0: name of calling script]
set,sc ${@0} set,sc ${@0}
default,sc ${@caller} default,sc ${@caller}
UnHook,{${sc}} OPCODE::${@def} UnHook,{${sc}} OPCODE::${@def}
#script=UnHookAll #script=UnHookAll
// @def: name of script to remove all hooks from // @def: name of script to remove all hooks from
// [@0: name of calling script] // [@0: name of calling script]
set,sc ${@0} set,sc ${@0}
set,sl ?{sclistname ${@def}} set,sl ?{sclistname ${@def}}
set,hn #tag:hook: set,hn #tag:hook:
set,hne #tag:hook-end set,hne #tag:hook-end
set,i 0 set,i 0
set,hookcode false set,hookcode false
loop loop
set,erased false set,erased false
if ?{bigger_eq,${i} ?{llen ${sl}}} if ?{bigger_eq,${i} ?{llen ${sl}}}
exitloop exitloop
endif endif
set,line ?{lindex,{${sl}} ${i}} set,line ?{lindex,{${sl}} ${i}}
if ?{equal,{${hn}} ?{substr,?{strlen ${hn}} ${line}}} if ?{equal,{${hn}} ?{substr,?{strlen ${hn}} ${line}}}
set,hookcode true set,hookcode true
else else
if ?{equal,{${hne}} ?{substr,?{strlen ${hn}} ${line}}} if ?{equal,{${hne}} ?{substr,?{strlen ${hn}} ${line}}}
lerase,{${sl}} ${i} lerase,{${sl}} ${i}
set,hookcode false set,hookcode false
set,erased true set,erased true
endif endif
endif endif
if ${hookcode} if ${hookcode}
lerase,{${sl}} ${i} lerase,{${sl}} ${i}
set,erased true set,erased true
endif endif
if ?{not ${erased}} if ?{not ${erased}}
add,i 1 add,i 1
endif endif
endloop endloop

View File

@ -1,118 +1,118 @@
// scripts used for configuration! DO NOT MODIFY unless you know what you do!! // scripts used for configuration! DO NOT MODIFY unless you know what you do!!
#onload #onload
log * Loading core scripts (internal config)... log * Loading core scripts (internal config)...
#/onload #/onload
//-------------------------------------------------------- //--------------------------------------------------------
#script=exit #script=exit
#permission=255 #permission=255
//-------------------------------------------------------- //--------------------------------------------------------
// just a name alternative // just a name alternative
QUIT QUIT
//-------------------------------------------------------- //--------------------------------------------------------
#script=quit #script=quit
#permission=255 #permission=255
//-------------------------------------------------------- //--------------------------------------------------------
// quit PseuWoW, say goodbye when logged in // quit PseuWoW, say goodbye when logged in
IF ${@inworld} IF ${@inworld}
SAY Terminating proc... SAY Terminating proc...
ENDIF ENDIF
SHDN SHDN
//----------------------------------------------- //-----------------------------------------------
#script=cleanupvars #script=cleanupvars
//----------------------------------------------- //-----------------------------------------------
// purpose: unset all variables that could be abused by someone // purpose: unset all variables that could be abused by someone
LOGDETAIL * Cleaning up variables... LOGDETAIL * Cleaning up variables...
UNSET #ACCPASS UNSET #ACCPASS
UNSET #ACCNAME UNSET #ACCNAME
LOGDETAIL * Dangerous variables removed. LOGDETAIL * Dangerous variables removed.
//----------------------------------------------- //-----------------------------------------------
#script=config #script=config
#permission=255 #permission=255
//----------------------------------------------- //-----------------------------------------------
#onload #onload
// create empty variable. stores if config script was already run successfully once. // create empty variable. stores if config script was already run successfully once.
SET,DONE SET,DONE
#/onload #/onload
// Load all conf files from directory /conf/ // Load all conf files from directory /conf/
// get all *.conf file names from /conf/ directory, store the names in list 'fl' and the amount in 'fcount' // get all *.conf file names from /conf/ directory, store the names in list 'fl' and the amount in 'fcount'
LOG ** Configuring PseuWoW... LOG ** Configuring PseuWoW...
SET,fcount ?{LGETFILES,fl,conf conf} SET,fcount ?{LGETFILES,fl,conf conf}
// sort the list, load conf files alphabetically. // sort the list, load conf files alphabetically.
LSORT fl LSORT fl
IF ?{NOT ${fcount}} IF ?{NOT ${fcount}}
LOGERROR No conf file found! Can't load. LOGERROR No conf file found! Can't load.
RETURN RETURN
ENDIF ENDIF
LOG * Loading ${fcount} conf files. LOG * Loading ${fcount} conf files.
// iterate over all files and load them; if counter i is equal to the amount of files we are done. // iterate over all files and load them; if counter i is equal to the amount of files we are done.
SET,i 0 SET,i 0
LOOP LOOP
IF ?{EQUAL,${i} ${fcount}} IF ?{EQUAL,${i} ${fcount}}
EXITLOOP EXITLOOP
ENDIF ENDIF
SET,fn ?{LINDEX,fl ${i}} SET,fn ?{LINDEX,fl ${i}}
LOG * Loading conf file [ ${fn} ] LOG * Loading conf file [ ${fn} ]
LOADCONF ${fn} LOADCONF ${fn}
ADD,i 1 ADD,i 1
ENDLOOP ENDLOOP
UNSET fcount UNSET fcount
UNSET i UNSET i
UNSET fn UNSET fn
LDELETE fl LDELETE fl
// Apply the configuration // Apply the configuration
APPLYCONF APPLYCONF
LOG * Configuration applied. LOG * Configuration applied.
// Apply user permissions // Apply user permissions
APPLYPERMISSIONS APPLYPERMISSIONS
// remove dangerous variables // remove dangerous variables
CLEANUPVARS CLEANUPVARS
// set permissions for internal functions // set permissions for internal functions
INTERNAL_PERM INTERNAL_PERM
// if its not set in the conf file, default it to "." (WoWEmu & MaNGOS style) // if its not set in the conf file, default it to "." (WoWEmu & MaNGOS style)
DEFAULT,#CMDCHAR . DEFAULT,#CMDCHAR .
LOG ** All Config done. LOG ** All Config done.
SET,DONE true SET,DONE true
//-------------------------------------------------- //--------------------------------------------------
#script=internal_perm #script=internal_perm
#permission=255 #permission=255
//-------------------------------------------------- //--------------------------------------------------
// purpose: set script permissions for internal functions that cant be set otherwise. // purpose: set script permissions for internal functions that cant be set otherwise.
// if you don't set a permission for a script manually, it will have permission 255 (highest) // if you don't set a permission for a script manually, it will have permission 255 (highest)
LOG * Assigning permissions for internal functions... LOG * Assigning permissions for internal functions...
// emotes are hard to abuse, allow for everyone // emotes are hard to abuse, allow for everyone
setscriptpermission,emote 0 setscriptpermission,emote 0
// ... set more permissions here ... // ... set more permissions here ...
// this dummy script does nothing actually but since its loaded last in this file it causes the config // this dummy script does nothing actually but since its loaded last in this file it causes the config
// script to be run before all .def files are loaded // script to be run before all .def files are loaded
// (this is important for scripts that depend on the config already existing during load-time) // (this is important for scripts that depend on the config already existing during load-time)
//------------------------------------------------- //-------------------------------------------------
#script=dummy #script=dummy
//------------------------------------------------- //-------------------------------------------------
#onload #onload
if ?{not ${#config::DONE}} if ?{not ${#config::DONE}}
config config
endif endif
#/onload #/onload

View File

@ -1,136 +1,136 @@
//-------------------------------------------- //--------------------------------------------
#script=lcontains #script=lcontains
//-------------------------------------------- //--------------------------------------------
// return true if any list element matches @def, else return false. // return true if any list element matches @def, else return false.
// @0: list name, @def: search string // @0: list name, @def: search string
set,i 0 set,i 0
set,l ?{globname,{${@caller}} ${@0}} set,l ?{globname,{${@caller}} ${@0}}
if ?{not ?{llen ${l}}} if ?{not ?{llen ${l}}}
return return
endif endif
set,result false set,result false
loop loop
if ?{equal,${i} ?{llen ${l}}} if ?{equal,${i} ?{llen ${l}}}
exitloop exitloop
endif endif
set,elem ?{lindex,{${l}} ${i}} set,elem ?{lindex,{${l}} ${i}}
if ?{equal,{${elem}} ${@def}} if ?{equal,{${elem}} ${@def}}
set,result true set,result true
exitloop exitloop
endif endif
add,i 1 add,i 1
endloop endloop
unset i unset i
unset l unset l
unset elem unset elem
return ${result} return ${result}
// ----------------------------------------- // -----------------------------------------
#script=lcontains_ext #script=lcontains_ext
// ----------------------------------------- // -----------------------------------------
// returns the amount of matched substrings of @def in list @0. // returns the amount of matched substrings of @def in list @0.
// default delimiter is space, override with @1. // default delimiter is space, override with @1.
// by default, any char in @1 serves as delimiter. // by default, any char in @1 serves as delimiter.
// if you set @2 to true, the exact string @1 is used as delimiter (no default is set) // if you set @2 to true, the exact string @1 is used as delimiter (no default is set)
// to check for individual chars in @def, use the following: "lcontains_ex,<list>,,true string_of_chars_for_example" // to check for individual chars in @def, use the following: "lcontains_ex,<list>,,true string_of_chars_for_example"
set,i 0 set,i 0
set,j 0 set,j 0
set,l ?{globname,{${@caller}} ${@0}} set,l ?{globname,{${@caller}} ${@0}}
set,delim ${@1} set,delim ${@1}
if ${@2} if ${@2}
set,engine lsplit set,engine lsplit
else else
set,engine lcsplit set,engine lcsplit
// take care of the whitespaces: we use space as delimiter! // take care of the whitespaces: we use space as delimiter!
default,delim { } default,delim { }
endif endif
${engine},myl,{${delim}} ${@def} ${engine},myl,{${delim}} ${@def}
// list to check must at least contain 1 element // list to check must at least contain 1 element
if ?{not ?{llen ${l}}} if ?{not ?{llen ${l}}}
return 0 return 0
endif endif
// and our pattern list must contain 1 element also // and our pattern list must contain 1 element also
if ?{not ?{llen myl}} if ?{not ?{llen myl}}
return 0 return 0
endif endif
set,result 0 set,result 0
loop loop
if ?{equal,${i} ?{llen ${l}}} if ?{equal,${i} ?{llen ${l}}}
exitloop exitloop
endif endif
set,elem ?{lindex,{${l}} ${i}} set,elem ?{lindex,{${l}} ${i}}
set,j 0 set,j 0
loop loop
if ?{equal,${j} ?{llen myl}} if ?{equal,${j} ?{llen myl}}
exitloop exitloop
endif endif
set,myelem ?{lindex,myl ${j}} set,myelem ?{lindex,myl ${j}}
if ?{equal,{${elem}} ${myelem}} if ?{equal,{${elem}} ${myelem}}
add,result 1 add,result 1
endif endif
add,j 1 add,j 1
endloop endloop
add,i 1 add,i 1
endloop endloop
unset i unset i
unset j unset j
unset l unset l
unset engine unset engine
unset elem unset elem
unset myelem unset myelem
ldelete myl ldelete myl
unset delim unset delim
return ${result} return ${result}
//-------------------------------------------- //--------------------------------------------
#script=lfind #script=lfind
//-------------------------------------------- //--------------------------------------------
// return the position of the first element matching @def // return the position of the first element matching @def
// @0: list name, @def: search string // @0: list name, @def: search string
// @1: ignore case? // @1: ignore case?
// if nothing is found, return empty string // if nothing is found, return empty string
set,i 0 set,i 0
set,l ?{globname,{${@caller}} ${@0}} set,l ?{globname,{${@caller}} ${@0}}
if ?{not ?{llen ${l}}} if ?{not ?{llen ${l}}}
return return
endif endif
set,result set,result
loop loop
if ?{equal,${i} ?{llen ${l}}} if ?{equal,${i} ?{llen ${l}}}
exitloop exitloop
endif endif
set,elem ?{lindex,{${l}} ${i}} set,elem ?{lindex,{${l}} ${i}}
if ${@1} if ${@1}
set,eq ?{equal,{?{lowercase ${elem}}} ?{lowercase ${@def}}} set,eq ?{equal,{?{lowercase ${elem}}} ?{lowercase ${@def}}}
else else
set,eq ?{equal,{${elem}} ${@def}} set,eq ?{equal,{${elem}} ${@def}}
endif endif
if ${eq} if ${eq}
set,result ${i} set,result ${i}
exitloop exitloop
endif endif
add,i 1 add,i 1
endloop endloop
unset i unset i
unset l unset l
unset elem unset elem
return ${result} return ${result}

View File

@ -1,57 +1,57 @@
//----------------------------------------------- //-----------------------------------------------
#script=getchatitem #script=getchatitem
#permission=255 #permission=255
//----------------------------------------------- //-----------------------------------------------
// expected args: // expected args:
// @def: item id // @def: item id
// @0 (optional): color (in RGB hex format: 00FF00 = pure green) // @0 (optional): color (in RGB hex format: 00FF00 = pure green)
// returns: clickable item link to use it chat messages // returns: clickable item link to use it chat messages
SET,i ${@def} SET,i ${@def}
SET,color ${@0} SET,color ${@0}
DEFAULT,i 0 DEFAULT,i 0
TOINT,i ${i} TOINT,i ${i}
DEFAULT,color 6679FF DEFAULT,color 6679FF
SET,link |cff${color}|Hitem:${i}:0:0:0:0:0:0:0|h[Item ${i}]|h|r SET,link |cff${color}|Hitem:${i}:0:0:0:0:0:0:0|h[Item ${i}]|h|r
UNSET i UNSET i
UNSET color UNSET color
RETURN ${link} RETURN ${link}
//----------------------------------------------- //-----------------------------------------------
#script=makechatitem #script=makechatitem
#permission=255 #permission=255
//----------------------------------------------- //-----------------------------------------------
// purpose: write the text of a clickable item link into a variable // purpose: write the text of a clickable item link into a variable
// expected args: // expected args:
// @def: item id // @def: item id
// @0: variable name to write into // @0: variable name to write into
// @1 (optional): color (in hex format: 00FF00 = pure green) // @1 (optional): color (in hex format: 00FF00 = pure green)
SET,v #${@caller}::${target} SET,v #${@caller}::${target}
SET,{${v}} ?{getchatitem,{${@1}} ${@def}} SET,{${v}} ?{getchatitem,{${@1}} ${@def}}
UNSET v UNSET v
//----------------------------------------------- //-----------------------------------------------
#script=outv #script=outv
#permission=0 #permission=0
//----------------------------------------------- //-----------------------------------------------
// purpose: output a variable's value to the console. // purpose: output a variable's value to the console.
// usage: "outv x" // usage: "outv x"
SET,vn #${@caller}::${@def} SET,vn #${@caller}::${@def}
IF ?{NOT ?{ISSET ${vn}}} IF ?{NOT ?{ISSET ${vn}}}
OUT * Var '${@def}' not defined. OUT * Var '${@def}' not defined.
RETURN RETURN
ENDIF ENDIF
SET,vv ${${vn}} SET,vv ${${vn}}
OUT * Var '${@def}' = '${vv}' OUT * Var '${@def}' = '${vv}'
UNSET vv UNSET vv
UNSET vn UNSET vn

View File

@ -1,40 +1,40 @@
// example file. wrap a few functions together. // example file. wrap a few functions together.
//------------------------------------------------ //------------------------------------------------
#script=gc #script=gc
#permission=0 #permission=0
//------------------------------------------------ //------------------------------------------------
// example script to write into channel "generalchat" // example script to write into channel "generalchat"
// usage: "gc bla bla..." // usage: "gc bla bla..."
chan,generalchat ${@def} chan,generalchat ${@def}
//------------------------------------------------ //------------------------------------------------
#script=gcl #script=gcl
#permission=0 #permission=0
//------------------------------------------------ //------------------------------------------------
// write leetspeak to channel generalchat (see "gc" script) // write leetspeak to channel generalchat (see "gc" script)
// usage: "gcl moo, cow syndrome!" // usage: "gcl moo, cow syndrome!"
gc ?{toleet ${@def}} gc ?{toleet ${@def}}
//------------------------------------------------ //------------------------------------------------
#script=selfheal #script=selfheal
#permission=0 #permission=0
//------------------------------------------------ //------------------------------------------------
// purpose: heal self with full hp. GM-ONLY!! // purpose: heal self with full hp. GM-ONLY!!
// be sure you have this spell in your spellbook! // be sure you have this spell in your spellbook!
// DO NOT USE THIS SCRIPT IF YOU ARE NO GM! // DO NOT USE THIS SCRIPT IF YOU ARE NO GM!
// target self (the name we used to login) // target self (the name we used to login)
TARGET ${#CHARNAME} TARGET ${#CHARNAME}
// 23965 = instant heal // 23965 = instant heal
CASTSPELL 23965 CASTSPELL 23965
//------------------------------------------------ //------------------------------------------------
#script=sl #script=sl
#permission=0 #permission=0
//------------------------------------------------ //------------------------------------------------
// say leetspeak text. gm-commands can't be executed this way // say leetspeak text. gm-commands can't be executed this way
s,{${@0}} ?{toleet ${@def}} s,{${@0}} ?{toleet ${@def}}

View File

@ -1,46 +1,46 @@
// -- using conf/ScriptConfig.conf // -- using conf/ScriptConfig.conf
// run this file to broadcast immediately (the timer will not change if you do!) // run this file to broadcast immediately (the timer will not change if you do!)
#permission=255 #permission=255
#onload #onload
// check if this script should be loaded. // check if this script should be loaded.
if ?{or,?{not ?{isset enable}} ?{not ${enable}}} if ?{or,?{not ?{isset enable}} ?{not ${enable}}}
log ** AutoBroadcast: skipped loading. log ** AutoBroadcast: skipped loading.
return return
endif endif
// convert secs into msecs // convert secs into msecs
set,timer ${secs} set,timer ${secs}
mul,timer 1000 mul,timer 1000
// we need this variable later as "array-index" // we need this variable later as "array-index"
set,x 0 set,x 0
// unregister the timer if it has been registered before // unregister the timer if it has been registered before
removeevent event_{${@myname}} removeevent event_{${@myname}}
// register the timer. // register the timer.
// script name is "autobroadcast", so the event name will be "event_autobroadcast" and the script command to call will be "autobroadcast" // script name is "autobroadcast", so the event name will be "event_autobroadcast" and the script command to call will be "autobroadcast"
// so we basically register ourselves // so we basically register ourselves
addevent,event_{${@myname}},${timer} ${@myname} addevent,event_{${@myname}},${timer} ${@myname}
// yay we are loaded :) // yay we are loaded :)
log ** AutoBroadcast loaded. ${textcount} Texts. log ** AutoBroadcast loaded. ${textcount} Texts.
#endonload #endonload
// --- begin of the script body --- // --- begin of the script body ---
// every call the value of x gets increased by 1 // every call the value of x gets increased by 1
add,x 1 add,x 1
// broadcast the text number x // broadcast the text number x
CMD ${cmd} ${text${x}} CMD ${cmd} ${text${x}}
// if x = textcount: reset text counter x to 0 (using the modulo operator) // if x = textcount: reset text counter x to 0 (using the modulo operator)
mod,x ${textcount} mod,x ${textcount}

View File

@ -1,36 +1,36 @@
#permission=255 #permission=255
// PSEUWOW DEF_SCRIPT WORLD-ENTER FILE // PSEUWOW DEF_SCRIPT WORLD-ENTER FILE
LOG * World entered, executing appropriate script... LOG * World entered, executing appropriate script...
// MaNGOS: make PseuWoW invincible // MaNGOS: make PseuWoW invincible
// CMD gmon // CMD gmon
// you can also teleport on every startup to a certain player... // you can also teleport on every startup to a certain player...
// simple: use the .goname command as usual. // simple: use the .goname command as usual.
// SAY .goname Gamemaster // SAY .goname Gamemaster
// or teleport to a specific loacation... // or teleport to a specific loacation...
// CMD tele gmisland // CMD tele gmisland
// to know everything worked fine, etc // to know everything worked fine, etc
SAY [${@version_short}] login successful. SAY [${@version_short}] login successful.
// yaay we are online. Ready! // yaay we are online. Ready!
// 126 = TEXTEMOTE_READY // 126 = TEXTEMOTE_READY
EMOTE 126 EMOTE 126
// join some channels... // join some channels...
JOINCHANNEL General JOINCHANNEL General
JOINCHANNEL LookingForGroup JOINCHANNEL LookingForGroup
// and a custom channel // and a custom channel
JOINCHANNEL generlachat JOINCHANNEL generlachat
// Spell 836 = LoginEffect // Spell 836 = LoginEffect
CASTSPELL 836 CASTSPELL 836
// add your own stuff here // add your own stuff here
// ... // ...
LOG * finished executing script. LOG * finished executing script.

View File

@ -1,3 +1,3 @@
#permission=255 #permission=255
// EXECUTED WHEN THE WORLD IS LEFT // EXECUTED WHEN THE WORLD IS LEFT

View File

@ -1,14 +1,14 @@
// this script gets executed if a player tries to give pseuwow a command but is not allowed to // this script gets executed if a player tries to give pseuwow a command but is not allowed to
// Arguments: // Arguments:
// ========== // ==========
// @0 : name of the player who wanted to execute a command // @0 : name of the player who wanted to execute a command
// @1 : permission level of this user // @1 : permission level of this user
// @2 : permission level needed to execute the script // @2 : permission level needed to execute the script
// @3 : name of the script that should get executed // @3 : name of the script that should get executed
SAY Forget it, ${@0}, you have only permission ${@1} but need ${@2} to run the script '${@3}' SAY Forget it, ${@0}, you have only permission ${@1} but need ${@2} to run the script '${@3}'
LOG Player '${@0}' (p:${@1}) wanted to execute '${@3}' (p:${@2}) LOG Player '${@0}' (p:${@1}) wanted to execute '${@3}' (p:${@2})
// say NO! // say NO!
EMOTE 66 EMOTE 66

View File

@ -1,4 +1,4 @@
// EXECUTED EVERYTIME A WHISPER IS BEEING RECIEVED // EXECUTED EVERYTIME A WHISPER IS BEEING RECIEVED
// comment out the following line if you dont need it // comment out the following line if you dont need it
//REPLY,0 [BOT] No need to whisper, nobody is here who could read what you wrote. //REPLY,0 [BOT] No need to whisper, nobody is here who could read what you wrote.

View File

@ -1,22 +1,22 @@
// temporary wrapper for requesting info about a certain player until implemented into the core // temporary wrapper for requesting info about a certain player until implemented into the core
#script=SendWhoForPlayer #script=SendWhoForPlayer
// minlvl 0 // minlvl 0
bbappend,pkt,uint32 0 bbappend,pkt,uint32 0
// maxlvl 100 // maxlvl 100
bbappend,pkt,uint32 100 bbappend,pkt,uint32 100
// player name, case-sensitive string // player name, case-sensitive string
bbappend,pkt,string ${@def} bbappend,pkt,string ${@def}
// no guild, empty string // no guild, empty string
bbappend,pkt,string bbappend,pkt,string
// racemask - all races // racemask - all races
bbappend,pkt,uint32 0xFFFFFFFF bbappend,pkt,uint32 0xFFFFFFFF
// classmask - all classes // classmask - all classes
bbappend,pkt,uint32 0xFFFFFFFF bbappend,pkt,uint32 0xFFFFFFFF
// 0 zones to check // 0 zones to check
bbappend,pkt,uint32 0 bbappend,pkt,uint32 0
// 0 additional strings // 0 additional strings
bbappend,pkt,uint32 0 bbappend,pkt,uint32 0
SendWorldPacket,{?{GetOpcodeID CMSG_WHO}} pkt SendWorldPacket,{?{GetOpcodeID CMSG_WHO}} pkt
bbdelete pkt bbdelete pkt

View File

@ -1,29 +1,29 @@
#script=bbexample #script=bbexample
bbinit,50 mybb bbinit,50 mybb
bbappend,mybb,uint32 123456 bbappend,mybb,uint32 123456
bbappend,mybb,uint8 255 bbappend,mybb,uint8 255
bbappend,mybb,float 3.141592 bbappend,mybb,float 3.141592
bbappend,mybb,string Hello World! bbappend,mybb,string Hello World!
bbappend,mybb,uint32 0xDEADBABE bbappend,mybb,uint32 0xDEADBABE
bbappend,mybb,uint16 1024 bbappend,mybb,uint16 1024
bbappend,mybb,uint64 0 bbappend,mybb,uint64 0
bbappend,mybb,uint64 0 bbappend,mybb,uint64 0
out ByteBuffer Example: out ByteBuffer Example:
bbhexlike mybb bbhexlike mybb
bbtextlike mybb bbtextlike mybb
bbrpos,mybb 0 bbrpos,mybb 0
out Reading uint32 - ?{bbread,mybb uint32} out Reading uint32 - ?{bbread,mybb uint32}
out Reading uint8 - ?{bbread,mybb uint8} out Reading uint8 - ?{bbread,mybb uint8}
out Reading float - ?{bbread,mybb float} out Reading float - ?{bbread,mybb float}
out Reading string - ?{bbread,mybb string} out Reading string - ?{bbread,mybb string}
set,t ?{bbread,mybb uint32} set,t ?{bbread,mybb uint32}
out Reading uint32 - ${t} hex: ?{tohex ${t}} out Reading uint32 - ${t} hex: ?{tohex ${t}}
out Reading uint16 - ?{bbread,mybb uint16} out Reading uint16 - ?{bbread,mybb uint16}
out skipping 16 bytes out skipping 16 bytes
bbread,mybb uint64 bbread,mybb uint64
bbread,mybb uint64 bbread,mybb uint64
out read from invalid position: result='?{bbread,mybb uint8}' out read from invalid position: result='?{bbread,mybb uint8}'
bbdelete mybb bbdelete mybb

View File

@ -1,39 +1,39 @@
// example script that registers itself to get called on incoming chat messages. // example script that registers itself to get called on incoming chat messages.
// args passed to this script are as follows: // args passed to this script are as follows:
// @def: chat msg // @def: chat msg
// @0: message type // @0: message type
// @1: lang id // @1: lang id
// @2: guid of sender // @2: guid of sender
// @3: channel name // @3: channel name
// @4: language name // @4: language name
// --------------------------------------- // ---------------------------------------
#script=chat_ai_helloworld #script=chat_ai_helloworld
// --------------------------------------- // ---------------------------------------
#onload #onload
// call us only if somebody says a text containing "hello" and "world" // call us only if somebody says a text containing "hello" and "world"
RegisterChatAIScript,{${@myname}},ALL hello world RegisterChatAIScript,{${@myname}},ALL hello world
set,counter 0 set,counter 0
#/onload #/onload
if ?{equal,${@0} 0} if ?{equal,${@0} 0}
// say some stuff is the language that was used by the sender // say some stuff is the language that was used by the sender
say,${@1} Hello World! This is an example! You used ${@4} language. say,${@1} Hello World! This is an example! You used ${@4} language.
else else
// or shout back in our default language // or shout back in our default language
if ?{equal,${@0} 5} if ?{equal,${@0} 5}
yell Yah "Hello World!" is widely used to proof that something is working!! You used ${@4} language. yell Yah "Hello World!" is widely used to proof that something is working!! You used ${@4} language.
else else
if ?{equal,${@0} 14} if ?{equal,${@0} 14}
chan,{${@3}} Recieved a nice "Hello World" in channel ${@3} ;) chan,{${@3}} Recieved a nice "Hello World" in channel ${@3} ;)
endif endif
endif endif
endif endif
add,counter 1 add,counter 1
// after 5 times of calling this script, it might get annoying, drop it // after 5 times of calling this script, it might get annoying, drop it
if ?{greater_eq,${counter} 5} if ?{greater_eq,${counter} 5}
DropChatAIScript ${@myname} DropChatAIScript ${@myname}
endif endif

View File

@ -1,21 +1,21 @@
#script=dumppcache #script=dumppcache
fopen,fh,rb ./cache/playernames.cache fopen,fh,rb ./cache/playernames.cache
freadbb,fh bb freadbb,fh bb
set,size ?{bbread,bb uint32} set,size ?{bbread,bb uint32}
log PlayerNameCache: ${size} entries. log PlayerNameCache: ${size} entries.
set,i 0 set,i 0
loop loop
if ?{bigger_eq,${i} ${size}} if ?{bigger_eq,${i} ${size}}
exitloop exitloop
endif endif
set,guid ?{bbread,bb uint64} set,guid ?{bbread,bb uint64}
set,len ?{bbread,bb uint8} set,len ?{bbread,bb uint8}
set,name ?{bbread,bb,${len} strnz} set,name ?{bbread,bb,${len} strnz}
log PlayerNameCache[${i}]: ${guid} = ${name} (${len}) log PlayerNameCache[${i}]: ${guid} = ${name} (${len})
add,i 1 add,i 1
endloop endloop
#script=dummy #script=dummy
#onload #onload
dumppcache dumppcache
#/onload #/onload

View File

@ -1,56 +1,56 @@
//---------------------------------- //----------------------------------
#script=hook_example_base #script=hook_example_base
//---------------------------------- //----------------------------------
// just do some random stuff here // just do some random stuff here
set,var 0 set,var 0
set,x hello world set,x hello world
add,var 15 add,var 15
out base: var=${var} out base: var=${var}
//---------------------------------- //----------------------------------
#script=hook_example_hooker #script=hook_example_hooker
//---------------------------------- //----------------------------------
#onload #onload
set,counter 0 set,counter 0
#/onload #/onload
// check if we have already added our code // check if we have already added our code
if ?{ScriptHasLine,hook_example_base #tag:hook:${@myname}} if ?{ScriptHasLine,hook_example_base #tag:hook:${@myname}}
out Hook Example: code already added, skipping. out Hook Example: code already added, skipping.
else else
set,somevar some text set,somevar some text
// this is a custom "tag" to indicate the modification. its necessary because a 'reloaddef' on base script removes our custom content, // this is a custom "tag" to indicate the modification. its necessary because a 'reloaddef' on base script removes our custom content,
// so we can check if our added lines are still there; and a reloaddef on this script would cause the lines to get added twice or more. // so we can check if our added lines are still there; and a reloaddef on this script would cause the lines to get added twice or more.
appenddef,hook_example_base #tag:hook:${@myname} appenddef,hook_example_base #tag:hook:${@myname}
appenddef,hook_example_base out == this is the hooked part == appenddef,hook_example_base out == this is the hooked part ==
appenddef,hook_example_base out text copied from hooking script: ${somevar} appenddef,hook_example_base out text copied from hooking script: ${somevar}
appenddef,hook_example_base out x in base script: $\{x\} appenddef,hook_example_base out x in base script: $\{x\}
appenddef,hook_example_base out add,a 10 appenddef,hook_example_base out add,a 10
appenddef,hook_example_base out var=$\{var\} appenddef,hook_example_base out var=$\{var\}
out Hook Example: ++ code appended. out Hook Example: ++ code appended.
endif endif
// everytine this script gets executed, add the same line of code to a "new" script (its not defined if you call this first time) // everytine this script gets executed, add the same line of code to a "new" script (its not defined if you call this first time)
appenddef,hook_example_new out line of text [${counter}] appenddef,hook_example_new out line of text [${counter}]
add,counter 1 add,counter 1
//---------------------------------- //----------------------------------
#script=hook_example_cleanup #script=hook_example_cleanup
//---------------------------------- //----------------------------------
unloaddef hook_example_new unloaddef hook_example_new
// other possible, but wrong way: delete DEFSCRIPT::SCRIPT::hook_example_new // other possible, but wrong way: delete DEFSCRIPT::SCRIPT::hook_example_new
//----------------------------------- //-----------------------------------
// dummy for running scripts as soon as all scripts in this file are loaded // dummy for running scripts as soon as all scripts in this file are loaded
#script=dummy #script=dummy
#onload #onload
hook_example_hooker hook_example_hooker
#/onload #/onload

View File

@ -1,113 +1,113 @@
// Item/Inventory debugger // Item/Inventory debugger
// Using Player/Item fields // Using Player/Item fields
// Works for 2.3.x // Works for 2.3.x
// Usage: As soon as this file is loaded, the debugger will be attached automatically (put this file in /scripts/ directory) // Usage: As soon as this file is loaded, the debugger will be attached automatically (put this file in /scripts/ directory)
// Known problems: If player/item names are not yet known, this script will display empty names. At second time everything will be fine. // Known problems: If player/item names are not yet known, this script will display empty names. At second time everything will be fine.
#script=itemdebugger_loader #script=itemdebugger_loader
#onload #onload
if ?{not ?{ishooked _onobjectcreate}} if ?{not ?{ishooked _onobjectcreate}}
hookstart _onobjectcreate hookstart _onobjectcreate
#escape-all=1 #escape-all=1
hookadd if ?{equal,4 ${@0}} // MaNGOS creates the player object after all items are created, so just need to check for that and read everything out of the player fields hookadd if ?{equal,4 ${@0}} // MaNGOS creates the player object after all items are created, so just need to check for that and read everything out of the player fields
hookadd playeritemdebugger ${@def} hookadd playeritemdebugger ${@def}
hookadd endif hookadd endif
#escape-all=0 #escape-all=0
hookend hookend
endif endif
if ?{not ?{ishooked _onobjectdelete}} if ?{not ?{ishooked _onobjectdelete}}
hookstart _onobjectdelete hookstart _onobjectdelete
#escape-all=1 #escape-all=1
hookadd if ?{or,?{equal,1 ${@0}} ?{equal,2 ${@0}}} hookadd if ?{or,?{equal,1 ${@0}} ?{equal,2 ${@0}}}
hookadd itemdebugger_del ${@def} hookadd itemdebugger_del ${@def}
hookadd endif hookadd endif
#escape-all=0 #escape-all=0
hookend hookend
endif endif
#/onload #/onload
logdetail Item debugger attached logdetail Item debugger attached
#script=playeritemdebugger #script=playeritemdebugger
// @def: player guid // @def: player guid
set,pguid ${@def} set,pguid ${@def}
set,pname ?{getname,guid ${pguid}} set,pname ?{getname,guid ${pguid}}
// between these fields all item guids are stored (check UpdateFields.h) // between these fields all item guids are stored (check UpdateFields.h)
set,fstart 0x26E // PLAYER_FIELD_INV_SLOT_HEAD set,fstart 0x26E // PLAYER_FIELD_INV_SLOT_HEAD
set,fend 0x35A // PLAYER_FIELD_KEYRING_SLOT_1 + 64 set,fend 0x35A // PLAYER_FIELD_KEYRING_SLOT_1 + 64
set,f ${fstart} set,f ${fstart}
set,slot 0 set,slot 0
loop loop
if ?{bigger_eq,${f} ${fend}} if ?{bigger_eq,${f} ${fend}}
exitloop exitloop
endif endif
set,iguid ?{getobjectvalue,${f},i64 ${pguid}} set,iguid ?{getobjectvalue,${f},i64 ${pguid}}
if ${iguid} if ${iguid}
//-- show info about item //-- show info about item
itemdebugger,{Player '${pname}' Slot ${slot} (field ${f}): } ${iguid} itemdebugger,{Player '${pname}' Slot ${slot} (field ${f}): } ${iguid}
//-- Iterate over bags -- //-- Iterate over bags --
if ?{equal,2 ?{getobjecttype ${iguid}}} if ?{equal,2 ?{getobjecttype ${iguid}}}
bagitemdebugger ${iguid} bagitemdebugger ${iguid}
endif endif
endif endif
add,f 2 add,f 2
add,slot 1 add,slot 1
endloop endloop
#script=bagitemdebugger #script=bagitemdebugger
set,bagslots ?{getobjectvalue,60 ${@def}} // CONTAINER_FIELD_NUM_SLOTS set,bagslots ?{getobjectvalue,60 ${@def}} // CONTAINER_FIELD_NUM_SLOTS
set,j 0 set,j 0
loop loop
set,t ${j} set,t ${j}
mul,t 2 mul,t 2
if ?{bigger,${t} ${bagslots}} // max. bag size = 36 slots if ?{bigger,${t} ${bagslots}} // max. bag size = 36 slots
exitloop exitloop
endif endif
set,field 62 // CONTAINER_FIELD_SLOT_1 - 36 set,field 62 // CONTAINER_FIELD_SLOT_1 - 36
add,field ${t} add,field ${t}
set,itemguid ?{getobjectvalue,${field},i64 ${@def}} set,itemguid ?{getobjectvalue,${field},i64 ${@def}}
itemdebugger,{Bag slot ${j} (field: ${field}) -> } ${itemguid} itemdebugger,{Bag slot ${j} (field: ${field}) -> } ${itemguid}
add,j 1 add,j 1
endloop endloop
#script=itemdebugger #script=itemdebugger
// @def: item guid // @def: item guid
// @0: text prefix // @0: text prefix
set,itemguid ${@def} set,itemguid ${@def}
if ?{not ?{objectknown ${itemguid}}} if ?{not ?{objectknown ${itemguid}}}
return return
endif endif
if ${itemguid} if ${itemguid}
set,itemname ?{getname,guid ${itemguid}} set,itemname ?{getname,guid ${itemguid}}
set,itementry ?{getentry ${itemguid}} set,itementry ?{getentry ${itemguid}}
log ${@0}Item: '${itemname}' (${itementry}) [${itemguid}] log ${@0}Item: '${itemname}' (${itementry}) [${itemguid}]
endif endif
#script=itemdebugger_del #script=itemdebugger_del
// @def: item guid // @def: item guid
set,itemguid ${@def} set,itemguid ${@def}
//if ?{not ?{objectknown ${itemguid}}} //if ?{not ?{objectknown ${itemguid}}}
// return // return
//endif //endif
if ${itemguid} if ${itemguid}
set,itemname ?{getname,guid ${itemguid}} set,itemname ?{getname,guid ${itemguid}}
set,itementry ?{getentry ${itemguid}} set,itementry ?{getentry ${itemguid}}
set,owner ?{getobjectvalue,6,i64 ${itemguid}} set,owner ?{getobjectvalue,6,i64 ${itemguid}}
set,ownername ?{getname,guid ${owner}} set,ownername ?{getname,guid ${owner}}
log Delete Item: '${itemname}' (${itementry}) (${ownername}) [${itemguid}] log Delete Item: '${itemname}' (${itementry}) (${ownername}) [${itemguid}]
endif endif

View File

@ -1,38 +1,38 @@
#script=getuptime #script=getuptime
// purpose: pseuwow uptime counter // purpose: pseuwow uptime counter
// args: @def: "say", "yell", "chan,General", etc. any command that accepts a string in @def and does something with it. // args: @def: "say", "yell", "chan,General", etc. any command that accepts a string in @def and does something with it.
// returns: uptime formatted as 0h 0m 0s // returns: uptime formatted as 0h 0m 0s
set,s ${@clock} set,s ${@clock}
div,s 1000 div,s 1000
set,s ?{toint ${s}} set,s ?{toint ${s}}
set,secs ${s} set,secs ${s}
set,h ${s} set,h ${s}
div,h 3600 div,h 3600
toint,h ${h} toint,h ${h}
mod,s 3600 mod,s 3600
set,m ${s} set,m ${s}
div,m 60 div,m 60
toint,m ${m} toint,m ${m}
mod,s 60 mod,s 60
toint,s ${s} toint,s ${s}
set,str ${h}h ${m}m ${s}s set,str ${h}h ${m}m ${s}s
out UPTIME: ${secs} secs = ${str} out UPTIME: ${secs} secs = ${str}
if ?{strlen ${@def}} if ?{strlen ${@def}}
${@def} UPTIME: ${h} hours, ${m} minutes, ${s} seconds ${@def} UPTIME: ${h} hours, ${m} minutes, ${s} seconds
endif endif
unset h unset h
unset m unset m
unset s unset s
unset secs unset secs
return ${str} return ${str}
#script=uptime #script=uptime
#permission=0 #permission=0
return ?{getuptime say} return ?{getuptime say}

View File

@ -1,24 +1,24 @@
Find the full license at: Find the full license at:
http://www.gnu.org/licenses/gpl.html http://www.gnu.org/licenses/gpl.html
Summary: Summary:
Copyright (C) 2006 False.Genesis @ SnowStom Software Copyright (C) 2006 False.Genesis @ SnowStom Software
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Every part of program code belongs to its respective owner. Every part of program code belongs to its respective owner.

View File

@ -1,18 +1,18 @@
#ifndef _CLI_H #ifndef _CLI_H
#define _CLI_H #define _CLI_H
class PseuInstance; class PseuInstance;
class CliRunnable : public ZThread::Runnable class CliRunnable : public ZThread::Runnable
{ {
public: public:
CliRunnable(PseuInstance*); CliRunnable(PseuInstance*);
void run(void); void run(void);
void stop() { _stop=true; } void stop() { _stop=true; }
private: private:
bool _stop; bool _stop;
PseuInstance *_instance; PseuInstance *_instance;
}; };
#endif #endif

View File

@ -1,59 +1,59 @@
#include "common.h" #include "common.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "RemoteController.h" #include "RemoteController.h"
#include "ControlSocket.h" #include "ControlSocket.h"
ControlSocket::ControlSocket(SocketHandler& h) : TcpSocket(h) ControlSocket::ControlSocket(SocketHandler& h) : TcpSocket(h)
{ {
_ok = false; _ok = false;
DEBUG(logdebug("ControlSocket created")); DEBUG(logdebug("ControlSocket created"));
} }
void ControlSocket::OnAccept(void) void ControlSocket::OnAccept(void)
{ {
logdetail("ControlSocket: Incoming connection from %s:%u [host:%s]",GetRemoteAddress().c_str(),GetRemotePort(),GetRemoteHostname().c_str()); logdetail("ControlSocket: Incoming connection from %s:%u [host:%s]",GetRemoteAddress().c_str(),GetRemotePort(),GetRemoteHostname().c_str());
// must perform some crappy ptr conversion here, doesnt want to typecast SocketHandler -> ControlSocketHandler directly // must perform some crappy ptr conversion here, doesnt want to typecast SocketHandler -> ControlSocketHandler directly
SocketHandler& hnd = Handler(); SocketHandler& hnd = Handler();
ControlSocketHandler *chnd = static_cast<ControlSocketHandler*>(&hnd); ControlSocketHandler *chnd = static_cast<ControlSocketHandler*>(&hnd);
_instance = chnd->GetInstance(); _instance = chnd->GetInstance();
DEBUG(logdebug("ControlSocket: setting instance = %X",_instance)); DEBUG(logdebug("ControlSocket: setting instance = %X",_instance));
// accept only connections from one host for now, if set // accept only connections from one host for now, if set
if(_instance->GetConf()->rmcontrolhost.length() if(_instance->GetConf()->rmcontrolhost.length()
&& !(GetRemoteAddress() == _instance->GetConf()->rmcontrolhost || GetRemoteHostname() == _instance->GetConf()->rmcontrolhost)) && !(GetRemoteAddress() == _instance->GetConf()->rmcontrolhost || GetRemoteHostname() == _instance->GetConf()->rmcontrolhost))
{ {
logdetail("ControlSocket: connection rejected. closing."); logdetail("ControlSocket: connection rejected. closing.");
SetCloseAndDelete(true); SetCloseAndDelete(true);
return; return;
} }
_ok = true; _ok = true;
} }
void ControlSocket::OnRead(void) void ControlSocket::OnRead(void)
{ {
if(!_ok) if(!_ok)
return; return;
TcpSocket::OnRead(); TcpSocket::OnRead();
uint32 len = ibuf.GetLength(); uint32 len = ibuf.GetLength();
if(!len) if(!len)
{ {
logdetail("ControlSocket: connection to %s:%u closed.",GetRemoteAddress().c_str(),GetRemotePort()); logdetail("ControlSocket: connection to %s:%u closed.",GetRemoteAddress().c_str(),GetRemotePort());
return; return;
} }
char *buf = new char[len]; char *buf = new char[len];
ibuf.Read(buf,len); ibuf.Read(buf,len);
if(buf[0]==0) if(buf[0]==0)
{ {
// reserved for future applications // reserved for future applications
} }
else else
{ {
if(_instance && _instance->GetScripts()) if(_instance && _instance->GetScripts())
_instance->GetScripts()->RunSingleLine(&buf[0]); _instance->GetScripts()->RunSingleLine(&buf[0]);
} }
delete [] buf; delete [] buf;
} }

View File

@ -1,23 +1,23 @@
#ifndef CONTROLSOCKET_H #ifndef CONTROLSOCKET_H
#define CONTROLSOCKET_H #define CONTROLSOCKET_H
#include "Network/TcpSocket.h" #include "Network/TcpSocket.h"
#include "RemoteController.h" #include "RemoteController.h"
class ControlSocket : public TcpSocket class ControlSocket : public TcpSocket
{ {
public: public:
ControlSocket(SocketHandler& h); ControlSocket(SocketHandler& h);
void SetInstance(PseuInstance *in) { _instance = in; } void SetInstance(PseuInstance *in) { _instance = in; }
void OnAccept(); void OnAccept();
void OnRead(); void OnRead();
private: private:
PseuInstance *_instance; PseuInstance *_instance;
bool _ok; bool _ok;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,288 +1,288 @@
#ifndef __DEFSCRIPT_H #ifndef __DEFSCRIPT_H
#define __DEFSCRIPT_H #define __DEFSCRIPT_H
#include "DefScriptDefines.h" #include "DefScriptDefines.h"
#include <map> #include <map>
#include <deque> #include <deque>
#include <fstream> #include <fstream>
#include "VarSet.h" #include "VarSet.h"
#include "ByteBuffer.h" #include "ByteBuffer.h"
#include "DynamicEvent.h" #include "DynamicEvent.h"
#include "TypeStorage.h" #include "TypeStorage.h"
#include "DefScriptTools.h" #include "DefScriptTools.h"
class DefScriptPackage; class DefScriptPackage;
class DefScript; class DefScript;
typedef void (*_slog_func)(const char*,...); typedef void (*_slog_func)(const char*,...);
// general struct for if..else..endif / loop..endloop blocks // general struct for if..else..endif / loop..endloop blocks
struct Def_Block struct Def_Block
{ {
unsigned char type; // stores DefScriptBlockType unsigned char type; // stores DefScriptBlockType
bool istrue; // only relevant for if-statements bool istrue; // only relevant for if-statements
unsigned int startline; // line where loop-statement started unsigned int startline; // line where loop-statement started
}; };
struct DefReturnResult struct DefReturnResult
{ {
DefReturnResult() { ok=true; mustreturn=false; ret="true"; } DefReturnResult() { ok=true; mustreturn=false; ret="true"; }
DefReturnResult(bool b) { ok=true; mustreturn=false; ret=b?"true":"false"; } DefReturnResult(bool b) { ok=true; mustreturn=false; ret=b?"true":"false"; }
DefReturnResult(std::string s) { ok=true; mustreturn=false; ret=s; } DefReturnResult(std::string s) { ok=true; mustreturn=false; ret=s; }
DefReturnResult(const char *s) { DefReturnResult(std::string(s)); } DefReturnResult(const char *s) { DefReturnResult(std::string(s)); }
bool ok; // true if the execution of the current statement was successful bool ok; // true if the execution of the current statement was successful
bool mustreturn; bool mustreturn;
std::string ret; // return value used by ?{..} std::string ret; // return value used by ?{..}
//bool abrt; // true if ALL current script execution must be aborted. //bool abrt; // true if ALL current script execution must be aborted.
//std::string err; // error string, including tracestack, etc. //std::string err; // error string, including tracestack, etc.
}; };
#define DEF_RETURN_ERROR { DefReturnResult __defreturnresult(false); __defreturnresult.ok=false; return __defreturnresult; } #define DEF_RETURN_ERROR { DefReturnResult __defreturnresult(false); __defreturnresult.ok=false; return __defreturnresult; }
struct DefXChgResult struct DefXChgResult
{ {
DefXChgResult() { changed=false; } DefXChgResult() { changed=false; }
bool changed; bool changed;
std::string str; std::string str;
DefReturnResult result; DefReturnResult result;
}; };
typedef std::map<unsigned int,std::string> _CmdSetArgMap; typedef std::map<unsigned int,std::string> _CmdSetArgMap;
class CmdSet { class CmdSet {
public: public:
CmdSet(); CmdSet();
~CmdSet(); ~CmdSet();
void Clear(); void Clear();
std::string cmd; std::string cmd;
_CmdSetArgMap arg; _CmdSetArgMap arg;
std::string defaultarg; std::string defaultarg;
std::string myname; std::string myname;
std::string caller; std::string caller;
}; };
struct DefScriptFunctionEntry { struct DefScriptFunctionEntry {
DefScriptFunctionEntry(std::string n,DefReturnResult (DefScriptPackage::*f)(CmdSet& Set), bool esc) DefScriptFunctionEntry(std::string n,DefReturnResult (DefScriptPackage::*f)(CmdSet& Set), bool esc)
{ {
name=n; name=n;
func=f; func=f;
escape=esc; escape=esc;
} }
std::string name; std::string name;
DefReturnResult (DefScriptPackage::*func)(CmdSet& Set); DefReturnResult (DefScriptPackage::*func)(CmdSet& Set);
bool escape; bool escape;
}; };
typedef std::deque<DefScriptFunctionEntry> DefScriptFunctionTable; typedef std::deque<DefScriptFunctionEntry> DefScriptFunctionTable;
typedef std::deque<std::string> DefList; typedef std::deque<std::string> DefList;
typedef std::map<std::string,DefList*> DefListMap; typedef std::map<std::string,DefList*> DefListMap;
class DefScript { class DefScript {
friend class DefScriptPackage; friend class DefScriptPackage;
public: public:
DefScript(DefScriptPackage *p); DefScript(DefScriptPackage *p);
~DefScript(); ~DefScript();
inline std::string GetLine(unsigned int id) { return Line[id]; } inline std::string GetLine(unsigned int id) { return Line[id]; }
inline unsigned int GetLines(void) { return Line.size(); } inline unsigned int GetLines(void) { return Line.size(); }
bool AddLine(std::string ); bool AddLine(std::string );
std::string GetName(void); std::string GetName(void);
void SetName(std::string); void SetName(std::string);
void SetPermission(unsigned char); void SetPermission(unsigned char);
unsigned char GetPermission(void); unsigned char GetPermission(void);
void Clear(void); void Clear(void);
void SetDebug(bool); void SetDebug(bool);
bool GetDebug(void); bool GetDebug(void);
//DefScriptPackage *GetParent(void); //DefScriptPackage *GetParent(void);
private: private:
DefList Line; DefList Line;
unsigned int lines; unsigned int lines;
std::string scriptname; std::string scriptname;
unsigned char permission; unsigned char permission;
bool debugmode; bool debugmode;
DefScriptPackage *_parent; DefScriptPackage *_parent;
}; };
class DefScriptPackage { class DefScriptPackage {
friend class DefScript; friend class DefScript;
public: public:
DefScriptPackage(); DefScriptPackage();
~DefScriptPackage(); ~DefScriptPackage();
void SetParentMethod(void*); // used to extend the scripts with own c++ interface functions void SetParentMethod(void*); // used to extend the scripts with own c++ interface functions
void Clear(void); void Clear(void);
DefScript *GetScript(std::string); DefScript *GetScript(std::string);
unsigned int GetScripts(void); unsigned int GetScripts(void);
bool LoadScriptFromFile(std::string); bool LoadScriptFromFile(std::string);
DefReturnResult RunScript(std::string name,CmdSet* pSet,std::string override_name=""); DefReturnResult RunScript(std::string name,CmdSet* pSet,std::string override_name="");
bool BoolRunScript(std::string,CmdSet*); bool BoolRunScript(std::string,CmdSet*);
bool RunScriptIfExists(std::string name, CmdSet *pSet = NULL); bool RunScriptIfExists(std::string name, CmdSet *pSet = NULL);
unsigned int GetScriptID(std::string); unsigned int GetScriptID(std::string);
DefReturnResult RunSingleLine(std::string); DefReturnResult RunSingleLine(std::string);
bool ScriptExists(std::string); bool ScriptExists(std::string);
void DeleteScript(std::string); void DeleteScript(std::string);
VarSet variables; VarSet variables;
void SetPath(std::string); void SetPath(std::string);
bool LoadByName(std::string); bool LoadByName(std::string);
std::string _NormalizeVarName(std::string, std::string); std::string _NormalizeVarName(std::string, std::string);
DefReturnResult RunSingleLineFromScript(std::string line, DefScript *pScript); DefReturnResult RunSingleLineFromScript(std::string line, DefScript *pScript);
DefScript_DynamicEventMgr *GetEventMgr(void); DefScript_DynamicEventMgr *GetEventMgr(void);
void AddFunc(DefScriptFunctionEntry); void AddFunc(DefScriptFunctionEntry);
void AddFunc(std::string n,DefReturnResult (DefScriptPackage::*)(CmdSet& Set), bool esc=true); void AddFunc(std::string n,DefReturnResult (DefScriptPackage::*)(CmdSet& Set), bool esc=true);
bool HasFunc(std::string); bool HasFunc(std::string);
void DelFunc(std::string); void DelFunc(std::string);
TypeStorage<DefList> lists; TypeStorage<DefList> lists;
TypeStorage<ByteBuffer> bytebuffers; TypeStorage<ByteBuffer> bytebuffers;
TypeStorage<std::fstream> files; TypeStorage<std::fstream> files;
std::string SecureString(std::string); std::string SecureString(std::string);
std::string EscapeString(std::string); std::string EscapeString(std::string);
std::string UnescapeString(std::string); std::string UnescapeString(std::string);
std::string GetUnescapedVar(std::string); std::string GetUnescapedVar(std::string);
// own logging functions. default is printf. // own logging functions. default is printf.
// DO NOT USE THEM YET! THEY DO NOT WORK CORRECTLY! // DO NOT USE THEM YET! THEY DO NOT WORK CORRECTLY!
// need some help with this [FG] // need some help with this [FG]
inline void SetLog(void *ptr) { _slog=(_slog_func)ptr; } inline void SetLog(void *ptr) { _slog=(_slog_func)ptr; }
inline void SetDebugLog(void *ptr) { _sdebuglog=(_slog_func)ptr; } inline void SetDebugLog(void *ptr) { _sdebuglog=(_slog_func)ptr; }
inline void SetErrorLog(void *ptr) { _serrorlog=(_slog_func)ptr; } inline void SetErrorLog(void *ptr) { _serrorlog=(_slog_func)ptr; }
void Log(const char*,...); void Log(const char*,...);
void DebugLog(const char*,...); void DebugLog(const char*,...);
void ErrorLog(const char*,...); void ErrorLog(const char*,...);
std::string scPath; std::string scPath;
// Own executor functions // Own executor functions
void My_LoadUserPermissions(VarSet&); void My_LoadUserPermissions(VarSet&);
void My_Run(std::string line,std::string username); void My_Run(std::string line,std::string username);
private: private:
void _UpdateOrCreateScriptByName(std::string); void _UpdateOrCreateScriptByName(std::string);
void _InitFunctions(void); void _InitFunctions(void);
DefXChgResult ReplaceVars(std::string str, CmdSet* pSet, unsigned char VarType, bool run_embedded); DefXChgResult ReplaceVars(std::string str, CmdSet* pSet, unsigned char VarType, bool run_embedded);
void SplitLine(CmdSet&,std::string); void SplitLine(CmdSet&,std::string);
DefReturnResult Interpret(CmdSet&); DefReturnResult Interpret(CmdSet&);
void RemoveBrackets(CmdSet&); void RemoveBrackets(CmdSet&);
void UnescapeSet(CmdSet&); void UnescapeSet(CmdSet&);
std::string RemoveBracketsFromString(std::string); std::string RemoveBracketsFromString(std::string);
void *parentMethod; void *parentMethod;
DefScript_DynamicEventMgr *_eventmgr; DefScript_DynamicEventMgr *_eventmgr;
std::map<std::string,DefScript*> Script; std::map<std::string,DefScript*> Script;
std::map<std::string,unsigned char> scriptPermissionMap; std::map<std::string,unsigned char> scriptPermissionMap;
DefScriptFunctionTable _functable; DefScriptFunctionTable _functable;
_slog_func _slog,_serrorlog,_sdebuglog; _slog_func _slog,_serrorlog,_sdebuglog;
_DEFSC_DEBUG(std::fstream hLogfile); _DEFSC_DEBUG(std::fstream hLogfile);
// Usable internal basic functions: // Usable internal basic functions:
DefReturnResult func_default(CmdSet&); DefReturnResult func_default(CmdSet&);
DefReturnResult func_set(CmdSet&); DefReturnResult func_set(CmdSet&);
DefReturnResult func_unset(CmdSet&); DefReturnResult func_unset(CmdSet&);
DefReturnResult func_loaddef(CmdSet&); DefReturnResult func_loaddef(CmdSet&);
DefReturnResult func_reloaddef(CmdSet&); DefReturnResult func_reloaddef(CmdSet&);
DefReturnResult func_createdef(CmdSet&); DefReturnResult func_createdef(CmdSet&);
DefReturnResult func_unloaddef(CmdSet&); DefReturnResult func_unloaddef(CmdSet&);
DefReturnResult func_out(CmdSet&); DefReturnResult func_out(CmdSet&);
DefReturnResult func_eof(CmdSet&); DefReturnResult func_eof(CmdSet&);
DefReturnResult func_shdn(CmdSet&); DefReturnResult func_shdn(CmdSet&);
DefReturnResult func_setscriptpermission(CmdSet&); DefReturnResult func_setscriptpermission(CmdSet&);
DefReturnResult func_toint(CmdSet&); DefReturnResult func_toint(CmdSet&);
DefReturnResult func_add(CmdSet&); DefReturnResult func_add(CmdSet&);
DefReturnResult func_sub(CmdSet&); DefReturnResult func_sub(CmdSet&);
DefReturnResult func_mul(CmdSet&); DefReturnResult func_mul(CmdSet&);
DefReturnResult func_div(CmdSet&); DefReturnResult func_div(CmdSet&);
DefReturnResult func_mod(CmdSet&); DefReturnResult func_mod(CmdSet&);
DefReturnResult func_pow(CmdSet&); DefReturnResult func_pow(CmdSet&);
DefReturnResult func_bitor(CmdSet&); DefReturnResult func_bitor(CmdSet&);
DefReturnResult func_bitand(CmdSet&); DefReturnResult func_bitand(CmdSet&);
DefReturnResult func_bitxor(CmdSet&); DefReturnResult func_bitxor(CmdSet&);
DefReturnResult func_addevent(CmdSet&); DefReturnResult func_addevent(CmdSet&);
DefReturnResult func_removeevent(CmdSet&); DefReturnResult func_removeevent(CmdSet&);
DefReturnResult func_abs(CmdSet&); DefReturnResult func_abs(CmdSet&);
DefReturnResult func_bigger(CmdSet&); DefReturnResult func_bigger(CmdSet&);
DefReturnResult func_bigger_eq(CmdSet&); DefReturnResult func_bigger_eq(CmdSet&);
DefReturnResult func_equal(CmdSet&); DefReturnResult func_equal(CmdSet&);
DefReturnResult func_isset(CmdSet&); DefReturnResult func_isset(CmdSet&);
DefReturnResult func_not(CmdSet&); DefReturnResult func_not(CmdSet&);
DefReturnResult func_smaller(CmdSet&); DefReturnResult func_smaller(CmdSet&);
DefReturnResult func_smaller_eq(CmdSet&); DefReturnResult func_smaller_eq(CmdSet&);
DefReturnResult func_strlen(CmdSet&); DefReturnResult func_strlen(CmdSet&);
DefReturnResult func_tohex(CmdSet&); DefReturnResult func_tohex(CmdSet&);
DefReturnResult func_and(CmdSet&); DefReturnResult func_and(CmdSet&);
DefReturnResult func_or(CmdSet&); DefReturnResult func_or(CmdSet&);
DefReturnResult func_xor(CmdSet&); DefReturnResult func_xor(CmdSet&);
DefReturnResult func_substr(CmdSet&); DefReturnResult func_substr(CmdSet&);
DefReturnResult func_uppercase(CmdSet&); DefReturnResult func_uppercase(CmdSet&);
DefReturnResult func_lowercase(CmdSet&); DefReturnResult func_lowercase(CmdSet&);
DefReturnResult func_random(CmdSet&); DefReturnResult func_random(CmdSet&);
DefReturnResult func_fileexists(CmdSet&); DefReturnResult func_fileexists(CmdSet&);
DefReturnResult func_strfind(CmdSet&); DefReturnResult func_strfind(CmdSet&);
DefReturnResult func_scriptexists(CmdSet&); DefReturnResult func_scriptexists(CmdSet&);
DefReturnResult func_funcexists(CmdSet&); DefReturnResult func_funcexists(CmdSet&);
// list functions // list functions
DefReturnResult func_lpushback(CmdSet&); DefReturnResult func_lpushback(CmdSet&);
DefReturnResult func_lpushfront(CmdSet&); DefReturnResult func_lpushfront(CmdSet&);
DefReturnResult func_lpopback(CmdSet&); DefReturnResult func_lpopback(CmdSet&);
DefReturnResult func_lpopfront(CmdSet&); DefReturnResult func_lpopfront(CmdSet&);
DefReturnResult func_ldelete(CmdSet&); DefReturnResult func_ldelete(CmdSet&);
DefReturnResult func_lexists(CmdSet&); DefReturnResult func_lexists(CmdSet&);
DefReturnResult func_llen(CmdSet&); DefReturnResult func_llen(CmdSet&);
DefReturnResult func_linsert(CmdSet&); DefReturnResult func_linsert(CmdSet&);
DefReturnResult func_lsplit(CmdSet&); DefReturnResult func_lsplit(CmdSet&);
DefReturnResult func_lcsplit(CmdSet&); DefReturnResult func_lcsplit(CmdSet&);
DefReturnResult func_ljoin(CmdSet&); DefReturnResult func_ljoin(CmdSet&);
DefReturnResult func_lindex(CmdSet&); DefReturnResult func_lindex(CmdSet&);
DefReturnResult func_lclean(CmdSet&); DefReturnResult func_lclean(CmdSet&);
DefReturnResult func_lmclean(CmdSet&); DefReturnResult func_lmclean(CmdSet&);
DefReturnResult func_lerase(CmdSet&); DefReturnResult func_lerase(CmdSet&);
DefReturnResult func_lsort(CmdSet&); DefReturnResult func_lsort(CmdSet&);
// ByteBuffer functions // ByteBuffer functions
DefReturnResult func_bbinit(CmdSet&); DefReturnResult func_bbinit(CmdSet&);
DefReturnResult func_bbdelete(CmdSet&); DefReturnResult func_bbdelete(CmdSet&);
DefReturnResult func_bbappend(CmdSet&); DefReturnResult func_bbappend(CmdSet&);
DefReturnResult func_bbread(CmdSet&); DefReturnResult func_bbread(CmdSet&);
DefReturnResult func_bbsetrpos(CmdSet&); DefReturnResult func_bbsetrpos(CmdSet&);
DefReturnResult func_bbsetwpos(CmdSet&); DefReturnResult func_bbsetwpos(CmdSet&);
DefReturnResult func_bbhexlike(CmdSet&); DefReturnResult func_bbhexlike(CmdSet&);
DefReturnResult func_bbtextlike(CmdSet&); DefReturnResult func_bbtextlike(CmdSet&);
DefReturnResult func_bbsize(CmdSet&); DefReturnResult func_bbsize(CmdSet&);
// file functions // file functions
DefReturnResult func_fopen(CmdSet&); DefReturnResult func_fopen(CmdSet&);
DefReturnResult func_fclose(CmdSet&); DefReturnResult func_fclose(CmdSet&);
DefReturnResult func_fisopen(CmdSet&); DefReturnResult func_fisopen(CmdSet&);
DefReturnResult func_feof(CmdSet&); DefReturnResult func_feof(CmdSet&);
DefReturnResult func_frpos(CmdSet&); DefReturnResult func_frpos(CmdSet&);
DefReturnResult func_fwpos(CmdSet&); DefReturnResult func_fwpos(CmdSet&);
DefReturnResult func_fdel(CmdSet&); DefReturnResult func_fdel(CmdSet&);
DefReturnResult func_fflush(CmdSet&); DefReturnResult func_fflush(CmdSet&);
DefReturnResult func_fwrite(CmdSet&); DefReturnResult func_fwrite(CmdSet&);
DefReturnResult func_fread(CmdSet&); DefReturnResult func_fread(CmdSet&);
DefReturnResult func_freadb(CmdSet&); DefReturnResult func_freadb(CmdSet&);
DefReturnResult func_fwriteb(CmdSet&); DefReturnResult func_fwriteb(CmdSet&);
DefReturnResult func_freadbb(CmdSet&); DefReturnResult func_freadbb(CmdSet&);
DefReturnResult func_fwritebb(CmdSet&); DefReturnResult func_fwritebb(CmdSet&);
DefReturnResult func_fsize(CmdSet&); DefReturnResult func_fsize(CmdSet&);
DefReturnResult func_freadline(CmdSet&); DefReturnResult func_freadline(CmdSet&);
DefReturnResult func_fseekw(CmdSet&); DefReturnResult func_fseekw(CmdSet&);
DefReturnResult func_fseekr(CmdSet&); DefReturnResult func_fseekr(CmdSet&);
// setup own function declarations here // setup own function declarations here
# include "DefScriptInterfaceInclude.h" # include "DefScriptInterfaceInclude.h"
// Own variable declarations // Own variable declarations
std::map<std::string, unsigned char> my_usrPermissionMap; std::map<std::string, unsigned char> my_usrPermissionMap;
}; };
#endif #endif

View File

@ -1,177 +1,177 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include "DefScript.h" #include "DefScript.h"
#include "DefScriptTools.h" #include "DefScriptTools.h"
#include "SysDefs.h" #include "SysDefs.h"
#include "ByteBuffer.h" #include "ByteBuffer.h"
using namespace DefScriptTools; using namespace DefScriptTools;
// Helper macros for insert/extract various datatypes that need type casting // Helper macros for insert/extract various datatypes that need type casting
#define BB_CAN_READ(bytebuffer, _ty) ((*(bytebuffer)).size() - (*(bytebuffer)).rpos() >= sizeof(_ty)) #define BB_CAN_READ(bytebuffer, _ty) ((*(bytebuffer)).size() - (*(bytebuffer)).rpos() >= sizeof(_ty))
#define BB_MACRO_INSERT_I(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) ) { *(bytebuffer) << (_ty)toUint64(Set.defaultarg); return true; } #define BB_MACRO_INSERT_I(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) ) { *(bytebuffer) << (_ty)toUint64(Set.defaultarg); return true; }
#define BB_MACRO_INSERT_F(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) ) { *(bytebuffer) << (_ty)toNumber(Set.defaultarg); return true; } #define BB_MACRO_INSERT_F(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) ) { *(bytebuffer) << (_ty)toNumber(Set.defaultarg); return true; }
#define BB_MACRO_EXTRACT_I(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) && BB_CAN_READ(bytebuffer,_ty) ) {_ty _var; *(bytebuffer) >> _var; return DefScriptTools::toString((uint64)_var); } #define BB_MACRO_EXTRACT_I(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) && BB_CAN_READ(bytebuffer,_ty) ) {_ty _var; *(bytebuffer) >> _var; return DefScriptTools::toString((uint64)_var); }
#define BB_MACRO_EXTRACT_F(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) && BB_CAN_READ(bytebuffer,_ty) ) {_ty _var; *(bytebuffer) >> _var; return DefScriptTools::toString((ldbl)_var); } #define BB_MACRO_EXTRACT_F(bytebuffer, _sty, _ty) if( (_sty)==(#_ty) && BB_CAN_READ(bytebuffer,_ty) ) {_ty _var; *(bytebuffer) >> _var; return DefScriptTools::toString((ldbl)_var); }
// Initializes bytebuffer with initial capacity (reserved, not resized) // Initializes bytebuffer with initial capacity (reserved, not resized)
// @def - bytebuffer identifier // @def - bytebuffer identifier
// @0 - if set, initial capacity // @0 - if set, initial capacity
DefReturnResult DefScriptPackage::func_bbinit(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbinit(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.Get(_NormalizeVarName(Set.defaultarg,Set.myname)); ByteBuffer *bb = bytebuffers.Get(_NormalizeVarName(Set.defaultarg,Set.myname));
bb->clear(); // also resets wpos & rpos bb->clear(); // also resets wpos & rpos
if (!Set.arg[0].empty()) if (!Set.arg[0].empty())
bb->reserve((size_t)DefScriptTools::toUint64(Set.arg[0])); bb->reserve((size_t)DefScriptTools::toUint64(Set.arg[0]));
return true; return true;
} }
// Cleans memory and deletes ByteBuffer from storage // Cleans memory and deletes ByteBuffer from storage
DefReturnResult DefScriptPackage::func_bbdelete(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbdelete(CmdSet& Set)
{ {
bytebuffers.Delete(_NormalizeVarName(Set.defaultarg,Set.myname)); bytebuffers.Delete(_NormalizeVarName(Set.defaultarg,Set.myname));
return true; return true;
} }
// Appends data to ByteBuffer // Appends data to ByteBuffer
// @def - data // @def - data
// @0 - bytebuffer identifier // @0 - bytebuffer identifier
// @1 - datatype of added data (uint8,uint16,uint32,uint64,float,double,string,strnz) // @1 - datatype of added data (uint8,uint16,uint32,uint64,float,double,string,strnz)
DefReturnResult DefScriptPackage::func_bbappend(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbappend(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.Get(_NormalizeVarName(Set.arg[0],Set.myname)); ByteBuffer *bb = bytebuffers.Get(_NormalizeVarName(Set.arg[0],Set.myname));
std::string dtype = DefScriptTools::stringToLower(Set.arg[1]); std::string dtype = DefScriptTools::stringToLower(Set.arg[1]);
if (dtype == "string") if (dtype == "string")
{ {
*bb << Set.defaultarg; *bb << Set.defaultarg;
return true; return true;
} }
else if(dtype == "strnz") else if(dtype == "strnz")
{ {
bb->append(Set.defaultarg.c_str(), Set.defaultarg.length()); // append the string skipping \0 bb->append(Set.defaultarg.c_str(), Set.defaultarg.length()); // append the string skipping \0
return true; return true;
} }
BB_MACRO_INSERT_I(bb, dtype, uint8); BB_MACRO_INSERT_I(bb, dtype, uint8);
BB_MACRO_INSERT_I(bb, dtype, uint16); BB_MACRO_INSERT_I(bb, dtype, uint16);
BB_MACRO_INSERT_I(bb, dtype, uint32); BB_MACRO_INSERT_I(bb, dtype, uint32);
BB_MACRO_INSERT_I(bb, dtype, uint64); BB_MACRO_INSERT_I(bb, dtype, uint64);
BB_MACRO_INSERT_F(bb, dtype, float); BB_MACRO_INSERT_F(bb, dtype, float);
BB_MACRO_INSERT_F(bb, dtype, double); BB_MACRO_INSERT_F(bb, dtype, double);
return false; return false;
} }
// Extracts data from bytebuffer // Extracts data from bytebuffer
// @def - datatype to extract (uint8,uint16,uint32,uint64,float,double,string) // @def - datatype to extract (uint8,uint16,uint32,uint64,float,double,string)
// @0 - bytebuffer identifier // @0 - bytebuffer identifier
DefReturnResult DefScriptPackage::func_bbread(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbread(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if (!bb) if (!bb)
return false; return false;
std::string dtype = DefScriptTools::stringToLower(Set.defaultarg); std::string dtype = DefScriptTools::stringToLower(Set.defaultarg);
if (dtype == "string") { if (dtype == "string") {
std::string g; std::string g;
*bb >> g; *bb >> g;
return g; return g;
} }
else if(dtype == "strnz") // extract some amount of bytes not terminated by \0 else if(dtype == "strnz") // extract some amount of bytes not terminated by \0
{ {
uint32 bytes = (uint32)toUint64(Set.arg[1]); uint32 bytes = (uint32)toUint64(Set.arg[1]);
if(bytes) if(bytes)
{ {
std::string g; std::string g;
char *buf = new char[bytes+1]; // +1 for \0 char *buf = new char[bytes+1]; // +1 for \0
buf[bytes] = 0; buf[bytes] = 0;
bb->read((uint8*)buf,bytes); bb->read((uint8*)buf,bytes);
g = buf; g = buf;
delete [] buf; delete [] buf;
return g; return g;
} }
return ""; return "";
} }
BB_MACRO_EXTRACT_I(bb, dtype, uint8); BB_MACRO_EXTRACT_I(bb, dtype, uint8);
BB_MACRO_EXTRACT_I(bb, dtype, uint16); BB_MACRO_EXTRACT_I(bb, dtype, uint16);
BB_MACRO_EXTRACT_I(bb, dtype, uint32); BB_MACRO_EXTRACT_I(bb, dtype, uint32);
BB_MACRO_EXTRACT_I(bb, dtype, uint64); BB_MACRO_EXTRACT_I(bb, dtype, uint64);
BB_MACRO_EXTRACT_F(bb, dtype, float); BB_MACRO_EXTRACT_F(bb, dtype, float);
BB_MACRO_EXTRACT_F(bb, dtype, double); BB_MACRO_EXTRACT_F(bb, dtype, double);
return ""; // if extraction unsuccessful, return empty string return ""; // if extraction unsuccessful, return empty string
} }
// Sets read position in bytebuffer // Sets read position in bytebuffer
// @0 - bytebuffer identifier // @0 - bytebuffer identifier
// @def - setted rpos (if "end", automatically set at end) // @def - setted rpos (if "end", automatically set at end)
DefReturnResult DefScriptPackage::func_bbsetrpos(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbsetrpos(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if (!bb) if (!bb)
return false; return false;
if (Set.defaultarg == "end") if (Set.defaultarg == "end")
bb->rpos( bb->size() ); bb->rpos( bb->size() );
else else
bb->rpos( (unsigned int)toNumber(Set.defaultarg) ); bb->rpos( (unsigned int)toNumber(Set.defaultarg) );
return true; return true;
} }
// Sets write position in bytebuffer // Sets write position in bytebuffer
// @0 - bytebuffer identifier // @0 - bytebuffer identifier
// @def - setted wpos (if "end", automatically set at end) // @def - setted wpos (if "end", automatically set at end)
DefReturnResult DefScriptPackage::func_bbsetwpos(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbsetwpos(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if (!bb) if (!bb)
return false; return false;
if (Set.defaultarg == "end") if (Set.defaultarg == "end")
bb->wpos( bb->size() ); bb->wpos( bb->size() );
else else
bb->wpos( (unsigned int)toNumber(Set.defaultarg) ); bb->wpos( (unsigned int)toNumber(Set.defaultarg) );
return true; return true;
} }
// Hexlike output of bytebuffer to console // Hexlike output of bytebuffer to console
// @def - bytebuffer identifier // @def - bytebuffer identifier
DefReturnResult DefScriptPackage::func_bbhexlike(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbhexlike(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if (!bb) if (!bb)
return false; return false;
bb->hexlike(); bb->hexlike();
return true; return true;
} }
// Textlike output of bytebuffer to console // Textlike output of bytebuffer to console
// @def - bytebuffer identifier // @def - bytebuffer identifier
DefReturnResult DefScriptPackage::func_bbtextlike(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbtextlike(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if (!bb) if (!bb)
return false; return false;
bb->textlike(); bb->textlike();
return true; return true;
} }
// Returns size of bytebuffer // Returns size of bytebuffer
// @def - bytebuffer identifier // @def - bytebuffer identifier
DefReturnResult DefScriptPackage::func_bbsize(CmdSet& Set) DefReturnResult DefScriptPackage::func_bbsize(CmdSet& Set)
{ {
ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if (!bb) if (!bb)
return false; return false;
return DefScriptTools::toString((uint64)bb->size()); return DefScriptTools::toString((uint64)bb->size());
} }

View File

@ -1,40 +1,40 @@
#ifndef DEFSCRIPTDEFINES_H #ifndef DEFSCRIPTDEFINES_H
#define DEFSCRIPTDEFINES_H #define DEFSCRIPTDEFINES_H
#include "SysDefs.h" #include "SysDefs.h"
// use this directive to check if the parser is working correctly // use this directive to check if the parser is working correctly
#define DEF_DEBUG_SCRIPT_CALLS #define DEF_DEBUG_SCRIPT_CALLS
#ifdef _DEBUG #ifdef _DEBUG
# define _DEFSC_DEBUG(code) code; # define _DEFSC_DEBUG(code) code;
# define _DEFSC_DEBUG_LOG DebugLog // does NOT YET work!! # define _DEFSC_DEBUG_LOG DebugLog // does NOT YET work!!
#else #else
# define _DEFSC_DEBUG(code) # define _DEFSC_DEBUG(code)
# define _DEFSC_DEBUG_LOG # define _DEFSC_DEBUG_LOG
#endif #endif
// now included in SysDefs.h // now included in SysDefs.h
/* /*
#if COMPILER == COMPILER_MICROSOFT #if COMPILER == COMPILER_MICROSOFT
typedef __int64 int64; typedef __int64 int64;
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;
#else #else
typedef __int64_t int64; typedef __int64_t int64;
typedef __uint64_t uint64; typedef __uint64_t uint64;
// TODO: correct ATOI64 for linux if necessary // TODO: correct ATOI64 for linux if necessary
#endif #endif
*/ */
enum VariableType enum VariableType
{ {
DEFSCRIPT_NONE=0, DEFSCRIPT_NONE=0,
DEFSCRIPT_VAR, DEFSCRIPT_VAR,
DEFSCRIPT_FUNC DEFSCRIPT_FUNC
}; };
typedef long double ldbl; typedef long double ldbl;
#define SCRIPT_NAMESPACE "DEFSCRIPT::SCRIPT::" #define SCRIPT_NAMESPACE "DEFSCRIPT::SCRIPT::"
#endif #endif

View File

@ -1,361 +1,361 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include "DefScript.h" #include "DefScript.h"
#include "DefScriptTools.h" #include "DefScriptTools.h"
#include "SysDefs.h" #include "SysDefs.h"
using namespace DefScriptTools; using namespace DefScriptTools;
#define FH_MACRO_READ_I(_f,_sty,_ty) if(_sty==(#_ty)) { _ty _in; (_f)->read((char*)&_in,sizeof(_ty)); return toString((uint64)_in); } #define FH_MACRO_READ_I(_f,_sty,_ty) if(_sty==(#_ty)) { _ty _in; (_f)->read((char*)&_in,sizeof(_ty)); return toString((uint64)_in); }
#define FH_MACRO_READ_F(_f,_sty,_ty) if(_sty==(#_ty)) { _ty _in; (_f)->read((char*)&_in,sizeof(_ty)); return toString((ldbl)_in); } #define FH_MACRO_READ_F(_f,_sty,_ty) if(_sty==(#_ty)) { _ty _in; (_f)->read((char*)&_in,sizeof(_ty)); return toString((ldbl)_in); }
DefReturnResult DefScriptPackage::func_fopen(CmdSet& Set) DefReturnResult DefScriptPackage::func_fopen(CmdSet& Set)
{ {
std::fstream *fh = files.Get(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.Get(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh->is_open()) if(fh->is_open())
return ""; return "";
std::string mode = stringToLower(Set.arg[1]); std::string mode = stringToLower(Set.arg[1]);
std::ios::openmode m = 0; std::ios::openmode m = 0;
if(mode.find('b') != std::string::npos) if(mode.find('b') != std::string::npos)
m |= std::ios_base::binary; m |= std::ios_base::binary;
if(mode.find('a') != std::string::npos) if(mode.find('a') != std::string::npos)
m |= std::ios_base::app; m |= std::ios_base::app;
if(mode.find('r') != std::string::npos) if(mode.find('r') != std::string::npos)
m |= std::ios_base::in; m |= std::ios_base::in;
if(mode.find('w') != std::string::npos) if(mode.find('w') != std::string::npos)
m |= std::ios_base::out; m |= std::ios_base::out;
// sort out some possible errors with bad open modes // sort out some possible errors with bad open modes
if(m & std::ios_base::app) if(m & std::ios_base::app)
m |= std::ios_base::out; // always open for writing when appending m |= std::ios_base::out; // always open for writing when appending
if(m == 0 || m == std::ios_base::binary) if(m == 0 || m == std::ios_base::binary)
m |= std::ios_base::out | std::ios_base::in; // if no openmode or binary only specified, use both r+w additionally m |= std::ios_base::out | std::ios_base::in; // if no openmode or binary only specified, use both r+w additionally
fh->open(Set.defaultarg.c_str(), m); fh->open(Set.defaultarg.c_str(), m);
// if the file didnt open properly, like if a not existing file opened in read+write mode, // if the file didnt open properly, like if a not existing file opened in read+write mode,
// try fallback mode with write mode only // try fallback mode with write mode only
if(!fh->is_open() && (m & std::ios_base::in)) if(!fh->is_open() && (m & std::ios_base::in))
{ {
m &= (~std::ios_base::in); m &= (~std::ios_base::in);
fh->open(Set.defaultarg.c_str(), m); fh->open(Set.defaultarg.c_str(), m);
} }
_DEFSC_DEBUG( if(!fh->is_open()) printf("DefScript: Can't open file '%s'\n",Set.defaultarg.c_str())); _DEFSC_DEBUG( if(!fh->is_open()) printf("DefScript: Can't open file '%s'\n",Set.defaultarg.c_str()));
return fh->is_open(); return fh->is_open();
} }
DefReturnResult DefScriptPackage::func_fclose(CmdSet& Set) DefReturnResult DefScriptPackage::func_fclose(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(fh) if(fh)
{ {
fh->flush(); fh->flush();
fh->close(); fh->close();
files.DeleteByPtr(fh); files.DeleteByPtr(fh);
return true; return true;
} }
return false; return false;
} }
DefReturnResult DefScriptPackage::func_fisopen(CmdSet& Set) DefReturnResult DefScriptPackage::func_fisopen(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
return fh && fh->good() && fh->is_open(); return fh && fh->good() && fh->is_open();
} }
DefReturnResult DefScriptPackage::func_feof(CmdSet& Set) DefReturnResult DefScriptPackage::func_feof(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
return (!fh) || fh->eof(); return (!fh) || fh->eof();
} }
DefReturnResult DefScriptPackage::func_frpos(CmdSet& Set) DefReturnResult DefScriptPackage::func_frpos(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(!fh) if(!fh)
return ""; return "";
return toString((uint64)fh->tellg()); return toString((uint64)fh->tellg());
} }
DefReturnResult DefScriptPackage::func_fwpos(CmdSet& Set) DefReturnResult DefScriptPackage::func_fwpos(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(!fh) if(!fh)
return ""; return "";
return toString((uint64)fh->tellp()); return toString((uint64)fh->tellp());
} }
DefReturnResult DefScriptPackage::func_fdel(CmdSet& Set) DefReturnResult DefScriptPackage::func_fdel(CmdSet& Set)
{ {
return (remove(Set.defaultarg.c_str()) == 0); return (remove(Set.defaultarg.c_str()) == 0);
} }
DefReturnResult DefScriptPackage::func_fflush(CmdSet& Set) DefReturnResult DefScriptPackage::func_fflush(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
fh->flush(); fh->flush();
return ""; return "";
} }
DefReturnResult DefScriptPackage::func_fwrite(CmdSet& Set) DefReturnResult DefScriptPackage::func_fwrite(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
*fh << Set.defaultarg; *fh << Set.defaultarg;
return true; return true;
} }
return false; return false;
} }
DefReturnResult DefScriptPackage::func_fread(CmdSet& Set) DefReturnResult DefScriptPackage::func_fread(CmdSet& Set)
{ {
std::string fn = _NormalizeVarName(Set.arg[0],Set.myname); std::string fn = _NormalizeVarName(Set.arg[0],Set.myname);
std::fstream *fh = files.GetNoCreate(fn); std::fstream *fh = files.GetNoCreate(fn);
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
uint64 bytes; uint64 bytes;
uint64 read = 0; uint64 read = 0;
if(stringToLower(Set.defaultarg) == "all") if(stringToLower(Set.defaultarg) == "all")
{ {
std::fstream::pos_type begin_pos, end_pos, old_pos = fh->tellg(); std::fstream::pos_type begin_pos, end_pos, old_pos = fh->tellg();
fh->seekg(0, std::ios_base::beg); fh->seekg(0, std::ios_base::beg);
begin_pos=fh->tellg(); begin_pos=fh->tellg();
fh->seekg(0, std::ios_base::end); fh->seekg(0, std::ios_base::end);
end_pos = fh->tellg(); end_pos = fh->tellg();
fh->seekg(old_pos, std::ios_base::beg); fh->seekg(old_pos, std::ios_base::beg);
bytes = (end_pos - begin_pos); bytes = (end_pos - begin_pos);
} }
else else
bytes = toUint64(Set.defaultarg); bytes = toUint64(Set.defaultarg);
std::string ret; std::string ret;
ret.reserve(bytes); ret.reserve(bytes);
for(uint64 i = 0; i < bytes && !fh->eof(); i++) for(uint64 i = 0; i < bytes && !fh->eof(); i++)
{ {
ret += fh->get(); ret += fh->get();
read++; read++;
} }
return toString(read); return toString(read);
} }
return ""; return "";
} }
DefReturnResult DefScriptPackage::func_freadb(CmdSet& Set) DefReturnResult DefScriptPackage::func_freadb(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
std::string t = stringToLower(Set.defaultarg); std::string t = stringToLower(Set.defaultarg);
if(t == "string") if(t == "string")
{ {
std::string ret; std::string ret;
while(char c = fh->get() && !fh->eof()) while(char c = fh->get() && !fh->eof())
ret += c; ret += c;
return ret; return ret;
} }
else if(t == "strnz") else if(t == "strnz")
{ {
uint32 bytes = (uint32)toUint64(Set.arg[1]); uint32 bytes = (uint32)toUint64(Set.arg[1]);
if(bytes) if(bytes)
{ {
std::string g; std::string g;
for(uint32 i = 0; i < bytes; i++) for(uint32 i = 0; i < bytes; i++)
{ {
g += fh->get(); g += fh->get();
} }
return g; return g;
} }
return ""; return "";
} }
FH_MACRO_READ_I(fh,t,uint8); FH_MACRO_READ_I(fh,t,uint8);
FH_MACRO_READ_I(fh,t,uint16); FH_MACRO_READ_I(fh,t,uint16);
FH_MACRO_READ_I(fh,t,uint32); FH_MACRO_READ_I(fh,t,uint32);
FH_MACRO_READ_I(fh,t,uint64); FH_MACRO_READ_I(fh,t,uint64);
FH_MACRO_READ_F(fh,t,float); FH_MACRO_READ_F(fh,t,float);
FH_MACRO_READ_F(fh,t,double); FH_MACRO_READ_F(fh,t,double);
} }
return ""; return "";
} }
DefReturnResult DefScriptPackage::func_fwriteb(CmdSet& Set) DefReturnResult DefScriptPackage::func_fwriteb(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
std::string t = stringToLower(Set.arg[1]); std::string t = stringToLower(Set.arg[1]);
if(t == "string") if(t == "string")
{ {
fh->write(Set.defaultarg.c_str(), Set.defaultarg.size() + 1); // also put \0 fh->write(Set.defaultarg.c_str(), Set.defaultarg.size() + 1); // also put \0
return true; return true;
} }
else if(t == "strnz") else if(t == "strnz")
{ {
fh->write(Set.defaultarg.c_str(), Set.defaultarg.size()); // skip \0 fh->write(Set.defaultarg.c_str(), Set.defaultarg.size()); // skip \0
return true; return true;
} }
else if(t == "uint8") else if(t == "uint8")
{ {
uint8 o = (uint8)toUint64(Set.defaultarg); uint8 o = (uint8)toUint64(Set.defaultarg);
fh->write((char*)&o,sizeof(uint8)); fh->write((char*)&o,sizeof(uint8));
return true; return true;
} }
else if(t == "uint16") else if(t == "uint16")
{ {
uint16 o = (uint16)toUint64(Set.defaultarg); uint16 o = (uint16)toUint64(Set.defaultarg);
fh->write((char*)&o,sizeof(uint16)); fh->write((char*)&o,sizeof(uint16));
return true; return true;
} }
else if(t == "uint32") else if(t == "uint32")
{ {
uint32 o = (uint32)toUint64(Set.defaultarg); uint32 o = (uint32)toUint64(Set.defaultarg);
fh->write((char*)&o,sizeof(uint32)); fh->write((char*)&o,sizeof(uint32));
return true; return true;
} }
else if(t == "uint64") else if(t == "uint64")
{ {
uint64 o = toUint64(Set.defaultarg); uint64 o = toUint64(Set.defaultarg);
fh->write((char*)&o,sizeof(uint64)); fh->write((char*)&o,sizeof(uint64));
return true; return true;
} }
else if(t == "float") else if(t == "float")
{ {
float o = (float)toNumber(Set.defaultarg); float o = (float)toNumber(Set.defaultarg);
fh->write((char*)&o,sizeof(float)); fh->write((char*)&o,sizeof(float));
return true; return true;
} }
else if(t == "double") else if(t == "double")
{ {
double o = (double)toNumber(Set.defaultarg); double o = (double)toNumber(Set.defaultarg);
fh->write((char*)&o,sizeof(double)); fh->write((char*)&o,sizeof(double));
return true; return true;
} }
} }
return false; return false;
} }
DefReturnResult DefScriptPackage::func_fwritebb(CmdSet& Set) DefReturnResult DefScriptPackage::func_fwritebb(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); ByteBuffer *bb = bytebuffers.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(bb) if(bb)
{ {
uint32 bytes = (uint32)toUint64(Set.arg[1]); uint32 bytes = (uint32)toUint64(Set.arg[1]);
if(!bytes) if(!bytes)
{ {
bytes = bb->size(); bytes = bb->size();
} }
if(bytes) if(bytes)
{ {
fh->write((char*)bb->contents(), bytes); fh->write((char*)bb->contents(), bytes);
} }
return toString((uint64)bytes); return toString((uint64)bytes);
} }
} }
return ""; return "";
} }
DefReturnResult DefScriptPackage::func_freadbb(CmdSet& Set) DefReturnResult DefScriptPackage::func_freadbb(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
ByteBuffer *bb = bytebuffers.Get(_NormalizeVarName(Set.defaultarg,Set.myname)); ByteBuffer *bb = bytebuffers.Get(_NormalizeVarName(Set.defaultarg,Set.myname));
uint32 bytes = (uint32)toUint64(Set.arg[1]); uint32 bytes = (uint32)toUint64(Set.arg[1]);
if(!bytes) if(!bytes)
{ {
// get amount of remaining bytes // get amount of remaining bytes
std::ios::pos_type oldpos = fh->tellg(); std::ios::pos_type oldpos = fh->tellg();
fh->seekg(0,std::ios_base::end); fh->seekg(0,std::ios_base::end);
bytes = uint32(fh->tellg() - oldpos); bytes = uint32(fh->tellg() - oldpos);
fh->seekg(oldpos,std::ios_base::beg); fh->seekg(oldpos,std::ios_base::beg);
} }
if(bytes) if(bytes)
{ {
bb->resize(bb->size() + bytes); bb->resize(bb->size() + bytes);
fh->read((char*)bb->contents(), bytes); fh->read((char*)bb->contents(), bytes);
} }
return toString((uint64)bytes); return toString((uint64)bytes);
} }
return ""; return "";
} }
DefReturnResult DefScriptPackage::func_fsize(CmdSet& Set) DefReturnResult DefScriptPackage::func_fsize(CmdSet& Set)
{ {
std::ifstream f; std::ifstream f;
f.open(Set.defaultarg.c_str(), std::ios_base::binary | std::ios_base::in); f.open(Set.defaultarg.c_str(), std::ios_base::binary | std::ios_base::in);
if (!f.good() || f.eof() || !f.is_open()) { return ""; } if (!f.good() || f.eof() || !f.is_open()) { return ""; }
f.seekg(0, std::ios_base::beg); f.seekg(0, std::ios_base::beg);
std::ifstream::pos_type begin_pos = f.tellg(), end_pos; std::ifstream::pos_type begin_pos = f.tellg(), end_pos;
f.seekg(0, std::ios_base::end); f.seekg(0, std::ios_base::end);
end_pos = f.tellg(); end_pos = f.tellg();
f.close(); f.close();
return toString((uint64)(end_pos - begin_pos)); return toString((uint64)(end_pos - begin_pos));
} }
DefReturnResult DefScriptPackage::func_freadline(CmdSet& Set) DefReturnResult DefScriptPackage::func_freadline(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
char c; char c;
std::string line; std::string line;
line.reserve(30); // rough guess to speedup appending line.reserve(30); // rough guess to speedup appending
while(!fh->eof()) while(!fh->eof())
{ {
c = fh->get(); c = fh->get();
if(c == '\n' || fh->eof()) if(c == '\n' || fh->eof())
return line; return line;
else else
line += c; line += c;
} }
} }
return ""; return "";
} }
DefReturnResult DefScriptPackage::func_fseekw(CmdSet& Set) DefReturnResult DefScriptPackage::func_fseekw(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
std::string w = stringToLower(Set.arg[1]); std::string w = stringToLower(Set.arg[1]);
uint32 pos = (uint32)toUint64(Set.defaultarg); uint32 pos = (uint32)toUint64(Set.defaultarg);
if(w.empty() || w == "begin") if(w.empty() || w == "begin")
{ {
fh->seekp(pos, std::ios_base::beg); fh->seekp(pos, std::ios_base::beg);
return true; return true;
} }
else if(w == "end") else if(w == "end")
{ {
fh->seekp(pos, std::ios_base::end); fh->seekp(pos, std::ios_base::end);
return true; return true;
} }
} }
return false; return false;
} }
DefReturnResult DefScriptPackage::func_fseekr(CmdSet& Set) DefReturnResult DefScriptPackage::func_fseekr(CmdSet& Set)
{ {
std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); std::fstream *fh = files.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(fh && fh->is_open()) if(fh && fh->is_open())
{ {
std::string w = stringToLower(Set.arg[1]); std::string w = stringToLower(Set.arg[1]);
uint32 pos = (uint32)toUint64(Set.defaultarg); uint32 pos = (uint32)toUint64(Set.defaultarg);
if(w.empty() || w == "begin") if(w.empty() || w == "begin")
{ {
fh->seekg(pos, std::ios_base::beg); fh->seekg(pos, std::ios_base::beg);
return true; return true;
} }
else if(w == "end") else if(w == "end")
{ {
fh->seekg(pos, std::ios_base::end); fh->seekg(pos, std::ios_base::end);
return true; return true;
} }
} }
return false; return false;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,296 +1,296 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include "DefScript.h" #include "DefScript.h"
using namespace DefScriptTools; using namespace DefScriptTools;
DefReturnResult DefScriptPackage::func_lpushback(CmdSet& Set) DefReturnResult DefScriptPackage::func_lpushback(CmdSet& Set)
{ {
DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname));
l->push_back(Set.defaultarg); l->push_back(Set.defaultarg);
return true; return true;
} }
DefReturnResult DefScriptPackage::func_lpushfront(CmdSet& Set) DefReturnResult DefScriptPackage::func_lpushfront(CmdSet& Set)
{ {
DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname));
l->push_front(Set.defaultarg); l->push_front(Set.defaultarg);
return true; return true;
} }
DefReturnResult DefScriptPackage::func_lpopback(CmdSet& Set) DefReturnResult DefScriptPackage::func_lpopback(CmdSet& Set)
{ {
std::string r; std::string r;
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if( (!l) || (!l->size()) ) // cant pop any element if the list doesnt exist or is empty if( (!l) || (!l->size()) ) // cant pop any element if the list doesnt exist or is empty
return ""; return "";
r= l->back(); r= l->back();
l->pop_back(); l->pop_back();
return r; return r;
} }
DefReturnResult DefScriptPackage::func_lpopfront(CmdSet& Set) DefReturnResult DefScriptPackage::func_lpopfront(CmdSet& Set)
{ {
std::string r; std::string r;
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if( (!l) || (!l->size()) ) // cant pop any element if the list doesnt exist or is empty if( (!l) || (!l->size()) ) // cant pop any element if the list doesnt exist or is empty
return ""; return "";
r = l->front(); r = l->front();
l->pop_front(); l->pop_front();
return r; return r;
} }
// delete a list and all its elements // delete a list and all its elements
DefReturnResult DefScriptPackage::func_ldelete(CmdSet& Set) DefReturnResult DefScriptPackage::func_ldelete(CmdSet& Set)
{ {
std::string lname = _NormalizeVarName(Set.defaultarg,Set.myname); std::string lname = _NormalizeVarName(Set.defaultarg,Set.myname);
if(strncmp(lname.c_str(), SCRIPT_NAMESPACE,strlen(SCRIPT_NAMESPACE))==0) if(strncmp(lname.c_str(), SCRIPT_NAMESPACE,strlen(SCRIPT_NAMESPACE))==0)
{ {
printf("DefScript: WARNING: ldelete used on a script list, clearing instead! (called by '%s', list '%s')\n",Set.myname.c_str(), lname.c_str()); printf("DefScript: WARNING: ldelete used on a script list, clearing instead! (called by '%s', list '%s')\n",Set.myname.c_str(), lname.c_str());
DefList *l = lists.GetNoCreate(lname); DefList *l = lists.GetNoCreate(lname);
if(l) if(l)
l->clear(); l->clear();
return true; return true;
} }
lists.Delete(lname); lists.Delete(lname);
return true; return true;
} }
// returns true if a list with the given name exists, else false // returns true if a list with the given name exists, else false
DefReturnResult DefScriptPackage::func_lexists(CmdSet& Set) DefReturnResult DefScriptPackage::func_lexists(CmdSet& Set)
{ {
return lists.Exists(_NormalizeVarName(Set.defaultarg,Set.myname)); return lists.Exists(_NormalizeVarName(Set.defaultarg,Set.myname));
} }
// return list element count // return list element count
DefReturnResult DefScriptPackage::func_llen(CmdSet& Set) DefReturnResult DefScriptPackage::func_llen(CmdSet& Set)
{ {
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(!l) if(!l)
return ""; // return nothing if list doesnt exist return ""; // return nothing if list doesnt exist
return toString((uint64)l->size()); // return any number return toString((uint64)l->size()); // return any number
} }
// insert item at some position in the list // insert item at some position in the list
DefReturnResult DefScriptPackage::func_linsert(CmdSet& Set) DefReturnResult DefScriptPackage::func_linsert(CmdSet& Set)
{ {
bool result; bool result;
DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname));
unsigned int pos = (unsigned int)toNumber(Set.arg[1]); unsigned int pos = (unsigned int)toNumber(Set.arg[1]);
if(pos > l->size()) // if the list is too short to insert at that pos... if(pos > l->size()) // if the list is too short to insert at that pos...
{ {
l->push_back(Set.defaultarg); // ... just append at the end l->push_back(Set.defaultarg); // ... just append at the end
result = false; result = false;
} }
else else
{ {
DefList::iterator it = l->begin(); DefList::iterator it = l->begin();
advance(it,pos); advance(it,pos);
l->insert(it,Set.defaultarg); // ... else insert at correct position l->insert(it,Set.defaultarg); // ... else insert at correct position
result = true; result = true;
} }
return result; return result;
} }
// returns the amount of string fragments added to the list // returns the amount of string fragments added to the list
// arg0: list name; arg1: delimiter string; defaultarg: string to split // arg0: list name; arg1: delimiter string; defaultarg: string to split
DefReturnResult DefScriptPackage::func_lsplit(CmdSet& Set) DefReturnResult DefScriptPackage::func_lsplit(CmdSet& Set)
{ {
// 1st create a new list, or get an already existing one and clear it // 1st create a new list, or get an already existing one and clear it
DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname));
l->clear(); l->clear();
if(Set.defaultarg.empty()) // we cant split an empty string, return nothing, and keep empty list if(Set.defaultarg.empty()) // we cant split an empty string, return nothing, and keep empty list
return ""; return "";
// special case: empty delimiter -> split in chars // special case: empty delimiter -> split in chars
if(Set.arg[1].empty()) if(Set.arg[1].empty())
{ {
for(unsigned int i=0; i<Set.defaultarg.length(); i++) for(unsigned int i=0; i<Set.defaultarg.length(); i++)
{ {
std::string tmp; std::string tmp;
tmp = Set.defaultarg[i]; tmp = Set.defaultarg[i];
l->push_back(tmp); l->push_back(tmp);
} }
return toString((uint64)l->size()); return toString((uint64)l->size());
} }
unsigned int p,q=0; // p=position of substr; q=next pos to start searching at unsigned int p,q=0; // p=position of substr; q=next pos to start searching at
while( (p = Set.defaultarg.find(Set.arg[1].c_str(),q)) != std::string::npos) while( (p = Set.defaultarg.find(Set.arg[1].c_str(),q)) != std::string::npos)
{ {
l->push_back( Set.defaultarg.substr(q,p - q) ); l->push_back( Set.defaultarg.substr(q,p - q) );
q = p + Set.arg[1].length(); q = p + Set.arg[1].length();
} }
if(q < Set.defaultarg.length()) // also append the last string fragment (that has no delimiter) if(q < Set.defaultarg.length()) // also append the last string fragment (that has no delimiter)
{ {
l->push_back(Set.defaultarg.c_str() + q); l->push_back(Set.defaultarg.c_str() + q);
} }
return toString((uint64)l->size()); return toString((uint64)l->size());
} }
// multi-split by chars // multi-split by chars
// returns the amount of string fragments added to the list // returns the amount of string fragments added to the list
// arg0: list name; args: delimit; defaultarg: string to split // arg0: list name; args: delimit; defaultarg: string to split
DefReturnResult DefScriptPackage::func_lcsplit(CmdSet& Set) DefReturnResult DefScriptPackage::func_lcsplit(CmdSet& Set)
{ {
// 1st create a new list, or get an already existing one and clear it // 1st create a new list, or get an already existing one and clear it
DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.Get(_NormalizeVarName(Set.arg[0],Set.myname));
l->clear(); l->clear();
if(Set.defaultarg.empty()) // we cant split an empty string, return nothing, and keep empty list if(Set.defaultarg.empty()) // we cant split an empty string, return nothing, and keep empty list
return ""; return "";
unsigned int p,q=0; // p=position of substr; q=next pos to start searching at unsigned int p,q=0; // p=position of substr; q=next pos to start searching at
while( (p = Set.defaultarg.find_first_of(Set.arg[1].c_str(),q)) != std::string::npos) while( (p = Set.defaultarg.find_first_of(Set.arg[1].c_str(),q)) != std::string::npos)
{ {
l->push_back( Set.defaultarg.substr(q,p - q) ); l->push_back( Set.defaultarg.substr(q,p - q) );
q = p + 1; q = p + 1;
} }
if(q < Set.defaultarg.length()) // also append the last string fragment (that has no delimiter) if(q < Set.defaultarg.length()) // also append the last string fragment (that has no delimiter)
{ {
l->push_back(Set.defaultarg.c_str() + q); l->push_back(Set.defaultarg.c_str() + q);
} }
return toString((uint64)l->size()); return toString((uint64)l->size());
} }
// create a string from a list, using <defaultarg> as delimiter // create a string from a list, using <defaultarg> as delimiter
DefReturnResult DefScriptPackage::func_ljoin(CmdSet& Set) DefReturnResult DefScriptPackage::func_ljoin(CmdSet& Set)
{ {
std::string r; std::string r;
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(!l) if(!l)
return ""; return "";
for(unsigned int i = 0; i < l->size(); i++) for(unsigned int i = 0; i < l->size(); i++)
{ {
r += (*l)[i]; r += (*l)[i];
if( i+1 != l->size() ) if( i+1 != l->size() )
r += Set.defaultarg; r += Set.defaultarg;
} }
return r; return r;
} }
// return list item at position xx // return list item at position xx
DefReturnResult DefScriptPackage::func_lindex(CmdSet& Set) DefReturnResult DefScriptPackage::func_lindex(CmdSet& Set)
{ {
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(!l) if(!l)
return ""; return "";
unsigned int pos = (unsigned int)toNumber(Set.defaultarg); unsigned int pos = (unsigned int)toNumber(Set.defaultarg);
if(pos+1 > l->size()) // ot of bounds? if(pos+1 > l->size()) // ot of bounds?
return ""; return "";
return (*l)[pos]; return (*l)[pos];
} }
// clean list: remove every element that matches @def // clean list: remove every element that matches @def
// use _only_ this function to remove empty strings from a list // use _only_ this function to remove empty strings from a list
DefReturnResult DefScriptPackage::func_lclean(CmdSet& Set) DefReturnResult DefScriptPackage::func_lclean(CmdSet& Set)
{ {
unsigned int r=0; unsigned int r=0;
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(!l) if(!l)
return ""; return "";
for(DefList::iterator i=l->begin(); i!=l->end(); ) for(DefList::iterator i=l->begin(); i!=l->end(); )
{ {
if(*i == Set.defaultarg) if(*i == Set.defaultarg)
{ {
i = l->erase(i); i = l->erase(i);
r++; r++;
continue; continue;
} }
i++; i++;
} }
return toString((uint64)r); return toString((uint64)r);
} }
// multi-clean list: remove every element that matches any of the args, if it isn't empty // multi-clean list: remove every element that matches any of the args, if it isn't empty
// NOTE: arg0 = list name, this one is skipped! // NOTE: arg0 = list name, this one is skipped!
// this func does NOT remove empty strings from a list, use lclean instead!! // this func does NOT remove empty strings from a list, use lclean instead!!
DefReturnResult DefScriptPackage::func_lmclean(CmdSet& Set) DefReturnResult DefScriptPackage::func_lmclean(CmdSet& Set)
{ {
unsigned int r=0; unsigned int r=0;
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(!l) if(!l)
return ""; return "";
_CmdSetArgMap::iterator it=Set.arg.begin(); _CmdSetArgMap::iterator it=Set.arg.begin();
advance(it,1); // skip list name advance(it,1); // skip list name
for( ; it != Set.arg.end(); it++) for( ; it != Set.arg.end(); it++)
{ {
if(it->second.length()) if(it->second.length())
{ {
for(DefList::iterator i=l->begin(); i!=l->end(); i++) for(DefList::iterator i=l->begin(); i!=l->end(); i++)
{ {
if(*i == it->second) if(*i == it->second)
{ {
l->erase(i); l->erase(i);
r++; r++;
if(i==l->end()) // must be checked here, else causing crash (?!) if(i==l->end()) // must be checked here, else causing crash (?!)
break; break;
} }
} }
} }
} }
// erase defaultarg if given // erase defaultarg if given
if(Set.defaultarg.length()) if(Set.defaultarg.length())
{ {
for(DefList::iterator i=l->begin(); i!=l->end(); i++) for(DefList::iterator i=l->begin(); i!=l->end(); i++)
{ {
if(*i == Set.defaultarg) if(*i == Set.defaultarg)
{ {
l->erase(i); l->erase(i);
r++; r++;
} }
} }
} }
return toString((uint64)r); return toString((uint64)r);
} }
// erase element at position @def, return erased element // erase element at position @def, return erased element
DefReturnResult DefScriptPackage::func_lerase(CmdSet& Set) DefReturnResult DefScriptPackage::func_lerase(CmdSet& Set)
{ {
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.arg[0],Set.myname));
if(!l) if(!l)
return ""; return "";
std::string r; std::string r;
unsigned int pos = (unsigned int)toNumber(Set.defaultarg); unsigned int pos = (unsigned int)toNumber(Set.defaultarg);
if(pos > l->size()) // if the list is too short to erase at that pos... if(pos > l->size()) // if the list is too short to erase at that pos...
return ""; // ... return nothing return ""; // ... return nothing
DefList::iterator it = l->begin(); DefList::iterator it = l->begin();
advance(it,pos); advance(it,pos);
r = *it; r = *it;
l->erase(it); // ... else erase at correct position l->erase(it); // ... else erase at correct position
return r; return r;
} }
DefReturnResult DefScriptPackage::func_lsort(CmdSet& Set) DefReturnResult DefScriptPackage::func_lsort(CmdSet& Set)
{ {
DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname)); DefList *l = lists.GetNoCreate(_NormalizeVarName(Set.defaultarg,Set.myname));
if(!l) if(!l)
return false; return false;
sort(l->begin(),l->end()); sort(l->begin(),l->end());
return true; return true;
} }
//DefReturnResult DefScriptPackage::func_lmerge(CmdSet& Set) //DefReturnResult DefScriptPackage::func_lmerge(CmdSet& Set)
//{ //{
// to be continued... // to be continued...

View File

@ -1,30 +1,30 @@
#ifndef _DEFSCRIPTTOOLS_H #ifndef _DEFSCRIPTTOOLS_H
#define _DEFSCRIPTTOOLS_H #define _DEFSCRIPTTOOLS_H
#include <sstream> #include <sstream>
namespace DefScriptTools namespace DefScriptTools
{ {
std::string stringToUpper(std::string); std::string stringToUpper(std::string);
std::string stringToLower(std::string); std::string stringToLower(std::string);
std::string toString(ldbl); std::string toString(ldbl);
inline std::string toString(double num) { return toString(ldbl(num)); } inline std::string toString(double num) { return toString(ldbl(num)); }
inline std::string toString(float num) { return toString(ldbl(num)); } inline std::string toString(float num) { return toString(ldbl(num)); }
template <class T> inline std::string toString(T num) template <class T> inline std::string toString(T num)
{ {
std::stringstream ss; std::stringstream ss;
ss << num; ss << num;
return ss.str(); return ss.str();
} }
ldbl toNumber(std::string&); ldbl toNumber(std::string&);
bool isTrue(std::string&); bool isTrue(std::string&);
uint64 toUint64(std::string&); uint64 toUint64(std::string&);
uint64 atoi64(std::string&); uint64 atoi64(std::string&);
inline long double Round(long double z,unsigned int n); inline long double Round(long double z,unsigned int n);
} }
#endif #endif

View File

@ -1,31 +1,31 @@
#ifndef _DEF_DYNAMICEVENT_H #ifndef _DEF_DYNAMICEVENT_H
#define _DEF_DYNAMICEVENT_H #define _DEF_DYNAMICEVENT_H
#include <time.h> #include <time.h>
#include <list> #include <list>
#include <string> #include <string>
#include "TypeStorage.h" #include "TypeStorage.h"
struct DefScript_DynamicEvent; struct DefScript_DynamicEvent;
class DefScript; class DefScript;
class DefScriptPackage; class DefScriptPackage;
typedef TypeStorage<DefScript_DynamicEvent> DefDynamicEventStorage; typedef TypeStorage<DefScript_DynamicEvent> DefDynamicEventStorage;
class DefScript_DynamicEventMgr class DefScript_DynamicEventMgr
{ {
public: public:
DefScript_DynamicEventMgr(DefScriptPackage *pack); DefScript_DynamicEventMgr(DefScriptPackage *pack);
~DefScript_DynamicEventMgr(); ~DefScript_DynamicEventMgr();
void Add(std::string name, std::string script, clock_t interval, const char *parent, bool force = false); void Add(std::string name, std::string script, clock_t interval, const char *parent, bool force = false);
void Remove(std::string name); void Remove(std::string name);
void Update(void); void Update(void);
private: private:
DefDynamicEventStorage _storage; DefDynamicEventStorage _storage;
clock_t _lastclock; clock_t _lastclock;
DefScriptPackage *_pack; DefScriptPackage *_pack;
bool _events_changed; // this one helps to detect if a script called from an event has modified the event storage (risk of iterator invalidation!) bool _events_changed; // this one helps to detect if a script called from an event has modified the event storage (risk of iterator invalidation!)
}; };
#endif #endif

View File

@ -1,148 +1,148 @@
#ifndef DEFSCRIPT_TYPESTORAGE_H #ifndef DEFSCRIPT_TYPESTORAGE_H
#define DEFSCRIPT_TYPESTORAGE_H #define DEFSCRIPT_TYPESTORAGE_H
#include <string> #include <string>
#include <map> #include <map>
template <class T> class TypeStorage template <class T> class TypeStorage
{ {
public: public:
typedef typename std::map<std::string,T*> _TypeMap; typedef typename std::map<std::string,T*> _TypeMap;
typedef typename _TypeMap::iterator _TypeIter; typedef typename _TypeMap::iterator _TypeIter;
TypeStorage() { _keep = false; } TypeStorage() { _keep = false; }
~TypeStorage(); ~TypeStorage();
bool Exists(std::string); bool Exists(std::string);
void Delete(std::string); void Delete(std::string);
void DeleteByPtr(T*); void DeleteByPtr(T*);
T *Get(std::string); T *Get(std::string);
T *GetNoCreate(std::string); T *GetNoCreate(std::string);
void Assign(std::string,T*); void Assign(std::string,T*);
void Unlink(std::string); void Unlink(std::string);
void UnlinkByPtr(T*); void UnlinkByPtr(T*);
std::string GetNameByPtr(T*); std::string GetNameByPtr(T*);
inline std::map<std::string,T*> &GetMap(void) { return _storage; } inline std::map<std::string,T*> &GetMap(void) { return _storage; }
inline void SetKeepOnDestruct(bool b = true) { _keep = true; } inline void SetKeepOnDestruct(bool b = true) { _keep = true; }
inline unsigned int Size(void) { return _storage.size(); } inline unsigned int Size(void) { return _storage.size(); }
void Clear(bool keep = false); void Clear(bool keep = false);
private: private:
T *_Create(std::string); T *_Create(std::string);
_TypeMap _storage; _TypeMap _storage;
bool _keep; bool _keep;
}; };
// check whether an object with this name is already present // check whether an object with this name is already present
template<class T> bool TypeStorage<T>::Exists(std::string s) template<class T> bool TypeStorage<T>::Exists(std::string s)
{ {
return _storage.find(s) != _storage.end(); return _storage.find(s) != _storage.end();
} }
// helper to create and assign a new object // helper to create and assign a new object
template<class T> T *TypeStorage<T>::_Create(std::string s) template<class T> T *TypeStorage<T>::_Create(std::string s)
{ {
T *elem = new T; T *elem = new T;
_storage[s] = elem; _storage[s] = elem;
return elem; return elem;
} }
// delete object with that name, if present // delete object with that name, if present
template<class T> void TypeStorage<T>::Delete(std::string s) template<class T> void TypeStorage<T>::Delete(std::string s)
{ {
_TypeIter it = _storage.find(s); _TypeIter it = _storage.find(s);
if(it != _storage.end()) if(it != _storage.end())
{ {
delete it->second; delete it->second;
_storage.erase(it); _storage.erase(it);
} }
} }
// delete object with that ptr, if present // delete object with that ptr, if present
template<class T> void TypeStorage<T>::DeleteByPtr(T *ptr) template<class T> void TypeStorage<T>::DeleteByPtr(T *ptr)
{ {
for(_TypeIter it = _storage.begin(); it != _storage.end(); it++) for(_TypeIter it = _storage.begin(); it != _storage.end(); it++)
{ {
if(it->second == ptr) if(it->second == ptr)
{ {
delete it->second; delete it->second;
_storage.erase(it); _storage.erase(it);
return; return;
} }
} }
} }
// return the the object with that name. return NULL if not found // return the the object with that name. return NULL if not found
template <class T> T *TypeStorage<T>::GetNoCreate(std::string s) template <class T> T *TypeStorage<T>::GetNoCreate(std::string s)
{ {
_TypeIter it = _storage.find(s); _TypeIter it = _storage.find(s);
if(it != _storage.end()) if(it != _storage.end())
return it->second; return it->second;
return NULL; return NULL;
} }
// return the the object with that name. create and return new object if not found // return the the object with that name. create and return new object if not found
template<class T> T *TypeStorage<T>::Get(std::string s) template<class T> T *TypeStorage<T>::Get(std::string s)
{ {
T *elem = GetNoCreate(s); T *elem = GetNoCreate(s);
return elem ? elem : _Create(s); return elem ? elem : _Create(s);
} }
// when destroying the TypeStorage, delete all stored objects // when destroying the TypeStorage, delete all stored objects
template<class T> TypeStorage<T>::~TypeStorage() template<class T> TypeStorage<T>::~TypeStorage()
{ {
Clear(_keep); Clear(_keep);
} }
template<class T> void TypeStorage<T>::Clear(bool keep) template<class T> void TypeStorage<T>::Clear(bool keep)
{ {
if(keep) if(keep)
{ {
_storage.clear(); _storage.clear();
return; return;
} }
for(_TypeIter it = _storage.begin(); it != _storage.end();) for(_TypeIter it = _storage.begin(); it != _storage.end();)
{ {
delete it->second; delete it->second;
_storage.erase(it++); _storage.erase(it++);
} }
} }
// stores an already existing object's pointer under a specific name; deletes and overwrites old of present // stores an already existing object's pointer under a specific name; deletes and overwrites old of present
template<class T> void TypeStorage<T>::Assign(std::string s,T *elem) template<class T> void TypeStorage<T>::Assign(std::string s,T *elem)
{ {
if(Exists(s)) if(Exists(s))
Delete(s); Delete(s);
_storage[s] = elem; _storage[s] = elem;
} }
// removes the pointer from the storage without deleting it // removes the pointer from the storage without deleting it
template<class T> void TypeStorage<T>::Unlink(std::string s) template<class T> void TypeStorage<T>::Unlink(std::string s)
{ {
_storage.erase(s); _storage.erase(s);
} }
// removes the pointer from the storage without deleting it, if name is unknown // removes the pointer from the storage without deleting it, if name is unknown
template<class T> void TypeStorage<T>::UnlinkByPtr(T *ptr) template<class T> void TypeStorage<T>::UnlinkByPtr(T *ptr)
{ {
for(_TypeIter it = _storage.begin(); it != _storage.end();) for(_TypeIter it = _storage.begin(); it != _storage.end();)
{ {
if(it->second == ptr) if(it->second == ptr)
{ {
Unlink(it->first); Unlink(it->first);
return; return;
} }
} }
} }
template<class T> std::string TypeStorage<T>::GetNameByPtr(T *ptr) template<class T> std::string TypeStorage<T>::GetNameByPtr(T *ptr)
{ {
for(_TypeIter it = _storage.begin(); it != _storage.end();) for(_TypeIter it = _storage.begin(); it != _storage.end();)
{ {
if(it->second == ptr) if(it->second == ptr)
{ {
return it->first; return it->first;
} }
} }
return ""; return "";
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +1,56 @@
#ifndef DEFSCRIPTINTERFACEINCLUDE_H #ifndef DEFSCRIPTINTERFACEINCLUDE_H
#define DEFSCRIPTINTERFACEINCLUDE_H #define DEFSCRIPTINTERFACEINCLUDE_H
#define USING_DEFSCRIPT_EXTENSIONS true #define USING_DEFSCRIPT_EXTENSIONS true
void _InitDefScriptInterface(void); void _InitDefScriptInterface(void);
// Usable own internal functions: // Usable own internal functions:
DefReturnResult SCpause(CmdSet&); DefReturnResult SCpause(CmdSet&);
DefReturnResult SCSendChatMessage(CmdSet&); DefReturnResult SCSendChatMessage(CmdSet&);
DefReturnResult SCsavecache(CmdSet&); DefReturnResult SCsavecache(CmdSet&);
DefReturnResult SCemote(CmdSet&); DefReturnResult SCemote(CmdSet&);
DefReturnResult SCfollow(CmdSet&); DefReturnResult SCfollow(CmdSet&);
DefReturnResult SCshdn(CmdSet&); DefReturnResult SCshdn(CmdSet&);
DefReturnResult SCjoinchannel(CmdSet&); DefReturnResult SCjoinchannel(CmdSet&);
DefReturnResult SCleavechannel(CmdSet&); DefReturnResult SCleavechannel(CmdSet&);
DefReturnResult SClistchannel(CmdSet&); DefReturnResult SClistchannel(CmdSet&);
DefReturnResult SCloadconf(CmdSet&); DefReturnResult SCloadconf(CmdSet&);
DefReturnResult SCapplypermissions(CmdSet&); DefReturnResult SCapplypermissions(CmdSet&);
DefReturnResult SCapplyconf(CmdSet&); DefReturnResult SCapplyconf(CmdSet&);
DefReturnResult SClog(CmdSet&); DefReturnResult SClog(CmdSet&);
DefReturnResult SClogdetail(CmdSet&); DefReturnResult SClogdetail(CmdSet&);
DefReturnResult SClogdebug(CmdSet&); DefReturnResult SClogdebug(CmdSet&);
DefReturnResult SClogerror(CmdSet&); DefReturnResult SClogerror(CmdSet&);
DefReturnResult SCcastspell(CmdSet&); DefReturnResult SCcastspell(CmdSet&);
DefReturnResult SCqueryitem(CmdSet&); DefReturnResult SCqueryitem(CmdSet&);
DefReturnResult SCtarget(CmdSet&); DefReturnResult SCtarget(CmdSet&);
DefReturnResult SCloadscp(CmdSet&); DefReturnResult SCloadscp(CmdSet&);
DefReturnResult SCScpExists(CmdSet&); DefReturnResult SCScpExists(CmdSet&);
DefReturnResult SCScpSectionExists(CmdSet&); DefReturnResult SCScpSectionExists(CmdSet&);
DefReturnResult SCScpEntryExists(CmdSet&); DefReturnResult SCScpEntryExists(CmdSet&);
DefReturnResult SCGetScpValue(CmdSet&); DefReturnResult SCGetScpValue(CmdSet&);
DefReturnResult SCGetName(CmdSet&); DefReturnResult SCGetName(CmdSet&);
DefReturnResult SCGetPlayerGuid(CmdSet&); DefReturnResult SCGetPlayerGuid(CmdSet&);
DefReturnResult SCGetEntry(CmdSet&); DefReturnResult SCGetEntry(CmdSet&);
DefReturnResult SCGetItemProtoValue(CmdSet&); DefReturnResult SCGetItemProtoValue(CmdSet&);
DefReturnResult SCGetObjectType(CmdSet&); DefReturnResult SCGetObjectType(CmdSet&);
DefReturnResult SCObjectKnown(CmdSet&); DefReturnResult SCObjectKnown(CmdSet&);
DefReturnResult SCGetPlayerPerm(CmdSet&); DefReturnResult SCGetPlayerPerm(CmdSet&);
DefReturnResult SCGetScriptPerm(CmdSet&); DefReturnResult SCGetScriptPerm(CmdSet&);
DefReturnResult SCGetFileList(CmdSet&); DefReturnResult SCGetFileList(CmdSet&);
DefReturnResult SCPrintScript(CmdSet&); DefReturnResult SCPrintScript(CmdSet&);
DefReturnResult SCGetObjectValue(CmdSet&); DefReturnResult SCGetObjectValue(CmdSet&);
DefReturnResult SCGetRace(CmdSet&); DefReturnResult SCGetRace(CmdSet&);
DefReturnResult SCGetClass(CmdSet&); DefReturnResult SCGetClass(CmdSet&);
DefReturnResult SCSendWorldPacket(CmdSet&); DefReturnResult SCSendWorldPacket(CmdSet&);
DefReturnResult SCGetOpcodeName(CmdSet&); DefReturnResult SCGetOpcodeName(CmdSet&);
DefReturnResult SCGetOpcodeID(CmdSet&); DefReturnResult SCGetOpcodeID(CmdSet&);
DefReturnResult SCBBGetPackedGuid(CmdSet&); DefReturnResult SCBBGetPackedGuid(CmdSet&);
DefReturnResult SCBBPutPackedGuid(CmdSet&); DefReturnResult SCBBPutPackedGuid(CmdSet&);
DefReturnResult SCGui(CmdSet&); DefReturnResult SCGui(CmdSet&);
DefReturnResult SCSendWho(CmdSet&); DefReturnResult SCSendWho(CmdSet&);
DefReturnResult SCGetObjectDistance(CmdSet&); DefReturnResult SCGetObjectDistance(CmdSet&);
DefReturnResult SCSwitchOpcodeHandler(CmdSet&); DefReturnResult SCSwitchOpcodeHandler(CmdSet&);
DefReturnResult SCOpcodeDisabled(CmdSet&); DefReturnResult SCOpcodeDisabled(CmdSet&);
DefReturnResult SCSpoofWorldPacket(CmdSet&); DefReturnResult SCSpoofWorldPacket(CmdSet&);
#endif #endif

View File

@ -1,392 +1,392 @@
/*-----------------------------------------------------------------------------* /*-----------------------------------------------------------------------------*
| headerfile MCamera.h | | headerfile MCamera.h |
| | | |
| version 1.20 | | version 1.20 |
| date: (29.04.2007) | | date: (29.04.2007) |
| | | |
| author: Michal Švantner | | author: Michal Švantner |
| | | |
| for Irrlicht engine | | for Irrlicht engine |
| firsth person and orbiting cameras | | firsth person and orbiting cameras |
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
#ifndef MCAMERA_H #ifndef MCAMERA_H
#define MCAMERA_H #define MCAMERA_H
#include "irrlicht/irrlicht.h" #include "irrlicht/irrlicht.h"
using namespace irr; using namespace irr;
class MCameraFPS class MCameraFPS
{ {
scene::ICameraSceneNode* camera; scene::ICameraSceneNode* camera;
f32 rotationX; f32 rotationX;
f32 rotationY; f32 rotationY;
core::vector3df direction; core::vector3df direction;
public: public:
MCameraFPS(scene::ISceneManager* smgr) MCameraFPS(scene::ISceneManager* smgr)
{ {
camera = smgr->addCameraSceneNode(); camera = smgr->addCameraSceneNode();
rotationX = 0.0f; rotationX = 0.0f;
rotationY = 0.0f; rotationY = 0.0f;
direction = core::vector3df(0,0,1); direction = core::vector3df(0,0,1);
} }
~MCameraFPS(){} ~MCameraFPS(){}
void turnRight(f32 i) void turnRight(f32 i)
{ {
rotationY += i; rotationY += i;
if(rotationY>=360)rotationY-=360; if(rotationY>=360)rotationY-=360;
if(rotationY<0)rotationY+=360; if(rotationY<0)rotationY+=360;
direction = core::vector3df(0,0,1); direction = core::vector3df(0,0,1);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0)); matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0));
matrix.rotateVect(direction); matrix.rotateVect(direction);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void turnLeft(f32 i) void turnLeft(f32 i)
{ {
rotationY -= i; rotationY -= i;
if(rotationY>=360)rotationY-=360; if(rotationY>=360)rotationY-=360;
if(rotationY<0)rotationY+=360; if(rotationY<0)rotationY+=360;
direction = core::vector3df(0,0,1); direction = core::vector3df(0,0,1);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0)); matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0));
matrix.rotateVect(direction); matrix.rotateVect(direction);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void turnUp(f32 i) void turnUp(f32 i)
{ {
rotationX += i; rotationX += i;
if(rotationX>=360)rotationX-=360; if(rotationX>=360)rotationX-=360;
if(rotationX<0)rotationX+=360; if(rotationX<0)rotationX+=360;
direction = core::vector3df(0,0,1); direction = core::vector3df(0,0,1);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0)); matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0));
matrix.rotateVect(direction); matrix.rotateVect(direction);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void turnDown(f32 i) void turnDown(f32 i)
{ {
rotationX -= i; rotationX -= i;
if(rotationX>=360)rotationX-=360; if(rotationX>=360)rotationX-=360;
if(rotationX<0)rotationX+=360; if(rotationX<0)rotationX+=360;
direction = core::vector3df(0,0,1); direction = core::vector3df(0,0,1);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0)); matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0));
matrix.rotateVect(direction); matrix.rotateVect(direction);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void moveForward(f32 i) void moveForward(f32 i)
{ {
core::vector3df step = core::vector3df(0,0,i); core::vector3df step = core::vector3df(0,0,i);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (0,rotationY,0)); matrix.setRotationDegrees(core::vector3df (0,rotationY,0));
matrix.rotateVect(step); matrix.rotateVect(step);
camera->setPosition(camera->getPosition() + step); camera->setPosition(camera->getPosition() + step);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void moveBack(f32 i) void moveBack(f32 i)
{ {
core::vector3df step = core::vector3df(0,0,-i); core::vector3df step = core::vector3df(0,0,-i);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (0,rotationY,0)); matrix.setRotationDegrees(core::vector3df (0,rotationY,0));
matrix.rotateVect(step); matrix.rotateVect(step);
camera->setPosition(camera->getPosition() + step); camera->setPosition(camera->getPosition() + step);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void moveRight(f32 i) void moveRight(f32 i)
{ {
core::vector3df step = core::vector3df(i,0,0); core::vector3df step = core::vector3df(i,0,0);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (0,rotationY,0)); matrix.setRotationDegrees(core::vector3df (0,rotationY,0));
matrix.rotateVect(step); matrix.rotateVect(step);
camera->setPosition(camera->getPosition() + step); camera->setPosition(camera->getPosition() + step);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void moveLeft(f32 i) void moveLeft(f32 i)
{ {
core::vector3df step = core::vector3df(-i,0,0); core::vector3df step = core::vector3df(-i,0,0);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (0,rotationY,0)); matrix.setRotationDegrees(core::vector3df (0,rotationY,0));
matrix.rotateVect(step); matrix.rotateVect(step);
camera->setPosition(camera->getPosition() + step); camera->setPosition(camera->getPosition() + step);
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void setHeight(f32 i) void setHeight(f32 i)
{ {
camera->setPosition(core::vector3df(camera->getPosition().X, i, camera->getPosition().Z)); camera->setPosition(core::vector3df(camera->getPosition().X, i, camera->getPosition().Z));
camera->setTarget(camera->getPosition() + direction); camera->setTarget(camera->getPosition() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
void setPosition(core::vector3df pos) void setPosition(core::vector3df pos)
{ {
camera->setPosition(pos); camera->setPosition(pos);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
core::vector3df getPosition() core::vector3df getPosition()
{ {
return camera->getPosition(); return camera->getPosition();
} }
core::vector3df getDirection() core::vector3df getDirection()
{ {
return direction; return direction;
} }
core::vector3df getTarget() core::vector3df getTarget()
{ {
return camera->getTarget(); return camera->getTarget();
} }
f32 getHeading() f32 getHeading()
{ {
return rotationY; return rotationY;
} }
f32 getPitch() f32 getPitch()
{ {
return rotationX; return rotationX;
} }
f32 getFarValue() f32 getFarValue()
{ {
return camera->getFarValue(); return camera->getFarValue();
} }
void setFarValue(f32 f) void setFarValue(f32 f)
{ {
camera->setFarValue(f); camera->setFarValue(f);
} }
f32 getNearValue() f32 getNearValue()
{ {
return camera->getNearValue(); return camera->getNearValue();
} }
void setNearValue(f32 n) void setNearValue(f32 n)
{ {
camera->setNearValue(n); camera->setNearValue(n);
} }
f32 getFOV() f32 getFOV()
{ {
return camera->getFOV(); return camera->getFOV();
} }
void setFOV(f32 v) void setFOV(f32 v)
{ {
camera->setFOV(v); camera->setFOV(v);
} }
f32 getAspectRatio() f32 getAspectRatio()
{ {
return camera->getAspectRatio(); return camera->getAspectRatio();
} }
void setAspectRatio(f32 a) void setAspectRatio(f32 a)
{ {
camera->setAspectRatio(a); camera->setAspectRatio(a);
} }
scene::ISceneNode* getNode() scene::ISceneNode* getNode()
{ {
return camera; return camera;
} }
}; };
class MCameraOrbit class MCameraOrbit
{ {
scene::ICameraSceneNode* camera; scene::ICameraSceneNode* camera;
f32 rotationX; f32 rotationX;
f32 rotationY; f32 rotationY;
f32 distance; f32 distance;
void update() void update()
{ {
core::vector3df direction = core::vector3df(0,0,distance); core::vector3df direction = core::vector3df(0,0,distance);
core::matrix4 matrix; core::matrix4 matrix;
matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0)); matrix.setRotationDegrees(core::vector3df (rotationX,rotationY,0));
matrix.rotateVect(direction); matrix.rotateVect(direction);
camera->setPosition(camera->getTarget() + direction); camera->setPosition(camera->getTarget() + direction);
camera->updateAbsolutePosition(); camera->updateAbsolutePosition();
} }
public: public:
MCameraOrbit(scene::ISceneManager* smgr) MCameraOrbit(scene::ISceneManager* smgr)
{ {
camera = smgr->addCameraSceneNode(); camera = smgr->addCameraSceneNode();
rotationX = 0.0f; rotationX = 0.0f;
rotationY = 0.0f; rotationY = 0.0f;
distance = 1.0f; distance = 1.0f;
camera->setTarget(core::vector3df(0,0,0)); camera->setTarget(core::vector3df(0,0,0));
update(); update();
} }
~MCameraOrbit(){} ~MCameraOrbit(){}
void turnRight(f32 i) void turnRight(f32 i)
{ {
rotationY += i; rotationY += i;
if(rotationY>=360)rotationY-=360; if(rotationY>=360)rotationY-=360;
if(rotationY<0)rotationY+=360; if(rotationY<0)rotationY+=360;
update(); update();
} }
void turnLeft(f32 i) void turnLeft(f32 i)
{ {
rotationY -= i; rotationY -= i;
if(rotationY>=360)rotationY-=360; if(rotationY>=360)rotationY-=360;
if(rotationY<0)rotationY+=360; if(rotationY<0)rotationY+=360;
update(); update();
} }
void turnUp(f32 i) void turnUp(f32 i)
{ {
rotationX += i; rotationX += i;
if(rotationX>=360)rotationX-=360; if(rotationX>=360)rotationX-=360;
if(rotationX<0)rotationX+=360; if(rotationX<0)rotationX+=360;
update(); update();
} }
void turnDown(f32 i) void turnDown(f32 i)
{ {
rotationX -= i; rotationX -= i;
if(rotationX>=360)rotationX-=360; if(rotationX>=360)rotationX-=360;
if(rotationX<0)rotationX+=360; if(rotationX<0)rotationX+=360;
update(); update();
} }
core::vector3df getTarget() core::vector3df getTarget()
{ {
return camera->getTarget(); return camera->getTarget();
} }
void setTarget(core::vector3df target) void setTarget(core::vector3df target)
{ {
camera->setTarget(target); camera->setTarget(target);
update(); update();
} }
core::vector3df getPosition() core::vector3df getPosition()
{ {
return camera->getPosition(); return camera->getPosition();
} }
f32 getDistance() f32 getDistance()
{ {
return distance; return distance;
} }
void setDistance(f32 i) void setDistance(f32 i)
{ {
distance = i; distance = i;
update(); update();
} }
void adjustDistance(f32 i) void adjustDistance(f32 i)
{ {
distance += i; distance += i;
update(); update();
} }
f32 getHeading() f32 getHeading()
{ {
return rotationY; return rotationY;
} }
f32 getPitch() f32 getPitch()
{ {
return rotationX; return rotationX;
} }
f32 getFarValue() f32 getFarValue()
{ {
return camera->getFarValue(); return camera->getFarValue();
} }
void setFarValue(f32 f) void setFarValue(f32 f)
{ {
camera->setFarValue(f); camera->setFarValue(f);
} }
f32 getNearValue() f32 getNearValue()
{ {
return camera->getNearValue(); return camera->getNearValue();
} }
void setNearValue(f32 n) void setNearValue(f32 n)
{ {
camera->setNearValue(n); camera->setNearValue(n);
} }
f32 getFOV() f32 getFOV()
{ {
return camera->getFOV(); return camera->getFOV();
} }
void setFOV(f32 v) void setFOV(f32 v)
{ {
camera->setFOV(v); camera->setFOV(v);
} }
f32 getAspectRatio() f32 getAspectRatio()
{ {
return camera->getAspectRatio(); return camera->getAspectRatio();
} }
void setAspectRatio(f32 a) void setAspectRatio(f32 a)
{ {
camera->setAspectRatio(a); camera->setAspectRatio(a);
} }
scene::ISceneNode* getNode() scene::ISceneNode* getNode()
{ {
return camera; return camera;
} }
}; };
#endif #endif

View File

@ -1,160 +1,160 @@
/*-----------------------------------------------------------------------------* /*-----------------------------------------------------------------------------*
| headerfile MInput.h | | headerfile MInput.h |
| | | |
| version 1.10 | | version 1.10 |
| date: (29.04.2007) | | date: (29.04.2007) |
| | | |
| author: Michal Švantner | | author: Michal Švantner |
| | | |
| for Irrlicht engine | | for Irrlicht engine |
| store keyboard and mouse input in structures "key" and "mouse" | | store keyboard and mouse input in structures "key" and "mouse" |
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
#ifndef MINPUT_H #ifndef MINPUT_H
#define MINPUT_H #define MINPUT_H
#include "irrlicht/irrlicht.h" #include "irrlicht/irrlicht.h"
using namespace irr; using namespace irr;
struct IKeys struct IKeys
{ {
bool pressed(EKEY_CODE keycode) bool pressed(EKEY_CODE keycode)
{ {
return code[keycode]; return code[keycode];
} }
bool pressed_once(EKEY_CODE keycode) bool pressed_once(EKEY_CODE keycode)
{ {
if(code[keycode]) if(code[keycode])
{ {
code[keycode] = false; code[keycode] = false;
return true; return true;
} }
return false; return false;
} }
void reset() void reset()
{ {
for(s32 i=0; i<KEY_KEY_CODES_COUNT; i++) code[i] = false; for(s32 i=0; i<KEY_KEY_CODES_COUNT; i++) code[i] = false;
} }
bool code[KEY_KEY_CODES_COUNT]; bool code[KEY_KEY_CODES_COUNT];
}; };
struct IMouse struct IMouse
{ {
bool left_pressed() bool left_pressed()
{ {
return left; return left;
} }
bool middle_pressed() bool middle_pressed()
{ {
return middle; return middle;
} }
bool right_pressed() bool right_pressed()
{ {
return right; return right;
} }
bool left_pressed_once() bool left_pressed_once()
{ {
if(left) if(left)
{ {
left = false; left = false;
return true; return true;
} }
return false; return false;
} }
bool middle_pressed_once() bool middle_pressed_once()
{ {
if(middle) if(middle)
{ {
middle = false; middle = false;
return true; return true;
} }
return false; return false;
} }
bool right_pressed_once() bool right_pressed_once()
{ {
if(right) if(right)
{ {
right = false; right = false;
return true; return true;
} }
return false; return false;
} }
void reset() void reset()
{ {
X = 0; X = 0;
Y = 0; Y = 0;
wheel = 0.0f; wheel = 0.0f;
left = false; left = false;
middle = false; middle = false;
right = false; right = false;
} }
s32 X; s32 X;
s32 Y; s32 Y;
f32 wheel; f32 wheel;
bool left; bool left;
bool middle; bool middle;
bool right; bool right;
}; };
class MyEventReceiver : public IEventReceiver class MyEventReceiver : public IEventReceiver
{ {
public: public:
MyEventReceiver() MyEventReceiver()
{ {
for(s32 i=0; i<KEY_KEY_CODES_COUNT; i++) for(s32 i=0; i<KEY_KEY_CODES_COUNT; i++)
key.code[i] = false; key.code[i] = false;
mouse.X = 0; mouse.X = 0;
mouse.Y = 0; mouse.Y = 0;
mouse.wheel = 0.0f; mouse.wheel = 0.0f;
mouse.left = false; mouse.left = false;
mouse.middle = false; mouse.middle = false;
mouse.right = false; mouse.right = false;
} }
virtual bool OnEvent(SEvent event) virtual bool OnEvent(SEvent event)
{ {
bool value = false; bool value = false;
if (event.EventType == irr::EET_KEY_INPUT_EVENT) if (event.EventType == irr::EET_KEY_INPUT_EVENT)
{ {
key.code[event.KeyInput.Key] = event.KeyInput.PressedDown; key.code[event.KeyInput.Key] = event.KeyInput.PressedDown;
value = true; value = true;
} }
if (event.EventType == irr::EET_MOUSE_INPUT_EVENT) if (event.EventType == irr::EET_MOUSE_INPUT_EVENT)
{ {
switch(event.MouseInput.Event) switch(event.MouseInput.Event)
{ {
case EMIE_LMOUSE_PRESSED_DOWN: mouse.left = true; break; case EMIE_LMOUSE_PRESSED_DOWN: mouse.left = true; break;
case EMIE_RMOUSE_PRESSED_DOWN: mouse.right = true; break; case EMIE_RMOUSE_PRESSED_DOWN: mouse.right = true; break;
case EMIE_MMOUSE_PRESSED_DOWN: mouse.middle = true; break; case EMIE_MMOUSE_PRESSED_DOWN: mouse.middle = true; break;
case EMIE_LMOUSE_LEFT_UP: mouse.left = false; break; case EMIE_LMOUSE_LEFT_UP: mouse.left = false; break;
case EMIE_RMOUSE_LEFT_UP: mouse.right = false; break; case EMIE_RMOUSE_LEFT_UP: mouse.right = false; break;
case EMIE_MMOUSE_LEFT_UP: mouse.middle = false; break; case EMIE_MMOUSE_LEFT_UP: mouse.middle = false; break;
case EMIE_MOUSE_MOVED: mouse.X = event.MouseInput.X; mouse.Y = event.MouseInput.Y; break; case EMIE_MOUSE_MOVED: mouse.X = event.MouseInput.X; mouse.Y = event.MouseInput.Y; break;
case EMIE_MOUSE_WHEEL: mouse.wheel = mouse.wheel + event.MouseInput.Wheel; break; case EMIE_MOUSE_WHEEL: mouse.wheel = mouse.wheel + event.MouseInput.Wheel; break;
} }
value = true; value = true;
} }
return value; return value;
} }
IMouse mouse; IMouse mouse;
IKeys key; IKeys key;
}; };
#endif #endif

View File

@ -1,324 +1,324 @@
#include "common.h" #include "common.h"
#include "irrlicht/irrlicht.h" #include "irrlicht/irrlicht.h"
#include "Object.h" #include "Object.h"
#include "DrawObject.h" #include "DrawObject.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "Scene.h" #include "Scene.h"
#include "PseuGUI.h" #include "PseuGUI.h"
PseuGUIRunnable::PseuGUIRunnable() PseuGUIRunnable::PseuGUIRunnable()
{ {
_gui = new PseuGUI(); _gui = new PseuGUI();
} }
void PseuGUIRunnable::run(void) void PseuGUIRunnable::run(void)
{ {
_gui->Run(); _gui->Run();
} }
PseuGUI *PseuGUIRunnable::GetGUI(void) PseuGUI *PseuGUIRunnable::GetGUI(void)
{ {
return _gui; return _gui;
} }
PseuGUIRunnable::~PseuGUIRunnable() PseuGUIRunnable::~PseuGUIRunnable()
{ {
delete _gui; delete _gui;
} }
PseuGUI::PseuGUI() PseuGUI::PseuGUI()
{ {
_xres = 640; _xres = 640;
_yres = 480; _yres = 480;
_colordepth = 32; _colordepth = 32;
_shadows = false; _shadows = false;
_windowed = true; _windowed = true;
_vsync = false; _vsync = false;
_initialized = false; _initialized = false;
_mustdie = false; _mustdie = false;
_driverType = video::EDT_BURNINGSVIDEO; // nulldevice makes not really a sense to display stuff _driverType = video::EDT_BURNINGSVIDEO; // nulldevice makes not really a sense to display stuff
_scenestate = _scenestate_new = SCENESTATE_NULL; _scenestate = _scenestate_new = SCENESTATE_NULL;
_smgr = NULL; _smgr = NULL;
_device = NULL; _device = NULL;
_guienv = NULL; _guienv = NULL;
_scene = NULL; _scene = NULL;
_passtime = _lastpasstime = _passtimediff = 0; _passtime = _lastpasstime = _passtimediff = 0;
_updateWorldPos = false; _updateWorldPos = false;
} }
PseuGUI::~PseuGUI() PseuGUI::~PseuGUI()
{ {
this->Cancel(); this->Cancel();
_instance->DeleteGUI(); // this makes the instance set its gui ptr to NULL _instance->DeleteGUI(); // this makes the instance set its gui ptr to NULL
logdebug("PseuGUI::~PseuGUI()"); logdebug("PseuGUI::~PseuGUI()");
} }
void PseuGUI::SetDriver(uint8 driverId) void PseuGUI::SetDriver(uint8 driverId)
{ {
switch(driverId) switch(driverId)
{ {
case DIRECTX9: _driverType = video::EDT_DIRECT3D9; break; case DIRECTX9: _driverType = video::EDT_DIRECT3D9; break;
case DIRECTX8: _driverType = video::EDT_DIRECT3D8; break; case DIRECTX8: _driverType = video::EDT_DIRECT3D8; break;
case OPENGL: _driverType = video::EDT_OPENGL; break; case OPENGL: _driverType = video::EDT_OPENGL; break;
case SOFTWARE: _driverType = video::EDT_SOFTWARE; break; case SOFTWARE: _driverType = video::EDT_SOFTWARE; break;
case BURNINGSVIDEO: _driverType = video::EDT_BURNINGSVIDEO; break; case BURNINGSVIDEO: _driverType = video::EDT_BURNINGSVIDEO; break;
case NULLDEVICE: _driverType = video::EDT_NULL; break; case NULLDEVICE: _driverType = video::EDT_NULL; break;
default: _driverType = video::EDT_BURNINGSVIDEO; // if no valid driver detected, use software default: _driverType = video::EDT_BURNINGSVIDEO; // if no valid driver detected, use software
} }
// TODO: add support for changing driver during runtime? // TODO: add support for changing driver during runtime?
} }
void PseuGUI::SetResolution(uint16 x, uint16 y, uint16 depth) void PseuGUI::SetResolution(uint16 x, uint16 y, uint16 depth)
{ {
_xres = x; _xres = x;
_yres = y; _yres = y;
_colordepth = depth; _colordepth = depth;
} }
void PseuGUI::SetWindowed(bool b) void PseuGUI::SetWindowed(bool b)
{ {
_windowed = b; _windowed = b;
// see PseuGUI::Init(): !_windowed == fullscreen // see PseuGUI::Init(): !_windowed == fullscreen
} }
void PseuGUI::SetVSync(bool b) void PseuGUI::SetVSync(bool b)
{ {
_vsync = b; _vsync = b;
} }
void PseuGUI::UseShadows(bool b) void PseuGUI::UseShadows(bool b)
{ {
_shadows = b; _shadows = b;
} }
// if this fuction is called from another thread the device will not work correctly. o_O // if this fuction is called from another thread the device will not work correctly. o_O
void PseuGUI::_Init(void) void PseuGUI::_Init(void)
{ {
_device = createDevice(_driverType,dimension2d<s32>(_xres,_yres),_colordepth,!_windowed,_shadows,_vsync); _device = createDevice(_driverType,dimension2d<s32>(_xres,_yres),_colordepth,!_windowed,_shadows,_vsync);
if(!_device) if(!_device)
{ {
logerror("PseuGUI: Can't use specified video driver, trying software mode..."); logerror("PseuGUI: Can't use specified video driver, trying software mode...");
_device = createDevice(video::EDT_SOFTWARE,dimension2d<s32>(_xres,_yres),_colordepth,!_windowed,false,false); _device = createDevice(video::EDT_SOFTWARE,dimension2d<s32>(_xres,_yres),_colordepth,!_windowed,false,false);
if(!_device) if(!_device)
{ {
logerror("ERROR: PseuGUI::_Init() failed, no video driver available!"); logerror("ERROR: PseuGUI::_Init() failed, no video driver available!");
return; return;
} }
else else
{ {
logerror("PseuGUI: Software mode OK!"); logerror("PseuGUI: Software mode OK!");
} }
} }
DEBUG(logdebug("PseuGUI::Init() _device=%X",_device)); DEBUG(logdebug("PseuGUI::Init() _device=%X",_device));
_device->setWindowCaption(L"PseuWoW - Initializing"); _device->setWindowCaption(L"PseuWoW - Initializing");
_device->setResizeAble(true); _device->setResizeAble(true);
_driver = _device->getVideoDriver(); _driver = _device->getVideoDriver();
_smgr = _device->getSceneManager(); _smgr = _device->getSceneManager();
_guienv = _device->getGUIEnvironment(); _guienv = _device->getGUIEnvironment();
_timer = _device->getTimer(); _timer = _device->getTimer();
//... //...
_initialized = true; _initialized = true;
} }
void PseuGUI::Cancel(void) void PseuGUI::Cancel(void)
{ {
DEBUG(logdebug("PseuGUI::Cancel()")); DEBUG(logdebug("PseuGUI::Cancel()"));
if(_scene) if(_scene)
{ {
_scene->OnDelete(); _scene->OnDelete();
delete _scene; delete _scene;
_scene = NULL; _scene = NULL;
} }
if(_device) if(_device)
{ {
_device->drop(); _device->drop();
_device = NULL; _device = NULL;
} }
_mustdie = true; _mustdie = true;
} }
void PseuGUI::Shutdown(void) void PseuGUI::Shutdown(void)
{ {
DEBUG(logdebug("PseuGUI::Shutdown()")); DEBUG(logdebug("PseuGUI::Shutdown()"));
_mustdie = true; _mustdie = true;
} }
void PseuGUI::Run(void) void PseuGUI::Run(void)
{ {
if(!_initialized) if(!_initialized)
this->_Init(); this->_Init();
if(!_initialized) // recheck if(!_initialized) // recheck
{ {
logerror("PseuGUI: not initialized, using non-GUI mode"); logerror("PseuGUI: not initialized, using non-GUI mode");
Cancel(); Cancel();
return; return;
} }
DEBUG(logdebug("PseuGUI::Run() _device=%X",_device)); DEBUG(logdebug("PseuGUI::Run() _device=%X",_device));
int lastFPS = -1, fps = -1; int lastFPS = -1, fps = -1;
while(_device && _device->run() && !_mustdie) while(_device && _device->run() && !_mustdie)
{ {
_lastpasstime = _passtime; _lastpasstime = _passtime;
_passtime = _timer->getTime(); _passtime = _timer->getTime();
_passtimediff = _passtime - _lastpasstime; _passtimediff = _passtime - _lastpasstime;
// _HandleWindowResize(); // not yet used; doesnt work // _HandleWindowResize(); // not yet used; doesnt work
if (!_device->isWindowActive()) if (!_device->isWindowActive())
{ {
_device->sleep(10); // save cpu & gpu power if not focused _device->sleep(10); // save cpu & gpu power if not focused
} }
try try
{ {
_UpdateSceneState(); _UpdateSceneState();
if(_scene && _initialized) if(_scene && _initialized)
{ {
if(_updateWorldPos) if(_updateWorldPos)
SetWorldPosition(_worldpos_tmp); SetWorldPosition(_worldpos_tmp);
_scene->OnUpdate(_passtimediff); _scene->OnUpdate(_passtimediff);
} }
_driver->beginScene(true, true, 0); _driver->beginScene(true, true, 0);
DrawCurrentScene(); DrawCurrentScene();
_smgr->drawAll(); _smgr->drawAll();
_guienv->drawAll(); _guienv->drawAll();
_driver->endScene(); _driver->endScene();
} }
catch(...) catch(...)
{ {
logerror("Unhandled exception in PseuGUI::Run() device=%X smgr=%X objects:%u", _device, _smgr, domgr.StorageSize()); logerror("Unhandled exception in PseuGUI::Run() device=%X smgr=%X objects:%u", _device, _smgr, domgr.StorageSize());
} }
fps = _driver->getFPS(); fps = _driver->getFPS();
if (lastFPS != fps) if (lastFPS != fps)
{ {
core::stringw str = L"PseuWoW ["; core::stringw str = L"PseuWoW [";
str += _driver->getName(); str += _driver->getName();
str += "] FPS:"; str += "] FPS:";
str += fps; str += fps;
_device->setWindowCaption(str.c_str()); _device->setWindowCaption(str.c_str());
lastFPS = fps; lastFPS = fps;
} }
} }
DEBUG(logdebug("PseuGUI::Run() finished")); DEBUG(logdebug("PseuGUI::Run() finished"));
Cancel(); // already got shut down somehow, we can now safely cancel and drop the device Cancel(); // already got shut down somehow, we can now safely cancel and drop the device
} }
// called from ObjMgr::Remove(guid) // called from ObjMgr::Remove(guid)
void PseuGUI::NotifyObjectDeletion(uint64 guid) void PseuGUI::NotifyObjectDeletion(uint64 guid)
{ {
domgr.Delete(guid); domgr.Delete(guid);
} }
// called from ObjMgr::Add(Object*) // called from ObjMgr::Add(Object*)
void PseuGUI::NotifyObjectCreation(Object *o) void PseuGUI::NotifyObjectCreation(Object *o)
{ {
DrawObject *d = new DrawObject(_smgr,o); DrawObject *d = new DrawObject(_smgr,o);
domgr.Add(o->GetGUID(),d); domgr.Add(o->GetGUID(),d);
} }
void PseuGUI::SetInstance(PseuInstance* in) void PseuGUI::SetInstance(PseuInstance* in)
{ {
_instance = in; _instance = in;
} }
void PseuGUI::SetSceneState(SceneState state) void PseuGUI::SetSceneState(SceneState state)
{ {
_scenestate_new = state; // will be applied at next cycle _scenestate_new = state; // will be applied at next cycle
} }
void PseuGUI::_UpdateSceneState(void) void PseuGUI::_UpdateSceneState(void)
{ {
if(_scenestate != _scenestate_new && _smgr) if(_scenestate != _scenestate_new && _smgr)
{ {
if(_scene) if(_scene)
{ {
_scene->OnDelete(); _scene->OnDelete();
delete _scene; delete _scene;
} }
_smgr->clear(); _smgr->clear();
_guienv->clear(); _guienv->clear();
_scenestate = _scenestate_new; _scenestate = _scenestate_new;
logdebug("PseuGUI: switched to SceneState %u", _scenestate); logdebug("PseuGUI: switched to SceneState %u", _scenestate);
switch (_scenestate) switch (_scenestate)
{ {
case SCENESTATE_GUISTART: _scene = new SceneGuiStart(this); break; case SCENESTATE_GUISTART: _scene = new SceneGuiStart(this); break;
case SCENESTATE_WORLD: _scene = new SceneWorld(this); break; case SCENESTATE_WORLD: _scene = new SceneWorld(this); break;
default: _scene = new Scene(this); // will draw nothing, just yield the gui default: _scene = new Scene(this); // will draw nothing, just yield the gui
} }
_scene->SetState(_scenestate); _scene->SetState(_scenestate);
logdebug("PseuGUI: scene created."); logdebug("PseuGUI: scene created.");
} }
} }
void PseuGUI::DrawCurrentScene(void) void PseuGUI::DrawCurrentScene(void)
{ {
if(_scene && _initialized) if(_scene && _initialized)
_scene->OnDraw(); _scene->OnDraw();
} }
// used to get our current WorldPosition // used to get our current WorldPosition
WorldPosition PseuGUI::GetWorldPosition(void) WorldPosition PseuGUI::GetWorldPosition(void)
{ {
if(_scene && _scene->GetState() == SCENESTATE_WORLD) if(_scene && _scene->GetState() == SCENESTATE_WORLD)
{ {
return ((SceneWorld*)_scene)->GetWorldPosition(); return ((SceneWorld*)_scene)->GetWorldPosition();
} }
return WorldPosition(); return WorldPosition();
} }
// used to notify the SceneWorld about a position change the server sent to us // used to notify the SceneWorld about a position change the server sent to us
void PseuGUI::SetWorldPosition(WorldPosition wp) void PseuGUI::SetWorldPosition(WorldPosition wp)
{ {
// buffer new position if the scene is not (yet) a world scene // buffer new position if the scene is not (yet) a world scene
_worldpos_tmp = wp; _worldpos_tmp = wp;
if(_scene && _scene->GetState() == SCENESTATE_WORLD) if(_scene && _scene->GetState() == SCENESTATE_WORLD)
{ {
_updateWorldPos = false; _updateWorldPos = false;
((SceneWorld*)_scene)->SetWorldPosition(wp); ((SceneWorld*)_scene)->SetWorldPosition(wp);
} }
else else
{ {
_updateWorldPos = true; _updateWorldPos = true;
} }
} }
void PseuGUI::_HandleWindowResize(void) void PseuGUI::_HandleWindowResize(void)
{ {
dimension2d<s32> scrn = _driver->getScreenSize(); dimension2d<s32> scrn = _driver->getScreenSize();
if(_screendimension.Width != scrn.Width) if(_screendimension.Width != scrn.Width)
{ {
scrn.Height = s32(scrn.Width * 0.8f); // for now use aspect ratio 5:4 scrn.Height = s32(scrn.Width * 0.8f); // for now use aspect ratio 5:4
_screendimension = scrn; _screendimension = scrn;
_driver->OnResize(scrn); _driver->OnResize(scrn);
DEBUG(logdebug("DEBUG: Width resize handled, Height adjusted")); DEBUG(logdebug("DEBUG: Width resize handled, Height adjusted"));
} }
else if(_screendimension.Height != scrn.Height) else if(_screendimension.Height != scrn.Height)
{ {
scrn.Width = s32(scrn.Height * 1.25); // 5:4 here too scrn.Width = s32(scrn.Height * 1.25); // 5:4 here too
_screendimension = scrn; _screendimension = scrn;
_driver->OnResize(scrn); _driver->OnResize(scrn);
DEBUG(logdebug("DEBUG: Height resize handled, Width adjusted")); DEBUG(logdebug("DEBUG: Height resize handled, Width adjusted"));
} }
// TODO: how to set irrlicht window size ?! // TODO: how to set irrlicht window size ?!
} }

View File

@ -1,110 +1,110 @@
#ifndef PSEUGUI_H #ifndef PSEUGUI_H
#define PSEUGUI_H #define PSEUGUI_H
#include "irrlicht/irrlicht.h" #include "irrlicht/irrlicht.h"
#include "DrawObjMgr.h" #include "DrawObjMgr.h"
#include "World.h" #include "World.h"
class PseuGUI; class PseuGUI;
class Object; class Object;
class PseuInstance; class PseuInstance;
class Scene; class Scene;
enum SceneState enum SceneState
{ {
SCENESTATE_NULL, SCENESTATE_NULL,
SCENESTATE_GUISTART, SCENESTATE_GUISTART,
SCENESTATE_LOGINSCREEN, SCENESTATE_LOGINSCREEN,
SCENESTATE_CHARACTERSELECTION, SCENESTATE_CHARACTERSELECTION,
SCENESTATE_LOADING, SCENESTATE_LOADING,
SCENESTATE_WORLD SCENESTATE_WORLD
}; };
enum DriverIDs enum DriverIDs
{ {
NULLDEVICE = 0, NULLDEVICE = 0,
SOFTWARE = 1, SOFTWARE = 1,
BURNINGSVIDEO = 2, BURNINGSVIDEO = 2,
OPENGL = 3, OPENGL = 3,
DIRECTX8 = 4, DIRECTX8 = 4,
DIRECTX9 = 5, DIRECTX9 = 5,
}; };
class PseuGUIRunnable : public ZThread::Runnable class PseuGUIRunnable : public ZThread::Runnable
{ {
public: public:
PseuGUIRunnable(); PseuGUIRunnable();
~PseuGUIRunnable(); ~PseuGUIRunnable();
void run(void); void run(void);
PseuGUI *GetGUI(void); PseuGUI *GetGUI(void);
private: private:
PseuGUI* _gui; PseuGUI* _gui;
}; };
class PseuGUI class PseuGUI
{ {
// too bad friends are not inherited... // too bad friends are not inherited...
friend class Scene; friend class Scene;
friend class SceneWorld; friend class SceneWorld;
friend class SceneGuiStart; friend class SceneGuiStart;
// ... // ...
public: public:
PseuGUI(); PseuGUI();
~PseuGUI(); ~PseuGUI();
void SetInstance(PseuInstance*); void SetInstance(PseuInstance*);
inline PseuInstance *GetInstance(void) { return _instance; } inline PseuInstance *GetInstance(void) { return _instance; }
void Run(void); void Run(void);
void SetDriver(uint8); void SetDriver(uint8);
void SetResolution(uint16 x, uint16 y, uint16 depth=32); void SetResolution(uint16 x, uint16 y, uint16 depth=32);
void SetWindowed(bool); void SetWindowed(bool);
void SetVSync(bool); void SetVSync(bool);
void UseShadows(bool); void UseShadows(bool);
void Cancel(void); void Cancel(void);
void Shutdown(void); void Shutdown(void);
inline bool IsInitialized(void) { return _initialized; } inline bool IsInitialized(void) { return _initialized; }
inline bool MustDie(void) { return _mustdie; } inline bool MustDie(void) { return _mustdie; }
// interfaces to tell the gui what to draw // interfaces to tell the gui what to draw
void NotifyObjectDeletion(uint64 guid); void NotifyObjectDeletion(uint64 guid);
void NotifyObjectCreation(Object *o); void NotifyObjectCreation(Object *o);
// scenes // scenes
void DrawCurrentScene(void); void DrawCurrentScene(void);
void SetSceneState(SceneState); void SetSceneState(SceneState);
// helpers // helpers
WorldPosition GetWorldPosition(void); WorldPosition GetWorldPosition(void);
void SetWorldPosition(WorldPosition); void SetWorldPosition(WorldPosition);
private: private:
void _Init(void); void _Init(void);
void _UpdateSceneState(void); void _UpdateSceneState(void);
void _HandleWindowResize(void); void _HandleWindowResize(void);
uint16 _xres,_yres,_colordepth; uint16 _xres,_yres,_colordepth;
bool _windowed,_vsync,_shadows; bool _windowed,_vsync,_shadows;
bool _initialized,_mustdie; bool _initialized,_mustdie;
irr::IrrlichtDevice *_device; irr::IrrlichtDevice *_device;
irr::video::IVideoDriver* _driver; irr::video::IVideoDriver* _driver;
irr::scene::ISceneManager* _smgr; irr::scene::ISceneManager* _smgr;
irr::gui::IGUIEnvironment* _guienv; irr::gui::IGUIEnvironment* _guienv;
irr::video::E_DRIVER_TYPE _driverType; irr::video::E_DRIVER_TYPE _driverType;
DrawObjMgr domgr; DrawObjMgr domgr;
PseuInstance *_instance; PseuInstance *_instance;
SceneState _scenestate, _scenestate_new; SceneState _scenestate, _scenestate_new;
Scene *_scene; Scene *_scene;
irr::ITimer *_timer; irr::ITimer *_timer;
uint32 _passtime, _lastpasstime, _passtimediff; uint32 _passtime, _lastpasstime, _passtimediff;
irr::core::dimension2d<irr::s32> _screendimension; irr::core::dimension2d<irr::s32> _screendimension;
WorldPosition _worldpos_tmp; WorldPosition _worldpos_tmp;
bool _updateWorldPos; bool _updateWorldPos;
}; };
#endif #endif

View File

@ -1,31 +1,31 @@
#include "common.h" #include "common.h"
#include "PseuGUI.h" #include "PseuGUI.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "Scene.h" #include "Scene.h"
Scene::Scene(PseuGUI *g) Scene::Scene(PseuGUI *g)
{ {
gui = g; gui = g;
device = gui->_device; device = gui->_device;
driver = gui->_driver; driver = gui->_driver;
smgr = gui->_smgr; smgr = gui->_smgr;
guienv = gui->_guienv; guienv = gui->_guienv;
} }
void Scene::OnDraw(void) void Scene::OnDraw(void)
{ {
device->yield(); device->yield();
} }
void Scene::OnDelete(void) void Scene::OnDelete(void)
{ {
} }
void Scene::OnUpdate(s32) void Scene::OnUpdate(s32)
{ {
} }
Scene::~Scene() Scene::~Scene()
{ {
DEBUG(logdebug("Scene::~Scene()")); DEBUG(logdebug("Scene::~Scene()"));
} }

View File

@ -1,33 +1,33 @@
#include "common.h" #include "common.h"
#include "PseuGUI.h" #include "PseuGUI.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "Scene.h" #include "Scene.h"
SceneGuiStart::SceneGuiStart(PseuGUI *gui) : Scene(gui) SceneGuiStart::SceneGuiStart(PseuGUI *gui) : Scene(gui)
{ {
irrlogo = guienv->addImage(driver->getTexture("data/misc/irrlichtlogo.png"), core::position2d<s32>(5,5)); irrlogo = guienv->addImage(driver->getTexture("data/misc/irrlichtlogo.png"), core::position2d<s32>(5,5));
char *fn; char *fn;
switch(gui->_driverType) switch(gui->_driverType)
{ {
case DIRECTX8: case DIRECTX8:
case DIRECTX9: case DIRECTX9:
fn = "data/misc/directxlogo.png"; fn = "data/misc/directxlogo.png";
break; break;
case OPENGL: case OPENGL:
fn = "data/misc/opengllogo.png"; fn = "data/misc/opengllogo.png";
break; break;
default: default:
fn = "data/misc/burninglogo.png"; fn = "data/misc/burninglogo.png";
} }
driverlogo = guienv->addImage(driver->getTexture(fn), core::position2d<s32>(50,50)); driverlogo = guienv->addImage(driver->getTexture(fn), core::position2d<s32>(50,50));
} }
void SceneGuiStart::OnDelete(void) void SceneGuiStart::OnDelete(void)
{ {
// not necessary to delete the images, because they are deleted by guienv->clear() // not necessary to delete the images, because they are deleted by guienv->clear()
} }

View File

@ -1,376 +1,376 @@
#include <sstream> #include <sstream>
#include <math.h> #include <math.h>
#include "common.h" #include "common.h"
#include "PseuGUI.h" #include "PseuGUI.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "Scene.h" #include "Scene.h"
#include "MapTile.h" #include "MapTile.h"
#include "MapMgr.h" #include "MapMgr.h"
#include "ShTlTerrainSceneNode.h" #include "ShTlTerrainSceneNode.h"
#include "MCamera.h" #include "MCamera.h"
#include "MInput.h" #include "MInput.h"
#include "WorldSession.h" #include "WorldSession.h"
#include "World.h" #include "World.h"
#define MOUSE_SENSIVITY 0.5f #define MOUSE_SENSIVITY 0.5f
#define ANGLE_STEP (M_PI/180) #define ANGLE_STEP (M_PI/180)
#define DEG_TO_RAD(x) ((x)*ANGLE_STEP) #define DEG_TO_RAD(x) ((x)*ANGLE_STEP)
#define RAD_TO_DEG(x) ((x)/ANGLE_STEP) #define RAD_TO_DEG(x) ((x)/ANGLE_STEP)
#define RAD_FIX(x) ( (x)>(2*M_PI) ? ((x)-(2*M_PI)) : (x) ) #define RAD_FIX(x) ( (x)>(2*M_PI) ? ((x)-(2*M_PI)) : (x) )
#define DEG_FIX(x) ( (x)>360 ? ((x)-360) : (x) ) #define DEG_FIX(x) ( (x)>360 ? ((x)-360) : (x) )
#define COORD_SCALE_VALUE_X 0.336f #define COORD_SCALE_VALUE_X 0.336f
#define COORD_SCALE_VALUE_Y 0.2f #define COORD_SCALE_VALUE_Y 0.2f
SceneWorld::SceneWorld(PseuGUI *g) : Scene(g) SceneWorld::SceneWorld(PseuGUI *g) : Scene(g)
{ {
DEBUG(logdebug("SceneWorld: Initializing...")); DEBUG(logdebug("SceneWorld: Initializing..."));
debugmode = false; debugmode = false;
// store some pointers right now to prevent repeated ptr dereferencing later (speeds up code) // store some pointers right now to prevent repeated ptr dereferencing later (speeds up code)
gui = g; gui = g;
wsession = gui->GetInstance()->GetWSession(); wsession = gui->GetInstance()->GetWSession();
mapmgr = wsession->GetWorld()->GetMapMgr(); mapmgr = wsession->GetWorld()->GetMapMgr();
// TODO: hardcoded for now, make this adjustable later // TODO: hardcoded for now, make this adjustable later
float fogdist = 150; float fogdist = 150;
ILightSceneNode* light = smgr->addLightSceneNode(0, core::vector3df(0,0,0), SColorf(255, 255, 255, 255), 1000.0f); ILightSceneNode* light = smgr->addLightSceneNode(0, core::vector3df(0,0,0), SColorf(255, 255, 255, 255), 1000.0f);
SLight ldata = light->getLightData(); SLight ldata = light->getLightData();
ldata.AmbientColor = video::SColorf(0.2f,0.2f,0.2f); ldata.AmbientColor = video::SColorf(0.2f,0.2f,0.2f);
ldata.DiffuseColor = video::SColorf(1.0f,1.0f,1.0f); ldata.DiffuseColor = video::SColorf(1.0f,1.0f,1.0f);
ldata.Type = video::ELT_DIRECTIONAL; ldata.Type = video::ELT_DIRECTIONAL;
ldata.Position = core::vector3df(-10,5,-5); ldata.Position = core::vector3df(-10,5,-5);
light->setLightData(ldata); light->setLightData(ldata);
eventrecv = new MyEventReceiver(); eventrecv = new MyEventReceiver();
device->setEventReceiver(eventrecv); device->setEventReceiver(eventrecv);
camera = new MCameraFPS(smgr); camera = new MCameraFPS(smgr);
camera->setNearValue(0.1f); camera->setNearValue(0.1f);
camera->setFarValue(12000); // TODO: adjust camera->setFarValue(12000); // TODO: adjust
debugText = guienv->addStaticText(L"< debug text >",rect<s32>(0,0,driver->getScreenSize().Width,30),true,true,0,-1,true); debugText = guienv->addStaticText(L"< debug text >",rect<s32>(0,0,driver->getScreenSize().Width,30),true,true,0,-1,true);
smgr->addSkyDomeSceneNode(driver->getTexture("data/misc/sky.jpg"),64,64,1.0f,2.0f); smgr->addSkyDomeSceneNode(driver->getTexture("data/misc/sky.jpg"),64,64,1.0f,2.0f);
driver->setFog(video::SColor(0,100,101,190), true, fogdist, fogdist + 30, 0.02f); driver->setFog(video::SColor(0,100,101,190), true, fogdist, fogdist + 30, 0.02f);
// setup cursor // setup cursor
device->getCursorControl()->setVisible(false); device->getCursorControl()->setVisible(false);
InitTerrain(); InitTerrain();
UpdateTerrain(); UpdateTerrain();
DEBUG(logdebug("SceneWorld: Init done!")); DEBUG(logdebug("SceneWorld: Init done!"));
} }
void SceneWorld::OnUpdate(s32 timediff) void SceneWorld::OnUpdate(s32 timediff)
{ {
static position2d<s32> mouse_pos; static position2d<s32> mouse_pos;
UpdateTerrain(); UpdateTerrain();
bool mouse_pressed_left = eventrecv->mouse.left_pressed(); bool mouse_pressed_left = eventrecv->mouse.left_pressed();
bool mouse_pressed_right = eventrecv->mouse.right_pressed(); bool mouse_pressed_right = eventrecv->mouse.right_pressed();
float timediff_f = timediff / 1000.0f; float timediff_f = timediff / 1000.0f;
if(eventrecv->key.pressed(KEY_KEY_W) || (mouse_pressed_left && mouse_pressed_right)) if(eventrecv->key.pressed(KEY_KEY_W) || (mouse_pressed_left && mouse_pressed_right))
camera->moveForward(50 * timediff_f); camera->moveForward(50 * timediff_f);
if(eventrecv->key.pressed(KEY_KEY_S)) if(eventrecv->key.pressed(KEY_KEY_S))
camera->moveBack(50 * timediff_f); camera->moveBack(50 * timediff_f);
if(eventrecv->key.pressed(KEY_KEY_E)) if(eventrecv->key.pressed(KEY_KEY_E))
camera->moveRight(50 * timediff_f); camera->moveRight(50 * timediff_f);
if(eventrecv->key.pressed(KEY_KEY_Q)) if(eventrecv->key.pressed(KEY_KEY_Q))
camera->moveLeft(50 * timediff_f); camera->moveLeft(50 * timediff_f);
// if right mouse button pressed, move in axis, if not, turn camera // if right mouse button pressed, move in axis, if not, turn camera
if(eventrecv->key.pressed(KEY_KEY_D)) if(eventrecv->key.pressed(KEY_KEY_D))
{ {
if(mouse_pressed_right) if(mouse_pressed_right)
camera->moveRight(50 * timediff_f); camera->moveRight(50 * timediff_f);
else else
camera->turnRight(timediff_f * M_PI * 25); camera->turnRight(timediff_f * M_PI * 25);
} }
if(eventrecv->key.pressed(KEY_KEY_A)) if(eventrecv->key.pressed(KEY_KEY_A))
{ {
if(mouse_pressed_right) if(mouse_pressed_right)
camera->moveLeft(50 * timediff_f); camera->moveLeft(50 * timediff_f);
else else
camera->turnLeft(timediff_f * M_PI * 25); camera->turnLeft(timediff_f * M_PI * 25);
} }
if(eventrecv->key.pressed_once(KEY_BACK)) if(eventrecv->key.pressed_once(KEY_BACK))
{ {
debugmode = !debugmode; debugmode = !debugmode;
if(debugmode) if(debugmode)
{ {
terrain->setDebugDataVisible(EDS_FULL); terrain->setDebugDataVisible(EDS_FULL);
} }
else else
{ {
terrain->setDebugDataVisible(EDS_OFF); terrain->setDebugDataVisible(EDS_OFF);
} }
} }
if(eventrecv->key.pressed_once(KEY_INSERT)) if(eventrecv->key.pressed_once(KEY_INSERT))
{ {
IImage *scrnshot = driver->createScreenShot(); IImage *scrnshot = driver->createScreenShot();
if(scrnshot) if(scrnshot)
{ {
CreateDir("screenshots"); CreateDir("screenshots");
std::string date = getDateString(); std::string date = getDateString();
for(uint32 i = 0; i < date.length(); i++) for(uint32 i = 0; i < date.length(); i++)
{ {
if(date[i] == ':') if(date[i] == ':')
date[i] = '_'; date[i] = '_';
} }
if(date[date.length()-1] == ' ') if(date[date.length()-1] == ' ')
{ {
date = date.substr(0,date.length()-2); date = date.substr(0,date.length()-2);
} }
driver->writeImageToFile(scrnshot, ("screenshots/PseuWoW " + date + ".jpg").c_str(), device->getTimer()->getRealTime()); driver->writeImageToFile(scrnshot, ("screenshots/PseuWoW " + date + ".jpg").c_str(), device->getTimer()->getRealTime());
scrnshot->drop(); scrnshot->drop();
} }
} }
if(mouse_pressed_left || mouse_pressed_right) if(mouse_pressed_left || mouse_pressed_right)
{ {
//if(device->getCursorControl()->isVisible()) //if(device->getCursorControl()->isVisible())
//device->getCursorControl()->setVisible(false); //device->getCursorControl()->setVisible(false);
if(mouse_pos != device->getCursorControl()->getPosition()) if(mouse_pos != device->getCursorControl()->getPosition())
{ {
camera->turnRight(MOUSE_SENSIVITY * (device->getCursorControl()->getPosition().X - mouse_pos.X)); camera->turnRight(MOUSE_SENSIVITY * (device->getCursorControl()->getPosition().X - mouse_pos.X));
// check if new camera pitch would cause camera to flip over; if thats the case keep current pitch // check if new camera pitch would cause camera to flip over; if thats the case keep current pitch
f32 upval = MOUSE_SENSIVITY * (device->getCursorControl()->getPosition().Y - mouse_pos.Y); f32 upval = MOUSE_SENSIVITY * (device->getCursorControl()->getPosition().Y - mouse_pos.Y);
f32 newval = camera->getPitch() + upval; f32 newval = camera->getPitch() + upval;
if( newval > 270.1f || newval < 89.9f) if( newval > 270.1f || newval < 89.9f)
{ {
camera->turnUp(upval); camera->turnUp(upval);
} }
device->getCursorControl()->setPosition(mouse_pos); device->getCursorControl()->setPosition(mouse_pos);
} }
} }
else else
{ {
device->getCursorControl()->setPosition(device->getCursorControl()->getPosition()); device->getCursorControl()->setPosition(device->getCursorControl()->getPosition());
//if(!device->getCursorControl()->isVisible()) //if(!device->getCursorControl()->isVisible())
//device->getCursorControl()->setVisible(true); //device->getCursorControl()->setVisible(true);
mouse_pos = device->getCursorControl()->getPosition(); mouse_pos = device->getCursorControl()->getPosition();
} }
// camera height control // camera height control
if (eventrecv->mouse.wheel < 10) eventrecv->mouse.wheel = 10; if (eventrecv->mouse.wheel < 10) eventrecv->mouse.wheel = 10;
camera->setHeight( eventrecv->mouse.wheel + terrain->getHeight(camera->getPosition()) ); camera->setHeight( eventrecv->mouse.wheel + terrain->getHeight(camera->getPosition()) );
WorldPosition wp = GetWorldPosition(); WorldPosition wp = GetWorldPosition();
core::stringw str = L"Camera: pitch:"; core::stringw str = L"Camera: pitch:";
str += camera->getPitch(); str += camera->getPitch();
str += L" c pos:"; str += L" c pos:";
str += camera->getPosition().X; str += camera->getPosition().X;
str += L","; str += L",";
str += camera->getPosition().Y; str += camera->getPosition().Y;
str += L","; str += L",";
str += camera->getPosition().Z; str += camera->getPosition().Z;
str += " ## HEAD: "; str += " ## HEAD: ";
str += DEG_TO_RAD(camera->getHeading()); str += DEG_TO_RAD(camera->getHeading());
str += L" Pos: "; str += L" Pos: ";
str = ((((((str + wp.x) + L" | ") + wp.y) + L" | ") + wp.z) + L" | OR:") + wp.o; str = ((((((str + wp.x) + L" | ") + wp.y) + L" | ") + wp.z) + L" | OR:") + wp.o;
str += L" -- Terrain: Sectors: "; str += L" -- Terrain: Sectors: ";
str += (int)terrain->getSectorsRendered(); str += (int)terrain->getSectorsRendered();
str += L" / "; str += L" / ";
str += (int)terrain->getSectorCount(); str += (int)terrain->getSectorCount();
debugText->setText(str.c_str()); debugText->setText(str.c_str());
} }
void SceneWorld::OnDraw(void) void SceneWorld::OnDraw(void)
{ {
// draw all objects // draw all objects
gui->domgr.Update(); // iterate over DrawObjects, draw them and clean up gui->domgr.Update(); // iterate over DrawObjects, draw them and clean up
} }
void SceneWorld::OnDelete(void) void SceneWorld::OnDelete(void)
{ {
DEBUG(logdebug("~SceneWorld()")); DEBUG(logdebug("~SceneWorld()"));
} }
void SceneWorld::InitTerrain(void) void SceneWorld::InitTerrain(void)
{ {
if(!mapmgr) if(!mapmgr)
{ {
logerror("SceneWorld: MapMgr not present, cant create World GUI. Switching back GUI to idle."); logerror("SceneWorld: MapMgr not present, cant create World GUI. Switching back GUI to idle.");
gui->SetSceneState(SCENESTATE_GUISTART); gui->SetSceneState(SCENESTATE_GUISTART);
return; return;
} }
mapsize = 8 * 16 * 3; // 9-1 height floats in 16 chunks per tile per axis in 3 MapTiles mapsize = 8 * 16 * 3; // 9-1 height floats in 16 chunks per tile per axis in 3 MapTiles
tilesize = UNITSIZE; tilesize = UNITSIZE;
meshsize = (s32)CHUNKSIZE*3; meshsize = (s32)CHUNKSIZE*3;
vector3df terrainPos(0.0f, 0.0f, 0.0f); // TODO: use PseuWoW's world coords here? vector3df terrainPos(0.0f, 0.0f, 0.0f); // TODO: use PseuWoW's world coords here?
camera->setPosition(core::vector3df(mapsize*tilesize/2, 0, mapsize*tilesize/2) + terrainPos); camera->setPosition(core::vector3df(mapsize*tilesize/2, 0, mapsize*tilesize/2) + terrainPos);
terrain = new ShTlTerrainSceneNode(smgr,mapsize,mapsize,tilesize,meshsize); terrain = new ShTlTerrainSceneNode(smgr,mapsize,mapsize,tilesize,meshsize);
terrain->drop(); terrain->drop();
terrain->follow(camera->getNode()); terrain->follow(camera->getNode());
terrain->setMaterialTexture(0, driver->getTexture("data/misc/dirt_test.jpg")); terrain->setMaterialTexture(0, driver->getTexture("data/misc/dirt_test.jpg"));
terrain->setMaterialFlag(video::EMF_LIGHTING, true); terrain->setMaterialFlag(video::EMF_LIGHTING, true);
terrain->setMaterialFlag(video::EMF_FOG_ENABLE, true); terrain->setMaterialFlag(video::EMF_FOG_ENABLE, true);
terrain->setPosition(terrainPos); terrain->setPosition(terrainPos);
} }
void SceneWorld::UpdateTerrain(void) void SceneWorld::UpdateTerrain(void)
{ {
// check if we changed the maptile // check if we changed the maptile
if(map_gridX == mapmgr->GetGridX() && map_gridY == mapmgr->GetGridY()) if(map_gridX == mapmgr->GetGridX() && map_gridY == mapmgr->GetGridY())
return; // grid not changed, not necessary to update tile data return; // grid not changed, not necessary to update tile data
// ... if changed, do necessary stuff... // ... if changed, do necessary stuff...
map_gridX = mapmgr->GetGridX(); map_gridX = mapmgr->GetGridX();
map_gridY = mapmgr->GetGridY(); map_gridY = mapmgr->GetGridY();
// TODO: better to do this with some ZThread Condition or FastMutex, but dont know how to. help plz! [FG] // TODO: better to do this with some ZThread Condition or FastMutex, but dont know how to. help plz! [FG]
if(!mapmgr->Loaded()) if(!mapmgr->Loaded())
{ {
logdebug("SceneWorld: Waiting until maps are loaded..."); logdebug("SceneWorld: Waiting until maps are loaded...");
while(!mapmgr->Loaded()) while(!mapmgr->Loaded())
device->sleep(1); device->sleep(1);
} }
// TODO: as soon as WMO-only worlds are implemented, remove this!! // TODO: as soon as WMO-only worlds are implemented, remove this!!
if(!mapmgr->GetLoadedMapsCount()) if(!mapmgr->GetLoadedMapsCount())
{ {
logerror("SceneWorld: Error: No maps loaded, not able to draw any terrain. Switching back GUI to idle."); logerror("SceneWorld: Error: No maps loaded, not able to draw any terrain. Switching back GUI to idle.");
logerror("SceneWorld: Hint: Be sure you are not in an WMO-only world (e.g. human capital city or most instances)!"); logerror("SceneWorld: Hint: Be sure you are not in an WMO-only world (e.g. human capital city or most instances)!");
gui->SetSceneState(SCENESTATE_GUISTART); gui->SetSceneState(SCENESTATE_GUISTART);
return; return;
} }
// something is not good here. we have terrain, but the chunks are read incorrectly. // something is not good here. we have terrain, but the chunks are read incorrectly.
// need to find out where which formula is wrong // need to find out where which formula is wrong
// the current terrain renderer code is just a test to see if ADT files are read correctly. // the current terrain renderer code is just a test to see if ADT files are read correctly.
// EDIT: it seems to display fine now, but i am still not sure if the way it is done is correct... // EDIT: it seems to display fine now, but i am still not sure if the way it is done is correct...
mutex.acquire(); // prevent other threads from deleting the maptile mutex.acquire(); // prevent other threads from deleting the maptile
logdebug("SceneWorld: Displaying MapTiles near grids x:%u y:%u",mapmgr->GetGridX(),mapmgr->GetGridY()); logdebug("SceneWorld: Displaying MapTiles near grids x:%u y:%u",mapmgr->GetGridX(),mapmgr->GetGridY());
for(s32 tiley = 0; tiley < 3; tiley++) for(s32 tiley = 0; tiley < 3; tiley++)
{ {
for(s32 tilex = 0; tilex < 3; tilex++) for(s32 tilex = 0; tilex < 3; tilex++)
{ {
MapTile *maptile = mapmgr->GetNearTile(tilex - 1, tiley - 1); MapTile *maptile = mapmgr->GetNearTile(tilex - 1, tiley - 1);
if(maptile) if(maptile)
{ {
// apply map height data // apply map height data
for(uint32 chy = 0; chy < 16; chy++) for(uint32 chy = 0; chy < 16; chy++)
for(uint32 chx = 0; chx < 16; chx++) for(uint32 chx = 0; chx < 16; chx++)
{ {
MapChunk *chunk = maptile->GetChunk(chx, chy); MapChunk *chunk = maptile->GetChunk(chx, chy);
for(uint32 hy = 0; hy < 8; hy++) for(uint32 hy = 0; hy < 8; hy++)
{ {
for(uint32 hx = 0; hx < 8; hx++) for(uint32 hx = 0; hx < 8; hx++)
{ {
f32 h = chunk->hmap_rough[hy * 9 + hx] + chunk->baseheight; // not sure if hx and hy are used correctly here f32 h = chunk->hmap_rough[hy * 9 + hx] + chunk->baseheight; // not sure if hx and hy are used correctly here
u32 terrainx = (128 * tilex) + (8 * chx) + hx; u32 terrainx = (128 * tilex) + (8 * chx) + hx;
u32 terrainy = (128 * tiley) + (8 * chy) + hy; u32 terrainy = (128 * tiley) + (8 * chy) + hy;
terrain->setHeight(terrainy, terrainx, h); terrain->setHeight(terrainy, terrainx, h);
} }
} }
} }
} }
else else
{ {
logerror("SceneWorld: MapTile not loaded, can't apply heightmap!"); logerror("SceneWorld: MapTile not loaded, can't apply heightmap!");
} }
} }
} }
mutex.release(); mutex.release();
// find out highest/lowest spot // find out highest/lowest spot
f32 highest = terrain->getHeight(0,0); f32 highest = terrain->getHeight(0,0);
f32 lowest = terrain->getHeight(0,0); f32 lowest = terrain->getHeight(0,0);
f32 curheight; f32 curheight;
for(s32 j=0; j<terrain->getSize().Height+1; j++) for(s32 j=0; j<terrain->getSize().Height+1; j++)
for(s32 i=0; i<terrain->getSize().Width+1; i++) for(s32 i=0; i<terrain->getSize().Width+1; i++)
{ {
curheight = terrain->getHeight(i,j); curheight = terrain->getHeight(i,j);
highest = max(highest,curheight); highest = max(highest,curheight);
lowest = min(lowest,curheight); lowest = min(lowest,curheight);
} }
// f32 heightdiff = highest - lowest; // f32 heightdiff = highest - lowest;
// randomize terrain color depending on height // randomize terrain color depending on height
for(s32 j=0; j<terrain->getSize().Height+1; j++) for(s32 j=0; j<terrain->getSize().Height+1; j++)
for(s32 i=0; i<terrain->getSize().Width+1; i++) for(s32 i=0; i<terrain->getSize().Width+1; i++)
{ {
curheight = terrain->getHeight(i,j); curheight = terrain->getHeight(i,j);
u32 g = (u32)(curheight / highest * 120) + 125; u32 g = (u32)(curheight / highest * 120) + 125;
u32 r = (u32)(curheight / highest * 120) + 60; u32 r = (u32)(curheight / highest * 120) + 60;
u32 b = (u32)(curheight / highest * 120) + 60; u32 b = (u32)(curheight / highest * 120) + 60;
terrain->setColor(i,j, video::SColor(255,r,g,b)); terrain->setColor(i,j, video::SColor(255,r,g,b));
} }
logdebug("SceneWorld: Smoothing terrain normals..."); logdebug("SceneWorld: Smoothing terrain normals...");
terrain->smoothNormals(); terrain->smoothNormals();
} }
WorldPosition SceneWorld::GetWorldPosition(void) WorldPosition SceneWorld::GetWorldPosition(void)
{ {
// TODO: later do not use CAMERA, but CHARACTER position, as soon as camera is changed from 1st to 3rd person view // TODO: later do not use CAMERA, but CHARACTER position, as soon as camera is changed from 1st to 3rd person view
// and floating around character in the middle // and floating around character in the middle
vector3df cam = camera->getPosition(); vector3df cam = camera->getPosition();
// TODO: need to correct camera values, the coords irrlicht returns are not suitable // TODO: need to correct camera values, the coords irrlicht returns are not suitable
// get the current maptile and use the coords of the top-left corner as relative positions // get the current maptile and use the coords of the top-left corner as relative positions
MapTile *tile = mapmgr->GetCurrentTile(); MapTile *tile = mapmgr->GetCurrentTile();
if(!tile) if(!tile)
{ {
logerror("SceneWorld::GetWorldPosition failed, MapTile not loaded!"); logerror("SceneWorld::GetWorldPosition failed, MapTile not loaded!");
return WorldPosition(); return WorldPosition();
} }
float mapx = tile->GetBaseX(); float mapx = tile->GetBaseX();
float mapy = tile->GetBaseY(); float mapy = tile->GetBaseY();
// the following formulas are NOT correct, just estimated. in most places they will differ from real expected values a lot! // the following formulas are NOT correct, just estimated. in most places they will differ from real expected values a lot!
float relx = cam.X * COORD_SCALE_VALUE_X + CHUNKSIZE; float relx = cam.X * COORD_SCALE_VALUE_X + CHUNKSIZE;
float rely = cam.Z * COORD_SCALE_VALUE_Y + CHUNKSIZE; float rely = cam.Z * COORD_SCALE_VALUE_Y + CHUNKSIZE;
float o = DEG_TO_RAD(camera->getHeading()) + ((M_PI*3.0f)/2.0f); float o = DEG_TO_RAD(camera->getHeading()) + ((M_PI*3.0f)/2.0f);
return WorldPosition(mapx - relx, mapy - rely, cam.Y, RAD_FIX(o) ); return WorldPosition(mapx - relx, mapy - rely, cam.Y, RAD_FIX(o) );
} }
void SceneWorld::SetWorldPosition(WorldPosition wp) void SceneWorld::SetWorldPosition(WorldPosition wp)
{ {
UpdateTerrain(); UpdateTerrain();
vector3df cam; vector3df cam;
dimension2d<s32> tsize = terrain->getSize(); dimension2d<s32> tsize = terrain->getSize();
MapTile *tile = mapmgr->GetTile(MapMgr::GetGridCoord(wp.x), MapMgr::GetGridCoord(wp.y)); MapTile *tile = mapmgr->GetTile(MapMgr::GetGridCoord(wp.x), MapMgr::GetGridCoord(wp.y));
ASSERT(tile == mapmgr->GetCurrentTile()); // for debugging; we should already be located on the new tile ASSERT(tile == mapmgr->GetCurrentTile()); // for debugging; we should already be located on the new tile
if(!tile) if(!tile)
{ {
logerror("SceneWorld::SetWorldPosition(): MapTile not loaded!"); logerror("SceneWorld::SetWorldPosition(): MapTile not loaded!");
return; return;
} }
cam.X = tile->GetBaseX() - wp.x + (tsize.Width * UNITSIZE); cam.X = tile->GetBaseX() - wp.x + (tsize.Width * UNITSIZE);
cam.Z = tile->GetBaseX() - wp.y + (tsize.Height * UNITSIZE); cam.Z = tile->GetBaseX() - wp.y + (tsize.Height * UNITSIZE);
float heading = RAD_TO_DEG(((M_PI*3.0f)/2.0f) - wp.o); float heading = RAD_TO_DEG(((M_PI*3.0f)/2.0f) - wp.o);
float heading_diff = camera->getHeading() - heading; float heading_diff = camera->getHeading() - heading;
logdebug("Setting camera to x: %3f y: %3f z:%3f head: %3f", cam.X, cam.Y, cam.Z, heading); logdebug("Setting camera to x: %3f y: %3f z:%3f head: %3f", cam.X, cam.Y, cam.Z, heading);
camera->turnLeft(heading_diff); camera->turnLeft(heading_diff);
// TODO: // TODO:
// - correct the above formulas // - correct the above formulas
// - find out terrain height where the camera should be set // - find out terrain height where the camera should be set
// - set camera to correct position // - set camera to correct position
// - correct camera turning // - correct camera turning
//camera->setPosition(cam); //camera->setPosition(cam);
//camera->turnRight(heading_diff); //camera->turnRight(heading_diff);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,317 +1,317 @@
/*-----------------------------------------------------------------------------* /*-----------------------------------------------------------------------------*
| headerfile ShTlTerrainSceneNode.h | | headerfile ShTlTerrainSceneNode.h |
| | | |
| version 2.00 | | version 2.00 |
| date: (29.04.2007) | | date: (29.04.2007) |
| | | |
| author: Michal Švantner | | author: Michal Švantner |
| | | |
| Shifting Tiled Terrain Scene Node | | Shifting Tiled Terrain Scene Node |
| | | |
| This node can render quit large terrain consisting of tiles by storing data | | This node can render quit large terrain consisting of tiles by storing data |
| of individual tiles in array and rendering only part of terrain around | | of individual tiles in array and rendering only part of terrain around |
| defined position and in defined size. This can be position of another scene | | defined position and in defined size. This can be position of another scene |
| node defined by user and terrain node can be set to render around it | | node defined by user and terrain node can be set to render around it |
| automaticaly. | | automaticaly. |
| It is done by creating mesh of given size which then glide over invisible | | It is done by creating mesh of given size which then glide over invisible |
| data skelet like a peace of soft cloth, updating its atributes from data | | data skelet like a peace of soft cloth, updating its atributes from data |
| arrays each time it shifts to a new position. | | arrays each time it shifts to a new position. |
| | | |
| Diferent atributes of individual tiles can be adjusted, most of them on run | | Diferent atributes of individual tiles can be adjusted, most of them on run |
| time. Namely texture coordinates, position of tile vertices, normals and | | time. Namely texture coordinates, position of tile vertices, normals and |
| color. | | color. |
| | | |
| Scene node use 2 texture layers. | | Scene node use 2 texture layers. |
| Firsth texture is standard texture which gives detail to terrain close by | | Firsth texture is standard texture which gives detail to terrain close by |
| and can by assigned to individual tiles by setting their UV coordinates. | | and can by assigned to individual tiles by setting their UV coordinates. |
| User have complete freedom as howe to apply this texture to tiles. Texture | | User have complete freedom as howe to apply this texture to tiles. Texture |
| can for example consist of seweral subtextures and each can be set to | | can for example consist of seweral subtextures and each can be set to |
| diferent tiles using UV coordinates. | | diferent tiles using UV coordinates. |
| | | |
| Second texture is created by terrain node internaly and is used to render | | Second texture is created by terrain node internaly and is used to render |
| color of individual tiles. This adds some variability to terrain at distance.| | color of individual tiles. This adds some variability to terrain at distance.|
| Both textures are blended together using EMT_DETAIL_MAP material type. | | Both textures are blended together using EMT_DETAIL_MAP material type. |
| | | |
| Normaly textures should be set in oposite order but there are some bugs with | | Normaly textures should be set in oposite order but there are some bugs with |
| updating texture under OpenGL so until it gets solved I have to stick with | | updating texture under OpenGL so until it gets solved I have to stick with |
| detailmap applyed as firsth texture layer. Not perfect but working. | | detailmap applyed as firsth texture layer. Not perfect but working. |
| | | |
| This scene node also provide user with functions to get height at given | | This scene node also provide user with functions to get height at given |
| coordinates and test 3d line for collision useful for line of sight or bullet| | coordinates and test 3d line for collision useful for line of sight or bullet|
| collision testing. | | collision testing. |
| | | |
| Rendered mesh is split in to seweral sectors which are culled individualy. | | Rendered mesh is split in to seweral sectors which are culled individualy. |
| This exclude around 60% of polygoons from rendering. | | This exclude around 60% of polygoons from rendering. |
| | | |
| Writen for Irrlicht engine version 1.3 | | Writen for Irrlicht engine version 1.3 |
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
#ifndef SHTLTERRAINSCENENODE_H #ifndef SHTLTERRAINSCENENODE_H
#define SHTLTERRAINSCENENODE_H #define SHTLTERRAINSCENENODE_H
#include "irrlicht/irrlicht.h" #include "irrlicht/irrlicht.h"
using namespace irr; using namespace irr;
#include "TlTMesh.h" #include "TlTMesh.h"
// Shifting Tiled Terrain Scene Node class // Shifting Tiled Terrain Scene Node class
class ShTlTerrainSceneNode : public scene::ISceneNode class ShTlTerrainSceneNode : public scene::ISceneNode
{ {
// dimensions of whole terrain // dimensions of whole terrain
core::dimension2d<s32> Size; core::dimension2d<s32> Size;
// bounding box of terrain mesh // bounding box of terrain mesh
core::aabbox3d<f32> BoundingBox; core::aabbox3d<f32> BoundingBox;
// terrain vertex data // terrain vertex data
array2d<TlTData> Data; array2d<TlTData> Data;
// terrain tile UV data for 1th texture layer // terrain tile UV data for 1th texture layer
array2d<TlTCoords> UVdata; array2d<TlTCoords> UVdata;
// terrain mesh sectors // terrain mesh sectors
array2d<TlTSector> Sector; array2d<TlTSector> Sector;
// array of pointers to vertices of tiles // array of pointers to vertices of tiles
array2d<TlTTile> Tile; array2d<TlTTile> Tile;
// size of vissible terrain mesh // size of vissible terrain mesh
core::dimension2d<s32> MeshSize; core::dimension2d<s32> MeshSize;
// position of vissible terrain mesh relative to whole terrain in tiles // position of vissible terrain mesh relative to whole terrain in tiles
core::vector2d<s32> MeshPosition; core::vector2d<s32> MeshPosition;
// material // material
core::array<video::SMaterial> Material; core::array<video::SMaterial> Material;
// size of terrain tiles // size of terrain tiles
f32 TileSize; f32 TileSize;
// node terrain mesh should be rendered around // node terrain mesh should be rendered around
scene::ISceneNode* Fnode; scene::ISceneNode* Fnode;
// color texture set as 2nd texture layer // color texture set as 2nd texture layer
video::ITexture* CTexture; video::ITexture* CTexture;
// number of sectors rendered last frame // number of sectors rendered last frame
u32 SectorsRendered; u32 SectorsRendered;
// howe many tiles should be skiped before terrain mesh gets updated // howe many tiles should be skiped before terrain mesh gets updated
s32 ShStep; s32 ShStep;
// return true if sector is on screen // return true if sector is on screen
virtual bool isSectorOnScreen(TlTSector* sctr); virtual bool isSectorOnScreen(TlTSector* sctr);
// update vertices of sector // update vertices of sector
virtual void updateVertices(TlTSector &sector); virtual void updateVertices(TlTSector &sector);
// update 2nd texture layer // update 2nd texture layer
virtual void updateTexture(u32* p, TlTSector &sector); virtual void updateTexture(u32* p, TlTSector &sector);
// return true if 3d line colide with tile // return true if 3d line colide with tile
virtual bool getIntersectionWithTile(s32 w, s32 h, core::line3d<f32> line, virtual bool getIntersectionWithTile(s32 w, s32 h, core::line3d<f32> line,
core::vector3df &outIntersection); core::vector3df &outIntersection);
public: public:
// constructor // constructor
// \param smgr -pointer to scene manager // \param smgr -pointer to scene manager
// \param width - width of terrain in tiles // \param width - width of terrain in tiles
// \param height - heighth of terrain in tiles // \param height - heighth of terrain in tiles
// \param tilesize -size of tile // \param tilesize -size of tile
// \param rendersize -size of rendered terrain mesh in tiles // \param rendersize -size of rendered terrain mesh in tiles
// \param parent -parent scene node // \param parent -parent scene node
// \param id -ID number // \param id -ID number
ShTlTerrainSceneNode(scene::ISceneManager* pSceneManager, s32 width, s32 height, ShTlTerrainSceneNode(scene::ISceneManager* pSceneManager, s32 width, s32 height,
f32 tilesize, s32 rendersize, scene::ISceneNode* parent = 0, s32 id = -1); f32 tilesize, s32 rendersize, scene::ISceneNode* parent = 0, s32 id = -1);
// destructor // destructor
~ShTlTerrainSceneNode(); ~ShTlTerrainSceneNode();
// frame // frame
virtual void OnRegisterSceneNode(); virtual void OnRegisterSceneNode();
// renders terrain // renders terrain
virtual void render(); virtual void render();
// returns the axis aligned bounding box of terrain // returns the axis aligned bounding box of terrain
virtual const core::aabbox3d<f32>& getBoundingBox() const; virtual const core::aabbox3d<f32>& getBoundingBox() const;
// recalculate terrain bounding box // recalculate terrain bounding box
virtual void recalculateBoundingBox(); virtual void recalculateBoundingBox();
// returns amount of materials used by terrain // returns amount of materials used by terrain
// this terrain uses only one material // this terrain uses only one material
virtual u32 getMaterialCount(); virtual u32 getMaterialCount();
// returns the material of terrain based on the zero based index // returns the material of terrain based on the zero based index
// \param i -index of material to return // \param i -index of material to return
virtual video::SMaterial& getMaterial(u32 i); virtual video::SMaterial& getMaterial(u32 i);
// return number of tiles to skip before terrain mesh gets updated // return number of tiles to skip before terrain mesh gets updated
virtual s32 getStep(); virtual s32 getStep();
// set number of tiles to skip before terrain mesh gets updated, default is 1 // set number of tiles to skip before terrain mesh gets updated, default is 1
// updating slows down rendering and seting step higher will cause terrain to update less ofthen // updating slows down rendering and seting step higher will cause terrain to update less ofthen
// \param newstep -amount of tiles to skip before updating // \param newstep -amount of tiles to skip before updating
virtual void setStep(u32 newstep); virtual void setStep(u32 newstep);
// return dimensions of whole terrain in tiles // return dimensions of whole terrain in tiles
virtual core::dimension2d<s32> getSize(); virtual core::dimension2d<s32> getSize();
// return dimension of terrain tile // return dimension of terrain tile
virtual f32 getTileSize(); virtual f32 getTileSize();
// set new dimensions of terrain tile // set new dimensions of terrain tile
// \param newsize -new size of tile // \param newsize -new size of tile
virtual void setTileSize(f32 newsize); virtual void setTileSize(f32 newsize);
// returns dimension of rendered mesh in tiles // returns dimension of rendered mesh in tiles
virtual core::dimension2d<s32> getRenderedSize(); virtual core::dimension2d<s32> getRenderedSize();
// return number of sectors into which terrain mesh is divided // return number of sectors into which terrain mesh is divided
virtual u32 getSectorCount(); virtual u32 getSectorCount();
// returns sectors rendered last frame // returns sectors rendered last frame
virtual u32 getSectorsRendered(); virtual u32 getSectorsRendered();
// return relative height of terrain spot at terrain coordinates // return relative height of terrain spot at terrain coordinates
// \param w -width coordinate of spot in tiles // \param w -width coordinate of spot in tiles
// \param h -height coordinate of spot in tiles // \param h -height coordinate of spot in tiles
virtual f32 getHeight(u32 w, u32 h); virtual f32 getHeight(u32 w, u32 h);
// return height of terrain at any position // return height of terrain at any position
// \param pos -3d coordinates at which to get height of terrain // \param pos -3d coordinates at which to get height of terrain
virtual f32 getHeight(core::vector3df pos); virtual f32 getHeight(core::vector3df pos);
// set relative height of terrain spot at terrain coordinates // set relative height of terrain spot at terrain coordinates
// \param w -width coordinate of spot in tiles // \param w -width coordinate of spot in tiles
// \param h -height coordinate of spot in tiles // \param h -height coordinate of spot in tiles
// \param newheight -new height of spot // \param newheight -new height of spot
virtual void setHeight(u32 w, u32 h, f32 newheight); virtual void setHeight(u32 w, u32 h, f32 newheight);
// return normal of terrain at terrain coordinates // return normal of terrain at terrain coordinates
// \param w -width coordinate of spot in tiles // \param w -width coordinate of spot in tiles
// \param h -height coordinate of spot in tiles // \param h -height coordinate of spot in tiles
virtual core::vector3df getNormal(u32 w, u32 h); virtual core::vector3df getNormal(u32 w, u32 h);
// set normal of terrain at terrain coordinates // set normal of terrain at terrain coordinates
// \param w -width coordinate of spot in tiles // \param w -width coordinate of spot in tiles
// \param h -height coordinate of spot in tiles // \param h -height coordinate of spot in tiles
// \param newnormal -new normal vector terrain spot // \param newnormal -new normal vector terrain spot
virtual void setNormal(s32 w, s32 h, core::vector3df newnormal); virtual void setNormal(s32 w, s32 h, core::vector3df newnormal);
// recalculate normal at terrain coordinates // recalculate normal at terrain coordinates
// \param w -width coordinate of spot in tiles // \param w -width coordinate of spot in tiles
// \param h -height coordinate of spot in tiles // \param h -height coordinate of spot in tiles
virtual void recalculateNormal(s32 w, s32 h); virtual void recalculateNormal(s32 w, s32 h);
// recalculare normals of whole terrain making it look smooth under light // recalculare normals of whole terrain making it look smooth under light
virtual void smoothNormals(); virtual void smoothNormals();
// get texture coordinates of tile corner // get texture coordinates of tile corner
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
// \param corner -tile corner, can be LOWER_LEFT, UPPER_LEFT, UPPER_RIGHT, LOWER_RIGHT // \param corner -tile corner, can be LOWER_LEFT, UPPER_LEFT, UPPER_RIGHT, LOWER_RIGHT
virtual core::vector2d<f32> getTileUV(u32 w, u32 h, TILE_VERTEX corner); virtual core::vector2d<f32> getTileUV(u32 w, u32 h, TILE_VERTEX corner);
// set texture coordinates of tile // set texture coordinates of tile
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
// \param UVLowerLeft -UV coordinates of lower left corner // \param UVLowerLeft -UV coordinates of lower left corner
// \param UVUpperLeft -UV coordinates of upper left corner // \param UVUpperLeft -UV coordinates of upper left corner
// \param UVUpperRight -UV coordinates of upper right corner // \param UVUpperRight -UV coordinates of upper right corner
// \param UVLowerRight -UV coordinates of lower right corner // \param UVLowerRight -UV coordinates of lower right corner
virtual void setTileUV(u32 w, u32 h, core::vector2d<f32> UVLowerLeft, virtual void setTileUV(u32 w, u32 h, core::vector2d<f32> UVLowerLeft,
core::vector2d<f32> UVUpperLeft, core::vector2d<f32> UVUpperRight, core::vector2d<f32> UVUpperLeft, core::vector2d<f32> UVUpperRight,
core::vector2d<f32> UVLowerRight); core::vector2d<f32> UVLowerRight);
// stretch texture over whole terrain // stretch texture over whole terrain
// \param scale -scale of the texture stretched, 2,2 would stretch it twice // \param scale -scale of the texture stretched, 2,2 would stretch it twice
virtual void stretchTexture(core::vector2d<f32> scale = core::vector2d<f32>(1,1)); virtual void stretchTexture(core::vector2d<f32> scale = core::vector2d<f32>(1,1));
// stretch texture over every tile individualy // stretch texture over every tile individualy
// \param scale -scale of the texture stretched, 0.5,0.5 would display half of texture over each tile // \param scale -scale of the texture stretched, 0.5,0.5 would display half of texture over each tile
virtual void stretchTextureOverTile(core::vector2d<f32> scale = core::vector2d<f32>(1,1)); virtual void stretchTextureOverTile(core::vector2d<f32> scale = core::vector2d<f32>(1,1));
// rotate texture of tile 90 degrees // rotate texture of tile 90 degrees
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
virtual void rotateTileTexture90(u32 w, u32 h); virtual void rotateTileTexture90(u32 w, u32 h);
// rotate texture of tile 180 degrees // rotate texture of tile 180 degrees
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
virtual void rotateTileTexture180(u32 w, u32 h); virtual void rotateTileTexture180(u32 w, u32 h);
// rotate texture of tile 270 degrees // rotate texture of tile 270 degrees
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
virtual void rotateTileTexture270(u32 w, u32 h); virtual void rotateTileTexture270(u32 w, u32 h);
// flip (mirror) texture of tile horizontaly // flip (mirror) texture of tile horizontaly
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
virtual void flipTileTextureHorizontal(u32 w, u32 h); virtual void flipTileTextureHorizontal(u32 w, u32 h);
// flip (mirror) texture of tile verticaly // flip (mirror) texture of tile verticaly
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
virtual void flipTileTextureVertical(u32 w, u32 h); virtual void flipTileTextureVertical(u32 w, u32 h);
// get color of tile at terrain coordinates // get color of tile at terrain coordinates
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
virtual video::SColor getColor(u32 w, u32 h); virtual video::SColor getColor(u32 w, u32 h);
// set color of tile at terrain coordinates // set color of tile at terrain coordinates
// \param w -width coordinate of tile // \param w -width coordinate of tile
// \param h -height coordinate of tile // \param h -height coordinate of tile
// \param newcolor -new color of tile // \param newcolor -new color of tile
virtual void setColor(u32 w, u32 h, video::SColor newcolor); virtual void setColor(u32 w, u32 h, video::SColor newcolor);
// set rendered mesh position relative to terrain // set rendered mesh position relative to terrain
// note that origin of mesh is in its lower left corner // note that origin of mesh is in its lower left corner
// \param pos -new position of mesh relative to terrain in tiles // \param pos -new position of mesh relative to terrain in tiles
virtual void setMeshPosition(core::vector2d<s32> pos); virtual void setMeshPosition(core::vector2d<s32> pos);
// center rendered mesh at 3d coordinates // center rendered mesh at 3d coordinates
// \param pos -new position mesh should be rendered around // \param pos -new position mesh should be rendered around
virtual void centerAt(core::vector3d<f32> pos); virtual void centerAt(core::vector3d<f32> pos);
// update rendered mesh // update rendered mesh
virtual void update(); virtual void update();
// set scene node terrain mesh should be automaticly rendered arround // set scene node terrain mesh should be automaticly rendered arround
// can be camera or player node for example // can be camera or player node for example
// \param node -scene node to automaticaly follow // \param node -scene node to automaticaly follow
virtual void follow(scene::ISceneNode* node); virtual void follow(scene::ISceneNode* node);
// cancel pervious function // cancel pervious function
// stop following scene node if any // stop following scene node if any
virtual void stop(); virtual void stop();
// test if 3d line colide with terrain // test if 3d line colide with terrain
// returns true if yes, false if not and store intersection in "outIntersection" vector // returns true if yes, false if not and store intersection in "outIntersection" vector
// \param line -3d line // \param line -3d line
// \param outIntersection -vector to store intersection point if any // \param outIntersection -vector to store intersection point if any
virtual bool getIntersectionWithLine( core::line3d<f32> line, core::vector3df &outIntersection); virtual bool getIntersectionWithLine( core::line3d<f32> line, core::vector3df &outIntersection);
// load height data from texture // load height data from texture
// parameters allow to specify place where to load data, which makes possible // parameters allow to specify place where to load data, which makes possible
// to load terrain from seweral smaller textures // to load terrain from seweral smaller textures
// \param filename -filename of texture // \param filename -filename of texture
// \param scale -scale to apply at height data, if you want white color to be height of 10.5 set scale to 10.5 // \param scale -scale to apply at height data, if you want white color to be height of 10.5 set scale to 10.5
// \param w -width coordinate of tile were to start loading // \param w -width coordinate of tile were to start loading
// \param h -height coordinate of tile were to start loading // \param h -height coordinate of tile were to start loading
virtual void loadHeightMap(const c8 *filename, f32 scale, u32 w = 0, u32 h = 0); virtual void loadHeightMap(const c8 *filename, f32 scale, u32 w = 0, u32 h = 0);
// load color data from texture // load color data from texture
// parameters allow to specify place where to load data, which makes possible // parameters allow to specify place where to load data, which makes possible
// to load terrain from seweral smaller textures // to load terrain from seweral smaller textures
// \param filename -filename of texture // \param filename -filename of texture
// \param w -width coordinate of tile were to start loading // \param w -width coordinate of tile were to start loading
// \param h -height coordinate of tile were to start loading // \param h -height coordinate of tile were to start loading
virtual void loadColorMap(const c8 *filename, u32 w = 0, u32 h = 0); virtual void loadColorMap(const c8 *filename, u32 w = 0, u32 h = 0);
}; };
#endif #endif

View File

@ -1,148 +1,148 @@
/*-----------------------------------------------------------------------------* /*-----------------------------------------------------------------------------*
| headerfile TLTMesh.h | | headerfile TLTMesh.h |
| | | |
| version 1.00 | | version 1.00 |
| date: (17.04.2007) | | date: (17.04.2007) |
| | | |
| author: Michal Švantner | | author: Michal Švantner |
| | | |
| Some structures used for Tiled Terrain | | Some structures used for Tiled Terrain |
| Writen for Irrlicht engine version 1.3 | | Writen for Irrlicht engine version 1.3 |
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
#ifndef TLTMESH_H #ifndef TLTMESH_H
#define TLTMESH_H #define TLTMESH_H
#include <irrlicht/irrlicht.h> #include <irrlicht/irrlicht.h>
using namespace irr; using namespace irr;
// dynamic 2d array // dynamic 2d array
template <class T> class array2d template <class T> class array2d
{ {
T** data; T** data;
s32 w, h; s32 w, h;
public: public:
array2d() : w(0), h(0) {} array2d() : w(0), h(0) {}
array2d(int width, int height) : w(width), h(height) array2d(int width, int height) : w(width), h(height)
{ {
data = new T*[w]; data = new T*[w];
for(int i=0; i<w; i++) data[i] = new T[h]; for(int i=0; i<w; i++) data[i] = new T[h];
} }
virtual void reset(int width, int height) virtual void reset(int width, int height)
{ {
if(w && h) if(w && h)
{ {
for(int i=0; i<w; i++) delete data[i]; for(int i=0; i<w; i++) delete data[i];
delete [] data; delete [] data;
} }
if(width && height) if(width && height)
{ {
w = width; w = width;
h = height; h = height;
data = new T*[w]; data = new T*[w];
for(int i=0; i<w; i++) data[i] = new T[h]; for(int i=0; i<w; i++) data[i] = new T[h];
} }
else else
{ {
w = 0; w = 0;
h = 0; h = 0;
} }
} }
~array2d() ~array2d()
{ {
if(w && h) if(w && h)
{ {
for(int i=0; i<w; i++) delete [] data[i]; for(int i=0; i<w; i++) delete [] data[i];
delete [] data; delete [] data;
} }
} }
virtual T& operator ()(u32 index1, u32 index2) virtual T& operator ()(u32 index1, u32 index2)
{ {
return data[index1][index2]; return data[index1][index2];
} }
virtual s32 width() {return w;} virtual s32 width() {return w;}
virtual s32 height() {return h;} virtual s32 height() {return h;}
}; };
// enumeration of tile vertices // enumeration of tile vertices
enum TILE_VERTEX enum TILE_VERTEX
{ {
LOWER_LEFT = 0, LOWER_LEFT = 0,
UPPER_LEFT, UPPER_LEFT,
UPPER_RIGHT, UPPER_RIGHT,
LOWER_RIGHT, LOWER_RIGHT,
}; };
// structure holding pointers to 4 vertices of tile // structure holding pointers to 4 vertices of tile
// makes possible to acces vertex data based on tile structure // makes possible to acces vertex data based on tile structure
struct TlTTile struct TlTTile
{ {
video::S3DVertex2TCoords* Vertex[4]; video::S3DVertex2TCoords* Vertex[4];
}; };
// structure holding texture coordinates of tile // structure holding texture coordinates of tile
struct TlTCoords struct TlTCoords
{ {
core::vector2d<f32> Vertex[4]; core::vector2d<f32> Vertex[4];
}; };
// structure which holds some data about spot on tiled terrain // structure which holds some data about spot on tiled terrain
struct TlTData struct TlTData
{ {
f32 Height; f32 Height;
core::vector3df Normal; core::vector3df Normal;
video::SColor Color; video::SColor Color;
}; };
// structure which is used as meshbuffer for Tiled Terrain // structure which is used as meshbuffer for Tiled Terrain
class TlTSector class TlTSector
{ {
public: public:
TlTSector() {}; TlTSector() {};
~TlTSector() {}; ~TlTSector() {};
// position relative to whole mesh of which sector is part in tiles // position relative to whole mesh of which sector is part in tiles
core::vector2d<s32> Offset; core::vector2d<s32> Offset;
// dimension of sector in tiles // dimension of sector in tiles
core::dimension2d<u32> Size; core::dimension2d<u32> Size;
// array of vertices // array of vertices
core::array<video::S3DVertex2TCoords> Vertex; core::array<video::S3DVertex2TCoords> Vertex;
// array of indices // array of indices
core::array<u16> Index; core::array<u16> Index;
// axis aligned bounding box // axis aligned bounding box
core::aabbox3d<f32> BoundingBox; core::aabbox3d<f32> BoundingBox;
// update texture flag // update texture flag
bool UpdateTexture; bool UpdateTexture;
// update vertices flag // update vertices flag
bool UpdateVertices; bool UpdateVertices;
// vissibility flag // vissibility flag
bool isVissible; bool isVissible;
}; };
#endif #endif

View File

@ -1,10 +1,10 @@
#ifndef _HELPERDEFS_H #ifndef _HELPERDEFS_H
#define _HELPERDEFS_H #define _HELPERDEFS_H
#define GUID_HIPART(x) (*(((uint32*)&(x))+1)) #define GUID_HIPART(x) (*(((uint32*)&(x))+1))
#define GUID_LOPART(x) (*((uint32*)&(x))) #define GUID_LOPART(x) (*((uint32*)&(x)))
#define MAKE_GUID(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) ) #define MAKE_GUID(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) )
#define CHAT_ITEM_BEGIN_STRING "|Hitem:" #define CHAT_ITEM_BEGIN_STRING "|Hitem:"
#endif #endif

View File

@ -1,143 +1,143 @@
#include <fstream> #include <fstream>
#include "MemoryDataHolder.h" #include "MemoryDataHolder.h"
#include "DefScript/TypeStorage.h" #include "DefScript/TypeStorage.h"
namespace MemoryDataHolder namespace MemoryDataHolder
{ {
class DataLoaderRunnable; class DataLoaderRunnable;
ZThread::FastMutex mutex; ZThread::FastMutex mutex;
TypeStorage<uint8*> storage; TypeStorage<uint8*> storage;
TypeStorage<DataLoaderRunnable> loaders; TypeStorage<DataLoaderRunnable> loaders;
// instances of this class MUST be created with new-operator, or Destroy() will cause a crash! // instances of this class MUST be created with new-operator, or Destroy() will cause a crash!
class DataLoaderRunnable : public ZThread::Runnable class DataLoaderRunnable : public ZThread::Runnable
{ {
public: public:
DataLoaderRunnable() DataLoaderRunnable()
{ {
_buf = NULL; _buf = NULL;
_threaded = false; _threaded = false;
} }
// the threaded part // the threaded part
void run() void run()
{ {
uint32 size = GetFileSize(_name.c_str()); uint32 size = GetFileSize(_name.c_str());
// couldnt open file if size is 0 // couldnt open file if size is 0
if(!size) if(!size)
{ {
logerror("DataLoaderRunnable: Error opening file: '%s'",_name.c_str()); logerror("DataLoaderRunnable: Error opening file: '%s'",_name.c_str());
DoCallbacks(false); // call callback func, 'false' to indicate file coulsnt be loaded DoCallbacks(false); // call callback func, 'false' to indicate file coulsnt be loaded
Destroy(); Destroy();
return; return;
} }
_buf = new uint8[size]; _buf = new uint8[size];
std::ifstream fh; std::ifstream fh;
fh.open(_name.c_str(), std::ios_base::in | std::ios_base::binary); fh.open(_name.c_str(), std::ios_base::in | std::ios_base::binary);
if(!fh.is_open()) if(!fh.is_open())
{ {
logerror("DataLoaderRunnable: Error opening file: '%s'",_name.c_str()); logerror("DataLoaderRunnable: Error opening file: '%s'",_name.c_str());
delete _buf; delete _buf;
_buf = NULL; _buf = NULL;
DoCallbacks(false); DoCallbacks(false);
Destroy(); Destroy();
return; return;
} }
fh.read((char*)_buf,size); fh.read((char*)_buf,size);
fh.close(); fh.close();
storage.Assign(_name,&_buf); storage.Assign(_name,&_buf);
loaders.UnlinkByPtr(this); // must be unlinked after the file is fully loaded, but before the callbacks are processed! loaders.UnlinkByPtr(this); // must be unlinked after the file is fully loaded, but before the callbacks are processed!
DoCallbacks(true); DoCallbacks(true);
Destroy(); Destroy();
} }
inline void AddCallback(callback_func func, void *ptr = NULL) inline void AddCallback(callback_func func, void *ptr = NULL)
{ {
_callbacks[func] = ptr; _callbacks[func] = ptr;
} }
inline void SetName(std::string name) inline void SetName(std::string name)
{ {
_name = name; _name = name;
} }
// if this class has done its work, delete self // if this class has done its work, delete self
inline void Destroy(void) inline void Destroy(void)
{ {
delete this; delete this;
} }
inline uint8 *GetBuf(void) inline uint8 *GetBuf(void)
{ {
return _buf; return _buf;
} }
inline void DoCallbacks(bool success = true) inline void DoCallbacks(bool success = true)
{ {
for(std::map<callback_func,void*>::iterator it = _callbacks.begin(); it != _callbacks.end(); it++) for(std::map<callback_func,void*>::iterator it = _callbacks.begin(); it != _callbacks.end(); it++)
{ {
(*(it->first))(it->second,success); (*(it->first))(it->second,success);
} }
} }
inline void SetThreaded(bool t) inline void SetThreaded(bool t)
{ {
_threaded = t; _threaded = t;
} }
inline bool IsThreaded(void) inline bool IsThreaded(void)
{ {
return _threaded; return _threaded;
} }
inline bool HasCallbackFunc(callback_func f) inline bool HasCallbackFunc(callback_func f)
{ {
return _callbacks.find(f) != _callbacks.end(); return _callbacks.find(f) != _callbacks.end();
} }
private: private:
std::string _name; std::string _name;
std::map<callback_func, void*> _callbacks; std::map<callback_func, void*> _callbacks;
uint8 *_buf; uint8 *_buf;
bool _threaded; bool _threaded;
}; };
uint8 *GetFile(std::string s, bool threaded = false, callback_func func = NULL,void *ptr = NULL) uint8 *GetFile(std::string s, bool threaded = false, callback_func func = NULL,void *ptr = NULL)
{ {
mutex.acquire(); // we need excusive access, other threads might unload the requested file during checking mutex.acquire(); // we need excusive access, other threads might unload the requested file during checking
if(uint8 **buf = storage.GetNoCreate(s)) if(uint8 **buf = storage.GetNoCreate(s))
{ {
// the file was requested some other time, is still present in memory and the pointer can simply be returned // the file was requested some other time, is still present in memory and the pointer can simply be returned
mutex.release(); // everything ok, mutex can be unloaded safely before returning mutex.release(); // everything ok, mutex can be unloaded safely before returning
return *buf; return *buf;
} }
else else
{ {
DataLoaderRunnable *r = loaders.GetNoCreate(s); DataLoaderRunnable *r = loaders.GetNoCreate(s);
if(r == NULL) if(r == NULL)
{ {
// no loader thread is working on that file... // no loader thread is working on that file...
r = new DataLoaderRunnable(); r = new DataLoaderRunnable();
loaders.Assign(s,r); loaders.Assign(s,r);
r->AddCallback(func,ptr); // not threadsafe! r->AddCallback(func,ptr); // not threadsafe!
// after assigning/registering a new loader to the file, the mutex can be released safely // after assigning/registering a new loader to the file, the mutex can be released safely
mutex.release(); mutex.release();
r->SetName(s); r->SetName(s);
r->SetThreaded(threaded); r->SetThreaded(threaded);
if(threaded) if(threaded)
{ {
ZThread::Thread t(r); // start thread ZThread::Thread t(r); // start thread
} }
else else
{ {
r->run(); // will exit after the whole file is loaded and the (one) callback is run r->run(); // will exit after the whole file is loaded and the (one) callback is run
return r->GetBuf(); return r->GetBuf();
} }
} }
else // if a loader is already existing, add callbacks to that loader. else // if a loader is already existing, add callbacks to that loader.
{ {
r->AddCallback(func,ptr); r->AddCallback(func,ptr);
mutex.release(); mutex.release();
} }
} }
return NULL; return NULL;
} }
}; };

View File

@ -1,14 +1,14 @@
#ifndef MEMORYDATAHOLDER_H #ifndef MEMORYDATAHOLDER_H
#define MEMORYDATAHOLDER_H #define MEMORYDATAHOLDER_H
#include "common.h" #include "common.h"
namespace MemoryDataHolder namespace MemoryDataHolder
{ {
typedef void (*callback_func)(void*,bool); typedef void (*callback_func)(void*,bool);
uint8 *GetFile(std::string&,bool,callback_func,void*); uint8 *GetFile(std::string&,bool,callback_func,void*);
}; };
#endif #endif

View File

@ -1,451 +1,451 @@
#include "common.h" #include "common.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include <time.h> #include <time.h>
#include <openssl/rand.h> #include <openssl/rand.h>
#include "ByteBuffer.h" #include "ByteBuffer.h"
#include "DefScript/DefScript.h" #include "DefScript/DefScript.h"
#include "DefScriptInterface.h" #include "DefScriptInterface.h"
#include "Auth/BigNumber.h" #include "Auth/BigNumber.h"
#include "DefScript/DefScript.h" #include "DefScript/DefScript.h"
#include "RealmSession.h" #include "RealmSession.h"
#include "WorldSession.h" #include "WorldSession.h"
#include "CacheHandler.h" #include "CacheHandler.h"
#include "GUI/PseuGUI.h" #include "GUI/PseuGUI.h"
#include "RemoteController.h" #include "RemoteController.h"
#include "Cli.h" #include "Cli.h"
//###### Start of program code ####### //###### Start of program code #######
PseuInstanceRunnable::PseuInstanceRunnable() PseuInstanceRunnable::PseuInstanceRunnable()
{ {
} }
void PseuInstanceRunnable::run(void) void PseuInstanceRunnable::run(void)
{ {
_i = new PseuInstance(this); _i = new PseuInstance(this);
_i->SetConfDir("./conf/"); _i->SetConfDir("./conf/");
_i->SetScpDir("./scripts/"); _i->SetScpDir("./scripts/");
if(_i->Init()) if(_i->Init())
{ {
_i->Run(); _i->Run();
} }
else else
{ {
getchar(); // if init failed, wait for keypress before exit getchar(); // if init failed, wait for keypress before exit
} }
delete _i; delete _i;
} }
void PseuInstanceRunnable::sleep(uint32 msecs) void PseuInstanceRunnable::sleep(uint32 msecs)
{ {
ZThread::Thread::sleep(msecs); ZThread::Thread::sleep(msecs);
} }
PseuInstance::PseuInstance(PseuInstanceRunnable *run) PseuInstance::PseuInstance(PseuInstanceRunnable *run)
{ {
_runnable=run; _runnable=run;
_ver="PseuWoW Alpha Build 13.51" DEBUG_APPENDIX; _ver="PseuWoW Alpha Build 13.51" DEBUG_APPENDIX;
_ver_short="A13.51" DEBUG_APPENDIX; _ver_short="A13.51" DEBUG_APPENDIX;
_wsession=NULL; _wsession=NULL;
_rsession=NULL; _rsession=NULL;
_scp=NULL; _scp=NULL;
_conf=NULL; _conf=NULL;
_cli=NULL; _cli=NULL;
_rmcontrol=NULL; _rmcontrol=NULL;
_gui=NULL; _gui=NULL;
_guithread=NULL; _guithread=NULL;
_stop=false; _stop=false;
_fastquit=false; _fastquit=false;
_startrealm=true; _startrealm=true;
_createws=false; _createws=false;
_error=false; _error=false;
_initialized=false; _initialized=false;
} }
PseuInstance::~PseuInstance() PseuInstance::~PseuInstance()
{ {
if(_cli) if(_cli)
{ {
_cli->stop(); _cli->stop();
// delete _cli; // ok this is a little mem leak... can be fixed sometime in future // delete _cli; // ok this is a little mem leak... can be fixed sometime in future
} }
if(_gui) if(_gui)
_gui->Shutdown(); _gui->Shutdown();
if(_guithread) if(_guithread)
_guithread->wait(); _guithread->wait();
if(_rmcontrol) if(_rmcontrol)
delete _rmcontrol; delete _rmcontrol;
if(_rsession) if(_rsession)
delete _rsession; delete _rsession;
if(_wsession) if(_wsession)
delete _wsession; delete _wsession;
delete _scp; delete _scp;
delete _conf; delete _conf;
log("--- Instance shut down ---"); log("--- Instance shut down ---");
} }
bool PseuInstance::Init(void) bool PseuInstance::Init(void)
{ {
log_setloglevel(0); log_setloglevel(0);
log(""); log("");
log("--- Initializing Instance ---"); log("--- Initializing Instance ---");
if(_confdir.empty()) if(_confdir.empty())
_confdir="./conf/"; _confdir="./conf/";
if(_scpdir.empty()) if(_scpdir.empty())
_scpdir="./scripts/"; _scpdir="./scripts/";
srand((unsigned)time(NULL)); srand((unsigned)time(NULL));
RAND_set_rand_method(RAND_SSLeay()); // init openssl randomizer RAND_set_rand_method(RAND_SSLeay()); // init openssl randomizer
_scp=new DefScriptPackage(); _scp=new DefScriptPackage();
_scp->SetParentMethod((void*)this); _scp->SetParentMethod((void*)this);
_conf=new PseuInstanceConf(); _conf=new PseuInstanceConf();
_scp->SetPath(_scpdir); _scp->SetPath(_scpdir);
_scp->SetLog(logdetail); // does anyone have an idea why log() is not accepted here? _scp->SetLog(logdetail); // does anyone have an idea why log() is not accepted here?
_scp->SetDebugLog(logdebug); _scp->SetDebugLog(logdebug);
_scp->SetErrorLog(logerror); _scp->SetErrorLog(logerror);
_scp->variables.Set("@version_short",_ver_short); _scp->variables.Set("@version_short",_ver_short);
_scp->variables.Set("@version",_ver); _scp->variables.Set("@version",_ver);
_scp->variables.Set("@inworld","false"); _scp->variables.Set("@inworld","false");
if(!_scp->LoadScriptFromFile("./_startup.def")) if(!_scp->LoadScriptFromFile("./_startup.def"))
{ {
logerror("Error loading '_startup.def'"); logerror("Error loading '_startup.def'");
SetError(); SetError();
} }
else if(!_scp->BoolRunScript("_startup",NULL)) else if(!_scp->BoolRunScript("_startup",NULL))
{ {
logerror("Error executing '_startup.def'"); logerror("Error executing '_startup.def'");
SetError(); SetError();
} }
// TODO: find a better loaction where to place this block! // TODO: find a better loaction where to place this block!
if(GetConf()->enablegui) if(GetConf()->enablegui)
{ {
if(InitGUI()) if(InitGUI())
logdebug("GUI: Init successful."); logdebug("GUI: Init successful.");
else else
logerror("GUI: Init failed!"); logerror("GUI: Init failed!");
} }
if(GetConf()->rmcontrolport) if(GetConf()->rmcontrolport)
{ {
_rmcontrol = new RemoteController(this,GetConf()->rmcontrolport); _rmcontrol = new RemoteController(this,GetConf()->rmcontrolport);
} }
if(GetConf()->enablecli) if(GetConf()->enablecli)
{ {
log("Starting CLI..."); log("Starting CLI...");
_cli = new CliRunnable(this); _cli = new CliRunnable(this);
ZThread::Thread t(_cli); ZThread::Thread t(_cli);
} }
if(_error) if(_error)
{ {
logcritical("Errors while initializing!"); logcritical("Errors while initializing!");
return false; return false;
} }
log("Init complete."); log("Init complete.");
_initialized=true; _initialized=true;
return true; return true;
} }
bool PseuInstance::InitGUI(void) bool PseuInstance::InitGUI(void)
{ {
if(GetGUI()) if(GetGUI())
{ {
logerror("GUI: Aborting init, GUI already exists!"); logerror("GUI: Aborting init, GUI already exists!");
return false; return false;
} }
uint16 x,y,depth; uint16 x,y,depth;
uint8 driver; uint8 driver;
bool shadows,vsync,win; bool shadows,vsync,win;
driver=(uint8)atoi(GetScripts()->variables.Get("GUI::DRIVER").c_str()); driver=(uint8)atoi(GetScripts()->variables.Get("GUI::DRIVER").c_str());
vsync=(bool)atoi(GetScripts()->variables.Get("GUI::VSYNC").c_str()); vsync=(bool)atoi(GetScripts()->variables.Get("GUI::VSYNC").c_str());
depth=(uint8)atoi(GetScripts()->variables.Get("GUI::DEPTH").c_str()); depth=(uint8)atoi(GetScripts()->variables.Get("GUI::DEPTH").c_str());
x=(uint16)atoi(GetScripts()->variables.Get("GUI::RESX").c_str()); x=(uint16)atoi(GetScripts()->variables.Get("GUI::RESX").c_str());
y=(uint16)atoi(GetScripts()->variables.Get("GUI::RESY").c_str()); y=(uint16)atoi(GetScripts()->variables.Get("GUI::RESY").c_str());
win=(bool)atoi(GetScripts()->variables.Get("GUI::WINDOWED").c_str()); win=(bool)atoi(GetScripts()->variables.Get("GUI::WINDOWED").c_str());
shadows=(bool)atoi(GetScripts()->variables.Get("GUI::SHADOWS").c_str()); shadows=(bool)atoi(GetScripts()->variables.Get("GUI::SHADOWS").c_str());
log("GUI settings: driver=%u, depth=%u, res=%ux%u, windowed=%u, shadows=%u",driver,depth,x,y,win,shadows); log("GUI settings: driver=%u, depth=%u, res=%ux%u, windowed=%u, shadows=%u",driver,depth,x,y,win,shadows);
if(x>0 && y>0 && (depth==16 || depth==32) && driver>0 && driver<=5) if(x>0 && y>0 && (depth==16 || depth==32) && driver>0 && driver<=5)
{ {
PseuGUIRunnable *rgui = new PseuGUIRunnable(); PseuGUIRunnable *rgui = new PseuGUIRunnable();
_gui = rgui->GetGUI(); _gui = rgui->GetGUI();
_gui->SetInstance(this); _gui->SetInstance(this);
_gui->SetDriver(driver); _gui->SetDriver(driver);
_gui->SetResolution(x,y,depth); _gui->SetResolution(x,y,depth);
_gui->SetVSync(vsync); _gui->SetVSync(vsync);
_gui->UseShadows(shadows); _gui->UseShadows(shadows);
_guithread = new ZThread::Thread(rgui); _guithread = new ZThread::Thread(rgui);
return true; return true;
} }
else else
logerror("GUI: incorrect settings!"); logerror("GUI: incorrect settings!");
return false; return false;
} }
void PseuInstance::Run(void) void PseuInstance::Run(void)
{ {
if(!_initialized) if(!_initialized)
return; return;
logdetail("PseuInstance: Initialized and running!"); logdetail("PseuInstance: Initialized and running!");
if(GetGUI()) if(GetGUI())
{ {
while(!GetGUI()->IsInitialized()) while(!GetGUI()->IsInitialized())
Sleep(1); // wait until the gui is ready. it will crash otherwise Sleep(1); // wait until the gui is ready. it will crash otherwise
logdebug("GUI: switching to startup display..."); logdebug("GUI: switching to startup display...");
GetGUI()->SetSceneState(SCENESTATE_GUISTART); GetGUI()->SetSceneState(SCENESTATE_GUISTART);
} }
// TODO: as soon as username and password can be inputted into the gui, wait until it was set by user. // TODO: as soon as username and password can be inputted into the gui, wait until it was set by user.
if(GetConf()->realmlist.empty() || GetConf()->realmport==0) if(GetConf()->realmlist.empty() || GetConf()->realmport==0)
{ {
logcritical("Realmlist address not set, can't connect."); logcritical("Realmlist address not set, can't connect.");
SetError(); SetError();
} }
else else
{ {
// for now: create the realmsession only on startup. // for now: create the realmsession only on startup.
// may be extended to a script command later on. // may be extended to a script command later on.
// then try to connect // then try to connect
_rsession = new RealmSession(this); _rsession = new RealmSession(this);
_rsession->Connect(); _rsession->Connect();
_rsession->SendLogonChallenge(); _rsession->SendLogonChallenge();
// this is the mainloop // this is the mainloop
while(!_stop) while(!_stop)
{ {
Update(); Update();
if(_error) if(_error)
_stop=true; _stop=true;
} }
} }
// fastquit is defined if we clicked [X] (on windows) // fastquit is defined if we clicked [X] (on windows)
if(_fastquit) if(_fastquit)
{ {
log("Aborting Instance..."); log("Aborting Instance...");
return; return;
} }
log("Shutting down instance..."); log("Shutting down instance...");
// if there was an error, better dont save, as the data might be damaged // if there was an error, better dont save, as the data might be damaged
if(!_error) if(!_error)
{ {
SaveAllCache(); SaveAllCache();
//... //...
} }
if(GetConf()->exitonerror == false && _error) if(GetConf()->exitonerror == false && _error)
{ {
log("Exiting on error is disabled, PseuWoW is now IDLE"); log("Exiting on error is disabled, PseuWoW is now IDLE");
log("-- Press enter to exit --"); log("-- Press enter to exit --");
char crap[100]; char crap[100];
fgets(crap,sizeof(crap),stdin); // workaround, need to press enter 2x for now fgets(crap,sizeof(crap),stdin); // workaround, need to press enter 2x for now
} }
} }
void PseuInstance::Update() void PseuInstance::Update()
{ {
// if the user typed anything into the console, process it before anything else. // if the user typed anything into the console, process it before anything else.
// note that it can also be used for simulated cli commands sent by other threads, so it needs to be checked even if cli is disabled // note that it can also be used for simulated cli commands sent by other threads, so it needs to be checked even if cli is disabled
ProcessCliQueue(); ProcessCliQueue();
// delete sessions if they are no longer needed // delete sessions if they are no longer needed
if(_rsession && _rsession->MustDie()) if(_rsession && _rsession->MustDie())
{ {
delete _rsession; delete _rsession;
_rsession = NULL; _rsession = NULL;
} }
if(_wsession && _wsession->MustDie()) if(_wsession && _wsession->MustDie())
{ {
delete _wsession; delete _wsession;
_wsession = NULL; _wsession = NULL;
} }
if(_createws) if(_createws)
{ {
_createws = false; _createws = false;
if(_wsession) if(_wsession)
delete _wsession; delete _wsession;
_wsession = new WorldSession(this); _wsession = new WorldSession(this);
_wsession->Start(); _wsession->Start();
} }
// if we have no active sessions, we may reconnect // if we have no active sessions, we may reconnect
if((!_rsession) && (!_wsession) && GetConf()->reconnect) if((!_rsession) && (!_wsession) && GetConf()->reconnect)
{ {
logdetail("Waiting %u ms before reconnecting.",GetConf()->reconnect); logdetail("Waiting %u ms before reconnecting.",GetConf()->reconnect);
for(uint32 t = 0; t < GetConf()->reconnect && !this->Stopped(); t+=100) Sleep(100); for(uint32 t = 0; t < GetConf()->reconnect && !this->Stopped(); t+=100) Sleep(100);
this->Sleep(1000); // wait 1 sec before reconnecting this->Sleep(1000); // wait 1 sec before reconnecting
_rsession = new RealmSession(this); _rsession = new RealmSession(this);
_rsession->Connect(); _rsession->Connect();
_rsession->SendLogonChallenge(); // and login again _rsession->SendLogonChallenge(); // and login again
} }
// update currently existing/active sessions // update currently existing/active sessions
if(_rsession) if(_rsession)
_rsession->Update(); _rsession->Update();
if(_wsession) if(_wsession)
try { _wsession->Update(); } catch (...) try { _wsession->Update(); } catch (...)
{ {
logerror("Unhandled exception in WorldSession::Update()"); logerror("Unhandled exception in WorldSession::Update()");
} }
if(_rmcontrol) if(_rmcontrol)
{ {
_rmcontrol->Update(); _rmcontrol->Update();
if(_rmcontrol->MustDie()) if(_rmcontrol->MustDie())
{ {
delete _rmcontrol; delete _rmcontrol;
_rmcontrol = NULL; _rmcontrol = NULL;
} }
} }
GetScripts()->GetEventMgr()->Update(); GetScripts()->GetEventMgr()->Update();
this->Sleep(GetConf()->networksleeptime); this->Sleep(GetConf()->networksleeptime);
} }
void PseuInstance::ProcessCliQueue(void) void PseuInstance::ProcessCliQueue(void)
{ {
std::string cmd; std::string cmd;
while(_cliQueue.size()) while(_cliQueue.size())
{ {
cmd = _cliQueue.next(); cmd = _cliQueue.next();
try try
{ {
GetScripts()->RunSingleLine(cmd); GetScripts()->RunSingleLine(cmd);
} }
catch(...) catch(...)
{ {
logerror("Exception while executing CLI command: \"%s\"",cmd.c_str()); logerror("Exception while executing CLI command: \"%s\"",cmd.c_str());
} }
} }
} }
void PseuInstance::AddCliCommand(std::string cmd) void PseuInstance::AddCliCommand(std::string cmd)
{ {
_cliQueue.add(cmd); _cliQueue.add(cmd);
} }
void PseuInstance::SaveAllCache(void) void PseuInstance::SaveAllCache(void)
{ {
//... //...
if(GetWSession()) if(GetWSession())
{ {
GetWSession()->plrNameCache.SaveToFile(); GetWSession()->plrNameCache.SaveToFile();
ItemProtoCache_WriteDataToCache(GetWSession()); ItemProtoCache_WriteDataToCache(GetWSession());
CreatureTemplateCache_WriteDataToCache(GetWSession()); CreatureTemplateCache_WriteDataToCache(GetWSession());
//... //...
} }
} }
void PseuInstance::Sleep(uint32 msecs) void PseuInstance::Sleep(uint32 msecs)
{ {
GetRunnable()->sleep(msecs); GetRunnable()->sleep(msecs);
} }
void PseuInstance::DeleteGUI(void) void PseuInstance::DeleteGUI(void)
{ {
_gui = NULL; _gui = NULL;
delete _guithread; // since it was allocated with new delete _guithread; // since it was allocated with new
_guithread = NULL; _guithread = NULL;
if(GetScripts()->ScriptExists("_onguiclose")) if(GetScripts()->ScriptExists("_onguiclose"))
AddCliCommand("_onguiclose"); // since this func is called from another thread, use threadsafe variant via CLI AddCliCommand("_onguiclose"); // since this func is called from another thread, use threadsafe variant via CLI
} }
PseuInstanceConf::PseuInstanceConf() PseuInstanceConf::PseuInstanceConf()
{ {
enablecli=false; enablecli=false;
enablegui=false; enablegui=false;
exitonerror=false; exitonerror=false;
debug=0; debug=0;
rmcontrolport=0; rmcontrolport=0;
} }
void PseuInstanceConf::ApplyFromVarSet(VarSet &v) void PseuInstanceConf::ApplyFromVarSet(VarSet &v)
{ {
debug=atoi(v.Get("DEBUG").c_str()); debug=atoi(v.Get("DEBUG").c_str());
realmlist=v.Get("REALMLIST"); realmlist=v.Get("REALMLIST");
accname=v.Get("ACCNAME"); accname=v.Get("ACCNAME");
accpass=v.Get("ACCPASS"); accpass=v.Get("ACCPASS");
exitonerror=(bool)atoi(v.Get("EXITONERROR").c_str()); exitonerror=(bool)atoi(v.Get("EXITONERROR").c_str());
reconnect=atoi(v.Get("RECONNECT").c_str()); reconnect=atoi(v.Get("RECONNECT").c_str());
realmport=atoi(v.Get("REALMPORT").c_str()); realmport=atoi(v.Get("REALMPORT").c_str());
clientversion_string=v.Get("CLIENTVERSION"); clientversion_string=v.Get("CLIENTVERSION");
clientbuild=atoi(v.Get("CLIENTBUILD").c_str()); clientbuild=atoi(v.Get("CLIENTBUILD").c_str());
clientlang=v.Get("CLIENTLANGUAGE"); clientlang=v.Get("CLIENTLANGUAGE");
realmname=v.Get("REALMNAME"); realmname=v.Get("REALMNAME");
charname=v.Get("CHARNAME"); charname=v.Get("CHARNAME");
networksleeptime=atoi(v.Get("NETWORKSLEEPTIME").c_str()); networksleeptime=atoi(v.Get("NETWORKSLEEPTIME").c_str());
showopcodes=atoi(v.Get("SHOWOPCODES").c_str()); showopcodes=atoi(v.Get("SHOWOPCODES").c_str());
hidefreqopcodes=(bool)atoi(v.Get("HIDEFREQOPCODES").c_str()); hidefreqopcodes=(bool)atoi(v.Get("HIDEFREQOPCODES").c_str());
hideDisabledOpcodes=(bool)atoi(v.Get("HIDEDISABLEDOPCODES").c_str()); hideDisabledOpcodes=(bool)atoi(v.Get("HIDEDISABLEDOPCODES").c_str());
enablecli=(bool)atoi(v.Get("ENABLECLI").c_str()); enablecli=(bool)atoi(v.Get("ENABLECLI").c_str());
allowgamecmd=(bool)atoi(v.Get("ALLOWGAMECMD").c_str()); allowgamecmd=(bool)atoi(v.Get("ALLOWGAMECMD").c_str());
enablechatai=(bool)atoi(v.Get("ENABLECHATAI").c_str()); enablechatai=(bool)atoi(v.Get("ENABLECHATAI").c_str());
notifyping=(bool)atoi(v.Get("NOTIFYPING").c_str()); notifyping=(bool)atoi(v.Get("NOTIFYPING").c_str());
showmyopcodes=(bool)atoi(v.Get("SHOWMYOPCODES").c_str()); showmyopcodes=(bool)atoi(v.Get("SHOWMYOPCODES").c_str());
disablespellcheck=(bool)atoi(v.Get("DISABLESPELLCHECK").c_str()); disablespellcheck=(bool)atoi(v.Get("DISABLESPELLCHECK").c_str());
enablegui=(bool)atoi(v.Get("ENABLEGUI").c_str()); enablegui=(bool)atoi(v.Get("ENABLEGUI").c_str());
rmcontrolport=atoi(v.Get("RMCONTROLPORT").c_str()); rmcontrolport=atoi(v.Get("RMCONTROLPORT").c_str());
rmcontrolhost=v.Get("RMCONTROLHOST"); rmcontrolhost=v.Get("RMCONTROLHOST");
useMaps=(bool)atoi(v.Get("USEMAPS").c_str()); useMaps=(bool)atoi(v.Get("USEMAPS").c_str());
skipaddonchat=(bool)atoi(v.Get("SKIPADDONCHAT").c_str()); skipaddonchat=(bool)atoi(v.Get("SKIPADDONCHAT").c_str());
// clientversion is a bit more complicated to add // clientversion is a bit more complicated to add
{ {
std::string opt=clientversion_string + "."; std::string opt=clientversion_string + ".";
std::string num; std::string num;
uint8 p=0; uint8 p=0;
for(uint8 i=0;i<opt.length();i++) for(uint8 i=0;i<opt.length();i++)
{ {
if(!isdigit(opt.at(i))) if(!isdigit(opt.at(i)))
{ {
clientversion[p]=(unsigned char)atoi(num.c_str()); clientversion[p]=(unsigned char)atoi(num.c_str());
num.clear(); num.clear();
p++; p++;
if(p>2) if(p>2)
break; break;
continue; continue;
} }
num+=opt.at(i); num+=opt.at(i);
} }
} }
log_setloglevel(debug); log_setloglevel(debug);
} }
PseuInstanceConf::~PseuInstanceConf() PseuInstanceConf::~PseuInstanceConf()
{ {
//... //...
} }

View File

@ -1,145 +1,145 @@
#ifndef _PSEUWOW_H #ifndef _PSEUWOW_H
#define _PSEUWOW_H #define _PSEUWOW_H
#include "common.h" #include "common.h"
#include "HelperDefs.h" #include "HelperDefs.h"
#include "log.h" #include "log.h"
#include "Auth/BigNumber.h" #include "Auth/BigNumber.h"
#include "DefScript/DefScript.h" #include "DefScript/DefScript.h"
#include "Network/SocketHandler.h" #include "Network/SocketHandler.h"
#include "SCPDatabase.h" #include "SCPDatabase.h"
#include "GUI/PseuGUI.h" #include "GUI/PseuGUI.h"
class RealmSession; class RealmSession;
class WorldSession; class WorldSession;
class Sockethandler; class Sockethandler;
class PseuInstanceRunnable; class PseuInstanceRunnable;
class CliRunnable; class CliRunnable;
class RemoteController; class RemoteController;
class PseuInstanceConf class PseuInstanceConf
{ {
public: public:
PseuInstanceConf(); PseuInstanceConf();
~PseuInstanceConf(); ~PseuInstanceConf();
void ApplyFromVarSet(VarSet &v); void ApplyFromVarSet(VarSet &v);
uint8 debug; uint8 debug;
std::string realmlist; std::string realmlist;
std::string accname; std::string accname;
std::string accpass; std::string accpass;
bool exitonerror; bool exitonerror;
uint32 reconnect; uint32 reconnect;
uint16 realmport; uint16 realmport;
uint16 worldport; uint16 worldport;
uint8 clientversion[3]; uint8 clientversion[3];
std::string clientversion_string; std::string clientversion_string;
uint16 clientbuild; uint16 clientbuild;
std::string clientlang; std::string clientlang;
std::string realmname; std::string realmname;
std::string charname; std::string charname;
std::string worldhost; std::string worldhost;
uint16 networksleeptime; uint16 networksleeptime;
uint8 showopcodes; uint8 showopcodes;
bool hidefreqopcodes; bool hidefreqopcodes;
bool hideDisabledOpcodes; bool hideDisabledOpcodes;
bool allowgamecmd; bool allowgamecmd;
bool enablecli; bool enablecli;
bool enablechatai; bool enablechatai;
bool notifyping; bool notifyping;
bool showmyopcodes; bool showmyopcodes;
bool disablespellcheck; bool disablespellcheck;
uint32 rmcontrolport; uint32 rmcontrolport;
std::string rmcontrolhost; std::string rmcontrolhost;
bool useMaps; bool useMaps;
bool skipaddonchat; bool skipaddonchat;
// gui related // gui related
bool enablegui; bool enablegui;
// need more here // need more here
}; };
class PseuInstance class PseuInstance
{ {
public: public:
PseuInstance(PseuInstanceRunnable *run); PseuInstance(PseuInstanceRunnable *run);
~PseuInstance(); ~PseuInstance();
inline WorldSession *GetWSession(void) { return _wsession; } inline WorldSession *GetWSession(void) { return _wsession; }
inline RealmSession *GetRSession(void) { return _rsession; } inline RealmSession *GetRSession(void) { return _rsession; }
inline PseuInstanceConf *GetConf(void) { return _conf; } inline PseuInstanceConf *GetConf(void) { return _conf; }
inline DefScriptPackage *GetScripts(void) { return _scp; } inline DefScriptPackage *GetScripts(void) { return _scp; }
inline PseuInstanceRunnable *GetRunnable(void) { return _runnable; } inline PseuInstanceRunnable *GetRunnable(void) { return _runnable; }
inline PseuGUI *GetGUI(void) { return _gui; } inline PseuGUI *GetGUI(void) { return _gui; }
void DeleteGUI(void); void DeleteGUI(void);
inline void SetConfDir(std::string dir) { _confdir = dir; } inline void SetConfDir(std::string dir) { _confdir = dir; }
inline std::string GetConfDir(void) { return _confdir; } inline std::string GetConfDir(void) { return _confdir; }
inline void SetScpDir(std::string dir) { _scpdir = dir; } inline void SetScpDir(std::string dir) { _scpdir = dir; }
inline void SetSessionKey(BigNumber key) { _sessionkey = key; } inline void SetSessionKey(BigNumber key) { _sessionkey = key; }
inline BigNumber *GetSessionKey(void) { return &_sessionkey; } inline BigNumber *GetSessionKey(void) { return &_sessionkey; }
inline void SetError(void) { _error = true; } inline void SetError(void) { _error = true; }
SCPDatabaseMgr dbmgr; SCPDatabaseMgr dbmgr;
bool Init(void); bool Init(void);
bool InitGUI(void); bool InitGUI(void);
void SaveAllCache(void); void SaveAllCache(void);
inline void Stop(void) { _stop = true; } inline void Stop(void) { _stop = true; }
inline bool Stopped(void) { return _stop; } inline bool Stopped(void) { return _stop; }
inline void SetFastQuit(bool q=true) { _fastquit=true; } inline void SetFastQuit(bool q=true) { _fastquit=true; }
void Run(void); void Run(void);
void Update(void); void Update(void);
void Sleep(uint32 msecs); void Sleep(uint32 msecs);
inline void CreateWorldSession(void) { _createws = true; } inline void CreateWorldSession(void) { _createws = true; }
void ProcessCliQueue(void); void ProcessCliQueue(void);
void AddCliCommand(std::string); void AddCliCommand(std::string);
private: private:
PseuInstanceRunnable *_runnable; PseuInstanceRunnable *_runnable;
RealmSession *_rsession; RealmSession *_rsession;
WorldSession *_wsession; WorldSession *_wsession;
PseuInstanceConf *_conf; PseuInstanceConf *_conf;
DefScriptPackage *_scp; DefScriptPackage *_scp;
std::string _confdir,_scpdir; // _scpdir is the scripts dir, and NOT where SCP files are stored!! std::string _confdir,_scpdir; // _scpdir is the scripts dir, and NOT where SCP files are stored!!
bool _initialized; bool _initialized;
bool _stop,_fastquit; bool _stop,_fastquit;
bool _startrealm; bool _startrealm;
bool _error; bool _error;
bool _createws; bool _createws;
BigNumber _sessionkey; BigNumber _sessionkey;
char *_ver,*_ver_short; char *_ver,*_ver_short;
SocketHandler _sh; SocketHandler _sh;
CliRunnable *_cli; CliRunnable *_cli;
ZThread::Thread _clithread; ZThread::Thread _clithread;
RemoteController *_rmcontrol; RemoteController *_rmcontrol;
ZThread::LockedQueue<std::string,ZThread::FastMutex> _cliQueue; ZThread::LockedQueue<std::string,ZThread::FastMutex> _cliQueue;
PseuGUI *_gui; PseuGUI *_gui;
ZThread::Thread *_guithread; ZThread::Thread *_guithread;
}; };
class PseuInstanceRunnable : public ZThread::Runnable class PseuInstanceRunnable : public ZThread::Runnable
{ {
public: public:
PseuInstanceRunnable(); PseuInstanceRunnable();
void run(void); void run(void);
void sleep(uint32); void sleep(uint32);
inline PseuInstance *GetInstance(void) { return _i; } inline PseuInstance *GetInstance(void) { return _i; }
private: private:
PseuInstance *_i; PseuInstance *_i;
}; };
#endif #endif

View File

@ -1,71 +1,71 @@
// Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
// //
#include "resource.h" #include "resource.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// German (Germany) resources // German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32 #ifdef _WIN32
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32 #endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Icon // Icon
// //
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_ICON1 ICON "Pseu1.ico" IDI_ICON1 ICON "Pseu1.ico"
#endif // German (Germany) resources #endif // German (Germany) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32 #ifdef _WIN32
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32 #endif //_WIN32
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// TEXTINCLUDE // TEXTINCLUDE
// //
1 TEXTINCLUDE 1 TEXTINCLUDE
BEGIN BEGIN
"resource.h\0" "resource.h\0"
END END
2 TEXTINCLUDE 2 TEXTINCLUDE
BEGIN BEGIN
"\0" "\0"
END END
3 TEXTINCLUDE 3 TEXTINCLUDE
BEGIN BEGIN
"\r\n" "\r\n"
"\0" "\0"
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources #endif // English (U.S.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Generated from the TEXTINCLUDE 3 resource. // Generated from the TEXTINCLUDE 3 resource.
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED

File diff suppressed because it is too large Load Diff

View File

@ -1,96 +1,96 @@
#include "common.h" #include "common.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "ByteBuffer.h" #include "ByteBuffer.h"
#include "RealmSession.h" #include "RealmSession.h"
#include "RealmSocket.h" #include "RealmSocket.h"
#include "Network/Utility.h" #include "Network/Utility.h"
RealmSocket::RealmSocket(SocketHandler& h) : TcpSocket(h) RealmSocket::RealmSocket(SocketHandler& h) : TcpSocket(h)
{ {
_session = NULL; _session = NULL;
_ok = false; _ok = false;
} }
RealmSocket::~RealmSocket() RealmSocket::~RealmSocket()
{ {
this->Close(); this->Close();
} }
bool RealmSocket::IsOk(void) bool RealmSocket::IsOk(void)
{ {
return _ok; return _ok;
} }
void RealmSocket::SetSession(RealmSession *rs) void RealmSocket::SetSession(RealmSession *rs)
{ {
_session = rs; _session = rs;
} }
int RealmSocket::Close(void) int RealmSocket::Close(void)
{ {
_ok = false; _ok = false;
return TcpSocket::Close(); return TcpSocket::Close();
} }
void RealmSocket::OnRead(void) void RealmSocket::OnRead(void)
{ {
TcpSocket::OnRead(); TcpSocket::OnRead();
uint32 len = ibuf.GetLength(); uint32 len = ibuf.GetLength();
logdev("RealmSocket::OnRead() %u bytes",len); logdev("RealmSocket::OnRead() %u bytes",len);
if(!len) if(!len)
return; return;
ByteBuffer *pkt = new ByteBuffer(len); ByteBuffer *pkt = new ByteBuffer(len);
uint8* data = new uint8[len]; uint8* data = new uint8[len];
ibuf.Read((char*)data,len); ibuf.Read((char*)data,len);
pkt->append(data,len); pkt->append(data,len);
delete [] data; delete [] data;
_session->AddToPktQueue(pkt); _session->AddToPktQueue(pkt);
} }
RealmSession *RealmSocket::GetSession(void) RealmSession *RealmSocket::GetSession(void)
{ {
return _session; return _session;
} }
void RealmSocket::OnAccept(void) void RealmSocket::OnAccept(void)
{ {
logdev("RealmSocket accepted."); logdev("RealmSocket accepted.");
} }
void RealmSocket::OnConnect(void) void RealmSocket::OnConnect(void)
{ {
logdetail("RealmSocket connected!"); logdetail("RealmSocket connected!");
_ok = true; _ok = true;
} }
void RealmSocket::OnConnectFailed(void) void RealmSocket::OnConnectFailed(void)
{ {
logerror("Connecting to Realm failed!"); logerror("Connecting to Realm failed!");
_ok = false; _ok = false;
} }
void RealmSocket::OnException(void) void RealmSocket::OnException(void)
{ {
if(_ok) if(_ok)
{ {
logerror("RealmSocket: Exception!"); logerror("RealmSocket: Exception!");
_ok = false; _ok = false;
} }
} }
void RealmSocket::OnDelete(void) void RealmSocket::OnDelete(void)
{ {
_ok = false; _ok = false;
_session->SetMustDie(); _session->SetMustDie();
} }
uint32 RealmSocket::GetMyIP(void) uint32 RealmSocket::GetMyIP(void)
{ {
return GetRemoteIP4(); return GetRemoteIP4();
} }

View File

@ -1,38 +1,38 @@
#include "common.h" #include "common.h"
#include "log.h" #include "log.h"
#include "ControlSocket.h" #include "ControlSocket.h"
#include "Network/ListenSocket.h" #include "Network/ListenSocket.h"
#include "RemoteController.h" #include "RemoteController.h"
RemoteController::RemoteController(PseuInstance *in,uint32 port) RemoteController::RemoteController(PseuInstance *in,uint32 port)
{ {
DEBUG(logdebug("RemoteController: setting instance = %X",in)); DEBUG(logdebug("RemoteController: setting instance = %X",in));
h.SetInstance(in); h.SetInstance(in);
_mustdie = false; _mustdie = false;
_instance = in; _instance = in;
ListenSocket<ControlSocket> *ls = new ListenSocket<ControlSocket>(h); ListenSocket<ControlSocket> *ls = new ListenSocket<ControlSocket>(h);
if(ls->Bind(port)) if(ls->Bind(port))
{ {
logerror("RemoteController: Can't bind to port %u",port); logerror("RemoteController: Can't bind to port %u",port);
_mustdie = true; _mustdie = true;
return; return;
} }
h.Add(ls); h.Add(ls);
log("RemoteController: listening on port %u",port); log("RemoteController: listening on port %u",port);
} }
RemoteController::~RemoteController() RemoteController::~RemoteController()
{ {
DEBUG(logdebug("~RemoteController()")); DEBUG(logdebug("~RemoteController()"));
} }
void RemoteController::Update(void) void RemoteController::Update(void)
{ {
if(_mustdie) if(_mustdie)
return; return;
h.Select(0,0); h.Select(0,0);
} }

View File

@ -1,210 +1,210 @@
#include <fstream> #include <fstream>
#include "common.h" #include "common.h"
#include "SCPDatabase.h" #include "SCPDatabase.h"
uint32 SCPDatabase::LoadFromFile(char *fn) uint32 SCPDatabase::LoadFromFile(char *fn)
{ {
std::fstream fh; std::fstream fh;
uint32 size = GetFileSize(fn); uint32 size = GetFileSize(fn);
if(!size) if(!size)
return 0; return 0;
fh.open(fn,std::ios_base::in | std::ios_base::binary); fh.open(fn,std::ios_base::in | std::ios_base::binary);
if( !fh.is_open() ) if( !fh.is_open() )
return 0; return 0;
char *buf = new char[size]; char *buf = new char[size];
fh.read(buf,size); fh.read(buf,size);
fh.close(); fh.close();
uint32 sections = LoadFromMem(buf,size); uint32 sections = LoadFromMem(buf,size);
delete [] buf; delete [] buf;
return sections; return sections;
} }
uint32 SCPDatabase::LoadFromMem(char *buf, uint32 size) uint32 SCPDatabase::LoadFromMem(char *buf, uint32 size)
{ {
std::string line,value,entry,storage; std::string line,value,entry,storage;
uint32 id=0,sections=0; uint32 id=0,sections=0;
for(uint32 pos = 0; pos < size; pos++) for(uint32 pos = 0; pos < size; pos++)
{ {
if(buf[pos] == '\n') if(buf[pos] == '\n')
{ {
if(line.empty()) if(line.empty())
continue; continue;
while(line[0]==' ' || line[0]=='\t') while(line[0]==' ' || line[0]=='\t')
line.erase(0,1); line.erase(0,1);
if(line.empty() || (line.length() > 1 && (line[0]=='#' || (line[0]=='/' && line[1]=='/'))) ) if(line.empty() || (line.length() > 1 && (line[0]=='#' || (line[0]=='/' && line[1]=='/'))) )
{ {
line.clear(); line.clear();
continue; continue;
} }
if(line[line.size()-1] == 13 || line[line.size()-1] == 10) // this fixes the annoying newline problems on windows + binary mode if(line[line.size()-1] == 13 || line[line.size()-1] == 10) // this fixes the annoying newline problems on windows + binary mode
line[line.size()-1] = 0; line[line.size()-1] = 0;
if(line[0]=='[') if(line[0]=='[')
{ {
id=(uint32)toInt(line.c_str()+1); // start reading after '[' id=(uint32)toInt(line.c_str()+1); // start reading after '['
sections++; sections++;
} }
else else
{ {
uint32 pos=line.find("="); uint32 pos=line.find("=");
if(pos!=std::string::npos) if(pos!=std::string::npos)
{ {
entry=stringToLower(line.substr(0,pos)); entry=stringToLower(line.substr(0,pos));
value=line.substr(pos+1,line.length()-1); value=line.substr(pos+1,line.length()-1);
_map[id].Set(entry,value); _map[id].Set(entry,value);
} }
// else invalid line, must have '=' // else invalid line, must have '='
} }
line.clear(); line.clear();
} }
else else
line += buf[pos]; // fill up line until a newline is reached (see above) line += buf[pos]; // fill up line until a newline is reached (see above)
} }
return sections; return sections;
} }
bool SCPDatabase::HasField(uint32 id) bool SCPDatabase::HasField(uint32 id)
{ {
for(SCPFieldMap::iterator i = _map.begin(); i != _map.end(); i++) for(SCPFieldMap::iterator i = _map.begin(); i != _map.end(); i++)
if(i->first == id) if(i->first == id)
return true; return true;
return false; return false;
} }
bool SCPField::HasEntry(std::string e) bool SCPField::HasEntry(std::string e)
{ {
for(SCPEntryMap::iterator i = _map.begin(); i != _map.end(); i++) for(SCPEntryMap::iterator i = _map.begin(); i != _map.end(); i++)
{ {
std::string ch = i->first; std::string ch = i->first;
if(ch == e) if(ch == e)
return true; return true;
} }
return false; return false;
} }
std::string SCPField::GetString(std::string entry) std::string SCPField::GetString(std::string entry)
{ {
//return HasEntry(entry) ? _map[entry] : ""; //return HasEntry(entry) ? _map[entry] : "";
return _map[entry]; return _map[entry];
} }
// note that this can take a while depending on the size of the database! // note that this can take a while depending on the size of the database!
uint32 SCPDatabase::GetFieldByValue(std::string entry, std::string value) uint32 SCPDatabase::GetFieldByValue(std::string entry, std::string value)
{ {
for(SCPFieldMap::iterator fm = _map.begin(); fm != _map.end(); fm++) for(SCPFieldMap::iterator fm = _map.begin(); fm != _map.end(); fm++)
if(fm->second.HasEntry(entry) && fm->second.GetString(entry)==value) if(fm->second.HasEntry(entry) && fm->second.GetString(entry)==value)
return fm->first; return fm->first;
return uint32(-1); return uint32(-1);
} }
bool SCPDatabaseMgr::HasDB(std::string n) bool SCPDatabaseMgr::HasDB(std::string n)
{ {
for(SCPDatabaseMap::iterator i = _map.begin(); i != _map.end(); i++) for(SCPDatabaseMap::iterator i = _map.begin(); i != _map.end(); i++)
if(i->first == n) if(i->first == n)
return true; return true;
return false; return false;
} }
SCPDatabase& SCPDatabaseMgr::GetDB(std::string n) SCPDatabase& SCPDatabaseMgr::GetDB(std::string n)
{ {
return _map[n]; return _map[n];
} }
uint32 SCPDatabaseMgr::AutoLoadFile(char *fn) uint32 SCPDatabaseMgr::AutoLoadFile(char *fn)
{ {
std::fstream fh; std::fstream fh;
uint32 size = GetFileSize(fn); uint32 size = GetFileSize(fn);
if(!size) if(!size)
return 0; return 0;
fh.open(fn,std::ios_base::in | std::ios_base::binary); fh.open(fn,std::ios_base::in | std::ios_base::binary);
if( !fh.is_open() ) if( !fh.is_open() )
return 0; return 0;
char *buf = new char[size]; char *buf = new char[size];
fh.read(buf,size); fh.read(buf,size);
fh.close(); fh.close();
std::string line,dbname; std::string line,dbname;
for(uint32 pos = 0; pos < size; pos++) for(uint32 pos = 0; pos < size; pos++)
{ {
if(buf[pos] == '\n') if(buf[pos] == '\n')
{ {
if(line.empty()) if(line.empty())
continue; continue;
while(line[0]==' ' || line[0]=='\t') while(line[0]==' ' || line[0]=='\t')
line.erase(0,1); line.erase(0,1);
if(line[0] == '#') if(line[0] == '#')
{ {
uint32 eq = line.find("="); uint32 eq = line.find("=");
if(eq != std::string::npos) if(eq != std::string::npos)
{ {
std::string info = stringToLower(line.substr(0,pos)); std::string info = stringToLower(line.substr(0,pos));
std::string value = stringToLower(line.substr(pos+1,line.length()-1)); std::string value = stringToLower(line.substr(pos+1,line.length()-1));
if(info == "#dbname") if(info == "#dbname")
{ {
dbname = value; dbname = value;
break; break;
} }
} }
} }
} }
else else
line += buf[pos]; line += buf[pos];
} }
delete [] buf; delete [] buf;
if(dbname.empty()) if(dbname.empty())
return 0; return 0;
uint32 sections = GetDB(dbname).LoadFromMem(buf,size); uint32 sections = GetDB(dbname).LoadFromMem(buf,size);
return sections; return sections;
} }
// -- helper functions -- // // -- helper functions -- //
std::string SCPDatabaseMgr::GetZoneName(uint32 id) std::string SCPDatabaseMgr::GetZoneName(uint32 id)
{ {
return GetDB("zone").GetField(id).GetString("name"); return GetDB("zone").GetField(id).GetString("name");
} }
std::string SCPDatabaseMgr::GetRaceName(uint32 id) std::string SCPDatabaseMgr::GetRaceName(uint32 id)
{ {
std::string r = GetDB("race").GetField(id).GetString("name"); std::string r = GetDB("race").GetField(id).GetString("name");
//if(r.empty()) //if(r.empty())
// r = raceName[id]; // r = raceName[id];
return r; return r;
} }
std::string SCPDatabaseMgr::GetMapName(uint32 id) std::string SCPDatabaseMgr::GetMapName(uint32 id)
{ {
return GetDB("map").GetField(id).GetString("name"); return GetDB("map").GetField(id).GetString("name");
} }
std::string SCPDatabaseMgr::GetClassName_(uint32 id) std::string SCPDatabaseMgr::GetClassName_(uint32 id)
{ {
std::string r = GetDB("class").GetField(id).GetString("name"); std::string r = GetDB("class").GetField(id).GetString("name");
//if(r.empty()) //if(r.empty())
// r = className[id]; // r = className[id];
return r; return r;
} }
std::string SCPDatabaseMgr::GetGenderName(uint32 id) std::string SCPDatabaseMgr::GetGenderName(uint32 id)
{ {
return GetDB("gender").GetField(id).GetString("name"); return GetDB("gender").GetField(id).GetString("name");
} }
std::string SCPDatabaseMgr::GetLangName(uint32 id) std::string SCPDatabaseMgr::GetLangName(uint32 id)
{ {
std::string r = GetDB("language").GetField(id).GetString("name"); std::string r = GetDB("language").GetField(id).GetString("name");
//if(r.empty()) //if(r.empty())
// r = LookupName(id,langNames); // r = LookupName(id,langNames);
return r; return r;
} }

View File

@ -1,116 +1,116 @@
#ifndef _SCPDATABASE_H #ifndef _SCPDATABASE_H
#define _SCPDATABASE_H #define _SCPDATABASE_H
#include <map> #include <map>
/* /*
* Some preparations for compiled databases. i will continue this later. [FG] * Some preparations for compiled databases. i will continue this later. [FG]
enum SCPTypes enum SCPTypes
{ {
SCP_TYPE_STRING = 0, SCP_TYPE_STRING = 0,
SCP_TYPE_INT, SCP_TYPE_INT,
SCP_TYPE_UINT, SCP_TYPE_UINT,
SCP_TYPE_FLOAT SCP_TYPE_FLOAT
}; };
class SCPEntry class SCPEntry
{ {
private: private:
char *str; char *str;
public: public:
SCPEntry() { str = NULL; } SCPEntry() { str = NULL; }
~SCPEntry() { if(str) delete [] str; } ~SCPEntry() { if(str) delete [] str; }
union union
{ {
int32 intvalue int32 intvalue
uint32 uintvalue; uint32 uintvalue;
float floatvalue; float floatvalue;
}; };
inline char *GetString(uint8 type) inline char *GetString(uint8 type)
{ {
if(str) if(str)
return str; return str;
else else
{ {
char buf[25]; char buf[25];
char *fmt; char *fmt;
switch (type) switch (type)
{ {
case SCP_TYPE_INT: sprintf(buf,"%d",intvalue); break; case SCP_TYPE_INT: sprintf(buf,"%d",intvalue); break;
case SCP_TYPE_UINT: sprintf(buf,"%u",uintvalue); break; case SCP_TYPE_UINT: sprintf(buf,"%u",uintvalue); break;
case SCP_TYPE_FLOAT: sprintf(buf,"%f",floatvalue); break; case SCP_TYPE_FLOAT: sprintf(buf,"%f",floatvalue); break;
} }
str = new char[strlen(buf) + 1]; str = new char[strlen(buf) + 1];
memcpy(str,buf,strlen(buf) + 1); memcpy(str,buf,strlen(buf) + 1);
return str; return str;
} }
} }
}; };
*/ */
typedef std::map<std::string,std::string> SCPEntryMap; typedef std::map<std::string,std::string> SCPEntryMap;
class SCPField class SCPField
{ {
public: public:
std::string GetString(std::string); std::string GetString(std::string);
inline uint64 GetInteger(std::string entry) { return toInt(GetString(entry)); } inline uint64 GetInteger(std::string entry) { return toInt(GetString(entry)); }
inline double GetDouble(std::string entry) { return strtod(GetString(entry).c_str(),NULL); } inline double GetDouble(std::string entry) { return strtod(GetString(entry).c_str(),NULL); }
inline void Set(std::string entry,std::string value) { _map[entry]=value; } inline void Set(std::string entry,std::string value) { _map[entry]=value; }
bool HasEntry(std::string); bool HasEntry(std::string);
private: private:
SCPEntryMap _map; SCPEntryMap _map;
}; };
typedef std::map<uint32,SCPField> SCPFieldMap; typedef std::map<uint32,SCPField> SCPFieldMap;
class SCPDatabase class SCPDatabase
{ {
public: public:
inline SCPField& GetField(uint32 id) { return _map[id]; } inline SCPField& GetField(uint32 id) { return _map[id]; }
bool HasField(uint32 id); bool HasField(uint32 id);
uint32 LoadFromFile(char*); uint32 LoadFromFile(char*);
uint32 LoadFromMem(char*,uint32); uint32 LoadFromMem(char*,uint32);
uint32 GetFieldByValue(std::string entry, std::string value); uint32 GetFieldByValue(std::string entry, std::string value);
private: private:
SCPFieldMap _map; SCPFieldMap _map;
}; };
typedef std::map<std::string,SCPDatabase> SCPDatabaseMap; typedef std::map<std::string,SCPDatabase> SCPDatabaseMap;
class SCPDatabaseMgr class SCPDatabaseMgr
{ {
public: public:
bool HasDB(std::string); bool HasDB(std::string);
SCPDatabase& GetDB(std::string); SCPDatabase& GetDB(std::string);
uint32 AutoLoadFile(char *fn); uint32 AutoLoadFile(char *fn);
inline void DropDB(std::string s) { _map.erase(stringToLower(s)); } inline void DropDB(std::string s) { _map.erase(stringToLower(s)); }
////////////////////// //////////////////////
// helper functions // // helper functions //
////////////////////// //////////////////////
std::string GetZoneName(uint32 id); std::string GetZoneName(uint32 id);
std::string GetRaceName(uint32 id); std::string GetRaceName(uint32 id);
std::string GetClassName_(uint32 id); std::string GetClassName_(uint32 id);
std::string GetGenderName(uint32 id); std::string GetGenderName(uint32 id);
std::string GetMapName(uint32 id); std::string GetMapName(uint32 id);
std::string GetLangName(uint32 id); std::string GetLangName(uint32 id);
private: private:
SCPDatabaseMap _map; SCPDatabaseMap _map;
}; };
#endif #endif

View File

@ -1,18 +1,18 @@
#ifndef _BAG_H #ifndef _BAG_H
#define _BAG_H #define _BAG_H
#include "common.h" #include "common.h"
#include "Item.h" #include "Item.h"
class Bag : public Item class Bag : public Item
{ {
public: public:
Bag(); Bag();
void Create(uint64); void Create(uint64);
private: private:
}; };
#endif #endif

View File

@ -1,196 +1,196 @@
#include "common.h" #include "common.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "WorldPacket.h" #include "WorldPacket.h"
#include "Opcodes.h" #include "Opcodes.h"
#include "Player.h" #include "Player.h"
#include "WorldSession.h" #include "WorldSession.h"
#include "Channel.h" #include "Channel.h"
void WorldSession::SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to) void WorldSession::SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to)
{ {
if((!_logged) || msg.empty()) if((!_logged) || msg.empty())
return; return;
WorldPacket packet; WorldPacket packet;
packet << type << lang; packet << type << lang;
switch(type){ switch(type){
case CHAT_MSG_WHISPER: case CHAT_MSG_WHISPER:
if(to.empty()) if(to.empty())
return; return;
packet << to << msg; packet << to << msg;
break; break;
case CHAT_MSG_CHANNEL: case CHAT_MSG_CHANNEL:
if(to.empty() /*|| !_channels->IsOnChannel(to)*/) if(to.empty() /*|| !_channels->IsOnChannel(to)*/)
return; return;
packet << to << msg; packet << to << msg;
break; break;
default: default:
packet << msg; packet << msg;
} }
packet.SetOpcode(CMSG_MESSAGECHAT); packet.SetOpcode(CMSG_MESSAGECHAT);
SendWorldPacket(packet); SendWorldPacket(packet);
} }
void WorldSession::SendQueryPlayerName(uint64 guid) void WorldSession::SendQueryPlayerName(uint64 guid)
{ {
if((!_logged) || guid==0) if((!_logged) || guid==0)
return; return;
WorldPacket packet; WorldPacket packet;
packet << guid; packet << guid;
packet.SetOpcode(CMSG_NAME_QUERY); packet.SetOpcode(CMSG_NAME_QUERY);
SendWorldPacket(packet); SendWorldPacket(packet);
// to prevent opcode spam, we need to make a list with already requested names // to prevent opcode spam, we need to make a list with already requested names
} }
void WorldSession::SendPing(uint32 ping) void WorldSession::SendPing(uint32 ping)
{ {
if(!_logged) if(!_logged)
return; return;
WorldPacket packet; WorldPacket packet;
packet << ping; packet << ping;
packet << GetLagMS(); packet << GetLagMS();
packet.SetOpcode(CMSG_PING); packet.SetOpcode(CMSG_PING);
SendWorldPacket(packet); SendWorldPacket(packet);
} }
void WorldSession::SendEmote(uint32 id) void WorldSession::SendEmote(uint32 id)
{ {
if(!_logged) if(!_logged)
return; return;
WorldPacket packet; WorldPacket packet;
int32 variation = 0; // randomized usually int32 variation = 0; // randomized usually
packet << id << (uint32)variation << GetMyChar()->GetTarget(); packet << id << (uint32)variation << GetMyChar()->GetTarget();
packet.SetOpcode(CMSG_TEXT_EMOTE); packet.SetOpcode(CMSG_TEXT_EMOTE);
SendWorldPacket(packet); SendWorldPacket(packet);
} }
void WorldSession::SendQueryItem(uint32 entry, uint64 guid) // is it a guid? not sure void WorldSession::SendQueryItem(uint32 entry, uint64 guid) // is it a guid? not sure
{ {
if(objmgr.ItemNonExistent(entry)) if(objmgr.ItemNonExistent(entry))
{ {
logdebug("Skipped query of item %u (was marked as nonexistent before)",entry); logdebug("Skipped query of item %u (was marked as nonexistent before)",entry);
return; return;
} }
logdebug("Sending Item query, id=%u",entry); logdebug("Sending Item query, id=%u",entry);
WorldPacket packet; WorldPacket packet;
packet << entry << guid; packet << entry << guid;
packet.SetOpcode(CMSG_ITEM_QUERY_SINGLE); packet.SetOpcode(CMSG_ITEM_QUERY_SINGLE);
SendWorldPacket(packet); SendWorldPacket(packet);
} }
// use ONLY this function to target objects and notify the server about it. // use ONLY this function to target objects and notify the server about it.
// (server & client need to stay synced) // (server & client need to stay synced)
void WorldSession::SendSetSelection(uint64 guid) void WorldSession::SendSetSelection(uint64 guid)
{ {
ASSERT(GetMyChar()) // we need to be logged in to select something ASSERT(GetMyChar()) // we need to be logged in to select something
if(guid==GetMyChar()->GetTarget()) if(guid==GetMyChar()->GetTarget())
return; // no need to select already selected target return; // no need to select already selected target
GetMyChar()->SetTarget(guid); GetMyChar()->SetTarget(guid);
logdebug("SetSelection GUID="I64FMT,guid); logdebug("SetSelection GUID="I64FMT,guid);
WorldPacket packet; WorldPacket packet;
packet << guid; packet << guid;
packet.SetOpcode(CMSG_SET_SELECTION); packet.SetOpcode(CMSG_SET_SELECTION);
SendWorldPacket(packet); SendWorldPacket(packet);
} }
void WorldSession::SendCastSpell(uint32 spellid, bool nocheck) void WorldSession::SendCastSpell(uint32 spellid, bool nocheck)
{ {
if(!spellid) if(!spellid)
return; return;
MyCharacter *my = GetMyChar(); MyCharacter *my = GetMyChar();
bool known = nocheck ? true : my->HasSpell(spellid); bool known = nocheck ? true : my->HasSpell(spellid);
//-- TEMP FIX --// TODO: need a list of spells that is excluded from the check and can always be casted. //-- TEMP FIX --// TODO: need a list of spells that is excluded from the check and can always be casted.
// settable via DefScript? // settable via DefScript?
if(spellid==836) if(spellid==836)
known=true; known=true;
if( (!known) && (!GetInstance()->GetConf()->disablespellcheck) ) if( (!known) && (!GetInstance()->GetConf()->disablespellcheck) )
{ {
logerror("Attempt to cast not-known spell %u",spellid); logerror("Attempt to cast not-known spell %u",spellid);
return; return;
} }
Object *target = objmgr.GetObj(my->GetTarget()); Object *target = objmgr.GetObj(my->GetTarget());
//if(!target) // this is wrong, some spells dont require a target (areaspells, self-only spells) //if(!target) // this is wrong, some spells dont require a target (areaspells, self-only spells)
// return; // but for now, this should be ok, until a db is used that provides spell info // return; // but for now, this should be ok, until a db is used that provides spell info
WorldPacket packet; WorldPacket packet;
ByteBuffer temp; ByteBuffer temp;
uint16 flags=TARGET_FLAG_SELF; // target mask. spellcast implementeation needs to be changed if TARGET_MASK_SELF is != 0 uint16 flags=TARGET_FLAG_SELF; // target mask. spellcast implementeation needs to be changed if TARGET_MASK_SELF is != 0
packet << spellid; packet << spellid;
packet << (uint8)0; // unk packet << (uint8)0; // unk
if(target && my->GetTarget() != GetGuid()) // self cast? if(target && my->GetTarget() != GetGuid()) // self cast?
{ {
if(target->GetTypeId() == TYPEID_PLAYER || target->GetTypeId() == TYPEID_UNIT) if(target->GetTypeId() == TYPEID_PLAYER || target->GetTypeId() == TYPEID_UNIT)
{ {
flags |= TARGET_FLAG_UNIT; flags |= TARGET_FLAG_UNIT;
temp << (uint8)0xFF << my->GetTarget(); // need to send packed guid? temp << (uint8)0xFF << my->GetTarget(); // need to send packed guid?
} }
if(target->GetTypeId() == TYPEID_OBJECT) if(target->GetTypeId() == TYPEID_OBJECT)
{ {
flags |= TARGET_FLAG_OBJECT; flags |= TARGET_FLAG_OBJECT;
temp << (uint8)0xFF <<my->GetTarget(); // need to send packed guid? temp << (uint8)0xFF <<my->GetTarget(); // need to send packed guid?
} }
// TODO: need implementation of areaspells & item targets (enchant) here (temp << itemGUID)! // TODO: need implementation of areaspells & item targets (enchant) here (temp << itemGUID)!
// TODO: append floats x,y,z according to target type srcloc & dstloc to temp // TODO: append floats x,y,z according to target type srcloc & dstloc to temp
// TODO: append string to temp if TARGET_FLAG_STRING is set. what string for what purpose?? // TODO: append string to temp if TARGET_FLAG_STRING is set. what string for what purpose??
// and whats with TARGET_CORPSE? // and whats with TARGET_CORPSE?
} }
packet << flags; packet << flags;
packet.append(temp); packet.append(temp);
// cast it // cast it
packet.SetOpcode(CMSG_CAST_SPELL); packet.SetOpcode(CMSG_CAST_SPELL);
SendWorldPacket(packet); SendWorldPacket(packet);
logdetail("Casting spell %u on target "I64FMT,spellid,my->GetTarget()); logdetail("Casting spell %u on target "I64FMT,spellid,my->GetTarget());
if(!known) if(!known)
logcustom(1,LRED," - WARNING: spell is NOT known!"); logcustom(1,LRED," - WARNING: spell is NOT known!");
} }
void WorldSession::SendWhoListRequest(uint32 minlvl, uint32 maxlvl, uint32 racemask, uint32 classmask, std::string name, std::string guildname, std::vector<uint32> *zonelist, std::vector<std::string> *strlist) void WorldSession::SendWhoListRequest(uint32 minlvl, uint32 maxlvl, uint32 racemask, uint32 classmask, std::string name, std::string guildname, std::vector<uint32> *zonelist, std::vector<std::string> *strlist)
{ {
WorldPacket pkt(CMSG_WHO, 50); // guess size WorldPacket pkt(CMSG_WHO, 50); // guess size
pkt << minlvl; pkt << minlvl;
pkt << maxlvl; pkt << maxlvl;
pkt << name; pkt << name;
pkt << guildname; pkt << guildname;
pkt << racemask; pkt << racemask;
pkt << classmask; pkt << classmask;
if(zonelist) if(zonelist)
{ {
pkt << (uint32)zonelist->size(); pkt << (uint32)zonelist->size();
for(uint32 i = 0; i < zonelist->size(); i++) for(uint32 i = 0; i < zonelist->size(); i++)
pkt << (*zonelist)[i]; pkt << (*zonelist)[i];
} }
else else
pkt << uint32(0); pkt << uint32(0);
if(strlist) if(strlist)
{ {
pkt << (uint32)strlist->size(); pkt << (uint32)strlist->size();
for(uint32 i = 0; i < strlist->size(); i++) for(uint32 i = 0; i < strlist->size(); i++)
pkt << (*strlist)[i]; pkt << (*strlist)[i];
} }
else else
pkt << uint32(0); pkt << uint32(0);
SendWorldPacket(pkt); SendWorldPacket(pkt);
} }
void WorldSession::SendQueryCreature(uint32 entry, uint64 guid) void WorldSession::SendQueryCreature(uint32 entry, uint64 guid)
{ {
if(objmgr.CreatureNonExistent(entry)) if(objmgr.CreatureNonExistent(entry))
{ {
logdebug("Skipped query of creature %u (was marked as nonexistent before)",entry); logdebug("Skipped query of creature %u (was marked as nonexistent before)",entry);
return; return;
} }
logdebug("Sending creature query, id=%u",entry); logdebug("Sending creature query, id=%u",entry);
WorldPacket wp(CMSG_CREATURE_QUERY,4+8); WorldPacket wp(CMSG_CREATURE_QUERY,4+8);
wp << entry << guid; wp << entry << guid;
SendWorldPacket(wp); SendWorldPacket(wp);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,31 @@
#ifndef _CACHEHANDLER_H #ifndef _CACHEHANDLER_H
#define _CACHEHANDLER_H #define _CACHEHANDLER_H
struct PlayerNameCacheItem { struct PlayerNameCacheItem {
uint64 _guid; uint64 _guid;
std::string _name; std::string _name;
}; };
class PlayerNameCache { class PlayerNameCache {
public: public:
~PlayerNameCache(); ~PlayerNameCache();
std::string GetName(uint64); std::string GetName(uint64);
bool IsKnown(uint64); bool IsKnown(uint64);
uint64 GetGuid(std::string); uint64 GetGuid(std::string);
bool AddInfo(uint64 guid, std::string name); bool AddInfo(uint64 guid, std::string name);
bool AddInfo(PlayerNameCacheItem*); bool AddInfo(PlayerNameCacheItem*);
bool SaveToFile(void); bool SaveToFile(void);
bool ReadFromFile(void); bool ReadFromFile(void);
uint32 GetSize(void); uint32 GetSize(void);
private: private:
std::vector<PlayerNameCacheItem*> _cache; std::vector<PlayerNameCacheItem*> _cache;
}; };
void ItemProtoCache_InsertDataToSession(WorldSession *session); void ItemProtoCache_InsertDataToSession(WorldSession *session);
void ItemProtoCache_WriteDataToCache(WorldSession *session); void ItemProtoCache_WriteDataToCache(WorldSession *session);
void CreatureTemplateCache_InsertDataToSession(WorldSession *session); void CreatureTemplateCache_InsertDataToSession(WorldSession *session);
void CreatureTemplateCache_WriteDataToCache(WorldSession *session); void CreatureTemplateCache_WriteDataToCache(WorldSession *session);
#endif #endif

View File

@ -1,273 +1,273 @@
#include "common.h" #include "common.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include <map> #include <map>
#include "Channel.h" #include "Channel.h"
enum NotifyTypes enum NotifyTypes
{ {
JOINED = 0x00, JOINED = 0x00,
LEFT = 0x01, LEFT = 0x01,
YOUJOINED = 0x02, YOUJOINED = 0x02,
YOULEFT = 0x03, YOULEFT = 0x03,
WRONGPASS = 0x04, WRONGPASS = 0x04,
NOTON1 = 0x05, // Not on channel channel name. NOTON1 = 0x05, // Not on channel channel name.
NOTMOD = 0x06, NOTMOD = 0x06,
SETPASS = 0x07, SETPASS = 0x07,
CHANGEOWNER = 0x08, CHANGEOWNER = 0x08,
NOTON2 = 0x09, // Player %s is not on channel. NOTON2 = 0x09, // Player %s is not on channel.
NOTOWNER = 0x0A, NOTOWNER = 0x0A,
WHOOWNER = 0x0B, WHOOWNER = 0x0B,
MODECHANGE = 0x0C, MODECHANGE = 0x0C,
ANNOUNCEON = 0x0D, ANNOUNCEON = 0x0D,
ANNOUNCEOFF = 0x0E, ANNOUNCEOFF = 0x0E,
MODERATED = 0x0F, MODERATED = 0x0F,
UNMODERATED = 0x10, UNMODERATED = 0x10,
YOUCANTSPEAK = 0x11, YOUCANTSPEAK = 0x11,
KICKED = 0x12, KICKED = 0x12,
YOUAREBANNED = 0x13, YOUAREBANNED = 0x13,
BANNED = 0x14, BANNED = 0x14,
UNBANNED = 0x15, UNBANNED = 0x15,
UNKNOWN1 = 0x16, // is not banned UNKNOWN1 = 0x16, // is not banned
ALREADYON = 0x17, ALREADYON = 0x17,
INVITED = 0x18, INVITED = 0x18,
WRONGALLIANCE = 0x19, // target is in the wrong alliance for channel name WRONGALLIANCE = 0x19, // target is in the wrong alliance for channel name
UNKNOWN2 = 0x1A, // wrong alliance for channel name UNKNOWN2 = 0x1A, // wrong alliance for channel name
UNKNOWN3 = 0x1B, // invalid channel name UNKNOWN3 = 0x1B, // invalid channel name
ISNOTMODERATED = 0x1C, ISNOTMODERATED = 0x1C,
YOUINVITED = 0x1D, YOUINVITED = 0x1D,
UNKNOWN4 = 0x1E, // %s has been banned. UNKNOWN4 = 0x1E, // %s has been banned.
UNKNOWN5 = 0x1F, // The number of messages that can be sent to this channel is limited, please wait to send another message. UNKNOWN5 = 0x1F, // The number of messages that can be sent to this channel is limited, please wait to send another message.
UNKNOWN6 = 0x20 // You are in not the correct area for this channel. UNKNOWN6 = 0x20 // You are in not the correct area for this channel.
}; };
enum ChannelFlags enum ChannelFlags
{ {
CHANNEL_FLAG_CUSTOM = 0x01, CHANNEL_FLAG_CUSTOM = 0x01,
// 0x02 // 0x02
CHANNEL_FLAG_TRADE = 0x04, CHANNEL_FLAG_TRADE = 0x04,
CHANNEL_FLAG_NOT_LFG = 0x08, CHANNEL_FLAG_NOT_LFG = 0x08,
CHANNEL_FLAG_GENERAL = 0x10, CHANNEL_FLAG_GENERAL = 0x10,
CHANNEL_FLAG_CITY = 0x20, CHANNEL_FLAG_CITY = 0x20,
CHANNEL_FLAG_LFG = 0x40, CHANNEL_FLAG_LFG = 0x40,
CHANNEL_FLAG_VOICE = 0x80 CHANNEL_FLAG_VOICE = 0x80
// General 0x18 = 0x10 | 0x08 // General 0x18 = 0x10 | 0x08
// Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04 // Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04
// LocalDefence 0x18 = 0x10 | 0x08 // LocalDefence 0x18 = 0x10 | 0x08
// GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08 // GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08
// LookingForGroup 0x50 = 0x40 | 0x10 // LookingForGroup 0x50 = 0x40 | 0x10
}; };
enum ChannelMemberFlags enum ChannelMemberFlags
{ {
MEMBER_FLAG_NONE = 0x00, MEMBER_FLAG_NONE = 0x00,
MEMBER_FLAG_OWNER = 0x01, MEMBER_FLAG_OWNER = 0x01,
MEMBER_FLAG_MODERATOR = 0x02, MEMBER_FLAG_MODERATOR = 0x02,
MEMBER_FLAG_VOICED = 0x04, MEMBER_FLAG_VOICED = 0x04,
MEMBER_FLAG_MUTED = 0x08, MEMBER_FLAG_MUTED = 0x08,
MEMBER_FLAG_CUSTOM = 0x10, MEMBER_FLAG_CUSTOM = 0x10,
MEMBER_FLAG_MIC_MUTED = 0x20, MEMBER_FLAG_MIC_MUTED = 0x20,
// 0x40 // 0x40
// 0x80 // 0x80
}; };
typedef std::map<uint64,uint8> ChannelPlayerList; typedef std::map<uint64,uint8> ChannelPlayerList;
void Channel::Join(std::string channel, std::string password) void Channel::Join(std::string channel, std::string password)
{ {
if (IsOnChannel(channel)) if (IsOnChannel(channel))
return; return;
// Send join channel request // Send join channel request
WorldPacket worldPacket; WorldPacket worldPacket;
worldPacket.SetOpcode(CMSG_JOIN_CHANNEL); worldPacket.SetOpcode(CMSG_JOIN_CHANNEL);
worldPacket << (uint32)0; // new since 2.0.x, some channel ID? server answers us with that number later if channel joined worldPacket << (uint32)0; // new since 2.0.x, some channel ID? server answers us with that number later if channel joined
worldPacket << (uint8)0; // unk worldPacket << (uint8)0; // unk
worldPacket << (uint8)0; // unk, new since 2.2.x worldPacket << (uint8)0; // unk, new since 2.2.x
worldPacket << channel << password; worldPacket << channel << password;
_worldSession->SendWorldPacket(worldPacket); _worldSession->SendWorldPacket(worldPacket);
} }
void Channel::Leave(std::string channel) void Channel::Leave(std::string channel)
{ {
for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++) for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++)
{ {
if (*i == channel) if (*i == channel)
{ {
// Send leave channel request // Send leave channel request
WorldPacket worldPacket; WorldPacket worldPacket;
worldPacket.SetOpcode(CMSG_LEAVE_CHANNEL); worldPacket.SetOpcode(CMSG_LEAVE_CHANNEL);
worldPacket << (uint32)0; // new since 2.0.x, maybe channel id worldPacket << (uint32)0; // new since 2.0.x, maybe channel id
worldPacket << channel; worldPacket << channel;
_worldSession->SendWorldPacket(worldPacket); _worldSession->SendWorldPacket(worldPacket);
return; return;
} }
} }
log("Can't leave channel \"%s\": not joined",channel.c_str()); log("Can't leave channel \"%s\": not joined",channel.c_str());
} }
void Channel::Say(std::string channel, std::string text, uint32 lang) void Channel::Say(std::string channel, std::string text, uint32 lang)
{ {
_worldSession->SendChatMessage(CHAT_MSG_CHANNEL, lang, text, channel); _worldSession->SendChatMessage(CHAT_MSG_CHANNEL, lang, text, channel);
} }
bool Channel::IsOnChannel(std::string channel) bool Channel::IsOnChannel(std::string channel)
{ {
for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++) for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++)
{ {
if (*i == channel) if (*i == channel)
{ {
return true; return true;
} }
} }
return false; return false;
} }
void Channel::HandleNotifyOpcode(WorldPacket &packet) void Channel::HandleNotifyOpcode(WorldPacket &packet)
{ {
uint8 code; uint8 code;
uint64 guid; uint64 guid;
std::string channel, name; std::string channel, name;
packet >> code >> channel; packet >> code >> channel;
switch (code) switch (code)
{ {
// Player joined channel you are on // Player joined channel you are on
case JOINED: case JOINED:
packet >> guid; packet >> guid;
if(guid) if(guid)
{ {
name = _worldSession->GetOrRequestPlayerName(guid); name = _worldSession->GetOrRequestPlayerName(guid);
if (name.empty()) if (name.empty())
{ {
_worldSession->_DelayWorldPacket(packet, uint32(_worldSession->GetLagMS() * 1.2f)); _worldSession->_DelayWorldPacket(packet, uint32(_worldSession->GetLagMS() * 1.2f));
return; return;
} }
} }
log("%s joined channel %s",name.c_str(),channel.c_str()); log("%s joined channel %s",name.c_str(),channel.c_str());
break; break;
// Player leaved channel you are on // Player leaved channel you are on
case LEFT: case LEFT:
packet >> guid; packet >> guid;
if(guid) if(guid)
{ {
name = _worldSession->GetOrRequestPlayerName(guid); name = _worldSession->GetOrRequestPlayerName(guid);
if (name.empty()) if (name.empty())
{ {
_worldSession->_DelayWorldPacket(packet, uint32(_worldSession->GetLagMS() * 1.2f)); _worldSession->_DelayWorldPacket(packet, uint32(_worldSession->GetLagMS() * 1.2f));
return; return;
} }
} }
log("%s left channel %s", name.c_str(), channel.c_str()); log("%s left channel %s", name.c_str(), channel.c_str());
break; break;
// You joined channel successfully // You joined channel successfully
case YOUJOINED: case YOUJOINED:
log("Joined channel %s", channel.c_str()); log("Joined channel %s", channel.c_str());
channels.push_back(channel); channels.push_back(channel);
break; break;
// You leaved channel successfully // You leaved channel successfully
case YOULEFT: case YOULEFT:
for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++) for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++)
{ {
if(*i == channel) if(*i == channel)
{ {
channels.erase(i); channels.erase(i);
break; break;
} }
} }
log("Left channel %s", channel.c_str()); log("Left channel %s", channel.c_str());
break; break;
// Wrong password while trying to join channel // Wrong password while trying to join channel
case WRONGPASS: case WRONGPASS:
log("Could not join channel %s (Wrong password)", channel.c_str()); log("Could not join channel %s (Wrong password)", channel.c_str());
break; break;
// Not on channel while trying to write to channel etc. // Not on channel while trying to write to channel etc.
case NOTON1: case NOTON1:
log("You are not on channel %s", channel.c_str()); log("You are not on channel %s", channel.c_str());
break; break;
} }
// TODO: Even more channel notices to handle // TODO: Even more channel notices to handle
/* /*
printf("Channel notice not handled! Code: %d - Channel name: %s\nData:\n", code, channel.c_str()); printf("Channel notice not handled! Code: %d - Channel name: %s\nData:\n", code, channel.c_str());
packet.textlike(); packet.textlike();
printf("\n"); printf("\n");
*/ */
} }
void Channel::RequestList(std::string ch) void Channel::RequestList(std::string ch)
{ {
if(!IsOnChannel(ch)) if(!IsOnChannel(ch))
logdebug("Requesting list of not joined channel '%s'",ch.c_str()); logdebug("Requesting list of not joined channel '%s'",ch.c_str());
WorldPacket wp; WorldPacket wp;
wp.SetOpcode(CMSG_CHANNEL_LIST); wp.SetOpcode(CMSG_CHANNEL_LIST);
wp << ch; wp << ch;
_worldSession->SendWorldPacket(wp); _worldSession->SendWorldPacket(wp);
} }
void Channel::HandleListRequest(WorldPacket& recvPacket) void Channel::HandleListRequest(WorldPacket& recvPacket)
{ {
ChannelPlayerList cpl; ChannelPlayerList cpl;
uint8 unk; uint8 unk;
uint32 size; uint32 size;
uint64 guid; uint64 guid;
uint8 mode, flags; // mode: player flags; flags: channel flags uint8 mode, flags; // mode: player flags; flags: channel flags
std::string name; std::string name;
bool must_delay = false; bool must_delay = false;
recvPacket >> unk >> name >> flags >> size; recvPacket >> unk >> name >> flags >> size;
for(uint32 i = 0; i < size; i++) for(uint32 i = 0; i < size; i++)
{ {
recvPacket >> guid >> mode; recvPacket >> guid >> mode;
// all player names in this packet must be known before // all player names in this packet must be known before
if(_worldSession->GetOrRequestPlayerName(guid).empty()) if(_worldSession->GetOrRequestPlayerName(guid).empty())
{ {
_worldSession->_DelayWorldPacket(recvPacket, uint32(_worldSession->GetLagMS() * 1.2f)); _worldSession->_DelayWorldPacket(recvPacket, uint32(_worldSession->GetLagMS() * 1.2f));
must_delay = true; must_delay = true;
} }
cpl[guid] = mode; cpl[guid] = mode;
} }
if(must_delay) if(must_delay)
return; return;
// store list of GUIDs in: @ChannelList - see below // store list of GUIDs in: @ChannelList - see below
DefList *l = _worldSession->GetInstance()->GetScripts()->lists.Get("@ChannelList"); DefList *l = _worldSession->GetInstance()->GetScripts()->lists.Get("@ChannelList");
l->clear(); l->clear();
std::string pname; std::string pname;
bool muted,mod; bool muted,mod;
logcustom(0,WHITE,"Player channel list, %u players:",size); logcustom(0,WHITE,"Player channel list, %u players:",size);
for(ChannelPlayerList::iterator i = cpl.begin(); i != cpl.end(); i++) for(ChannelPlayerList::iterator i = cpl.begin(); i != cpl.end(); i++)
{ {
pname = _worldSession->GetOrRequestPlayerName(i->first); // all names should be known now pname = _worldSession->GetOrRequestPlayerName(i->first); // all names should be known now
mode = i->second; mode = i->second;
if(pname.empty()) if(pname.empty())
pname = "<unknown>"; pname = "<unknown>";
muted = mode & MEMBER_FLAG_MUTED; muted = mode & MEMBER_FLAG_MUTED;
mod = mode & MEMBER_FLAG_MODERATOR; mod = mode & MEMBER_FLAG_MODERATOR;
while(pname.length() < MAX_PLAYERNAME_LENGTH) while(pname.length() < MAX_PLAYERNAME_LENGTH)
pname += " "; // for better formatting pname += " "; // for better formatting
logcustom(0,WHITE,"%s ["I64FMT"] %s %s",pname.c_str(),i->first,muted?"(muted)":"",mod?"(moderator)":""); logcustom(0,WHITE,"%s ["I64FMT"] %s %s",pname.c_str(),i->first,muted?"(muted)":"",mod?"(moderator)":"");
// DefScript binding // DefScript binding
l->push_back(DefScriptTools::toString(guid)); l->push_back(DefScriptTools::toString(guid));
} }
} }

View File

@ -1,16 +1,16 @@
#ifndef _CORPSE_H #ifndef _CORPSE_H
#define _CORPSE_H #define _CORPSE_H
#include "Object.h" #include "Object.h"
class Corpse : public WorldObject class Corpse : public WorldObject
{ {
public: public:
Corpse(); Corpse();
void Create(uint64); void Create(uint64);
private: private:
}; };
#endif #endif

View File

@ -1,16 +1,16 @@
#ifndef _DYNAMICOBJECT_H #ifndef _DYNAMICOBJECT_H
#define _DYNAMICOBJECT_H #define _DYNAMICOBJECT_H
#include "Object.h" #include "Object.h"
class DynamicObject : public WorldObject class DynamicObject : public WorldObject
{ {
public: public:
DynamicObject(); DynamicObject();
void Create(uint64); void Create(uint64);
private: private:
}; };
#endif #endif

View File

@ -1,16 +1,16 @@
#ifndef _GAMEOBJECT_H #ifndef _GAMEOBJECT_H
#define _GAMEOBJECT_H #define _GAMEOBJECT_H
#include "Object.h" #include "Object.h"
class GameObject : public WorldObject class GameObject : public WorldObject
{ {
public: public:
GameObject(); GameObject();
void Create(uint64); void Create(uint64);
private: private:
}; };
#endif #endif

View File

@ -1,129 +1,129 @@
#include "WorldSession.h" #include "WorldSession.h"
#include "UpdateFields.h" #include "UpdateFields.h"
#include "Item.h" #include "Item.h"
#include "Bag.h" #include "Bag.h"
void WorldSession::_HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket) void WorldSession::_HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket)
{ {
ItemProto *proto = new ItemProto(); ItemProto *proto = new ItemProto();
recvPacket >> proto->Id; recvPacket >> proto->Id;
uint8 field[64]; uint8 field[64];
uint32 unk; uint32 unk;
std::string s; std::string s;
memset(field,0,64); memset(field,0,64);
if(memcmp(recvPacket.contents()+sizeof(uint32),field,64)) if(memcmp(recvPacket.contents()+sizeof(uint32),field,64))
{ {
recvPacket >> proto->Class; recvPacket >> proto->Class;
recvPacket >> proto->SubClass; recvPacket >> proto->SubClass;
recvPacket >> unk; // dont need that value? recvPacket >> unk; // dont need that value?
recvPacket >> proto->Name; recvPacket >> proto->Name;
recvPacket >> s >> s >> s; // strip name2-4 recvPacket >> s >> s >> s; // strip name2-4
recvPacket >> proto->DisplayInfoID; recvPacket >> proto->DisplayInfoID;
recvPacket >> proto->Quality; recvPacket >> proto->Quality;
recvPacket >> proto->Flags; recvPacket >> proto->Flags;
recvPacket >> proto->BuyPrice; recvPacket >> proto->BuyPrice;
recvPacket >> proto->SellPrice; recvPacket >> proto->SellPrice;
recvPacket >> proto->InventoryType; recvPacket >> proto->InventoryType;
recvPacket >> proto->AllowableClass; recvPacket >> proto->AllowableClass;
recvPacket >> proto->AllowableRace; recvPacket >> proto->AllowableRace;
recvPacket >> proto->ItemLevel; recvPacket >> proto->ItemLevel;
recvPacket >> proto->RequiredLevel; recvPacket >> proto->RequiredLevel;
recvPacket >> proto->RequiredSkill; recvPacket >> proto->RequiredSkill;
recvPacket >> proto->RequiredSkillRank; recvPacket >> proto->RequiredSkillRank;
recvPacket >> proto->RequiredSpell; recvPacket >> proto->RequiredSpell;
recvPacket >> proto->RequiredHonorRank; recvPacket >> proto->RequiredHonorRank;
recvPacket >> proto->RequiredCityRank; recvPacket >> proto->RequiredCityRank;
recvPacket >> proto->RequiredReputationFaction; recvPacket >> proto->RequiredReputationFaction;
recvPacket >> proto->RequiredReputationRank; recvPacket >> proto->RequiredReputationRank;
recvPacket >> proto->MaxCount; recvPacket >> proto->MaxCount;
recvPacket >> proto->Stackable; recvPacket >> proto->Stackable;
recvPacket >> proto->ContainerSlots; recvPacket >> proto->ContainerSlots;
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)
{ {
recvPacket >> proto->ItemStat[i].ItemStatType; recvPacket >> proto->ItemStat[i].ItemStatType;
recvPacket >> proto->ItemStat[i].ItemStatValue; recvPacket >> proto->ItemStat[i].ItemStatValue;
} }
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; i++)
{ {
recvPacket >> proto->Damage[i].DamageMin; recvPacket >> proto->Damage[i].DamageMin;
recvPacket >> proto->Damage[i].DamageMax; recvPacket >> proto->Damage[i].DamageMax;
recvPacket >> proto->Damage[i].DamageType; recvPacket >> proto->Damage[i].DamageType;
} }
recvPacket >> proto->Armor; recvPacket >> proto->Armor;
recvPacket >> proto->HolyRes; recvPacket >> proto->HolyRes;
recvPacket >> proto->FireRes; recvPacket >> proto->FireRes;
recvPacket >> proto->NatureRes; recvPacket >> proto->NatureRes;
recvPacket >> proto->FrostRes; recvPacket >> proto->FrostRes;
recvPacket >> proto->ShadowRes; recvPacket >> proto->ShadowRes;
recvPacket >> proto->ArcaneRes; recvPacket >> proto->ArcaneRes;
recvPacket >> proto->Delay; recvPacket >> proto->Delay;
recvPacket >> proto->Ammo_type; recvPacket >> proto->Ammo_type;
recvPacket >> proto->RangedModRange; recvPacket >> proto->RangedModRange;
for(int s = 0; s < 5; s++) for(int s = 0; s < 5; s++)
{ {
recvPacket >> proto->Spells[s].SpellId; recvPacket >> proto->Spells[s].SpellId;
recvPacket >> proto->Spells[s].SpellTrigger; recvPacket >> proto->Spells[s].SpellTrigger;
recvPacket >> proto->Spells[s].SpellCharges; recvPacket >> proto->Spells[s].SpellCharges;
recvPacket >> proto->Spells[s].SpellCooldown; recvPacket >> proto->Spells[s].SpellCooldown;
recvPacket >> proto->Spells[s].SpellCategory; recvPacket >> proto->Spells[s].SpellCategory;
recvPacket >> proto->Spells[s].SpellCategoryCooldown; recvPacket >> proto->Spells[s].SpellCategoryCooldown;
} }
recvPacket >> proto->Bonding; recvPacket >> proto->Bonding;
recvPacket >> proto->Description; recvPacket >> proto->Description;
recvPacket >> proto->PageText; recvPacket >> proto->PageText;
recvPacket >> proto->LanguageID; recvPacket >> proto->LanguageID;
recvPacket >> proto->PageMaterial; recvPacket >> proto->PageMaterial;
recvPacket >> proto->StartQuest; recvPacket >> proto->StartQuest;
recvPacket >> proto->LockID; recvPacket >> proto->LockID;
recvPacket >> proto->Material; recvPacket >> proto->Material;
recvPacket >> proto->Sheath; recvPacket >> proto->Sheath;
recvPacket >> proto->Extra; recvPacket >> proto->Extra;
recvPacket >> proto->Block; recvPacket >> proto->Block;
recvPacket >> proto->ItemSet; recvPacket >> proto->ItemSet;
recvPacket >> proto->MaxDurability; recvPacket >> proto->MaxDurability;
recvPacket >> proto->Area; recvPacket >> proto->Area;
recvPacket >> proto->Map; recvPacket >> proto->Map;
recvPacket >> proto->BagFamily; recvPacket >> proto->BagFamily;
recvPacket >> proto->TotemCategory; // Added in 1.12.x client branch recvPacket >> proto->TotemCategory; // Added in 1.12.x client branch
for(uint32 s = 0; s < 3; s++) for(uint32 s = 0; s < 3; s++)
{ {
recvPacket >> proto->Socket[s].Color; recvPacket >> proto->Socket[s].Color;
recvPacket >> proto->Socket[s].Content; recvPacket >> proto->Socket[s].Content;
} }
recvPacket >> proto->socketBonus; recvPacket >> proto->socketBonus;
recvPacket >> proto->GemProperties; recvPacket >> proto->GemProperties;
recvPacket >> proto->ExtendedCost; recvPacket >> proto->ExtendedCost;
recvPacket >> proto->RequiredDisenchantSkill; recvPacket >> proto->RequiredDisenchantSkill;
recvPacket >> proto->ArmorDamageModifier; recvPacket >> proto->ArmorDamageModifier;
logdetail("Got Item Info: Id=%u Name='%s' ReqLevel=%u Armor=%u Desc='%s'", logdetail("Got Item Info: Id=%u Name='%s' ReqLevel=%u Armor=%u Desc='%s'",
proto->Id, proto->Name.c_str(), proto->RequiredLevel, proto->Armor, proto->Description.c_str()); proto->Id, proto->Name.c_str(), proto->RequiredLevel, proto->Armor, proto->Description.c_str());
objmgr.Add(proto); objmgr.Add(proto);
objmgr.AssignNameToObj(proto->Id, TYPEID_ITEM, proto->Name); objmgr.AssignNameToObj(proto->Id, TYPEID_ITEM, proto->Name);
objmgr.AssignNameToObj(proto->Id, TYPEID_CONTAINER, proto->Name); objmgr.AssignNameToObj(proto->Id, TYPEID_CONTAINER, proto->Name);
} }
else else
{ {
logdetail("Got info of nonexistent Item %u",proto->Id); logdetail("Got info of nonexistent Item %u",proto->Id);
objmgr.AddNonexistentItem(proto->Id); objmgr.AddNonexistentItem(proto->Id);
delete proto; delete proto;
} }
} }
Item::Item() Item::Item()
{ {
_type |= TYPE_ITEM; _type |= TYPE_ITEM;
_typeid = TYPEID_ITEM; _typeid = TYPEID_ITEM;
_valuescount = ITEM_END; _valuescount = ITEM_END;
_slot = 0; _slot = 0;
//_bag = NULL; // not yet implemented //_bag = NULL; // not yet implemented
} }
void Item::Create(uint64 guid) void Item::Create(uint64 guid)
{ {
Object::Create(guid); Object::Create(guid);
// what else? // what else?
} }

View File

@ -1,440 +1,440 @@
#ifndef _ITEM_H #ifndef _ITEM_H
#define _ITEM_H #define _ITEM_H
#include "common.h" #include "common.h"
#include "Object.h" #include "Object.h"
class Bag; class Bag;
enum InventoryChangeFailure enum InventoryChangeFailure
{ {
EQUIP_ERR_OK = 0, EQUIP_ERR_OK = 0,
EQUIP_ERR_YOU_MUST_REACH_LEVEL_N = 1, EQUIP_ERR_YOU_MUST_REACH_LEVEL_N = 1,
EQUIP_ERR_SKILL_ISNT_HIGH_ENOUGH = 2, EQUIP_ERR_SKILL_ISNT_HIGH_ENOUGH = 2,
EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT = 3, EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT = 3,
EQUIP_ERR_BAG_FULL = 4, EQUIP_ERR_BAG_FULL = 4,
EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG = 5, EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG = 5,
EQUIP_ERR_CANT_TRADE_EQUIP_BAGS = 6, EQUIP_ERR_CANT_TRADE_EQUIP_BAGS = 6,
EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE = 7, EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE = 7,
EQUIP_ERR_NO_REQUIRED_PROFICIENCY = 8, EQUIP_ERR_NO_REQUIRED_PROFICIENCY = 8,
EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE = 9, EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE = 9,
EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM = 10, EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM = 10,
EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM2 = 11, EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM2 = 11,
EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE2 = 12, EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE2 = 12,
EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED = 13, EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED = 13,
EQUIP_ERR_CANT_DUAL_WIELD = 14, EQUIP_ERR_CANT_DUAL_WIELD = 14,
EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG = 15, EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG = 15,
EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2 = 16, EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2 = 16,
EQUIP_ERR_CANT_CARRY_MORE_OF_THIS = 17, EQUIP_ERR_CANT_CARRY_MORE_OF_THIS = 17,
EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE3 = 18, EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE3 = 18,
EQUIP_ERR_ITEM_CANT_STACK = 19, EQUIP_ERR_ITEM_CANT_STACK = 19,
EQUIP_ERR_ITEM_CANT_BE_EQUIPPED = 20, EQUIP_ERR_ITEM_CANT_BE_EQUIPPED = 20,
EQUIP_ERR_ITEMS_CANT_BE_SWAPPED = 21, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED = 21,
EQUIP_ERR_SLOT_IS_EMPTY = 22, EQUIP_ERR_SLOT_IS_EMPTY = 22,
EQUIP_ERR_ITEM_NOT_FOUND = 23, EQUIP_ERR_ITEM_NOT_FOUND = 23,
EQUIP_ERR_CANT_DROP_SOULBOUND = 24, EQUIP_ERR_CANT_DROP_SOULBOUND = 24,
EQUIP_ERR_OUT_OF_RANGE = 25, EQUIP_ERR_OUT_OF_RANGE = 25,
EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT = 26, EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT = 26,
EQUIP_ERR_COULDNT_SPLIT_ITEMS = 27, EQUIP_ERR_COULDNT_SPLIT_ITEMS = 27,
EQUIP_ERR_MISSING_REAGENT = 28, EQUIP_ERR_MISSING_REAGENT = 28,
EQUIP_ERR_NOT_ENOUGH_MONEY = 29, EQUIP_ERR_NOT_ENOUGH_MONEY = 29,
EQUIP_ERR_NOT_A_BAG = 30, EQUIP_ERR_NOT_A_BAG = 30,
EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS = 31, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS = 31,
EQUIP_ERR_DONT_OWN_THAT_ITEM = 32, EQUIP_ERR_DONT_OWN_THAT_ITEM = 32,
EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER = 33, EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER = 33,
EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT = 34, EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT = 34,
EQUIP_ERR_TOO_FAR_AWAY_FROM_BANK = 35, EQUIP_ERR_TOO_FAR_AWAY_FROM_BANK = 35,
EQUIP_ERR_ITEM_LOCKED = 36, EQUIP_ERR_ITEM_LOCKED = 36,
EQUIP_ERR_YOU_ARE_STUNNED = 37, EQUIP_ERR_YOU_ARE_STUNNED = 37,
EQUIP_ERR_YOU_ARE_DEAD = 38, EQUIP_ERR_YOU_ARE_DEAD = 38,
EQUIP_ERR_CANT_DO_RIGHT_NOW = 39, EQUIP_ERR_CANT_DO_RIGHT_NOW = 39,
EQUIP_ERR_BAG_FULL2 = 40, EQUIP_ERR_BAG_FULL2 = 40,
EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER2 = 41, EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER2 = 41,
EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH = 42, EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH = 42,
EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED = 43, EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED = 43,
EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED = 44, EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED = 44,
EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED = 45, EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED = 45,
EQUIP_ERR_BOUND_CANT_BE_WRAPPED = 46, EQUIP_ERR_BOUND_CANT_BE_WRAPPED = 46,
EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED = 47, EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED = 47,
EQUIP_ERR_BAGS_CANT_BE_WRAPPED = 48, EQUIP_ERR_BAGS_CANT_BE_WRAPPED = 48,
EQUIP_ERR_ALREADY_LOOTED = 49, EQUIP_ERR_ALREADY_LOOTED = 49,
EQUIP_ERR_INVENTORY_FULL = 50, EQUIP_ERR_INVENTORY_FULL = 50,
EQUIP_ERR_BANK_FULL = 51, EQUIP_ERR_BANK_FULL = 51,
EQUIP_ERR_ITEM_IS_CURRENTLY_SOLD_OUT = 52, EQUIP_ERR_ITEM_IS_CURRENTLY_SOLD_OUT = 52,
EQUIP_ERR_BAG_FULL3 = 53, EQUIP_ERR_BAG_FULL3 = 53,
EQUIP_ERR_ITEM_NOT_FOUND2 = 54, EQUIP_ERR_ITEM_NOT_FOUND2 = 54,
EQUIP_ERR_ITEM_CANT_STACK2 = 55, EQUIP_ERR_ITEM_CANT_STACK2 = 55,
EQUIP_ERR_BAG_FULL4 = 56, EQUIP_ERR_BAG_FULL4 = 56,
EQUIP_ERR_ITEM_SOLD_OUT = 57, EQUIP_ERR_ITEM_SOLD_OUT = 57,
EQUIP_ERR_OBJECT_IS_BUSY = 58, EQUIP_ERR_OBJECT_IS_BUSY = 58,
EQUIP_ERR_NONE = 59, EQUIP_ERR_NONE = 59,
EQUIP_ERR_CANT_DO_IN_COMBAT = 60, EQUIP_ERR_CANT_DO_IN_COMBAT = 60,
EQUIP_CANT_DO_WHILE_DISARMED = 61, EQUIP_CANT_DO_WHILE_DISARMED = 61,
EQUIP_ERR_BAG_FULL6 = 62, EQUIP_ERR_BAG_FULL6 = 62,
EQUIP_ITEM_RANK_NOT_ENOUGH = 63, EQUIP_ITEM_RANK_NOT_ENOUGH = 63,
EQUIP_ITEM_REPUTATION_NOT_ENOUGH = 64, EQUIP_ITEM_REPUTATION_NOT_ENOUGH = 64,
EQUIP_MORE_THAN1_SPECIAL_BAG = 65 EQUIP_MORE_THAN1_SPECIAL_BAG = 65
}; };
enum BuyFailure enum BuyFailure
{ {
BUY_ERR_CANT_FIND_ITEM = 0, BUY_ERR_CANT_FIND_ITEM = 0,
BUY_ERR_ITEM_ALREADY_SOLD = 1, BUY_ERR_ITEM_ALREADY_SOLD = 1,
BUY_ERR_NOT_ENOUGHT_MONEY = 2, BUY_ERR_NOT_ENOUGHT_MONEY = 2,
BUY_ERR_SELLER_DONT_LIKE_YOU = 4, BUY_ERR_SELLER_DONT_LIKE_YOU = 4,
BUY_ERR_DISTANCE_TOO_FAR = 5, BUY_ERR_DISTANCE_TOO_FAR = 5,
BUY_ERR_CANT_CARRY_MORE = 8, BUY_ERR_CANT_CARRY_MORE = 8,
BUY_ERR_LEVEL_REQUIRE = 11, BUY_ERR_LEVEL_REQUIRE = 11,
BUY_ERR_REPUTATION_REQUIRE = 12 BUY_ERR_REPUTATION_REQUIRE = 12
}; };
enum SellFailure enum SellFailure
{ {
SELL_ERR_CANT_FIND_ITEM = 1, SELL_ERR_CANT_FIND_ITEM = 1,
SELL_ERR_CANT_SELL_ITEM = 2, SELL_ERR_CANT_SELL_ITEM = 2,
SELL_ERR_CANT_FIND_VENDOR = 3 SELL_ERR_CANT_FIND_VENDOR = 3
}; };
enum ITEM_STAT_TYPE enum ITEM_STAT_TYPE
{ {
ITEM_STAT_POWER = 0, ITEM_STAT_POWER = 0,
ITEM_STAT_HEALTH = 1, ITEM_STAT_HEALTH = 1,
ITEM_STAT_UNKNOWN = 2, ITEM_STAT_UNKNOWN = 2,
ITEM_STAT_AGILITY = 3, ITEM_STAT_AGILITY = 3,
ITEM_STAT_STRENGTH = 4, ITEM_STAT_STRENGTH = 4,
ITEM_STAT_INTELLECT = 5, ITEM_STAT_INTELLECT = 5,
ITEM_STAT_SPIRIT = 6, ITEM_STAT_SPIRIT = 6,
ITEM_STAT_STAMINA = 7 ITEM_STAT_STAMINA = 7
}; };
enum ITEM_DAMAGE_TYPE enum ITEM_DAMAGE_TYPE
{ {
NORMAL_DAMAGE = 0, NORMAL_DAMAGE = 0,
HOLY_DAMAGE = 1, HOLY_DAMAGE = 1,
FIRE_DAMAGE = 2, FIRE_DAMAGE = 2,
NATURE_DAMAGE = 3, NATURE_DAMAGE = 3,
FROST_DAMAGE = 4, FROST_DAMAGE = 4,
SHADOW_DAMAGE = 5, SHADOW_DAMAGE = 5,
ARCANE_DAMAGE = 6 ARCANE_DAMAGE = 6
}; };
enum ITEM_SPELLTRIGGER_TYPE enum ITEM_SPELLTRIGGER_TYPE
{ {
USE = 0, USE = 0,
ON_EQUIP = 1, ON_EQUIP = 1,
CHANCE_ON_HIT = 2, CHANCE_ON_HIT = 2,
SOULSTONE = 4 SOULSTONE = 4
}; };
enum ITEM_BONDING_TYPE enum ITEM_BONDING_TYPE
{ {
NO_BIND = 0, NO_BIND = 0,
BIND_WHEN_PICKED_UP = 1, BIND_WHEN_PICKED_UP = 1,
BIND_WHEN_EQUIPED = 2, BIND_WHEN_EQUIPED = 2,
BIND_WHEN_USE = 3, BIND_WHEN_USE = 3,
//TODO: Better name these //TODO: Better name these
QUEST_ITEM = 4, QUEST_ITEM = 4,
QUEST_ITEM1 = 5 QUEST_ITEM1 = 5
}; };
// masks for ITEM_FIELD_FLAGS field // masks for ITEM_FIELD_FLAGS field
enum ITEM_FLAGS enum ITEM_FLAGS
{ {
ITEM_FLAGS_BINDED = 1 ITEM_FLAGS_BINDED = 1
}; };
enum BAG_FAMILY enum BAG_FAMILY
{ {
BAG_FAMILY_NONE = 0, BAG_FAMILY_NONE = 0,
BAG_FAMILY_ARROWS = 1, BAG_FAMILY_ARROWS = 1,
BAG_FAMILY_BULLETS = 2, BAG_FAMILY_BULLETS = 2,
BAG_FAMILY_SOUL_SHARDS = 3, BAG_FAMILY_SOUL_SHARDS = 3,
//BAG_FAMILY_UNK1 = 4, //BAG_FAMILY_UNK1 = 4,
//BAG_FAMILY_UNK1 = 5, //BAG_FAMILY_UNK1 = 5,
BAG_FAMILY_HERBS = 6, BAG_FAMILY_HERBS = 6,
BAG_FAMILY_ENCHANTING_SUPP = 7, BAG_FAMILY_ENCHANTING_SUPP = 7,
BAG_FAMILY_ENGINEERING_SUPP = 8, BAG_FAMILY_ENGINEERING_SUPP = 8,
BAG_FAMILY_KEYS = 9, BAG_FAMILY_KEYS = 9,
BAG_FAMILY_GEMS = 10, BAG_FAMILY_GEMS = 10,
//BAG_FAMILY_UNK3 = 11, //BAG_FAMILY_UNK3 = 11,
BAG_FAMILY_MINING_SUPP = 12 BAG_FAMILY_MINING_SUPP = 12
}; };
enum INVENTORY_TYPES enum INVENTORY_TYPES
{ {
INVTYPE_NON_EQUIP = 0, INVTYPE_NON_EQUIP = 0,
INVTYPE_HEAD = 1, INVTYPE_HEAD = 1,
INVTYPE_NECK = 2, INVTYPE_NECK = 2,
INVTYPE_SHOULDERS = 3, INVTYPE_SHOULDERS = 3,
INVTYPE_BODY = 4, INVTYPE_BODY = 4,
INVTYPE_CHEST = 5, INVTYPE_CHEST = 5,
INVTYPE_WAIST = 6, INVTYPE_WAIST = 6,
INVTYPE_LEGS = 7, INVTYPE_LEGS = 7,
INVTYPE_FEET = 8, INVTYPE_FEET = 8,
INVTYPE_WRISTS = 9, INVTYPE_WRISTS = 9,
INVTYPE_HANDS = 10, INVTYPE_HANDS = 10,
INVTYPE_FINGER = 11, INVTYPE_FINGER = 11,
INVTYPE_TRINKET = 12, INVTYPE_TRINKET = 12,
INVTYPE_WEAPON = 13, INVTYPE_WEAPON = 13,
INVTYPE_SHIELD = 14, INVTYPE_SHIELD = 14,
INVTYPE_RANGED = 15, INVTYPE_RANGED = 15,
INVTYPE_CLOAK = 16, INVTYPE_CLOAK = 16,
INVTYPE_2HWEAPON = 17, INVTYPE_2HWEAPON = 17,
INVTYPE_BAG = 18, INVTYPE_BAG = 18,
INVTYPE_TABARD = 19, INVTYPE_TABARD = 19,
INVTYPE_ROBE = 20, INVTYPE_ROBE = 20,
INVTYPE_WEAPONMAINHAND = 21, INVTYPE_WEAPONMAINHAND = 21,
INVTYPE_WEAPONOFFHAND = 22, INVTYPE_WEAPONOFFHAND = 22,
INVTYPE_HOLDABLE = 23, INVTYPE_HOLDABLE = 23,
INVTYPE_AMMO = 24, INVTYPE_AMMO = 24,
INVTYPE_THROWN = 25, INVTYPE_THROWN = 25,
INVTYPE_RANGEDRIGHT = 26, INVTYPE_RANGEDRIGHT = 26,
INVTYPE_SLOT_ITEM = 27, INVTYPE_SLOT_ITEM = 27,
INVTYPE_RELIC = 28, INVTYPE_RELIC = 28,
NUM_INVENTORY_TYPES = 29 NUM_INVENTORY_TYPES = 29
}; };
enum INVENTORY_CLASS enum INVENTORY_CLASS
{ {
ITEM_CLASS_CONSUMABLE = 0, ITEM_CLASS_CONSUMABLE = 0,
ITEM_CLASS_CONTAINER = 1, ITEM_CLASS_CONTAINER = 1,
ITEM_CLASS_WEAPON = 2, ITEM_CLASS_WEAPON = 2,
ITEM_CLASS_JEWELRY = 3, ITEM_CLASS_JEWELRY = 3,
ITEM_CLASS_ARMOR = 4, ITEM_CLASS_ARMOR = 4,
ITEM_CLASS_REAGENT = 5, ITEM_CLASS_REAGENT = 5,
ITEM_CLASS_PROJECTILE = 6, ITEM_CLASS_PROJECTILE = 6,
ITEM_CLASS_TRADE_GOODS = 7, ITEM_CLASS_TRADE_GOODS = 7,
ITEM_CLASS_GENERIC = 8, ITEM_CLASS_GENERIC = 8,
ITEM_CLASS_BOOK = 9, ITEM_CLASS_BOOK = 9,
ITEM_CLASS_MONEY = 10, ITEM_CLASS_MONEY = 10,
ITEM_CLASS_QUIVER = 11, ITEM_CLASS_QUIVER = 11,
ITEM_CLASS_QUEST = 12, ITEM_CLASS_QUEST = 12,
ITEM_CLASS_KEY = 13, ITEM_CLASS_KEY = 13,
ITEM_CLASS_PERMANENT = 14, ITEM_CLASS_PERMANENT = 14,
ITEM_CLASS_JUNK = 15 ITEM_CLASS_JUNK = 15
}; };
// Client understand only 0 subclass for ITEM_CLASS_CONSUMABLE // Client understand only 0 subclass for ITEM_CLASS_CONSUMABLE
// but this value used in code as implementation workaround // but this value used in code as implementation workaround
enum ITEM_SUBCLASS_CONSUMABLE enum ITEM_SUBCLASS_CONSUMABLE
{ {
ITEM_SUBCLASS_POTION = 1, ITEM_SUBCLASS_POTION = 1,
ITEM_SUBCLASS_ELIXIR = 2, ITEM_SUBCLASS_ELIXIR = 2,
ITEM_SUBCLASS_FLASK = 3, ITEM_SUBCLASS_FLASK = 3,
ITEM_SUBCLASS_SCROLL = 4, ITEM_SUBCLASS_SCROLL = 4,
ITEM_SUBCLASS_FOOD = 5, ITEM_SUBCLASS_FOOD = 5,
ITEM_SUBCLASS_ITEM_ENHANCEMENT = 6, ITEM_SUBCLASS_ITEM_ENHANCEMENT = 6,
ITEM_SUBCLASS_BANDAGE = 7 ITEM_SUBCLASS_BANDAGE = 7
}; };
enum ITEM_SUBCLASS_CONTAINER enum ITEM_SUBCLASS_CONTAINER
{ {
ITEM_SUBCLASS_CONTAINER = 0, ITEM_SUBCLASS_CONTAINER = 0,
ITEM_SUBCLASS_SOUL_CONTAINER = 1, ITEM_SUBCLASS_SOUL_CONTAINER = 1,
ITEM_SUBCLASS_HERB_CONTAINER = 2, ITEM_SUBCLASS_HERB_CONTAINER = 2,
ITEM_SUBCLASS_ENCHANTING_CONTAINER = 3, ITEM_SUBCLASS_ENCHANTING_CONTAINER = 3,
ITEM_SUBCLASS_ENGINEERING_CONTAINER = 4, ITEM_SUBCLASS_ENGINEERING_CONTAINER = 4,
ITEM_SUBCLASS_GEM_CONTAINER = 5, ITEM_SUBCLASS_GEM_CONTAINER = 5,
ITEM_SUBCLASS_MINING_CONTAINER = 6, ITEM_SUBCLASS_MINING_CONTAINER = 6,
ITEM_SUBCLASS_LEATHERWORKING_CONTAINER = 7 ITEM_SUBCLASS_LEATHERWORKING_CONTAINER = 7
}; };
enum INVENTORY_SUBCLASS_WEAPON enum INVENTORY_SUBCLASS_WEAPON
{ {
ITEM_SUBCLASS_WEAPON_AXE = 0, ITEM_SUBCLASS_WEAPON_AXE = 0,
ITEM_SUBCLASS_WEAPON_AXE2 = 1, ITEM_SUBCLASS_WEAPON_AXE2 = 1,
ITEM_SUBCLASS_WEAPON_BOW = 2, ITEM_SUBCLASS_WEAPON_BOW = 2,
ITEM_SUBCLASS_WEAPON_GUN = 3, ITEM_SUBCLASS_WEAPON_GUN = 3,
ITEM_SUBCLASS_WEAPON_MACE = 4, ITEM_SUBCLASS_WEAPON_MACE = 4,
ITEM_SUBCLASS_WEAPON_MACE2 = 5, ITEM_SUBCLASS_WEAPON_MACE2 = 5,
ITEM_SUBCLASS_WEAPON_POLEARM = 6, ITEM_SUBCLASS_WEAPON_POLEARM = 6,
ITEM_SUBCLASS_WEAPON_SWORD = 7, ITEM_SUBCLASS_WEAPON_SWORD = 7,
ITEM_SUBCLASS_WEAPON_SWORD2 = 8, ITEM_SUBCLASS_WEAPON_SWORD2 = 8,
ITEM_SUBCLASS_WEAPON_obsolete = 9, ITEM_SUBCLASS_WEAPON_obsolete = 9,
ITEM_SUBCLASS_WEAPON_STAFF = 10, ITEM_SUBCLASS_WEAPON_STAFF = 10,
ITEM_SUBCLASS_WEAPON_EXOTIC = 11, ITEM_SUBCLASS_WEAPON_EXOTIC = 11,
ITEM_SUBCLASS_WEAPON_EXOTIC2 = 12, ITEM_SUBCLASS_WEAPON_EXOTIC2 = 12,
ITEM_SUBCLASS_WEAPON_UNARMED = 13, ITEM_SUBCLASS_WEAPON_UNARMED = 13,
ITEM_SUBCLASS_WEAPON_GENERIC = 14, ITEM_SUBCLASS_WEAPON_GENERIC = 14,
ITEM_SUBCLASS_WEAPON_DAGGER = 15, ITEM_SUBCLASS_WEAPON_DAGGER = 15,
ITEM_SUBCLASS_WEAPON_THROWN = 16, ITEM_SUBCLASS_WEAPON_THROWN = 16,
ITEM_SUBCLASS_WEAPON_SPEAR = 17, ITEM_SUBCLASS_WEAPON_SPEAR = 17,
ITEM_SUBCLASS_WEAPON_CROSSBOW = 18, ITEM_SUBCLASS_WEAPON_CROSSBOW = 18,
ITEM_SUBCLASS_WEAPON_WAND = 19, ITEM_SUBCLASS_WEAPON_WAND = 19,
ITEM_SUBCLASS_WEAPON_FISHING_POLE = 20 ITEM_SUBCLASS_WEAPON_FISHING_POLE = 20
}; };
enum ITEM_SUBCLASS_ARMOR enum ITEM_SUBCLASS_ARMOR
{ {
ITEM_SUBCLASS_ARMOR_GENERIC = 0, ITEM_SUBCLASS_ARMOR_GENERIC = 0,
ITEM_SUBCLASS_ARMOR_CLOTH = 1, ITEM_SUBCLASS_ARMOR_CLOTH = 1,
ITEM_SUBCLASS_ARMOR_LEATHER = 2, ITEM_SUBCLASS_ARMOR_LEATHER = 2,
ITEM_SUBCLASS_ARMOR_MAIL = 3, ITEM_SUBCLASS_ARMOR_MAIL = 3,
ITEM_SUBCLASS_ARMOR_PLATE = 4, ITEM_SUBCLASS_ARMOR_PLATE = 4,
ITEM_SUBCLASS_ARMOR_BUCKLER = 5, ITEM_SUBCLASS_ARMOR_BUCKLER = 5,
ITEM_SUBCLASS_ARMOR_SHIELD = 6 ITEM_SUBCLASS_ARMOR_SHIELD = 6
}; };
enum ITEM_SUBCLASS_PROJECTILE enum ITEM_SUBCLASS_PROJECTILE
{ {
ITEM_SUBCLASS_ARROW = 2, ITEM_SUBCLASS_ARROW = 2,
ITEM_SUBCLASS_BULLET = 3 ITEM_SUBCLASS_BULLET = 3
}; };
enum ITEM_SUBCLASS_TRADE_GOODS enum ITEM_SUBCLASS_TRADE_GOODS
{ {
ITEM_SUBCLASS_TRADE_GOODS = 0, ITEM_SUBCLASS_TRADE_GOODS = 0,
ITEM_SUBCLASS_PARTS = 1, ITEM_SUBCLASS_PARTS = 1,
ITEM_SUBCLASS_EXPLOSIVES = 2, ITEM_SUBCLASS_EXPLOSIVES = 2,
ITEM_SUBCLASS_DEVICES = 3, ITEM_SUBCLASS_DEVICES = 3,
ITEM_SUBCLASS_JEWELCRAFTING = 4, ITEM_SUBCLASS_JEWELCRAFTING = 4,
ITEM_SUBCLASS_CLOTH = 5, ITEM_SUBCLASS_CLOTH = 5,
ITEM_SUBCLASS_LEATHER = 6, ITEM_SUBCLASS_LEATHER = 6,
ITEM_SUBCLASS_METAL_STONE = 7, ITEM_SUBCLASS_METAL_STONE = 7,
ITEM_SUBCLASS_MEAT = 8, ITEM_SUBCLASS_MEAT = 8,
ITEM_SUBCLASS_HERB = 9, ITEM_SUBCLASS_HERB = 9,
ITEM_SUBCLASS_ELEMENTAZL = 10, ITEM_SUBCLASS_ELEMENTAZL = 10,
ITEM_SUBCLASS_TRADE_GOODS_OTHER = 11, ITEM_SUBCLASS_TRADE_GOODS_OTHER = 11,
ITEM_SUBCLASS_ENCHANTING = 12 ITEM_SUBCLASS_ENCHANTING = 12
}; };
enum ITEM_SUBCLASS_BOOK enum ITEM_SUBCLASS_BOOK
{ {
ITEM_SUBCLASS_BOOK = 0, ITEM_SUBCLASS_BOOK = 0,
ITEM_SUBCLASS_LEATHERWORKING_PATTERN = 1, ITEM_SUBCLASS_LEATHERWORKING_PATTERN = 1,
ITEM_SUBCLASS_TAILORING_PATTERN = 2, ITEM_SUBCLASS_TAILORING_PATTERN = 2,
ITEM_SUBCLASS_ENGINEERING_SCHEMATIC = 3, ITEM_SUBCLASS_ENGINEERING_SCHEMATIC = 3,
ITEM_SUBCLASS_COOKING_RECIPE = 5, ITEM_SUBCLASS_COOKING_RECIPE = 5,
ITEM_SUBCLASS_ALCHEMY_RECIPE = 6, ITEM_SUBCLASS_ALCHEMY_RECIPE = 6,
ITEM_SUBCLASS_FIRST_AID_MANUAL = 7, ITEM_SUBCLASS_FIRST_AID_MANUAL = 7,
ITEM_SUBCLASS_ENCHANTING_FORMULA = 8, ITEM_SUBCLASS_ENCHANTING_FORMULA = 8,
ITEM_SUBCLASS_FISHING_MANUAL = 9 ITEM_SUBCLASS_FISHING_MANUAL = 9
}; };
enum ITEM_SUBCLASS_QUIVER enum ITEM_SUBCLASS_QUIVER
{ {
ITEM_SUBCLASS_QUIVER = 2, ITEM_SUBCLASS_QUIVER = 2,
ITEM_SUBCLASS_AMMO_POUCH = 3 ITEM_SUBCLASS_AMMO_POUCH = 3
}; };
struct _ItemStat struct _ItemStat
{ {
uint32 ItemStatType; uint32 ItemStatType;
uint32 ItemStatValue; uint32 ItemStatValue;
}; };
struct _ItemSpell struct _ItemSpell
{ {
uint32 SpellId; uint32 SpellId;
uint32 SpellTrigger; uint32 SpellTrigger;
uint32 SpellCharges; uint32 SpellCharges;
uint32 SpellCooldown; uint32 SpellCooldown;
uint32 SpellCategory; uint32 SpellCategory;
uint32 SpellCategoryCooldown; uint32 SpellCategoryCooldown;
}; };
struct _ItemSocket struct _ItemSocket
{ {
uint32 Color; uint32 Color;
uint32 Content; uint32 Content;
}; };
struct _ItemDamage struct _ItemDamage
{ {
float DamageMin; float DamageMin;
float DamageMax; float DamageMax;
uint32 DamageType; uint32 DamageType;
}; };
struct ItemProto struct ItemProto
{ {
uint32 Id; uint32 Id;
uint32 Class; uint32 Class;
uint32 SubClass; uint32 SubClass;
std::string Name; std::string Name;
uint32 DisplayInfoID; uint32 DisplayInfoID;
uint32 Quality; uint32 Quality;
uint32 Flags; uint32 Flags;
uint32 BuyCount; uint32 BuyCount;
uint32 BuyPrice; uint32 BuyPrice;
uint32 SellPrice; uint32 SellPrice;
uint32 InventoryType; uint32 InventoryType;
uint32 AllowableClass; uint32 AllowableClass;
uint32 AllowableRace; uint32 AllowableRace;
uint32 ItemLevel; uint32 ItemLevel;
uint32 RequiredLevel; uint32 RequiredLevel;
uint32 RequiredSkill; uint32 RequiredSkill;
uint32 RequiredSkillRank; uint32 RequiredSkillRank;
uint32 RequiredSpell; uint32 RequiredSpell;
uint32 RequiredHonorRank; uint32 RequiredHonorRank;
uint32 RequiredCityRank; uint32 RequiredCityRank;
uint32 RequiredReputationFaction; uint32 RequiredReputationFaction;
uint32 RequiredReputationRank; uint32 RequiredReputationRank;
uint32 MaxCount; uint32 MaxCount;
uint32 Stackable; uint32 Stackable;
uint32 ContainerSlots; uint32 ContainerSlots;
_ItemStat ItemStat[10]; _ItemStat ItemStat[10];
_ItemDamage Damage[5]; _ItemDamage Damage[5];
uint32 Armor; uint32 Armor;
uint32 HolyRes; uint32 HolyRes;
uint32 FireRes; uint32 FireRes;
uint32 NatureRes; uint32 NatureRes;
uint32 FrostRes; uint32 FrostRes;
uint32 ShadowRes; uint32 ShadowRes;
uint32 ArcaneRes; uint32 ArcaneRes;
uint32 Delay; uint32 Delay;
uint32 Ammo_type; uint32 Ammo_type;
float RangedModRange; float RangedModRange;
_ItemSpell Spells[5]; _ItemSpell Spells[5];
uint32 Bonding; uint32 Bonding;
std::string Description; std::string Description;
uint32 PageText; uint32 PageText;
uint32 LanguageID; uint32 LanguageID;
uint32 PageMaterial; uint32 PageMaterial;
uint32 StartQuest; uint32 StartQuest;
uint32 LockID; uint32 LockID;
uint32 Material; uint32 Material;
uint32 Sheath; uint32 Sheath;
uint32 Extra; uint32 Extra;
uint32 Unk1; uint32 Unk1;
uint32 Block; uint32 Block;
uint32 ItemSet; uint32 ItemSet;
uint32 MaxDurability; uint32 MaxDurability;
uint32 Area; uint32 Area;
uint32 Map; uint32 Map;
uint32 BagFamily; uint32 BagFamily;
uint32 TotemCategory; uint32 TotemCategory;
_ItemSocket Socket[3]; _ItemSocket Socket[3];
uint32 socketBonus; uint32 socketBonus;
uint32 GemProperties; uint32 GemProperties;
uint32 ExtendedCost; uint32 ExtendedCost;
uint32 RequiredArenaRank; uint32 RequiredArenaRank;
uint32 RequiredDisenchantSkill; uint32 RequiredDisenchantSkill;
float ArmorDamageModifier; float ArmorDamageModifier;
}; };
class Item : public Object class Item : public Object
{ {
public: public:
Item(); Item();
void Create(uint64); void Create(uint64);
uint8 GetSlot(void) { return _slot; } uint8 GetSlot(void) { return _slot; }
void SetSlot(uint8 nr) { _slot = nr; } void SetSlot(uint8 nr) { _slot = nr; }
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); } uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
Bag *GetBag(void) { return _bag; } Bag *GetBag(void) { return _bag; }
bool IsInBag() const { return _bag != NULL; } bool IsInBag() const { return _bag != NULL; }
protected: protected:
uint8 _slot; uint8 _slot;
Bag *_bag; Bag *_bag;
}; };
#endif #endif

View File

@ -1,181 +1,181 @@
#include "common.h" #include "common.h"
#include "log.h" #include "log.h"
#include "MapTile.h" #include "MapTile.h"
#include "MapMgr.h" #include "MapMgr.h"
MapMgr::MapMgr() MapMgr::MapMgr()
{ {
DEBUG(logdebug("Creating MapMgr with TILESIZE=%.3f CHUNKSIZE=%.3f UNITSIZE=%.3f",TILESIZE,CHUNKSIZE,UNITSIZE)); DEBUG(logdebug("Creating MapMgr with TILESIZE=%.3f CHUNKSIZE=%.3f UNITSIZE=%.3f",TILESIZE,CHUNKSIZE,UNITSIZE));
_tiles = new MapTileStorage(); _tiles = new MapTileStorage();
_gridx = _gridy = _mapid = (-1); _gridx = _gridy = _mapid = (-1);
_mapsLoaded = false; _mapsLoaded = false;
} }
MapMgr::~MapMgr() MapMgr::~MapMgr()
{ {
Flush(); Flush();
delete _tiles; delete _tiles;
} }
void MapMgr::Update(float x, float y, uint32 m) void MapMgr::Update(float x, float y, uint32 m)
{ {
if(m != _mapid) if(m != _mapid)
{ {
Flush(); // we teleported to a new map, drop all loaded maps Flush(); // we teleported to a new map, drop all loaded maps
WDTFile *wdt = new WDTFile(); WDTFile *wdt = new WDTFile();
char buf[100]; char buf[100];
sprintf(buf,"data/maps/%u.wdt",m); sprintf(buf,"data/maps/%u.wdt",m);
if(!wdt->Load(buf)) if(!wdt->Load(buf))
{ {
logerror("MAPMGR: Could not load WDT file '%s'",buf); logerror("MAPMGR: Could not load WDT file '%s'",buf);
} }
_tiles->ImportTileMap(wdt); _tiles->ImportTileMap(wdt);
delete wdt; delete wdt;
_mapid = m; _mapid = m;
_gridx = _gridy = (-1); // must load tiles now _gridx = _gridy = (-1); // must load tiles now
} }
GridCoordPair gcoords = GetTransformGridCoordPair(x,y); GridCoordPair gcoords = GetTransformGridCoordPair(x,y);
if(gcoords.x != _gridx || gcoords.y != _gridy) if(gcoords.x != _gridx || gcoords.y != _gridy)
{ {
_gridx = gcoords.x; _gridx = gcoords.x;
_gridy = gcoords.y; _gridy = gcoords.y;
_LoadNearTiles(_gridx,_gridy,m); _LoadNearTiles(_gridx,_gridy,m);
_UnloadOldTiles(); _UnloadOldTiles();
} }
} }
void MapMgr::Flush(void) void MapMgr::Flush(void)
{ {
_mapsLoaded = false; _mapsLoaded = false;
for(uint32 i = 0; i < 4096; i++) for(uint32 i = 0; i < 4096; i++)
_tiles->UnloadMapTile(i); _tiles->UnloadMapTile(i);
logdebug("MAPMGR: Flushed all maps"); logdebug("MAPMGR: Flushed all maps");
} }
void MapMgr::_LoadNearTiles(uint32 gx, uint32 gy, uint32 m) void MapMgr::_LoadNearTiles(uint32 gx, uint32 gy, uint32 m)
{ {
logdebug("MAPMGR: Loading near tiles for (%u, %u) map %u",gx,gy,m); logdebug("MAPMGR: Loading near tiles for (%u, %u) map %u",gx,gy,m);
for(uint32 v = gy-1; v <= gy+1; v++) for(uint32 v = gy-1; v <= gy+1; v++)
{ {
for(uint32 h = gx-1; h <= gx+1; h++) for(uint32 h = gx-1; h <= gx+1; h++)
{ {
_LoadTile(h,v,m); _LoadTile(h,v,m);
} }
} }
_mapsLoaded = true; _mapsLoaded = true;
} }
void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m) void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m)
{ {
if(!_tiles->TileExists(gx,gy)) if(!_tiles->TileExists(gx,gy))
{ {
logerror("MAPMGR: Not loading MapTile (%u, %u) map %u, no entry in WDT tile map",gx,gy,m); logerror("MAPMGR: Not loading MapTile (%u, %u) map %u, no entry in WDT tile map",gx,gy,m);
return; return;
} }
if( !_tiles->GetTile(gx,gy) ) if( !_tiles->GetTile(gx,gy) )
{ {
ADTFile *adt = new ADTFile(); ADTFile *adt = new ADTFile();
char buf[300]; char buf[300];
sprintf(buf,"data/maps/%u_%u_%u.adt",m,gx,gy); sprintf(buf,"data/maps/%u_%u_%u.adt",m,gx,gy);
if(adt->Load(buf)) if(adt->Load(buf))
{ {
logdebug("MAPMGR: Loaded ADT '%s'",buf); logdebug("MAPMGR: Loaded ADT '%s'",buf);
MapTile *tile = new MapTile(); MapTile *tile = new MapTile();
tile->ImportFromADT(adt); tile->ImportFromADT(adt);
_tiles->SetTile(tile,gx,gy); _tiles->SetTile(tile,gx,gy);
logdebug("MAPMGR: Imported MapTile (%u, %u) for map %u",gx,gy,m); logdebug("MAPMGR: Imported MapTile (%u, %u) for map %u",gx,gy,m);
} }
else else
{ {
logerror("MAPMGR: Loading ADT '%s' failed!",buf); logerror("MAPMGR: Loading ADT '%s' failed!",buf);
} }
delete adt; delete adt;
} }
else else
{ {
logdebug("MAPMGR: No need to load MapTile (%u, %u) map %u",gx,gy,m); logdebug("MAPMGR: No need to load MapTile (%u, %u) map %u",gx,gy,m);
} }
} }
void MapMgr::_UnloadOldTiles(void) void MapMgr::_UnloadOldTiles(void)
{ {
for(uint32 gy=0; gy<64; gy++) for(uint32 gy=0; gy<64; gy++)
{ {
for(uint32 gx=0; gx<64; gx++) for(uint32 gx=0; gx<64; gx++)
{ {
if( (_gridx < gx-1 || _gridx > gx+1) && (_gridy < gy-1 || _gridy > gy+1) ) if( (_gridx < gx-1 || _gridx > gx+1) && (_gridy < gy-1 || _gridy > gy+1) )
{ {
if(_tiles->GetTile(gx,gy)) if(_tiles->GetTile(gx,gy))
{ {
logdebug("MAPMGR: Unloading old MapTile (%u, %u) map %u",gx,gy,_mapid); logdebug("MAPMGR: Unloading old MapTile (%u, %u) map %u",gx,gy,_mapid);
_tiles->UnloadMapTile(gx,gy); _tiles->UnloadMapTile(gx,gy);
} }
} }
} }
} }
} }
// Using forceLoad is VERY ineffective here, because the tile is removed again after the next Update() call! // Using forceLoad is VERY ineffective here, because the tile is removed again after the next Update() call!
MapTile *MapMgr::GetTile(uint32 xg, uint32 yg, bool forceLoad) MapTile *MapMgr::GetTile(uint32 xg, uint32 yg, bool forceLoad)
{ {
MapTile *tile = _tiles->GetTile(xg,yg); MapTile *tile = _tiles->GetTile(xg,yg);
if(!tile) if(!tile)
{ {
_LoadTile(xg,yg,_mapid); _LoadTile(xg,yg,_mapid);
tile = _tiles->GetTile(xg,yg); tile = _tiles->GetTile(xg,yg);
} }
return tile; return tile;
} }
MapTile *MapMgr::GetCurrentTile(void) MapTile *MapMgr::GetCurrentTile(void)
{ {
return GetTile(_gridx,_gridy); return GetTile(_gridx,_gridy);
} }
MapTile *MapMgr::GetNearTile(int32 xoffs, int32 yoffs) MapTile *MapMgr::GetNearTile(int32 xoffs, int32 yoffs)
{ {
return GetTile(_gridx + xoffs, _gridy + yoffs); return GetTile(_gridx + xoffs, _gridy + yoffs);
} }
uint32 MapMgr::GetGridCoord(float f) uint32 MapMgr::GetGridCoord(float f)
{ {
return (ZEROPOINT - f) / TILESIZE; return (ZEROPOINT - f) / TILESIZE;
} }
GridCoordPair MapMgr::GetTransformGridCoordPair(float x, float y) GridCoordPair MapMgr::GetTransformGridCoordPair(float x, float y)
{ {
return GridCoordPair(GetGridCoord(x), GetGridCoord(y)); return GridCoordPair(GetGridCoord(x), GetGridCoord(y));
} }
uint32 MapMgr::GetLoadedMapsCount(void) uint32 MapMgr::GetLoadedMapsCount(void)
{ {
uint32 counter = 0; uint32 counter = 0;
for(uint32 i = 0; i < 4096; i++) for(uint32 i = 0; i < 4096; i++)
{ {
if(_tiles->GetTile(i)) if(_tiles->GetTile(i))
{ {
counter++; counter++;
} }
} }
return counter; return counter;
} }
float MapMgr::GetZ(float x, float y) float MapMgr::GetZ(float x, float y)
{ {
return -99999.0f; // for now return lowest possible number, GetZ() will be implemented correctly later return -99999.0f; // for now return lowest possible number, GetZ() will be implemented correctly later
/* GridCoordPair gcoords = GetTransformGridCoordPair(x,y); /* GridCoordPair gcoords = GetTransformGridCoordPair(x,y);
MapTile *tile = _tiles->GetTile(gcoords.x,gcoords.y); MapTile *tile = _tiles->GetTile(gcoords.x,gcoords.y);
if(tile) if(tile)
{ {
#ifdef _DEBUG #ifdef _DEBUG
tile->DebugDumpToFile(); tile->DebugDumpToFile();
logdebug("DEBUG: tile dumped"); logdebug("DEBUG: tile dumped");
#endif #endif
return tile->GetZ(x,y); return tile->GetZ(x,y);
} }
logerror("MapMgr::GetZ() called for not loaded MapTile (%u, %u) for (%f, %f)",gcoords.x,gcoords.y,x,y); logerror("MapMgr::GetZ() called for not loaded MapTile (%u, %u) for (%f, %f)",gcoords.x,gcoords.y,x,y);
return 0;*/ return 0;*/
} }

View File

@ -1,171 +1,171 @@
#include "PseuWoW.h" #include "PseuWoW.h"
#include "WorldSession.h" #include "WorldSession.h"
#include "World.h" #include "World.h"
#include "MovementMgr.h" #include "MovementMgr.h"
#include "Player.h" #include "Player.h"
MovementMgr::MovementMgr() MovementMgr::MovementMgr()
{ {
_moveFlags = 0; _moveFlags = 0;
_instance = NULL; _instance = NULL;
_optime = 0; _optime = 0;
_updatetime = 0; _updatetime = 0;
} }
MovementMgr::~MovementMgr() MovementMgr::~MovementMgr()
{ {
} }
void MovementMgr::SetInstance(PseuInstance *inst) void MovementMgr::SetInstance(PseuInstance *inst)
{ {
_movemode = MOVEMODE_MANUAL; _movemode = MOVEMODE_MANUAL;
_instance = inst; _instance = inst;
_mychar = inst->GetWSession()->GetMyChar(); _mychar = inst->GetWSession()->GetMyChar();
} }
void MovementMgr::_BuildPacket(uint16 opcode) void MovementMgr::_BuildPacket(uint16 opcode)
{ {
WorldPacket wp(opcode,4+1+4+12); // it can be larger, if we are juming, on transport or swimming WorldPacket wp(opcode,4+1+4+12); // it can be larger, if we are juming, on transport or swimming
wp << _moveFlags; wp << _moveFlags;
wp << (uint8)0; // unk wp << (uint8)0; // unk
wp << getMSTime(); wp << getMSTime();
wp << _mychar->GetPosition(); wp << _mychar->GetPosition();
// TODO: transport not yet handled/done // TODO: transport not yet handled/done
if(_moveFlags & MOVEMENTFLAG_ONTRANSPORT) if(_moveFlags & MOVEMENTFLAG_ONTRANSPORT)
{ {
wp << (uint64)0; // transport guid wp << (uint64)0; // transport guid
wp << WorldPosition(); // transport position wp << WorldPosition(); // transport position
wp << getMSTime(); // transport time (??) wp << getMSTime(); // transport time (??)
} }
// TODO: swimming not yet done // TODO: swimming not yet done
if(_moveFlags & MOVEMENTFLAG_SWIMMING) if(_moveFlags & MOVEMENTFLAG_SWIMMING)
{ {
wp << (float)0; // angle; 1.55=looking up, -1.55=looking down, 0=looking forward wp << (float)0; // angle; 1.55=looking up, -1.55=looking down, 0=looking forward
} }
wp << (uint32)0; // last fall time (also used when jumping) wp << (uint32)0; // last fall time (also used when jumping)
// TODO: jumping not yet done // TODO: jumping not yet done
// TODO: spline not yet done // TODO: spline not yet done
_optime = getMSTime(); _optime = getMSTime();
} }
void MovementMgr::Update(bool calcpos) void MovementMgr::Update(bool calcpos)
{ {
uint32 curtime = getMSTime(); uint32 curtime = getMSTime();
uint32 timediff = curtime - _updatetime; uint32 timediff = curtime - _updatetime;
_updatetime = curtime; _updatetime = curtime;
if(_movemode == MOVEMODE_AUTO) if(_movemode == MOVEMODE_AUTO)
{ {
WorldPosition& pos = _mychar->GetPosition(); WorldPosition& pos = _mychar->GetPosition();
float turnspeed = _mychar->GetSpeed(MOVE_TURN) / 1000.0f * timediff; float turnspeed = _mychar->GetSpeed(MOVE_TURN) / 1000.0f * timediff;
float runspeed = _mychar->GetSpeed(MOVE_RUN) / 1000.0f * timediff; float runspeed = _mychar->GetSpeed(MOVE_RUN) / 1000.0f * timediff;
float movespeed = runspeed; // or use walkspeed, depending on setting. for now use only runspeed float movespeed = runspeed; // or use walkspeed, depending on setting. for now use only runspeed
// TODO: calc other speeds as soon as implemented // TODO: calc other speeds as soon as implemented
/* /*
if(_moveFlags & MOVEMENTFLAG_FORWARD) if(_moveFlags & MOVEMENTFLAG_FORWARD)
{ {
pos.x += movespeed * sin(pos.o); pos.x += movespeed * sin(pos.o);
pos.y += movespeed * cos(pos.o); pos.y += movespeed * cos(pos.o);
} }
// ... // ...
if(_moveFlags & MOVEMENTFLAG_LEFT) if(_moveFlags & MOVEMENTFLAG_LEFT)
{ {
pos.o -= turnspeed; pos.o -= turnspeed;
} }
if(_moveFlags & MOVEMENTFLAG_RIGHT) if(_moveFlags & MOVEMENTFLAG_RIGHT)
{ {
pos.o += turnspeed; pos.o += turnspeed;
} }
if(pos.o < 0) if(pos.o < 0)
pos.o += 2 * M_PI; pos.o += 2 * M_PI;
else if(pos.o > 2 * M_PI) else if(pos.o > 2 * M_PI)
pos.o -= 2 * M_PI; pos.o -= 2 * M_PI;
pos.z = _instance->GetWSession()->GetWorld()->GetPosZ(pos.x,pos.y); pos.z = _instance->GetWSession()->GetWorld()->GetPosZ(pos.x,pos.y);
*/ */
// ^ It should look like this later on, but its not finished, and formulas are not tested. // ^ It should look like this later on, but its not finished, and formulas are not tested.
// see it as some future plans that need a lot of finetuning ;) // see it as some future plans that need a lot of finetuning ;)
} }
// if we are moving, and 500ms have passed, send an heartbeat packet // if we are moving, and 500ms have passed, send an heartbeat packet
if( (_moveFlags & MOVEMENTFLAG_ANY_MOVE) && _optime + MOVE_HEARTBEAT_DELAY < getMSTime()) if( (_moveFlags & MOVEMENTFLAG_ANY_MOVE) && _optime + MOVE_HEARTBEAT_DELAY < getMSTime())
{ {
_BuildPacket(MSG_MOVE_HEARTBEAT); _BuildPacket(MSG_MOVE_HEARTBEAT);
} }
// TODO: apply gravity, handle falling, swimming, etc. // TODO: apply gravity, handle falling, swimming, etc.
} }
void MovementMgr::MoveStop(void) void MovementMgr::MoveStop(void)
{ {
_moveFlags &= ~(MOVEMENTFLAG_ANY_MOVE); _moveFlags &= ~(MOVEMENTFLAG_ANY_MOVE);
Update(false); Update(false);
_BuildPacket(MSG_MOVE_STOP); _BuildPacket(MSG_MOVE_STOP);
} }
void MovementMgr::MoveStartForward(void) void MovementMgr::MoveStartForward(void)
{ {
_moveFlags |= MOVEMENTFLAG_FORWARD; _moveFlags |= MOVEMENTFLAG_FORWARD;
_moveFlags &= ~MOVEMENTFLAG_BACKWARD; _moveFlags &= ~MOVEMENTFLAG_BACKWARD;
Update(false); Update(false);
_BuildPacket(MSG_MOVE_START_FORWARD); _BuildPacket(MSG_MOVE_START_FORWARD);
} }
void MovementMgr::MoveStartBackward(void) void MovementMgr::MoveStartBackward(void)
{ {
_moveFlags |= MOVEMENTFLAG_BACKWARD; _moveFlags |= MOVEMENTFLAG_BACKWARD;
_moveFlags &= ~MOVEMENTFLAG_FORWARD; _moveFlags &= ~MOVEMENTFLAG_FORWARD;
Update(false); Update(false);
_BuildPacket(MSG_MOVE_START_BACKWARD); _BuildPacket(MSG_MOVE_START_BACKWARD);
} }
void MovementMgr::MoveStartStrafeLeft(void) void MovementMgr::MoveStartStrafeLeft(void)
{ {
_moveFlags |= MOVEMENTFLAG_STRAFE_LEFT; _moveFlags |= MOVEMENTFLAG_STRAFE_LEFT;
_moveFlags &= ~MOVEMENTFLAG_STRAFE_RIGHT; _moveFlags &= ~MOVEMENTFLAG_STRAFE_RIGHT;
Update(false); Update(false);
_BuildPacket(MSG_MOVE_START_STRAFE_LEFT); _BuildPacket(MSG_MOVE_START_STRAFE_LEFT);
} }
void MovementMgr::MoveStartStrafeRight(void) void MovementMgr::MoveStartStrafeRight(void)
{ {
_moveFlags |= MOVEMENTFLAG_STRAFE_RIGHT; _moveFlags |= MOVEMENTFLAG_STRAFE_RIGHT;
_moveFlags &= ~MOVEMENTFLAG_STRAFE_LEFT; _moveFlags &= ~MOVEMENTFLAG_STRAFE_LEFT;
Update(false); Update(false);
_BuildPacket(MSG_MOVE_START_STRAFE_RIGHT); _BuildPacket(MSG_MOVE_START_STRAFE_RIGHT);
} }
void MovementMgr::MoveStartTurnLeft(void) void MovementMgr::MoveStartTurnLeft(void)
{ {
_moveFlags |= MOVEMENTFLAG_LEFT; _moveFlags |= MOVEMENTFLAG_LEFT;
_moveFlags &= ~MOVEMENTFLAG_RIGHT; _moveFlags &= ~MOVEMENTFLAG_RIGHT;
Update(false); Update(false);
_BuildPacket(MSG_MOVE_START_TURN_LEFT); _BuildPacket(MSG_MOVE_START_TURN_LEFT);
} }
void MovementMgr::MoveStartTurnRight(void) void MovementMgr::MoveStartTurnRight(void)
{ {
_moveFlags |= MOVEMENTFLAG_RIGHT; _moveFlags |= MOVEMENTFLAG_RIGHT;
_moveFlags &= ~MOVEMENTFLAG_LEFT; _moveFlags &= ~MOVEMENTFLAG_LEFT;
Update(false); Update(false);
_BuildPacket(MSG_MOVE_START_TURN_RIGHT); _BuildPacket(MSG_MOVE_START_TURN_RIGHT);
} }
void MovementMgr::MoveStopTurn(void) void MovementMgr::MoveStopTurn(void)
{ {
_moveFlags &= ~(MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT); _moveFlags &= ~(MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT);
Update(false); Update(false);
_BuildPacket(MSG_MOVE_STOP_TURN); _BuildPacket(MSG_MOVE_STOP_TURN);
} }
void MovementMgr::MoveSetFacing(float o) void MovementMgr::MoveSetFacing(float o)
{ {
_mychar->SetPosition(_mychar->GetX(), _mychar->GetY(), _mychar->GetZ(), o); _mychar->SetPosition(_mychar->GetX(), _mychar->GetY(), _mychar->GetZ(), o);
Update(true); Update(true);
_BuildPacket(MSG_MOVE_SET_FACING); _BuildPacket(MSG_MOVE_SET_FACING);
} }

View File

@ -1,85 +1,85 @@
#ifndef MOVEMENTMGR_H #ifndef MOVEMENTMGR_H
#define MOVEMENTMGR_H #define MOVEMENTMGR_H
#include "common.h" #include "common.h"
#define MOVE_HEARTBEAT_DELAY 500 #define MOVE_HEARTBEAT_DELAY 500
enum MovementFlags enum MovementFlags
{ {
MOVEMENTFLAG_NONE = 0x00000000, MOVEMENTFLAG_NONE = 0x00000000,
MOVEMENTFLAG_FORWARD = 0x00000001, MOVEMENTFLAG_FORWARD = 0x00000001,
MOVEMENTFLAG_BACKWARD = 0x00000002, MOVEMENTFLAG_BACKWARD = 0x00000002,
MOVEMENTFLAG_STRAFE_LEFT = 0x00000004, MOVEMENTFLAG_STRAFE_LEFT = 0x00000004,
MOVEMENTFLAG_STRAFE_RIGHT = 0x00000008, MOVEMENTFLAG_STRAFE_RIGHT = 0x00000008,
MOVEMENTFLAG_LEFT = 0x00000010, MOVEMENTFLAG_LEFT = 0x00000010,
MOVEMENTFLAG_RIGHT = 0x00000020, MOVEMENTFLAG_RIGHT = 0x00000020,
MOVEMENTFLAG_PITCH_UP = 0x00000040, MOVEMENTFLAG_PITCH_UP = 0x00000040,
MOVEMENTFLAG_PITCH_DOWN = 0x00000080, MOVEMENTFLAG_PITCH_DOWN = 0x00000080,
MOVEMENTFLAG_WALK = 0x00000100, MOVEMENTFLAG_WALK = 0x00000100,
MOVEMENTFLAG_ONTRANSPORT = 0x00000200, MOVEMENTFLAG_ONTRANSPORT = 0x00000200,
MOVEMENTFLAG_UNK1 = 0x00000400, MOVEMENTFLAG_UNK1 = 0x00000400,
MOVEMENTFLAG_FLY_UNK1 = 0x00000800, MOVEMENTFLAG_FLY_UNK1 = 0x00000800,
MOVEMENTFLAG_JUMPING = 0x00001000, MOVEMENTFLAG_JUMPING = 0x00001000,
MOVEMENTFLAG_UNK4 = 0x00002000, MOVEMENTFLAG_UNK4 = 0x00002000,
MOVEMENTFLAG_FALLING = 0x00004000, MOVEMENTFLAG_FALLING = 0x00004000,
// 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000 // 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000
MOVEMENTFLAG_SWIMMING = 0x00200000, // appears with fly flag also MOVEMENTFLAG_SWIMMING = 0x00200000, // appears with fly flag also
MOVEMENTFLAG_FLY_UP = 0x00400000, MOVEMENTFLAG_FLY_UP = 0x00400000,
MOVEMENTFLAG_CAN_FLY = 0x00800000, MOVEMENTFLAG_CAN_FLY = 0x00800000,
MOVEMENTFLAG_FLYING = 0x01000000, MOVEMENTFLAG_FLYING = 0x01000000,
MOVEMENTFLAG_UNK5 = 0x02000000, MOVEMENTFLAG_UNK5 = 0x02000000,
MOVEMENTFLAG_SPLINE = 0x04000000, // probably wrong name MOVEMENTFLAG_SPLINE = 0x04000000, // probably wrong name
MOVEMENTFLAG_SPLINE2 = 0x08000000, MOVEMENTFLAG_SPLINE2 = 0x08000000,
MOVEMENTFLAG_WATERWALKING = 0x10000000, MOVEMENTFLAG_WATERWALKING = 0x10000000,
MOVEMENTFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive) MOVEMENTFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive)
MOVEMENTFLAG_UNK3 = 0x40000000, MOVEMENTFLAG_UNK3 = 0x40000000,
// custom flags // custom flags
MOVEMENTFLAG_ANY_MOVE = (MOVEMENTFLAG_BACKWARD | MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT MOVEMENTFLAG_ANY_MOVE = (MOVEMENTFLAG_BACKWARD | MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_STRAFE_LEFT | MOVEMENTFLAG_STRAFE_RIGHT
| MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT) | MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT)
}; };
enum MoveModes enum MoveModes
{ {
MOVEMODE_AUTO, // CPU controlling movement, MyCharacter must be updated MOVEMODE_AUTO, // CPU controlling movement, MyCharacter must be updated
MOVEMODE_MANUAL, // user controlling movement, MyCharacter is updated by the GUI already MOVEMODE_MANUAL, // user controlling movement, MyCharacter is updated by the GUI already
}; };
class PseuInstance; class PseuInstance;
class MyCharacter; class MyCharacter;
class MovementMgr class MovementMgr
{ {
public: public:
MovementMgr(); MovementMgr();
~MovementMgr(); ~MovementMgr();
void SetInstance(PseuInstance*); void SetInstance(PseuInstance*);
inline void SetMoveMode(uint8 mode) { _movemode = mode; } inline void SetMoveMode(uint8 mode) { _movemode = mode; }
void Update(bool); void Update(bool);
void MoveStartForward(void); void MoveStartForward(void);
void MoveStartBackward(void); void MoveStartBackward(void);
void MoveStop(void); void MoveStop(void);
void MoveStartStrafeLeft(void); void MoveStartStrafeLeft(void);
void MoveStartStrafeRight(void); void MoveStartStrafeRight(void);
void MoveStartTurnLeft(void); void MoveStartTurnLeft(void);
void MoveStartTurnRight(void); void MoveStartTurnRight(void);
void MoveStopTurn(void); void MoveStopTurn(void);
void MoveFallLand(void); void MoveFallLand(void);
void MoveSetFacing(float); void MoveSetFacing(float);
private: private:
void _BuildPacket(uint16); void _BuildPacket(uint16);
PseuInstance *_instance; PseuInstance *_instance;
MyCharacter *_mychar; MyCharacter *_mychar;
uint32 _moveFlags; // server relevant flags (move forward/backward/swim/fly/jump/etc) uint32 _moveFlags; // server relevant flags (move forward/backward/swim/fly/jump/etc)
uint32 _updatetime; // timeMS of last update cycle uint32 _updatetime; // timeMS of last update cycle
uint32 _optime; // timeMS when last opcode was sent uint32 _optime; // timeMS when last opcode was sent
uint8 _movemode; // automatic or manual uint8 _movemode; // automatic or manual
UnitMoveType _movetype; // index used for speed selection UnitMoveType _movetype; // index used for speed selection
}; };
#endif #endif

View File

@ -1,153 +1,153 @@
#include "common.h" #include "common.h"
#include "log.h" #include "log.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "ObjMgr.h" #include "ObjMgr.h"
#include "GUI/PseuGUI.h" #include "GUI/PseuGUI.h"
ObjMgr::ObjMgr() ObjMgr::ObjMgr()
{ {
DEBUG(logdebug("DEBUG: ObjMgr created")); DEBUG(logdebug("DEBUG: ObjMgr created"));
} }
ObjMgr::~ObjMgr() ObjMgr::~ObjMgr()
{ {
RemoveAll(); RemoveAll();
} }
void ObjMgr::SetInstance(PseuInstance *i) void ObjMgr::SetInstance(PseuInstance *i)
{ {
_instance = i; _instance = i;
DEBUG(logdebug("DEBUG: ObjMgr instance set to 0x%X",i)); DEBUG(logdebug("DEBUG: ObjMgr instance set to 0x%X",i));
} }
void ObjMgr::RemoveAll(void) void ObjMgr::RemoveAll(void)
{ {
for(ItemProtoMap::iterator i = _iproto.begin(); i!=_iproto.end(); i++) for(ItemProtoMap::iterator i = _iproto.begin(); i!=_iproto.end(); i++)
{ {
delete i->second; delete i->second;
} }
for(CreatureTemplateMap::iterator i = _creature_templ.begin(); i!=_creature_templ.end(); i++) for(CreatureTemplateMap::iterator i = _creature_templ.begin(); i!=_creature_templ.end(); i++)
{ {
delete i->second; delete i->second;
} }
while(_obj.size()) while(_obj.size())
{ {
Remove(_obj.begin()->first); Remove(_obj.begin()->first);
} }
} }
void ObjMgr::Remove(uint64 guid) void ObjMgr::Remove(uint64 guid)
{ {
Object *o = GetObj(guid); Object *o = GetObj(guid);
if(o) if(o)
{ {
PseuGUI *gui = _instance->GetGUI(); PseuGUI *gui = _instance->GetGUI();
if(gui) if(gui)
gui->NotifyObjectDeletion(guid); // we have a gui, which must delete linked DrawObject gui->NotifyObjectDeletion(guid); // we have a gui, which must delete linked DrawObject
_obj.erase(guid); // now delete the obj from the mgr _obj.erase(guid); // now delete the obj from the mgr
delete o; // and delete the obj itself delete o; // and delete the obj itself
} }
else else
{ {
_obj.erase(guid); _obj.erase(guid);
logcustom(2,LRED,"ObjMgr::Remove("I64FMT") - not existing",guid); logcustom(2,LRED,"ObjMgr::Remove("I64FMT") - not existing",guid);
} }
} }
// -- Object part -- // -- Object part --
void ObjMgr::Add(Object *o) void ObjMgr::Add(Object *o)
{ {
_obj[o->GetGUID()] = o; _obj[o->GetGUID()] = o;
PseuGUI *gui = _instance->GetGUI(); PseuGUI *gui = _instance->GetGUI();
if(gui) if(gui)
gui->NotifyObjectCreation(o); gui->NotifyObjectCreation(o);
} }
Object *ObjMgr::GetObj(uint64 guid) Object *ObjMgr::GetObj(uint64 guid)
{ {
if(!guid) if(!guid)
return NULL; return NULL;
for(ObjectMap::iterator i = _obj.begin(); i!=_obj.end(); i++) for(ObjectMap::iterator i = _obj.begin(); i!=_obj.end(); i++)
if(i->second->GetGUID() == guid) if(i->second->GetGUID() == guid)
return i->second; return i->second;
return NULL; return NULL;
} }
// iterate over all objects and assign a name to all matching the entry and typeid // iterate over all objects and assign a name to all matching the entry and typeid
uint32 ObjMgr::AssignNameToObj(uint32 entry, uint8 type, std::string name) uint32 ObjMgr::AssignNameToObj(uint32 entry, uint8 type, std::string name)
{ {
uint32 changed = 0; uint32 changed = 0;
for(ObjectMap::iterator it = _obj.begin(); it != _obj.end(); it++) for(ObjectMap::iterator it = _obj.begin(); it != _obj.end(); it++)
{ {
if(it->second->GetEntry() && (it->second->GetTypeId() == type)) if(it->second->GetEntry() && (it->second->GetTypeId() == type))
{ {
it->second->SetName(name); it->second->SetName(name);
changed++; changed++;
} }
} }
return changed; return changed;
} }
// -- Item part -- // -- Item part --
void ObjMgr::Add(ItemProto *proto) void ObjMgr::Add(ItemProto *proto)
{ {
_iproto[proto->Id] = proto; _iproto[proto->Id] = proto;
} }
ItemProto *ObjMgr::GetItemProto(uint32 entry) ItemProto *ObjMgr::GetItemProto(uint32 entry)
{ {
ItemProtoMap::iterator it = _iproto.find(entry); ItemProtoMap::iterator it = _iproto.find(entry);
if(it != _iproto.end()) if(it != _iproto.end())
return it->second; return it->second;
return NULL; return NULL;
} }
void ObjMgr::AddNonexistentItem(uint32 id) void ObjMgr::AddNonexistentItem(uint32 id)
{ {
_noitem.insert(id); _noitem.insert(id);
} }
bool ObjMgr::ItemNonExistent(uint32 id) bool ObjMgr::ItemNonExistent(uint32 id)
{ {
return _noitem.find(id) != _noitem.end(); return _noitem.find(id) != _noitem.end();
} }
// -- Creature part -- // -- Creature part --
void ObjMgr::Add(CreatureTemplate *cr) void ObjMgr::Add(CreatureTemplate *cr)
{ {
_creature_templ[cr->entry] = cr; _creature_templ[cr->entry] = cr;
} }
CreatureTemplate *ObjMgr::GetCreatureTemplate(uint32 entry) CreatureTemplate *ObjMgr::GetCreatureTemplate(uint32 entry)
{ {
CreatureTemplateMap::iterator it = _creature_templ.find(entry); CreatureTemplateMap::iterator it = _creature_templ.find(entry);
if(it != _creature_templ.end()) if(it != _creature_templ.end())
return it->second; return it->second;
return NULL; return NULL;
} }
void ObjMgr::AddNonexistentCreature(uint32 id) void ObjMgr::AddNonexistentCreature(uint32 id)
{ {
_nocreature.insert(id); _nocreature.insert(id);
} }
bool ObjMgr::CreatureNonExistent(uint32 id) bool ObjMgr::CreatureNonExistent(uint32 id)
{ {
return _nocreature.find(id) != _nocreature.end(); return _nocreature.find(id) != _nocreature.end();
} }
// -- misc part -- // -- misc part --
void ObjMgr::AddRequestedPlayerGUID(uint32 loguid) void ObjMgr::AddRequestedPlayerGUID(uint32 loguid)
{ {
_reqpnames.insert(loguid); _reqpnames.insert(loguid);
} }
bool ObjMgr::IsRequestedPlayerGUID(uint32 loguid) bool ObjMgr::IsRequestedPlayerGUID(uint32 loguid)
{ {
return _reqpnames.find(loguid) != _reqpnames.end(); return _reqpnames.find(loguid) != _reqpnames.end();
} }

View File

@ -1,177 +1,177 @@
#ifndef _OBJECT_H #ifndef _OBJECT_H
#define _OBJECT_H #define _OBJECT_H
#include "UpdateFields.h" #include "UpdateFields.h"
#include "ObjectDefines.h" #include "ObjectDefines.h"
#include "common.h" #include "common.h"
#include "HelperDefs.h" #include "HelperDefs.h"
#include "World.h" #include "World.h"
enum TYPE enum TYPE
{ {
TYPE_OBJECT = 1, TYPE_OBJECT = 1,
TYPE_ITEM = 2, TYPE_ITEM = 2,
TYPE_CONTAINER = 6, // a container is ALWAYS an item! TYPE_CONTAINER = 6, // a container is ALWAYS an item!
TYPE_UNIT = 8, TYPE_UNIT = 8,
TYPE_PLAYER = 16, TYPE_PLAYER = 16,
TYPE_GAMEOBJECT = 32, TYPE_GAMEOBJECT = 32,
TYPE_DYNAMICOBJECT = 64, TYPE_DYNAMICOBJECT = 64,
TYPE_CORPSE = 128, TYPE_CORPSE = 128,
TYPE_AIGROUP = 256, TYPE_AIGROUP = 256,
TYPE_AREATRIGGER = 512 TYPE_AREATRIGGER = 512
}; };
enum TYPEID enum TYPEID
{ {
TYPEID_OBJECT = 0, TYPEID_OBJECT = 0,
TYPEID_ITEM = 1, TYPEID_ITEM = 1,
TYPEID_CONTAINER = 2, TYPEID_CONTAINER = 2,
TYPEID_UNIT = 3, TYPEID_UNIT = 3,
TYPEID_PLAYER = 4, TYPEID_PLAYER = 4,
TYPEID_GAMEOBJECT = 5, TYPEID_GAMEOBJECT = 5,
TYPEID_DYNAMICOBJECT = 6, TYPEID_DYNAMICOBJECT = 6,
TYPEID_CORPSE = 7, TYPEID_CORPSE = 7,
TYPEID_AIGROUP = 8, TYPEID_AIGROUP = 8,
TYPEID_AREATRIGGER = 9 TYPEID_AREATRIGGER = 9
}; };
class Object class Object
{ {
public: public:
virtual ~Object(); virtual ~Object();
inline const uint64 GetGUID() const { return GetUInt64Value(0); } inline const uint64 GetGUID() const { return GetUInt64Value(0); }
inline const uint32 GetGUIDLow() const { return GetUInt32Value(0); } inline const uint32 GetGUIDLow() const { return GetUInt32Value(0); }
inline const uint32 GetGUIDHigh() const { return GetUInt32Value(1); } inline const uint32 GetGUIDHigh() const { return GetUInt32Value(1); }
inline uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } inline uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
inline uint16 GetValuesCount(void) { return _valuescount; } inline uint16 GetValuesCount(void) { return _valuescount; }
inline const uint8 GetTypeId() { return _typeid; } inline const uint8 GetTypeId() { return _typeid; }
inline const uint8 GetTypeMask() { return _type; } inline const uint8 GetTypeMask() { return _type; }
inline bool IsType(uint8 mask) { return (mask & _type) ? true : false; } inline bool IsType(uint8 mask) { return (mask & _type) ? true : false; }
inline bool IsPlayer(void) { return _typeid == TYPEID_PLAYER; } // specific inline bool IsPlayer(void) { return _typeid == TYPEID_PLAYER; } // specific
inline bool IsUnit(void) { return _type & TYPE_UNIT; } // generic (unit = creature or player) inline bool IsUnit(void) { return _type & TYPE_UNIT; } // generic (unit = creature or player)
inline bool IsCreature(void) { return IsUnit() && !IsPlayer(); } // specific inline bool IsCreature(void) { return IsUnit() && !IsPlayer(); } // specific
inline bool IsItem(void) { return _type & TYPE_ITEM; } // generic (item or container) inline bool IsItem(void) { return _type & TYPE_ITEM; } // generic (item or container)
inline bool IsContainer(void) { return _typeid == TYPEID_CONTAINER; } // specific inline bool IsContainer(void) { return _typeid == TYPEID_CONTAINER; } // specific
inline bool IsCorpse(void) { return _typeid == TYPEID_CORPSE; } // specific inline bool IsCorpse(void) { return _typeid == TYPEID_CORPSE; } // specific
inline bool IsDynObject(void) { return _typeid == TYPEID_DYNAMICOBJECT; } // specific inline bool IsDynObject(void) { return _typeid == TYPEID_DYNAMICOBJECT; } // specific
inline bool IsWorldObject(void) { return _type & (TYPE_PLAYER | TYPE_UNIT | TYPE_CORPSE | TYPE_DYNAMICOBJECT | TYPE_GAMEOBJECT); } inline bool IsWorldObject(void) { return _type & (TYPE_PLAYER | TYPE_UNIT | TYPE_CORPSE | TYPE_DYNAMICOBJECT | TYPE_GAMEOBJECT); }
inline const uint32 GetUInt32Value( uint16 index ) const inline const uint32 GetUInt32Value( uint16 index ) const
{ {
return _uint32values[ index ]; return _uint32values[ index ];
} }
inline const uint64 GetUInt64Value( uint16 index ) const inline const uint64 GetUInt64Value( uint16 index ) const
{ {
return *((uint64*)&(_uint32values[ index ])); return *((uint64*)&(_uint32values[ index ]));
} }
inline bool HasFlag( uint16 index, uint32 flag ) const inline bool HasFlag( uint16 index, uint32 flag ) const
{ {
return (_uint32values[ index ] & flag) != 0; return (_uint32values[ index ] & flag) != 0;
} }
inline const float GetFloatValue( uint16 index ) const inline const float GetFloatValue( uint16 index ) const
{ {
return _floatvalues[ index ]; return _floatvalues[ index ];
} }
inline void SetFloatValue( uint16 index, float value ) inline void SetFloatValue( uint16 index, float value )
{ {
_floatvalues[ index ] = value; _floatvalues[ index ] = value;
} }
inline void SetUInt32Value( uint16 index, uint32 value ) inline void SetUInt32Value( uint16 index, uint32 value )
{ {
_uint32values[ index ] = value; _uint32values[ index ] = value;
} }
inline void SetName(std::string name) { _name = name; } inline void SetName(std::string name) { _name = name; }
inline std::string GetName(void) { return _name; } inline std::string GetName(void) { return _name; }
inline float GetObjectSize() const inline float GetObjectSize() const
{ {
return ( _valuescount > UNIT_FIELD_BOUNDINGRADIUS ) ? _floatvalues[UNIT_FIELD_BOUNDINGRADIUS] : 0.39f; return ( _valuescount > UNIT_FIELD_BOUNDINGRADIUS ) ? _floatvalues[UNIT_FIELD_BOUNDINGRADIUS] : 0.39f;
} }
void Create(uint64 guid); void Create(uint64 guid);
protected: protected:
Object(); Object();
void _InitValues(void); void _InitValues(void);
uint16 _valuescount; uint16 _valuescount;
union union
{ {
uint32 *_uint32values; uint32 *_uint32values;
float *_floatvalues; float *_floatvalues;
}; };
uint8 _type; uint8 _type;
uint8 _typeid; uint8 _typeid;
std::string _name; std::string _name;
}; };
class WorldObject : public Object class WorldObject : public Object
{ {
public: public:
virtual ~WorldObject ( ) {} virtual ~WorldObject ( ) {}
void SetPosition(float x, float y, float z, float o, uint16 _map); void SetPosition(float x, float y, float z, float o, uint16 _map);
void SetPosition(float x, float y, float z, float o); void SetPosition(float x, float y, float z, float o);
inline void SetPosition(WorldPosition& wp) { _wpos = wp; } inline void SetPosition(WorldPosition& wp) { _wpos = wp; }
inline void SetPosition(WorldPosition& wp, uint16 mapid) { SetPosition(wp); _m = mapid; } inline void SetPosition(WorldPosition& wp, uint16 mapid) { SetPosition(wp); _m = mapid; }
inline WorldPosition GetPosition(void) {return _wpos; } inline WorldPosition GetPosition(void) {return _wpos; }
inline float GetX(void) { return _wpos.x; } inline float GetX(void) { return _wpos.x; }
inline float GetY(void) { return _wpos.y; } inline float GetY(void) { return _wpos.y; }
inline float GetZ(void) { return _wpos.z; } inline float GetZ(void) { return _wpos.z; }
inline float GetO(void) { return _wpos.o; } inline float GetO(void) { return _wpos.o; }
float GetDistance(WorldObject *obj); float GetDistance(WorldObject *obj);
float GetDistance2d(float x, float y); float GetDistance2d(float x, float y);
float GetDistance(float x, float y, float z); float GetDistance(float x, float y, float z);
float GetDistance2d(WorldObject *obj); float GetDistance2d(WorldObject *obj);
float GetDistanceZ(WorldObject *obj); float GetDistanceZ(WorldObject *obj);
protected: protected:
WorldObject(); WorldObject();
WorldPosition _wpos; // coords, orientation WorldPosition _wpos; // coords, orientation
uint16 _m; // map uint16 _m; // map
}; };
inline uint32 GetValuesCountByTypeId(uint8 tid) inline uint32 GetValuesCountByTypeId(uint8 tid)
{ {
switch(tid) switch(tid)
{ {
case TYPEID_OBJECT: return OBJECT_END; case TYPEID_OBJECT: return OBJECT_END;
case TYPEID_UNIT: return UNIT_END; case TYPEID_UNIT: return UNIT_END;
case TYPEID_PLAYER: return PLAYER_END; case TYPEID_PLAYER: return PLAYER_END;
case TYPEID_ITEM: return ITEM_END; case TYPEID_ITEM: return ITEM_END;
case TYPEID_CONTAINER: return CONTAINER_END; case TYPEID_CONTAINER: return CONTAINER_END;
case TYPEID_GAMEOBJECT: return GAMEOBJECT_END; case TYPEID_GAMEOBJECT: return GAMEOBJECT_END;
case TYPEID_DYNAMICOBJECT: return DYNAMICOBJECT_END; case TYPEID_DYNAMICOBJECT: return DYNAMICOBJECT_END;
case TYPEID_CORPSE: return CORPSE_END; case TYPEID_CORPSE: return CORPSE_END;
} }
return 0; return 0;
} }
inline uint8 GetTypeIdByGuid(uint64 guid) inline uint8 GetTypeIdByGuid(uint64 guid)
{ {
switch(GUID_HIPART(guid)) switch(GUID_HIPART(guid))
{ {
case HIGHGUID_PLAYER: case HIGHGUID_PLAYER:
return TYPEID_PLAYER; return TYPEID_PLAYER;
case HIGHGUID_CORPSE: case HIGHGUID_CORPSE:
case HIGHGUID_PLAYER_CORPSE: // not sure case HIGHGUID_PLAYER_CORPSE: // not sure
return TYPEID_CORPSE; return TYPEID_CORPSE;
case HIGHGUID_ITEM: // == HIGHGUID_CONTAINER case HIGHGUID_ITEM: // == HIGHGUID_CONTAINER
return TYPEID_ITEM; return TYPEID_ITEM;
case HIGHGUID_DYNAMICOBJECT: case HIGHGUID_DYNAMICOBJECT:
return TYPEID_DYNAMICOBJECT; return TYPEID_DYNAMICOBJECT;
case HIGHGUID_GAMEOBJECT: case HIGHGUID_GAMEOBJECT:
case HIGHGUID_TRANSPORT: // not sure case HIGHGUID_TRANSPORT: // not sure
return TYPEID_GAMEOBJECT; return TYPEID_GAMEOBJECT;
case HIGHGUID_UNIT: case HIGHGUID_UNIT:
return TYPEID_UNIT; return TYPEID_UNIT;
} }
return TYPEID_OBJECT; return TYPEID_OBJECT;
} }
#endif #endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,21 @@
#include "common.h" #include "common.h"
#include "Unit.h" #include "Unit.h"
Unit::Unit() : WorldObject() Unit::Unit() : WorldObject()
{ {
_type |= TYPE_UNIT; _type |= TYPE_UNIT;
_typeid = TYPEID_UNIT; _typeid = TYPEID_UNIT;
_valuescount = UNIT_END; _valuescount = UNIT_END;
} }
void Unit::Create(uint64 guid) void Unit::Create(uint64 guid)
{ {
Object::Create(guid); Object::Create(guid);
} }
uint8 Unit::GetGender(void) uint8 Unit::GetGender(void)
{ {
uint32 temp = GetUInt32Value(UNIT_FIELD_BYTES_0); uint32 temp = GetUInt32Value(UNIT_FIELD_BYTES_0);
return ((uint8*)&temp)[2]; return ((uint8*)&temp)[2];
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,34 @@
#ifndef _UPDATEDATA_H #ifndef _UPDATEDATA_H
#define _UPDATEDATA_H #define _UPDATEDATA_H
enum OBJECT_UPDATE_TYPE enum OBJECT_UPDATE_TYPE
{ {
UPDATETYPE_VALUES = 0, UPDATETYPE_VALUES = 0,
UPDATETYPE_MOVEMENT = 1, UPDATETYPE_MOVEMENT = 1,
UPDATETYPE_CREATE_OBJECT = 2, UPDATETYPE_CREATE_OBJECT = 2,
UPDATETYPE_CREATE_OBJECT2 = 3, UPDATETYPE_CREATE_OBJECT2 = 3,
UPDATETYPE_OUT_OF_RANGE_OBJECTS = 4, UPDATETYPE_OUT_OF_RANGE_OBJECTS = 4,
UPDATETYPE_NEAR_OBJECTS = 5 UPDATETYPE_NEAR_OBJECTS = 5
}; };
enum OBJECT_UPDATE_FLAGS enum OBJECT_UPDATE_FLAGS
{ {
UPDATEFLAG_SELF = 0x01, UPDATEFLAG_SELF = 0x01,
UPDATEFLAG_TRANSPORT = 0x02, UPDATEFLAG_TRANSPORT = 0x02,
UPDATEFLAG_FULLGUID = 0x04, UPDATEFLAG_FULLGUID = 0x04,
UPDATEFLAG_HIGHGUID = 0x08, UPDATEFLAG_HIGHGUID = 0x08,
UPDATEFLAG_ALL = 0x10, UPDATEFLAG_ALL = 0x10,
UPDATEFLAG_LIVING = 0x20, UPDATEFLAG_LIVING = 0x20,
UPDATEFLAG_HASPOSITION = 0x40 UPDATEFLAG_HASPOSITION = 0x40
}; };
// not sure about those flags, mangos hasnt a description for it either // not sure about those flags, mangos hasnt a description for it either
enum FLAGS2_UPDATE_FLAGS enum FLAGS2_UPDATE_FLAGS
{ {
FLAGS2_TRANSPORT = 0x200, FLAGS2_TRANSPORT = 0x200,
FLAGS2_SPIRITHEALER = 0x10000000, FLAGS2_SPIRITHEALER = 0x10000000,
}; };
bool IsFloatField(uint8, uint32); bool IsFloatField(uint8, uint32);
#endif #endif

View File

@ -1,469 +1,469 @@
/* /*
* Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/> * Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef _UPDATEFIELDS_AUTO_H #ifndef _UPDATEFIELDS_AUTO_H
#define _UPDATEFIELDS_AUTO_H #define _UPDATEFIELDS_AUTO_H
// Auto generated for version 0, 3, 2, 7655 // Auto generated for version 0, 3, 2, 7655
enum EObjectFields enum EObjectFields
{ {
OBJECT_FIELD_GUID = 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC OBJECT_FIELD_GUID = 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC
OBJECT_FIELD_TYPE = 0x0002, // Size: 1, Type: INT, Flags: PUBLIC OBJECT_FIELD_TYPE = 0x0002, // Size: 1, Type: INT, Flags: PUBLIC
OBJECT_FIELD_ENTRY = 0x0003, // Size: 1, Type: INT, Flags: PUBLIC OBJECT_FIELD_ENTRY = 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
OBJECT_FIELD_SCALE_X = 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC OBJECT_FIELD_SCALE_X = 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC
OBJECT_FIELD_PADDING = 0x0005, // Size: 1, Type: INT, Flags: NONE OBJECT_FIELD_PADDING = 0x0005, // Size: 1, Type: INT, Flags: NONE
OBJECT_END = 0x0006, OBJECT_END = 0x0006,
}; };
enum EItemFields enum EItemFields
{ {
ITEM_FIELD_OWNER = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_OWNER = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC
ITEM_FIELD_CONTAINED = OBJECT_END + 0x0002, // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_CONTAINED = OBJECT_END + 0x0002, // Size: 2, Type: LONG, Flags: PUBLIC
ITEM_FIELD_CREATOR = OBJECT_END + 0x0004, // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_CREATOR = OBJECT_END + 0x0004, // Size: 2, Type: LONG, Flags: PUBLIC
ITEM_FIELD_GIFTCREATOR = OBJECT_END + 0x0006, // Size: 2, Type: LONG, Flags: PUBLIC ITEM_FIELD_GIFTCREATOR = OBJECT_END + 0x0006, // Size: 2, Type: LONG, Flags: PUBLIC
ITEM_FIELD_STACK_COUNT = OBJECT_END + 0x0008, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2 ITEM_FIELD_STACK_COUNT = OBJECT_END + 0x0008, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2
ITEM_FIELD_DURATION = OBJECT_END + 0x0009, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2 ITEM_FIELD_DURATION = OBJECT_END + 0x0009, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2
ITEM_FIELD_SPELL_CHARGES = OBJECT_END + 0x000A, // Size: 5, Type: INT, Flags: OWNER_ONLY, UNK2 ITEM_FIELD_SPELL_CHARGES = OBJECT_END + 0x000A, // Size: 5, Type: INT, Flags: OWNER_ONLY, UNK2
ITEM_FIELD_FLAGS = OBJECT_END + 0x000F, // Size: 1, Type: INT, Flags: PUBLIC ITEM_FIELD_FLAGS = OBJECT_END + 0x000F, // Size: 1, Type: INT, Flags: PUBLIC
ITEM_FIELD_ENCHANTMENT = OBJECT_END + 0x0010, // Size: 33, Type: INT, Flags: PUBLIC ITEM_FIELD_ENCHANTMENT = OBJECT_END + 0x0010, // Size: 33, Type: INT, Flags: PUBLIC
ITEM_FIELD_PROPERTY_SEED = OBJECT_END + 0x0031, // Size: 1, Type: INT, Flags: PUBLIC ITEM_FIELD_PROPERTY_SEED = OBJECT_END + 0x0031, // Size: 1, Type: INT, Flags: PUBLIC
// custom // custom
ITEM_FIELD_SUFFIX_FACTOR = ITEM_FIELD_PROPERTY_SEED, ITEM_FIELD_SUFFIX_FACTOR = ITEM_FIELD_PROPERTY_SEED,
ITEM_FIELD_RANDOM_PROPERTIES_ID = OBJECT_END + 0x0032, // Size: 1, Type: INT, Flags: PUBLIC ITEM_FIELD_RANDOM_PROPERTIES_ID = OBJECT_END + 0x0032, // Size: 1, Type: INT, Flags: PUBLIC
ITEM_FIELD_ITEM_TEXT_ID = OBJECT_END + 0x0033, // Size: 1, Type: INT, Flags: OWNER_ONLY ITEM_FIELD_ITEM_TEXT_ID = OBJECT_END + 0x0033, // Size: 1, Type: INT, Flags: OWNER_ONLY
ITEM_FIELD_DURABILITY = OBJECT_END + 0x0034, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2 ITEM_FIELD_DURABILITY = OBJECT_END + 0x0034, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2
ITEM_FIELD_MAXDURABILITY = OBJECT_END + 0x0035, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2 ITEM_FIELD_MAXDURABILITY = OBJECT_END + 0x0035, // Size: 1, Type: INT, Flags: OWNER_ONLY, UNK2
ITEM_END = OBJECT_END + 0x0036, ITEM_END = OBJECT_END + 0x0036,
}; };
enum EContainerFields enum EContainerFields
{ {
CONTAINER_FIELD_NUM_SLOTS = ITEM_END + 0x0000, // Size: 1, Type: INT, Flags: PUBLIC CONTAINER_FIELD_NUM_SLOTS = ITEM_END + 0x0000, // Size: 1, Type: INT, Flags: PUBLIC
CONTAINER_ALIGN_PAD = ITEM_END + 0x0001, // Size: 1, Type: BYTES, Flags: NONE CONTAINER_ALIGN_PAD = ITEM_END + 0x0001, // Size: 1, Type: BYTES, Flags: NONE
CONTAINER_FIELD_SLOT_1 = ITEM_END + 0x0002, // Size: 72, Type: LONG, Flags: PUBLIC CONTAINER_FIELD_SLOT_1 = ITEM_END + 0x0002, // Size: 72, Type: LONG, Flags: PUBLIC
CONTAINER_END = ITEM_END + 0x004A, CONTAINER_END = ITEM_END + 0x004A,
}; };
enum EUnitFields enum EUnitFields
{ {
UNIT_FIELD_CHARM = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_CHARM = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_SUMMON = OBJECT_END + 0x0002, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_SUMMON = OBJECT_END + 0x0002, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_CHARMEDBY = OBJECT_END + 0x0004, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_CHARMEDBY = OBJECT_END + 0x0004, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_SUMMONEDBY = OBJECT_END + 0x0006, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_SUMMONEDBY = OBJECT_END + 0x0006, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_CREATEDBY = OBJECT_END + 0x0008, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_CREATEDBY = OBJECT_END + 0x0008, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_TARGET = OBJECT_END + 0x000A, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_TARGET = OBJECT_END + 0x000A, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_PERSUADED = OBJECT_END + 0x000C, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_PERSUADED = OBJECT_END + 0x000C, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_CHANNEL_OBJECT = OBJECT_END + 0x000E, // Size: 2, Type: LONG, Flags: PUBLIC UNIT_FIELD_CHANNEL_OBJECT = OBJECT_END + 0x000E, // Size: 2, Type: LONG, Flags: PUBLIC
UNIT_FIELD_HEALTH = OBJECT_END + 0x0010, // Size: 1, Type: INT, Flags: DYNAMIC UNIT_FIELD_HEALTH = OBJECT_END + 0x0010, // Size: 1, Type: INT, Flags: DYNAMIC
UNIT_FIELD_POWER1 = OBJECT_END + 0x0011, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER1 = OBJECT_END + 0x0011, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_POWER2 = OBJECT_END + 0x0012, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER2 = OBJECT_END + 0x0012, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_POWER3 = OBJECT_END + 0x0013, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER3 = OBJECT_END + 0x0013, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_POWER4 = OBJECT_END + 0x0014, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER4 = OBJECT_END + 0x0014, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_POWER5 = OBJECT_END + 0x0015, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER5 = OBJECT_END + 0x0015, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXHEALTH = OBJECT_END + 0x0016, // Size: 1, Type: INT, Flags: DYNAMIC UNIT_FIELD_MAXHEALTH = OBJECT_END + 0x0016, // Size: 1, Type: INT, Flags: DYNAMIC
UNIT_FIELD_MAXPOWER1 = OBJECT_END + 0x0017, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER1 = OBJECT_END + 0x0017, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER2 = OBJECT_END + 0x0018, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER2 = OBJECT_END + 0x0018, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER3 = OBJECT_END + 0x0019, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER3 = OBJECT_END + 0x0019, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER4 = OBJECT_END + 0x001A, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER4 = OBJECT_END + 0x001A, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MAXPOWER5 = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER5 = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_LEVEL = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_LEVEL = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_FACTIONTEMPLATE = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_FACTIONTEMPLATE = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_BYTES_0 = OBJECT_END + 0x001E, // Size: 1, Type: BYTES, Flags: PUBLIC UNIT_FIELD_BYTES_0 = OBJECT_END + 0x001E, // Size: 1, Type: BYTES, Flags: PUBLIC
UNIT_VIRTUAL_ITEM_SLOT_DISPLAY = OBJECT_END + 0x001F, // Size: 3, Type: INT, Flags: PUBLIC UNIT_VIRTUAL_ITEM_SLOT_DISPLAY = OBJECT_END + 0x001F, // Size: 3, Type: INT, Flags: PUBLIC
UNIT_VIRTUAL_ITEM_INFO = OBJECT_END + 0x0022, // Size: 6, Type: BYTES, Flags: PUBLIC UNIT_VIRTUAL_ITEM_INFO = OBJECT_END + 0x0022, // Size: 6, Type: BYTES, Flags: PUBLIC
UNIT_FIELD_FLAGS = OBJECT_END + 0x0028, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_FLAGS = OBJECT_END + 0x0028, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_FLAGS_2 = OBJECT_END + 0x0029, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_FLAGS_2 = OBJECT_END + 0x0029, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_AURA = OBJECT_END + 0x002A, // Size: 56, Type: INT, Flags: PUBLIC UNIT_FIELD_AURA = OBJECT_END + 0x002A, // Size: 56, Type: INT, Flags: PUBLIC
UNIT_FIELD_AURAFLAGS = OBJECT_END + 0x0062, // Size: 14, Type: BYTES, Flags: PUBLIC UNIT_FIELD_AURAFLAGS = OBJECT_END + 0x0062, // Size: 14, Type: BYTES, Flags: PUBLIC
UNIT_FIELD_AURALEVELS = OBJECT_END + 0x0070, // Size: 14, Type: BYTES, Flags: PUBLIC UNIT_FIELD_AURALEVELS = OBJECT_END + 0x0070, // Size: 14, Type: BYTES, Flags: PUBLIC
UNIT_FIELD_AURAAPPLICATIONS = OBJECT_END + 0x007E, // Size: 14, Type: BYTES, Flags: PUBLIC UNIT_FIELD_AURAAPPLICATIONS = OBJECT_END + 0x007E, // Size: 14, Type: BYTES, Flags: PUBLIC
UNIT_FIELD_AURASTATE = OBJECT_END + 0x008C, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_AURASTATE = OBJECT_END + 0x008C, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_BASEATTACKTIME = OBJECT_END + 0x008D, // Size: 2, Type: INT, Flags: PUBLIC UNIT_FIELD_BASEATTACKTIME = OBJECT_END + 0x008D, // Size: 2, Type: INT, Flags: PUBLIC
// custom // custom
UNIT_FIELD_OFFHANDATTACKTIME = UNIT_FIELD_BASEATTACKTIME + 1, UNIT_FIELD_OFFHANDATTACKTIME = UNIT_FIELD_BASEATTACKTIME + 1,
UNIT_FIELD_RANGEDATTACKTIME = OBJECT_END + 0x008F, // Size: 1, Type: INT, Flags: PRIVATE UNIT_FIELD_RANGEDATTACKTIME = OBJECT_END + 0x008F, // Size: 1, Type: INT, Flags: PRIVATE
UNIT_FIELD_BOUNDINGRADIUS = OBJECT_END + 0x0090, // Size: 1, Type: FLOAT, Flags: PUBLIC UNIT_FIELD_BOUNDINGRADIUS = OBJECT_END + 0x0090, // Size: 1, Type: FLOAT, Flags: PUBLIC
UNIT_FIELD_COMBATREACH = OBJECT_END + 0x0091, // Size: 1, Type: FLOAT, Flags: PUBLIC UNIT_FIELD_COMBATREACH = OBJECT_END + 0x0091, // Size: 1, Type: FLOAT, Flags: PUBLIC
UNIT_FIELD_DISPLAYID = OBJECT_END + 0x0092, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_DISPLAYID = OBJECT_END + 0x0092, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_NATIVEDISPLAYID = OBJECT_END + 0x0093, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_NATIVEDISPLAYID = OBJECT_END + 0x0093, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MOUNTDISPLAYID = OBJECT_END + 0x0094, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MOUNTDISPLAYID = OBJECT_END + 0x0094, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_MINDAMAGE = OBJECT_END + 0x0095, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3 UNIT_FIELD_MINDAMAGE = OBJECT_END + 0x0095, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3
UNIT_FIELD_MAXDAMAGE = OBJECT_END + 0x0096, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3 UNIT_FIELD_MAXDAMAGE = OBJECT_END + 0x0096, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3
UNIT_FIELD_MINOFFHANDDAMAGE = OBJECT_END + 0x0097, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3 UNIT_FIELD_MINOFFHANDDAMAGE = OBJECT_END + 0x0097, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3
UNIT_FIELD_MAXOFFHANDDAMAGE = OBJECT_END + 0x0098, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3 UNIT_FIELD_MAXOFFHANDDAMAGE = OBJECT_END + 0x0098, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY, UNK3
UNIT_FIELD_BYTES_1 = OBJECT_END + 0x0099, // Size: 1, Type: BYTES, Flags: PUBLIC UNIT_FIELD_BYTES_1 = OBJECT_END + 0x0099, // Size: 1, Type: BYTES, Flags: PUBLIC
UNIT_FIELD_PETNUMBER = OBJECT_END + 0x009A, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_PETNUMBER = OBJECT_END + 0x009A, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_PET_NAME_TIMESTAMP = OBJECT_END + 0x009B, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_PET_NAME_TIMESTAMP = OBJECT_END + 0x009B, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_FIELD_PETEXPERIENCE = OBJECT_END + 0x009C, // Size: 1, Type: INT, Flags: OWNER_ONLY UNIT_FIELD_PETEXPERIENCE = OBJECT_END + 0x009C, // Size: 1, Type: INT, Flags: OWNER_ONLY
UNIT_FIELD_PETNEXTLEVELEXP = OBJECT_END + 0x009D, // Size: 1, Type: INT, Flags: OWNER_ONLY UNIT_FIELD_PETNEXTLEVELEXP = OBJECT_END + 0x009D, // Size: 1, Type: INT, Flags: OWNER_ONLY
UNIT_DYNAMIC_FLAGS = OBJECT_END + 0x009E, // Size: 1, Type: INT, Flags: DYNAMIC UNIT_DYNAMIC_FLAGS = OBJECT_END + 0x009E, // Size: 1, Type: INT, Flags: DYNAMIC
UNIT_CHANNEL_SPELL = OBJECT_END + 0x009F, // Size: 1, Type: INT, Flags: PUBLIC UNIT_CHANNEL_SPELL = OBJECT_END + 0x009F, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_MOD_CAST_SPEED = OBJECT_END + 0x00A0, // Size: 1, Type: FLOAT, Flags: PUBLIC UNIT_MOD_CAST_SPEED = OBJECT_END + 0x00A0, // Size: 1, Type: FLOAT, Flags: PUBLIC
UNIT_CREATED_BY_SPELL = OBJECT_END + 0x00A1, // Size: 1, Type: INT, Flags: PUBLIC UNIT_CREATED_BY_SPELL = OBJECT_END + 0x00A1, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_NPC_FLAGS = OBJECT_END + 0x00A2, // Size: 1, Type: INT, Flags: DYNAMIC UNIT_NPC_FLAGS = OBJECT_END + 0x00A2, // Size: 1, Type: INT, Flags: DYNAMIC
UNIT_NPC_EMOTESTATE = OBJECT_END + 0x00A3, // Size: 1, Type: INT, Flags: PUBLIC UNIT_NPC_EMOTESTATE = OBJECT_END + 0x00A3, // Size: 1, Type: INT, Flags: PUBLIC
UNIT_TRAINING_POINTS = OBJECT_END + 0x00A4, // Size: 1, Type: TWO_SHORT, Flags: OWNER_ONLY UNIT_TRAINING_POINTS = OBJECT_END + 0x00A4, // Size: 1, Type: TWO_SHORT, Flags: OWNER_ONLY
UNIT_FIELD_STAT0 = OBJECT_END + 0x00A5, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_STAT0 = OBJECT_END + 0x00A5, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_STAT1 = OBJECT_END + 0x00A6, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_STAT1 = OBJECT_END + 0x00A6, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_STAT2 = OBJECT_END + 0x00A7, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_STAT2 = OBJECT_END + 0x00A7, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_STAT3 = OBJECT_END + 0x00A8, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_STAT3 = OBJECT_END + 0x00A8, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_STAT4 = OBJECT_END + 0x00A9, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_STAT4 = OBJECT_END + 0x00A9, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_POSSTAT0 = OBJECT_END + 0x00AA, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_POSSTAT0 = OBJECT_END + 0x00AA, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_POSSTAT1 = OBJECT_END + 0x00AB, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_POSSTAT1 = OBJECT_END + 0x00AB, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_POSSTAT2 = OBJECT_END + 0x00AC, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_POSSTAT2 = OBJECT_END + 0x00AC, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_POSSTAT3 = OBJECT_END + 0x00AD, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_POSSTAT3 = OBJECT_END + 0x00AD, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_POSSTAT4 = OBJECT_END + 0x00AE, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_POSSTAT4 = OBJECT_END + 0x00AE, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_NEGSTAT0 = OBJECT_END + 0x00AF, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_NEGSTAT0 = OBJECT_END + 0x00AF, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_NEGSTAT1 = OBJECT_END + 0x00B0, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_NEGSTAT1 = OBJECT_END + 0x00B0, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_NEGSTAT2 = OBJECT_END + 0x00B1, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_NEGSTAT2 = OBJECT_END + 0x00B1, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_NEGSTAT3 = OBJECT_END + 0x00B2, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_NEGSTAT3 = OBJECT_END + 0x00B2, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_NEGSTAT4 = OBJECT_END + 0x00B3, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_NEGSTAT4 = OBJECT_END + 0x00B3, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_RESISTANCES = OBJECT_END + 0x00B4, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY, UNK3 UNIT_FIELD_RESISTANCES = OBJECT_END + 0x00B4, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY, UNK3
UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE = OBJECT_END + 0x00BB, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE = OBJECT_END + 0x00BB, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE = OBJECT_END + 0x00C2, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE = OBJECT_END + 0x00C2, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_BASE_MANA = OBJECT_END + 0x00C9, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_BASE_MANA = OBJECT_END + 0x00C9, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_BASE_HEALTH = OBJECT_END + 0x00CA, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_BASE_HEALTH = OBJECT_END + 0x00CA, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_BYTES_2 = OBJECT_END + 0x00CB, // Size: 1, Type: BYTES, Flags: PUBLIC UNIT_FIELD_BYTES_2 = OBJECT_END + 0x00CB, // Size: 1, Type: BYTES, Flags: PUBLIC
UNIT_FIELD_ATTACK_POWER = OBJECT_END + 0x00CC, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_ATTACK_POWER = OBJECT_END + 0x00CC, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_ATTACK_POWER_MODS = OBJECT_END + 0x00CD, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_ATTACK_POWER_MODS = OBJECT_END + 0x00CD, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_ATTACK_POWER_MULTIPLIER = OBJECT_END + 0x00CE, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_ATTACK_POWER_MULTIPLIER = OBJECT_END + 0x00CE, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_RANGED_ATTACK_POWER = OBJECT_END + 0x00CF, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_RANGED_ATTACK_POWER = OBJECT_END + 0x00CF, // Size: 1, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_RANGED_ATTACK_POWER_MODS = OBJECT_END + 0x00D0, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_RANGED_ATTACK_POWER_MODS = OBJECT_END + 0x00D0, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = OBJECT_END + 0x00D1, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = OBJECT_END + 0x00D1, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_MINRANGEDDAMAGE = OBJECT_END + 0x00D2, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_MINRANGEDDAMAGE = OBJECT_END + 0x00D2, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_MAXRANGEDDAMAGE = OBJECT_END + 0x00D3, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_MAXRANGEDDAMAGE = OBJECT_END + 0x00D3, // Size: 1, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_POWER_COST_MODIFIER = OBJECT_END + 0x00D4, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_POWER_COST_MODIFIER = OBJECT_END + 0x00D4, // Size: 7, Type: INT, Flags: PRIVATE, OWNER_ONLY
UNIT_FIELD_POWER_COST_MULTIPLIER = OBJECT_END + 0x00DB, // Size: 7, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY UNIT_FIELD_POWER_COST_MULTIPLIER = OBJECT_END + 0x00DB, // Size: 7, Type: FLOAT, Flags: PRIVATE, OWNER_ONLY
UNIT_END = OBJECT_END + 0x00E2, UNIT_END = OBJECT_END + 0x00E2,
PLAYER_DUEL_ARBITER = UNIT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_DUEL_ARBITER = UNIT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_FLAGS = UNIT_END + 0x0002, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_FLAGS = UNIT_END + 0x0002, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_GUILDID = UNIT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_GUILDID = UNIT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_GUILDRANK = UNIT_END + 0x0004, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_GUILDRANK = UNIT_END + 0x0004, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_BYTES = UNIT_END + 0x0005, // Size: 1, Type: BYTES, Flags: PUBLIC PLAYER_BYTES = UNIT_END + 0x0005, // Size: 1, Type: BYTES, Flags: PUBLIC
PLAYER_BYTES_2 = UNIT_END + 0x0006, // Size: 1, Type: BYTES, Flags: PUBLIC PLAYER_BYTES_2 = UNIT_END + 0x0006, // Size: 1, Type: BYTES, Flags: PUBLIC
PLAYER_BYTES_3 = UNIT_END + 0x0007, // Size: 1, Type: BYTES, Flags: PUBLIC PLAYER_BYTES_3 = UNIT_END + 0x0007, // Size: 1, Type: BYTES, Flags: PUBLIC
PLAYER_DUEL_TEAM = UNIT_END + 0x0008, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_DUEL_TEAM = UNIT_END + 0x0008, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_GUILD_TIMESTAMP = UNIT_END + 0x0009, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_GUILD_TIMESTAMP = UNIT_END + 0x0009, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_QUEST_LOG_1_1 = UNIT_END + 0x000A, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_1_1 = UNIT_END + 0x000A, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_1_2 = UNIT_END + 0x000B, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_1_2 = UNIT_END + 0x000B, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_2_1 = UNIT_END + 0x000D, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_2_1 = UNIT_END + 0x000D, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_2_2 = UNIT_END + 0x000E, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_2_2 = UNIT_END + 0x000E, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_3_1 = UNIT_END + 0x0010, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_3_1 = UNIT_END + 0x0010, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_3_2 = UNIT_END + 0x0011, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_3_2 = UNIT_END + 0x0011, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_4_1 = UNIT_END + 0x0013, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_4_1 = UNIT_END + 0x0013, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_4_2 = UNIT_END + 0x0014, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_4_2 = UNIT_END + 0x0014, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_5_1 = UNIT_END + 0x0016, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_5_1 = UNIT_END + 0x0016, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_5_2 = UNIT_END + 0x0017, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_5_2 = UNIT_END + 0x0017, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_6_1 = UNIT_END + 0x0019, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_6_1 = UNIT_END + 0x0019, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_6_2 = UNIT_END + 0x001A, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_6_2 = UNIT_END + 0x001A, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_7_1 = UNIT_END + 0x001C, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_7_1 = UNIT_END + 0x001C, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_7_2 = UNIT_END + 0x001D, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_7_2 = UNIT_END + 0x001D, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_8_1 = UNIT_END + 0x001F, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_8_1 = UNIT_END + 0x001F, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_8_2 = UNIT_END + 0x0020, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_8_2 = UNIT_END + 0x0020, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_9_1 = UNIT_END + 0x0022, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_9_1 = UNIT_END + 0x0022, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_9_2 = UNIT_END + 0x0023, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_9_2 = UNIT_END + 0x0023, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_10_1 = UNIT_END + 0x0025, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_10_1 = UNIT_END + 0x0025, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_10_2 = UNIT_END + 0x0026, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_10_2 = UNIT_END + 0x0026, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_11_1 = UNIT_END + 0x0028, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_11_1 = UNIT_END + 0x0028, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_11_2 = UNIT_END + 0x0029, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_11_2 = UNIT_END + 0x0029, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_12_1 = UNIT_END + 0x002B, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_12_1 = UNIT_END + 0x002B, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_12_2 = UNIT_END + 0x002C, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_12_2 = UNIT_END + 0x002C, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_13_1 = UNIT_END + 0x002E, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_13_1 = UNIT_END + 0x002E, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_13_2 = UNIT_END + 0x002F, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_13_2 = UNIT_END + 0x002F, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_14_1 = UNIT_END + 0x0031, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_14_1 = UNIT_END + 0x0031, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_14_2 = UNIT_END + 0x0032, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_14_2 = UNIT_END + 0x0032, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_15_1 = UNIT_END + 0x0034, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_15_1 = UNIT_END + 0x0034, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_15_2 = UNIT_END + 0x0035, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_15_2 = UNIT_END + 0x0035, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_16_1 = UNIT_END + 0x0037, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_16_1 = UNIT_END + 0x0037, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_16_2 = UNIT_END + 0x0038, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_16_2 = UNIT_END + 0x0038, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_17_1 = UNIT_END + 0x003A, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_17_1 = UNIT_END + 0x003A, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_17_2 = UNIT_END + 0x003B, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_17_2 = UNIT_END + 0x003B, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_18_1 = UNIT_END + 0x003D, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_18_1 = UNIT_END + 0x003D, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_18_2 = UNIT_END + 0x003E, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_18_2 = UNIT_END + 0x003E, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_19_1 = UNIT_END + 0x0040, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_19_1 = UNIT_END + 0x0040, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_19_2 = UNIT_END + 0x0041, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_19_2 = UNIT_END + 0x0041, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_20_1 = UNIT_END + 0x0043, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_20_1 = UNIT_END + 0x0043, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_20_2 = UNIT_END + 0x0044, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_20_2 = UNIT_END + 0x0044, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_21_1 = UNIT_END + 0x0046, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_21_1 = UNIT_END + 0x0046, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_21_2 = UNIT_END + 0x0047, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_21_2 = UNIT_END + 0x0047, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_22_1 = UNIT_END + 0x0049, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_22_1 = UNIT_END + 0x0049, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_22_2 = UNIT_END + 0x004A, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_22_2 = UNIT_END + 0x004A, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_23_1 = UNIT_END + 0x004C, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_23_1 = UNIT_END + 0x004C, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_23_2 = UNIT_END + 0x004D, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_23_2 = UNIT_END + 0x004D, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_24_1 = UNIT_END + 0x004F, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_24_1 = UNIT_END + 0x004F, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_24_2 = UNIT_END + 0x0050, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_24_2 = UNIT_END + 0x0050, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_QUEST_LOG_25_1 = UNIT_END + 0x0052, // Size: 1, Type: INT, Flags: GROUP_ONLY PLAYER_QUEST_LOG_25_1 = UNIT_END + 0x0052, // Size: 1, Type: INT, Flags: GROUP_ONLY
PLAYER_QUEST_LOG_25_2 = UNIT_END + 0x0053, // Size: 2, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_25_2 = UNIT_END + 0x0053, // Size: 2, Type: INT, Flags: PRIVATE
PLAYER_VISIBLE_ITEM_1_CREATOR = UNIT_END + 0x0055, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_1_CREATOR = UNIT_END + 0x0055, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_1_0 = UNIT_END + 0x0057, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_1_0 = UNIT_END + 0x0057, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_1_PROPERTIES = UNIT_END + 0x0063, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_1_PROPERTIES = UNIT_END + 0x0063, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_1_PAD = UNIT_END + 0x0064, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_1_PAD = UNIT_END + 0x0064, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_2_CREATOR = UNIT_END + 0x0065, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_2_CREATOR = UNIT_END + 0x0065, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_2_0 = UNIT_END + 0x0067, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_2_0 = UNIT_END + 0x0067, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_2_PROPERTIES = UNIT_END + 0x0073, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_2_PROPERTIES = UNIT_END + 0x0073, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_2_PAD = UNIT_END + 0x0074, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_2_PAD = UNIT_END + 0x0074, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_3_CREATOR = UNIT_END + 0x0075, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_3_CREATOR = UNIT_END + 0x0075, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_3_0 = UNIT_END + 0x0077, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_3_0 = UNIT_END + 0x0077, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_3_PROPERTIES = UNIT_END + 0x0083, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_3_PROPERTIES = UNIT_END + 0x0083, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_3_PAD = UNIT_END + 0x0084, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_3_PAD = UNIT_END + 0x0084, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_4_CREATOR = UNIT_END + 0x0085, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_4_CREATOR = UNIT_END + 0x0085, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_4_0 = UNIT_END + 0x0087, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_4_0 = UNIT_END + 0x0087, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_4_PROPERTIES = UNIT_END + 0x0093, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_4_PROPERTIES = UNIT_END + 0x0093, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_4_PAD = UNIT_END + 0x0094, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_4_PAD = UNIT_END + 0x0094, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_5_CREATOR = UNIT_END + 0x0095, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_5_CREATOR = UNIT_END + 0x0095, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_5_0 = UNIT_END + 0x0097, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_5_0 = UNIT_END + 0x0097, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_5_PROPERTIES = UNIT_END + 0x00A3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_5_PROPERTIES = UNIT_END + 0x00A3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_5_PAD = UNIT_END + 0x00A4, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_5_PAD = UNIT_END + 0x00A4, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_6_CREATOR = UNIT_END + 0x00A5, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_6_CREATOR = UNIT_END + 0x00A5, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_6_0 = UNIT_END + 0x00A7, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_6_0 = UNIT_END + 0x00A7, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_6_PROPERTIES = UNIT_END + 0x00B3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_6_PROPERTIES = UNIT_END + 0x00B3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_6_PAD = UNIT_END + 0x00B4, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_6_PAD = UNIT_END + 0x00B4, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_7_CREATOR = UNIT_END + 0x00B5, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_7_CREATOR = UNIT_END + 0x00B5, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_7_0 = UNIT_END + 0x00B7, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_7_0 = UNIT_END + 0x00B7, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_7_PROPERTIES = UNIT_END + 0x00C3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_7_PROPERTIES = UNIT_END + 0x00C3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_7_PAD = UNIT_END + 0x00C4, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_7_PAD = UNIT_END + 0x00C4, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_8_CREATOR = UNIT_END + 0x00C5, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_8_CREATOR = UNIT_END + 0x00C5, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_8_0 = UNIT_END + 0x00C7, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_8_0 = UNIT_END + 0x00C7, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_8_PROPERTIES = UNIT_END + 0x00D3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_8_PROPERTIES = UNIT_END + 0x00D3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_8_PAD = UNIT_END + 0x00D4, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_8_PAD = UNIT_END + 0x00D4, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_9_CREATOR = UNIT_END + 0x00D5, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_9_CREATOR = UNIT_END + 0x00D5, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_9_0 = UNIT_END + 0x00D7, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_9_0 = UNIT_END + 0x00D7, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_9_PROPERTIES = UNIT_END + 0x00E3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_9_PROPERTIES = UNIT_END + 0x00E3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_9_PAD = UNIT_END + 0x00E4, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_9_PAD = UNIT_END + 0x00E4, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_10_CREATOR = UNIT_END + 0x00E5, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_10_CREATOR = UNIT_END + 0x00E5, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_10_0 = UNIT_END + 0x00E7, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_10_0 = UNIT_END + 0x00E7, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_10_PROPERTIES = UNIT_END + 0x00F3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_10_PROPERTIES = UNIT_END + 0x00F3, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_10_PAD = UNIT_END + 0x00F4, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_10_PAD = UNIT_END + 0x00F4, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_11_CREATOR = UNIT_END + 0x00F5, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_11_CREATOR = UNIT_END + 0x00F5, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_11_0 = UNIT_END + 0x00F7, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_11_0 = UNIT_END + 0x00F7, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_11_PROPERTIES = UNIT_END + 0x0103, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_11_PROPERTIES = UNIT_END + 0x0103, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_11_PAD = UNIT_END + 0x0104, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_11_PAD = UNIT_END + 0x0104, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_12_CREATOR = UNIT_END + 0x0105, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_12_CREATOR = UNIT_END + 0x0105, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_12_0 = UNIT_END + 0x0107, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_12_0 = UNIT_END + 0x0107, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_12_PROPERTIES = UNIT_END + 0x0113, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_12_PROPERTIES = UNIT_END + 0x0113, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_12_PAD = UNIT_END + 0x0114, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_12_PAD = UNIT_END + 0x0114, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_13_CREATOR = UNIT_END + 0x0115, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_13_CREATOR = UNIT_END + 0x0115, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_13_0 = UNIT_END + 0x0117, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_13_0 = UNIT_END + 0x0117, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_13_PROPERTIES = UNIT_END + 0x0123, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_13_PROPERTIES = UNIT_END + 0x0123, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_13_PAD = UNIT_END + 0x0124, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_13_PAD = UNIT_END + 0x0124, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_14_CREATOR = UNIT_END + 0x0125, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_14_CREATOR = UNIT_END + 0x0125, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_14_0 = UNIT_END + 0x0127, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_14_0 = UNIT_END + 0x0127, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_14_PROPERTIES = UNIT_END + 0x0133, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_14_PROPERTIES = UNIT_END + 0x0133, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_14_PAD = UNIT_END + 0x0134, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_14_PAD = UNIT_END + 0x0134, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_15_CREATOR = UNIT_END + 0x0135, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_15_CREATOR = UNIT_END + 0x0135, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_15_0 = UNIT_END + 0x0137, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_15_0 = UNIT_END + 0x0137, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_15_PROPERTIES = UNIT_END + 0x0143, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_15_PROPERTIES = UNIT_END + 0x0143, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_15_PAD = UNIT_END + 0x0144, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_15_PAD = UNIT_END + 0x0144, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_16_CREATOR = UNIT_END + 0x0145, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_16_CREATOR = UNIT_END + 0x0145, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_16_0 = UNIT_END + 0x0147, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_16_0 = UNIT_END + 0x0147, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_16_PROPERTIES = UNIT_END + 0x0153, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_16_PROPERTIES = UNIT_END + 0x0153, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_16_PAD = UNIT_END + 0x0154, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_16_PAD = UNIT_END + 0x0154, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_17_CREATOR = UNIT_END + 0x0155, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_17_CREATOR = UNIT_END + 0x0155, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_17_0 = UNIT_END + 0x0157, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_17_0 = UNIT_END + 0x0157, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_17_PROPERTIES = UNIT_END + 0x0163, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_17_PROPERTIES = UNIT_END + 0x0163, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_17_PAD = UNIT_END + 0x0164, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_17_PAD = UNIT_END + 0x0164, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_18_CREATOR = UNIT_END + 0x0165, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_18_CREATOR = UNIT_END + 0x0165, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_18_0 = UNIT_END + 0x0167, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_18_0 = UNIT_END + 0x0167, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_18_PROPERTIES = UNIT_END + 0x0173, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_18_PROPERTIES = UNIT_END + 0x0173, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_18_PAD = UNIT_END + 0x0174, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_18_PAD = UNIT_END + 0x0174, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_19_CREATOR = UNIT_END + 0x0175, // Size: 2, Type: LONG, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_CREATOR = UNIT_END + 0x0175, // Size: 2, Type: LONG, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_19_0 = UNIT_END + 0x0177, // Size: 12, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_0 = UNIT_END + 0x0177, // Size: 12, Type: INT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_19_PROPERTIES = UNIT_END + 0x0183, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_PROPERTIES = UNIT_END + 0x0183, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC
PLAYER_VISIBLE_ITEM_19_PAD = UNIT_END + 0x0184, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_PAD = UNIT_END + 0x0184, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_CHOSEN_TITLE = UNIT_END + 0x0185, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_CHOSEN_TITLE = UNIT_END + 0x0185, // Size: 1, Type: INT, Flags: PUBLIC
PLAYER_FIELD_INV_SLOT_HEAD = UNIT_END + 0x0186, // Size: 46, Type: LONG, Flags: PRIVATE PLAYER_FIELD_INV_SLOT_HEAD = UNIT_END + 0x0186, // Size: 46, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_PACK_SLOT_1 = UNIT_END + 0x01B4, // Size: 32, Type: LONG, Flags: PRIVATE PLAYER_FIELD_PACK_SLOT_1 = UNIT_END + 0x01B4, // Size: 32, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_BANK_SLOT_1 = UNIT_END + 0x01D4, // Size: 56, Type: LONG, Flags: PRIVATE PLAYER_FIELD_BANK_SLOT_1 = UNIT_END + 0x01D4, // Size: 56, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_BANKBAG_SLOT_1 = UNIT_END + 0x020C, // Size: 14, Type: LONG, Flags: PRIVATE PLAYER_FIELD_BANKBAG_SLOT_1 = UNIT_END + 0x020C, // Size: 14, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_VENDORBUYBACK_SLOT_1 = UNIT_END + 0x021A, // Size: 24, Type: LONG, Flags: PRIVATE PLAYER_FIELD_VENDORBUYBACK_SLOT_1 = UNIT_END + 0x021A, // Size: 24, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_KEYRING_SLOT_1 = UNIT_END + 0x0232, // Size: 64, Type: LONG, Flags: PRIVATE PLAYER_FIELD_KEYRING_SLOT_1 = UNIT_END + 0x0232, // Size: 64, Type: LONG, Flags: PRIVATE
PLAYER_FARSIGHT = UNIT_END + 0x0272, // Size: 2, Type: LONG, Flags: PRIVATE PLAYER_FARSIGHT = UNIT_END + 0x0272, // Size: 2, Type: LONG, Flags: PRIVATE
PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x0274, // Size: 2, Type: LONG, Flags: PRIVATE PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x0274, // Size: 2, Type: LONG, Flags: PRIVATE
PLAYER_XP = UNIT_END + 0x0276, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_XP = UNIT_END + 0x0276, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_NEXT_LEVEL_XP = UNIT_END + 0x0277, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_NEXT_LEVEL_XP = UNIT_END + 0x0277, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_SKILL_INFO_1_1 = UNIT_END + 0x0278, // Size: 384, Type: TWO_SHORT, Flags: PRIVATE PLAYER_SKILL_INFO_1_1 = UNIT_END + 0x0278, // Size: 384, Type: TWO_SHORT, Flags: PRIVATE
PLAYER_CHARACTER_POINTS1 = UNIT_END + 0x03F8, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_CHARACTER_POINTS1 = UNIT_END + 0x03F8, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_CHARACTER_POINTS2 = UNIT_END + 0x03F9, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_CHARACTER_POINTS2 = UNIT_END + 0x03F9, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_TRACK_CREATURES = UNIT_END + 0x03FA, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_TRACK_CREATURES = UNIT_END + 0x03FA, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_TRACK_RESOURCES = UNIT_END + 0x03FB, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_TRACK_RESOURCES = UNIT_END + 0x03FB, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_BLOCK_PERCENTAGE = UNIT_END + 0x03FC, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_BLOCK_PERCENTAGE = UNIT_END + 0x03FC, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_DODGE_PERCENTAGE = UNIT_END + 0x03FD, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_DODGE_PERCENTAGE = UNIT_END + 0x03FD, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_PARRY_PERCENTAGE = UNIT_END + 0x03FE, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_PARRY_PERCENTAGE = UNIT_END + 0x03FE, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_EXPERTISE = UNIT_END + 0x03FF, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_EXPERTISE = UNIT_END + 0x03FF, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_CRIT_PERCENTAGE = UNIT_END + 0x0400, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_CRIT_PERCENTAGE = UNIT_END + 0x0400, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_RANGED_CRIT_PERCENTAGE = UNIT_END + 0x0401, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_RANGED_CRIT_PERCENTAGE = UNIT_END + 0x0401, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_OFFHAND_CRIT_PERCENTAGE = UNIT_END + 0x0402, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_OFFHAND_CRIT_PERCENTAGE = UNIT_END + 0x0402, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_SPELL_CRIT_PERCENTAGE1 = UNIT_END + 0x0403, // Size: 7, Type: FLOAT, Flags: PRIVATE PLAYER_SPELL_CRIT_PERCENTAGE1 = UNIT_END + 0x0403, // Size: 7, Type: FLOAT, Flags: PRIVATE
// custom // custom
PLAYER_HOLY_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+1, PLAYER_HOLY_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+1,
PLAYER_FIRE_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+2, PLAYER_FIRE_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+2,
PLAYER_NATURE_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+3, PLAYER_NATURE_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+3,
PLAYER_FROST_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+4, PLAYER_FROST_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+4,
PLAYER_SHADOW_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+5, PLAYER_SHADOW_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+5,
PLAYER_ARCANE_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+6, PLAYER_ARCANE_SPELL_CRIT_PERCENTAGE = PLAYER_SPELL_CRIT_PERCENTAGE1+6,
PLAYER_SHIELD_BLOCK = UNIT_END + 0x040A, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_SHIELD_BLOCK = UNIT_END + 0x040A, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_EXPLORED_ZONES_1 = UNIT_END + 0x040B, // Size: 64, Type: BYTES, Flags: PRIVATE PLAYER_EXPLORED_ZONES_1 = UNIT_END + 0x040B, // Size: 64, Type: BYTES, Flags: PRIVATE
PLAYER_REST_STATE_EXPERIENCE = UNIT_END + 0x044B, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_REST_STATE_EXPERIENCE = UNIT_END + 0x044B, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_COINAGE = UNIT_END + 0x044C, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_COINAGE = UNIT_END + 0x044C, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_MOD_DAMAGE_DONE_POS = UNIT_END + 0x044D, // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_DAMAGE_DONE_POS = UNIT_END + 0x044D, // Size: 7, Type: INT, Flags: PRIVATE
PLAYER_FIELD_MOD_DAMAGE_DONE_NEG = UNIT_END + 0x0454, // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_DAMAGE_DONE_NEG = UNIT_END + 0x0454, // Size: 7, Type: INT, Flags: PRIVATE
PLAYER_FIELD_MOD_DAMAGE_DONE_PCT = UNIT_END + 0x045B, // Size: 7, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_DAMAGE_DONE_PCT = UNIT_END + 0x045B, // Size: 7, Type: INT, Flags: PRIVATE
PLAYER_FIELD_MOD_HEALING_DONE_POS = UNIT_END + 0x0462, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_HEALING_DONE_POS = UNIT_END + 0x0462, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_MOD_TARGET_RESISTANCE = UNIT_END + 0x0463, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_MOD_TARGET_RESISTANCE = UNIT_END + 0x0463, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_BYTES = UNIT_END + 0x0464, // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_FIELD_BYTES = UNIT_END + 0x0464, // Size: 1, Type: BYTES, Flags: PRIVATE
PLAYER_AMMO_ID = UNIT_END + 0x0465, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_AMMO_ID = UNIT_END + 0x0465, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_SELF_RES_SPELL = UNIT_END + 0x0466, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_SELF_RES_SPELL = UNIT_END + 0x0466, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_PVP_MEDALS = UNIT_END + 0x0467, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_PVP_MEDALS = UNIT_END + 0x0467, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_BUYBACK_PRICE_1 = UNIT_END + 0x0468, // Size: 12, Type: INT, Flags: PRIVATE PLAYER_FIELD_BUYBACK_PRICE_1 = UNIT_END + 0x0468, // Size: 12, Type: INT, Flags: PRIVATE
PLAYER_FIELD_BUYBACK_TIMESTAMP_1 = UNIT_END + 0x0474, // Size: 12, Type: INT, Flags: PRIVATE PLAYER_FIELD_BUYBACK_TIMESTAMP_1 = UNIT_END + 0x0474, // Size: 12, Type: INT, Flags: PRIVATE
PLAYER_FIELD_KILLS = UNIT_END + 0x0480, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE PLAYER_FIELD_KILLS = UNIT_END + 0x0480, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE
PLAYER_FIELD_TODAY_CONTRIBUTION = UNIT_END + 0x0481, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_TODAY_CONTRIBUTION = UNIT_END + 0x0481, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_YESTERDAY_CONTRIBUTION = UNIT_END + 0x0482, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_YESTERDAY_CONTRIBUTION = UNIT_END + 0x0482, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_LIFETIME_HONORBALE_KILLS = UNIT_END + 0x0483, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_LIFETIME_HONORBALE_KILLS = UNIT_END + 0x0483, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_BYTES2 = UNIT_END + 0x0484, // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_FIELD_BYTES2 = UNIT_END + 0x0484, // Size: 1, Type: BYTES, Flags: PRIVATE
PLAYER_FIELD_WATCHED_FACTION_INDEX = UNIT_END + 0x0485, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_WATCHED_FACTION_INDEX = UNIT_END + 0x0485, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_COMBAT_RATING_1 = UNIT_END + 0x0486, // Size: 24, Type: INT, Flags: PRIVATE PLAYER_FIELD_COMBAT_RATING_1 = UNIT_END + 0x0486, // Size: 24, Type: INT, Flags: PRIVATE
// custom // client names: // custom // client names:
// CR_WEAPON_SKILL // CR_WEAPON_SKILL
PLAYER_FIELD_ALL_WEAPONS_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1, PLAYER_FIELD_ALL_WEAPONS_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1,
// CR_DEFENSE_SKILL // CR_DEFENSE_SKILL
PLAYER_FIELD_DEFENCE_RATING = PLAYER_FIELD_COMBAT_RATING_1+1, PLAYER_FIELD_DEFENCE_RATING = PLAYER_FIELD_COMBAT_RATING_1+1,
// CR_DODGE // CR_DODGE
PLAYER_FIELD_DODGE_RATING = PLAYER_FIELD_COMBAT_RATING_1+2, PLAYER_FIELD_DODGE_RATING = PLAYER_FIELD_COMBAT_RATING_1+2,
// CR_PARRY // CR_PARRY
PLAYER_FIELD_PARRY_RATING = PLAYER_FIELD_COMBAT_RATING_1+3, PLAYER_FIELD_PARRY_RATING = PLAYER_FIELD_COMBAT_RATING_1+3,
// CR_BLOCK // CR_BLOCK
PLAYER_FIELD_BLOCK_RATING = PLAYER_FIELD_COMBAT_RATING_1+4, PLAYER_FIELD_BLOCK_RATING = PLAYER_FIELD_COMBAT_RATING_1+4,
// CR_HIT_MELEE // CR_HIT_MELEE
PLAYER_FIELD_MELEE_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+5, PLAYER_FIELD_MELEE_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+5,
// CR_HIT_RANGED // CR_HIT_RANGED
PLAYER_FIELD_RANGED_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+6, PLAYER_FIELD_RANGED_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+6,
// CR_HIT_SPELL // CR_HIT_SPELL
PLAYER_FIELD_SPELL_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+7, PLAYER_FIELD_SPELL_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+7,
// CR_CRIT_MELEE // CR_CRIT_MELEE
PLAYER_FIELD_MELEE_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+8, PLAYER_FIELD_MELEE_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+8,
// CR_CRIT_RANGED // CR_CRIT_RANGED
PLAYER_FIELD_RANGED_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+9, PLAYER_FIELD_RANGED_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+9,
// CR_CRIT_SPELL // CR_CRIT_SPELL
PLAYER_FIELD_SPELL_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+10, PLAYER_FIELD_SPELL_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+10,
// CR_HIT_TAKEN_MELEE // CR_HIT_TAKEN_MELEE
PLAYER_FIELD_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+11, PLAYER_FIELD_HIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+11,
// CR_HIT_TAKEN_RANGED // CR_HIT_TAKEN_RANGED
PLAYER_FIELD_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+12, PLAYER_FIELD_CRIT_RATING = PLAYER_FIELD_COMBAT_RATING_1+12,
// CR_HIT_TAKEN_SPELL // CR_HIT_TAKEN_SPELL
PLAYER_FIELD_UNK3_RATING = PLAYER_FIELD_COMBAT_RATING_1+13, PLAYER_FIELD_UNK3_RATING = PLAYER_FIELD_COMBAT_RATING_1+13,
// CR_CRIT_TAKEN_MELEE // CR_CRIT_TAKEN_MELEE
PLAYER_FIELD_UNK4_RATING = PLAYER_FIELD_COMBAT_RATING_1+14, PLAYER_FIELD_UNK4_RATING = PLAYER_FIELD_COMBAT_RATING_1+14,
// CR_CRIT_TAKEN_RANGED // CR_CRIT_TAKEN_RANGED
PLAYER_FIELD_UNK5_RATING = PLAYER_FIELD_COMBAT_RATING_1+15, PLAYER_FIELD_UNK5_RATING = PLAYER_FIELD_COMBAT_RATING_1+15,
// CR_CRIT_TAKEN_SPELL // CR_CRIT_TAKEN_SPELL
PLAYER_FIELD_RESILIENCE_RATING = PLAYER_FIELD_COMBAT_RATING_1+16, PLAYER_FIELD_RESILIENCE_RATING = PLAYER_FIELD_COMBAT_RATING_1+16,
// CR_HASTE_MELEE // CR_HASTE_MELEE
PLAYER_FIELD_MELEE_HASTE_RATING = PLAYER_FIELD_COMBAT_RATING_1+17, PLAYER_FIELD_MELEE_HASTE_RATING = PLAYER_FIELD_COMBAT_RATING_1+17,
// CR_HASTE_RANGED // CR_HASTE_RANGED
PLAYER_FIELD_RANGED_HASTE_RATING = PLAYER_FIELD_COMBAT_RATING_1+18, PLAYER_FIELD_RANGED_HASTE_RATING = PLAYER_FIELD_COMBAT_RATING_1+18,
// CR_HASTE_SPELL // CR_HASTE_SPELL
PLAYER_FIELD_SPELL_HASTE_RATING = PLAYER_FIELD_COMBAT_RATING_1+19, PLAYER_FIELD_SPELL_HASTE_RATING = PLAYER_FIELD_COMBAT_RATING_1+19,
// CR_WEAPON_SKILL_MAINHAND // CR_WEAPON_SKILL_MAINHAND
PLAYER_FIELD_MELEE_WEAPON_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1+20, PLAYER_FIELD_MELEE_WEAPON_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1+20,
// CR_WEAPON_SKILL_OFFHAND // CR_WEAPON_SKILL_OFFHAND
PLAYER_FIELD_OFFHAND_WEAPON_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1+21, PLAYER_FIELD_OFFHAND_WEAPON_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1+21,
// CR_WEAPON_SKILL_RANGED // CR_WEAPON_SKILL_RANGED
PLAYER_FIELD_RANGED_WEAPON_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1+22, PLAYER_FIELD_RANGED_WEAPON_SKILL_RATING = PLAYER_FIELD_COMBAT_RATING_1+22,
// CR_EXPERTISE // CR_EXPERTISE
PLAYER_FIELD_EXPERTISE_RATING = PLAYER_FIELD_COMBAT_RATING_1+23, PLAYER_FIELD_EXPERTISE_RATING = PLAYER_FIELD_COMBAT_RATING_1+23,
PLAYER_FIELD_ARENA_TEAM_INFO_1_1 = UNIT_END + 0x049E, // Size: 18, Type: INT, Flags: PRIVATE PLAYER_FIELD_ARENA_TEAM_INFO_1_1 = UNIT_END + 0x049E, // Size: 18, Type: INT, Flags: PRIVATE
// custom // custom
PLAYER_FIELD_ARENA_TEAM_ID_2v2 = PLAYER_FIELD_ARENA_TEAM_INFO_1_1, PLAYER_FIELD_ARENA_TEAM_ID_2v2 = PLAYER_FIELD_ARENA_TEAM_INFO_1_1,
PLAYER_FIELD_ARENA_TEAM_ID_3v3 = PLAYER_FIELD_ARENA_TEAM_INFO_1_1+6, PLAYER_FIELD_ARENA_TEAM_ID_3v3 = PLAYER_FIELD_ARENA_TEAM_INFO_1_1+6,
PLAYER_FIELD_ARENA_TEAM_ID_5v5 = PLAYER_FIELD_ARENA_TEAM_INFO_1_1+12, PLAYER_FIELD_ARENA_TEAM_ID_5v5 = PLAYER_FIELD_ARENA_TEAM_INFO_1_1+12,
PLAYER_FIELD_HONOR_CURRENCY = UNIT_END + 0x04B0, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_HONOR_CURRENCY = UNIT_END + 0x04B0, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_ARENA_CURRENCY = UNIT_END + 0x04B1, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_ARENA_CURRENCY = UNIT_END + 0x04B1, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_MOD_MANA_REGEN = UNIT_END + 0x04B2, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_FIELD_MOD_MANA_REGEN = UNIT_END + 0x04B2, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_FIELD_MOD_MANA_REGEN_INTERRUPT = UNIT_END + 0x04B3, // Size: 1, Type: FLOAT, Flags: PRIVATE PLAYER_FIELD_MOD_MANA_REGEN_INTERRUPT = UNIT_END + 0x04B3, // Size: 1, Type: FLOAT, Flags: PRIVATE
PLAYER_FIELD_MAX_LEVEL = UNIT_END + 0x04B4, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_FIELD_MAX_LEVEL = UNIT_END + 0x04B4, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_FIELD_DAILY_QUESTS_1 = UNIT_END + 0x04B5, // Size: 10, Type: INT, Flags: PRIVATE PLAYER_FIELD_DAILY_QUESTS_1 = UNIT_END + 0x04B5, // Size: 10, Type: INT, Flags: PRIVATE
PLAYER_FIELD_PADDING = UNIT_END + 0x04BF, // Size: 1, Type: INT, Flags: NONE PLAYER_FIELD_PADDING = UNIT_END + 0x04BF, // Size: 1, Type: INT, Flags: NONE
PLAYER_END = UNIT_END + 0x04C0, PLAYER_END = UNIT_END + 0x04C0,
}; };
enum EGameObjectFields enum EGameObjectFields
{ {
OBJECT_FIELD_CREATED_BY = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC OBJECT_FIELD_CREATED_BY = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC
GAMEOBJECT_DISPLAYID = OBJECT_END + 0x0002, // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_DISPLAYID = OBJECT_END + 0x0002, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_FLAGS = OBJECT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_FLAGS = OBJECT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_ROTATION = OBJECT_END + 0x0004, // Size: 4, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_ROTATION = OBJECT_END + 0x0004, // Size: 4, Type: FLOAT, Flags: PUBLIC
GAMEOBJECT_STATE = OBJECT_END + 0x0008, // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_STATE = OBJECT_END + 0x0008, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_POS_X = OBJECT_END + 0x0009, // Size: 1, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_POS_X = OBJECT_END + 0x0009, // Size: 1, Type: FLOAT, Flags: PUBLIC
GAMEOBJECT_POS_Y = OBJECT_END + 0x000A, // Size: 1, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_POS_Y = OBJECT_END + 0x000A, // Size: 1, Type: FLOAT, Flags: PUBLIC
GAMEOBJECT_POS_Z = OBJECT_END + 0x000B, // Size: 1, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_POS_Z = OBJECT_END + 0x000B, // Size: 1, Type: FLOAT, Flags: PUBLIC
GAMEOBJECT_FACING = OBJECT_END + 0x000C, // Size: 1, Type: FLOAT, Flags: PUBLIC GAMEOBJECT_FACING = OBJECT_END + 0x000C, // Size: 1, Type: FLOAT, Flags: PUBLIC
GAMEOBJECT_DYN_FLAGS = OBJECT_END + 0x000D, // Size: 1, Type: INT, Flags: DYNAMIC GAMEOBJECT_DYN_FLAGS = OBJECT_END + 0x000D, // Size: 1, Type: INT, Flags: DYNAMIC
GAMEOBJECT_FACTION = OBJECT_END + 0x000E, // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_FACTION = OBJECT_END + 0x000E, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_TYPE_ID = OBJECT_END + 0x000F, // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_TYPE_ID = OBJECT_END + 0x000F, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_LEVEL = OBJECT_END + 0x0010, // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_LEVEL = OBJECT_END + 0x0010, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_ARTKIT = OBJECT_END + 0x0011, // Size: 1, Type: INT, Flags: PUBLIC GAMEOBJECT_ARTKIT = OBJECT_END + 0x0011, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_ANIMPROGRESS = OBJECT_END + 0x0012, // Size: 1, Type: INT, Flags: DYNAMIC GAMEOBJECT_ANIMPROGRESS = OBJECT_END + 0x0012, // Size: 1, Type: INT, Flags: DYNAMIC
GAMEOBJECT_PADDING = OBJECT_END + 0x0013, // Size: 1, Type: INT, Flags: NONE GAMEOBJECT_PADDING = OBJECT_END + 0x0013, // Size: 1, Type: INT, Flags: NONE
GAMEOBJECT_END = OBJECT_END + 0x0014, GAMEOBJECT_END = OBJECT_END + 0x0014,
}; };
enum EDynamicObjectFields enum EDynamicObjectFields
{ {
DYNAMICOBJECT_CASTER = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC DYNAMICOBJECT_CASTER = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC
DYNAMICOBJECT_BYTES = OBJECT_END + 0x0002, // Size: 1, Type: BYTES, Flags: PUBLIC DYNAMICOBJECT_BYTES = OBJECT_END + 0x0002, // Size: 1, Type: BYTES, Flags: PUBLIC
DYNAMICOBJECT_SPELLID = OBJECT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC DYNAMICOBJECT_SPELLID = OBJECT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
DYNAMICOBJECT_RADIUS = OBJECT_END + 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC DYNAMICOBJECT_RADIUS = OBJECT_END + 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC
DYNAMICOBJECT_POS_X = OBJECT_END + 0x0005, // Size: 1, Type: FLOAT, Flags: PUBLIC DYNAMICOBJECT_POS_X = OBJECT_END + 0x0005, // Size: 1, Type: FLOAT, Flags: PUBLIC
DYNAMICOBJECT_POS_Y = OBJECT_END + 0x0006, // Size: 1, Type: FLOAT, Flags: PUBLIC DYNAMICOBJECT_POS_Y = OBJECT_END + 0x0006, // Size: 1, Type: FLOAT, Flags: PUBLIC
DYNAMICOBJECT_POS_Z = OBJECT_END + 0x0007, // Size: 1, Type: FLOAT, Flags: PUBLIC DYNAMICOBJECT_POS_Z = OBJECT_END + 0x0007, // Size: 1, Type: FLOAT, Flags: PUBLIC
DYNAMICOBJECT_FACING = OBJECT_END + 0x0008, // Size: 1, Type: FLOAT, Flags: PUBLIC DYNAMICOBJECT_FACING = OBJECT_END + 0x0008, // Size: 1, Type: FLOAT, Flags: PUBLIC
DYNAMICOBJECT_PAD = OBJECT_END + 0x0009, // Size: 1, Type: BYTES, Flags: PUBLIC DYNAMICOBJECT_PAD = OBJECT_END + 0x0009, // Size: 1, Type: BYTES, Flags: PUBLIC
DYNAMICOBJECT_END = OBJECT_END + 0x000A, DYNAMICOBJECT_END = OBJECT_END + 0x000A,
}; };
enum ECorpseFields enum ECorpseFields
{ {
CORPSE_FIELD_OWNER = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC CORPSE_FIELD_OWNER = OBJECT_END + 0x0000, // Size: 2, Type: LONG, Flags: PUBLIC
CORPSE_FIELD_FACING = OBJECT_END + 0x0002, // Size: 1, Type: FLOAT, Flags: PUBLIC CORPSE_FIELD_FACING = OBJECT_END + 0x0002, // Size: 1, Type: FLOAT, Flags: PUBLIC
CORPSE_FIELD_POS_X = OBJECT_END + 0x0003, // Size: 1, Type: FLOAT, Flags: PUBLIC CORPSE_FIELD_POS_X = OBJECT_END + 0x0003, // Size: 1, Type: FLOAT, Flags: PUBLIC
CORPSE_FIELD_POS_Y = OBJECT_END + 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC CORPSE_FIELD_POS_Y = OBJECT_END + 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC
CORPSE_FIELD_POS_Z = OBJECT_END + 0x0005, // Size: 1, Type: FLOAT, Flags: PUBLIC CORPSE_FIELD_POS_Z = OBJECT_END + 0x0005, // Size: 1, Type: FLOAT, Flags: PUBLIC
CORPSE_FIELD_DISPLAY_ID = OBJECT_END + 0x0006, // Size: 1, Type: INT, Flags: PUBLIC CORPSE_FIELD_DISPLAY_ID = OBJECT_END + 0x0006, // Size: 1, Type: INT, Flags: PUBLIC
CORPSE_FIELD_ITEM = OBJECT_END + 0x0007, // Size: 19, Type: INT, Flags: PUBLIC CORPSE_FIELD_ITEM = OBJECT_END + 0x0007, // Size: 19, Type: INT, Flags: PUBLIC
CORPSE_FIELD_BYTES_1 = OBJECT_END + 0x001A, // Size: 1, Type: BYTES, Flags: PUBLIC CORPSE_FIELD_BYTES_1 = OBJECT_END + 0x001A, // Size: 1, Type: BYTES, Flags: PUBLIC
CORPSE_FIELD_BYTES_2 = OBJECT_END + 0x001B, // Size: 1, Type: BYTES, Flags: PUBLIC CORPSE_FIELD_BYTES_2 = OBJECT_END + 0x001B, // Size: 1, Type: BYTES, Flags: PUBLIC
CORPSE_FIELD_GUILD = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC CORPSE_FIELD_GUILD = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC
CORPSE_FIELD_FLAGS = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC CORPSE_FIELD_FLAGS = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC
CORPSE_FIELD_DYNAMIC_FLAGS = OBJECT_END + 0x001E, // Size: 1, Type: INT, Flags: DYNAMIC CORPSE_FIELD_DYNAMIC_FLAGS = OBJECT_END + 0x001E, // Size: 1, Type: INT, Flags: DYNAMIC
CORPSE_FIELD_PAD = OBJECT_END + 0x001F, // Size: 1, Type: INT, Flags: NONE CORPSE_FIELD_PAD = OBJECT_END + 0x001F, // Size: 1, Type: INT, Flags: NONE
CORPSE_END = OBJECT_END + 0x0020, CORPSE_END = OBJECT_END + 0x0020,
}; };
#endif #endif

View File

@ -1,74 +1,74 @@
#include "common.h" #include "common.h"
#include "MapMgr.h" #include "MapMgr.h"
#include "WorldSession.h" #include "WorldSession.h"
#include "World.h" #include "World.h"
World::World(WorldSession *s) World::World(WorldSession *s)
{ {
_session = s; _session = s;
_mapId = -1; _mapId = -1;
_mapmgr = NULL; _mapmgr = NULL;
if(_session->GetInstance()->GetConf()->useMaps) if(_session->GetInstance()->GetConf()->useMaps)
_mapmgr = new MapMgr(); _mapmgr = new MapMgr();
} }
World::~World() World::~World()
{ {
Clear(); Clear();
if(_mapmgr) if(_mapmgr)
delete _mapmgr; delete _mapmgr;
} }
// called on SMSG_NEW_WORLD // called on SMSG_NEW_WORLD
void World::Clear(void) void World::Clear(void)
{ {
if(_mapmgr) if(_mapmgr)
{ {
_mapmgr->Flush(); _mapmgr->Flush();
} }
// TODO: clear WorldStates (-> SMSG_INIT_WORLD_STATES ?) and everything else thats required // TODO: clear WorldStates (-> SMSG_INIT_WORLD_STATES ?) and everything else thats required
} }
void World::Update(void) void World::Update(void)
{ {
if(_mapId == uint32(-1)) // to prevent unexpected behaviour if(_mapId == uint32(-1)) // to prevent unexpected behaviour
return; return;
if(_mapmgr) if(_mapmgr)
{ {
_mapmgr->Update(_x,_y,_mapId); _mapmgr->Update(_x,_y,_mapId);
} }
// some debug code for testing... // some debug code for testing...
/*if(_mapmgr && _x != _lastx || _y != _lasty) /*if(_mapmgr && _x != _lastx || _y != _lasty)
{ {
logdetail("WORLD: relocation, to x=%f y=%f, calculated z=%f",_x,_y,this->GetPosZ(_x,_y)); logdetail("WORLD: relocation, to x=%f y=%f, calculated z=%f",_x,_y,this->GetPosZ(_x,_y));
_lastx = _x; _lastx = _x;
_lasty = _y; _lasty = _y;
}*/ }*/
} }
void World::UpdatePos(float x, float y, uint32 m) void World::UpdatePos(float x, float y, uint32 m)
{ {
_mapId = m; _mapId = m;
UpdatePos(x,y); UpdatePos(x,y);
} }
void World::UpdatePos(float x, float y) void World::UpdatePos(float x, float y)
{ {
_x = x; _x = x;
_y = y; _y = y;
Update(); Update();
} }
float World::GetPosZ(float x, float y) float World::GetPosZ(float x, float y)
{ {
if(_mapmgr) if(_mapmgr)
return _mapmgr->GetZ(x,y); return _mapmgr->GetZ(x,y);
logdebug("WORLD: GetPosZ() called, but no MapMgr exists (do you really use maps?)"); logdebug("WORLD: GetPosZ() called, but no MapMgr exists (do you really use maps?)");
return 0; return 0;
} }

View File

@ -1,52 +1,52 @@
#ifndef WORLD_H #ifndef WORLD_H
#define WORLD_H #define WORLD_H
class WorldSession; class WorldSession;
class MapMgr; class MapMgr;
struct WorldPosition struct WorldPosition
{ {
WorldPosition() : x(0.0f), y(0.0f), z(0.0f), o(0.0f) {}; WorldPosition() : x(0.0f), y(0.0f), z(0.0f), o(0.0f) {};
WorldPosition(float px, float py) : x(px), y(py), z(0.0f), o(0.0f) {}; WorldPosition(float px, float py) : x(px), y(py), z(0.0f), o(0.0f) {};
WorldPosition(float px, float py, float pz) : x(px), y(py), z(pz), o(0.0f) {}; WorldPosition(float px, float py, float pz) : x(px), y(py), z(pz), o(0.0f) {};
WorldPosition(float px, float py, float pz, float po) : x(px), y(py), z(pz), o(po) {}; WorldPosition(float px, float py, float pz, float po) : x(px), y(py), z(pz), o(po) {};
float x,y,z,o; float x,y,z,o;
}; };
inline ByteBuffer& operator<<(ByteBuffer& bb, WorldPosition& p) inline ByteBuffer& operator<<(ByteBuffer& bb, WorldPosition& p)
{ {
bb << p.x << p.y << p.z << p.o; bb << p.x << p.y << p.z << p.o;
return bb; return bb;
} }
inline ByteBuffer& operator>>(ByteBuffer& bb, WorldPosition& p) inline ByteBuffer& operator>>(ByteBuffer& bb, WorldPosition& p)
{ {
bb >> p.x >> p.y >> p.z >> p.o; bb >> p.x >> p.y >> p.z >> p.o;
return bb; return bb;
} }
// used as interface for movement, map data, // used as interface for movement, map data,
class World class World
{ {
public: public:
World(WorldSession*); World(WorldSession*);
~World(); ~World();
inline uint32 GetMapId(void) { return _mapId; } inline uint32 GetMapId(void) { return _mapId; }
inline WorldSession *GetSession(void) { return _session; } inline WorldSession *GetSession(void) { return _session; }
void Clear(void); void Clear(void);
void Update(void); void Update(void);
void UpdatePos(float,float,uint32); void UpdatePos(float,float,uint32);
void UpdatePos(float,float); void UpdatePos(float,float);
float GetPosZ(float x, float y); float GetPosZ(float x, float y);
inline MapMgr *GetMapMgr(void) { return _mapmgr; } inline MapMgr *GetMapMgr(void) { return _mapmgr; }
private: private:
WorldSession *_session; WorldSession *_session;
MapMgr *_mapmgr; MapMgr *_mapmgr;
uint32 _mapId; uint32 _mapId;
float _x,_y; float _x,_y;
float _lastx,_lasty; float _lastx,_lasty;
}; };
#endif #endif

View File

@ -1,19 +1,19 @@
#include "WorldPacket.h" #include "WorldPacket.h"
uint64 WorldPacket::GetPackedGuid(void) uint64 WorldPacket::GetPackedGuid(void)
{ {
uint8 mask; uint8 mask;
*this >> mask; *this >> mask;
uint64 guid=0; uint64 guid=0;
for(uint8 i=0;i<8;i++) for(uint8 i=0;i<8;i++)
{ {
if(mask & (1<<i) ) if(mask & (1<<i) )
{ {
*this >> ((uint8*)&guid)[i]; *this >> ((uint8*)&guid)[i];
} }
} }
return guid; return guid;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,162 +1,162 @@
#ifndef _WORLDSESSION_H #ifndef _WORLDSESSION_H
#define _WORLDSESSION_H #define _WORLDSESSION_H
#include <deque> #include <deque>
#include <bitset> #include <bitset>
#include "common.h" #include "common.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "Network/SocketHandler.h" #include "Network/SocketHandler.h"
#include "Player.h" #include "Player.h"
#include "Auth/AuthCrypt.h" #include "Auth/AuthCrypt.h"
#include "SharedDefines.h" #include "SharedDefines.h"
#include "ObjMgr.h" #include "ObjMgr.h"
#include "CacheHandler.h" #include "CacheHandler.h"
#include "Opcodes.h" #include "Opcodes.h"
class WorldSocket; class WorldSocket;
class WorldPacket; class WorldPacket;
class Channel; class Channel;
class RealmSession; class RealmSession;
struct OpcodeHandler; struct OpcodeHandler;
class World; class World;
struct WhoListEntry struct WhoListEntry
{ {
std::string name; std::string name;
std::string gname; std::string gname;
uint32 level; uint32 level;
uint32 classId; uint32 classId;
uint32 raceId; uint32 raceId;
uint32 zoneId; uint32 zoneId;
}; };
struct DelayedWorldPacket struct DelayedWorldPacket
{ {
DelayedWorldPacket() { pkt = NULL; when = clock(); } DelayedWorldPacket() { pkt = NULL; when = clock(); }
DelayedWorldPacket(WorldPacket *p, uint32 ms) { pkt = p; when = ms + clock(); } DelayedWorldPacket(WorldPacket *p, uint32 ms) { pkt = p; when = ms + clock(); }
WorldPacket *pkt; WorldPacket *pkt;
clock_t when; clock_t when;
}; };
typedef std::vector<WhoListEntry> WhoList; typedef std::vector<WhoListEntry> WhoList;
typedef std::deque<DelayedWorldPacket> DelayedPacketQueue; typedef std::deque<DelayedWorldPacket> DelayedPacketQueue;
class WorldSession class WorldSession
{ {
friend class Channel; friend class Channel;
public: public:
WorldSession(PseuInstance *i); WorldSession(PseuInstance *i);
~WorldSession(); ~WorldSession();
void Init(void); void Init(void);
inline PseuInstance *GetInstance(void) { return _instance; } inline PseuInstance *GetInstance(void) { return _instance; }
inline SCPDatabaseMgr& GetDBMgr(void) { return GetInstance()->dbmgr; } inline SCPDatabaseMgr& GetDBMgr(void) { return GetInstance()->dbmgr; }
void AddToPktQueue(WorldPacket *pkt); void AddToPktQueue(WorldPacket *pkt);
void Update(void); void Update(void);
void Start(void); void Start(void);
inline bool MustDie(void) { return _mustdie; } inline bool MustDie(void) { return _mustdie; }
void SetMustDie(void); void SetMustDie(void);
void SendWorldPacket(WorldPacket&); void SendWorldPacket(WorldPacket&);
inline bool InWorld(void) { return _logged; } inline bool InWorld(void) { return _logged; }
inline uint32 GetLagMS(void) { return _lag_ms; } inline uint32 GetLagMS(void) { return _lag_ms; }
void SetTarget(uint64 guid); void SetTarget(uint64 guid);
inline uint64 GetTarget(void) { return GetMyChar() ? GetMyChar()->GetTarget() : 0; } inline uint64 GetTarget(void) { return GetMyChar() ? GetMyChar()->GetTarget() : 0; }
inline uint64 GetGuid(void) { return _myGUID; } inline uint64 GetGuid(void) { return _myGUID; }
inline Channel *GetChannels(void) { return _channels; } inline Channel *GetChannels(void) { return _channels; }
inline MyCharacter *GetMyChar(void) { ASSERT(_myGUID > 0); return (MyCharacter*)objmgr.GetObj(_myGUID); } inline MyCharacter *GetMyChar(void) { ASSERT(_myGUID > 0); return (MyCharacter*)objmgr.GetObj(_myGUID); }
inline World *GetWorld(void) { return _world; } inline World *GetWorld(void) { return _world; }
std::string GetOrRequestPlayerName(uint64); std::string GetOrRequestPlayerName(uint64);
// CMSGConstructor // CMSGConstructor
void SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to=""); void SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to="");
void SendQueryPlayerName(uint64 guid); void SendQueryPlayerName(uint64 guid);
void SendPing(uint32); void SendPing(uint32);
void SendEmote(uint32); void SendEmote(uint32);
void SendQueryItem(uint32 id, uint64 guid = 0); void SendQueryItem(uint32 id, uint64 guid = 0);
void SendSetSelection(uint64); void SendSetSelection(uint64);
void SendCastSpell(uint32 spellid, bool nocheck=false); void SendCastSpell(uint32 spellid, bool nocheck=false);
void SendWhoListRequest(uint32 minlvl=0, uint32 maxlvl=100, uint32 racemask=-1, uint32 classmask=-1, std::string name="", std::string guildname="", std::vector<uint32> *zonelist=NULL, std::vector<std::string> *strlist=NULL); void SendWhoListRequest(uint32 minlvl=0, uint32 maxlvl=100, uint32 racemask=-1, uint32 classmask=-1, std::string name="", std::string guildname="", std::vector<uint32> *zonelist=NULL, std::vector<std::string> *strlist=NULL);
void SendQueryCreature(uint32 entry, uint64 guid = 0); void SendQueryCreature(uint32 entry, uint64 guid = 0);
void HandleWorldPacket(WorldPacket*); void HandleWorldPacket(WorldPacket*);
inline void DisableOpcode(uint16 opcode) { _disabledOpcodes[opcode] = true; } inline void DisableOpcode(uint16 opcode) { _disabledOpcodes[opcode] = true; }
inline void EnableOpcode(uint16 opcode) { _disabledOpcodes[opcode] = false; } inline void EnableOpcode(uint16 opcode) { _disabledOpcodes[opcode] = false; }
inline bool IsOpcodeDisabled(uint16 opcode) { return _disabledOpcodes[opcode]; } inline bool IsOpcodeDisabled(uint16 opcode) { return _disabledOpcodes[opcode]; }
PlayerNameCache plrNameCache; PlayerNameCache plrNameCache;
ObjMgr objmgr; ObjMgr objmgr;
private: private:
OpcodeHandler *_GetOpcodeHandlerTable(void) const; OpcodeHandler *_GetOpcodeHandlerTable(void) const;
// Helpers // Helpers
void _OnEnterWorld(void); // = login void _OnEnterWorld(void); // = login
void _OnLeaveWorld(void); // = logout void _OnLeaveWorld(void); // = logout
void _DoTimedActions(void); void _DoTimedActions(void);
void _DelayWorldPacket(WorldPacket&, uint32); void _DelayWorldPacket(WorldPacket&, uint32);
void _HandleDelayedPackets(void); void _HandleDelayedPackets(void);
// Opcode Handlers // Opcode Handlers
void _HandleAuthChallengeOpcode(WorldPacket& recvPacket); void _HandleAuthChallengeOpcode(WorldPacket& recvPacket);
void _HandleAuthResponseOpcode(WorldPacket& recvPacket); void _HandleAuthResponseOpcode(WorldPacket& recvPacket);
void _HandleCharEnumOpcode(WorldPacket& recvPacket); void _HandleCharEnumOpcode(WorldPacket& recvPacket);
void _HandleSetProficiencyOpcode(WorldPacket& recvPacket); void _HandleSetProficiencyOpcode(WorldPacket& recvPacket);
void _HandleAccountDataMD5Opcode(WorldPacket& recvPacket); void _HandleAccountDataMD5Opcode(WorldPacket& recvPacket);
void _HandleMessageChatOpcode(WorldPacket& recvPacket); void _HandleMessageChatOpcode(WorldPacket& recvPacket);
void _HandleNameQueryResponseOpcode(WorldPacket& recvPacket); void _HandleNameQueryResponseOpcode(WorldPacket& recvPacket);
void _HandleMovementOpcode(WorldPacket& recvPacket); void _HandleMovementOpcode(WorldPacket& recvPacket);
void _HandlePongOpcode(WorldPacket& recvPacket); void _HandlePongOpcode(WorldPacket& recvPacket);
void _HandleTradeStatusOpcode(WorldPacket& recvPacket); void _HandleTradeStatusOpcode(WorldPacket& recvPacket);
void _HandleGroupInviteOpcode(WorldPacket& recvPacket); void _HandleGroupInviteOpcode(WorldPacket& recvPacket);
void _HandleTelePortAckOpcode(WorldPacket& recvPacket); void _HandleTelePortAckOpcode(WorldPacket& recvPacket);
void _HandleChannelNotifyOpcode(WorldPacket& recvPacket); void _HandleChannelNotifyOpcode(WorldPacket& recvPacket);
void _HandleCastResultOpcode(WorldPacket& recvPacket); void _HandleCastResultOpcode(WorldPacket& recvPacket);
void _HandleCastSuccessOpcode(WorldPacket& recvPacket); void _HandleCastSuccessOpcode(WorldPacket& recvPacket);
void _HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket); void _HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket);
void _HandleUpdateObjectOpcode(WorldPacket& recvPacket); void _HandleUpdateObjectOpcode(WorldPacket& recvPacket);
void _HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket); void _HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket);
void _HandleDestroyObjectOpcode(WorldPacket& recvPacket); void _HandleDestroyObjectOpcode(WorldPacket& recvPacket);
void _HandleInitialSpellsOpcode(WorldPacket& recvPacket); void _HandleInitialSpellsOpcode(WorldPacket& recvPacket);
void _HandleLearnedSpellOpcode(WorldPacket& recvPacket); void _HandleLearnedSpellOpcode(WorldPacket& recvPacket);
void _HandleRemovedSpellOpcode(WorldPacket& recvPacket); void _HandleRemovedSpellOpcode(WorldPacket& recvPacket);
void _HandleChannelListOpcode(WorldPacket& recvPacket); void _HandleChannelListOpcode(WorldPacket& recvPacket);
void _HandleEmoteOpcode(WorldPacket& recvPacket); void _HandleEmoteOpcode(WorldPacket& recvPacket);
void _HandleTextEmoteOpcode(WorldPacket& recvPacket); void _HandleTextEmoteOpcode(WorldPacket& recvPacket);
void _HandleNewWorldOpcode(WorldPacket& recvPacket); void _HandleNewWorldOpcode(WorldPacket& recvPacket);
void _HandleLoginVerifyWorldOpcode(WorldPacket& recvPacket); void _HandleLoginVerifyWorldOpcode(WorldPacket& recvPacket);
void _HandleMotdOpcode(WorldPacket& recvPacket); void _HandleMotdOpcode(WorldPacket& recvPacket);
void _HandleNotificationOpcode(WorldPacket& recvPacket); void _HandleNotificationOpcode(WorldPacket& recvPacket);
void _HandleWhoOpcode(WorldPacket& recvPacket); void _HandleWhoOpcode(WorldPacket& recvPacket);
void _HandleCreatureQueryResponseOpcode(WorldPacket& recvPacket); void _HandleCreatureQueryResponseOpcode(WorldPacket& recvPacket);
// helper functions to keep SMSG_(COMPRESSED_)UPDATE_OBJECT easy to handle // helper functions to keep SMSG_(COMPRESSED_)UPDATE_OBJECT easy to handle
void _MovementUpdate(uint8 objtypeid, uint64 guid, WorldPacket& recvPacket); // Helper for _HandleUpdateObjectOpcode void _MovementUpdate(uint8 objtypeid, uint64 guid, WorldPacket& recvPacket); // Helper for _HandleUpdateObjectOpcode
void _ValuesUpdate(uint64 uguid, WorldPacket& recvPacket); // ... void _ValuesUpdate(uint64 uguid, WorldPacket& recvPacket); // ...
void _QueryObjectInfo(uint64 guid); void _QueryObjectInfo(uint64 guid);
void _LoadCache(void); void _LoadCache(void);
PseuInstance *_instance; PseuInstance *_instance;
WorldSocket *_socket; WorldSocket *_socket;
ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> pktQueue; ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> pktQueue;
DelayedPacketQueue delayedPktQueue; DelayedPacketQueue delayedPktQueue;
bool _logged,_mustdie; // world status bool _logged,_mustdie; // world status
SocketHandler _sh; // handles the WorldSocket SocketHandler _sh; // handles the WorldSocket
Channel *_channels; Channel *_channels;
uint64 _myGUID; uint64 _myGUID;
World *_world; World *_world;
WhoList _whoList; WhoList _whoList;
uint32 _lag_ms; uint32 _lag_ms;
std::bitset<MAX_OPCODE_ID> _disabledOpcodes; std::bitset<MAX_OPCODE_ID> _disabledOpcodes;
}; };
#endif #endif

View File

@ -1,130 +1,130 @@
#include "WorldPacket.h" #include "WorldPacket.h"
#include "WorldSession.h" #include "WorldSession.h"
#include "WorldSocket.h" #include "WorldSocket.h"
#include "Opcodes.h" #include "Opcodes.h"
WorldSocket::WorldSocket(SocketHandler &h, WorldSession *s) : TcpSocket(h) WorldSocket::WorldSocket(SocketHandler &h, WorldSession *s) : TcpSocket(h)
{ {
_session = s; _session = s;
_gothdr = false; _gothdr = false;
_ok=false; _ok=false;
} }
bool WorldSocket::IsOk(void) bool WorldSocket::IsOk(void)
{ {
return _ok; return _ok;
} }
void WorldSocket::OnConnect() void WorldSocket::OnConnect()
{ {
log("Connected to world server."); log("Connected to world server.");
_ok = true; _ok = true;
} }
void WorldSocket::OnConnectFailed() void WorldSocket::OnConnectFailed()
{ {
logerror("Connecting to World Server failed!"); logerror("Connecting to World Server failed!");
_ok = false; _ok = false;
} }
void WorldSocket::OnDelete() void WorldSocket::OnDelete()
{ {
log("Connection to world server has been closed."); log("Connection to world server has been closed.");
_ok = false; _ok = false;
_session->SetMustDie(); // recreate the session if needed _session->SetMustDie(); // recreate the session if needed
} }
void WorldSocket::OnException() void WorldSocket::OnException()
{ {
if(_ok) if(_ok)
{ {
logerror("WorldSocket::OnException()"); logerror("WorldSocket::OnException()");
_ok = false; _ok = false;
} }
} }
void WorldSocket::OnRead() void WorldSocket::OnRead()
{ {
TcpSocket::OnRead(); TcpSocket::OnRead();
if(!ibuf.GetLength()) if(!ibuf.GetLength())
{ {
this->CloseAndDelete(); this->CloseAndDelete();
return; return;
} }
while(ibuf.GetLength() > 0) // when all packets from the current ibuf are transformed into WorldPackets the remaining len will be zero while(ibuf.GetLength() > 0) // when all packets from the current ibuf are transformed into WorldPackets the remaining len will be zero
{ {
if(_gothdr) // already got header, this packet has to be the data part if(_gothdr) // already got header, this packet has to be the data part
{ {
ASSERT(_remaining > 0); // case pktsize==0 is handled below ASSERT(_remaining > 0); // case pktsize==0 is handled below
if(ibuf.GetLength() < _remaining) if(ibuf.GetLength() < _remaining)
{ {
DEBUG(logdebug("Delaying WorldPacket generation, bufsize is %u but should be >= %u",ibuf.GetLength(),_remaining)); DEBUG(logdebug("Delaying WorldPacket generation, bufsize is %u but should be >= %u",ibuf.GetLength(),_remaining));
break; break;
} }
_gothdr=false; _gothdr=false;
WorldPacket *wp = new WorldPacket(_remaining); WorldPacket *wp = new WorldPacket(_remaining);
wp->resize(_remaining); wp->resize(_remaining);
ibuf.Read((char*)wp->contents(),_remaining); ibuf.Read((char*)wp->contents(),_remaining);
wp->SetOpcode(_opcode); wp->SetOpcode(_opcode);
GetSession()->AddToPktQueue(wp); GetSession()->AddToPktQueue(wp);
} }
else // no pending header stored, so this packet must be a header else // no pending header stored, so this packet must be a header
{ {
if(ibuf.GetLength() < sizeof(ServerPktHeader)) if(ibuf.GetLength() < sizeof(ServerPktHeader))
{ {
DEBUG(logdebug("Delaying header reading, bufsize is %u but should be >= %u",ibuf.GetLength(),sizeof(ServerPktHeader))); DEBUG(logdebug("Delaying header reading, bufsize is %u but should be >= %u",ibuf.GetLength(),sizeof(ServerPktHeader)));
break; break;
} }
ServerPktHeader hdr; ServerPktHeader hdr;
ibuf.Read((char*)&hdr,sizeof(ServerPktHeader)); ibuf.Read((char*)&hdr,sizeof(ServerPktHeader));
_crypt.DecryptRecv((uint8*)&hdr,sizeof(ServerPktHeader)); _crypt.DecryptRecv((uint8*)&hdr,sizeof(ServerPktHeader));
_remaining = ntohs(hdr.size)-2; _remaining = ntohs(hdr.size)-2;
_opcode = hdr.cmd; _opcode = hdr.cmd;
if(_opcode > MAX_OPCODE_ID) // no opcode has yet a number over 1000 if(_opcode > MAX_OPCODE_ID) // no opcode has yet a number over 1000
{ {
logcritical("CRYPT ERROR: opcode=%u, remain=%u",_opcode,_remaining); // this should never be the case! logcritical("CRYPT ERROR: opcode=%u, remain=%u",_opcode,_remaining); // this should never be the case!
GetSession()->GetInstance()->SetError(); // no way to recover the crypt, must exit GetSession()->GetInstance()->SetError(); // no way to recover the crypt, must exit
// if the crypt gets messy its hardly possible to recover it, especially if we dont know // if the crypt gets messy its hardly possible to recover it, especially if we dont know
// the lentgh of the following data part // the lentgh of the following data part
// TODO: invent some way how to recover the crypt (reconnect?) // TODO: invent some way how to recover the crypt (reconnect?)
return; return;
} }
// the header is fine, now check if there are more data // the header is fine, now check if there are more data
if(_remaining == 0) // this is a packet with no data (like CMSG_NULL_ACTION) if(_remaining == 0) // this is a packet with no data (like CMSG_NULL_ACTION)
{ {
WorldPacket *wp = new WorldPacket; WorldPacket *wp = new WorldPacket;
wp->SetOpcode(_opcode); wp->SetOpcode(_opcode);
GetSession()->AddToPktQueue(wp); GetSession()->AddToPktQueue(wp);
} }
else // there is a data part to fetch else // there is a data part to fetch
{ {
_gothdr=true; // only got the header, next packet will contain the data _gothdr=true; // only got the header, next packet will contain the data
} }
} }
} }
} }
void WorldSocket::SendWorldPacket(WorldPacket &pkt) void WorldSocket::SendWorldPacket(WorldPacket &pkt)
{ {
if(!_ok) if(!_ok)
return; return;
ClientPktHeader hdr; ClientPktHeader hdr;
memset(&hdr,0,sizeof(ClientPktHeader)); memset(&hdr,0,sizeof(ClientPktHeader));
hdr.size = ntohs(pkt.size()+4); hdr.size = ntohs(pkt.size()+4);
hdr.cmd = pkt.GetOpcode(); hdr.cmd = pkt.GetOpcode();
_crypt.EncryptSend((uint8*)&hdr, 6); _crypt.EncryptSend((uint8*)&hdr, 6);
ByteBuffer final(pkt.size()+6); ByteBuffer final(pkt.size()+6);
final.append((uint8*)&hdr,sizeof(ClientPktHeader)); final.append((uint8*)&hdr,sizeof(ClientPktHeader));
if(pkt.size()) if(pkt.size())
final.append(pkt.contents(),pkt.size()); final.append(pkt.contents(),pkt.size());
SendBuf((char*)final.contents(),final.size()); SendBuf((char*)final.contents(),final.size());
} }
void WorldSocket::InitCrypt(uint8 *key,uint32 len) void WorldSocket::InitCrypt(uint8 *key,uint32 len)
{ {
_crypt.SetKey(key,len); _crypt.SetKey(key,len);
_crypt.Init(); _crypt.Init();
} }

View File

@ -1,61 +1,61 @@
//****************************************************************************** //******************************************************************************
// Here are all codes used in Logon Server. // Here are all codes used in Logon Server.
//============================================================================== //==============================================================================
#ifndef _LOGONCODES_H #ifndef _LOGONCODES_H
#define _LOGONCODES_H #define _LOGONCODES_H
//============================================================================== //==============================================================================
//#include "OurDefs.h" //#include "OurDefs.h"
//============================================================================== //==============================================================================
// wow's codes: // wow's codes:
enum EClientCommand enum EClientCommand
// dumped from wow.exe 1.8.0 // dumped from wow.exe 1.8.0
// 0x007F86A8: table of // 0x007F86A8: table of
// <int32 code, int32 pstr, int32 pproc, int32 0> // <int32 code, int32 pstr, int32 pproc, int32 0>
// switch: 005999A7 cmp byte ptr [ecx],dl // switch: 005999A7 cmp byte ptr [ecx],dl
{ {
CMD_AUTH_LOGON_CHALLENGE = 0x00, // client CMD_AUTH_LOGON_CHALLENGE = 0x00, // client
CMD_AUTH_LOGON_PROOF = 0x01, // client CMD_AUTH_LOGON_PROOF = 0x01, // client
CMD_AUTH_RECONNECT_CHALLENGE = 0x02, // client CMD_AUTH_RECONNECT_CHALLENGE = 0x02, // client
CMD_AUTH_RECONNECT_PROOF = 0x03, // client CMD_AUTH_RECONNECT_PROOF = 0x03, // client
CMD_REALM_LIST = 0x10, // client CMD_REALM_LIST = 0x10, // client
CMD_XFER_INITIATE = 0x30, // client? from server CMD_XFER_INITIATE = 0x30, // client? from server
CMD_XFER_DATA = 0x31, // client? from server CMD_XFER_DATA = 0x31, // client? from server
CMD_XFER_ACCEPT = 0x32, // not official name, from client CMD_XFER_ACCEPT = 0x32, // not official name, from client
CMD_XFER_RESUME = 0x33, // not official name, from client CMD_XFER_RESUME = 0x33, // not official name, from client
CMD_XFER_CANCEL = 0x34, // not official name, from client CMD_XFER_CANCEL = 0x34, // not official name, from client
// unknown: // unknown:
CMD_GRUNT_AUTH_CHALLENGE = 0x00, // server CMD_GRUNT_AUTH_CHALLENGE = 0x00, // server
CMD_GRUNT_AUTH_VERIFY = 0x02, // server CMD_GRUNT_AUTH_VERIFY = 0x02, // server
CMD_GRUNT_CONN_PING = 0x10, // server CMD_GRUNT_CONN_PING = 0x10, // server
CMD_GRUNT_CONN_PONG = 0x11, // server CMD_GRUNT_CONN_PONG = 0x11, // server
CMD_GRUNT_HELLO = 0x20, // server CMD_GRUNT_HELLO = 0x20, // server
CMD_GRUNT_PROVESESSION = 0x21, // server CMD_GRUNT_PROVESESSION = 0x21, // server
CMD_GRUNT_KICK = 0x24, // server CMD_GRUNT_KICK = 0x24, // server
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
enum ELoginErrorCode enum ELoginErrorCode
// dumped from wow.exe 1.8.0 // dumped from wow.exe 1.8.0
// 00591E9D mov eax,dword ptr [ebp+8] // 00591E9D mov eax,dword ptr [ebp+8]
// eax - code, name in stack after exiting from current funk // eax - code, name in stack after exiting from current funk
{ {
// LOGIN_STATE_FAILED: // LOGIN_STATE_FAILED:
LOGIN_FAILED = 1, // 2, B, C, D // "Unable to connect" LOGIN_FAILED = 1, // 2, B, C, D // "Unable to connect"
LOGIN_BANNED = 3, // "This World of Warcraft account has been closed and is no longer in service -- Please check the registered email address of this account for further information."; -- This is the error message players get when trying to log in with a banned account. LOGIN_BANNED = 3, // "This World of Warcraft account has been closed and is no longer in service -- Please check the registered email address of this account for further information."; -- This is the error message players get when trying to log in with a banned account.
LOGIN_UNKNOWN_ACCOUNT = 4, // 5 // "The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password and account, see www.worldofwarcraft.com for more information."; LOGIN_UNKNOWN_ACCOUNT = 4, // 5 // "The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password and account, see www.worldofwarcraft.com for more information.";
LOGIN_ALREADYONLINE = 6, // "This account is already logged into World of Warcraft. Please check the spelling and try again."; LOGIN_ALREADYONLINE = 6, // "This account is already logged into World of Warcraft. Please check the spelling and try again.";
LOGIN_NOTIME = 7, // "You have used up your prepaid time for this account. Please purchase more to continue playing"; LOGIN_NOTIME = 7, // "You have used up your prepaid time for this account. Please purchase more to continue playing";
LOGIN_DBBUSY = 8, // "Could not log in to World of Warcraft at this time. Please try again later."; LOGIN_DBBUSY = 8, // "Could not log in to World of Warcraft at this time. Please try again later.";
LOGIN_BADVERSION = 9, // "Unable to validate game version. This may be caused by file corruption or the interference of another program. Please visit www.blizzard.com/support/wow/ for more information and possible solutions to this issue."; LOGIN_BADVERSION = 9, // "Unable to validate game version. This may be caused by file corruption or the interference of another program. Please visit www.blizzard.com/support/wow/ for more information and possible solutions to this issue.";
LOGIN_PARENTALCONTROL = 0xF, // "17"="LOGIN_PARENTALCONTROL" // "Access to this account has been blocked by parental controls. Your settings may be changed in your account preferences at http://www.worldofwarcraft.com."; LOGIN_PARENTALCONTROL = 0xF, // "17"="LOGIN_PARENTALCONTROL" // "Access to this account has been blocked by parental controls. Your settings may be changed in your account preferences at http://www.worldofwarcraft.com.";
// LOGIN_STATE_AUTHENTICATED: // LOGIN_STATE_AUTHENTICATED:
LOGIN_OK = 0, // E LOGIN_OK = 0, // E
// LOGIN_STATE_DOWNLOADFILE, LOGIN_OK // LOGIN_STATE_DOWNLOADFILE, LOGIN_OK
LOGIN_DOWNLOADFILE = 0xA, // not official name LOGIN_DOWNLOADFILE = 0xA, // not official name
}; };
//============================================================================== //==============================================================================
#endif // _LOGONCODES_H #endif // _LOGONCODES_H
//****************************************************************************** //******************************************************************************

View File

@ -1,193 +1,193 @@
//****************************************************************************** //******************************************************************************
// Here are all packets to and from Logon Server. // Here are all packets to and from Logon Server.
//============================================================================== //==============================================================================
#ifndef _LOGONPACKETS_H #ifndef _LOGONPACKETS_H
#define _LOGONPACKETS_H #define _LOGONPACKETS_H
//============================================================================== //==============================================================================
#include "../Shared/OurDefs.h" #include "../Shared/OurDefs.h"
#include <openssl/md5.h> #include <openssl/md5.h>
//============================================================================== //==============================================================================
#pragma pack(push, 1) #pragma pack(push, 1)
//============================================================================== //==============================================================================
// Challenge: // Challenge:
struct SClientLogonChallenge struct SClientLogonChallenge
{ {
uint8 cmd; // OP code = CMD_AUTH_LOGON_CHALLENGE uint8 cmd; // OP code = CMD_AUTH_LOGON_CHALLENGE
uint8 error0x02; // 0x02 uint8 error0x02; // 0x02
uint16 size; // size of the rest of packet, without this part uint16 size; // size of the rest of packet, without this part
uint8 gamename[4]; // "WoW" uint8 gamename[4]; // "WoW"
uint8 version[2]; // 0x01 08 00 -> (1.8.0) uint8 version[2]; // 0x01 08 00 -> (1.8.0)
uint16 build; // 0x7F12 -> 4735 uint16 build; // 0x7F12 -> 4735
uint8 platform[3]; // 68x\0 -> "x86" uint8 platform[3]; // 68x\0 -> "x86"
uint8 os[3]; // niW\0 -> "Win" uint8 os[3]; // niW\0 -> "Win"
uint8 localization[4];// BGne -> 'enGB' uint8 localization[4];// BGne -> 'enGB'
uint32 timezone_bias; // 0x78 00 00 00 uint32 timezone_bias; // 0x78 00 00 00
uint8 ip[4]; // client ip: 0x7F 00 00 01 uint8 ip[4]; // client ip: 0x7F 00 00 01
uint8 acclen; // length of account name (without zero-char) uint8 acclen; // length of account name (without zero-char)
uint8 *acc; // upcased account name (without zero-char) uint8 *acc; // upcased account name (without zero-char)
}; };
struct SClientLogonChallenge_Header // just for usability struct SClientLogonChallenge_Header // just for usability
{ {
uint8 cmd; // OP code = CMD_AUTH_LOGON_CHALLENGE uint8 cmd; // OP code = CMD_AUTH_LOGON_CHALLENGE
uint8 error; // 0x02 uint8 error; // 0x02
uint16 size; // size of the rest of packet, without this part uint16 size; // size of the rest of packet, without this part
}; };
struct SClientReconnectChallenge // == SClientChallenge struct SClientReconnectChallenge // == SClientChallenge
{ {
uint8 cmd; // OP code = 02 = CMD_AUTH_RECONNECT_CHALLENGE uint8 cmd; // OP code = 02 = CMD_AUTH_RECONNECT_CHALLENGE
uint8 error; // 0x02 uint8 error; // 0x02
uint16 size; // size of the rest of packet, without this part uint16 size; // size of the rest of packet, without this part
uint8 gamename[4]; // "WoW" uint8 gamename[4]; // "WoW"
uint8 version[2]; // 0x01 08 00 -> (1.8.0) uint8 version[2]; // 0x01 08 00 -> (1.8.0)
uint16 build; // 0x7F12 -> 4735 uint16 build; // 0x7F12 -> 4735
uint8 platform[4]; // 68x\0 -> "x86" uint8 platform[4]; // 68x\0 -> "x86"
uint8 os[4]; // niW\0 -> "Win" uint8 os[4]; // niW\0 -> "Win"
uint8 country[4]; // BGne -> 'enGB' uint8 country[4]; // BGne -> 'enGB'
uint32 timezone_bias; // 0x78 00 00 00 uint32 timezone_bias; // 0x78 00 00 00
uint8 ip[4]; // client ip: 0x7F 00 00 01 uint8 ip[4]; // client ip: 0x7F 00 00 01
uint8 acclen; // length of account name (without zero-char) uint8 acclen; // length of account name (without zero-char)
uint8 *acc; // upcased account name (without zero-char) uint8 *acc; // upcased account name (without zero-char)
}; };
struct SServerLogonChallenge_Err struct SServerLogonChallenge_Err
{ {
uint8 cmd; // 0x00 -> OPcode = CMD_AUTH_LOGON_CHALLENGE ? CMD_GRUNT_AUTH_CHALLENGE uint8 cmd; // 0x00 -> OPcode = CMD_AUTH_LOGON_CHALLENGE ? CMD_GRUNT_AUTH_CHALLENGE
uint8 error; // one of SServerChallenge_ErrorCodes codes uint8 error; // one of SServerChallenge_ErrorCodes codes
}; };
struct SServerLogonChallenge_Ok struct SServerLogonChallenge_Ok
// Variables: // Variables:
// X := SHA1( salt || SHA1(upper(acc:pass)) ) // X := SHA1( salt || SHA1(upper(acc:pass)) )
// b[20] := random server's secret // b[20] := random server's secret
// K := 3 // K := 3
// salt[32] := random // salt[32] := random
// N := 89 4B 64 5E - 89 E1 53 5B - BD AD 5B 8B - 29 06 50 53 // N := 89 4B 64 5E - 89 E1 53 5B - BD AD 5B 8B - 29 06 50 53
// 08 01 B1 8E - BF BF 5E 8F - AB 3C 82 87 - 2A 3E 9B B7 // 08 01 B1 8E - BF BF 5E 8F - AB 3C 82 87 - 2A 3E 9B B7
// g[1] := 7 // g[1] := 7
// //
// Calculations: // Calculations:
// Verifier := g^(~x) mod ~N // Verifier := g^(~x) mod ~N
// B := ~( K*V + g^(~b) mod ~N ) // B := ~( K*V + g^(~b) mod ~N )
{ {
uint8 cmd; // 0x00 -> OPcode = CMD_AUTH_LOGON_CHALLENGE ? CMD_GRUNT_AUTH_CHALLENGE uint8 cmd; // 0x00 -> OPcode = CMD_AUTH_LOGON_CHALLENGE ? CMD_GRUNT_AUTH_CHALLENGE
uint8 error; // 0 -> ok = LOGIN_OK uint8 error; // 0 -> ok = LOGIN_OK
uint8 unk1; // 0x00 uint8 unk1; // 0x00
uint8 B[32]; // calculated by server uint8 B[32]; // calculated by server
uint8 g_len; // 0x01 uint8 g_len; // 0x01
uint8 g[1]; // 0x07 (const) uint8 g[1]; // 0x07 (const)
uint8 N_len; // 0x20 uint8 N_len; // 0x20
uint8 N[32]; // const uint8 N[32]; // const
uint8 salt[32]; // random uint8 salt[32]; // random
uint8 unk2[16]; //1: BA 79 D4 8D - BF FC BF AD - 8C B4 EC B3 - 75 C5 96 05 uint8 unk2[16]; //1: BA 79 D4 8D - BF FC BF AD - 8C B4 EC B3 - 75 C5 96 05
//2: 0F EB C2 82 - 28 C2 BC E4 - A6 31 30 C7 - 9F 6D 72 76 //2: 0F EB C2 82 - 28 C2 BC E4 - A6 31 30 C7 - 9F 6D 72 76
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Proof: // Proof:
struct SClientLogonProof struct SClientLogonProof
{ {
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF
uint8 A[32]; // calculated by client uint8 A[32]; // calculated by client
uint8 M1[20]; // uint8 M1[20]; //
uint8 crc_hash[20]; // uint8 crc_hash[20]; //
uint8 number_of_keys; // 0x00 uint8 number_of_keys; // 0x00
}; };
struct SClientReconnectProof // == SClientProof struct SClientReconnectProof // == SClientProof
{ {
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_RECONNECT_PROOF uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_RECONNECT_PROOF
uint8 A[32]; // calculated by client uint8 A[32]; // calculated by client
uint8 M1[20]; // uint8 M1[20]; //
uint8 crc_hash[20]; // uint8 crc_hash[20]; //
uint8 number_of_keys; // 0x00 uint8 number_of_keys; // 0x00
}; };
struct SServerLogonProof_Err struct SServerLogonProof_Err
// Variables: // Variables:
// U := SHA1(A || B) // U := SHA1(A || B)
// //
// Calculations: // Calculations:
// S := ~( ( (V^(~U))*(~A) ) ^ (~b) mod ~N ) // S := ~( ( (V^(~U))*(~A) ) ^ (~b) mod ~N )
// hS0 := SHA1 ( S[0] || S[2] || ... || S[20] ) // hS0 := SHA1 ( S[0] || S[2] || ... || S[20] )
// hS1 := SHA1 ( S[1] || S[3] || ... || S[19] ) // hS1 := SHA1 ( S[1] || S[3] || ... || S[19] )
// SS := hS0[0] || hS1[0] || hS0[1] || ... || hS1[10] // SS := hS0[0] || hS1[0] || hS0[1] || ... || hS1[10]
// M1 := SHA1( (SHA1(N) xor SHA1(G)) || SHA1(upper(acc)) || salt || A || B || SS ) // M1 := SHA1( (SHA1(N) xor SHA1(G)) || SHA1(upper(acc)) || salt || A || B || SS )
{ {
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF
uint8 error; // 0x04 -> password is incorrect = LOGIN_UNKNOWN_ACCOUNT uint8 error; // 0x04 -> password is incorrect = LOGIN_UNKNOWN_ACCOUNT
}; };
struct SServerLogonProof_Ok struct SServerLogonProof_Ok
// M2 := SHA1(A || M1 || SS) // M2 := SHA1(A || M1 || SS)
{ {
uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF uint8 cmd; // 0x01 -> OPcode = CMD_AUTH_LOGON_PROOF
uint8 error; // 0x00 -> ok uint8 error; // 0x00 -> ok
uint8 M2[20]; // calculated by server uint8 M2[20]; // calculated by server
uint32 unk; // 0x00 00 00 00 uint32 unk; // 0x00 00 00 00
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Realm: // Realm:
struct SClientRealmList struct SClientRealmList
{ {
uint8 cmd; // OP code = CMD_REALM_LIST uint8 cmd; // OP code = CMD_REALM_LIST
uint32 unknown; // 0x00 00 00 00 uint32 unknown; // 0x00 00 00 00
}; };
struct SServerRealmList // for info only - variable size struct SServerRealmList // for info only - variable size
{ {
uint8 cmd; // OP code = CMD_REALM_LIST uint8 cmd; // OP code = CMD_REALM_LIST
uint16 size; // size of the rest of packet, without this part uint16 size; // size of the rest of packet, without this part
uint32 unknown; // 0x00 00 00 00 uint32 unknown; // 0x00 00 00 00
uint8 count; // quantity of realms uint8 count; // quantity of realms
struct SRealmInfo struct SRealmInfo
{ {
uint32 icon; // icon near realm uint32 icon; // icon near realm
uint8 color; // color of record uint8 color; // color of record
char *name; // Text zero terminated name of Realm char *name; // Text zero terminated name of Realm
char *addr_port; // Text zero terminated address of Realm ("ip:port") char *addr_port; // Text zero terminated address of Realm ("ip:port")
float population; // 1.6 -> population value. lower == lower population and vice versa float population; // 1.6 -> population value. lower == lower population and vice versa
uint8 chars_here; // number of characters on this server uint8 chars_here; // number of characters on this server
uint8 timezone; // timezone uint8 timezone; // timezone
uint8 unknown; // uint8 unknown; //
} * realms; } * realms;
uint8 unknown1; // 0x2A unknown uint8 unknown1; // 0x2A unknown
uint8 unknown2; // 0x00 unknown uint8 unknown2; // 0x00 unknown
}; };
struct SServerRealmList_Header struct SServerRealmList_Header
{ {
uint8 cmd; // OP code = CMD_REALM_LIST uint8 cmd; // OP code = CMD_REALM_LIST
uint16 size; // size of the rest of packet, without this part uint16 size; // size of the rest of packet, without this part
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Xref: // Xref:
struct SServerXferInitiate struct SServerXferInitiate
{ {
uint8 cmd; // 0x30 -> OPcode = CMD_XFER_INITIATE uint8 cmd; // 0x30 -> OPcode = CMD_XFER_INITIATE
uint8 typelen; // 0x05 -> sizeof(Patch) uint8 typelen; // 0x05 -> sizeof(Patch)
uint8 typestr[5]; // 'Patch' uint8 typestr[5]; // 'Patch'
uint32 size; // 0x34 C4 0D 00 = 902,196 byte (180->181 enGB) uint32 size; // 0x34 C4 0D 00 = 902,196 byte (180->181 enGB)
uint32 unk; // 0x0 always uint32 unk; // 0x0 always
uint8 md5[MD5_DIGEST_LENGTH]; // md5 checksum of file uint8 md5[MD5_DIGEST_LENGTH]; // md5 checksum of file
}; };
struct SServerXferData struct SServerXferData
{ {
uint8 cmd; // 0x31 -> OPcode = CMD_XFER_DATA uint8 cmd; // 0x31 -> OPcode = CMD_XFER_DATA
uint16 blocksize; // 0xDC 05 -> 1500 (max block) uint16 blocksize; // 0xDC 05 -> 1500 (max block)
uint8 buf[1500]; // block uint8 buf[1500]; // block
}; };
struct SClientXferAccept struct SClientXferAccept
{ {
uint8 cmd; // 0x32 -> OPcode = CMD_XFER_ACCEPT uint8 cmd; // 0x32 -> OPcode = CMD_XFER_ACCEPT
}; };
struct SClientXferResume struct SClientXferResume
{ {
uint8 cmd; // 0x33 -> OPcode = CMD_XFER_RESUME uint8 cmd; // 0x33 -> OPcode = CMD_XFER_RESUME
uint32 start; // will continue at uint32 start; // will continue at
uint32 unknown; // uint32 unknown; //
}; };
struct SClientXferCancel struct SClientXferCancel
{ {
uint8 cmd; // 0x34 -> OPcode = CMD_XFER_CANCEL uint8 cmd; // 0x34 -> OPcode = CMD_XFER_CANCEL
}; };
//============================================================================== //==============================================================================
#pragma pack(pop) #pragma pack(pop)
//============================================================================== //==============================================================================
#endif // _LOGONPACKETS_H #endif // _LOGONPACKETS_H
//****************************************************************************** //******************************************************************************

Some files were not shown because too many files have changed in this diff Show More