mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-06 08:02:25 +00:00
- License was intended to be GPLv3 per earlier commit of GPLv3 LICENSE FILE - This is confirmed by the inclusion of libraries that are incompatible with GPLv2 - This is also confirmed by KLS and the agreement of KLS's predecessors - Added GPLv3 license headers to the compilable source files - Removed Folly licensing in strings.h since the string functions do not match the Folly functions and are standard functions - this must have been left over from previous implementations - Removed individual contributor license headers since the project has been under the "developer" mantle for many years - Removed comments on files that were previously automatically generated since they've been manually modified multiple times and there are no automatic scripts referencing them (removed in 2023)
167 lines
4.2 KiB
C++
167 lines
4.2 KiB
C++
/* EQEmu: EQEmulator
|
|
|
|
Copyright (C) 2001-2026 EQEmu Development Team
|
|
|
|
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 3 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "TEMPLATE.h"
|
|
#include "TEMPLATE_structs.h"
|
|
|
|
#include "common/eq_packet_structs.h"
|
|
#include "common/eq_stream_ident.h"
|
|
#include "common/logsys.h"
|
|
#include "common/opcodemgr.h"
|
|
|
|
namespace TEMPLATE {
|
|
|
|
static const char *name = "CHANGEME";
|
|
static OpcodeManager *opcodes = NULL;
|
|
static Strategy struct_strategy;
|
|
|
|
void Register(EQStreamIdentifier &into) {
|
|
//create our opcode manager if we havent already
|
|
if(opcodes == NULL) {
|
|
string opfile = Config->PatchDir;
|
|
opfile += "patch_";
|
|
opfile += name;
|
|
opfile += ".conf";
|
|
//load up the opcode manager.
|
|
//TODO: figure out how to support shared memory with multiple patches...
|
|
opcodes = new RegularOpcodeManager();
|
|
if(!opcodes->LoadOpcodes(opfile.c_str())) {
|
|
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
|
|
return;
|
|
}
|
|
}
|
|
|
|
//ok, now we have what we need to register.
|
|
|
|
EQStream::Signature signature;
|
|
|
|
//register our world signature.
|
|
signature.first_length = sizeof(structs::LoginInfo_Struct);
|
|
signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo);
|
|
into.RegisterPatch(signature, name, &opcodes, &struct_strategy);
|
|
|
|
//register our zone signature.
|
|
signature.first_length = sizeof(structs::ClientZoneEntry_Struct);
|
|
signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry);
|
|
into.RegisterPatch(signature, name, &opcodes, &struct_strategy);
|
|
}
|
|
|
|
void Reload() {
|
|
|
|
//we have a big problem to solve here when we switch back to shared memory
|
|
//opcode managers because we need to change the manager pointer, which means
|
|
//we need to go to every stream and replace it's manager.
|
|
|
|
if(opcodes != NULL) {
|
|
//TODO: get this file name from the config file
|
|
string opfile = Config->PatchDir;
|
|
opfile += "patch_";
|
|
opfile += name;
|
|
opfile += ".conf";
|
|
if(!opcodes->ReloadOpcodes(opfile.c_str())) {
|
|
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
|
|
return;
|
|
}
|
|
logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Strategy::Strategy()
|
|
: StructStrategy()
|
|
{
|
|
//all opcodes default to passthrough.
|
|
#include "ss_register.h"
|
|
#include "TEMPLATE_ops.h"
|
|
}
|
|
|
|
std::string Strategy::Describe() const {
|
|
std::string r;
|
|
r += "Patch ";
|
|
r += name;
|
|
return(r);
|
|
}
|
|
|
|
|
|
#include "ss_define.h"
|
|
|
|
|
|
/*ENCODE(OP_PlayerProfile) {
|
|
SETUP_DIRECT(PlayerProfile_Struct, structs::PlayerProfile_Struct);
|
|
|
|
|
|
|
|
FINISH_DIRECT();
|
|
}
|
|
|
|
ENCODE(OP_NewZone) {
|
|
SETUP_DIRECT(PlayerProfile_Struct, structs::PlayerProfile_Struct);
|
|
|
|
|
|
|
|
FINISH_DIRECT();
|
|
}*/
|
|
|
|
ENCODE(OP_SendAATable) {
|
|
SETUP_DIRECT_ENCODE(SendAA_Struct, structs::SendAA_Struct);
|
|
OUT(id);
|
|
OUT(hotkey_sid);
|
|
OUT(hotkey_sid2);
|
|
OUT(title_sid);
|
|
OUT(desc_sid);
|
|
OUT(cost);
|
|
OUT(seq);
|
|
OUT(current_level);
|
|
OUT(prereq_skill);
|
|
OUT(prereq_minpoints);
|
|
OUT(type);
|
|
OUT(spellid);
|
|
OUT(spell_type);
|
|
OUT(spell_refresh);
|
|
OUT(classes);
|
|
OUT(berserker);
|
|
OUT(max_level);
|
|
OUT(last_id);
|
|
OUT(next_id);
|
|
OUT(cost2);
|
|
OUT(unknown80[0]);
|
|
OUT(unknown80[1]);
|
|
OUT(total_abilities);
|
|
unsigned int r;
|
|
for(r = 0; r < emu->total_abilities; r++) {
|
|
OUT(abilities[r].skill_id);
|
|
OUT(abilities[r].increase_amt);
|
|
OUT(abilities[r].unknown08);
|
|
OUT(abilities[r].last_level);
|
|
}
|
|
FINISH_DIRECT_ENCODE();
|
|
}
|
|
|
|
DECODE(OP_SetServerFilter) {
|
|
SETUP_DIRECT_DECODE(SetServerFilter_Struct, structs::SetServerFilter_Struct);
|
|
int r;
|
|
for(r = 0; r < 25; r++) {
|
|
IN(filters[r]);
|
|
}
|
|
emu->filters[25] = 1;
|
|
FINISH_DIRECT_DECODE();
|
|
}
|
|
|
|
} // namespace TEMPLATE
|