Compare commits

..
12 Commits
Author SHA1 Message Date
ThomasandClaude Sonnet 5 0884cab294 Make webtools host port configurable via WEBTOOLS_PORT
Port 80 on the host isn't always free (e.g. another service already bound
to it), so let .env override it like the game server ports already do.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 17:08:39 +02:00
ThomasandClaude Sonnet 5 1998bf4273 Strip dead Windows-only code paths, add LTO/march build flags, seed default GM account
Removes now-unreachable #ifdef _WIN32 branches across Common/ and the three
server binaries (all builds are Linux-only), deletes the entirely unused
SEH exception-handling shim and an orphaned vendored MySQL client header.
Enables LTO and -march=x86-64-v2 in Release builds for a small free perf win.

Also seeds a default GM account (gmadmin/changeme) via
database sql files/gm_account.sql so a fresh deploy has something to log
into the web admin panel with, switches the MariaDB data directory from a
Docker named volume to a host bind mount for visibility/backup, and expands
the README with a fuller Docker deployment walkthrough.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 15:42:36 +02:00
Thomas 1e47731d7a Remove MSVC project files (.vcxproj/.sln)
CharServer/, Login/, WorldServer/, and Servers/ contained nothing but Visual
Studio project files -- no source, nothing else. CMake/Docker is the only
build path now, so these were pure dead weight.
2026-07-10 14:30:56 +02:00
Thomas 8b9547a928 Add README
Covers quick start, the two web UIs, non-Docker build instructions, repo
layout, and the two Windows-porting gotchas (clock() semantics, DB string
widths) most likely to bite future changes.
2026-07-10 14:28:09 +02:00
Thomas e0d1f629db Add NPC/monster spawn browser with map and monster names to webtools
Map names now come from LIST_ZONE.STB (row index = map id, matching
CWorldServer::LoadZoneData). New NPCs tab lists all placed NPCs from
list_npcs with coordinates; new Monsters tab lists all 1,193 named montypes
from LIST_NPC.STB. Both are click-to-copy GM commands (/tele, /mon) for
quick GM navigation/spawning.
2026-07-10 14:20:12 +02:00
Thomas 16dccc94f2 Fix /setspeedmod: apply per-character, persist across stat recalculation
Previously stomped the shared GServer->MOVE_SPEED_MOD movement-timing
divisor, which character.cpp's UpdatePosition also uses for monster position
interpolation -- GM testing broke movement/attack range server-wide until
restart. Now stores a per-character SpeedModPercent that GetMoveSpeed()
applies on every recompute, so it survives future SetStats() calls instead
of being silently overwritten back to base speed. Also fixes Mspd_base (the
value actually broadcast to clients) never being set while WALKING.
2026-07-10 14:19:32 +02:00
Thomas 15e562cb04 Add server control (start/stop/restart, live logs, broadcast, kick) to webadmin
Docker SDK drives login/char/worldserver containers via docker.sock (mounted
read-only into webadmin); live logs stream over SSE with nginx buffering
disabled so lines arrive in real time. Broadcast/kick go through a new
admin_queue DB table that the world server polls every ~2s in its existing
WorldProcess tick loop, avoiding a second IPC channel to the game server.
2026-07-10 14:19:14 +02:00
Thomas 3554c85f2f Strip IDE cruft, stale build binaries, and dead source copies before external push
Removes Visual Studio local-state files (.vs/, .vcxproj.user, .suo/.VC.db),
precompiled Windows server binaries (now built from source via Docker), and
"Copy of"/.bak duplicate source/data files that were never referenced by the
CMake build. Adds matching .gitignore rules so they don't come back.
2026-07-10 14:18:32 +02:00
ThomasandClaude Sonnet 5 8486504b49 Merge admin panel into the port-80 webtools site under /admin/
webtools' nginx now reverse-proxies /admin/ to the webadmin container
(docker/conf/webtools-nginx.conf), which no longer publishes its own
port -- everything is reachable through port 80 alongside the GM
toolbox. Added a link to it in webtools/index.html's sidebar.

Flask needs to know it's mounted under /admin/ to generate correct
url_for()/redirect() targets, so app.py now wraps the app in
werkzeug's ProxyFix (x_prefix/x_proto/x_for/x_host) reading the
X-Forwarded-Prefix header nginx sets; verified redirects, form
actions, and links all come back /admin/-prefixed end to end through
port 80.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 08:18:07 +02:00
ThomasandClaude Sonnet 5 2b209cf17f Fix skill damage never actually scaling with level as its own comment claims
CCharacter::UseAtkSkill's hitmod formula was missing the "+ Stats->Level"
term that CCharacter::NormalAttack's equivalent hitmod already has --
despite the comment directly above it ("skill attacks now based on a
percentage of base attack power so that they scale with level")
promising exactly that. Net effect: a skill with atkpower=100 computed
the same base Attack as a plain auto-attack, but without the level
bonus or crit chance auto-attacks get, so skills ended up hitting no
harder (often weaker) than basic attacks.

This only touches genuine damage skills (skilltype 3/6 dispatched via
SKILL_ATTACK in worldpackets.cpp:pakStartSkill); buffs/heals/status
effects/resurrect (skilltype 9/11/13/20, SKILL_BUFF and friends) run
through entirely separate code and are untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 08:09:20 +02:00
ThomasandClaude Sonnet 5 a07c2e0a3f Add character rename to admin panel
Renaming checks for a name collision first (characters.char_name has
no unique constraint in the schema, so this has to be enforced at the
application level to avoid two characters silently sharing a name),
and also updates list_friend.namefriend for any rows referencing this
character's id -- that column is a denormalized display-name cache in
other players' friend lists and would otherwise go stale on rename.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 07:59:49 +02:00
ThomasandClaude Sonnet 5 315f64cf95 Add character teleport, delete, and account kick/delete to admin panel
Traced how login placement actually works: CPlayer login placement
(Src/World Server/worldpackets.cpp:27, pakPlayer) calls
GetRespawnByID(Position->respawn), and Position->respawn is loaded
straight from characters.respawnid (playerdata.cpp:110). So setting
respawnid to a Src/World Server list_respawnzones.id is a real, live
lever over where a character logs in next -- not a vestigial column
(unlike characters.townid, which turned out to be dead: the only
other code path that reads it is commented-out dead code in
pakUserDied, superseded by CPlayer::RespawnPlayer which uses an
in-memory Position->saved instead).

Added to the character edit page: a teleport dropdown grouped by map,
populated from list_respawnzones, wired straight to respawnid (takes
effect on the character's next login same as other stat edits) and a
delete-character action. Added to the account edit page: delete
account (characters are kept) and a "reset online flag" action for
accounts stuck thinking they're still logged in after a crash.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 07:54:00 +02:00
83 changed files with 1206 additions and 6309 deletions

No files matched your search

+4 -1
View File
@@ -17,6 +17,9 @@ PUBLIC_HOST=127.0.0.1
LOGIN_PORT=29000
CHAR_PORT=29100
WORLD_PORT=29200
# Web tools + admin panel (http://<host>:<this port>/). Change this if port 80
# is already taken by something else on the host.
WEBTOOLS_PORT=80
# --- Server / channel naming -----------------------------------------------
LOGIN_SERVER_NAME=ROSE Login
@@ -35,7 +38,7 @@ SHARED_LOGIN_PASS=789456
SHARED_CHAR_PASS=456123
SHARED_WORLD_PASS=321654
# --- Web admin panel (http://<host>:8081) -----------------------------------
# --- Web admin panel (http://<host>/admin/) ----------------------------------
# Logs in with an existing game account; only accounts with
# accesslevel >= ADMIN_MIN_ACCESSLEVEL are allowed in.
# Generate your own with: python3 -c "import secrets; print(secrets.token_hex(32))"
+24 -1
View File
@@ -2,12 +2,35 @@ build/
build-*/
.env
# MariaDB data directory -- now a bind mount (was a Docker named volume) so
# it's visible/backup-able from the host, but that also means it lives
# inside the repo checkout and must never be committed.
/docker/data/
# Windows game client + data assets, kept locally for end-to-end login/game
# testing but not part of the server source tree.
# testing but not part of the server source tree. Binary/3DData is the
# separate, already-pruned subset of this data the server itself actually
# reads (STB definitions, quest scripts, AIP scripts) and stays tracked.
/Client/
/3Ddata/
/3Ddata.zip
/KTRose_pre-evo.zip
# Visual Studio / MSVC local IDE state -- machine-specific, never useful to
# another checkout.
.vs/
*.vcxproj.user
*.suo
*.ncb
*.sdf
*.VC.db
# Editor/OS cruft and stray backup files left by past edits.
*.bak
*~
[Cc]opy of *
Thumbs.db
.DS_Store
# Claude Code project-local config
/.claude/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12 -1
View File
@@ -34,17 +34,28 @@ add_compile_options(
# in Release builds only). -fwrapv makes overflow well-defined instead
# of auditing every arithmetic expression in the tree.
-fwrapv
# x86-64-v2 (SSE4.2/POPCNT baseline, ~2009+ CPUs) is safe for any real
# deployment target and gets a bit more codegen than the generic x86-64
# baseline GCC defaults to.
-march=x86-64-v2
-include "${CMAKE_SOURCE_DIR}/Src/Common/compat.h"
)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
# Link-time optimization: lets GCC inline/optimize across the many small
# .cpp translation units instead of only within each one.
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_ERROR)
if(IPO_SUPPORTED AND CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif()
set(COMMON_SOURCES
"Src/Common/config.cpp"
"Src/Common/database/database.cpp"
"Src/Common/globals.cpp"
"Src/Common/log.cpp"
"Src/Common/rosecrypt.cpp"
"Src/Common/seh.cpp"
"Src/Common/SocketBase.cpp"
"Src/Common/SocketClient.cpp"
"Src/Common/SocketServer.cpp"
-182
View File
@@ -1,182 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{3d0d591e-9902-4991-8147-f731225439d9}</ProjectGuid>
<RootNamespace>CharServer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\Binary</OutDir>
<IncludePath>$(SolutionDir)../Src\3rd_party\mysql\include;$(SolutionDir)../Src\3rd_party\pthread\include;D:\Triggersoft\KTRose_Server\Src\3rd_party\mysql\include;D:\Triggersoft\KTRose_Server\Src\3rd_party\pthread\include;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\3rd_Party\pthread\lib\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_MBCS;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)../Src\3rd_party\mysql\include;$(SolutionDir)../Src\3rd_party\pthread\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)../Src\3rd_Party\mysql\lib;$(SolutionDir)../Src\3rd_Party\pthread\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libmysql.lib;pthreadvc2.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Src\3rd_party\mysql\include\mysql.h" />
<ClInclude Include="..\Src\3rd_party\pthread\include\pthread.h" />
<ClInclude Include="..\Src\Char Server\charserver.h" />
<ClInclude Include="..\Src\Char Server\datatypes.h" />
<ClInclude Include="..\Src\Common\config.h" />
<ClInclude Include="..\Src\Common\database\database.h" />
<ClInclude Include="..\Src\Common\log.h" />
<ClInclude Include="..\Src\Common\seh.hpp" />
<ClInclude Include="..\Src\Common\sockets.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Src\Char Server\charclient.cpp" />
<ClCompile Include="..\Src\Char Server\charpackets.cpp" />
<ClCompile Include="..\Src\Char Server\charserver.cpp" />
<ClCompile Include="..\Src\Char Server\clan.cpp" />
<ClCompile Include="..\Src\Char Server\community.cpp" />
<ClCompile Include="..\Src\Char Server\extrafunctions.cpp" />
<ClCompile Include="..\Src\Char Server\main.cpp" />
<ClCompile Include="..\Src\Char Server\signal.cpp" />
<ClCompile Include="..\Src\Common\config.cpp" />
<ClCompile Include="..\Src\Common\database\database.cpp" />
<ClCompile Include="..\Src\Common\globals.cpp" />
<ClCompile Include="..\Src\Common\log.cpp" />
<ClCompile Include="..\Src\Common\rosecrypt.cpp" />
<ClCompile Include="..\Src\Common\seh.cpp" />
<ClCompile Include="..\Src\Common\SocketBase.cpp" />
<ClCompile Include="..\Src\Common\SocketClient.cpp" />
<ClCompile Include="..\Src\Common\SocketServer.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
-99
View File
@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Src\Char Server\charserver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Char Server\datatypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\seh.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\sockets.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\3rd_party\mysql\include\mysql.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\3rd_party\pthread\include\pthread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\database\database.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Src\Char Server\charclient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Char Server\charpackets.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Char Server\charserver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Char Server\clan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Char Server\community.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Char Server\extrafunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Char Server\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Char Server\signal.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\globals.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\rosecrypt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\seh.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketClient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketServer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\database\database.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>..\Binary</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
-180
View File
@@ -1,180 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{8a4791f9-4631-46d2-a7e3-7c7e21301cf6}</ProjectGuid>
<RootNamespace>Login</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>LoginServer</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\Binary</OutDir>
<IncludePath>$(SolutionDir)../Src\3rd_party\mysql\include;$(SolutionDir)../Src\3rd_party\pthread\include;D:\Triggersoft\KTRose_Server\Src\3rd_party\mysql\include;D:\Triggersoft\KTRose_Server\Src\3rd_party\pthread\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\Triggersoft\KTRose_Server\Src\3rd_party\mysql\lib;D:\Triggersoft\KTRose_Server\Src\3rd_party\pthread\lib\x86;$(SolutionDir)..\Src\3rd_Party\pthread\lib\x86;$(SolutionDir)..\Src\3rd_Party\mysql\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_MBSC;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>D:\Triggersoft\KTRose_Server\Src\3rd_party\pthread\include;D:\Triggersoft\KTRose_Server\Src\3rd_party\mysql\include;$(SolutionDir)../Src\3rd_party\mysql\include;$(SolutionDir)../Src\3rd_party\pthread\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>D:\Triggersoft\KTRose_Server\Src\3rd_party\mysql\lib;D:\Triggersoft\KTRose_Server\Src\3rd_party\pthread\lib\x86;$(SolutionDir)../3rd_Party\mysql\lib;$(SolutionDir)../3rd_Party\pthread\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libmysql.lib;pthreadvc2.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Src\3rd_party\mysql\include\mysql.h" />
<ClInclude Include="..\Src\3rd_party\pthread\include\pthread.h" />
<ClInclude Include="..\Src\Common\config.h" />
<ClInclude Include="..\Src\Common\database\database.h" />
<ClInclude Include="..\Src\Common\log.h" />
<ClInclude Include="..\Src\Common\seh.hpp" />
<ClInclude Include="..\Src\Common\sockets.h" />
<ClInclude Include="..\Src\Login Server\datatype.h" />
<ClInclude Include="..\Src\Login Server\loginserver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Src\Common\config.cpp" />
<ClCompile Include="..\Src\Common\database\database.cpp" />
<ClCompile Include="..\Src\Common\globals.cpp" />
<ClCompile Include="..\Src\Common\log.cpp" />
<ClCompile Include="..\Src\Common\rosecrypt.cpp" />
<ClCompile Include="..\Src\Common\seh.cpp" />
<ClCompile Include="..\Src\Common\SocketBase.cpp" />
<ClCompile Include="..\Src\Common\SocketClient.cpp" />
<ClCompile Include="..\Src\Common\SocketServer.cpp" />
<ClCompile Include="..\Src\Login Server\extrafunction.cpp" />
<ClCompile Include="..\Src\Login Server\loginclient.cpp" />
<ClCompile Include="..\Src\Login Server\loginpackets.cpp" />
<ClCompile Include="..\Src\Login Server\loginserver.cpp" />
<ClCompile Include="..\Src\Login Server\main.cpp" />
<ClCompile Include="..\Src\Login Server\signal.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
-93
View File
@@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Src\3rd_party\mysql\include\mysql.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\3rd_party\pthread\include\pthread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\database\database.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\seh.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\sockets.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Login Server\datatype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Login Server\loginserver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Src\Common\config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\globals.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\rosecrypt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\seh.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketClient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketServer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Login Server\extrafunction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Login Server\loginclient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Login Server\loginpackets.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Login Server\loginserver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Login Server\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Login Server\signal.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\database\database.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>..\Binary</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
+129
View File
@@ -0,0 +1,129 @@
# ROSS
A [ROSE Online](https://en.wikipedia.org/wiki/Rose_Online) (KTRose, pre-evo era) private server emulator, ported from its
original Windows/MSVC codebase to build and run natively on Linux, packaged as a Docker Compose stack.
Three C++ servers (login, character, world) talk to a MariaDB database and to each other over plain sockets, exactly like
the original 2007-era server did — just with the Windows-only bits (MSVC CRT calls, `clock()` semantics, path handling)
shimmed out so it builds and runs correctly under Linux/glibc/POSIX threads.
## Quick start
Needs Docker + the Compose plugin (`docker compose version` should work) on the host. Nothing else — the C++ servers,
their build toolchain, and the database all live inside the containers.
```sh
git clone <this repo> ross && cd ross
cp .env.example .env # edit PUBLIC_HOST at minimum if clients connect from another machine
docker compose up -d --build
```
`docker compose up -d --build` builds the `rose-server` image (compiles all three C++ servers inside a throwaway
builder stage, see `Dockerfile`), then starts every service in `docker-compose.yml` in the background. First start
takes a minute or two (compiling + MariaDB initializing and loading `database sql files/`); `docker compose logs -f`
to watch it happen.
That brings up:
| Service | Container | Port | What it is |
|---|---|---|---|
| `db` | `ross-db-1` | — (internal) | MariaDB, schema auto-loaded from `database sql files/` on first start |
| `loginserver` | `ross-loginserver-1` | `29000` | Account login |
| `charserver` | `ross-charserver-1` | `29100` | Character select/create/delete |
| `worldserver` | `ross-worldserver-1` | `29200` | The actual game world |
| `webtools` | `ross-webtools-1` | `80` (`WEBTOOLS_PORT`) | Static GM toolbox (see below) + reverse-proxies `/admin/` |
| `webadmin` | `ross-webadmin-1` | — (behind webtools) | Account/character/server admin panel |
Point a KTRose pre-evo client at `PUBLIC_HOST:29000` and log in — `LOGIN_CREATE_ACCOUNT=1` (the default) auto-creates an
account on first login with that username/password.
A default GM account is seeded into a fresh database by `database sql files/gm_account.sql`:
- username `gmadmin`, password `changeme`, `accesslevel 900` — logs into both the game (as a GM) and the web admin
panel below. **Change this password** (via the web admin panel, or `docker compose exec db mariadb ...`) on anything
other than a throwaway local instance — it's a public default sitting in git.
### `docker-compose.yml`, briefly
- `x-app` at the top is a YAML anchor: a template block (image, restart policy, the full list of `environment:`
variables read from `.env`) that `loginserver`, `charserver`, and `worldserver` each pull in with `<<: *app` so the
three definitions don't repeat themselves. They differ only in `command:` (which server to run) and which port they
publish.
- `db` is stock MariaDB; anything in `database sql files/` gets executed once, alphabetically, the first time the
container starts with an empty data volume (mounted read-only at `/docker-entrypoint-initdb.d`, MariaDB's standard
init-script hook). If you change schema files after the first start, they won't re-run automatically — either
`docker compose down -v` to wipe the `db-data` volume and reinitialize, or apply the change by hand.
- `webtools` (nginx) is what clients' browsers hit; it serves the static GM toolbox directly and reverse-proxies
`/admin/*` to the `webadmin` container, which isn't published to the host itself.
- `.env` (copied from `.env.example`) is where every port, server name, and shared inter-server password gets set —
`docker-compose.yml` itself should not need editing for a normal deploy.
Useful commands once it's up:
```sh
docker compose logs -f worldserver # tail one server's logs
docker compose restart worldserver # restart just one service (or use the webadmin Server tab)
docker compose down # stop everything, keep the DB volume
docker compose down -v # stop everything AND wipe the database
```
## Web tools — `http://<host>/`
A static, no-build-step GM toolbox, generated from the same STB/DB data the server itself reads:
- **GM Commands** — every `/command` `gmcmds.cpp` understands, with syntax, access-level, and a copy button.
- **Item Configurator** — browse all ~9,950 items, configure refine/count/etc., copy the exact `/item` or `/give2` command.
- **Maps** — every map with spawn/NPC activity, named from `LIST_ZONE.STB` (row index = map id, same as the server's own
`CWorldServer::LoadZoneData`).
- **NPCs** — every placed NPC (`list_npcs`) with coordinates; click to copy a `/tele <map> <x> <y>`.
- **Monsters** — all 1,193 named monster types from `LIST_NPC.STB`; click to copy a `/mon <montype> <count> <ai>`.
## Web admin — `http://<host>/admin/`
Logs in with an existing **game account** — only accounts with `accesslevel >= ADMIN_MIN_ACCESSLEVEL` (default `900`) get
in. From there:
- Browse/edit/delete accounts and characters, reset stats, grant GM/DEV, reset a stuck "online" flag.
- **Server** tab: start/stop/restart each of the three game servers, live-tail their logs (SSE), broadcast a message to
everyone online, or kick a character — all straight from the browser.
The server-control features talk to the Docker API (`/var/run/docker.sock`, mounted read-only into `webadmin`), so this
panel effectively has host-level privileges. It's fine behind GM-only login on a machine you control; don't put it
directly on the public internet without a reverse proxy that adds another auth layer.
## Building without Docker
```sh
apt-get install cmake g++ make libmariadb-dev pkg-config
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j"$(nproc)"
```
Produces `build/loginserver`, `build/charserver`, `build/worldserver`. Each expects a `.conf` file as its only argument
(see `docker/conf/*.conf.tmpl` for the format, or `Binary/*.conf` for a filled-in example) and reads game data relative
to its working directory — run it from a directory containing `3DData/` (see below) and `clanmark/`.
## Repo layout
- `Src/` — the three servers' C++ source, plus `Src/Common/` (shared networking/DB/crypto code all three link against).
- `database sql files/` — MariaDB schema, loaded automatically into a fresh `db` container.
- `Binary/3DData/` — the subset of the original game's data files the **server** actually reads at runtime: item/skill/
quest/zone definitions (`STB/`), quest scripts (`QUESTDATA/`), monster AI scripts (`AI/`). This is *not* the client's
3D models/textures/sound — the server never touches those, so they aren't in this repo.
- `webtools/`, `webadmin/` — the two web UIs described above.
- `docker/` — Dockerfile support files: config templates, entrypoint script, the webtools nginx config.
- `tools/rose_login_test.cpp` — a standalone protocol-level login smoke test, linking against the server's own
`rosecrypt.cpp` so it exercises the real crypto/handshake instead of a reimplementation.
## Notes for anyone touching the server code
This codebase was written entirely against Windows/MSVC assumptions that don't hold on Linux. The two that will bite you
if you're not aware of them:
- **`clock()`**: POSIX `clock()` returns *CPU time summed across every thread in the process*, not wall-clock time, and
ticks at `CLOCKS_PER_SEC == 1,000,000` instead of Windows' `1,000`. `Src/Common/sockets.h` `#define`s `clock()` to a
`CLOCK_MONOTONIC`-backed wall-clock millisecond counter for the whole codebase — don't remove that shim, and don't
call `clock()` expecting Windows semantics anywhere it might not apply.
- **DB string widths**: this server was built against MySQL 5.0, which silently truncated over-length strings instead
of rejecting them. MariaDB's default strict mode does not — if you add a new DB-backed field that stores a
server-generated string (timestamps, etc.), size the column generously.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-51
View File
@@ -1,51 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.34729.46
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LoginServer", "..\Login\Login.vcxproj", "{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CharServer", "..\CharServer\CharServer.vcxproj", "{3D0D591E-9902-4991-8147-F731225439D9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorldServer", "..\WorldServer\WorldServer.vcxproj", "{AC244676-8F9F-4498-BD17-E53746172C4B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Debug|x64.ActiveCfg = Debug|x64
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Debug|x64.Build.0 = Debug|x64
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Debug|x86.ActiveCfg = Debug|Win32
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Debug|x86.Build.0 = Debug|Win32
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Release|x64.ActiveCfg = Release|x64
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Release|x64.Build.0 = Release|x64
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Release|x86.ActiveCfg = Release|Win32
{8A4791F9-4631-46D2-A7E3-7C7E21301CF6}.Release|x86.Build.0 = Release|Win32
{3D0D591E-9902-4991-8147-F731225439D9}.Debug|x64.ActiveCfg = Debug|x64
{3D0D591E-9902-4991-8147-F731225439D9}.Debug|x64.Build.0 = Debug|x64
{3D0D591E-9902-4991-8147-F731225439D9}.Debug|x86.ActiveCfg = Debug|Win32
{3D0D591E-9902-4991-8147-F731225439D9}.Debug|x86.Build.0 = Debug|Win32
{3D0D591E-9902-4991-8147-F731225439D9}.Release|x64.ActiveCfg = Release|x64
{3D0D591E-9902-4991-8147-F731225439D9}.Release|x64.Build.0 = Release|x64
{3D0D591E-9902-4991-8147-F731225439D9}.Release|x86.ActiveCfg = Release|Win32
{3D0D591E-9902-4991-8147-F731225439D9}.Release|x86.Build.0 = Release|Win32
{AC244676-8F9F-4498-BD17-E53746172C4B}.Debug|x64.ActiveCfg = Debug|x64
{AC244676-8F9F-4498-BD17-E53746172C4B}.Debug|x64.Build.0 = Debug|x64
{AC244676-8F9F-4498-BD17-E53746172C4B}.Debug|x86.ActiveCfg = Debug|Win32
{AC244676-8F9F-4498-BD17-E53746172C4B}.Debug|x86.Build.0 = Debug|Win32
{AC244676-8F9F-4498-BD17-E53746172C4B}.Release|x64.ActiveCfg = Release|x64
{AC244676-8F9F-4498-BD17-E53746172C4B}.Release|x64.Build.0 = Release|x64
{AC244676-8F9F-4498-BD17-E53746172C4B}.Release|x86.ActiveCfg = Release|Win32
{AC244676-8F9F-4498-BD17-E53746172C4B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6BB11128-3E58-43E5-B9C0-6C9214D8E5BC}
EndGlobalSection
EndGlobal
-150
View File
@@ -1,150 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{00d682b3-25be-4840-b721-44ef6b63e5d3}</ProjectGuid>
<RootNamespace>Servers</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared" >
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup></ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
</Project>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
-3
View File
@@ -49,9 +49,6 @@ int main(int argc, char *argv[])
else
{
delete server;
#ifdef _WIN32
system("pause");
#endif
return -1;
}
server->LoadEncryption ();
-24
View File
@@ -38,9 +38,6 @@ void StartSignal( )
signal( SIGFPE, HandleSignal );
signal( SIGSEGV, HandleSignal );
signal( SIGTERM, HandleSignal );
#ifdef _WIN32
signal( SIGBREAK, HandleSignal );
#endif
signal( SIGABRT, HandleSignal );
}
@@ -51,9 +48,6 @@ void StopSignal( )
signal( SIGFPE, 0 );
signal( SIGSEGV, 0 );
signal( SIGTERM, 0 );
#ifdef _WIN32
signal( SIGBREAK, 0 );
#endif
signal( SIGABRT, 0 );
}
@@ -63,21 +57,13 @@ void HandleSignal( int num )
{
case SIGINT:/* Interactive attention */
Log( MSG_ERROR, "Signal received: SIGINT" );
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
raise(num);
break;
case SIGILL:/* Illegal instruction */
Log( MSG_ERROR, "Signal received: SIGILL, Server will be closed, Trying to save..." );
GServer->isActive = false;
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
raise(num);
break;
case SIGFPE:/* Floating point error */
@@ -88,11 +74,7 @@ void HandleSignal( int num )
case SIGSEGV:/* Segmentation violation */
Log( MSG_ERROR, "Signal received: SIGSEGV, Server will be closed, Trying to save..." );
GServer->isActive = false;
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
raise(num);
break;
@@ -100,12 +82,6 @@ void HandleSignal( int num )
Log( MSG_INFO, "Signal received: SIGTERM, Server will be closed" );
GServer->isActive = false;
break;
#ifdef _WIN32
case SIGBREAK:/* Control-break */
Log( MSG_INFO, "Signal received: SIGBREAK, Server will be closed" );
GServer->isActive = false;
break;
#endif
default:
cout << "Unknown Signal Number: " << num << endl;
raise(num);
+1 -10
View File
@@ -45,23 +45,14 @@ void CBaseSocket::CloseSocket( void )
isActive = false;
}
// Init winsocket, if we are using Windows
// No-op on Linux; kept so call sites don't need to special-case platforms.
bool InitWinSocket ( void )
{
#ifdef _WIN32
WSADATA wsa;
return (WSAStartup(MAKEWORD(2,0),&wsa)==0);
#else
return true;
#endif
}
// Close winsocket, if we are using Windows
void CloseWinSocket( void )
{
#ifdef _WIN32
WSACleanup( );
#endif
}
-11
View File
@@ -19,7 +19,6 @@
developed with Main erose/hrose source server + some change from the original eich source
*/
#include "sockets.h"
#include "seh.hpp"
#include "config.h"
// Constructor
@@ -183,16 +182,6 @@ void CClientSocket::SendPacket( CPacket *P )
Log(MSG_WARNING,"tried to send a packet to a socket that doesn't exist any more");
return;
}
//__seh_try
//{
// EncryptBuffer( CryptTable, Buffer );
//}
//__seh_except(info, context)
//{
// Log(MSG_WARNING,"Caught a bad packet %s. Send cancelled", Buffer);
// return;
//}
//__seh_end
EncryptBuffer( CryptTable, Buffer2 );
#endif
send( sock, (char*)Buffer2, Size, 0 );
-24
View File
@@ -289,21 +289,13 @@ void CServerSocket::ServerLoop( )
if ( activity == 0 )continue;
if ( activity < 0 && errno != EINTR )
{
#ifdef _WIN32
Log( MSG_ERROR, "Select command failed. Error #%i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Select command failed. Error #%i", errno );
#endif
isActive = false;
}
if ( LOG_THISSERVER != LOG_LOGIN_SERVER && FD_ISSET( sckISC, &fds ) )
{
int clientinfolen = sizeof( sockaddr_in );
#ifdef _WIN32
NewSocket = accept( sckISC, (sockaddr*)&ClientInfo, (int*)&clientinfolen );
#else
NewSocket = accept( sckISC, (sockaddr*)&ClientInfo, (socklen_t*)&clientinfolen );
#endif
// TODO: check if server is full
if (NewSocket != INVALID_SOCKET)
{
@@ -312,42 +304,26 @@ void CServerSocket::ServerLoop( )
}
else
{
#ifdef _WIN32
Log( MSG_ERROR, "Error accepting socket: %i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Error accepting socket: %i", errno );
#endif
}
}
}
if ( activity < 0 && errno != EINTR )
{
#ifdef _WIN32
Log( MSG_ERROR, "Select command failed. Error #%i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Select command failed. Error #%i", errno );
#endif
isActive = false;
}
if ( FD_ISSET( sock, &fds ) )
{
int clientinfolen = sizeof( sockaddr_in );
#ifdef _WIN32
NewSocket = accept( sock, (sockaddr*)&ClientInfo, (int*)&clientinfolen );
#else
NewSocket = accept( sock, (sockaddr*)&ClientInfo, (socklen_t*)&clientinfolen );
#endif
// TODO: check if server is full
if (NewSocket != INVALID_SOCKET)
AddUser( NewSocket, &ClientInfo, false );
else
{
#ifdef _WIN32
Log( MSG_ERROR, "Error accepting socket: %i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Error accepting socket: %i", errno );
#endif
}
}
if(!Config.usethreads)
-13
View File
@@ -45,18 +45,6 @@ bool ConfigGetEntry( const char *pcFile, const char *pcNameMust, char* &pcResult
while ( *pcPar==' ' || *pcPar=='\t' || *pcPar=='=' ) ++pcPar;
*pcPoint=0;
#ifdef _WIN32
if ( !_strcmpi( pcName, pcNameMust ) )
{
pcResult = _strdup( pcPar );
pcPoint = pcResult + strlen( pcPar );
if ( *pcPoint==0 ) return true;
--pcPoint;
while( *pcPoint==' ' || *pcPoint=='\t' ) *pcPoint--=0;
return true;
}
#else
if ( strcasecmp( pcName, pcNameMust )==0 )
{
pcResult = _strdup( pcPar );
@@ -66,7 +54,6 @@ bool ConfigGetEntry( const char *pcFile, const char *pcNameMust, char* &pcResult
while( *pcPoint==' ' || *pcPoint=='\t' ) *pcPoint--=0;
return true;
}
#endif
} while ( !feof( fh ) );
-11
View File
@@ -1,8 +1,3 @@
#ifdef _WIN32
#include <conio.h>
#include <windows.h>
#include <cstdio>
#endif
#include <cstdio>
#include <cstdarg>
#include <cstring>
@@ -38,12 +33,6 @@ static int __FOREGROUND = LIGHTGRAY;
// Change console text color
void textcolor(int color)
{
#ifdef _WIN32
__FOREGROUND = color;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color + (__BACKGROUND << 4));
#else
#endif
}
// This function logs based on flags
+1 -7
View File
@@ -6,13 +6,7 @@
#define __ROSE_LOGGING_FUNCTIONS__
// Log path
#ifdef _WIN32
# define LOG_DIRECTORY "log/"
#endif
#ifdef __unix__
# define LOG_DIRECTORY "/var/log/roseserver/"
#endif
#define LOG_DIRECTORY "/var/log/roseserver/"
#define LOG_LOGIN_SERVER 0x01
#define LOG_CHARACTER_SERVER 0x02
-739
View File
@@ -1,739 +0,0 @@
/* Copyright (C) 2000-2003 MySQL AB
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _mysql_h
#define _mysql_h
#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _global_h /* If not standard header */
#include <sys/types.h>
#ifdef __LCC__
#include <winsock.h> /* For windows */
#endif
typedef char my_bool;
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
#define __WIN__
#endif
#if !defined(__WIN__)
#define STDCALL
#else
#define STDCALL __stdcall
#endif
typedef char * gptr;
#ifndef my_socket_defined
#ifdef __WIN__
#define my_socket SOCKET
#else
typedef int my_socket;
#endif /* __WIN__ */
#endif /* my_socket_defined */
#endif /* _global_h */
#include "mysql_com.h"
#include "mysql_time.h"
#include "mysql_version.h"
#include "typelib.h"
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
extern unsigned int mysql_port;
extern char *mysql_unix_port;
#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */
#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */
#ifdef __NETWARE__
#pragma pack(push, 8) /* 8 byte alignment */
#endif
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG)
#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
typedef struct st_mysql_field {
char *name; /* Name of column */
char *org_name; /* Original column name, if an alias */
char *table; /* Table of column if column was a field */
char *org_table; /* Org table name, if table was an alias */
char *db; /* Database for table */
char *catalog; /* Catalog for table */
char *def; /* Default value (set by mysql_list_fields) */
unsigned long length; /* Width of column (create length) */
unsigned long max_length; /* Max width for selected set */
unsigned int name_length;
unsigned int org_name_length;
unsigned int table_length;
unsigned int org_table_length;
unsigned int db_length;
unsigned int catalog_length;
unsigned int def_length;
unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */
unsigned int charsetnr; /* Character set */
enum enum_field_types type; /* Type of field. See mysql_com.h for types */
} MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
#ifndef _global_h
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif defined (__WIN__)
typedef unsigned __int64 my_ulonglong;
#else
typedef unsigned long long my_ulonglong;
#endif
#endif
#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
typedef struct st_mysql_rows {
struct st_mysql_rows *next; /* list of rows */
MYSQL_ROW data;
unsigned long length;
} MYSQL_ROWS;
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
#include "my_alloc.h"
typedef struct st_mysql_data {
my_ulonglong rows;
unsigned int fields;
MYSQL_ROWS *data;
MEM_ROOT alloc;
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
MYSQL_ROWS **prev_ptr;
#endif
} MYSQL_DATA;
enum mysql_option
{
MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH
};
struct st_mysql_options {
unsigned int connect_timeout, read_timeout, write_timeout;
unsigned int port, protocol;
unsigned long client_flag;
char *host,*user,*password,*unix_socket,*db;
struct st_dynamic_array *init_commands;
char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
char *ssl_key; /* PEM key file */
char *ssl_cert; /* PEM cert file */
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */
char *shared_memory_base_name;
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe;
/*
On connect, find out the replication role of the server, and
establish connections to all the peers
*/
my_bool rpl_probe;
/*
Each call to mysql_real_query() will parse it to tell if it is a read
or a write, and direct it to the slave or the master
*/
my_bool rpl_parse;
/*
If set, never read from a master, only from slave, when doing
a read that is replication-aware
*/
my_bool no_master_reads;
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
my_bool separate_thread;
#endif
enum mysql_option methods_to_use;
char *client_ip;
/* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
my_bool secure_auth;
/* function pointers for local infile support */
int (*local_infile_init)(void **, const char *, void *);
int (*local_infile_read)(void *, char *, unsigned int);
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
void *local_infile_userdata;
};
enum mysql_status
{
MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT
};
enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
/*
There are three types of queries - the ones that have to go to
the master, the ones that go to a slave, and the adminstrative
type which must happen on the pivot connectioin
*/
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
struct st_mysql_methods;
typedef struct st_mysql
{
NET net; /* Communication parameters */
gptr connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
char *db;
struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
unsigned long client_flag,server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
unsigned int warning_count;
struct st_mysql_options options;
enum mysql_status status;
my_bool free_me; /* If free in mysql_close */
my_bool reconnect; /* set to 1 if automatic reconnect */
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1];
/*
Set if this is the original connection, not a master or a slave we have
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
/*
Pointers to the master, and the next slave connections, points to
itself if lone connection.
*/
struct st_mysql* master, *next_slave;
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
/* needed for send/read/store/use result to work correctly with replication */
struct st_mysql* last_used_con;
LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods;
void *thd;
/*
Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag
from mysql_stmt_close if close had to cancel result set of this object.
*/
my_bool *unbuffered_fetch_owner;
} MYSQL;
typedef struct st_mysql_res {
my_ulonglong row_count;
MYSQL_FIELD *fields;
MYSQL_DATA *data;
MYSQL_ROWS *data_cursor;
unsigned long *lengths; /* column lengths of current row */
MYSQL *handle; /* for unbuffered reads */
MEM_ROOT field_alloc;
unsigned int field_count, current_field;
MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */
my_bool eof; /* Used by mysql_fetch_row */
/* mysql_stmt_close() had to cancel this result */
my_bool unbuffered_fetch_cancelled;
const struct st_mysql_methods *methods;
} MYSQL_RES;
#define MAX_MYSQL_MANAGER_ERR 256
#define MAX_MYSQL_MANAGER_MSG 256
#define MANAGER_OK 200
#define MANAGER_INFO 250
#define MANAGER_ACCESS 401
#define MANAGER_CLIENT_ERR 450
#define MANAGER_INTERNAL_ERR 500
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT
#endif
typedef struct st_mysql_manager
{
NET net;
char *host,*user,*passwd;
unsigned int port;
my_bool free_me;
my_bool eof;
int cmd_status;
int last_errno;
char* net_buf,*net_buf_pos,*net_data_end;
int net_buf_size;
char last_error[MAX_MYSQL_MANAGER_ERR];
} MYSQL_MANAGER;
typedef struct st_mysql_parameters
{
unsigned long *p_max_allowed_packet;
unsigned long *p_net_buffer_length;
} MYSQL_PARAMETERS;
#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
#endif
/*
Set up and bring down the server; to ensure that applications will
work when linked against either the standard client library or the
embedded server library, these functions should be called.
*/
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void);
/*
mysql_server_init/end need to be called when using libmysqld or
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
you don't need to call it explicitely; but you need to call
mysql_server_end() to free memory). The names are a bit misleading
(mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
names which suit well whether you're using libmysqld or libmysqlclient. We
intend to promote these aliases over the mysql_server* ones.
*/
#define mysql_library_init mysql_server_init
#define mysql_library_end mysql_server_end
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
/*
Set up and bring down a thread; these function should be called
for each thread in an application which opens at least one MySQL
connection. All uses of the connection(s) should be between these
function calls.
*/
my_bool STDCALL mysql_thread_init(void);
void STDCALL mysql_thread_end(void);
/*
Functions to get information from the MYSQL and MYSQL_RES structures
Should definitely be used if one uses shared libraries.
*/
my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
my_bool STDCALL mysql_eof(MYSQL_RES *res);
MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
unsigned int fieldnr);
MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
unsigned int STDCALL mysql_field_count(MYSQL *mysql);
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
unsigned int STDCALL mysql_errno(MYSQL *mysql);
const char * STDCALL mysql_error(MYSQL *mysql);
const char *STDCALL mysql_sqlstate(MYSQL *mysql);
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char * STDCALL mysql_info(MYSQL *mysql);
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
const char * STDCALL mysql_character_set_name(MYSQL *mysql);
int STDCALL mysql_set_character_set(MYSQL *mysql, char *csname);
MYSQL * STDCALL mysql_init(MYSQL *mysql);
my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db);
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
const char *user,
const char *passwd,
const char *db,
unsigned int port,
const char *unix_socket,
unsigned long clientflag);
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
int STDCALL mysql_query(MYSQL *mysql, const char *q);
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
unsigned long length);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length);
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
/* perform query on master */
my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length);
/* perform query on slave */
my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
/* local infile support */
#define LOCAL_INFILE_ERROR_LEN 512
void
mysql_set_local_infile_handler(MYSQL *mysql,
int (*local_infile_init)(void **, const char *,
void *),
int (*local_infile_read)(void *, char *,
unsigned int),
void (*local_infile_end)(void *),
int (*local_infile_error)(void *, char*,
unsigned int),
void *);
void
mysql_set_local_infile_default(MYSQL *mysql);
/*
enable/disable parsing of all queries to decide if they go on master or
slave
*/
void STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
void STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
/* get the value of the parse flag */
int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
/* enable/disable reads from master */
void STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
void STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
/* get the value of the master read flag */
my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len);
/* discover the master and its slaves */
my_bool STDCALL mysql_rpl_probe(MYSQL* mysql);
/* set the master, close/free the old one, if it is not a pivot */
int STDCALL mysql_set_master(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level
shutdown_level);
int STDCALL mysql_dump_debug_info(MYSQL *mysql);
int STDCALL mysql_refresh(MYSQL *mysql,
unsigned int refresh_options);
int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
int STDCALL mysql_set_server_option(MYSQL *mysql,
enum enum_mysql_set_option
option);
int STDCALL mysql_ping(MYSQL *mysql);
const char * STDCALL mysql_stat(MYSQL *mysql);
const char * STDCALL mysql_get_server_info(MYSQL *mysql);
const char * STDCALL mysql_get_client_info(void);
unsigned long STDCALL mysql_get_client_version(void);
const char * STDCALL mysql_get_host_info(MYSQL *mysql);
unsigned long STDCALL mysql_get_server_version(MYSQL *mysql);
unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
const char *arg);
void STDCALL mysql_free_result(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result,
my_ulonglong offset);
MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result,
MYSQL_ROW_OFFSET offset);
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_FIELD_OFFSET offset);
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
const char *wild);
unsigned long STDCALL mysql_escape_string(char *to,const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_hex_string(char *to,const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
char *to,const char *from,
unsigned long length);
void STDCALL mysql_debug(const char *debug);
char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
char *to,
unsigned long to_length,
const char *from,
unsigned long from_length,
void *param,
char *
(*extend_buffer)
(void *, char *to,
unsigned long *length));
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void);
my_bool STDCALL mysql_embedded(void);
MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con);
MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
const char* host,
const char* user,
const char* passwd,
unsigned int port);
void STDCALL mysql_manager_close(MYSQL_MANAGER* con);
int STDCALL mysql_manager_command(MYSQL_MANAGER* con,
const char* cmd, int cmd_len);
int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
char* res_buf,
int res_buf_size);
my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
/*
The following definitions are added for the enhanced
client-server protocol
*/
/* statement state */
enum enum_mysql_stmt_state
{
MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE,
MYSQL_STMT_FETCH_DONE
};
/* bind structure */
typedef struct st_mysql_bind
{
unsigned long *length; /* output length pointer */
my_bool *is_null; /* Pointer to null indicator */
void *buffer; /* buffer to get/put data */
enum enum_field_types buffer_type; /* buffer type */
unsigned long buffer_length; /* buffer length, must be set for str/binary */
/* Following are for internal use. Set by mysql_stmt_bind_param */
unsigned char *inter_buffer; /* for the current data position */
unsigned long offset; /* offset position for char/binary fetch */
unsigned long internal_length; /* Used if length is 0 */
unsigned int param_number; /* For null count and error messages */
unsigned int pack_length; /* Internal length for packed data */
my_bool is_unsigned; /* set if integer type is unsigned */
my_bool long_data_used; /* If used with mysql_send_long_data */
my_bool internal_is_null; /* Used if is_null is 0 */
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
void (*fetch_result)(struct st_mysql_bind *, unsigned char **row);
void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
unsigned char **row);
} MYSQL_BIND;
/* statement handler */
typedef struct st_mysql_stmt
{
MEM_ROOT mem_root; /* root allocations */
LIST list; /* list to keep track of all stmts */
MYSQL *mysql; /* connection handle */
MYSQL_BIND *params; /* input parameters */
MYSQL_BIND *bind; /* output parameters */
MYSQL_FIELD *fields; /* result set metadata */
MYSQL_DATA result; /* cached result set */
MYSQL_ROWS *data_cursor; /* current row in cached result */
/* copy of mysql->affected_rows after statement execution */
my_ulonglong affected_rows;
my_ulonglong insert_id; /* copy of mysql->insert_id */
/*
mysql_stmt_fetch() calls this function to fetch one row (it's different
for buffered, unbuffered and cursor fetch).
*/
int (*read_row_func)(struct st_mysql_stmt *stmt,
unsigned char **row);
unsigned long stmt_id; /* Id for prepared statement */
unsigned int last_errno; /* error code */
unsigned int param_count; /* input parameter count */
unsigned int field_count; /* number of columns in result set */
enum enum_mysql_stmt_state state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
char sqlstate[SQLSTATE_LENGTH+1];
/* Types of input parameters should be sent to server */
my_bool send_types_to_server;
my_bool bind_param_done; /* input buffers were supplied */
my_bool bind_result_done; /* output buffers were supplied */
/* mysql_stmt_close() had to cancel this result */
my_bool unbuffered_fetch_cancelled;
/*
Is set to true if we need to calculate field->max_length for
metadata fields when doing mysql_stmt_store_result.
*/
my_bool update_max_length;
} MYSQL_STMT;
enum enum_stmt_attr_type
{
/*
When doing mysql_stmt_store_result calculate max_length attribute
of statement metadata. This is to be consistent with the old API,
where this was done automatically.
In the new API we do that only by request because it slows down
mysql_stmt_store_result sufficiently.
*/
STMT_ATTR_UPDATE_MAX_LENGTH
};
typedef struct st_mysql_methods
{
my_bool (*read_query_result)(MYSQL *mysql);
my_bool (*advanced_command)(MYSQL *mysql,
enum enum_server_command command,
const char *header,
unsigned long header_length,
const char *arg,
unsigned long arg_length,
my_bool skip_check);
MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
unsigned int fields);
MYSQL_RES * (*use_result)(MYSQL *mysql);
void (*fetch_lengths)(unsigned long *to,
MYSQL_ROW column, unsigned int field_count);
void (*flush_use_result)(MYSQL *mysql);
#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
int (*stmt_execute)(MYSQL_STMT *stmt);
int (*read_binary_rows)(MYSQL_STMT *stmt);
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
void (*free_embedded_thd)(MYSQL *mysql);
const char *(*read_statistics)(MYSQL *mysql);
my_bool (*next_result)(MYSQL *mysql);
int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
#endif
} MYSQL_METHODS;
MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
unsigned long length);
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
unsigned int column,
unsigned long offset);
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt);
my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt,
enum enum_stmt_attr_type attr_type,
const void *attr);
my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
enum enum_stmt_attr_type attr_type,
void *attr);
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt,
unsigned int param_number,
const char *data,
unsigned long length);
MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt,
MYSQL_ROW_OFFSET offset);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
my_bool STDCALL mysql_commit(MYSQL * mysql);
my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
my_bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql);
void STDCALL mysql_close(MYSQL *sock);
/* status return codes */
#define MYSQL_NO_DATA 100
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#ifdef USE_OLD_FUNCTIONS
MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd);
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#endif
#define HAVE_MYSQL_REAL_CONNECT
/*
The following functions are mainly exported because of mysqlbinlog;
They are not for general usage
*/
#define simple_command(mysql, command, arg, length, skip_check) \
(*(mysql)->methods->advanced_command)(mysql, command, \
NullS, 0, arg, length, skip_check)
unsigned long net_safe_read(MYSQL* mysql);
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
#endif
#ifdef __cplusplus
}
#endif
#endif /* _mysql_h */
-29
View File
@@ -1,29 +0,0 @@
//#include <cstring>
#include "seh.hpp"
#ifdef __WIN32__
EXCEPTION_DISPOSITION __SEH_HANDLER::ExceptionRouter(PEXCEPTION_RECORD pRecord,
__SEH_EXCEPTION_REGISTRATION* pReg,
PCONTEXT pContext,
PEXCEPTION_RECORD pRecord2)
{
return pReg->exthandler->ExceptionHandler(pRecord, pReg, pContext, pRecord2);
}
EXCEPTION_DISPOSITION __SEH_HANDLER::ExceptionHandler(PEXCEPTION_RECORD pRecord,
__SEH_EXCEPTION_REGISTRATION* pReg,
PCONTEXT pContext,
PEXCEPTION_RECORD pRecord2)
{
/*std::memcpy(&excContext, pContext, sizeof(_CONTEXT));
std::memcpy(&excRecord, pRecord, sizeof(_EXCEPTION_RECORD));*/
memcpy(&excContext, pContext, sizeof(_CONTEXT));
memcpy(&excRecord, pRecord, sizeof(_EXCEPTION_RECORD));
longjmp(context, 1);
}
#endif
-96
View File
@@ -1,96 +0,0 @@
#ifndef __FV_SEH_H__
#define __FV_SEH_H__
#ifdef __WIN32__
#include <windows.h>
#include <excpt.h>
#endif
#include <setjmp.h>
//#include <fv/defs.hpp>
//NAMESPACE_BEGIN(PU)
//NAMESPACE_BEGIN(SEH)
#ifdef __WIN32__
class __SEH_HANDLER;
typedef struct tag__SEH_EXCEPTION_REGISTRATION
{
tag__SEH_EXCEPTION_REGISTRATION* prev;
PEXCEPTION_HANDLER handler;
__SEH_HANDLER* exthandler;
} __SEH_EXCEPTION_REGISTRATION;
class __SEH_HANDLER
{
public:
__SEH_HANDLER() { }
static EXCEPTION_DISPOSITION ExceptionRouter(PEXCEPTION_RECORD pRecord,
__SEH_EXCEPTION_REGISTRATION* pReg,
PCONTEXT pContext,
PEXCEPTION_RECORD pRecord2);
virtual EXCEPTION_DISPOSITION ExceptionHandler(PEXCEPTION_RECORD pRecord,
__SEH_EXCEPTION_REGISTRATION* pReg,
PCONTEXT pContext,
PEXCEPTION_RECORD pRecord2);
jmp_buf context;
EXCEPTION_RECORD excRecord;
CONTEXT excContext;
};
#define __seh_try \
{ \
__SEH_EXCEPTION_REGISTRATION _lseh_er; \
__SEH_HANDLER _lseh_handler; \
\
_lseh_er.handler = \
reinterpret_cast<PEXCEPTION_HANDLER>(__SEH_HANDLER::ExceptionRouter); \
_lseh_er.exthandler = &_lseh_handler; \
asm volatile ("movl %%fs:0, %0" : "=r" (_lseh_er.prev)); \
asm volatile ("movl %0, %%fs:0" : : "r" (&_lseh_er)); \
int _lseh_setjmp_res = setjmp(_lseh_handler.context); \
while(true) { \
if(_lseh_setjmp_res != 0) { \
break; \
} \
#define __seh_finally \
break; \
} \
while(true) {
#define __seh_except(rec, ctx) \
break; \
} \
PEXCEPTION_RECORD rec = &_lseh_handler.excRecord; \
PCONTEXT ctx = &_lseh_handler.excContext; \
\
asm volatile ("movl %0, %%fs:0" : : "r" (_lseh_er.prev)); \
if(_lseh_setjmp_res != 0)
#define __seh_end }
#else
#define __seh_try
#define __seh_except(rec, ctx) if(false) {
#define __seh_end }
#define __seh_finally
#endif
//NAMESPACE_END(SEH)
//NAMESPACE_END(PU)
#endif
+17 -39
View File
@@ -22,33 +22,23 @@
#ifndef __ROSE_SOCKETS__
#define __ROSE_SOCKETS__
#define USEIFO
#ifdef _WIN32
#include <windows.h>
#define close closesocket
#ifdef FD_SETSIZE
#undef FD_SETSIZE
#endif
#define FD_SETSIZE 1024
#else
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <netinet/tcp.h>
#include <cstdarg>
#include <errno.h>
#define WSAGetLastError() errno
#define SOCKET int
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define PVOID void *
#define ioctlsocket ioctl
#define SOCKADDR struct sockaddr
#define closesocket close
#endif
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <netinet/tcp.h>
#include <cstdarg>
#include <errno.h>
#define WSAGetLastError() errno
#define SOCKET int
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define PVOID void *
#define ioctlsocket ioctl
#define SOCKADDR struct sockaddr
#define closesocket close
#include "mysql.h"
#include <cstdio>
@@ -63,7 +53,6 @@
#include <math.h>
#include <cmath>
#ifndef _WIN32
// The entire codebase was written against Windows' clock(), which returns a
// monotonic MILLISECOND counter (CLOCKS_PER_SEC == 1000) that closely tracks
// wall-clock time for a normal single-threaded process. POSIX clock() is
@@ -84,7 +73,6 @@ static inline long __rose_portable_clock()
#undef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC 1000
#define clock() __rose_portable_clock()
#endif
#include <map>
#include "pthread.h"
#include <vector>
@@ -93,9 +81,6 @@ static inline long __rose_portable_clock()
#include "rosecrypt.hpp"
#include "config.h"
#include "database/database.h"
#ifdef _WIN32
#pragma comment(lib, "Ws2_32.lib")
#endif
// Just some defs for easier use
typedef char SBYTE;
typedef unsigned char BYTE;
@@ -105,18 +90,11 @@ typedef int SDWORD;
typedef unsigned int DWORD;
typedef long long SQWORD;
typedef unsigned long long QWORD;
#ifdef _WIN32
typedef unsigned __int8 byte;
typedef unsigned __int16 word;
typedef unsigned __int32 dword;
typedef unsigned __int64 qword;
#else
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;
typedef unsigned long long qword;
typedef unsigned int UINT;
#endif
typedef char* strings;
using std::cout;
using std::endl;
+1 -6
View File
@@ -58,12 +58,7 @@ bool CLoginServer::pakUserLogin( CLoginClient* thisclient, CPacket* P )
if( mysql_num_rows( result ) == 1 )
{
row = mysql_fetch_row(result);
int res = 0;
#ifdef _WIN32
res = _stricmp( row[1], thisclient->password.c_str() );
#else
res = strcasecmp( row[1], thisclient->password.c_str() );
#endif
int res = strcasecmp( row[1], thisclient->password.c_str() );
if ( res == 0 )
{
if(atoi(row[3])==1)
-3
View File
@@ -50,9 +50,6 @@ int main(int argc, char *argv[])
else
{
delete server;
#ifdef _WIN32
system("pause");
#endif
return -1;
}
server->LoadEncryption ();
-24
View File
@@ -38,9 +38,6 @@ void StartSignal( )
signal( SIGFPE, HandleSignal );
signal( SIGSEGV, HandleSignal );
signal( SIGTERM, HandleSignal );
#ifdef _WIN32
signal( SIGBREAK, HandleSignal );
#endif
signal( SIGABRT, HandleSignal );
}
@@ -51,9 +48,6 @@ void StopSignal( )
signal( SIGFPE, 0 );
signal( SIGSEGV, 0 );
signal( SIGTERM, 0 );
#ifdef _WIN32
signal( SIGBREAK, 0 );
#endif
signal( SIGABRT, 0 );
}
@@ -63,21 +57,13 @@ void HandleSignal( int num )
{
case SIGINT:/* Interactive attention */
Log( MSG_ERROR, "Signal received: SIGINT" );
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
raise(num);
break;
case SIGILL:/* Illegal instruction */
Log( MSG_ERROR, "Signal received: SIGILL, Server will be closed, Trying to save..." );
GServer->isActive = false;
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
raise(num);
break;
case SIGFPE:/* Floating point error */
@@ -88,11 +74,7 @@ void HandleSignal( int num )
case SIGSEGV:/* Segmentation violation */
Log( MSG_ERROR, "Signal received: SIGSEGV, Server will be closed, Trying to save..." );
GServer->isActive = false;
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
raise(num);
break;
@@ -100,12 +82,6 @@ void HandleSignal( int num )
Log( MSG_INFO, "Signal received: SIGTERM, Server will be closed" );
GServer->isActive = false;
break;
#ifdef _WIN32
case SIGBREAK:/* Control-break */
Log( MSG_INFO, "Signal received: SIGBREAK, Server will be closed" );
GServer->isActive = false;
break;
#endif
default:
cout << "Unknown Signal Number: " << num << endl;
raise(num);
-847
View File
@@ -1,847 +0,0 @@
/*
Rose Online Server Emulator
Copyright (C) 2006,2007 OSRose Team http://www.osrose.net
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 the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
depeloped with Main erose/hrose source server + some change from the original eich source
*/
#include "character.h"
#include "worldserver.h"
void CCharacter::DoAttack( )
{
//if(Status->Sleep <= 0xff)
//{
// ClearBattle( Battle );
// return; // can't take any action while we are asleep can we?
//}
//Log(MSG_INFO,"skill type %i selected. Chartype = %i",Battle->atktype, CharType);
if(Battle->iscasting == 1)
{
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL)
{
ClearBattle( Battle );
return;
}
//Log(MSG_DEBUG,"Iscasting detected as true. Reset to false.");
if(CanAttack())
{
if(IsPlayer())
{
Log(MSG_DEBUG,"Should reach here once on normal attack. iscasting state = %i",Battle->iscasting);
}
ClearBattle( Battle );
StartAction(Enemy, NORMAL_ATTACK, 0);
return;
}
else
{
return;
}
}
if(!CanAttack())
{
return;
}
if(IsSummon())
{
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL || (Battle->atktype != SKILL_AOE && Battle->atktype != BUFF_AOE))
{
//Log(MSG_DEBUG,"No Enemy found");
ClearBattle( Battle );
return;
}
if(this == Enemy) //summoned monster is attacking itself. It has been observed to happen
{
//Log(MSG_INFO,"Clearing Battle for this summon");
ClearBattle( Battle );
return;
}
if(Enemy->IsSummon())
{
CMonster* thisMonster = reinterpret_cast<CMonster*>(this);
if(thisMonster == NULL)
{
ClearBattle( Battle );
return;
}
CMonster* otherMonster = reinterpret_cast<CMonster*>(Enemy);
if(otherMonster == NULL)
{
ClearBattle( Battle );
return;
}
if(thisMonster->owner == otherMonster->owner)
{
//Log(MSG_INFO,"Clearing Battle for this summon");
ClearBattle( Battle );
return;
}
}
}
CMap* map = GServer->MapList.Index[Position->Map];
//Log(MSG_INFO,"DoAttack Battle Attack type = %i",Battle->atktype);
switch(Battle->atktype)
{
case NORMAL_ATTACK://normal attack
{
//if(!Status->CanAttack)
// return; //can't attack right now.
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL)
{
ClearBattle( Battle );
return;
}
if(Enemy == this)
{
//Log(MSG_INFO,"WTF?? I AM trying to attack myself");
ClearBattle( Battle );
}
if(IsTargetReached( Enemy ))
{
//if(IsMonster())
// Log(MSG_INFO,"Monster is trying to hit the player");
NormalAttack( Enemy );
if (Enemy->IsMonster()) // do monster AI script when monster is attacked.
{
CMonster* monster = GServer->GetMonsterByID(Enemy->clientid, Enemy->Position->Map);
if(monster == NULL)return;
//monster->DoAi(monster->thisnpc->AI, 3);
monster->DoAi(monster->monAI, 3);
}
}
}
break;
case SKILL_ATTACK://skill attack
{
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL)
{
ClearBattle( Battle );
return;
}
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//ClearBattle( Battle );
return;
}
if(IsTargetReached( Enemy, skill ))
{
SkillAttack( Enemy, skill );
if (Enemy->IsMonster())
{
CMonster* monster = GServer->GetMonsterByID(Enemy->clientid, Enemy->Position->Map);
if(monster == NULL)return;
monster->DoAi(monster->monAI, 3);
}
}
}
break;
case SKILL_BUFF://buffs
{
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL)
{
//Log(MSG_DEBUG,"this target is NULL");
ClearBattle( Battle );
return;
}
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//Log(MSG_DEBUG,"this skill is NULL");
return;
}
if(IsTargetReached( Enemy, skill ))
{
//Log(MSG_DEBUG,"Skill successfully cast");
BuffSkill( Enemy, skill );
}
}
break;
case SKILL_AOE:
//case SKILL_SELF: //this is impossible. it can never be set
case AOE_TARGET:
{
//Log(MSG_DEBUG,"Called skill type %i",Battle->atktype);
CCharacter* Enemy = NULL;
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
ClearBattle( Battle );
return;
}
if(Battle->atktype == AOE_TARGET)
{
float distance = GServer->distance( Position->current, Position->destiny );
if(distance <= skill->range)
{
Position->destiny = Position->current;
AoeSkill( skill, Enemy );
}
}
else
{
Position->skilltargetpos = Position->current;
AoeSkill( skill, NULL );
}
}
break;
case BUFF_SELF:
{
// return; // can't cast skills right now
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//ClearBattle( Battle );
return;
}
BuffSkill( this, skill );
}
break;
case BUFF_AOE:
{
//Log(MSG_INFO,"BUFF AOE selected");
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//ClearBattle( Battle );
return;
}
AoeBuff( skill );
}
break;
default:
return;
break;
}
}
// do normal attack
void CCharacter::NormalAttack( CCharacter* Enemy )
{
Enemy->OnBeAttacked( this );
Position->destiny = Position->current;
// PY code
float mod = 0;
if(IsPlayer())
{
mod = 23 + (Stats->Level / 1.5);
}
else
{
mod = 23 + (Stats->Level / 4);
}
float attack = 0;
if(Stats->magicattack == 1)
{
attack = (float) Stats->Attack_Power / Enemy->Stats->Magic_Defense;
attack *= mod;
}
else
{
attack = (float) Stats->Attack_Power / Enemy->Stats->Defense;
attack *= mod;
}
//PY end
if(attack < 5) attack = 5;
float d_attack = attack / 100;
mod = GServer->RandNumber( 0, 10 ) * d_attack;
attack += mod;
long int hitpower = (long int)floor(attack + GServer->RandNumber(0, 10));
if(IsPlayer( )) //temp fix to find balance btw monster and player
{
hitpower = (long int)floor(attack * (GServer->Config.PlayerDmg/100.00));
hitpower+=((hitpower*(Stats->ExtraDamage))/100);
}
if(IsMonster( )) //temp fix to find balance btw monster and player
hitpower = (long int)floor(attack * (GServer->Config.MonsterDmg/100.00));
bool critical = false;
if(hitpower <= 5)
{
hitpower = 5;
}
else
{
if(GServer->RandNumber(0,300)<Stats->Critical)
{
hitpower = (long int)floor(hitpower * 1.5);
critical = true;
}
}
// dodge
unsigned int hitvalue = (unsigned int)floor((double)(Stats->Accury * 100 / Enemy->Stats->Dodge));
if(hitvalue>100) hitvalue = 100;
if(GServer->RandNumber( 0, 100 )>hitvalue)
hitpower = 0; // dodged
if (hitpower > 0x7ff)//2047 packet size limit.
{
hitpower=0x7ff;
}
//maybe this little line here will fix my ghosty problem
//they are definitely attacking. But no animation so maybe atktarget is empty
Battle->atktarget = Battle->target;
//Well it does make the damage show up at teh client but the animation is still dodgey
if(IsMonster())
{
//Log(MSG_INFO,"Monster hits player for %i damage. Attack target = %i",hitpower,Battle->atktarget);
}
//Log( MSG_INFO, "hitpower %i. Attack %f ", hitpower,attack );
if(!Enemy->IsSummon( ) && Enemy->IsMonster( ))
{
Enemy->AddDamage( this, hitpower );
Enemy->damagecounter += hitpower;// is for AI
}
Enemy->Stats->HP -= hitpower;
if(IsPlayer())
Log(MSG_DEBUG,"Player attack did damage %i",hitpower);
if(IsMonster())
Log(MSG_DEBUG,"Monster attack did damage %i",hitpower);
BEGINPACKET( pak, 0x799 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Battle->atktarget );
if(Enemy->IsDead())
{
CDrop* thisdrop = NULL;
ADDWORD ( pak, (hitpower | ( critical?0xb000:0x8000 ) ));
if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
{
thisdrop = Enemy->GetDrop( );
if(thisdrop != NULL)
{
ADDFLOAT ( pak, thisdrop->pos.x*100 );
ADDFLOAT ( pak, thisdrop->pos.y*100 );
if(thisdrop->type == 1)
{
ADDWORD( pak, 0xccdf );
ADDDWORD( pak, thisdrop->amount );
}
else
{
ADDWORD ( pak, GServer->BuildItemHead( thisdrop->item ) );
ADDDWORD ( pak, GServer->BuildItemData( thisdrop->item ) );
}
ADDWORD ( pak, thisdrop->clientid );
ADDWORD ( pak, thisdrop->owner );
CMap* map = GServer->MapList.Index[thisdrop->posMap];
map->AddDrop( thisdrop );
}
}
GServer->SendToVisible( &pak, Enemy, thisdrop );
OnEnemyDie( Enemy );
}
else
{
ADDWORD ( pak, (hitpower|(hitpower>0?(critical?0x4000:0):0)));
GServer->SendToVisible( &pak, Enemy );
}
ReduceABC( );
Battle->lastAtkTime = clock( );
}
// do skill attack
bool CCharacter::SkillAttack( CCharacter* Enemy, CSkills* skill )
{
Position->destiny = Position->current;
//if(Battle->castTime == 0)
//{
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, this );
// Battle->castTime = clock();
// return true;
//}
//else
//{
// clock_t etime = clock() - Battle->castTime;
// if(etime < SKILL_DELAY)
// return true;
//}
//Battle->castTime = 0;
UseAtkSkill( Enemy, skill );
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0)
Stats->MP = 0;
//Battle->atktype = NORMAL_ATTACK;
//Battle->skilltarget = 0;
//Battle->atktarget = Battle->target;
//Battle->skillid = 0;
GServer->DoSkillScript( this, skill );
Battle->lastAtkTime = clock( );
if(Enemy->IsDead())
ClearBattle(Battle);
Battle->iscasting = 1;
//Log(MSG_DEBUG,"Cast a skill. Iscasting set to true");
return true;
}
// do buff skill
bool CCharacter::BuffSkill( CCharacter* Target, CSkills* skill )
{
Position->destiny = Position->current;
//if(Battle->castTime == 0)
//{
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, (CCharacter*)this );
// Battle->castTime = clock();
// return true;
//}
//else
//{
// clock_t etime = clock() - Battle->castTime;
// if(etime < SKILL_DELAY)
// return true;
//}
//Battle->castTime = 0;
//Log(MSG_DEBUG,"applied buff skill %i",skill->id);
UseBuffSkill( Target, skill );
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0) Stats->MP = 0;
GServer->DoSkillScript( this, skill ); //summons a monster. Why do we do this for all skills?
if(!IsMonster())
{
ClearBattle( Battle ); // clear battle for players when they use buff skills
//Battle->bufftarget = 0;
//Battle->skilltarget = 0;
//Battle->skillid = 0;
//Battle->atktype = NORMAL_ATTACK;
}
else //Monsters need to be reset to normal attack and clear skill attacks.
{
//Battle->atktarget = Battle->target;
//Battle->bufftarget = 0;
//Battle->skilltarget = 0;
//Battle->skillid = 0;
//Battle->atktype = NORMAL_ATTACK;
//StartAction(Target, NORMAL_ATTACK);
}
Battle->lastAtkTime = clock( );
Battle->iscasting = 1;
return true;
}
//arnold
// do AoE skill
bool CCharacter::AoeSkill( CSkills* skill, CCharacter* Enemy )
{
Position->destiny = Position->current;
//Log(MSG_INFO,"Doing AOE Skill");
//if(Battle->castTime == 0)
//{
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, (CCharacter*)this );
// Battle->castTime = clock();
// return true;
//}
//else
//{
// clock_t etime = clock() - Battle->castTime;
// if(etime < SKILL_DELAY)
// return true;
//}
//Battle->castTime = 0;
CMap* map = GServer->MapList.Index[Position->Map];
//PY replacement code
if(IsPlayer() || IsSummon())
{
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
if(monster == NULL) continue;
if(monster->clientid == clientid) continue;
if(monster->IsSummon( ) && (map->allowpvp == 0 || monster->owner == clientid)) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos, monster->Position->current,(float)skill->aoeradius + 1))
UseAtkSkill( (CCharacter*) monster, skill );
}
}
if(IsMonster() && !IsSummon())
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
if(player == NULL)continue;
if(player->clientid == clientid) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos,player->Position->current,(float)skill->aoeradius+1))
UseAtkSkill( (CCharacter*) player, skill );
}
}
//PY end
// this code appears to me to be completely wrong replaced with code above
/*
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
if(monster->clientid == clientid) continue;
if(IsSummon( ) || IsPlayer( ))
{
if(monster->IsSummon( ) && (map->allowpvp==0 || monster->owner == clientid)) continue;
}
else
{
if(!monster->IsSummon( )) continue;
}
if(GServer->IsMonInCircle( Position->skilltargetpos, monster->Position->current,(float)skill->aoeradius + 1))
UseAtkSkill( (CCharacter*) monster, skill );
}
if(map->allowpvp!=0 || (IsMonster( ) && !IsSummon( )))
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
if(player->clientid==clientid) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos,player->Position->current,(float)skill->aoeradius+1))
UseAtkSkill( (CCharacter*) player, skill );
}
}*/
Battle->iscasting = 1;
//Log(MSG_DEBUG,"Cast a skill. Iscasting set to true");
if(Enemy != NULL)
{
if(Enemy->IsDead( ))
ClearBattle( Battle );
}
else
ClearBattle( Battle );
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0) Stats->MP = 0;
Battle->lastAtkTime = clock( );
return true;
}
bool CCharacter::AoeBuff( CSkills* skill )
{
//Log(MSG_INFO,"BUFF AOE called");
Position->destiny = Position->current;
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, (CCharacter*)this );
CMap* map = GServer->MapList.Index[Position->Map];
if(CharType != 2) //player || Summon || NPC. Anything that is not a monster
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
if(player == NULL)continue;
switch(skill->target)
{
case 1: //tPartyMember
if(player->Party->party == GetParty())
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough party member");
if (player == this) //it is me so I had better cast it anyway ^-^
{
UseBuffSkill( (CCharacter*)player, skill );
}
else if(player->Party->party != NULL) // Don't cast the skill on players who are not in any party at all.
{
if(GServer->IsMonInCircle( Position->current,player->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)player, skill );
}
}
break;
case 2: //tClanMember
if (player->Clan == GetClan( ) && (player->Clan != 0 || player == this))
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough clan member");
if(GServer->IsMonInCircle( Position->current, player->Position->current, (float)skill->aoeradius + 1 ) )
UseBuffSkill( (CCharacter*)player, skill );
}
break;
case 3: //tAlly
case 7: //tAllCharacters
case 8: //tAllMembers. all characters
{
Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough allied Player");
if(GServer->IsMonInCircle( Position->current,player->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)player, skill );
}
break;
case 5: //tHostileCharacter
{
if (CharType == 2)
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough hostile Player");
if(GServer->IsMonInCircle( Position->current,player->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)player, skill );
}
}
break;
}
}
}
else if (CharType == 2) //monster
{
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
if(monster == NULL)continue;
switch(skill->target)
{
case tPartyMember: // party
break;
case 2: //tClanMember
break;
case 3: //tAlly
case 7: //tAllCharacters
case 8: //tAllMembers. all characters
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough monster");
if(GServer->IsMonInCircle( Position->current,monster->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)monster, skill );
}
break;
case tHostileCharacter:
break;
}
}
}
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0) Stats->MP = 0;
//Battle->atktarget = Battle->target;
//Battle->bufftarget = 0;
//Battle->skilltarget = 0;
//Battle->skillid = 0;
//Battle->atktype = NORMAL_ATTACK;
ClearBattle( Battle );
Battle->lastAtkTime = clock( );
Battle->iscasting = 1;
return true;
}
// use skill attack
void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill, bool deBuff)
{
long int skillpower = skill->atkpower;
UINT weapontype = 0;
float mod = 0;
float attack = 0;
if(IsPlayer())
{
mod = 20 + (Stats->Level / 2);
}
else
{
mod = 15 + (Stats->Level / 2);
}
if(skill->skilltype == 6 || skill->skilltype == 7) //magical damage
{
attack = skillpower / (Enemy->Stats->Magic_Defense / 2);
}
else
{
attack = skillpower / (Enemy->Stats->Defense / 2);
}
attack *= mod;
attack += (Stats->Attack_Power / 2); // let's add our AP to the skillpower to make it worthwhile to cast skills.
skillpower = (int)attack;
bool bflag = false;
Enemy->OnBeAttacked( this );
if(skillpower <= 0) skillpower = 0;
if(IsPlayer())
{
skillpower += (int)(skillpower * (Stats->ExtraDamage))/100;
}
if (skill->atkpower == 0)
{
skillpower = 0; // If the skill has a 0 atk power, it isn't meant to damage
Log( MSG_INFO, "This skill does no damage" );
//ClearBattle( Battle );
return; // probably need to add some alternative code here for legitimate skills that have no attack power.
}
if(skillpower >2046)skillpower = 2046;
//Log(MSG_DEBUG,"Cast a skill. damage is %i",skillpower);
if(!Enemy->IsSummon( ) && Enemy->IsMonster( ))
{
Enemy->AddDamage( this, skillpower );
Enemy->damagecounter += skillpower;// is for AI
}
Enemy->Stats->HP -= skillpower;
if(IsPlayer())
Log(MSG_DEBUG,"Player Spell did damage %i",skillpower);
if(IsMonster())
Log(MSG_DEBUG,"Monster spell did damage %i",skillpower);
BEGINPACKET( pak, 0x7b6 );
ADDWORD ( pak, Enemy->clientid );
ADDWORD ( pak, clientid );
ADDDWORD ( pak, 0x000007f8 );
ADDBYTE ( pak, 0x00 );
if (Enemy->Stats->HP<1)
{
ADDWORD ( pak, skillpower + 0x8000 );
}
else
{
ADDWORD ( pak, skillpower + 0x2000 );
}
if(Enemy->IsDead())
{
//Log(MSG_DEBUG,"Enemy died");
CDrop* thisdrop = NULL;
ADDDWORD ( pak, 16 );
if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
{
thisdrop = Enemy->GetDrop( );
if(thisdrop != NULL)
{
ADDFLOAT ( pak, thisdrop->pos.x*100 );
ADDFLOAT ( pak, thisdrop->pos.y*100 );
if(thisdrop->type==1)
{
ADDWORD( pak, 0xccdf );
ADDDWORD( pak, thisdrop->amount );
}
else
{
ADDWORD ( pak, GServer->BuildItemHead( thisdrop->item ) );
ADDDWORD ( pak, GServer->BuildItemData( thisdrop->item ) );
}
ADDWORD ( pak, thisdrop->clientid );
ADDWORD ( pak, thisdrop->owner );
CMap* map = GServer->MapList.Index[thisdrop->posMap];
map->AddDrop( thisdrop );
}
}
GServer->SendToVisible( &pak, Enemy, thisdrop );
OnEnemyDie( Enemy );
}
else
{
ADDDWORD ( pak, 4 );
GServer->SendToVisible( &pak, Enemy );
bflag = GServer->AddBuffs( skill, Enemy, GetInt( ) );
//Send (de)buff information to the whole world
if(skill->nbuffs > 0 && bflag)
{
BEGINPACKET( pak, 0x7b5 );
ADDWORD ( pak, Battle->skilltarget );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Battle->skillid );
ADDWORD ( pak, GetInt( ) );
ADDBYTE ( pak, skill->nbuffs );
GServer->SendToVisible( &pak, Enemy );
}
}
if (deBuff) return;
//Send skill animation to the world
RESETPACKET( pak, 0x7b9);
ADDWORD ( pak, clientid);
ADDWORD ( pak, Battle->skillid);
ADDWORD ( pak, 1);
GServer->SendToVisible( &pak, this );
Battle->bufftarget = 0;
Battle->skilltarget = 0;
Battle->skillid = 0;
//Battle->atktype = NORMAL_ATTACK;
}
// use buff skill
void CCharacter::UseBuffSkill( CCharacter* Target, CSkills* skill )
{
bool bflag = false;
bflag = GServer->AddBuffs( skill, Target, GetInt( ) );
if(skill->nbuffs > 0 && bflag == true)
{
BEGINPACKET( pak, 0x7b5 );
ADDWORD ( pak, Target->clientid );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Battle->skillid );
ADDWORD ( pak, GetInt( )/4 );
ADDBYTE ( pak, skill->nbuffs );
GServer->SendToVisible( &pak, Target );
//Log(MSG_DEBUG,"Buff Skill. buffs applied 1");
}
BEGINPACKET( pak, 0x7b9);
ADDWORD ( pak, clientid);
ADDWORD ( pak, Battle->skillid);
ADDWORD ( pak, 1);
GServer->SendToVisible( &pak, this );
//Log(MSG_DEBUG,"Buff Skill. buffs applied 2 nbuffs = %i",skill->nbuffs);
//Log(MSG_INFO,"Target HP = %i",Target->Stats->HP);
}
// Use a skill
bool CCharacter::UseSkill( CSkills* skill, CCharacter *Target )
{
if (skill->atkpower > 0)
{
Log(MSG_INFO, "Need to do %i%s %s in range %i to target %i",
( skill->atkpower ),
( (skill->range > 0) ? " AOE" : "" ),
( (GServer->isSkillTargetFriendly(skill)) ? "healing" : "damage" ),
( skill->range ),
( skill->target ) );
}
for (int i = 0; i < 2; i++) {
Log(MSG_INFO, "Status ID: %i", skill->status[i]);
if (skill->status[i] == 0) continue;
CStatus* status = GServer->GetStatusByID(skill->status[i]);
if (status == NULL) continue;
/************************
We'll probably need to use status->decrease (Figure out whether buf is up/down
status->repeat will tell us whether it's a one-time (Stat Boost [2]), repeat
(Recovery, continueing damage [1]) or Special (Status Effect [3]).
************************/
if (status->repeat == 1) // Continuous
{
Log(MSG_INFO, "Need to take stat %i and %s it by %i%s over %i seconds", skill->buff[i],
((status->decrease) ? "decrease" : "increase"),
((skill->value1[i] != 0) ? skill->value1[i] : skill->value2[i]),
((skill->value1[i] != 0) ? "" : "%"), skill->duration);
}
else if (status->repeat == 2) // Once (Stat Boost)
{
Log(MSG_INFO, "Need to take stat %i and %s it by %i%s for %i seconds", skill->buff[i],
((status->decrease) ? "decrease" : "increase"),
((skill->value1[i] != 0) ? skill->value1[i] : skill->value2[i]),
((skill->value1[i] != 0) ? "" : "%"), skill->duration);
} else if (status->repeat == 3) // Status Effect (Poison,etc)
{
Log(MSG_INFO, "Need to give user status effect %i for %i seconds", skill->buff[i],
((skill->value1[i] != 0) ? skill->value1[i] : skill->value2[i]),
( skill->duration ) );
}
}
return true;
}
-570
View File
@@ -1,570 +0,0 @@
/*
Rose Online Server Emulator
Copyright (C) 2006,2007 OSRose Team http://www.osrose.net
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 the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
developed with Main erose/hrose source server + some change from the original eich source
*/
#include "character.h"
#include "worldserver.h"
// return true if this character is monster
bool CCharacter::IsMonster( )
{
if(CharType == 2 || CharType == 3)
return true;
return false;
}
// return true if this character is player
bool CCharacter::IsPlayer( )
{
if(CharType == 1)
return true;
return false;
}
//return true if this character is an NPC
bool CCharacter::IsNPC( )
{
if(CharType == 4)
return true;
return false;
}
// return true if HP is lower to 1
bool CCharacter::IsDead( )
{
if(Stats->HP <= 0)
return true;
return false;
}
// return true if this character is summon
bool CCharacter::IsSummon( )
{
if(this == NULL) return false;
if(CharType == 3)// this line is erroring. No idea why
return true;
return false;
}
// Virtual function [return item drop]
CDrop* CCharacter::GetDrop( )
{
return NULL;
}
// start action [attack]
void CCharacter::StartAction( CCharacter* Target, BYTE action, UINT skillid)
{
BEGINPACKET( pak, 0 );
switch(action)
{
case NORMAL_ATTACK:
{
//Log( MSG_INFO, "case NORMAL_ATTACK");
if(Target == NULL)return;
RESETPACKET( pak, 0x798 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Target->clientid );
ADDWORD ( pak, Stats->Move_Speed );
ADDFLOAT ( pak, Target->Position->current.x * 100 );
ADDFLOAT ( pak, Target->Position->current.y * 100 );
Battle->target = Target->clientid;
Battle->atktarget = Target->clientid;
Battle->atktype = action;
Battle->skilltarget = 0;
Battle->bufftarget = 0;
Battle->skillid = 0;
Position->destiny = Target->Position->current;
Position->lastMoveTime = clock();
}
break;
case SKILL_ATTACK: //Log( MSG_INFO, "case SKILL_ATTACK");
case SKILL_BUFF:
{
if(Target == NULL)return;
RESETPACKET( pak, 0x7b3 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Target->clientid );
ADDWORD ( pak, skillid );
ADDWORD ( pak, 0x0000 );
ADDFLOAT ( pak, Target->Position->current.x * 100 );
ADDFLOAT ( pak, Target->Position->current.y * 100 );
Battle->target = Target->clientid;
if(action == SKILL_ATTACK)
{
//Log( MSG_INFO, "case SKILL_ATTACK");
Battle->skilltarget = Target->clientid;
Battle->bufftarget = 0;
}
else
{
//Log( MSG_INFO, "case SKILL_BUFF");
Battle->bufftarget = Target->clientid;
Battle->skilltarget = 0;
}
Battle->atktype = action;
Position->destiny = Target->Position->current;
Battle->skillid = skillid;
Position->lastMoveTime = clock();
}
break;
case SKILL_AOE://Log( MSG_INFO, "case SKILL_AOE");
case BUFF_SELF://Log( MSG_INFO, "case BUFF_SELF");
case BUFF_AOE:
{
//Log( MSG_INFO, "case BUFF_AOE");
RESETPACKET( pak, 0x7b2);
ADDWORD ( pak, clientid );
ADDWORD ( pak, skillid );
Battle->atktype = action;
Battle->skillid = skillid;
//Log( MSG_INFO, "BUFF_AOE packet sent");
}
break;
case AOE_TARGET:
{
//Log( MSG_INFO, "case AOE_TARGET");
//Target is NULL for this function when cast by a player
//Target is NOT NULL when it comes from a monster
if(Target != NULL) //monster attack
{
Position->skilltargetpos.x = Target->Position->current.x;
Position->skilltargetpos.y = Target->Position->current.y;
}
RESETPACKET( pak, 0x7b4 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, skillid );
ADDFLOAT ( pak, Position->skilltargetpos.x * 100 );
ADDFLOAT ( pak, Position->skilltargetpos.y * 100 );
Battle->atktype = action;
Battle->skillid = skillid;
Battle->skilltarget = 0;
Battle->bufftarget = 0;
}
break;
default:
return;
break;
}
GServer->SendToVisible( &pak, this );
Battle->contatk = true;
//Log(MSG_INFO,"Battle Attacktype = %i",Battle->atktype);
return;
}
bool CCharacter::IsOnBattle( )
{
if(Battle->atktype == 0)
{
if(Battle->iscasting == 1)
{
clock_t etime = clock() - Battle->lastAtkTime;
if( etime < CLOCKS_PER_SEC * 100 / Stats->Attack_Speed )
{
//Log(MSG_DEBUG,"Iscasting is true while NOT in battle. Reset to false.");
Battle->iscasting = 0;
return false;
}
}
return false;
}
switch(Battle->atktype)
{
case NORMAL_ATTACK:
{
if(Battle->atktarget != 0) return true;
}
break;
case SKILL_ATTACK:
case AOE_TARGET:
{
if(Battle->skilltarget != 0 && Battle->skillid != 0) return true;
}
break;
case SKILL_BUFF:
{
if(Battle->bufftarget != 0 && Battle->skillid != 0) return true;
}
break;
case SKILL_AOE:
//case SKILL_SELF: //no such skill type
case BUFF_SELF:
case BUFF_AOE:
{
if(Battle->skillid != 0) return true;
}
break;
default: return false;
}
}
bool CCharacter::CanAttack( )
{
clock_t etime = clock() - Battle->lastAtkTime;
if (Stats->Attack_Speed < 1)
{
Log( MSG_INFO, "weapon with no attackspeed.");
return false;
}
if(Battle->iscasting == 1)
{
if( etime < CLOCKS_PER_SEC * 25 / Stats->Attack_Speed ) //should make the delay 4 times longer
{
//if(IsPlayer())
// Log(MSG_INFO,"Cannot use magic attack yet. Last attack time = %i",Battle->lastAtkTime);
return false;
}
else
{
Battle->iscasting = 0;
//if(IsPlayer())
// Log(MSG_INFO,"OK Now we can use a new (magic or normal) attack.");
return true;
}
}
else //normal attack
{
if( etime < CLOCKS_PER_SEC * 100 / Stats->Attack_Speed )
{
//if(IsPlayer())
// Log(MSG_INFO,"Cannot attack yet. Last attack time = %i",Battle->lastAtkTime);
return false;
}
//if(IsPlayer())
// Log(MSG_INFO,"OK Now we can use a normal attack");
}
return true;
}
// return true if target is reached
bool CCharacter::IsTargetReached( CCharacter* Enemy, CSkills* skill )
{
CMap* map = GServer->MapList.Index[Position->Map];
if(map == NULL)return false;
float distance = GServer->distance( Position->current, Enemy->Position->current );
if(skill == NULL) //it's a normal attack
{
if(distance <= Stats->Attack_Distance)
{
return true;
}
else
{
Position->destiny = Enemy->Position->current;
}
}
else
{
if(distance <= skill->range)
{
return true;
}
else
{
Position->destiny = Enemy->Position->current;
}
}
//Log(MSG_INFO,"Monster cannot attack. Too far away");
return false;
}
// return true if the character is moving
bool CCharacter::IsMoving( )
{
if(Position->current.x == Position->destiny.x && Position->current.y == Position->destiny.y )
return false;
return true;
}
// VIRTUAL [add player damage]
void CCharacter::AddDamage( CCharacter* enemy, long int hitpower)
{
}
// return character target
CCharacter* CCharacter::GetCharTarget( )
{
CCharacter* thistarget = GServer->MapList.Index[Position->Map]->GetCharInMap( Battle->target );
if (thistarget != NULL)
return thistarget;
//if I don't currently have a target then return the character who just hit me
return GServer->MapList.Index[Position->Map]->GetCharInMap( Battle->hitby );
}
// VIRTUAL [reduce ammon/bullets/cannons]
void CCharacter::ReduceABC( )
{
}
// VIRTUAL [get extra buff value]
int CCharacter::GetEVBuff( )
{
return 0;
}
// VIRTUAL [return intelligence]
unsigned int CCharacter::GetInt( )
{
return 15;
}
// Check For Debuffs
void CCharacter::RefreshBuff( )
{
bool bflag = false;
for( UINT i=0;i<30;i++)
{
if(MagicStatus[i].Buff == 0) continue;
clock_t etime = clock() - MagicStatus[i].BuffTime;
if( etime >= MagicStatus[i].Duration * CLOCKS_PER_SEC )
{
switch(MagicStatus[i].Status)
{
case 18: // attack power up
case 19: // attack power down
case 48: // attack power up
if(i<15)
Status->Attack_up = 0xff;
else
Status->Attack_down = 0xff;
Stats->Attack_Power = GetAttackPower( );
break;
case 20: // def up
case 21: // def down
case 49: // def up
if(i<15)
Status->Defense_up= 0xff;
else
Status->Defense_down = 0xff;
Stats->Defense = GetDefense( );
break;
case 24: //accuracy up
case 25: //accuracy down
case 51: //attack accuracy up.
if(i<15)
Status->Accury_up= 0xff;
else
Status->Accury_down = 0xff;
Stats->Accury = GetAccury( );
break;
case 22: // macic resistance up
case 23: // magic resistance down
case 50: // magic resistance up
if(i<15)
Status->Magic_Defense_up = 0xff;
else
Status->Magic_Defense_down = 0xff;
Stats->Magic_Defense = GetMagicDefense( );
break;
case 28: //dodge up
case 29: //dodge down
case 53: //dodge rate up
if(i<15)
Status->Dodge_up = 0xff;
else
Status->Dodge_down = 0xff;
Stats->Dodge = GetDodge( );
break;
case 14: //dash
case 15: //slow
case 46: //movement speed increased
if(i<15)
Status->Dash_up = 0xff;
else
Status->Dash_down = 0xff;
Stats->Move_Speed = GetMoveSpeed( );
break;
case 16: // haste attack
case 17: // slow attack
case 47: // attack speed up
if(i<15)
Status->Haste_up = 0xff;
else
Status->Haste_down = 0xff;
Stats->Attack_Speed = GetAttackSpeed( );
break;
case 26: // crit up
case 27: // crit down
case 52: // crit up
if(i<15)
Status->Critical_up = 0xff;
else
Status->Critical_down = 0xff;
Stats->Critical = GetCritical( );
break;
case 12: // max HP up
case 44: // max HP up
if(i<15)
Status->HP_up = 0xff;
else
Status->HP_down = 0xff;
Stats->MaxHP = GetMaxHP( );
break;
case 13: // max MP up
case 45: // max MP up
if(i<15)
Status->MP_up = 0xff;
else
Status->MP_down = 0xff;
Stats->MaxMP = GetMaxMP( );
break;
case 32: // faint
Status->Stuned = 0xff;
Status->CanAttack = true;
//printf("removing stun\n");
break;
case 7: case 8: case 9: case 10: case 11: //poisoned
Status->Poisoned = 0xff;
//printf("removing poison\n");
break;
case 30: // muted
Status->Muted = 0xff;
Status->CanCastSkill = true;
break;
case 31: // sleep May need to be fixed later to accomodate multiple status effects.
Status->Sleep = 0xff;
Status->CanMove = true;
Status->CanCastSkill = true;
Status->CanAttack = true;
break;
case 54: //A_GMExtra_Damage:
case 36: //A_Extra_Damage:
if(i<15)
{
Status->ExtraDamage_up = 0xff;
Stats->ExtraDamage = 0xff;
}
else
{
Status->ExtraDamage_down = 0xff;
Stats->ExtraDamage = 0xff;
}
break;
case 56: // Taunt
Status->Taunt = 0xff;
break;
}
MagicStatus[i].Status = 0;
MagicStatus[i].Buff = 0;
MagicStatus[i].BuffTime = 0;
MagicStatus[i].Duration = 0;
MagicStatus[i].Value = 0;
bflag = true;
}
else if (MagicStatus[i].Status >= 7 && MagicStatus[i].Status <= 11 && etime > 1*CLOCKS_PER_SEC) //Do poison dmg every 1.5 seconds
{
Stats->HP -= MagicStatus[i].Status; //Actually take 7, 8, 9, 10 or 11 from the health. Based on the Status itself
MagicStatus[i].BuffTime += 1*CLOCKS_PER_SEC;
MagicStatus[i].Duration -= 1;
//printf("did %i poison dmg to the player, still %i seconds and %i HP remain \n", MagicStatus[i].Status, MagicStatus[i].Duration, Stats->HP);
//A bunch of messy code to send dmg packet
BEGINPACKET( pak, 0x7b6 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, 0 );
ADDDWORD ( pak, 0x000007f8 );
ADDBYTE ( pak, 0x00 );
ADDDWORD ( pak, MagicStatus[i].Status );
//If Enemy is killed
if( IsDead())
{
//printf("char died\n");
CDrop* thisdrop = NULL;
ADDDWORD ( pak, 16 );
if( !IsSummon( ) && !IsPlayer( ))
{
thisdrop = GetDrop( );
if( thisdrop!=NULL)
{
ADDFLOAT ( pak, thisdrop->pos.x*100 );
ADDFLOAT ( pak, thisdrop->pos.y*100 );
if( thisdrop->type==1)
{
ADDDWORD( pak, 0xccccccdf );
ADDDWORD( pak, thisdrop->amount );
}
else
{
ADDDWORD ( pak, GServer->BuildItemHead( thisdrop->item ) );
ADDDWORD ( pak, GServer->BuildItemData( thisdrop->item ) );
}
ADDWORD ( pak, thisdrop->clientid );
ADDWORD ( pak, thisdrop->owner );
CMap* map = GServer->MapList.Index[thisdrop->posMap];
map->AddDrop( thisdrop );
}
}
GServer->SendToVisible( &pak, this, thisdrop );
}
//If enemy is still alive
else
{
ADDDWORD ( pak, 4 );
GServer->SendToVisible( &pak, this );
}
}
}
if(bflag)
{
BEGINPACKET( pak,0x7b7 );
ADDWORD ( pak, clientid );
ADDDWORD ( pak, GServer->BuildBuffs( this ) );
GServer->SendToVisible( &pak, this );
}
}
// VIRTUAL [return party pointer]
CParty* CCharacter::GetParty( )
{
return NULL;
}
// VIRTUAL [return clan pointer]
CLAN* CCharacter::GetClan( )
{
return NULL;
}
bool CCharacter::IsAttacking( )
{
if(IsOnBattle( ))
{
switch(Battle->atktype)
{
case SKILL_BUFF:
case BUFF_SELF:
case BUFF_AOE:
return false;
}
}
else return false;
return true;
}
+8 -16
View File
@@ -356,11 +356,7 @@ PVOID MapProcess( PVOID TS )
}
pthread_mutex_unlock( &GServer->MapMutex );
pthread_mutex_unlock( &GServer->PlayerMutex );
#ifdef _WIN32
Sleep(GServer->Config.MapDelay);
#else
usleep(GServer->Config.MapDelay * 1000); // MapDelay is in milliseconds; usleep wants microseconds
#endif
}
pthread_exit( NULL );
return 0;
@@ -390,11 +386,7 @@ PVOID VisibilityProcess(PVOID TS)
}
pthread_mutex_unlock( &GServer->MapMutex );
pthread_mutex_unlock( &GServer->PlayerMutex );
#ifdef _WIN32
Sleep(GServer->Config.VisualDelay);
#else
usleep(GServer->Config.VisualDelay * 1000); // VisualDelay is in milliseconds; usleep wants microseconds
#endif
}
pthread_exit(NULL);
return 0;
@@ -403,8 +395,16 @@ PVOID VisibilityProcess(PVOID TS)
// World Process
PVOID WorldProcess( PVOID TS )
{
int adminQueueTicks = 0;
while( GServer->ServerOnline )
{
// Poll roughly every 2 seconds regardless of WorldDelay, instead of
// hitting the DB on every tick.
if( ++adminQueueTicks * GServer->Config.WorldDelay >= 2000 )
{
adminQueueTicks = 0;
GServer->PollAdminQueue( );
}
pthread_mutex_lock( &GServer->MapMutex );
for(UINT i=0;i<GServer->MapList.Map.size();i++)
{
@@ -421,11 +421,7 @@ PVOID WorldProcess( PVOID TS )
}
pthread_mutex_unlock( &GServer->MapMutex );
GServer->RefreshFairy( );
#ifdef _WIN32
Sleep(GServer->Config.WorldDelay);
#else
usleep(GServer->Config.WorldDelay * 1000); // WorldDelay is in milliseconds; usleep wants microseconds
#endif
}
pthread_exit(NULL);
return 0;
@@ -435,11 +431,7 @@ PVOID WorldProcess( PVOID TS )
void ShutdownServer(PVOID TS)
{
int minutes = (int)(intptr_t)TS;
#ifdef _WIN32
Sleep(minutes*60000);
#else
sleep(minutes*60); // minutes*60000 was milliseconds; sleep() wants seconds
#endif
Log( MSG_INFO, "Saving User Information... " );
GServer->DisconnectAll();
Log( MSG_INFO, "Waiting Process to ShutDown... " );
+42
View File
@@ -66,6 +66,48 @@ bool CWorldServer::NPCAnnounce( const char msg[200], const char npc[50])
return true;
}
// Poll the admin_queue table (written by the webadmin panel) for pending
// broadcast/kick actions and execute them. There's no direct socket between
// webadmin and the world server, so this DB-polling approach reuses the
// existing MYSQL connection instead of adding a second IPC channel.
void CWorldServer::PollAdminQueue( )
{
// QStore holds SQLMutex locked until QFree() -- copy the rows out and
// free the result set first, since NPCAnnounce/pakGMKick/QExecute below
// issue their own queries and would deadlock on the same (non-recursive)
// mutex if called while this result set is still open.
struct QueueItem { int id; char type[20]; char payload[255]; };
QueueItem items[20];
int count = 0;
MYSQL_RES* result = DB->QStore("SELECT id, type, payload FROM admin_queue WHERE executed=0 ORDER BY id LIMIT 20");
if(result != NULL)
{
MYSQL_ROW row;
while(count < 20 && (row = mysql_fetch_row(result)) != NULL)
{
items[count].id = atoi(row[0]);
strncpy_s(items[count].type, row[1], sizeof(items[count].type)-1);
strncpy_s(items[count].payload, row[2], sizeof(items[count].payload)-1);
count++;
}
}
DB->QFree( );
for(int i = 0; i < count; i++)
{
if(strcmp(items[i].type, "broadcast") == 0)
{
NPCAnnounce(items[i].payload, "[Admin]");
}
else if(strcmp(items[i].type, "kick") == 0)
{
pakGMKick(NULL, items[i].payload);
}
DB->QExecute("UPDATE admin_queue SET executed=1 WHERE id=%i", items[i].id);
}
}
// NPC Whisper to a character
bool CWorldServer::NPCWhisper( CPlayer* thisclient, CMonster* thismon, const char msg[200], const char npc[50] )
{
-24
View File
@@ -38,9 +38,6 @@ void StartSignal( )
signal( SIGFPE, HandleSignal );
signal( SIGSEGV, HandleSignal );
signal( SIGTERM, HandleSignal );
#ifdef _WIN32
signal( SIGBREAK, HandleSignal );
#endif
signal( SIGABRT, HandleSignal );
}
@@ -51,9 +48,6 @@ void StopSignal( )
signal( SIGFPE, 0 );
signal( SIGSEGV, 0 );
signal( SIGTERM, 0 );
#ifdef _WIN32
signal( SIGBREAK, 0 );
#endif
signal( SIGABRT, 0 );
}
@@ -63,22 +57,14 @@ void HandleSignal( int num )
{
case SIGINT:/* Interactive attention */
Log( MSG_ERROR, "Signal received: SIGINT" );
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
delete GServer;
raise(num);
break;
case SIGILL:/* Illegal instruction */
Log( MSG_ERROR, "Signal received: SIGILL, Server will be closed, Trying to save..." );
GServer->DisconnectAll();
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
delete GServer;
raise(num);
break;
@@ -91,11 +77,7 @@ void HandleSignal( int num )
case SIGSEGV:/* Segmentation violation */
Log( MSG_ERROR, "Signal received: SIGSEGV, Server will be closed, Trying to save..." );
GServer->DisconnectAll();
#ifdef _WIN32
Sleep(1000);
#else
usleep(1000);
#endif
delete GServer;
raise(num);
break;
@@ -104,12 +86,6 @@ void HandleSignal( int num )
Log( MSG_INFO, "Signal received: SIGTERM, Server will be closed" );
pthread_create( &GServer->WorldThread[SHUTDOWN_THREAD], NULL, (void *(__cdecl *)(void *))ShutdownServer, (PVOID)0);
break;
#ifdef _WIN32
case SIGBREAK:/* Control-break */
Log( MSG_INFO, "Signal received: SIGBREAK, Server will be closed" );
pthread_create( &GServer->WorldThread[SHUTDOWN_THREAD], NULL, (void *(__cdecl *)(void *))ShutdownServer, (PVOID)0);
break;
#endif
default:
cout << "Unknown Signal Number: " << num << endl;
raise(num);
+1
View File
@@ -342,6 +342,7 @@ class CWorldServer : public CServerSocket
bool NPCMessage( CMonster* thismon, const char msg[200], const char npc[50] );
bool NPCWhisper( CPlayer* thisclient, CMonster* thismon, const char msg[200], const char npc[50] );
bool NPCAnnounce( const char msg[200], const char npc[50] );
void PollAdminQueue( );
UINT GetMaxPartyExp( UINT partylevel );
bool DoSkillScript( CCharacter* character, CSkills* thisskill );
File diff suppressed because it is too large. Load diff
+7 -2
View File
@@ -737,7 +737,12 @@ void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill, bool deBuff)
{
//unsigned int totalpower = skill->atkpower + Enemy->Stats->Magic_Defense;
unsigned int totalpower = Attack + Enemy->Stats->Magic_Defense;
double hitmod = Attack * 100 / totalpower; //percentage of hitpower to use * 100
// + Stats->Level to match NormalAttack's hitmod (see battle.cpp
// NormalAttack) -- without it, skills never actually scaled with
// level despite the comment above claiming they do, and ended up
// hitting no harder than (often weaker than, since skills get no
// crit) a plain auto-attack.
double hitmod = Attack * 100 / totalpower + Stats->Level; //percentage of hitpower to use * 100
hitpower = (unsigned int)floor((double)(hitmod * Attack / 100));
//Log(MSG_DEBUG,"Skill magic: AP %i DEF %i",Stats->Attack_Power,Enemy->Stats->Defense);
//Log(MSG_DEBUG,"Skill magic: Skill power %i. Attack %i",skill->atkpower,Attack);
@@ -747,7 +752,7 @@ void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill, bool deBuff)
{
//unsigned int totalpower = skill->atkpower + Enemy->Stats->Defense;
unsigned int totalpower = Attack + Enemy->Stats->Defense;
double hitmod = Attack * 100 / totalpower; //percentage of hitpower to use * 100
double hitmod = Attack * 100 / totalpower + Stats->Level; //percentage of hitpower to use * 100
hitpower = (unsigned int)floor((double)(hitmod * Attack / 100));
//Log(MSG_DEBUG,"Skill physical: AP %i DEF %i",Stats->Attack_Power,Enemy->Stats->Defense);
//Log(MSG_DEBUG,"Skill physical: Skill power %i. Attack %i",skill->atkpower,Attack);
-802
View File
@@ -1,802 +0,0 @@
/*
Rose Online Server Emulator
Copyright (C) 2006,2007 OSRose Team http://www.osrose.net
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 the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
depeloped with Main erose/hrose source server + some change from the original eich source
*/
#include "character.h"
#include "worldserver.h"
void CCharacter::DoAttack( )
{
//if(Status->Sleep <= 0xff)
//{
// ClearBattle( Battle );
// return; // can't take any action while we are asleep can we?
//}
if(IsSummon())
{
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL && Battle->atktype != SKILL_AOE && Battle->atktype != BUFF_AOE)
{
//Log(MSG_DEBUG,"No Enemy found");
ClearBattle( Battle );
return;
}
//Log(MSG_DEBUG,"Client id: %i Enemy client id: %i",clientid, Enemy->clientid);
if(this == Enemy) //summoned monster is attacking itself. It has been observed to happen
{
//Log(MSG_INFO,"Clearing Battle for this summon");
ClearBattle( Battle );
return;
}
}
CMap* map = GServer->MapList.Index[Position->Map];
//Log(MSG_INFO,"DoAttack Battle Attack type = %i",Battle->atktype);
switch(Battle->atktype)
{
case NORMAL_ATTACK://normal attack
{
//if(!Status->CanAttack)
// return; //can't attack right now.
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL)
{
ClearBattle( Battle );
return;
}
if(Enemy == this)
{
//Log(MSG_INFO,"WTF?? I AM trying to attack myself");
ClearBattle( Battle );
}
if(IsTargetReached( Enemy ) && CanAttack( ))
{
NormalAttack( Enemy );
if (Enemy->IsMonster()) // do monster AI script when monster is attacked.
{
CMonster* monster = GServer->GetMonsterByID(Enemy->clientid, Enemy->Position->Map);
if(monster == NULL)return;
monster->DoAi(monster->thisnpc->AI, 3);
}
}
}
break;
case SKILL_ATTACK://skill attack
{
//if(!Status->CanCastSkill)
// return; // can't cast skills right now
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL)
{
ClearBattle( Battle );
return;
}
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//ClearBattle( Battle );
return;
}
if(IsTargetReached( Enemy, skill ) && CanAttack( ))
{
SkillAttack( Enemy, skill );
if (Enemy->IsMonster())
{
CMonster* monster = GServer->GetMonsterByID(Enemy->clientid, Enemy->Position->Map);
if(monster == NULL)return;
monster->DoAi(monster->thisnpc->AI, 3);
}
}
}
break;
case SKILL_BUFF://buffs
{
//if(!Status->CanCastSkill)
// return; // can't cast skills right now
CCharacter* Enemy = GetCharTarget( );
if(Enemy == NULL)
{
//Log(MSG_DEBUG,"this target is NULL");
ClearBattle( Battle );
return;
}
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//Log(MSG_DEBUG,"this skill is NULL");
//ClearBattle( Battle );
return;
}
//Log(MSG_DEBUG,"Called skill buff code for skill %i",skill->id);
if(IsTargetReached( Enemy, skill ) && CanAttack( ))
{
//Log(MSG_DEBUG,"Skill successfully cast");
BuffSkill( Enemy, skill );
}
}
break;
case SKILL_AOE:
//case SKILL_SELF: //this is impossible. it can never be set
case AOE_TARGET:
{
//if(!Status->CanCastSkill)
// return; // can't cast skills right now
//Log(MSG_DEBUG,"Called skill type %i",Battle->atktype);
CCharacter* Enemy = NULL;
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
ClearBattle( Battle );
return;
}
if(Battle->atktype == AOE_TARGET)
{
float distance = GServer->distance( Position->current, Position->destiny );
if(distance <= skill->range && CanAttack( ))
{
Position->destiny = Position->current;
AoeSkill( skill, Enemy );
}
}
else
{
Position->skilltargetpos = Position->current;
AoeSkill( skill, NULL );
}
}
break;
case BUFF_SELF:
{
//if(!Status->CanCastSkill)
// return; // can't cast skills right now
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//ClearBattle( Battle );
return;
}
BuffSkill( this, skill );
}
break;
case BUFF_AOE:
{
//if(!Status->CanCastSkill)
// return; // can't cast skills right now
Log(MSG_INFO,"BUFF AOE selected");
CSkills* skill = GServer->GetSkillByID( Battle->skillid );
if(skill == NULL)
{
//ClearBattle( Battle );
return;
}
AoeBuff( skill );
}
break;
default:
return;
break;
}
}
// do normal attack
void CCharacter::NormalAttack( CCharacter* Enemy )
{
Enemy->OnBeAttacked( this );
Position->destiny = Position->current;
// PY code
float mod = 0;
if(IsPlayer())
{
mod = 23 + (Stats->Level / 1.5);
}
else
{
mod = 23 + (Stats->Level / 4);
}
float attack = 0;
if(Stats->magicattack == 1)
{
attack = (float) Stats->Attack_Power / Enemy->Stats->Magic_Defense;
attack *= mod;
}
else
{
attack = (float) Stats->Attack_Power / Enemy->Stats->Defense;
attack *= mod;
}
//PY end
if(attack < 5) attack = 5;
float d_attack = attack / 100;
mod = GServer->RandNumber( 0, 10 ) * d_attack;
attack += mod;
long int hitpower = (long int)floor(attack + GServer->RandNumber(0, 10));
if(IsPlayer( )) //temp fix to find balance btw monster and player
{
hitpower = (long int)floor(attack * (GServer->Config.PlayerDmg/100.00));
hitpower+=((hitpower*(Stats->ExtraDamage))/100);
}
if(IsMonster( )) //temp fix to find balance btw monster and player
hitpower = (long int)floor(attack * (GServer->Config.MonsterDmg/100.00));
bool critical = false;
if(hitpower <= 5)
{
hitpower = 5;
}
else
{
if(GServer->RandNumber(0,300)<Stats->Critical)
{
hitpower = (long int)floor(hitpower * 1.5);
critical = true;
}
}
// dodge
unsigned int hitvalue = (unsigned int)floor((double)(Stats->Accury * 100 / Enemy->Stats->Dodge));
if(hitvalue>100) hitvalue = 100;
if(GServer->RandNumber( 0, 100 )>hitvalue)
hitpower = 0; // dodged
if (hitpower > 0x7ff)//2047 packet size limit.
{
hitpower=0x7ff;
}
//maybe this little line here will fix my ghosty problem
//they are definitely attacking. But no animation so maybe atktarget is empty
Battle->atktarget = Battle->target;
//Well it does make the damage show up at teh client but the animation is still dodgey
if(IsMonster())
{
Log(MSG_INFO,"Monster hits player for %i damage. Attack target = %i",hitpower,Battle->atktarget);
}
//Log( MSG_INFO, "hitpower %i. Attack %f ", hitpower,attack );
if(!Enemy->IsSummon( ) && Enemy->IsMonster( ))
{
Enemy->AddDamage( this, hitpower );
Enemy->damagecounter += hitpower;// is for AI
}
Enemy->Stats->HP -= hitpower;
BEGINPACKET( pak, 0x799 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Battle->atktarget );
#ifdef USE124
ADDDWORD ( pak, hitpower );
#endif
if(Enemy->IsDead())
{
CDrop* thisdrop = NULL;
#ifndef USE124
ADDWORD ( pak, (hitpower | ( critical?0xb000:0x8000 ) ));
#else
ADDDWORD ( pak, critical?28:16 );
#endif
if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
{
thisdrop = Enemy->GetDrop( );
if(thisdrop!=NULL)
{
ADDFLOAT ( pak, thisdrop->pos.x*100 );
ADDFLOAT ( pak, thisdrop->pos.y*100 );
if(thisdrop->type == 1)
{
ADDWORD( pak, 0xccdf );
ADDDWORD( pak, thisdrop->amount );
}
else
{
ADDWORD ( pak, GServer->BuildItemHead( thisdrop->item ) );
ADDDWORD ( pak, GServer->BuildItemData( thisdrop->item ) );
}
ADDWORD ( pak, thisdrop->clientid );
ADDWORD ( pak, thisdrop->owner );
CMap* map = GServer->MapList.Index[thisdrop->posMap];
map->AddDrop( thisdrop );
}
}
GServer->SendToVisible( &pak, Enemy, thisdrop );
OnEnemyDie( Enemy );
}
else
{
#ifndef USE124
ADDWORD ( pak, (hitpower|(hitpower>0?(critical?0x4000:0):0)));
#else
ADDDWORD ( pak, (hitpower>0?(critical?12:0):0) );
#endif
GServer->SendToVisible( &pak, Enemy );
}
ReduceABC( );
Battle->lastAtkTime = clock( );
}
// do skill attack
bool CCharacter::SkillAttack( CCharacter* Enemy, CSkills* skill )
{
Position->destiny = Position->current;
//if(Battle->castTime==0)
//{
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, this );
// Battle->castTime = clock();
// return true;
//}
//else
//{
// clock_t etime = clock() - Battle->castTime;
// if(etime<SKILL_DELAY)
// return true;
//}
//Battle->castTime = 0;
UseAtkSkill( Enemy, skill );
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP<0) Stats->MP=0;
if(Battle->contatk)
{
Battle->atktype = NORMAL_ATTACK;
Battle->skilltarget = 0;
Battle->atktarget = Battle->target;
Battle->skillid = 0;
}
else
{
//ClearBattle( Battle );
}
GServer->DoSkillScript( this, skill );
Battle->lastAtkTime = clock( );
return true;
}
// do buff skill
bool CCharacter::BuffSkill( CCharacter* Target, CSkills* skill )
{
Position->destiny = Position->current;
//if(Battle->castTime == 0)
//{
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, (CCharacter*)this );
// Battle->castTime = clock();
// return true;
//}
//else
//{
// clock_t etime = clock() - Battle->castTime;
// if(etime < SKILL_DELAY)
// return true;
//}
//Battle->castTime = 0;
//Log(MSG_DEBUG,"applied buff skill %i",skill->id);
UseBuffSkill( Target, skill );
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0) Stats->MP = 0;
GServer->DoSkillScript( this, skill ); //summons a monster. Why do we do this for all skills?
if(!IsMonster())
{
ClearBattle( Battle ); // clear battle for players when they use buff skills
//Battle->bufftarget = 0;
//Battle->skilltarget = 0;
//Battle->skillid = 0;
//Battle->atktype = NORMAL_ATTACK;
}
else //Monsters need to be reset to normal attack and clear skill attacks.
{
Battle->bufftarget = 0;
Battle->skilltarget = 0;
Battle->skillid = 0;
Battle->atktype = NORMAL_ATTACK;
}
Battle->lastAtkTime = clock( );
return true;
}
//arnold
// do AoE skill
bool CCharacter::AoeSkill( CSkills* skill, CCharacter* Enemy )
{
Position->destiny = Position->current;
//Log(MSG_INFO,"Doing AOE Skill");
//if(Battle->castTime == 0)
//{
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, (CCharacter*)this );
// Battle->castTime = clock();
// return true;
//}
//else
//{
// clock_t etime = clock() - Battle->castTime;
// if(etime < SKILL_DELAY)
// return true;
//}
//Battle->castTime = 0;
CMap* map = GServer->MapList.Index[Position->Map];
//PY replacement code
if(IsPlayer() || IsSummon())
{
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
if(monster->clientid == clientid) continue;
if(monster->IsSummon( ) && (map->allowpvp == 0 || monster->owner == clientid)) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos, monster->Position->current,(float)skill->aoeradius + 1))
UseAtkSkill( (CCharacter*) monster, skill );
}
}
if(IsMonster() && !IsSummon())
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
if(player->clientid == clientid) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos,player->Position->current,(float)skill->aoeradius+1))
UseAtkSkill( (CCharacter*) player, skill );
}
}
//PY end
// this code appears to me to be completely wrong replaced with code above
/*
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
if(monster->clientid == clientid) continue;
if(IsSummon( ) || IsPlayer( ))
{
if(monster->IsSummon( ) && (map->allowpvp==0 || monster->owner == clientid)) continue;
}
else
{
if(!monster->IsSummon( )) continue;
}
if(GServer->IsMonInCircle( Position->skilltargetpos, monster->Position->current,(float)skill->aoeradius + 1))
UseAtkSkill( (CCharacter*) monster, skill );
}
if(map->allowpvp!=0 || (IsMonster( ) && !IsSummon( )))
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
if(player->clientid==clientid) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos,player->Position->current,(float)skill->aoeradius+1))
UseAtkSkill( (CCharacter*) player, skill );
}
}*/
if(Enemy != NULL)
{
if(!Enemy->IsDead( ))
{
Battle->atktarget = Battle->target;
Battle->atktype = NORMAL_ATTACK;
Battle->skilltarget = 0;
Battle->skillid = 0;
}
else ClearBattle( Battle );
}
else ClearBattle( Battle );
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0) Stats->MP = 0;
Battle->lastAtkTime = clock( );
return true;
}
bool CCharacter::AoeBuff( CSkills* skill )
{
//Log(MSG_INFO,"BUFF AOE called");
Position->destiny = Position->current;
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, (CCharacter*)this );
CMap* map = GServer->MapList.Index[Position->Map];
if(CharType == 1 || CharType == 3) //player || Summon
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
switch(skill->target)
{
case 1: //tPartyMember
if(player->Party->party == GetParty( ))
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough party member");
if(GServer->IsMonInCircle( Position->current,player->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)player, skill );
}
break;
case 2: //tClanMember
if (player->Clan == GetClan( ))
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough clan member");
if(GServer->IsMonInCircle( Position->current, player->Position->current, (float)skill->aoeradius + 1 ) )
UseBuffSkill( (CCharacter*)player, skill );
}
break;
case 3: //tAlly
case 7: //tAllCharacters
case 8: //tAllMembers. all characters
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough allied Player");
if(GServer->IsMonInCircle( Position->current,player->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)player, skill );
}
break;
case 5: //tHostileCharacter
{
if (CharType == 2)
{
//Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough hostile Player");
if(GServer->IsMonInCircle( Position->current,player->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)player, skill );
}
}
break;
}
}
}
else if (CharType == 2) //monster
{
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
switch(skill->target)
{
case tPartyMember: // party
break;
case 2: //tClanMember
break;
case 3: //tAlly
case 7: //tAllCharacters
case 8: //tAllMembers. all characters
{
Log(MSG_INFO,"Applying AOE buff as long as I can find a close enough monster");
if(GServer->IsMonInCircle( Position->current,monster->Position->current,(float)skill->aoeradius + 1))
UseBuffSkill( (CCharacter*)monster, skill );
}
break;
case tHostileCharacter:
break;
}
}
}
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0) Stats->MP = 0;
Battle->bufftarget = 0;
Battle->skilltarget = 0;
Battle->skillid = 0;
Battle->atktype = NORMAL_ATTACK;
//ClearBattle( Battle );
Battle->lastAtkTime = clock( );
return true;
}
// use skill attack
void CCharacter::UseAtkSkill( CCharacter* Enemy, CSkills* skill, bool deBuff)
{
long int skillpower = 0;
if(skill->skilltype == 6 || skill->skilltype == 7) //magical damage
{
skillpower = skill->atkpower * 2;
}
else // physical damage
{
skillpower = skill->atkpower * 2;
}
UINT weapontype = 0;
float mod = 0;
float attack = 0;
if(IsPlayer())
{
mod = 35 + (Stats->Level / 2);
}
else
{
mod = 35 + (Stats->Level / 2);
}
if(skill->skilltype == 6 || skill->skilltype == 7) //magical damage
{
attack = skillpower / Enemy->Stats->Magic_Defense;
}
else
{
attack = skillpower / Enemy->Stats->Defense;
}
attack *= mod;
attack += (Stats->Attack_Power / 2); // let's add our AP to the skillpower to make it worthwhile to cast skills.
skillpower = (int)attack;
bool bflag = false;
Enemy->OnBeAttacked( this );
if(skillpower <= 0) skillpower = 0;
if(IsPlayer())
{
skillpower += (int)(skillpower * (Stats->ExtraDamage))/100;
}
if (skill->atkpower == 0)
{
skillpower = 0; // If the skill has a 0 atk power, it isn't meant to damage
Log( MSG_INFO, "This skill does no damage" );
//ClearBattle( Battle );
return; // probably need to add some alternative code here for legitimate skills that have no attack power.
}
if(skillpower >2046)skillpower = 2046;
if(!Enemy->IsSummon( ) && Enemy->IsMonster( ))
{
Enemy->AddDamage( this, skillpower );
Enemy->damagecounter += skillpower;// is for AI
}
Enemy->Stats->HP -= skillpower;
BEGINPACKET( pak, 0x7b6 );
ADDWORD ( pak, Enemy->clientid );
ADDWORD ( pak, clientid );
ADDDWORD ( pak, 0x000007f8 );
ADDBYTE ( pak, 0x00 );
if (Enemy->Stats->HP<1)
{
ADDWORD ( pak, skillpower + 0x8000 );
}
else
{
ADDWORD ( pak, skillpower + 0x2000 );
}
if(Enemy->IsDead())
{
CDrop* thisdrop = NULL;
ADDDWORD ( pak, 16 );
if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
{
thisdrop = Enemy->GetDrop( );
if(thisdrop!=NULL)
{
ADDFLOAT ( pak, thisdrop->pos.x*100 );
ADDFLOAT ( pak, thisdrop->pos.y*100 );
if(thisdrop->type==1)
{
ADDWORD( pak, 0xccdf );
ADDDWORD( pak, thisdrop->amount );
}
else
{
ADDWORD ( pak, GServer->BuildItemHead( thisdrop->item ) );
ADDDWORD ( pak, GServer->BuildItemData( thisdrop->item ) );
}
ADDWORD ( pak, thisdrop->clientid );
ADDWORD ( pak, thisdrop->owner );
CMap* map = GServer->MapList.Index[thisdrop->posMap];
map->AddDrop( thisdrop );
}
}
GServer->SendToVisible( &pak, Enemy, thisdrop );
OnEnemyDie( Enemy );
}
else
{
ADDDWORD ( pak, 4 );
GServer->SendToVisible( &pak, Enemy );
bflag = GServer->AddBuffs( skill, Enemy, GetInt( ) );
//Send (de)buff information to the whole world
if(skill->nbuffs>0 && bflag)
{
BEGINPACKET( pak, 0x7b5 );
ADDWORD ( pak, Battle->skilltarget );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Battle->skillid );
ADDWORD ( pak, GetInt( ) );
ADDBYTE ( pak, skill->nbuffs );
GServer->SendToVisible( &pak, Enemy );
}
}
if (deBuff) return;
//Send skill animation to the world
RESETPACKET( pak, 0x7b9);
ADDWORD ( pak, clientid);
ADDWORD ( pak, Battle->skillid);
ADDWORD ( pak, 1);
GServer->SendToVisible( &pak, this );
Battle->bufftarget = 0;
Battle->skilltarget = 0;
Battle->skillid = 0;
Battle->atktype = NORMAL_ATTACK;
}
// use buff skill
void CCharacter::UseBuffSkill( CCharacter* Target, CSkills* skill )
{
bool bflag = false;
bflag = GServer->AddBuffs( skill, Target, GetInt( ) );
if(skill->nbuffs > 0 && bflag == true)
{
BEGINPACKET( pak, 0x7b5 );
ADDWORD ( pak, Target->clientid );
ADDWORD ( pak, clientid );
ADDWORD ( pak, Battle->skillid );
ADDWORD ( pak, GetInt( )/4 );
ADDBYTE ( pak, skill->nbuffs );
GServer->SendToVisible( &pak, Target );
//Log(MSG_DEBUG,"Buff Skill. buffs applied 1");
}
BEGINPACKET( pak, 0x7b9);
ADDWORD ( pak, clientid);
ADDWORD ( pak, Battle->skillid);
ADDWORD ( pak, 1);
GServer->SendToVisible( &pak, this );
//Log(MSG_DEBUG,"Buff Skill. buffs applied 2 nbuffs = %i",skill->nbuffs);
//Log(MSG_INFO,"Target HP = %i",Target->Stats->HP);
}
// Use a skill
bool CCharacter::UseSkill( CSkills* skill, CCharacter *Target )
{
if (skill->atkpower > 0)
{
Log(MSG_INFO, "Need to do %i%s %s in range %i to target %i",
( skill->atkpower ),
( (skill->range > 0) ? " AOE" : "" ),
( (GServer->isSkillTargetFriendly(skill)) ? "healing" : "damage" ),
( skill->range ),
( skill->target ) );
}
for (int i = 0; i < 2; i++) {
Log(MSG_INFO, "Status ID: %i", skill->status[i]);
if (skill->status[i] == 0) continue;
CStatus* status = GServer->GetStatusByID(skill->status[i]);
if (status == NULL) continue;
/************************
We'll probably need to use status->decrease (Figure out whether buf is up/down
status->repeat will tell us whether it's a one-time (Stat Boost [2]), repeat
(Recovery, continueing damage [1]) or Special (Status Effect [3]).
************************/
if (status->repeat == 1) // Continuous
{
Log(MSG_INFO, "Need to take stat %i and %s it by %i%s over %i seconds", skill->buff[i],
((status->decrease) ? "decrease" : "increase"),
((skill->value1[i] != 0) ? skill->value1[i] : skill->value2[i]),
((skill->value1[i] != 0) ? "" : "%"), skill->duration);
}
else if (status->repeat == 2) // Once (Stat Boost)
{
Log(MSG_INFO, "Need to take stat %i and %s it by %i%s for %i seconds", skill->buff[i],
((status->decrease) ? "decrease" : "increase"),
((skill->value1[i] != 0) ? skill->value1[i] : skill->value2[i]),
((skill->value1[i] != 0) ? "" : "%"), skill->duration);
} else if (status->repeat == 3) // Status Effect (Poison,etc)
{
Log(MSG_INFO, "Need to give user status effect %i for %i seconds", skill->buff[i],
((skill->value1[i] != 0) ? skill->value1[i] : skill->value2[i]),
( skill->duration ) );
}
}
return true;
}
+1
View File
@@ -40,6 +40,7 @@ CCharacter::CCharacter( )
Stats->Accury = 0;
Stats->Magic_Defense = 0;
Stats->Move_Speed = 0;
Stats->SpeedModPercent = 100;
Stats->Attack_Speed = 0;
Stats->Attack_Distance = 0;
Stats->MaxWeight = 0;
+1
View File
@@ -63,6 +63,7 @@ struct STATS
unsigned int Magic_Defense;
unsigned int Move_Speed;
unsigned int Mspd_base;
unsigned int SpeedModPercent; // GM /setspeedmod override, 100 = unmodified; applied in GetMoveSpeed()
unsigned int Attack_Speed;
float Attack_Distance;
unsigned int MaxWeight;
+19 -2
View File
@@ -3814,10 +3814,27 @@ bool CWorldServer::pakGMChangeMonsterDmg(CPlayer* thisclient, int rate)
return true;
}
//change the mSpeedModif || For test only
//change this GM's own move speed by a percentage (100 = unmodified) || For test only
bool CWorldServer::pakGMChangeMSpeedModif(CPlayer* thisclient, int modif)
{
GServer->MOVE_SPEED_MOD = modif;
// NOTE: this used to stomp GServer->MOVE_SPEED_MOD, a server-wide
// constant that character.cpp's UpdatePosition also uses for monster
// position interpolation -- overwriting it here broke movement/attack
// range for everyone until the next restart reloaded it from
// list_config.movespeedmod. Use a per-character percent instead, which
// GetMoveSpeed() applies on every recompute so it survives future stat
// refreshes (equip changes, buffs, etc.) instead of being a one-shot
// value that the next SetStats() call overwrites back to base.
if(modif == 0) modif = 100;
thisclient->Stats->SpeedModPercent = modif;
thisclient->SetStats( );
BEGINPACKET( pakspd, 0x782 );
ADDWORD( pakspd, thisclient->clientid );
ADDBYTE( pakspd, thisclient->Status->Stance );
ADDWORD( pakspd, thisclient->Stats->Mspd_base );
SendToVisible( &pakspd, thisclient );
BEGINPACKET (pak, 0x702);
ADDSTRING(pak, "mSpeedModif Changed.");
ADDBYTE(pak, 0);
-3
View File
@@ -60,9 +60,6 @@ int main(int argc, char *argv[])
else
{
delete server;
#ifdef _WIN32
system("pause");
#endif
return -1;
}
+7
View File
@@ -1050,6 +1050,13 @@ unsigned int CPlayer::GetMoveSpeed( )
default:
break;
}
if(Stats->SpeedModPercent != 100)
mspeed = mspeed * Stats->SpeedModPercent / 100;
// Mspd_base (what actually gets broadcast to clients, e.g. worldpackets.cpp's
// 0x782) was previously only touched by the RUNNING/DRIVING branches above --
// WALKING/default left it stale, so speed changes never showed up client-side
// while walking. Mirror the final value unconditionally.
Stats->Mspd_base = mspeed;
return mspeed;
}
-4
View File
@@ -13,11 +13,7 @@ public:
unsigned dataoffset = 0;
unsigned short fieldlen = 0;
#ifdef _WIN32
if ( (fh = fopen( filename, "rb" )) == 0 ) {
#else
if ( (fh = rose_fopen( filename, "rb" )) == 0 ) {
#endif
Log( MSG_ERROR, "Could not load STB '%s'", filename );
return 1;
}else{
-35
View File
@@ -215,17 +215,8 @@ class CRoseFile
{
ftype = FT_BINARY;
}
#ifndef CFILE_NODEPRECATE
if( fopen_s( &fh, fname, fasciimode ) == 0 )
{
#else
#ifdef _WIN32
if( ( fh = fopen( fname, fasciimode ) ) != NULL )
#else
if( ( fh = rose_fopen( fname, fasciimode ) ) != NULL )
#endif
{
#endif
delete[] fasciimode;
//Check if unicode or ascii
if( ftype != FT_BINARY )
@@ -244,13 +235,7 @@ class CRoseFile
DoError( FE_INTERNALERROR );
return false;
}
#ifndef CFILE_NODEPRECATE
fopen_s( &fh, fname, fasciimode );
#elif defined(_WIN32)
fh = fopen( fname, fasciimode );
#else
fh = rose_fopen( fname, fasciimode );
#endif
SetAbsPos( 2 );
ftype = FT_UNICODE;
#else
@@ -561,12 +546,7 @@ class CRoseFile
CFILE_CHAR buf;
wchar_t buffer;
buffer = fgetwc( fh );
#ifndef CFILE_NODEPRECATE
size_t tmp;
wcstombs_s( &tmp, &buf, (size_t)(sizeof(buf)), &buffer, 1 );
#else
wcstombs( &buf, &buffer, 1 );
#endif
return (CFILE_CHAR)buf;
#else
DoError( FE_UNICODENOTALLOWED );
@@ -610,12 +590,7 @@ class CRoseFile
#ifndef CFILE_NOUNICODE
wchar_t* buffer = new wchar_t[max_count];
fgetws( buffer, max_count, fh );
#ifndef CFILE_NODEPRECATE
size_t tmp;
wcstombs_s( &tmp, buf->arr, (size_t)(buf->absSize()), buffer, max_count );
#else
wcstombs( buf->arr, buffer, max_count );
#endif
return NULL;
#else
DoError( FE_UNICODENOTALLOWED );
@@ -861,12 +836,7 @@ class CRoseFile
{
#ifndef CFILE_NOUNICODE
wchar_t buffer;
#ifndef CFILE_NODEPRECATE
size_t tmp;
mbstowcs_s( &tmp, &buffer, 1, (CFILE_CHAR*)(&chr), 1 );
#else
mbstowcs( &buffer, (CFILE_CHAR*)(&chr), 1 );
#endif
return (CFILE_SCHAR)(fputwc( buffer, fh ));
#else
DoError( FE_UNICODENOTALLOWED );
@@ -904,12 +874,7 @@ class CRoseFile
{
#ifndef CFILE_NOUNICODE
wchar_t* buffer = new wchar_t[ (size_t)(str->size()) ];
#ifndef CFILE_NODEPRECATE
size_t tmp;
mbstowcs_s( &tmp, buffer, (size_t)(str->size()), str->arr, (size_t)(str->size()) );
#else
mbstowcs( buffer, str->arr, str->size() );
#endif
return (fputws( buffer, fh )!=EOF)?(true):(false);
#else
DoError( FE_UNICODENOTALLOWED );
-119
View File
@@ -1,119 +0,0 @@
/*
Rose Online Server Emulator
Copyright (C) 2006,2007 OSRose Team http://www.osrose.net
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 the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
depeloped with Main erose/hrose source server + some change from the original eich source
*/
#ifndef __ROSE_MAP__
#define __ROSE_MAP__
#include "worldserver.h"
#include "player.h"
#include "character.h"
#include "worldmonster.h"
#include "datatypes.h"
class CMonster;
class CMap
{
public:
CMap( );
~CMap( );
bool AddPlayer( CPlayer* player );
bool RemovePlayer( CPlayer* player, bool clearobject=true );
//CMonster* AddMonster( UINT montype, fPoint position, UINT owner=0, UINT spawnid=0, bool GetDropData=false );
CMonster* AddMonster( UINT montype, fPoint position, UINT owner=0, UINT spawnid=0, UINT aggro = 0, bool IsTD = false, UINT limit = 0, UINT AI = 0);
bool DeleteMonster( CMonster*, bool clearobject=false, UINT i=0 );
bool AddDrop( CDrop* drop );
bool DeleteDrop( CDrop* drop );
bool AddNPC( CNPC* npc );
bool DeleteNPC( CNPC* npc );
CMonster* ConverToMonster( CMonster* monster, UINT newmonttype, bool heal=true );
CMonster* ConverToMonster( CNPC* npc, UINT newmonttype );
bool TeleportPlayer( CPlayer* player, fPoint coord, bool TelePassenger=true );
bool pakTeleport( CPlayer* player, unsigned int Map, fPoint coord, bool TelePassenger );
CRespawnPoint* GetNearRespawn( CPlayer* player );
CRespawnPoint* GetFirstRespawn( );
CRespawnPoint* GetStartRespawn( );
CCharacter* GetCharInMap( unsigned int id );
CPlayer* GetPlayerInMap( UINT id );
CMonster* GetMonsterInMap( UINT id );
CPlayer* GetCharIDInMap( UINT id );
CDrop* GetDropInMap( UINT id );
CNPC* GetNPCInMap( UINT id );
void UpdateTime( );
void CleanDrops( );
void RespawnMonster( );
void UpdateSpawnCounter( UINT montype, UINT spawnid, UINT key );
bool IsNight( );
void LoadZon(strings zon);
void LoadData(strings zonpath, CStrStb* stbEvent);
void AddIfo(strings ifo, CStrStb* stbEvent);
UINT id; // id from map
UINT dayperiod; // duration of 1 day
UINT morningtime; // morning start time
UINT daytime; // day start time
UINT eveningtime; // evening start time
UINT nighttime; // nighttime start time
UINT ZoneTime; // how many 6 minute segments since start of the day
UINT ghost; // ghosttime?
BYTE allowpvp; // pvp allowed?
bool dungeon; // Map is a dungeon?
bool allowpat; // pat allowed?
// Time values
UINT MapTime; // Past time in this map
UINT Date;
UINT hour;
UINT minute;
UINT ObjVar[20]; //for storing map variables used in AIP
clock_t LastUpdate;// Last time update in the map
UINT CurrentTime; // 0 = morning | 1 = day | 2 = evening | 3 = night | 4+ = invalid
//TDMobList
UINT TDMobList[100]; //List of TD monsters waiting to be spawned
UINT TDNextSpawn; //index pointer for next spawn in TDMobList
UINT TDNextMon; //index pointer for next addition to TDMobList
clock_t lastTDSpawnTime; //time of the last spawn
UINT TDMobDelay; // delay between spawns (ms)
UINT crystalhealth; // current health of the base crystal
UINT portalhealth; // current health of the spawn portal
UINT mapXPRate; // exp rate for this map
vector<CRespawnPoint*> RespawnList; // RespawnZones List
vector<CSpawnArea*> MonsterSpawnList; // Monster spawn in this map
#ifdef USEIFO
vector<CMobGroup*> MobGroupList; // Spawn "Zones"
#endif
vector<CMonster*> MonsterList; // Monster List in this map
vector<CDrop*> DropsList; // Droped Items
vector<CPlayer*> PlayerList; // Client list in this map;
vector<CNPC*> NPCList; // NPC in this map
vector<CTeleGate*> TeleGateList; // Telegates from this map
std::vector<SZonPoint*> PointList;
pthread_mutex_t MonsterMutex, DropMutex;
};
#endif
-7
View File
@@ -2052,13 +2052,6 @@ bool CWorldServer::pakNPCBuy ( CPlayer* thisclient, CPacket* P )
thisclient->client->SendPacket( &pak );
thisclient->saveinventory();
return true;
//}
//__seh_except(info, context)
//{
// Log( MSG_ERROR, "Error in pakNPCBuy");
// return false;
//}
//__seh_end
}
-32
View File
@@ -360,80 +360,48 @@ void CWorldServer::ServerLoop( )
if ( activity == 0 )
{
pthread_mutex_unlock( &PlayerMutex );
#ifdef _WIN32
Sleep(1);
#else
usleep(1);
#endif
continue;
}
if ( activity < 0 && errno != EINTR )
{
#ifdef _WIN32
Log( MSG_ERROR, "Select command failed. Error #%i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Select command failed. Error #%i", errno );
#endif
isActive = false;
}
if ( FD_ISSET( sckISCII, &fds ) )
{
int clientinfolen = sizeof( sockaddr_in );
#ifdef _WIN32
NewSocket = accept( sckISCII, (sockaddr*)&ClientInfo, (int*)&clientinfolen );
#else
NewSocket = accept( sckISCII, (sockaddr*)&ClientInfo, (socklen_t*)&clientinfolen );
#endif
// TODO: check if server is full
if (NewSocket != INVALID_SOCKET)
AddUser( NewSocket, &ClientInfo, true);
else
{
#ifdef _WIN32
Log( MSG_ERROR, "Error accepting socket: %i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Error accepting socket: %i", errno );
#endif
}
}
}
if ( activity < 0 && errno != EINTR )
{
#ifdef _WIN32
Log( MSG_ERROR, "Select command failed. Error #%i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Select command failed. Error #%i", errno );
#endif
isActive = false;
}
if ( FD_ISSET( sock, &fds ) )
{
int clientinfolen = sizeof( sockaddr_in );
#ifdef _WIN32
NewSocket = accept( sock, (sockaddr*)&ClientInfo, (int*)&clientinfolen );
#else
NewSocket = accept( sock, (sockaddr*)&ClientInfo, (socklen_t*)&clientinfolen );
#endif
// TODO: check if server is full
if (NewSocket != INVALID_SOCKET)
AddUser( NewSocket, &ClientInfo, false);
else
{
#ifdef _WIN32
Log( MSG_ERROR, "Error accepting socket: %i", WSAGetLastError() );
#else
Log( MSG_ERROR, "Error accepting socket: %i", errno );
#endif
}
}
if(!Config.usethreads)
HandleClients( &fds );
pthread_mutex_unlock( &PlayerMutex );
#ifdef _WIN32
Sleep(1);
#else
usleep(1);
#endif
} while( isActive );
}
-233
View File
@@ -1,233 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{ac244676-8f9f-4498-bd17-e53746172c4b}</ProjectGuid>
<RootNamespace>WorldServer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>..\Binary</OutDir>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)../Src\3rd_party\mysql\include;$(SolutionDir)../Src\3rd_party\pthread\include;$(SolutionDir)../\Src\Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)../Src\3rd_Party\mysql\lib;$(SolutionDir)../Src\3rd_Party\pthread\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libmysql.lib;pthreadvc2.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Src\3rd_party\mysql\include\mysql.h" />
<ClInclude Include="..\Src\3rd_party\pthread\include\pthread.h" />
<ClInclude Include="..\Src\Common\config.h" />
<ClInclude Include="..\Src\Common\database\database.h" />
<ClInclude Include="..\Src\Common\log.h" />
<ClInclude Include="..\Src\Common\rosecrypt.hpp" />
<ClInclude Include="..\Src\Common\seh.hpp" />
<ClInclude Include="..\Src\Common\sockets.h" />
<ClInclude Include="..\Src\World Server\aip\AiActions.h" />
<ClInclude Include="..\Src\World Server\aip\AiConditions.h" />
<ClInclude Include="..\Src\World Server\aip\Aip.h" />
<ClInclude Include="..\Src\World Server\character.h" />
<ClInclude Include="..\Src\World Server\chartype.h" />
<ClInclude Include="..\Src\World Server\datatypes.h" />
<ClInclude Include="..\Src\World Server\party.h" />
<ClInclude Include="..\Src\World Server\player.h" />
<ClInclude Include="..\Src\World Server\QuestConditions.h" />
<ClInclude Include="..\Src\World Server\QuestTrigger.h" />
<ClInclude Include="..\Src\World Server\quest\QuestActions.h" />
<ClInclude Include="..\Src\World Server\stbhandler.h" />
<ClInclude Include="..\Src\World Server\stlhandler.h" />
<ClInclude Include="..\Src\World Server\strhashing.h" />
<ClInclude Include="..\Src\World Server\worldmap.h" />
<ClInclude Include="..\Src\World Server\WorldMonster.h" />
<ClInclude Include="..\Src\World Server\WorldServer.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Src\Common\config.cpp" />
<ClCompile Include="..\Src\Common\database\database.cpp" />
<ClCompile Include="..\Src\Common\globals.cpp" />
<ClCompile Include="..\Src\Common\log.cpp" />
<ClCompile Include="..\Src\Common\rosecrypt.cpp" />
<ClCompile Include="..\Src\Common\seh.cpp" />
<ClCompile Include="..\Src\Common\SocketBase.cpp" />
<ClCompile Include="..\Src\Common\SocketClient.cpp" />
<ClCompile Include="..\Src\Common\SocketServer.cpp" />
<ClCompile Include="..\Src\World Server\aip\AiActions.cpp" />
<ClCompile Include="..\Src\World Server\aip\AiConditions.cpp" />
<ClCompile Include="..\Src\World Server\aip\Aip.cpp" />
<ClCompile Include="..\Src\World Server\battle.cpp" />
<ClCompile Include="..\Src\World Server\Buff.cpp" />
<ClCompile Include="..\Src\World Server\character.cpp" />
<ClCompile Include="..\Src\World Server\charevent.cpp" />
<ClCompile Include="..\Src\World Server\charfunctions.cpp" />
<ClCompile Include="..\Src\World Server\charstats.cpp" />
<ClCompile Include="..\Src\World Server\clan.cpp" />
<ClCompile Include="..\Src\World Server\extrafunctions.cpp" />
<ClCompile Include="..\Src\World Server\gmcmds.cpp" />
<ClCompile Include="..\Src\World Server\itemdata.cpp" />
<ClCompile Include="..\Src\World Server\main.cpp" />
<ClCompile Include="..\Src\World Server\MainProcess.cpp" />
<ClCompile Include="..\Src\World Server\mapfunctions.cpp" />
<ClCompile Include="..\Src\World Server\Monster.cpp" />
<ClCompile Include="..\Src\World Server\MonsterDamage.cpp" />
<ClCompile Include="..\Src\World Server\MonsterEvents.cpp" />
<ClCompile Include="..\Src\World Server\monsterfunctions.cpp" />
<ClCompile Include="..\Src\World Server\MonsterStats.cpp" />
<ClCompile Include="..\Src\World Server\Party.cpp" />
<ClCompile Include="..\Src\World Server\partyfunctions.cpp" />
<ClCompile Include="..\Src\World Server\player.cpp" />
<ClCompile Include="..\Src\World Server\playerdata.cpp" />
<ClCompile Include="..\Src\World Server\playerfunctions.cpp" />
<ClCompile Include="..\Src\World Server\playerquest.cpp" />
<ClCompile Include="..\Src\World Server\playerstats.cpp" />
<ClCompile Include="..\Src\World Server\quest\QuestActions.cpp" />
<ClCompile Include="..\Src\World Server\quest\QuestConditions.cpp" />
<ClCompile Include="..\Src\World Server\quest\Quests.cpp" />
<ClCompile Include="..\Src\World Server\ServerFunctions.cpp" />
<ClCompile Include="..\Src\World Server\Signal.cpp" />
<ClCompile Include="..\Src\World Server\startup.cpp" />
<ClCompile Include="..\Src\World Server\stbhandler.cpp" />
<ClCompile Include="..\Src\World Server\stb_manager.cpp" />
<ClCompile Include="..\Src\World Server\stlhandler.cpp" />
<ClCompile Include="..\Src\World Server\strhashing.cpp" />
<ClCompile Include="..\Src\World Server\worldmap.cpp" />
<ClCompile Include="..\Src\World Server\WorldMonster.cpp" />
<ClCompile Include="..\Src\World Server\worldpackets.cpp" />
<ClCompile Include="..\Src\World Server\Worldprocess.cpp" />
<ClCompile Include="..\Src\World Server\worldserver.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
-252
View File
@@ -1,252 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Src\3rd_party\mysql\include\mysql.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\3rd_party\pthread\include\pthread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\database\database.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\rosecrypt.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\seh.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\Common\sockets.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\character.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\chartype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\datatypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\party.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\player.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\QuestConditions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\QuestTrigger.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\stbhandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\stlhandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\strhashing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\worldmap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\WorldMonster.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\WorldServer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\quest\QuestActions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\aip\Aip.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\aip\AiActions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Src\World Server\aip\AiConditions.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Src\Common\database\database.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\globals.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\rosecrypt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\seh.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketClient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\Common\SocketServer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\battle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\Buff.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\character.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\charevent.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\charfunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\charstats.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\extrafunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\gmcmds.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\itemdata.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\MainProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\mapfunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\Monster.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\MonsterDamage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\MonsterEvents.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\monsterfunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\MonsterStats.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\Party.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\partyfunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\player.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\playerdata.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\playerfunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\playerquest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\playerstats.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\ServerFunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\Signal.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\startup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\stb_manager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\stbhandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\stlhandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\strhashing.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\worldmap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\WorldMonster.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\worldpackets.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\Worldprocess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\worldserver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\clan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\quest\QuestActions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\quest\QuestConditions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\quest\Quests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\aip\Aip.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\aip\AiActions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Src\World Server\aip\AiConditions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>..\Binary</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
+14
View File
@@ -0,0 +1,14 @@
--
-- Queue table the webadmin panel writes to and the world server polls
-- (in WorldProcess, MainProcess.cpp) to execute broadcast/kick actions
-- without needing a direct socket between the two processes.
--
CREATE TABLE IF NOT EXISTS `admin_queue` (
`id` int(11) NOT NULL auto_increment,
`type` varchar(20) NOT NULL,
`payload` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`executed` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+9
View File
@@ -0,0 +1,9 @@
-- Default GM account so a fresh deploy has something to log into the
-- web admin panel and the game with. Change the password immediately on
-- any server that isn't purely local/dev -- see README.md.
--
-- username: gmadmin
-- password: changeme (stored as md5, matching Src/Login Server/loginpackets.cpp
-- and webadmin/app.py's hash_password())
INSERT INTO `accounts` (`username`, `password`, `accesslevel`, `lastlogin`, `logtime`)
VALUES ('gmadmin', MD5('changeme'), 900, '', 0);
+14 -5
View File
@@ -42,7 +42,7 @@ services:
MYSQL_USER: ${DB_USER:-rose}
MYSQL_PASSWORD: ${DB_PASSWORD:-change_me}
volumes:
- db-data:/var/lib/mysql
- "./docker/data/mysql:/var/lib/mysql"
- "./database sql files:/docker-entrypoint-initdb.d:ro"
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
@@ -85,9 +85,12 @@ services:
image: nginx:alpine
restart: unless-stopped
ports:
- "80:80"
- "${WEBTOOLS_PORT:-80}:80"
volumes:
- "./webtools:/usr/share/nginx/html:ro"
- "./docker/conf/webtools-nginx.conf:/etc/nginx/conf.d/default.conf:ro"
depends_on:
- webadmin
webadmin:
build:
@@ -101,13 +104,19 @@ services:
DB_NAME: ${DB_NAME:-ktrose}
ADMIN_SECRET_KEY: ${ADMIN_SECRET_KEY:-change-me-too}
ADMIN_MIN_ACCESSLEVEL: ${ADMIN_MIN_ACCESSLEVEL:-900}
ports:
- "8081:8080"
COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME:-ross}
volumes:
# Lets the panel start/stop/restart the login/char/world containers and
# stream their logs via the Docker API. Grants the container
# effectively root-equivalent access to the host -- acceptable here
# since the panel sits behind GM-only login and isn't internet-exposed.
- /var/run/docker.sock:/var/run/docker.sock:ro
expose:
- "8080"
depends_on:
db:
condition: service_healthy
volumes:
db-data:
logs:
clanmark:
+23
View File
@@ -0,0 +1,23 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location /admin/ {
proxy_pass http://webadmin:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Prefix /admin;
# /server/<service>/logs is an SSE stream -- buffering would delay
# lines until nginx's buffer fills instead of forwarding them live.
proxy_buffering off;
proxy_read_timeout 1h;
}
location / {
try_files $uri $uri/ =404;
}
}
+1 -1
View File
@@ -9,4 +9,4 @@ COPY app.py ./
COPY templates ./templates
EXPOSE 8080
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "2", "app:app"]
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "2", "--worker-class", "gthread", "--threads", "8", "app:app"]
+239 -3
View File
@@ -1,13 +1,22 @@
import os
import functools
import hashlib
import json
import time
import docker
import docker.errors
import pymysql
import pymysql.cursors
from flask import Flask, request, session, redirect, url_for, render_template, flash
from flask import Flask, Response, request, session, redirect, url_for, render_template, flash
from werkzeug.middleware.proxy_fix import ProxyFix
app = Flask(__name__)
app.secret_key = os.environ.get("ADMIN_SECRET_KEY", "dev-only-change-me")
# Sits behind the webtools nginx container at /admin/ (see webtools/nginx.conf);
# this reads X-Forwarded-Prefix/-Proto/-For so url_for()/redirect() produce
# correct /admin/-prefixed URLs instead of root-relative ones.
app.wsgi_app = ProxyFix(app.wsgi_app, x_prefix=1, x_proto=1, x_for=1, x_host=1)
def hash_password(plaintext):
@@ -25,11 +34,43 @@ DB_NAME = os.environ.get("DB_NAME", "ktrose")
# Only accounts with accesslevel >= this may log in to the admin panel.
ADMIN_MIN_ACCESSLEVEL = int(os.environ.get("ADMIN_MIN_ACCESSLEVEL", "900"))
COMPOSE_PROJECT_NAME = os.environ.get("COMPOSE_PROJECT_NAME", "ross")
GAME_SERVICES = ["loginserver", "charserver", "worldserver"]
_docker_client = None
def get_docker():
global _docker_client
if _docker_client is None:
_docker_client = docker.from_env()
return _docker_client
def get_service_container(service):
# Looked up by compose labels rather than a hardcoded "<project>-<service>-1"
# name, since that naming scheme isn't guaranteed across compose versions.
containers = get_docker().containers.list(
all=True,
filters={
"label": [
f"com.docker.compose.project={COMPOSE_PROJECT_NAME}",
f"com.docker.compose.service={service}",
]
},
)
return containers[0] if containers else None
CHAR_STAT_FIELDS = [
"level", "zuly", "str", "con", "dex", "_int", "cha", "sen",
"curHp", "curMp", "statp", "skillp", "stamina",
"curHp", "curMp", "statp", "skillp", "stamina", "exp", "classid",
]
# Column edited via its own <select> (populated from list_respawnzones) rather
# than a bare number input, but it's a plain int column just like the ones
# above, so the generic CHAR_STAT_FIELDS UPDATE loop handles it unchanged.
CHAR_STAT_FIELDS.append("respawnid")
def get_db():
return pymysql.connect(
@@ -253,6 +294,37 @@ def edit_character(char_id):
db = get_db()
try:
if request.method == "POST":
with db.cursor() as cur:
cur.execute("SELECT char_name FROM characters WHERE id=%s", (char_id,))
old = cur.fetchone()
if not old:
flash("Charakter nicht gefunden.")
return redirect(url_for("characters"))
new_name = request.form.get("char_name", "").strip()
if new_name and new_name != old["char_name"]:
with db.cursor() as cur:
cur.execute(
"SELECT id FROM characters WHERE char_name=%s AND id<>%s",
(new_name, char_id),
)
if cur.fetchone():
flash(f"Name '{new_name}' ist bereits vergeben.")
return redirect(url_for("edit_character", char_id=char_id))
cur.execute(
"UPDATE characters SET char_name=%s WHERE id=%s",
(new_name, char_id),
)
# namefriend is a denormalized display-name cache in other
# players' friend lists (list_friend.idfriend references
# this character's id) -- keep it in sync so renames
# don't leave stale names in friend lists.
cur.execute(
"UPDATE list_friend SET namefriend=%s WHERE idfriend=%s",
(new_name, char_id),
)
flash(f"Charakter '{old['char_name']}' umbenannt in '{new_name}'.")
values = []
set_clauses = []
for field in CHAR_STAT_FIELDS:
@@ -276,12 +348,176 @@ def edit_character(char_id):
with db.cursor() as cur:
cur.execute("SELECT * FROM characters WHERE id=%s", (char_id,))
char = cur.fetchone()
cur.execute(
"SELECT id, map, x, y FROM list_respawnzones ORDER BY map, id"
)
respawn_zones = cur.fetchall()
finally:
db.close()
if not char:
flash("Charakter nicht gefunden.")
return redirect(url_for("characters"))
return render_template("edit_character.html", char=char, stat_fields=CHAR_STAT_FIELDS)
zones_by_map = {}
for z in respawn_zones:
zones_by_map.setdefault(z["map"], []).append(z)
return render_template(
"edit_character.html",
char=char,
stat_fields=[f for f in CHAR_STAT_FIELDS if f != "respawnid"],
zones_by_map=zones_by_map,
)
@app.route("/characters/<int:char_id>/delete", methods=["POST"])
@login_required
def delete_character(char_id):
db = get_db()
try:
with db.cursor() as cur:
cur.execute("SELECT char_name FROM characters WHERE id=%s", (char_id,))
row = cur.fetchone()
if row:
cur.execute("DELETE FROM characters WHERE id=%s", (char_id,))
finally:
db.close()
if row:
flash(f"Charakter '{row['char_name']}' gelöscht.")
return redirect(url_for("characters"))
@app.route("/accounts/<int:account_id>/delete", methods=["POST"])
@login_required
def delete_account(account_id):
db = get_db()
try:
with db.cursor() as cur:
cur.execute("SELECT username FROM accounts WHERE id=%s", (account_id,))
row = cur.fetchone()
if row:
cur.execute("DELETE FROM accounts WHERE id=%s", (account_id,))
finally:
db.close()
if row:
flash(f"Account '{row['username']}' gelöscht (Charaktere bleiben erhalten).")
return redirect(url_for("accounts"))
@app.route("/accounts/<int:account_id>/kick", methods=["POST"])
@login_required
def kick_account(account_id):
# Resets the DB's stale "online" flag -- useful after a crash/kill -9
# left an account stuck thinking it's still logged in and unable to
# log back in. Does not disconnect a currently-live session.
db = get_db()
try:
with db.cursor() as cur:
cur.execute("UPDATE accounts SET online=0 WHERE id=%s", (account_id,))
finally:
db.close()
flash("Online-Status zurückgesetzt.")
return redirect(url_for("edit_account", account_id=account_id))
def queue_admin_command(cmd_type, payload):
db = get_db()
try:
with db.cursor() as cur:
cur.execute(
"INSERT INTO admin_queue (type, payload) VALUES (%s, %s)",
(cmd_type, payload),
)
finally:
db.close()
@app.route("/server")
@login_required
def server_control():
statuses = {}
for service in GAME_SERVICES:
container = get_service_container(service)
if container is None:
statuses[service] = {"status": "missing", "started_at": None}
else:
statuses[service] = {
"status": container.status,
"started_at": container.attrs.get("State", {}).get("StartedAt"),
}
db = get_db()
try:
with db.cursor() as cur:
cur.execute(
"SELECT username, lastchar FROM accounts WHERE online=1 ORDER BY username"
)
online = cur.fetchall()
finally:
db.close()
return render_template(
"server.html", statuses=statuses, services=GAME_SERVICES, online=online
)
@app.route("/server/<service>/<action>", methods=["POST"])
@login_required
def server_action(service, action):
if service not in GAME_SERVICES or action not in ("start", "stop", "restart"):
flash("Ungültige Aktion.")
return redirect(url_for("server_control"))
container = get_service_container(service)
if container is None:
flash(f"Container für '{service}' nicht gefunden.")
return redirect(url_for("server_control"))
try:
if action == "start":
container.start()
else:
getattr(container, action)(timeout=15)
except docker.errors.APIError as exc:
flash(f"Aktion fehlgeschlagen: {exc}")
else:
flash(f"{service}: {action} ausgeführt.")
return redirect(url_for("server_control"))
@app.route("/server/<service>/logs")
@login_required
def server_logs(service):
if service not in GAME_SERVICES:
return "unknown service", 404
container = get_service_container(service)
if container is None:
return "container not found", 404
def stream():
for line in container.logs(stream=True, follow=True, tail=200):
text = line.decode("utf-8", errors="replace").rstrip("\n")
yield f"data: {json.dumps(text)}\n\n"
return Response(stream(), mimetype="text/event-stream")
@app.route("/server/broadcast", methods=["POST"])
@login_required
def server_broadcast():
message = request.form.get("message", "").strip()
if not message:
flash("Nachricht darf nicht leer sein.")
else:
queue_admin_command("broadcast", message[:250])
flash("Broadcast eingereiht (wird binnen ~2s vom Worldserver gesendet).")
return redirect(url_for("server_control"))
@app.route("/server/kick", methods=["POST"])
@login_required
def server_kick():
charname = request.form.get("charname", "").strip()
if not charname:
flash("Kein Charakter angegeben.")
else:
queue_admin_command("kick", charname[:64])
flash(f"Kick für '{charname}' eingereiht.")
return redirect(url_for("server_control"))
if __name__ == "__main__":
+1
View File
@@ -1,3 +1,4 @@
Flask==3.0.3
PyMySQL==1.1.1
gunicorn==22.0.0
docker==7.1.0
+16
View File
@@ -71,6 +71,21 @@
.badge.ok { background: #163a26; color: var(--ok); }
.badge.off { background: #3a1620; color: var(--danger); }
.row-actions a { margin-right: 8px; }
.logbox {
background: #0a0b10;
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px;
height: 360px;
overflow-y: auto;
font-family: "SF Mono", Consolas, Menlo, monospace;
font-size: 12px;
white-space: pre-wrap;
word-break: break-all;
}
.service-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.service-tabs button.tab { background: #33384a; }
.service-tabs button.tab.active { background: var(--accent); }
</style>
</head>
<body>
@@ -80,6 +95,7 @@
<nav>
<a href="{{ url_for('accounts') }}">Accounts</a>
<a href="{{ url_for('characters') }}">Charaktere</a>
<a href="{{ url_for('server_control') }}">Server</a>
<a href="{{ url_for('logout') }}">Logout ({{ session['username'] }})</a>
</nav>
{% endif %}
+14 -1
View File
@@ -2,7 +2,9 @@
{% block title %}{{ account.username }} - ROSS Admin{% endblock %}
{% block content %}
<div class="card" style="max-width:480px;">
<h2 style="margin-top:0;">Account: {{ account.username }}</h2>
<h2 style="margin-top:0;">Account: {{ account.username }}
{% if account.online %}<span class="badge ok">online</span>{% else %}<span class="badge off">offline</span>{% endif %}
</h2>
<form method="post">
<label>Accesslevel (100 = normaler Spieler, 900 = Admin)</label>
<input type="number" name="accesslevel" value="{{ account.accesslevel }}">
@@ -30,4 +32,15 @@
{% endfor %}
</table>
</div>
<div class="card" style="max-width:480px;border-color:#5a2530;">
<h3 style="margin-top:0;color:var(--danger);">Gefahrenzone</h3>
<form method="post" action="{{ url_for('kick_account', account_id=account.id) }}" style="margin-bottom:12px;">
<button type="submit" class="secondary">Online-Status zurücksetzen</button>
<p style="color:var(--muted);font-size:12px;">Nützlich wenn der Account nach einem Server-Crash als "online" hängen geblieben ist und sich nicht neu einloggen kann.</p>
</form>
<form method="post" action="{{ url_for('delete_account', account_id=account.id) }}"
onsubmit="return confirm('Account {{ account.username }} wirklich unwiderruflich löschen? (Charaktere bleiben erhalten)');">
<button type="submit" style="background:var(--danger);">Account löschen</button>
</form>
</div>
{% endblock %}
+23 -1
View File
@@ -4,7 +4,22 @@
<div class="card" style="max-width:600px;">
<h2 style="margin-top:0;">Charakter: {{ char.char_name }} <span class="badge ok">Account: {{ char.account_name }}</span></h2>
<form method="post">
<div class="grid">
<label>Charaktername</label>
<input type="text" name="char_name" value="{{ char.char_name }}" required>
<label>Standort (wirkt beim nächsten Login)</label>
<select name="respawnid">
<option value="{{ char.respawnid }}">-- aktuell: Zone #{{ char.respawnid }} --</option>
{% for map, zones in zones_by_map.items() %}
<optgroup label="Map {{ map }}">
{% for z in zones %}
<option value="{{ z.id }}">Map {{ z.map }} - Zone #{{ z.id }} ({{ '%.0f' % z.x }}, {{ '%.0f' % z.y }})</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>
<div class="grid" style="margin-top:12px;">
{% for field in stat_fields %}
<div>
<label>{{ field.lstrip('_') }}</label>
@@ -20,4 +35,11 @@
</div>
</form>
</div>
<div class="card" style="max-width:600px;border-color:#5a2530;">
<h3 style="margin-top:0;color:var(--danger);">Gefahrenzone</h3>
<form method="post" action="{{ url_for('delete_character', char_id=char.id) }}"
onsubmit="return confirm('Charakter {{ char.char_name }} wirklich unwiderruflich löschen?');">
<button type="submit" style="background:var(--danger);">Charakter löschen</button>
</form>
</div>
{% endblock %}
+103
View File
@@ -0,0 +1,103 @@
{% extends "base.html" %}
{% block title %}Server – ROSS Admin{% endblock %}
{% block content %}
<h2>Serversteuerung</h2>
<div class="card">
<table>
<thead><tr><th>Dienst</th><th>Status</th><th>Gestartet</th><th></th></tr></thead>
<tbody>
{% for service in services %}
<tr>
<td>{{ service }}</td>
<td>
{% set st = statuses[service]['status'] %}
<span class="badge {{ 'ok' if st == 'running' else 'off' }}">{{ st }}</span>
</td>
<td>{{ statuses[service]['started_at'] or '-' }}</td>
<td class="row-actions">
<form class="inline" method="post" action="{{ url_for('server_action', service=service, action='start') }}">
<button type="submit">Start</button>
</form>
<form class="inline" method="post" action="{{ url_for('server_action', service=service, action='restart') }}">
<button type="submit" class="secondary">Restart</button>
</form>
<form class="inline" method="post" action="{{ url_for('server_action', service=service, action='stop') }}"
onsubmit="return confirm('{{ service }} wirklich stoppen?');">
<button type="submit" class="secondary" style="background:var(--danger)">Stop</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="card">
<h3 style="margin-top:0">Live-Logs</h3>
<div class="service-tabs">
{% for service in services %}
<button type="button" class="tab {{ 'active' if loop.first else '' }}" data-service="{{ service }}" onclick="switchLog('{{ service }}')">{{ service }}</button>
{% endfor %}
</div>
<div id="logbox" class="logbox"></div>
</div>
<div class="grid">
<div class="card">
<h3 style="margin-top:0">Broadcast</h3>
<form method="post" action="{{ url_for('server_broadcast') }}">
<label>Nachricht an alle Spieler</label>
<input type="text" name="message" maxlength="250" required>
<div style="margin-top:12px"><button type="submit">Senden</button></div>
</form>
</div>
<div class="card">
<h3 style="margin-top:0">Online-Spieler</h3>
{% if online %}
<table>
<thead><tr><th>Account</th><th>Charakter</th><th></th></tr></thead>
<tbody>
{% for row in online %}
<tr>
<td>{{ row['username'] }}</td>
<td>{{ row['lastchar'] }}</td>
<td class="row-actions">
<form class="inline" method="post" action="{{ url_for('server_kick') }}"
onsubmit="return confirm('{{ row['lastchar'] }} kicken?');">
<input type="hidden" name="charname" value="{{ row['lastchar'] }}">
<button type="submit" class="secondary" style="background:var(--danger)">Kick</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p style="color:var(--muted)">Niemand online.</p>
{% endif %}
</div>
</div>
<script>
let currentSource = null;
function switchLog(service) {
document.querySelectorAll('.service-tabs .tab').forEach(function(btn) {
btn.classList.toggle('active', btn.dataset.service === service);
});
const box = document.getElementById('logbox');
box.textContent = '';
if (currentSource) currentSource.close();
currentSource = new EventSource('{{ url_for("server_logs", service="__SERVICE__") }}'.replace('__SERVICE__', service));
currentSource.onmessage = function(ev) {
const line = JSON.parse(ev.data);
const atBottom = box.scrollHeight - box.scrollTop - box.clientHeight < 40;
box.textContent += line + '\n';
if (atBottom) box.scrollTop = box.scrollHeight;
};
}
switchLog('{{ services[0] }}');
window.addEventListener('beforeunload', function() { if (currentSource) currentSource.close(); });
</script>
{% endblock %}
+141 -9
View File
@@ -56,13 +56,15 @@
.brand .sub{font-size:0.7rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-faint); margin-top:2px;}
.tabs{display:flex; flex-direction:column; gap:3px;}
.tab{
.tab, .tab-link{
display:flex; align-items:center; gap:9px; padding:9px 11px; border-radius:8px;
font-size:0.9rem; color:var(--ink-dim); cursor:pointer; border:1px solid transparent;
text-decoration:none;
}
.tab:hover{background:var(--bg-card); color:var(--ink);}
.tab:hover, .tab-link:hover{background:var(--bg-card); color:var(--ink);}
.tab.active{background:var(--bg-card); border-color:var(--line); color:var(--ink); font-weight:600;}
.tab .ico{font-size:1rem; width:1.2em; text-align:center;}
.tab .ico, .tab-link .ico{font-size:1rem; width:1.2em; text-align:center;}
.tab-link{border-top:1px solid var(--line); margin-top:6px; padding-top:12px;}
.side-panel{display:none; flex-direction:column; gap:10px;}
.side-panel.active{display:flex;}
@@ -173,6 +175,9 @@
<div class="tab active" data-view="commands"><span class="ico">⌘</span> GM Commands</div>
<div class="tab" data-view="items"><span class="ico">◆</span> Item Configurator</div>
<div class="tab" data-view="maps"><span class="ico">⌗</span> Maps</div>
<div class="tab" data-view="npcs"><span class="ico">☺</span> NPCs</div>
<div class="tab" data-view="monsters"><span class="ico">☠</span> Monsters</div>
<a class="tab-link" href="/admin/"><span class="ico">⚙</span> Admin Panel</a>
</nav>
<div class="side-panel active" id="panel-commands">
@@ -197,6 +202,22 @@
</select>
</div>
<div class="side-panel" id="panel-npcs">
<div class="label">Map</div>
<select id="npc-map"></select>
<div class="label">Search by name</div>
<input id="q-npcs" type="text" placeholder="e.g. Lampa" autocomplete="off" />
</div>
<div class="side-panel" id="panel-monsters">
<div class="label">Spawn count</div>
<input id="mon-count" type="number" value="1" min="1" />
<div class="label">AI (0 = default)</div>
<input id="mon-ai" type="number" value="0" min="0" />
<div class="label">Search by name or id</div>
<input id="q-monsters" type="text" placeholder="e.g. jelly, or 210" autocomplete="off" />
</div>
<div class="legend" id="legend-commands">
<div class="row"><span class="pill pill-any">any</span> usable by any GM character</div>
<div class="row"><span class="pill pill-gm">gm 300+</span> accesslevel ≥ 300</div>
@@ -251,17 +272,39 @@
<section class="view" id="view-maps">
<div class="pagehead">
<h1>Every map with active spawn or NPC data</h1>
<p>Aggregated live from <code>list_special_spawns</code> and <code>list_npcs</code>.</p>
<p>Names pulled straight from <code>LIST_ZONE.STB</code> (row index = map id, same as <code>CWorldServer::LoadZoneData</code>
uses server-side); spawn/NPC counts aggregated live from <code>list_special_spawns</code> and <code>list_npcs</code>.</p>
</div>
<div class="map-empty-note">
No minimap images or display names are shown here — this repo only ships the server side of KTRose, not the
client's 3D/texture assets, and the localized zone-name strings aren't parsed by the server's simplified STB
loader either. What's below (spawn counts, monster totals, coordinate bounds) is real, queried straight from
the running database.
No minimap images are shipped here — this repo only ships the server side of KTRose, not the client's 3D/texture
assets. A handful of zone names are untranslated Korean (the dev-tool STB just was never localized for those rows).
</div>
<div class="map-grid" id="results-maps"></div>
</section>
<!-- ===================== NPCS ===================== -->
<section class="view" id="view-npcs">
<div class="pagehead">
<h1>Every placed NPC, with exact coordinates</h1>
<p>Straight out of <code>list_npcs</code>. Click a card to copy the matching <code>/tele</code> command
and warp straight to it as GM.</p>
</div>
<div class="resultmeta" id="resultmeta-npcs"></div>
<div class="item-grid" id="results-npcs"></div>
</section>
<!-- ===================== MONSTERS ===================== -->
<section class="view" id="view-monsters">
<div class="pagehead">
<h1>Every monster/NPC type, ready to spawn</h1>
<p>1,193 named entries straight out of <code>LIST_NPC.STB</code> (row index = <code>montype</code>, the same
id <code>/mon</code> and <code>/spawn</code> expect). Click one to copy a ready-to-paste <code>/mon</code>
command that drops it next to you.</p>
</div>
<div class="resultmeta" id="resultmeta-monsters"></div>
<div class="item-grid" id="results-monsters"></div>
</section>
</main>
</div>
@@ -453,7 +496,7 @@ function renderMaps(){
? `<div>X range</div><b>${m.bounds.minX} – ${m.bounds.maxX}</b><div>Y range</div><b>${m.bounds.minY} – ${m.bounds.maxY}</b>`
: `<div>Coordinates</div><b>no spawn data</b><div></div><b></b>`;
el.innerHTML = `
<h3>Map ${m.id}</h3>
<h3>${m.name || ("Map "+m.id)} <span style="color:var(--ink-faint); font-weight:400;">#${m.id}</span></h3>
${m.note ? `<div class="note">${m.note}</div>` : ""}
<div class="map-stats">
<div>Spawn points</div><b>${m.spawnPoints}</b>
@@ -466,6 +509,81 @@ function renderMaps(){
}
document.getElementById("map-sort").addEventListener("change", renderMaps);
/* ---------------- NPCS TAB ---------------- */
let NPCS = [];
function renderNpcs(){
const root = document.getElementById("results-npcs");
const meta = document.getElementById("resultmeta-npcs");
const map = document.getElementById("npc-map").value;
const q = document.getElementById("q-npcs").value.trim().toLowerCase();
root.innerHTML = "";
let filtered = NPCS;
if(map !== "__all__") filtered = filtered.filter(n => String(n.map) === map);
if(q) filtered = filtered.filter(n => n.name.toLowerCase().includes(q));
filtered.forEach(n=>{
const el = document.createElement("div");
el.className = "item-card";
const tele = `/tele ${n.map} ${n.x} ${n.y}`;
el.innerHTML = `<div class="nm">${n.name}</div><div class="id">map ${n.map} · x ${n.x} · y ${n.y}</div>`;
el.title = "Click to copy: " + tele;
el.addEventListener("click", ()=>{
copyText(tele);
const nm = el.querySelector(".nm");
const prev = nm.textContent;
nm.textContent = "Copied: " + tele;
setTimeout(()=>{ nm.textContent = prev; }, 1200);
});
root.appendChild(el);
});
if(filtered.length===0) root.innerHTML = `<div class="empty">No NPC matches.</div>`;
meta.textContent = `${filtered.length} of ${NPCS.length} NPCs`;
}
document.getElementById("q-npcs").addEventListener("input", renderNpcs);
document.getElementById("npc-map").addEventListener("change", renderNpcs);
/* ---------------- MONSTERS TAB ---------------- */
let MONSTERS = [];
function renderMonsters(){
const root = document.getElementById("results-monsters");
const meta = document.getElementById("resultmeta-monsters");
const q = document.getElementById("q-monsters").value.trim().toLowerCase();
root.innerHTML = "";
let filtered = MONSTERS;
if(q) filtered = filtered.filter(m => m.name.toLowerCase().includes(q) || String(m.id)===q);
const CAP = 180;
const total = filtered.length;
const shown = filtered.slice(0, CAP);
shown.forEach(m=>{
const el = document.createElement("div");
el.className = "item-card";
el.innerHTML = `<div class="nm">${m.name}</div><div class="id">montype ${m.id}</div>`;
el.addEventListener("click", ()=>{
const count = document.getElementById("mon-count").value || 1;
const ai = document.getElementById("mon-ai").value || 0;
const cmd = `/mon ${m.id} ${count} ${ai}`;
copyText(cmd);
const nm = el.querySelector(".nm");
const prev = nm.textContent;
nm.textContent = "Copied: " + cmd;
setTimeout(()=>{ nm.textContent = prev; }, 1200);
});
root.appendChild(el);
});
if(total===0) root.innerHTML = `<div class="empty">No monster matches.</div>`;
meta.textContent = total > CAP
? `Showing first ${CAP} of ${total} matches — narrow your search to see more.`
: `${total} of ${MONSTERS.length} monster types`;
}
document.getElementById("q-monsters").addEventListener("input", renderMonsters);
document.getElementById("mon-count").addEventListener("input", renderMonsters);
document.getElementById("mon-ai").addEventListener("input", renderMonsters);
/* ---------------- boot ---------------- */
buildCommandsNav();
renderCommands("");
@@ -482,6 +600,20 @@ fetch("maps.json").then(r=>r.json()).then(data=>{
MAPS = data;
renderMaps();
});
fetch("npcs.json").then(r=>r.json()).then(data=>{
NPCS = data;
const maps = [...new Set(data.map(n=>n.map))].sort((a,b)=>a-b);
const sel = document.getElementById("npc-map");
sel.innerHTML = `<option value="__all__">All maps</option>` +
maps.map(m=>`<option value="${m}">Map ${m}</option>`).join("");
renderNpcs();
});
fetch("monsters.json").then(r=>r.json()).then(data=>{
MONSTERS = data;
renderMonsters();
});
</script>
</body>
</html>
+331 -30
View File
@@ -1,32 +1,333 @@
[
{"id":1,"spawnPoints":45,"totalMonsters":225,"npcCount":22,"bounds":{"minX":5097,"maxX":5500,"minY":5050,"maxY":5448}},
{"id":2,"spawnPoints":43,"totalMonsters":92,"npcCount":27,"bounds":{"minX":5075,"maxX":5767,"minY":5433,"maxY":5535}},
{"id":3,"spawnPoints":0,"totalMonsters":0,"npcCount":1,"bounds":null},
{"id":5,"spawnPoints":0,"totalMonsters":0,"npcCount":2,"bounds":null},
{"id":6,"spawnPoints":0,"totalMonsters":0,"npcCount":1,"bounds":null},
{"id":9,"spawnPoints":0,"totalMonsters":0,"npcCount":2,"bounds":null},
{"id":11,"spawnPoints":0,"totalMonsters":0,"npcCount":4,"bounds":null},
{"id":12,"spawnPoints":0,"totalMonsters":0,"npcCount":4,"bounds":null},
{"id":13,"spawnPoints":0,"totalMonsters":0,"npcCount":4,"bounds":null},
{"id":15,"spawnPoints":0,"totalMonsters":0,"npcCount":18,"bounds":null},
{"id":20,"spawnPoints":46,"totalMonsters":455,"npcCount":5,"bounds":{"minX":5030,"maxX":5713,"minY":4738,"maxY":5375},"note":"default respawn/town map (townid=20 in characters table)"},
{"id":21,"spawnPoints":43,"totalMonsters":183,"npcCount":3,"bounds":{"minX":5098,"maxX":5435,"minY":5053,"maxY":5505}},
{"id":22,"spawnPoints":52,"totalMonsters":415,"npcCount":9,"bounds":{"minX":4983,"maxX":5748,"minY":4995,"maxY":5485}},
{"id":23,"spawnPoints":44,"totalMonsters":201,"npcCount":4,"bounds":{"minX":5053,"maxX":5512,"minY":4900,"maxY":5498}},
{"id":24,"spawnPoints":63,"totalMonsters":281,"npcCount":3,"bounds":{"minX":5053,"maxX":5685,"minY":4998,"maxY":5530}},
{"id":25,"spawnPoints":74,"totalMonsters":232,"npcCount":3,"bounds":{"minX":5023,"maxX":5688,"minY":4871,"maxY":5520}},
{"id":26,"spawnPoints":97,"totalMonsters":241,"npcCount":1,"bounds":{"minX":5053,"maxX":5695,"minY":4873,"maxY":5544}},
{"id":27,"spawnPoints":100,"totalMonsters":250,"npcCount":5,"bounds":{"minX":5005,"maxX":5831,"minY":4979,"maxY":5509}},
{"id":28,"spawnPoints":55,"totalMonsters":126,"npcCount":1,"bounds":{"minX":5027,"maxX":5567,"minY":4769,"maxY":5518}},
{"id":31,"spawnPoints":27,"totalMonsters":75,"npcCount":0,"bounds":{"minX":5028,"maxX":5446,"minY":5057,"maxY":5449}},
{"id":32,"spawnPoints":31,"totalMonsters":74,"npcCount":0,"bounds":{"minX":5079,"maxX":5523,"minY":5138,"maxY":5541}},
{"id":33,"spawnPoints":2,"totalMonsters":20,"npcCount":0,"bounds":{"minX":5246,"maxX":5251,"minY":5352,"maxY":5372}},
{"id":37,"spawnPoints":0,"totalMonsters":0,"npcCount":1,"bounds":null},
{"id":38,"spawnPoints":7,"totalMonsters":53,"npcCount":2,"bounds":{"minX":5080,"maxX":5164,"minY":5371,"maxY":5478}},
{"id":40,"spawnPoints":0,"totalMonsters":0,"npcCount":1,"bounds":null},
{"id":51,"spawnPoints":35,"totalMonsters":103,"npcCount":9,"bounds":{"minX":5048,"maxX":5640,"minY":4710,"maxY":5296}},
{"id":52,"spawnPoints":49,"totalMonsters":176,"npcCount":0,"bounds":{"minX":5041,"maxX":6111,"minY":4467,"maxY":5271}},
{"id":54,"spawnPoints":56,"totalMonsters":156,"npcCount":1,"bounds":{"minX":5057,"maxX":5645,"minY":4285,"maxY":5313}},
{"id":61,"spawnPoints":0,"totalMonsters":0,"npcCount":17,"bounds":null},
{"id":62,"spawnPoints":0,"totalMonsters":0,"npcCount":8,"bounds":null}
{
"id": 1,
"name": "Canyon City of Zant",
"spawnPoints": 45,
"totalMonsters": 225,
"npcCount": 22,
"bounds": {
"minX": 5097,
"maxX": 5500,
"minY": 5050,
"maxY": 5448
}
},
{
"id": 2,
"name": "City of Junon Polis",
"spawnPoints": 43,
"totalMonsters": 92,
"npcCount": 27,
"bounds": {
"minX": 5075,
"maxX": 5767,
"minY": 5433,
"maxY": 5535
}
},
{
"id": 3,
"name": "Dolphin Island",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 1,
"bounds": null
},
{
"id": 5,
"name": "Junon Cartel",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 2,
"bounds": null
},
{
"id": 6,
"name": "Crusader Training Camp",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 1,
"bounds": null
},
{
"id": 9,
"name": "주논카르텔",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 2,
"bounds": null
},
{
"id": 11,
"name": "Junon Clan Field",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 4,
"bounds": null
},
{
"id": 12,
"name": "Junon Clan Field",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 4,
"bounds": null
},
{
"id": 13,
"name": "Junon Clan Field",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 4,
"bounds": null
},
{
"id": 15,
"name": "클랜아지트",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 18,
"bounds": null
},
{
"id": 20,
"name": "Birth Island",
"spawnPoints": 46,
"totalMonsters": 455,
"npcCount": 5,
"bounds": {
"minX": 5030,
"maxX": 5713,
"minY": 4738,
"maxY": 5375
},
"note": "default respawn/town map (townid=20 in characters table)"
},
{
"id": 21,
"name": "Valley of Luxem Tower",
"spawnPoints": 43,
"totalMonsters": 183,
"npcCount": 3,
"bounds": {
"minX": 5098,
"maxX": 5435,
"minY": 5053,
"maxY": 5505
}
},
{
"id": 22,
"name": "Adventurer's Plains",
"spawnPoints": 52,
"totalMonsters": 415,
"npcCount": 9,
"bounds": {
"minX": 4983,
"maxX": 5748,
"minY": 4995,
"maxY": 5485
}
},
{
"id": 23,
"name": "Breezy Hills",
"spawnPoints": 44,
"totalMonsters": 201,
"npcCount": 4,
"bounds": {
"minX": 5053,
"maxX": 5512,
"minY": 4900,
"maxY": 5498
}
},
{
"id": 24,
"name": "El Verloon Desert",
"spawnPoints": 63,
"totalMonsters": 281,
"npcCount": 3,
"bounds": {
"minX": 5053,
"maxX": 5685,
"minY": 4998,
"maxY": 5530
}
},
{
"id": 25,
"name": "Anima Lake",
"spawnPoints": 74,
"totalMonsters": 232,
"npcCount": 3,
"bounds": {
"minX": 5023,
"maxX": 5688,
"minY": 4871,
"maxY": 5520
}
},
{
"id": 26,
"name": "Forest of Wisdom",
"spawnPoints": 97,
"totalMonsters": 241,
"npcCount": 1,
"bounds": {
"minX": 5053,
"maxX": 5695,
"minY": 4873,
"maxY": 5544
}
},
{
"id": 27,
"name": "Kenji Beach",
"spawnPoints": 100,
"totalMonsters": 250,
"npcCount": 5,
"bounds": {
"minX": 5005,
"maxX": 5831,
"minY": 4979,
"maxY": 5509
}
},
{
"id": 28,
"name": "Gorge of Silence",
"spawnPoints": 55,
"totalMonsters": 126,
"npcCount": 1,
"bounds": {
"minX": 5027,
"maxX": 5567,
"minY": 4769,
"maxY": 5518
}
},
{
"id": 31,
"name": "Goblin Cave (B1)",
"spawnPoints": 27,
"totalMonsters": 75,
"npcCount": 0,
"bounds": {
"minX": 5028,
"maxX": 5446,
"minY": 5057,
"maxY": 5449
}
},
{
"id": 32,
"name": "Goblin Cave (B2)",
"spawnPoints": 31,
"totalMonsters": 74,
"npcCount": 0,
"bounds": {
"minX": 5079,
"maxX": 5523,
"minY": 5138,
"maxY": 5541
}
},
{
"id": 33,
"name": "Goblin Cave (B3)",
"spawnPoints": 2,
"totalMonsters": 20,
"npcCount": 0,
"bounds": {
"minX": 5246,
"maxX": 5251,
"minY": 5352,
"maxY": 5372
}
},
{
"id": 37,
"name": "Sunshine Coast",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 1,
"bounds": null
},
{
"id": 38,
"name": "Santa Planetoid",
"spawnPoints": 7,
"totalMonsters": 53,
"npcCount": 2,
"bounds": {
"minX": 5080,
"maxX": 5164,
"minY": 5371,
"maxY": 5478
}
},
{
"id": 40,
"name": "Grand Ballroom",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 1,
"bounds": null
},
{
"id": 51,
"name": "Magic City of the Eucar",
"spawnPoints": 35,
"totalMonsters": 103,
"npcCount": 9,
"bounds": {
"minX": 5048,
"maxX": 5640,
"minY": 4710,
"maxY": 5296
}
},
{
"id": 52,
"name": "Mana Snowfields",
"spawnPoints": 49,
"totalMonsters": 176,
"npcCount": 0,
"bounds": {
"minX": 5041,
"maxX": 6111,
"minY": 4467,
"maxY": 5271
}
},
{
"id": 54,
"name": "Crystal Snowfields",
"spawnPoints": 56,
"totalMonsters": 156,
"npcCount": 1,
"bounds": {
"minX": 5057,
"maxX": 5645,
"minY": 4285,
"maxY": 5313
}
},
{
"id": 61,
"name": "피난처시타",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 17,
"bounds": null
},
{
"id": 62,
"name": "그림자정글",
"spawnPoints": 0,
"totalMonsters": 0,
"npcCount": 8,
"bounds": null
}
]
+1
View File
@@ -0,0 +1 @@
[{"id":1,"name":"Mini-Jelly Bean"},{"id":2,"name":"Jelly Bean"},{"id":3,"name":"Jelly Nut"},{"id":4,"name":"Royal Jelly Bean"},{"id":5,"name":"Red Jelly Bean"},{"id":8,"name":"Butterfly"},{"id":9,"name":"Butterfly"},{"id":10,"name":"Butterfly"},{"id":11,"name":"Mini-Choropy"},{"id":12,"name":"Choropy"},{"id":13,"name":"Mother Choropy"},{"id":15,"name":"Spotted Choropy"},{"id":21,"name":"Pumpkin"},{"id":22,"name":"Big Pumpkin"},{"id":23,"name":"Elder Pumpkin"},{"id":24,"name":"Cowboy Pumpkin"},{"id":31,"name":"Dalping"},{"id":32,"name":"Ranger Dalping"},{"id":33,"name":"Hunter Dalping"},{"id":34,"name":"Dalping Leader"},{"id":41,"name":"Flanae"},{"id":42,"name":"Elder Flanae"},{"id":43,"name":"Red Flanae"},{"id":44,"name":"Old Flanae"},{"id":45,"name":"Big Flanae"},{"id":51,"name":"Smouly"},{"id":52,"name":"Elder Smouly"},{"id":53,"name":"Old Smouly"},{"id":61,"name":"Needle Honey Bee"},{"id":62,"name":"Honey Bee"},{"id":63,"name":"Needle Hornet"},{"id":64,"name":"Hornet"},{"id":67,"name":"Queen Honey Bee"},{"id":68,"name":"Queen Bibi"},{"id":69,"name":"Master Queen Bibi"},{"id":71,"name":"Needle Pomic"},{"id":72,"name":"Pomic"},{"id":73,"name":"Red Pomic"},{"id":74,"name":"Pomic Soldier"},{"id":75,"name":"Pomic Fighter"},{"id":76,"name":"Pomic Giant"},{"id":81,"name":"Beetle"},{"id":82,"name":"Beetle Fighter"},{"id":84,"name":"Turtle"},{"id":85,"name":"Turtle Guard"},{"id":87,"name":"Crack"},{"id":88,"name":"Crack Fighter"},{"id":91,"name":"Honey Rackie"},{"id":92,"name":"Rackie Hooligan"},{"id":93,"name":"Fighter Rackie"},{"id":94,"name":"Rackie Hooligan"},{"id":95,"name":"Purified Rackie"},{"id":96,"name":"Hunter Rackie"},{"id":97,"name":"Purified Rackie"},{"id":98,"name":"Purified Rackie"},{"id":99,"name":"Purified Rackie"},{"id":101,"name":"Woopie"},{"id":102,"name":"Woopie Chef"},{"id":103,"name":"Woopie Glutton"},{"id":111,"name":"Moldie"},{"id":112,"name":"Coal Mine Moldie"},{"id":113,"name":"Gold Mine Moldie"},{"id":114,"name":"Captain Moldie"},{"id":121,"name":"Krawfy"},{"id":122,"name":"Krawfy Warrior"},{"id":123,"name":"Krawfy Captain"},{"id":127,"name":"Krawfy Warrior"},{"id":128,"name":"Doonga Hunter"},{"id":129,"name":"Krawfy Captain"},{"id":130,"name":"Doonga Captain"},{"id":131,"name":"Mini-Porkie"},{"id":132,"name":"Porkie"},{"id":133,"name":"Porkie Hooligan"},{"id":134,"name":"Grunter"},{"id":135,"name":"Grunter Fighter"},{"id":136,"name":"Grunter Warrior"},{"id":138,"name":"Grunter Leader"},{"id":139,"name":"Grunter Captain"},{"id":141,"name":"Kaiman"},{"id":142,"name":"Kaiman Guard"},{"id":143,"name":"Kaiman Warrior"},{"id":144,"name":"Kaiman Ranger"},{"id":145,"name":"Kaiman Hunter"},{"id":151,"name":"Doonga"},{"id":152,"name":"Elder Doonga"},{"id":153,"name":"Doonga Origin"},{"id":154,"name":"Doonga Fighter"},{"id":155,"name":"Doonga Warrior"},{"id":156,"name":"Doonga Hunter"},{"id":157,"name":"Doonga Leader"},{"id":158,"name":"Doonga Captain"},{"id":159,"name":"Master Doonga"},{"id":161,"name":"Jewel Golem"},{"id":162,"name":"Junon's Golem"},{"id":163,"name":"Master Golem"},{"id":164,"name":"Stone Golem"},{"id":165,"name":"Elder Stone Golem"},{"id":166,"name":"Master Stone Golem"},{"id":169,"name":"Grandmaster Golem"},{"id":171,"name":"Aqua Guard"},{"id":172,"name":"Aqua Warrior"},{"id":173,"name":"Aqua Captain"},{"id":175,"name":"Aqua Ranger"},{"id":176,"name":"Aqua Hunter"},{"id":177,"name":"Aqua Hunter"},{"id":178,"name":"Aqua Captain"},{"id":179,"name":"Coal Mine Moldie"},{"id":180,"name":"Captain Moldie"},{"id":181,"name":"Small Clown"},{"id":182,"name":"Clown"},{"id":183,"name":"Fighter Clown"},{"id":185,"name":"Ranger Clown"},{"id":186,"name":"Hunter Clown"},{"id":187,"name":"Grunter Warrior"},{"id":188,"name":"Old Smouly"},{"id":189,"name":"Hunter Clown"},{"id":190,"name":"Grunter Captain"},{"id":192,"name":"Elder Stone Golem"},{"id":193,"name":"Junon's Golem"},{"id":194,"name":"Master Stone Golem"},{"id":196,"name":"Goblin Guard"},{"id":197,"name":"Goblin Mage"},{"id":198,"name":"Goblin Leader"},{"id":201,"name":"Worm Dragon"},{"id":202,"name":"Little Worm Dragon"},{"id":203,"name":"Jelly King"},{"id":204,"name":"Wandering Rackie"},{"id":205,"name":"Woopie King"},{"id":206,"name":"Wild Gorilla"},{"id":207,"name":"Aqua King"},{"id":208,"name":"Guardian Tree"},{"id":209,"name":"Grunter King"},{"id":210,"name":"Scarab"},{"id":211,"name":"Junon's Doongoliath"},{"id":212,"name":"Krawfy King"},{"id":213,"name":"Aqua Giant"},{"id":215,"name":"Aqua Guardian"},{"id":216,"name":"Grunter Guardian"},{"id":217,"name":"Krawfy Guardian"},{"id":218,"name":"Golem Guardian"},{"id":219,"name":"Goblin Guardian"},{"id":222,"name":"Grunter King"},{"id":223,"name":"Krawfy King"},{"id":224,"name":"Grandmaster Golem"},{"id":226,"name":"Flanae"},{"id":227,"name":"Flanae"},{"id":228,"name":"Elder Flanae"},{"id":229,"name":"Red Flanae"},{"id":230,"name":"Melendino"},{"id":231,"name":"Zombie"},{"id":251,"name":"Candle Ghost"},{"id":252,"name":"Electric Ghost"},{"id":254,"name":"Stone Golem"},{"id":256,"Line truncated
+1
View File
@@ -0,0 +1 @@
[{"id":13,"name":"[Akram Kingdom Minister] Warren","map":1,"x":5209,"y":5113},{"id":19,"name":"[Armor Seller] Carrion","map":1,"x":5314,"y":5198},{"id":16,"name":"[Arumic Merchant] Tryteh","map":1,"x":5313,"y":5154},{"id":4,"name":"[Co-Founder of the Junon Order] Francis","map":1,"x":5080,"y":5066},{"id":15,"name":"[Cornell's Grandson] Cheney","map":1,"x":5439,"y":5492},{"id":6,"name":"[Designer] Keenu","map":1,"x":5274,"y":5257},{"id":7,"name":"[Eccentric Inventor] Spero","map":1,"x":5212,"y":5255},{"id":11,"name":"[Event Info] Judy","map":1,"x":5262,"y":5213},{"id":2,"name":"[Ferrell Guild Staff] Crow","map":1,"x":5094,"y":5260},{"id":3,"name":"[Ferrell Guild Staff] Ulysses","map":1,"x":5071,"y":5207},{"id":10,"name":"[Guide] Lena","map":1,"x":5240,"y":5125},{"id":17,"name":"[Gypsy Jewel Seller] Mina","map":1,"x":5293,"y":5128},{"id":20,"name":"[Keenu's Daughter] Arisa","map":1,"x":5429,"y":5084},{"id":158,"name":"[Kuro-Tejina Staff] Buffy","map":1,"x":5226,"y":5218},{"id":21,"name":"[Lena's Sister] Shirley","map":1,"x":5510,"y":5293},{"id":1,"name":"[Livestock Farmer] Lampa","map":1,"x":5109,"y":5364},{"id":9,"name":"[Resident] Luth","map":1,"x":5131,"y":5155},{"id":5,"name":"[Righteous Crusader] Leonard","map":1,"x":5261,"y":5167},{"id":8,"name":"[Tavern Owner] Sharlin","map":1,"x":5132,"y":5218},{"id":12,"name":"[Teleporter] Selladin","map":1,"x":5247,"y":5223},{"id":14,"name":"[Village Chief] Cornell","map":1,"x":5218,"y":5113},{"id":18,"name":"[Weapon Seller] Raffle","map":1,"x":5302,"y":5232},{"id":36,"name":"[Armor Merchant] Saki","map":2,"x":5722,"y":5291},{"id":43,"name":"[Arumic Merchant] Chester","map":2,"x":5724,"y":5087},{"id":47,"name":"[Arumic Researcher] Carasia","map":2,"x":5731,"y":5094},{"id":24,"name":"[Clan Owner] Burtland","map":2,"x":5289,"y":5264},{"id":40,"name":"[Designer] Lisa","map":2,"x":5729,"y":5136},{"id":27,"name":"[Elder of Junon Order] Gorthein","map":2,"x":5326,"y":5095},{"id":32,"name":"[Event Info] Felice Fete","map":2,"x":5562,"y":5165},{"id":41,"name":"[Ferrell Guild Merchant] Mildun","map":2,"x":5673,"y":5194},{"id":37,"name":"[Ferrell Guild Staff] Charrs","map":2,"x":5713,"y":5369},{"id":45,"name":"[Ferrell Guild Staff] Hayen","map":2,"x":5604,"y":5046},{"id":46,"name":"[Ferrell Guild Staff] Itz","map":2,"x":5604,"y":5035},{"id":44,"name":"[Ferrell Guild Staff] Kiroth","map":2,"x":5604,"y":5058},{"id":26,"name":"[Founder of Junon Order] Raw","map":2,"x":5319,"y":5095},{"id":33,"name":"[Guide] Alphonso","map":2,"x":5521,"y":5064},{"id":28,"name":"[Guide] Eva","map":2,"x":5506,"y":5346},{"id":38,"name":"[Gypsy Jewel Seller] Bellia","map":2,"x":5725,"y":5199},{"id":34,"name":"[Historian] Jones","map":2,"x":5578,"y":4890},{"id":48,"name":"[Livestock Farmer] Sicru","map":2,"x":5818,"y":5488},{"id":35,"name":"[Manager of Ferrell] Arothel","map":2,"x":5713,"y":5360},{"id":31,"name":"[Mayor] Darren","map":2,"x":5514,"y":5238},{"id":22,"name":"[Righteous Crusader] Gawain","map":2,"x":5335,"y":5354},{"id":23,"name":"[Righteous Crusader] Huffe","map":2,"x":5335,"y":5346},{"id":29,"name":"[Soldier] Odelo","map":2,"x":5507,"y":5397},{"id":30,"name":"[Soldier] Winters","map":2,"x":5523,"y":5398},{"id":42,"name":"[Tavern Owner] Harin","map":2,"x":5682,"y":5131},{"id":25,"name":"[Teleporter] Idiosel","map":2,"x":5344,"y":5177},{"id":39,"name":"[Weapon Merchant] Crune","map":2,"x":5729,"y":5225},{"id":49,"name":"[Ferrell Guild Staff] Rooen","map":3,"x":5104,"y":5020},{"id":51,"name":"[Akram Minister] Mel","map":5,"x":5247,"y":5280},{"id":50,"name":"[Akram Minister] Rodath","map":5,"x":5155,"y":5280},{"id":52,"name":"[Akram Minister] Gamp","map":6,"x":5248,"y":5279},{"id":53,"name":"[Referee] Leum","map":9,"x":5200,"y":5390},{"id":54,"name":"[Referee] Pirre","map":9,"x":5202,"y":4766},{"id":55,"name":"[Akram Minister] Nell","map":11,"x":4953,"y":4992},{"id":56,"name":"[Akram Minister] Nell","map":11,"x":4978,"y":5479},{"id":57,"name":"[Akram Minister] Nell","map":11,"x":5456,"y":5479},{"id":58,"name":"[Akram Minister] Nell","map":11,"x":5522,"y":5021},{"id":62,"name":"[Akram Minister] Nell","map":12,"x":5522,"y":5021},{"id":61,"name":"[Akram Minister] Nell","map":12,"x":5456,"y":5479},{"id":60,"name":"[Akram Minister] Nell","map":12,"x":4978,"y":5479},{"id":59,"name":"[Akram Minister] Nell","map":12,"x":4953,"y":4992},{"id":66,"name":"[Akram Minister] Nell","map":13,"x":5522,"y":5021},{"id":65,"name":"[Akram Minister] Nell","map":13,"x":5456,"y":5479},{"id":64,"name":"[Akram Minister] Nell","map":13,"x":4978,"y":5479},{"id":63,"name":"[Akram Minister] Nell","map":13,"x":4953,"y":4992},{"id":84,"name":"[Clan House Manager] Kushard","map":15,"x":5520,"y":4891},{"id":82,"name":"[Clan House Manager] Kushard","map":15,"x":5520,"y":5051},{"id":80,"name":"[Clan House Manager] Kushard","map":15,"x":5520,"y":5211},{"id":78,"name":"[Clan House Manager] Kushard","map":15,"x":5360,"y":4890},{"id":76,"name":"[Clan House Manager] Kushard","map":15,"x":5360,"y":5051},{"id":73,"name":"[Clan HouseLine truncated