This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
26 changed files
with
922 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright © 2022 Open-Shen Team. All rights reserved. | ||
* | ||
* Project licensed under the MIT License: https://www.mit.edu/~amini/LICENSE.md | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE | ||
* OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* All portions of this software are available for public use, provided that | ||
* credit is given to the original author(s). | ||
*/ | ||
|
||
import Command from "../objects/command"; | ||
import Player from "../player/player"; | ||
import {base, config, mode} from "../index"; | ||
import {existsSync} from "fs"; | ||
import {execSync} from "child_process"; | ||
import {formatDate} from "../utils/utilities"; | ||
|
||
export default class SupportCommand extends Command { | ||
constructor() { | ||
super("support", "Logs useful support information to the console.", "/support"); | ||
} | ||
|
||
async execute(args: string[], player?: Player): Promise<void> { | ||
// Collect the data. | ||
const data: string = ` | ||
Running in mode: ${mode == "precompile" ? "development" : "release"} | ||
Running: ${existsSync(`${base}/.git`) ? `from source code on Git (build: ${execSync("git describe --tags --always --dirty", {encoding: "utf-8"}).trim()})` : "from a packaged executable"} | ||
Using client version: ${config.server.clientVersion} | ||
Running server on port: ${config.server.udpPort} | ||
Config version: ${config.version} | ||
Debug status: ${config.debug.enableDebug ? `enabled (level ${config.debug.debugLevel})` : "disabled"} | ||
Specified data provider: ${config.data.dataProvider} | ||
Data dump from ${formatDate(Date.now())} | ||
`; | ||
|
||
console.info("Paste the following data into the support channel: ", "```" + data + "```"); | ||
return Promise.resolve(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright © 2022 Open-Shen Team. All rights reserved. | ||
* | ||
* Project licensed under the MIT License: https://www.mit.edu/~amini/LICENSE.md | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE | ||
* OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* All portions of this software are available for public use, provided that | ||
* credit is given to the original author(s). | ||
*/ | ||
|
||
import Player from "../../player/player"; | ||
|
||
export default async function (data: object, player: Player) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright © 2022 Open-Shen Team. All rights reserved. | ||
* | ||
* Project licensed under the MIT License: https://www.mit.edu/~amini/LICENSE.md | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE | ||
* OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* All portions of this software are available for public use, provided that | ||
* credit is given to the original author(s). | ||
*/ | ||
|
||
import Player from "../../player/player"; | ||
import World from "../../world/world"; | ||
import ServerEntity from "../../world/entity"; | ||
import {CombatInvocationsNotify, EntityMoveInfo} from "../../utils/protocol"; | ||
import {InvocationArguments} from "../../utils/constants"; | ||
import * as protocol from "../../utils/packets"; | ||
|
||
export default async function (data: CombatInvocationsNotify, player: Player) { | ||
for(const invoke of data.invokeList) { | ||
const type: number = invoke.argumentType; | ||
const forwardTo: number = invoke.forwardType; | ||
const data: Buffer = invoke.combatData; | ||
await handleInvocation({ | ||
player: player, | ||
type: type, | ||
forwardTo: forwardTo, | ||
data: data | ||
}); | ||
} | ||
} | ||
|
||
async function handleInvocation(object: InvocationObject) { | ||
const {data, player, type} = object; | ||
const world: World = player.world; | ||
|
||
switch(type) { | ||
default: | ||
console.log(`Unknown invocation type: ${type}`); | ||
break; | ||
|
||
case InvocationArguments.ENTITY_MOVE: | ||
const decoded: EntityMoveInfo = await protocol.packetToObject(data, "EntityMoveInfo"); | ||
|
||
const entityId: number = decoded.entityId; | ||
const entity: ServerEntity = world.entityManager.getEntityById(entityId); | ||
if(entity) entity.move(decoded.motionInfo); // Move the specified entity. | ||
break; | ||
} | ||
|
||
return Promise.resolve(); | ||
} | ||
|
||
/* Makes data easier. */ | ||
interface InvocationObject { | ||
data: Buffer; | ||
forwardTo: number; | ||
type: number; | ||
player: Player; | ||
} |
Oops, something went wrong.