Compare commits

...
10 Commits
Author SHA1 Message Date
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
60 changed files with 1116 additions and 5145 deletions

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ SHARED_LOGIN_PASS=789456
SHARED_CHAR_PASS=456123 SHARED_CHAR_PASS=456123
SHARED_WORLD_PASS=321654 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 # Logs in with an existing game account; only accounts with
# accesslevel >= ADMIN_MIN_ACCESSLEVEL are allowed in. # accesslevel >= ADMIN_MIN_ACCESSLEVEL are allowed in.
# Generate your own with: python3 -c "import secrets; print(secrets.token_hex(32))" # Generate your own with: python3 -c "import secrets; print(secrets.token_hex(32))"
+19 -1
View File
@@ -3,11 +3,29 @@ build-*/
.env .env
# Windows game client + data assets, kept locally for end-to-end login/game # 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/ /Client/
/3Ddata/ /3Ddata/
/3Ddata.zip /3Ddata.zip
/KTRose_pre-evo.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 Code project-local config
/.claude/ /.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.
-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>
+90
View File
@@ -0,0 +1,90 @@
# 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
```sh
cp .env.example .env # edit PUBLIC_HOST at minimum if clients connect from another machine
docker compose up -d --build
```
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` | 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.
## 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>
-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
View File
@@ -403,8 +403,16 @@ PVOID VisibilityProcess(PVOID TS)
// World Process // World Process
PVOID WorldProcess( PVOID TS ) PVOID WorldProcess( PVOID TS )
{ {
int adminQueueTicks = 0;
while( GServer->ServerOnline ) 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 ); pthread_mutex_lock( &GServer->MapMutex );
for(UINT i=0;i<GServer->MapList.Map.size();i++) for(UINT i=0;i<GServer->MapList.Map.size();i++)
{ {
+42
View File
@@ -66,6 +66,48 @@ bool CWorldServer::NPCAnnounce( const char msg[200], const char npc[50])
return true; 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 // NPC Whisper to a character
bool CWorldServer::NPCWhisper( CPlayer* thisclient, CMonster* thismon, const char msg[200], const char npc[50] ) bool CWorldServer::NPCWhisper( CPlayer* thisclient, CMonster* thismon, const char msg[200], const char npc[50] )
{ {
+1
View File
@@ -342,6 +342,7 @@ class CWorldServer : public CServerSocket
bool NPCMessage( CMonster* thismon, const char msg[200], const char npc[50] ); 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 NPCWhisper( CPlayer* thisclient, CMonster* thismon, const char msg[200], const char npc[50] );
bool NPCAnnounce( const char msg[200], const char npc[50] ); bool NPCAnnounce( const char msg[200], const char npc[50] );
void PollAdminQueue( );
UINT GetMaxPartyExp( UINT partylevel ); UINT GetMaxPartyExp( UINT partylevel );
bool DoSkillScript( CCharacter* character, CSkills* thisskill ); 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 = skill->atkpower + Enemy->Stats->Magic_Defense;
unsigned int totalpower = Attack + 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)); 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: AP %i DEF %i",Stats->Attack_Power,Enemy->Stats->Defense);
//Log(MSG_DEBUG,"Skill magic: Skill power %i. Attack %i",skill->atkpower,Attack); //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 = skill->atkpower + Enemy->Stats->Defense;
unsigned int totalpower = Attack + 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)); 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: AP %i DEF %i",Stats->Attack_Power,Enemy->Stats->Defense);
//Log(MSG_DEBUG,"Skill physical: Skill power %i. Attack %i",skill->atkpower,Attack); //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->Accury = 0;
Stats->Magic_Defense = 0; Stats->Magic_Defense = 0;
Stats->Move_Speed = 0; Stats->Move_Speed = 0;
Stats->SpeedModPercent = 100;
Stats->Attack_Speed = 0; Stats->Attack_Speed = 0;
Stats->Attack_Distance = 0; Stats->Attack_Distance = 0;
Stats->MaxWeight = 0; Stats->MaxWeight = 0;
+1
View File
@@ -63,6 +63,7 @@ struct STATS
unsigned int Magic_Defense; unsigned int Magic_Defense;
unsigned int Move_Speed; unsigned int Move_Speed;
unsigned int Mspd_base; unsigned int Mspd_base;
unsigned int SpeedModPercent; // GM /setspeedmod override, 100 = unmodified; applied in GetMoveSpeed()
unsigned int Attack_Speed; unsigned int Attack_Speed;
float Attack_Distance; float Attack_Distance;
unsigned int MaxWeight; unsigned int MaxWeight;
+19 -2
View File
@@ -3814,10 +3814,27 @@ bool CWorldServer::pakGMChangeMonsterDmg(CPlayer* thisclient, int rate)
return true; 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) 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); BEGINPACKET (pak, 0x702);
ADDSTRING(pak, "mSpeedModif Changed."); ADDSTRING(pak, "mSpeedModif Changed.");
ADDBYTE(pak, 0); ADDBYTE(pak, 0);
+7
View File
@@ -1050,6 +1050,13 @@ unsigned int CPlayer::GetMoveSpeed( )
default: default:
break; 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; return mspeed;
} }
-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
-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;
+12 -2
View File
@@ -88,6 +88,9 @@ services:
- "80:80" - "80:80"
volumes: volumes:
- "./webtools:/usr/share/nginx/html:ro" - "./webtools:/usr/share/nginx/html:ro"
- "./docker/conf/webtools-nginx.conf:/etc/nginx/conf.d/default.conf:ro"
depends_on:
- webadmin
webadmin: webadmin:
build: build:
@@ -101,8 +104,15 @@ services:
DB_NAME: ${DB_NAME:-ktrose} DB_NAME: ${DB_NAME:-ktrose}
ADMIN_SECRET_KEY: ${ADMIN_SECRET_KEY:-change-me-too} ADMIN_SECRET_KEY: ${ADMIN_SECRET_KEY:-change-me-too}
ADMIN_MIN_ACCESSLEVEL: ${ADMIN_MIN_ACCESSLEVEL:-900} ADMIN_MIN_ACCESSLEVEL: ${ADMIN_MIN_ACCESSLEVEL:-900}
ports: COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME:-ross}
- "8081:8080" 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: depends_on:
db: db:
condition: service_healthy condition: service_healthy
+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 COPY templates ./templates
EXPOSE 8080 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 os
import functools import functools
import hashlib import hashlib
import json
import time
import docker
import docker.errors
import pymysql import pymysql
import pymysql.cursors 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 = Flask(__name__)
app.secret_key = os.environ.get("ADMIN_SECRET_KEY", "dev-only-change-me") 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): 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. # Only accounts with accesslevel >= this may log in to the admin panel.
ADMIN_MIN_ACCESSLEVEL = int(os.environ.get("ADMIN_MIN_ACCESSLEVEL", "900")) 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 = [ CHAR_STAT_FIELDS = [
"level", "zuly", "str", "con", "dex", "_int", "cha", "sen", "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(): def get_db():
return pymysql.connect( return pymysql.connect(
@@ -253,6 +294,37 @@ def edit_character(char_id):
db = get_db() db = get_db()
try: try:
if request.method == "POST": 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 = [] values = []
set_clauses = [] set_clauses = []
for field in CHAR_STAT_FIELDS: for field in CHAR_STAT_FIELDS:
@@ -276,12 +348,176 @@ def edit_character(char_id):
with db.cursor() as cur: with db.cursor() as cur:
cur.execute("SELECT * FROM characters WHERE id=%s", (char_id,)) cur.execute("SELECT * FROM characters WHERE id=%s", (char_id,))
char = cur.fetchone() char = cur.fetchone()
cur.execute(
"SELECT id, map, x, y FROM list_respawnzones ORDER BY map, id"
)
respawn_zones = cur.fetchall()
finally: finally:
db.close() db.close()
if not char: if not char:
flash("Charakter nicht gefunden.") flash("Charakter nicht gefunden.")
return redirect(url_for("characters")) 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__": if __name__ == "__main__":
+1
View File
@@ -1,3 +1,4 @@
Flask==3.0.3 Flask==3.0.3
PyMySQL==1.1.1 PyMySQL==1.1.1
gunicorn==22.0.0 gunicorn==22.0.0
docker==7.1.0
+16
View File
@@ -71,6 +71,21 @@
.badge.ok { background: #163a26; color: var(--ok); } .badge.ok { background: #163a26; color: var(--ok); }
.badge.off { background: #3a1620; color: var(--danger); } .badge.off { background: #3a1620; color: var(--danger); }
.row-actions a { margin-right: 8px; } .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> </style>
</head> </head>
<body> <body>
@@ -80,6 +95,7 @@
<nav> <nav>
<a href="{{ url_for('accounts') }}">Accounts</a> <a href="{{ url_for('accounts') }}">Accounts</a>
<a href="{{ url_for('characters') }}">Charaktere</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> <a href="{{ url_for('logout') }}">Logout ({{ session['username'] }})</a>
</nav> </nav>
{% endif %} {% endif %}
+14 -1
View File
@@ -2,7 +2,9 @@
{% block title %}{{ account.username }} - ROSS Admin{% endblock %} {% block title %}{{ account.username }} - ROSS Admin{% endblock %}
{% block content %} {% block content %}
<div class="card" style="max-width:480px;"> <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"> <form method="post">
<label>Accesslevel (100 = normaler Spieler, 900 = Admin)</label> <label>Accesslevel (100 = normaler Spieler, 900 = Admin)</label>
<input type="number" name="accesslevel" value="{{ account.accesslevel }}"> <input type="number" name="accesslevel" value="{{ account.accesslevel }}">
@@ -30,4 +32,15 @@
{% endfor %} {% endfor %}
</table> </table>
</div> </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 %} {% endblock %}
+23 -1
View File
@@ -4,7 +4,22 @@
<div class="card" style="max-width:600px;"> <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> <h2 style="margin-top:0;">Charakter: {{ char.char_name }} <span class="badge ok">Account: {{ char.account_name }}</span></h2>
<form method="post"> <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 %} {% for field in stat_fields %}
<div> <div>
<label>{{ field.lstrip('_') }}</label> <label>{{ field.lstrip('_') }}</label>
@@ -20,4 +35,11 @@
</div> </div>
</form> </form>
</div> </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 %} {% 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;} .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;} .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; 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; 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.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{display:none; flex-direction:column; gap:10px;}
.side-panel.active{display:flex;} .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 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="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="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> </nav>
<div class="side-panel active" id="panel-commands"> <div class="side-panel active" id="panel-commands">
@@ -197,6 +202,22 @@
</select> </select>
</div> </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="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-any">any</span> usable by any GM character</div>
<div class="row"><span class="pill pill-gm">gm 300+</span> accesslevel ≥ 300</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"> <section class="view" id="view-maps">
<div class="pagehead"> <div class="pagehead">
<h1>Every map with active spawn or NPC data</h1> <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>
<div class="map-empty-note"> <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 No minimap images are shipped here — this repo only ships the server side of KTRose, not the client's 3D/texture
client's 3D/texture assets, and the localized zone-name strings aren't parsed by the server's simplified STB assets. A handful of zone names are untranslated Korean (the dev-tool STB just was never localized for those rows).
loader either. What's below (spawn counts, monster totals, coordinate bounds) is real, queried straight from
the running database.
</div> </div>
<div class="map-grid" id="results-maps"></div> <div class="map-grid" id="results-maps"></div>
</section> </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> </main>
</div> </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>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>`; : `<div>Coordinates</div><b>no spawn data</b><div></div><b></b>`;
el.innerHTML = ` 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>` : ""} ${m.note ? `<div class="note">${m.note}</div>` : ""}
<div class="map-stats"> <div class="map-stats">
<div>Spawn points</div><b>${m.spawnPoints}</b> <div>Spawn points</div><b>${m.spawnPoints}</b>
@@ -466,6 +509,81 @@ function renderMaps(){
} }
document.getElementById("map-sort").addEventListener("change", 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 ---------------- */ /* ---------------- boot ---------------- */
buildCommandsNav(); buildCommandsNav();
renderCommands(""); renderCommands("");
@@ -482,6 +600,20 @@ fetch("maps.json").then(r=>r.json()).then(data=>{
MAPS = data; MAPS = data;
renderMaps(); 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> </script>
</body> </body>
</html> </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": 1,
{"id":3,"spawnPoints":0,"totalMonsters":0,"npcCount":1,"bounds":null}, "name": "Canyon City of Zant",
{"id":5,"spawnPoints":0,"totalMonsters":0,"npcCount":2,"bounds":null}, "spawnPoints": 45,
{"id":6,"spawnPoints":0,"totalMonsters":0,"npcCount":1,"bounds":null}, "totalMonsters": 225,
{"id":9,"spawnPoints":0,"totalMonsters":0,"npcCount":2,"bounds":null}, "npcCount": 22,
{"id":11,"spawnPoints":0,"totalMonsters":0,"npcCount":4,"bounds":null}, "bounds": {
{"id":12,"spawnPoints":0,"totalMonsters":0,"npcCount":4,"bounds":null}, "minX": 5097,
{"id":13,"spawnPoints":0,"totalMonsters":0,"npcCount":4,"bounds":null}, "maxX": 5500,
{"id":15,"spawnPoints":0,"totalMonsters":0,"npcCount":18,"bounds":null}, "minY": 5050,
{"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)"}, "maxY": 5448
{"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": 2,
{"id":25,"spawnPoints":74,"totalMonsters":232,"npcCount":3,"bounds":{"minX":5023,"maxX":5688,"minY":4871,"maxY":5520}}, "name": "City of Junon Polis",
{"id":26,"spawnPoints":97,"totalMonsters":241,"npcCount":1,"bounds":{"minX":5053,"maxX":5695,"minY":4873,"maxY":5544}}, "spawnPoints": 43,
{"id":27,"spawnPoints":100,"totalMonsters":250,"npcCount":5,"bounds":{"minX":5005,"maxX":5831,"minY":4979,"maxY":5509}}, "totalMonsters": 92,
{"id":28,"spawnPoints":55,"totalMonsters":126,"npcCount":1,"bounds":{"minX":5027,"maxX":5567,"minY":4769,"maxY":5518}}, "npcCount": 27,
{"id":31,"spawnPoints":27,"totalMonsters":75,"npcCount":0,"bounds":{"minX":5028,"maxX":5446,"minY":5057,"maxY":5449}}, "bounds": {
{"id":32,"spawnPoints":31,"totalMonsters":74,"npcCount":0,"bounds":{"minX":5079,"maxX":5523,"minY":5138,"maxY":5541}}, "minX": 5075,
{"id":33,"spawnPoints":2,"totalMonsters":20,"npcCount":0,"bounds":{"minX":5246,"maxX":5251,"minY":5352,"maxY":5372}}, "maxX": 5767,
{"id":37,"spawnPoints":0,"totalMonsters":0,"npcCount":1,"bounds":null}, "minY": 5433,
{"id":38,"spawnPoints":7,"totalMonsters":53,"npcCount":2,"bounds":{"minX":5080,"maxX":5164,"minY":5371,"maxY":5478}}, "maxY": 5535
{"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": 3,
{"id":61,"spawnPoints":0,"totalMonsters":0,"npcCount":17,"bounds":null}, "name": "Dolphin Island",
{"id":62,"spawnPoints":0,"totalMonsters":0,"npcCount":8,"bounds":null} "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