mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-12 23:14:36 +01:00
feat: Custom prefixes and basic help command
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
"ClientMode": "ZZ",
|
"ClientMode": "ZZ",
|
||||||
"QuestCacheExpiry": 300,
|
"QuestCacheExpiry": 300,
|
||||||
"ProxyPort": 0,
|
"ProxyPort": 0,
|
||||||
|
"CommandPrefix": "!",
|
||||||
"DevMode": true,
|
"DevMode": true,
|
||||||
"DevModeOptions": {
|
"DevModeOptions": {
|
||||||
"AutoCreateAccount": true,
|
"AutoCreateAccount": true,
|
||||||
@@ -78,6 +79,11 @@
|
|||||||
"RealtimeChannelID": ""
|
"RealtimeChannelID": ""
|
||||||
},
|
},
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
{
|
||||||
|
"Name": "Help",
|
||||||
|
"Enabled": true,
|
||||||
|
"Prefix": "help"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Name": "Rights",
|
"Name": "Rights",
|
||||||
"Enabled": false,
|
"Enabled": false,
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ type Config struct {
|
|||||||
RealClientMode Mode
|
RealClientMode Mode
|
||||||
QuestCacheExpiry int // Number of seconds to keep quest data cached
|
QuestCacheExpiry int // Number of seconds to keep quest data cached
|
||||||
ProxyPort uint16 // Forces the game to connect to a channel server proxy
|
ProxyPort uint16 // Forces the game to connect to a channel server proxy
|
||||||
|
CommandPrefix string // The prefix for commands
|
||||||
DevMode bool
|
DevMode bool
|
||||||
|
|
||||||
DevModeOptions DevModeOptions
|
DevModeOptions DevModeOptions
|
||||||
|
|||||||
@@ -318,6 +318,12 @@ func parseChatCommand(s *Session, command string) {
|
|||||||
} else {
|
} else {
|
||||||
sendDisabledCommandMessage(s, commands["Teleport"])
|
sendDisabledCommandMessage(s, commands["Teleport"])
|
||||||
}
|
}
|
||||||
|
case commands["Help"].Prefix:
|
||||||
|
if commands["Help"].Enabled {
|
||||||
|
sendServerChatMessage(s, fmt.Sprintf(s.server.dict["commandTeleportSuccess"], x, y))
|
||||||
|
} else {
|
||||||
|
sendDisabledCommandMessage(s, commands["Help"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +397,7 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
bf.SetLE()
|
bf.SetLE()
|
||||||
chatMessage := &binpacket.MsgBinChat{}
|
chatMessage := &binpacket.MsgBinChat{}
|
||||||
chatMessage.Parse(bf)
|
chatMessage.Parse(bf)
|
||||||
if strings.HasPrefix(chatMessage.Message, "!") {
|
if strings.HasPrefix(chatMessage.Message, s.server.erupeConfig.CommandPrefix) {
|
||||||
parseChatCommand(s, chatMessage.Message)
|
parseChatCommand(s, chatMessage.Message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user