mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
[Feature] Exempt a zone from IP-limit checks. (#4137)
* Exempt zone from IP checks * [Feature] Add Support for String-based Rules # Notes - Add support for string-based rules. # Images * convert to comma-seperated list * Forgot to convert the zone to a string * Update lua_general.cpp * fixed rule name * use the local string methods instead * I think this will work as desired without the extra condition --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
+11
-6
@@ -647,7 +647,7 @@ bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) {
|
||||
if (database.CheckNameFilter(newName)) {
|
||||
std::string query = StringFormat("SELECT `name` FROM `character_data` WHERE `name` = '%s'", newName);
|
||||
auto res = database.QueryDatabase(query);
|
||||
if (res.Success() && res.RowCount() == 0) {
|
||||
if (res.Success() && res.RowCount() == 0) {
|
||||
unique = true;
|
||||
}
|
||||
}
|
||||
@@ -887,14 +887,19 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_MOTD);
|
||||
std::string motd_message;
|
||||
if (database.GetVariable("MOTD", motd_message)) {
|
||||
outapp->size = motd_message.length() + 1;
|
||||
std::string motd = RuleS(World, MOTD);
|
||||
if (!motd.empty()) {
|
||||
outapp->size = motd.length() + 1;
|
||||
outapp->pBuffer = new uchar[outapp->size];
|
||||
memset(outapp->pBuffer, 0, outapp->size);
|
||||
strcpy((char*)outapp->pBuffer, motd_message.c_str());
|
||||
strcpy((char*) outapp->pBuffer, motd.c_str());
|
||||
} else if (database.GetVariable("MOTD", motd)) {
|
||||
outapp->size = motd.length() + 1;
|
||||
outapp->pBuffer = new uchar[outapp->size];
|
||||
memset(outapp->pBuffer, 0, outapp->size);
|
||||
strcpy((char*) outapp->pBuffer, motd.c_str());
|
||||
} else { // Null Message of the Day. :)
|
||||
outapp->size = 1;
|
||||
outapp->size = 1;
|
||||
outapp->pBuffer = new uchar[outapp->size];
|
||||
outapp->pBuffer[0] = 0;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,15 @@ void ClientList::GetCLEIP(uint32 in_ip) {
|
||||
|
||||
while (iterator.MoreElements()) {
|
||||
cle = iterator.GetData();
|
||||
|
||||
const auto zones = Strings::Split(RuleS(World, IPExemptionZones), ",");
|
||||
for (const auto &z : zones) {
|
||||
if (Strings::ToUnsignedInt(z) == cle->zone()) {
|
||||
iterator.Advance();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
cle->GetIP() == in_ip &&
|
||||
(
|
||||
|
||||
@@ -1100,7 +1100,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
|
||||
auto smotd = (ServerMotd_Struct*) pack->pBuffer;
|
||||
database.SetVariable("MOTD", smotd->motd);
|
||||
RuleManager::Instance()->SetRule("MOTD", smotd->motd, &database, true, true);
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user