mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Merge with master
This commit is contained in:
commit
e47de5deed
@ -10,7 +10,6 @@ SET(common_sources
|
||||
database.cpp
|
||||
dbasync.cpp
|
||||
dbcore.cpp
|
||||
DBMemLeak.cpp
|
||||
debug.cpp
|
||||
emu_opcodes.cpp
|
||||
EmuTCPConnection.cpp
|
||||
@ -103,7 +102,6 @@ SET(common_headers
|
||||
database.h
|
||||
dbasync.h
|
||||
dbcore.h
|
||||
DBMemLeak.h
|
||||
debug.h
|
||||
deity.h
|
||||
emu_opcodes.h
|
||||
|
||||
@ -20,17 +20,9 @@
|
||||
#include "Condition.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
|
||||
Condition::Condition()
|
||||
{
|
||||
Condition::Condition()
|
||||
{
|
||||
m_events[SignalEvent] = CreateEvent (nullptr, // security
|
||||
FALSE, // is auto-reset event?
|
||||
FALSE, // is signaled initially?
|
||||
@ -41,33 +33,33 @@ Condition::Condition()
|
||||
nullptr); // name
|
||||
m_waiters = 0;
|
||||
InitializeCriticalSection(&CSMutex);
|
||||
}
|
||||
}
|
||||
|
||||
Condition::~Condition()
|
||||
{
|
||||
Condition::~Condition()
|
||||
{
|
||||
DeleteCriticalSection(&CSMutex);
|
||||
CloseHandle(m_events[SignalEvent]);
|
||||
CloseHandle(m_events[BroadcastEvent]);
|
||||
}
|
||||
}
|
||||
|
||||
void Condition::Signal()
|
||||
{
|
||||
void Condition::Signal()
|
||||
{
|
||||
EnterCriticalSection(&CSMutex);
|
||||
if(m_waiters > 0)
|
||||
SetEvent(m_events[SignalEvent]);
|
||||
LeaveCriticalSection(&CSMutex);
|
||||
}
|
||||
}
|
||||
|
||||
void Condition::SignalAll()
|
||||
{
|
||||
void Condition::SignalAll()
|
||||
{
|
||||
EnterCriticalSection(&CSMutex);
|
||||
if(m_waiters > 0)
|
||||
SetEvent(m_events[BroadcastEvent]);
|
||||
LeaveCriticalSection(&CSMutex);
|
||||
}
|
||||
}
|
||||
|
||||
void Condition::Wait()
|
||||
{
|
||||
void Condition::Wait()
|
||||
{
|
||||
EnterCriticalSection(&CSMutex);
|
||||
|
||||
m_waiters++;
|
||||
@ -85,49 +77,51 @@ void Condition::Wait()
|
||||
ResetEvent(m_events[BroadcastEvent]);
|
||||
|
||||
LeaveCriticalSection(&CSMutex);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#else //!WIN32
|
||||
|
||||
Condition::Condition()
|
||||
{
|
||||
Condition::Condition()
|
||||
{
|
||||
pthread_cond_init(&cond,nullptr);
|
||||
pthread_mutex_init(&mutex,nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void Condition::Signal()
|
||||
{
|
||||
void Condition::Signal()
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
pthread_cond_signal(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void Condition::SignalAll()
|
||||
{
|
||||
void Condition::SignalAll()
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
pthread_cond_broadcast(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void Condition::Wait()
|
||||
{
|
||||
void Condition::Wait()
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
pthread_cond_wait(&cond,&mutex);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
I commented this specifically because I think it might be very
|
||||
difficult to write a windows counterpart to it, so I would like
|
||||
to discourage its use until we can confirm that it can be reasonably
|
||||
implemented on windows.
|
||||
/*
|
||||
I commented this specifically because I think it might be very
|
||||
difficult to write a windows counterpart to it, so I would like
|
||||
to discourage its use until we can confirm that it can be reasonably
|
||||
implemented on windows.
|
||||
|
||||
bool Condition::TimedWait(unsigned long usec)
|
||||
{
|
||||
struct timeval now;
|
||||
struct timespec timeout;
|
||||
int retcode=0;
|
||||
bool Condition::TimedWait(unsigned long usec)
|
||||
{
|
||||
struct timeval now;
|
||||
struct timespec timeout;
|
||||
int retcode=0;
|
||||
pthread_mutex_lock(&mutex);
|
||||
gettimeofday(&now,nullptr);
|
||||
now.tv_usec+=usec;
|
||||
@ -139,15 +133,16 @@ int retcode=0;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
return retcode!=ETIMEDOUT;
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
Condition::~Condition()
|
||||
{
|
||||
Condition::~Condition()
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
pthread_cond_destroy(&cond);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
pthread_mutex_destroy(&mutex);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,62 +0,0 @@
|
||||
#ifdef _EQDEBUG
|
||||
#include "../common/debug.h"
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../common/Mutex.h"
|
||||
#include "DBMemLeak.h"
|
||||
|
||||
#include <crtdbg.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
DBMemLeak dbmemleak;
|
||||
LinkedList<DBMemLeakStruct*>* list = 0;
|
||||
Mutex MDBMemLeak;
|
||||
|
||||
DBMemLeak::DBMemLeak() {
|
||||
list = new LinkedList<DBMemLeakStruct*>;
|
||||
}
|
||||
|
||||
DBMemLeak::~DBMemLeak() {
|
||||
LinkedListIterator<DBMemLeakStruct*> iterator(*list);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
char tmp[200];
|
||||
snprintf(tmp, sizeof(tmp) - 3, "DB Mem Leak: Block=%6d, Query=%s", iterator.GetData()->memblock, iterator.GetData()->query);
|
||||
snprintf(tmp, sizeof(tmp), "%s\n", tmp);
|
||||
OutputDebugString(tmp);
|
||||
iterator.Advance();
|
||||
}
|
||||
safe_delete(list);
|
||||
}
|
||||
|
||||
void DBMemLeak::Alloc(const void* result, const char* query) {
|
||||
LockMutex lock(&MDBMemLeak);
|
||||
long requestNumber;
|
||||
uint8* tmp2 = new uint8;
|
||||
_CrtIsMemoryBlock( tmp2, 1, &requestNumber, 0, 0 );
|
||||
safe_delete(tmp2);
|
||||
DBMemLeakStruct* tmp = (DBMemLeakStruct*) new uchar[sizeof(DBMemLeakStruct) + strlen(query) + 1];
|
||||
tmp->result = result;
|
||||
tmp->memblock = requestNumber;
|
||||
strcpy(tmp->query, query);
|
||||
list->Append(tmp);
|
||||
}
|
||||
|
||||
void DBMemLeak::Free(const void* result) {
|
||||
LockMutex lock(&MDBMemLeak);
|
||||
LinkedListIterator<DBMemLeakStruct*> iterator(*list);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (result == iterator.GetData()->result)
|
||||
iterator.RemoveCurrent();
|
||||
else
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,25 +0,0 @@
|
||||
#ifdef _EQDEBUG
|
||||
#ifndef DBMemLeak_H
|
||||
#define DBMemLeak_H
|
||||
#include "../common/types.h"
|
||||
#include "../common/linked_list.h"
|
||||
|
||||
#define mysql_free_result(r) { DBMemLeak::Free(r); mysql_free_result(r); }
|
||||
|
||||
struct DBMemLeakStruct {
|
||||
const void* result;
|
||||
uint32 memblock;
|
||||
char query[0];
|
||||
};
|
||||
|
||||
class DBMemLeak {
|
||||
public:
|
||||
DBMemLeak();
|
||||
~DBMemLeak();
|
||||
|
||||
static void Alloc(const void* result, const char* query);
|
||||
static void Free(const void* result);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -15,15 +15,32 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "EQPacket.h"
|
||||
#include "EQStream.h"
|
||||
#include "misc.h"
|
||||
#include "Mutex.h"
|
||||
#include "op_codes.h"
|
||||
#include "CRC16.h"
|
||||
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <sys/types.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(ZONE) || defined(WORLD)
|
||||
#define RETRANSMITS
|
||||
#endif
|
||||
#ifdef RETRANSMITS
|
||||
#include "rulesys.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
@ -32,20 +49,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include "EQPacket.h"
|
||||
#include "EQStream.h"
|
||||
//#include "EQStreamFactory.h"
|
||||
#include "misc.h"
|
||||
#include "Mutex.h"
|
||||
#include "op_codes.h"
|
||||
#include "CRC16.h"
|
||||
|
||||
#if defined(ZONE) || defined(WORLD)
|
||||
#define RETRANSMITS
|
||||
#endif
|
||||
#ifdef RETRANSMITS
|
||||
#include "rulesys.h"
|
||||
#endif
|
||||
|
||||
//for logsys
|
||||
#define _L "%s:%d: "
|
||||
@ -1355,6 +1358,9 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) {
|
||||
_log(NET__DEBUG, _L "Timeout expired in established state. Closing connection." __L);
|
||||
_SendDisconnect();
|
||||
SetState(DISCONNECTING);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
147
common/Item.cpp
147
common/Item.cpp
@ -16,20 +16,8 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef _WINDOWS
|
||||
// VS6 doesn't like the length of STL generated names: disabling
|
||||
#pragma warning(disable:4786)
|
||||
// Quagmire: Dont know why the one in debug.h doesnt work, but it doesnt.
|
||||
#endif
|
||||
#include "../common/debug.h"
|
||||
/*#ifdef _CRTDBG_MAP_ALLOC
|
||||
#undef new
|
||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
*/
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <limits.h>
|
||||
#include "debug.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Item.h"
|
||||
#include "database.h"
|
||||
#include "misc.h"
|
||||
@ -37,6 +25,11 @@
|
||||
#include "shareddb.h"
|
||||
#include "classes.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
int32 NextItemInstSerialNumber = 1;
|
||||
|
||||
static inline int32 GetNextItemInstSerialNumber() {
|
||||
@ -1059,103 +1052,75 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo
|
||||
return SLOT_INVALID;
|
||||
}
|
||||
|
||||
void Inventory::dumpInventory() {
|
||||
void Inventory::dumpBagContents(ItemInst *inst, iter_inst *it) {
|
||||
iter_contents itb;
|
||||
|
||||
if (!inst || !inst->IsType(ItemClassContainer))
|
||||
return;
|
||||
|
||||
// Go through bag, if bag
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if(!baginst || !baginst->GetItem())
|
||||
continue;
|
||||
|
||||
std::string subSlot;
|
||||
StringFormat(subSlot," Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first),
|
||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||
std::cout << subSlot << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Inventory::dumpItemCollection(const std::map<int16, ItemInst*> &collection) {
|
||||
iter_inst it;
|
||||
iter_contents itb;
|
||||
ItemInst* inst = nullptr;
|
||||
|
||||
// Check item: After failed checks, check bag contents (if bag)
|
||||
printf("Worn items:\n");
|
||||
for (it=m_worn.begin(); it!=m_worn.end(); it++) {
|
||||
for (it=collection.begin(); it!=collection.end(); it++) {
|
||||
inst = it->second;
|
||||
it->first;
|
||||
if(!inst || !inst->GetItem())
|
||||
continue;
|
||||
|
||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
||||
std::string slot;
|
||||
StringFormat(slot, "Slot %d: %s (%d)",it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
||||
std::cout << slot << std::endl;
|
||||
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if(!baginst || !baginst->GetItem())
|
||||
continue;
|
||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||
}
|
||||
}
|
||||
dumpBagContents(inst, &it);
|
||||
}
|
||||
}
|
||||
|
||||
printf("Inventory items:\n");
|
||||
for (it=m_inv.begin(); it!=m_inv.end(); it++) {
|
||||
inst = it->second;
|
||||
it->first;
|
||||
if(!inst || !inst->GetItem())
|
||||
continue;
|
||||
void Inventory::dumpWornItems() {
|
||||
std::cout << "Worn items:" << std::endl;
|
||||
dumpItemCollection(m_worn);
|
||||
}
|
||||
|
||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
||||
void Inventory::dumpInventory() {
|
||||
std::cout << "Inventory items:" << std::endl;
|
||||
dumpItemCollection(m_inv);
|
||||
}
|
||||
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if(!baginst || !baginst->GetItem())
|
||||
continue;
|
||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||
void Inventory::dumpBankItems() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "Bank items:" << std::endl;
|
||||
dumpItemCollection(m_bank);
|
||||
}
|
||||
|
||||
printf("Bank items:\n");
|
||||
for (it=m_bank.begin(); it!=m_bank.end(); it++) {
|
||||
inst = it->second;
|
||||
it->first;
|
||||
if(!inst || !inst->GetItem())
|
||||
continue;
|
||||
void Inventory::dumpSharedBankItems() {
|
||||
|
||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
||||
std::cout << "Shared Bank items:" << std::endl;
|
||||
dumpItemCollection(m_shbank);
|
||||
}
|
||||
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
void Inventory::dumpEntireInventory() {
|
||||
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if(!baginst || !baginst->GetItem())
|
||||
continue;
|
||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||
dumpWornItems();
|
||||
dumpInventory();
|
||||
dumpBankItems();
|
||||
dumpSharedBankItems();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("Shared Bank items:\n");
|
||||
for (it=m_shbank.begin(); it!=m_shbank.end(); it++) {
|
||||
inst = it->second;
|
||||
it->first;
|
||||
if(!inst || !inst->GetItem())
|
||||
continue;
|
||||
|
||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
||||
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if(!baginst || !baginst->GetItem())
|
||||
continue;
|
||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Internal Method: Retrieves item within an inventory bucket
|
||||
|
||||
@ -195,7 +195,11 @@ public:
|
||||
// Test whether a given slot can support a container item
|
||||
static bool SupportsContainers(int16 slot_id);
|
||||
|
||||
void dumpEntireInventory();
|
||||
void dumpWornItems();
|
||||
void dumpInventory();
|
||||
void dumpBankItems();
|
||||
void dumpSharedBankItems();
|
||||
|
||||
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value);
|
||||
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value);
|
||||
@ -207,6 +211,9 @@ protected:
|
||||
// Protected Methods
|
||||
///////////////////////////////
|
||||
|
||||
void dumpItemCollection(const std::map<int16, ItemInst*> &collection);
|
||||
void dumpBagContents(ItemInst *inst, iter_inst *it);
|
||||
|
||||
// Retrieves item within an inventory bucket
|
||||
ItemInst* _GetItem(const std::map<int16, ItemInst*>& bucket, int16 slot_id) const;
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
//
|
||||
#define VARSTRUCT_DECODE_TYPE(Type, Buffer) *(Type *)Buffer; Buffer += sizeof(Type);
|
||||
#define VARSTRUCT_DECODE_STRING(String, Buffer) strcpy(String, Buffer); Buffer += strlen(String)+1;
|
||||
#define VARSTRUCT_ENCODE_STRING(Buffer, String) { sprintf(Buffer, String); Buffer += strlen(String) + 1; }
|
||||
#define VARSTRUCT_ENCODE_STRING(Buffer, String) { sprintf(Buffer, "%s", String); Buffer += strlen(String) + 1; }
|
||||
#define VARSTRUCT_ENCODE_INTSTRING(Buffer, Number) { sprintf(Buffer, "%i", Number); Buffer += strlen(Buffer) + 1; }
|
||||
#define VARSTRUCT_ENCODE_TYPE(Type, Buffer, Value) { *(Type *)Buffer = Value; Buffer += sizeof(Type); }
|
||||
#define VARSTRUCT_SKIP_TYPE(Type, Buffer) Buffer += sizeof(Type);
|
||||
|
||||
@ -15,21 +15,25 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "debug.h"
|
||||
#include "ProcLauncher.h"
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
ProcLauncher ProcLauncher::s_launcher;
|
||||
|
||||
@ -126,27 +126,6 @@ bool strn0cpyt(char* dest, const char* source, uint32 size) {
|
||||
return (bool) (source[strlen(dest)] == 0);
|
||||
}
|
||||
|
||||
const char *MakeUpperString(const char *source) {
|
||||
static char str[128];
|
||||
if (!source)
|
||||
return nullptr;
|
||||
MakeUpperString(source, str);
|
||||
return str;
|
||||
}
|
||||
|
||||
void MakeUpperString(const char *source, char *target) {
|
||||
if (!source || !target) {
|
||||
*target=0;
|
||||
return;
|
||||
}
|
||||
while (*source)
|
||||
{
|
||||
*target = toupper(*source);
|
||||
target++;source++;
|
||||
}
|
||||
*target = 0;
|
||||
}
|
||||
|
||||
const char *MakeLowerString(const char *source) {
|
||||
static char str[128];
|
||||
if (!source)
|
||||
|
||||
@ -23,19 +23,9 @@
|
||||
|
||||
void vStringFormat(std::string& output, const char* format, va_list args);
|
||||
void StringFormat(std::string& output, const char* format, ...);
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MakeUpperString
|
||||
// i : source - allocated null-terminated string
|
||||
// return: pointer to static buffer with the target string
|
||||
const char *MakeUpperString(const char *source);
|
||||
|
||||
const char *MakeLowerString(const char *source);
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MakeUpperString
|
||||
// i : source - allocated null-terminated string
|
||||
// io: target - allocated buffer, at least of size strlen(source)+1
|
||||
void MakeUpperString(const char *source, char *target);
|
||||
|
||||
void MakeLowerString(const char *source, char *target);
|
||||
|
||||
|
||||
|
||||
@ -216,7 +216,7 @@ public:
|
||||
const char *GetRaidLeaderName(uint32 rid);
|
||||
|
||||
/*
|
||||
* Database Varaibles
|
||||
* Database Variables
|
||||
*/
|
||||
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
||||
bool SetVariable(const char* varname, const char* varvalue);
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
//#include <winsock.h>
|
||||
#endif
|
||||
#include <mysql.h>
|
||||
#include "../common/DBMemLeak.h"
|
||||
#include "../common/types.h"
|
||||
#include "../common/Mutex.h"
|
||||
#include "../common/linked_list.h"
|
||||
|
||||
@ -45,20 +45,7 @@
|
||||
#ifndef _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#if (_MSC_VER < 1300)
|
||||
#include <new>
|
||||
#include <memory>
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
// VS6 doesn't like the length of STL generated names: disabling
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#ifndef EQDEBUG_H
|
||||
|
||||
@ -95,11 +95,11 @@ namespace EQEmu
|
||||
*/
|
||||
const char* what() const throw() { return full_description().c_str(); }
|
||||
protected:
|
||||
std::string name_; //!< Exception name
|
||||
std::string desc_; //!< Exception Description
|
||||
mutable std::string full_desc_; //!< Full Exception Description
|
||||
std::string file_; //!< File Name
|
||||
long line_; //<! File Line
|
||||
std::string file_; //!< File Name
|
||||
std::string desc_; //!< Exception Description
|
||||
std::string name_; //!< Exception name
|
||||
};
|
||||
} // EQEmu
|
||||
|
||||
|
||||
@ -18,9 +18,12 @@
|
||||
|
||||
#include "debug.h"
|
||||
#include "logsys.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
void log_message(LogType type, const char *fmt, ...) {
|
||||
va_list args;
|
||||
@ -30,10 +33,10 @@ void log_message(LogType type, const char *fmt, ...) {
|
||||
}
|
||||
|
||||
void log_messageVA(LogType type, const char *fmt, va_list args) {
|
||||
char prefix_buffer[256];
|
||||
snprintf(prefix_buffer, 255, "[%s] ", log_type_info[type].name);
|
||||
prefix_buffer[255] = '\0';
|
||||
std::string prefix_buffer;
|
||||
|
||||
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args);
|
||||
StringFormat(prefix_buffer, "[%s] ", log_type_info[type].name);
|
||||
|
||||
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args);
|
||||
}
|
||||
|
||||
|
||||
@ -1120,7 +1120,7 @@ struct QSPlayerLogTrade_Struct {
|
||||
};
|
||||
|
||||
struct QSHandinItems_Struct {
|
||||
char action_type[6]; // handin, return or reward
|
||||
char action_type[7]; // handin, return or reward
|
||||
uint16 char_slot;
|
||||
uint32 item_id;
|
||||
uint16 charges;
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
#include "shareddb.h"
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "shareddb.h"
|
||||
#include "mysql.h"
|
||||
#include "Item.h"
|
||||
#include "classes.h"
|
||||
#include "rulesys.h"
|
||||
@ -19,13 +21,13 @@
|
||||
|
||||
SharedDatabase::SharedDatabase()
|
||||
: Database(), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr), faction_mmf(nullptr), faction_hash(nullptr),
|
||||
loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr), loot_drop_hash(nullptr)
|
||||
loot_table_mmf(nullptr), loot_table_hash(nullptr), loot_drop_mmf(nullptr), loot_drop_hash(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
SharedDatabase::SharedDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port)
|
||||
: Database(host, user, passwd, database, port), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr),
|
||||
faction_mmf(nullptr), faction_hash(nullptr), loot_table_mmf(nullptr), loot_drop_mmf(nullptr), loot_table_hash(nullptr),
|
||||
faction_mmf(nullptr), faction_hash(nullptr), loot_table_mmf(nullptr), loot_table_hash(nullptr), loot_drop_mmf(nullptr),
|
||||
loot_drop_hash(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -112,6 +112,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
EQEmu::MemoryMappedFile *skill_caps_mmf;
|
||||
EQEmu::MemoryMappedFile *items_mmf;
|
||||
EQEmu::FixedMemoryHashSet<Item_Struct> *items_hash;
|
||||
EQEmu::MemoryMappedFile *faction_mmf;
|
||||
@ -120,7 +121,6 @@ protected:
|
||||
EQEmu::FixedMemoryVariableHashSet<LootTable_Struct> *loot_table_hash;
|
||||
EQEmu::MemoryMappedFile *loot_drop_mmf;
|
||||
EQEmu::FixedMemoryVariableHashSet<LootDrop_Struct> *loot_drop_hash;
|
||||
EQEmu::MemoryMappedFile *skill_caps_mmf;
|
||||
};
|
||||
|
||||
#endif /*SHAREDDB_H_*/
|
||||
|
||||
@ -13,6 +13,8 @@ SET(eqlaunch_headers
|
||||
|
||||
ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
|
||||
|
||||
INSTALL(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
|
||||
@ -41,6 +41,8 @@ ENDIF(UNIX)
|
||||
|
||||
ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers})
|
||||
|
||||
INSTALL(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(loginserver Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE})
|
||||
|
||||
IF(MSVC)
|
||||
|
||||
@ -17,6 +17,8 @@ SET(qserv_headers
|
||||
|
||||
ADD_EXECUTABLE(queryserv ${qserv_sources} ${qserv_headers})
|
||||
|
||||
INSTALL(TARGETS queryserv RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DQSERV)
|
||||
|
||||
TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
@ -19,6 +19,8 @@ SET(shared_memory_headers
|
||||
|
||||
ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers})
|
||||
|
||||
INSTALL(TARGETS shared_memory RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(shared_memory Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
|
||||
@ -19,6 +19,8 @@ SET(ucs_headers
|
||||
|
||||
ADD_EXECUTABLE(ucs ${ucs_sources} ${ucs_headers})
|
||||
|
||||
INSTALL(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DUCS)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
@ -1280,8 +1280,8 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins.begin();
|
||||
while(i < 100 && iter != leaderboard_info_wins.end())
|
||||
@ -1347,8 +1347,8 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage.begin();
|
||||
while(i < 100 && iter != leaderboard_info_percentage.end())
|
||||
@ -1414,8 +1414,8 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_guk.begin();
|
||||
while(i < 100 && iter != leaderboard_info_wins_guk.end())
|
||||
@ -1481,8 +1481,8 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_guk.begin();
|
||||
while(i < 100 && iter != leaderboard_info_percentage_guk.end())
|
||||
@ -1548,8 +1548,8 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mir.begin();
|
||||
while(i < 100 && iter != leaderboard_info_wins_mir.end())
|
||||
@ -1615,8 +1615,8 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mir.begin();
|
||||
while(i < 100 && iter != leaderboard_info_percentage_mir.end())
|
||||
@ -1682,8 +1682,8 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mmc.begin();
|
||||
while(i < 100 && iter != leaderboard_info_wins_mmc.end())
|
||||
@ -1749,8 +1749,8 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mmc.begin();
|
||||
while(i < 100 && iter != leaderboard_info_percentage_mmc.end())
|
||||
@ -1816,8 +1816,8 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
|
||||
while(i < 100 && iter != leaderboard_info_wins_ruj.end())
|
||||
@ -1883,8 +1883,8 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_ruj.begin();
|
||||
while(i < 100 && iter != leaderboard_info_percentage_ruj.end())
|
||||
@ -1950,8 +1950,8 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
|
||||
while(i < 100 && iter != leaderboard_info_wins_ruj.end())
|
||||
@ -2017,8 +2017,8 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
|
||||
strcpy((char*)pack->pBuffer, player);
|
||||
|
||||
int place = -1;
|
||||
int our_successes;
|
||||
int our_failures;
|
||||
int our_successes = 0;
|
||||
int our_failures = 0;
|
||||
int i = 0;
|
||||
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_tak.begin();
|
||||
while(i < 100 && iter != leaderboard_info_percentage_tak.end())
|
||||
|
||||
@ -65,6 +65,8 @@ SET(world_headers
|
||||
|
||||
ADD_EXECUTABLE(world ${world_sources} ${world_headers})
|
||||
|
||||
INSTALL(TARGETS world RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DWORLD)
|
||||
|
||||
TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
@ -2,8 +2,34 @@
|
||||
#include "../common/EQPacket.h"
|
||||
#include "../common/EQStreamIntf.h"
|
||||
#include "../common/misc.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/emu_opcodes.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
#include "../common/packet_dump.h"
|
||||
#include "../common/EQStreamIntf.h"
|
||||
#include "../common/Item.h"
|
||||
#include "../common/races.h"
|
||||
#include "../common/classes.h"
|
||||
#include "../common/languages.h"
|
||||
#include "../common/skills.h"
|
||||
#include "../common/extprofile.h"
|
||||
#include "../common/StringUtil.h"
|
||||
#include "../common/clientversions.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "worlddb.h"
|
||||
#include "WorldConfig.h"
|
||||
#include "LoginServer.h"
|
||||
#include "LoginServerList.h"
|
||||
#include "zoneserver.h"
|
||||
#include "zonelist.h"
|
||||
#include "clientlist.h"
|
||||
#include "wguild_mgr.h"
|
||||
#include "SoFCharCreateData.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -17,44 +43,18 @@
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
|
||||
|
||||
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "client.h"
|
||||
#include "../common/emu_opcodes.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
#include "../common/packet_dump.h"
|
||||
#include "../common/EQStreamIntf.h"
|
||||
#include "worlddb.h"
|
||||
#include "../common/Item.h"
|
||||
#include "../common/races.h"
|
||||
#include "../common/classes.h"
|
||||
#include "../common/languages.h"
|
||||
#include "../common/skills.h"
|
||||
#include "../common/extprofile.h"
|
||||
#include "../common/StringUtil.h"
|
||||
#include "WorldConfig.h"
|
||||
#include "LoginServer.h"
|
||||
#include "LoginServerList.h"
|
||||
#include "zoneserver.h"
|
||||
#include "zonelist.h"
|
||||
#include "clientlist.h"
|
||||
#include "wguild_mgr.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "SoFCharCreateData.h"
|
||||
#include "../common/clientversions.h"
|
||||
|
||||
std::vector<RaceClassAllocation> character_create_allocations;
|
||||
std::vector<RaceClassCombos> character_create_race_class_combos;
|
||||
|
||||
@ -252,7 +252,7 @@ void Client::SendMembershipSettings() {
|
||||
Membership_Details_Struct* mds = (Membership_Details_Struct*)outapp->pBuffer;
|
||||
|
||||
mds->membership_setting_count = 66;
|
||||
uint32 gold_settings[22] = {-1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,1,-1,-1,0};
|
||||
int32 gold_settings[22] = {-1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,1,1,1,1,1,-1,-1,0};
|
||||
uint32 entry_count = 0;
|
||||
for (int setting_id=0; setting_id < 22; setting_id++)
|
||||
{
|
||||
@ -1578,7 +1578,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
||||
|
||||
uint32 max_stats = 0;
|
||||
uint32 allocs = character_create_allocations.size();
|
||||
RaceClassAllocation allocation;
|
||||
RaceClassAllocation allocation = {0};
|
||||
found = false;
|
||||
for(int i = 0; i < combos; ++i) {
|
||||
if(character_create_allocations[i].Index == class_combo.AllocationIndex) {
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/logsys.h"
|
||||
#include "../common/StringUtil.h"
|
||||
|
||||
#include "zoneserver.h"
|
||||
#include "client.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
void log_message_clientVA(LogType type, Client *who, const char *fmt, va_list args) {
|
||||
char prefix_buffer[256];
|
||||
snprintf(prefix_buffer, 255, "[%s] %s: ", log_type_info[type].name, who->GetAccountName());
|
||||
prefix_buffer[255] = '\0';
|
||||
|
||||
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args);
|
||||
std::string prefix_buffer;
|
||||
StringFormat(prefix_buffer,"[%s] %s: ", log_type_info[type].name, who->GetAccountName());
|
||||
|
||||
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args);
|
||||
}
|
||||
|
||||
void log_message_client(LogType type, Client *who, const char *fmt, ...) {
|
||||
@ -24,18 +27,17 @@ void log_message_client(LogType type, Client *who, const char *fmt, ...) {
|
||||
|
||||
void log_message_zoneVA(LogType type, ZoneServer *who, const char *fmt, va_list args) {
|
||||
|
||||
char prefix_buffer[256];
|
||||
char zone_tag[65];
|
||||
std::string prefix_buffer, zone_tag;
|
||||
const char *zone_name=who->GetZoneName();
|
||||
if (*zone_name==0)
|
||||
snprintf(zone_tag,64,"[%d]", who->GetID());
|
||||
|
||||
if (zone_name == nullptr)
|
||||
StringFormat(zone_tag,"[%d]", who->GetID());
|
||||
else
|
||||
snprintf(zone_tag,64,"[%d] [%s]",who->GetID(),zone_name);
|
||||
StringFormat(zone_tag,"[%d] [%s]",who->GetID(),zone_name);
|
||||
|
||||
snprintf(prefix_buffer, 255, "[%s] %s ", log_type_info[type].name, zone_tag);
|
||||
prefix_buffer[255] = '\0';
|
||||
StringFormat(prefix_buffer, "[%s] %s ", log_type_info[type].name, zone_tag.c_str());
|
||||
|
||||
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args);
|
||||
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args);
|
||||
}
|
||||
|
||||
void log_message_zone(LogType type, ZoneServer *who, const char *fmt, ...) {
|
||||
|
||||
@ -186,6 +186,8 @@ SET(zone_headers
|
||||
|
||||
ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
|
||||
|
||||
INSTALL(TARGETS zone RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
ADD_DEFINITIONS(-DZONE)
|
||||
|
||||
TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} ${LUA_LIBRARY})
|
||||
|
||||
@ -27,12 +27,10 @@ Child of the Mob class.
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
#include "masterentity.h"
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#include "../common/debug.h"
|
||||
#include "../common/StringUtil.h"
|
||||
#include "QGlobals.h"
|
||||
#include "masterentity.h"
|
||||
#include "zone.h"
|
||||
#include "zonedb.h"
|
||||
|
||||
void QGlobalCache::AddGlobal(uint32 id, QGlobal global)
|
||||
@ -16,7 +18,9 @@ void QGlobalCache::RemoveGlobal(std::string name, uint32 npcID, uint32 charID, u
|
||||
{
|
||||
if(name.compare((*iter).name) == 0)
|
||||
{
|
||||
if((npcID == (*iter).npc_id || (*iter).npc_id == 0) && (charID == (*iter).char_id || (*iter).char_id == 0) && (zoneID == (*iter).zone_id || (*iter).zone_id == 0))
|
||||
if((npcID == (*iter).npc_id || (*iter).npc_id == 0) &&
|
||||
(charID == (*iter).char_id || (*iter).char_id == 0) &&
|
||||
(zoneID == (*iter).zone_id || (*iter).zone_id == 0))
|
||||
{
|
||||
qGlobalBucket.erase(iter);
|
||||
return;
|
||||
@ -33,7 +37,8 @@ void QGlobalCache::Combine(std::list<QGlobal> &cacheA, std::list<QGlobal> cacheB
|
||||
{
|
||||
QGlobal cur = (*iter);
|
||||
|
||||
if((cur.npc_id == npcID || cur.npc_id == 0) && (cur.char_id == charID || cur.char_id == 0) && (cur.zone_id == zoneID || cur.zone_id == 0))
|
||||
if((cur.npc_id == npcID || cur.npc_id == 0) && (cur.char_id == charID || cur.char_id == 0) &&
|
||||
(cur.zone_id == zoneID || cur.zone_id == 0))
|
||||
{
|
||||
if(Timer::GetTimeSeconds() < cur.expdate)
|
||||
{
|
||||
@ -44,6 +49,76 @@ void QGlobalCache::Combine(std::list<QGlobal> &cacheA, std::list<QGlobal> cacheB
|
||||
}
|
||||
}
|
||||
|
||||
void QGlobalCache::GetQGlobals(std::list<QGlobal> &globals, NPC *n, Client *c, Zone *z) {
|
||||
globals.clear();
|
||||
|
||||
QGlobalCache *npc_c = nullptr;
|
||||
QGlobalCache *char_c = nullptr;
|
||||
QGlobalCache *zone_c = nullptr;
|
||||
uint32 npc_id = 0;
|
||||
uint32 char_id = 0;
|
||||
uint32 zone_id = 0;
|
||||
|
||||
if(n) {
|
||||
npc_id = n->GetNPCTypeID();
|
||||
npc_c = n->GetQGlobals();
|
||||
}
|
||||
|
||||
if(c) {
|
||||
char_id = c->CharacterID();
|
||||
char_c = c->GetQGlobals();
|
||||
}
|
||||
|
||||
if(z) {
|
||||
zone_id = z->GetZoneID();
|
||||
zone_c = z->GetQGlobals();
|
||||
}
|
||||
|
||||
if(!npc_c && n) {
|
||||
npc_c = n->CreateQGlobals();
|
||||
npc_c->LoadByNPCID(npc_id);
|
||||
}
|
||||
|
||||
if(!char_c && c) {
|
||||
char_c = c->CreateQGlobals();
|
||||
char_c->LoadByCharID(char_id);
|
||||
}
|
||||
|
||||
if(!zone_c && z) {
|
||||
zone_c = z->CreateQGlobals();
|
||||
zone_c->LoadByZoneID(zone_id);
|
||||
zone_c->LoadByGlobalContext();
|
||||
}
|
||||
|
||||
if(npc_c) {
|
||||
QGlobalCache::Combine(globals, npc_c->GetBucket(), npc_id, char_id, zone_id);
|
||||
}
|
||||
|
||||
if(char_c) {
|
||||
QGlobalCache::Combine(globals, char_c->GetBucket(), npc_id, char_id, zone_id);
|
||||
}
|
||||
|
||||
if(zone_c) {
|
||||
QGlobalCache::Combine(globals, zone_c->GetBucket(), npc_id, char_id, zone_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool QGlobalCache::GetQGlobal(QGlobal &g, std::string name, NPC *n, Client *c, Zone *z) {
|
||||
std::list<QGlobal> globals;
|
||||
QGlobalCache::GetQGlobals(globals, n, c, z);
|
||||
|
||||
auto iter = globals.begin();
|
||||
while(iter != globals.end()) {
|
||||
if(iter->name.compare(name) == 0) {
|
||||
g = (*iter);
|
||||
return true;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QGlobalCache::PurgeExpiredGlobals()
|
||||
{
|
||||
if(!qGlobalBucket.size())
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
#include <stdlib.h>
|
||||
#include "../common/timer.h"
|
||||
|
||||
class NPC;
|
||||
class Client;
|
||||
class Zone;
|
||||
|
||||
struct QGlobal
|
||||
{
|
||||
QGlobal() { }
|
||||
@ -29,6 +33,8 @@ public:
|
||||
|
||||
//assumes cacheA is already a valid or empty list and doesn't check for valid items.
|
||||
static void Combine(std::list<QGlobal> &cacheA, std::list<QGlobal> cacheB, uint32 npcID, uint32 charID, uint32 zoneID);
|
||||
static void GetQGlobals(std::list<QGlobal> &globals, NPC *n, Client *c, Zone *z);
|
||||
static bool GetQGlobal(QGlobal &g, std::string name, NPC *n, Client *c, Zone *z);
|
||||
|
||||
void PurgeExpiredGlobals();
|
||||
void LoadByNPCID(uint32 npcID); //npc
|
||||
|
||||
@ -1442,7 +1442,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
|
||||
killerMob->GetCleanName(), GetCleanName(), ConvertArray(damage, val1));
|
||||
}
|
||||
|
||||
int exploss;
|
||||
int exploss = 0;
|
||||
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
|
||||
|
||||
//
|
||||
|
||||
@ -24,13 +24,12 @@ target to center around.
|
||||
*/
|
||||
|
||||
#include "../common/debug.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
#include "masterentity.h"
|
||||
|
||||
@ -26,19 +26,13 @@
|
||||
|
||||
// for windows compile
|
||||
#ifdef _WINDOWS
|
||||
#define abs64 _abs64
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define abs64 _abs64
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#define abs64 abs
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#define abs64 abs
|
||||
#endif
|
||||
|
||||
extern volatile bool RunLoops;
|
||||
@ -601,7 +595,7 @@ bool Client::Save(uint8 iCommitNow) {
|
||||
p_timers.Store(&database);
|
||||
|
||||
// printf("Dumping inventory on save:\n");
|
||||
// m_inv.dumpInventory();
|
||||
// m_inv.dumpEntireInventory();
|
||||
|
||||
SaveTaskState();
|
||||
if (iCommitNow <= 1) {
|
||||
@ -7367,10 +7361,12 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra
|
||||
if (IsInvisible(tnpc))
|
||||
return FACTION_INDIFFERENT;
|
||||
if (tnpc && tnpc->GetOwnerID() != 0) // pets con amiably to owner and indiff to rest
|
||||
{
|
||||
if (char_id == tnpc->GetOwner()->CastToClient()->CharacterID())
|
||||
return FACTION_AMIABLE;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
}
|
||||
|
||||
//First get the NPC's Primary faction
|
||||
if(pFaction > 0)
|
||||
|
||||
@ -19,8 +19,6 @@
|
||||
#define CLIENT_H
|
||||
class Client;
|
||||
|
||||
|
||||
|
||||
#include "../common/timer.h"
|
||||
#include "../common/ptimer.h"
|
||||
#include "../common/emu_opcodes.h"
|
||||
@ -30,29 +28,39 @@ class Client;
|
||||
#include "../common/EQPacket.h"
|
||||
#include "../common/linked_list.h"
|
||||
#include "../common/extprofile.h"
|
||||
#include "zonedb.h"
|
||||
#include "errno.h"
|
||||
#include "../common/classes.h"
|
||||
#include "../common/races.h"
|
||||
#include "../common/deity.h"
|
||||
#include "../common/seperator.h"
|
||||
#include "../common/Item.h"
|
||||
#include "../common/guilds.h"
|
||||
#include "../common/item_struct.h"
|
||||
#include "../common/clientversions.h"
|
||||
|
||||
#include "zonedb.h"
|
||||
#include "errno.h"
|
||||
#include "mob.h"
|
||||
#include "npc.h"
|
||||
#include "merc.h"
|
||||
#include "zone.h"
|
||||
#include "AA.h"
|
||||
#include "../common/seperator.h"
|
||||
#include "../common/Item.h"
|
||||
#include "updatemgr.h"
|
||||
#include "../common/guilds.h"
|
||||
#include "questmgr.h"
|
||||
#include "QGlobals.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
// since windows defines these within windef.h (which windows.h include)
|
||||
// we are required to undefine these to use min and max from <algorithm>
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "../common/item_struct.h"
|
||||
#include "../common/clientversions.h"
|
||||
#include "QGlobals.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#define CLIENT_TIMEOUT 90000
|
||||
#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing
|
||||
#define TARGETING_RANGE 200 // range for /assist and /target
|
||||
|
||||
@ -128,7 +128,7 @@ void ClientLogs::EQEmuIO_pva(EQEMuLog::LogIDs id, const char *prefix, const char
|
||||
if(fmt[0] == '\n' || fmt[0] == '\r')
|
||||
return; //skip new lines...
|
||||
char *buf = _buffer;
|
||||
int plen = snprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH, prefix);
|
||||
int plen = snprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH, "%s", prefix);
|
||||
buf += plen;
|
||||
vsnprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH-plen, fmt, ap);
|
||||
_buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH] = '\0';
|
||||
|
||||
@ -15,19 +15,21 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <algorithm>
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "masterentity.h"
|
||||
#include "worldserver.h"
|
||||
#include "zonedb.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/packet_dump.h"
|
||||
#include "../common/packet_functions.h"
|
||||
#include "petitions.h"
|
||||
#include "../common/serverinfo.h"
|
||||
#include "../common/ZoneNumbers.h"
|
||||
#include "../common/moremath.h"
|
||||
#include "../common/guilds.h"
|
||||
#include "../common/logsys.h"
|
||||
#include "masterentity.h"
|
||||
#include "worldserver.h"
|
||||
#include "zonedb.h"
|
||||
#include "petitions.h"
|
||||
#include "StringIDs.h"
|
||||
#include "NpcAI.h"
|
||||
|
||||
|
||||
@ -3884,7 +3884,7 @@ void Client::Handle_OP_LDoNInspect(const EQApplicationPacket *app)
|
||||
void Client::Handle_OP_Dye(const EQApplicationPacket *app)
|
||||
{
|
||||
if(app->size!=sizeof(DyeStruct))
|
||||
printf("Wrong size of DyeStruct, Got: %i, Expected: %lu\n",app->size,sizeof(DyeStruct));
|
||||
printf("Wrong size of DyeStruct, Got: %i, Expected: %i\n",app->size,sizeof(DyeStruct));
|
||||
else{
|
||||
DyeStruct* dye = (DyeStruct*)app->pBuffer;
|
||||
DyeArmor(dye);
|
||||
@ -3955,7 +3955,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app)
|
||||
|
||||
if (app->size < sizeof(GuildUpdate_PublicNote)) {
|
||||
// client calls for a motd on login even if they arent in a guild
|
||||
printf("Error: app size of %i < size of OP_GuildPublicNote of %lu\n",app->size,sizeof(GuildUpdate_PublicNote));
|
||||
printf("Error: app size of %i < size of OP_GuildPublicNote of %i\n",app->size,sizeof(GuildUpdate_PublicNote));
|
||||
return;
|
||||
}
|
||||
GuildUpdate_PublicNote* gpn=(GuildUpdate_PublicNote*)app->pBuffer;
|
||||
@ -4013,7 +4013,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app)
|
||||
|
||||
if (app->size != sizeof(GuildMOTD_Struct)) {
|
||||
// client calls for a motd on login even if they arent in a guild
|
||||
printf("Error: app size of %i != size of GuildMOTD_Struct of %lu\n",app->size,sizeof(GuildMOTD_Struct));
|
||||
printf("Error: app size of %i != size of GuildMOTD_Struct of %i\n",app->size,sizeof(GuildMOTD_Struct));
|
||||
return;
|
||||
}
|
||||
if(!IsInAGuild()) {
|
||||
@ -4988,7 +4988,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_FinishTrade, 0);
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
if(with->IsNPC())
|
||||
if(with->IsNPC()) {
|
||||
// Audit trade to database for player trade stream
|
||||
if(RuleB(QueryServ, PlayerLogHandins)) {
|
||||
uint16 handin_count = 0;
|
||||
@ -5008,6 +5008,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
|
||||
else {
|
||||
FinishTrade(with->CastToNPC());
|
||||
}
|
||||
}
|
||||
#ifdef BOTS
|
||||
else if(with->IsBot())
|
||||
with->CastToBot()->FinishTrade(this, Bot::BotTradeClientNormal);
|
||||
@ -6916,7 +6917,7 @@ void Client::Handle_OP_DeleteSpell(const EQApplicationPacket *app)
|
||||
void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
|
||||
{
|
||||
if(app->size!=sizeof(LoadSpellSet_Struct)) {
|
||||
printf("Wrong size of LoadSpellSet_Struct! Expected: %lu, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
|
||||
printf("Wrong size of LoadSpellSet_Struct! Expected: %i, Got: %i\n",sizeof(LoadSpellSet_Struct),app->size);
|
||||
return;
|
||||
}
|
||||
int i;
|
||||
@ -6931,7 +6932,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
|
||||
void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
|
||||
{
|
||||
if(app->size!=sizeof(PetitionBug_Struct))
|
||||
printf("Wrong size of BugStruct! Expected: %lu, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
|
||||
printf("Wrong size of BugStruct! Expected: %i, Got: %i\n",sizeof(PetitionBug_Struct),app->size);
|
||||
else{
|
||||
Message(0, "Petition Bugs are not supported, please use /bug.");
|
||||
}
|
||||
@ -6941,7 +6942,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app)
|
||||
void Client::Handle_OP_Bug(const EQApplicationPacket *app)
|
||||
{
|
||||
if(app->size!=sizeof(BugStruct))
|
||||
printf("Wrong size of BugStruct got %d expected %lu!\n", app->size, sizeof(BugStruct));
|
||||
printf("Wrong size of BugStruct got %d expected %i!\n", app->size, sizeof(BugStruct));
|
||||
else{
|
||||
BugStruct* bug=(BugStruct*)app->pBuffer;
|
||||
database.UpdateBug(bug);
|
||||
@ -8337,7 +8338,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app)
|
||||
_pkt(TRIBUTE__IN, app);
|
||||
|
||||
if(app->size != sizeof(StartTribute_Struct))
|
||||
printf("Error in OP_OpenTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
printf("Error in OP_OpenTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
else {
|
||||
//Opens the tribute master window
|
||||
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
||||
@ -8362,7 +8363,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app)
|
||||
_pkt(TRIBUTE__IN, app);
|
||||
|
||||
if(app->size != sizeof(StartTribute_Struct))
|
||||
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
printf("Error in OP_OpenGuildTributeMaster. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
else {
|
||||
//Opens the guild tribute master window
|
||||
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
|
||||
@ -8388,7 +8389,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app)
|
||||
|
||||
//player donates an item...
|
||||
if(app->size != sizeof(TributeItem_Struct))
|
||||
printf("Error in OP_TributeItem. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
printf("Error in OP_TributeItem. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
else {
|
||||
TributeItem_Struct* t = (TributeItem_Struct*)app->pBuffer;
|
||||
|
||||
@ -8417,7 +8418,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app)
|
||||
|
||||
//player donates money
|
||||
if(app->size != sizeof(TributeMoney_Struct))
|
||||
printf("Error in OP_TributeMoney. Expected size of: %lu, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
printf("Error in OP_TributeMoney. Expected size of: %i, but got: %i\n",sizeof(StartTribute_Struct),app->size);
|
||||
else {
|
||||
TributeMoney_Struct* t = (TributeMoney_Struct*)app->pBuffer;
|
||||
|
||||
@ -8565,7 +8566,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app)
|
||||
void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
|
||||
{
|
||||
if(app->size != sizeof(FindPersonRequest_Struct))
|
||||
printf("Error in FindPersonRequest_Struct. Expected size of: %lu, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
|
||||
printf("Error in FindPersonRequest_Struct. Expected size of: %i, but got: %i\n",sizeof(FindPersonRequest_Struct),app->size);
|
||||
else {
|
||||
FindPersonRequest_Struct* t = (FindPersonRequest_Struct*)app->pBuffer;
|
||||
|
||||
@ -9173,7 +9174,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
|
||||
|
||||
#ifdef _EQDEBUG
|
||||
printf("Dumping inventory on load:\n");
|
||||
m_inv.dumpInventory();
|
||||
m_inv.dumpEntireInventory();
|
||||
#endif
|
||||
|
||||
//lost in current PP
|
||||
|
||||
@ -1686,10 +1686,12 @@ void command_timezone(Client *c, const Seperator *sep)
|
||||
c->Message(13, "Current timezone is: %ih %im", zone->zone_time.getEQTimeZoneHr(), zone->zone_time.getEQTimeZoneMin());
|
||||
}
|
||||
else {
|
||||
if(sep->arg[2]=="")
|
||||
strcpy(sep->arg[2], "0");
|
||||
c->Message(13, "Setting timezone to %s h %s m", sep->arg[1], sep->arg[2]);
|
||||
uint32 ntz=(atoi(sep->arg[1])*60)+atoi(sep->arg[2]);
|
||||
uint8 hours = atoi(sep->arg[1]);
|
||||
uint8 minutes = atoi(sep->arg[2]);
|
||||
if(!sep->IsNumber(2))
|
||||
minutes = 0;
|
||||
c->Message(13, "Setting timezone to %i h %i m", hours, minutes);
|
||||
uint32 ntz=(hours*60)+minutes;
|
||||
zone->zone_time.setEQTimeZone(ntz);
|
||||
database.SetZoneTZ(zone->GetZoneID(), zone->GetInstanceVersion(), ntz);
|
||||
|
||||
@ -3824,7 +3826,7 @@ void command_fixmob(Client *c, const Seperator *sep)
|
||||
{
|
||||
|
||||
uint32 Adjustment = 1; // Previous or Next
|
||||
char codeMove;
|
||||
char codeMove = 0;
|
||||
|
||||
if (sep->arg[2])
|
||||
{
|
||||
|
||||
@ -1485,11 +1485,13 @@ void EntityList::RemoveFromTargets(Mob* mob, bool RemoveFromXTargets)
|
||||
m->RemoveFromHateList(mob);
|
||||
|
||||
if(RemoveFromXTargets)
|
||||
{
|
||||
if(m->IsClient())
|
||||
m->CastToClient()->RemoveXTarget(mob, false);
|
||||
// FadingMemories calls this function passing the client.
|
||||
else if(mob->IsClient())
|
||||
mob->CastToClient()->RemoveXTarget(m, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,12 +20,13 @@
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/linked_list.h"
|
||||
#include "zonedb.h"
|
||||
#include "../common/eq_constants.h"
|
||||
#include "zonedump.h"
|
||||
#include "zonedbasync.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/bodytypes.h"
|
||||
#include "../common/eq_constants.h"
|
||||
|
||||
#include "zonedb.h"
|
||||
#include "zonedump.h"
|
||||
#include "zonedbasync.h"
|
||||
#include "QGlobals.h"
|
||||
|
||||
// max number of newspawns to send per bulk packet
|
||||
|
||||
@ -5009,7 +5009,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
|
||||
snprintf(c->GetEPP().merc_name, 64, "%s", c->GetMercInfo().merc_name);
|
||||
snprintf(npc_type->name, 64, "%s", c->GetMercInfo().merc_name);
|
||||
}
|
||||
uint8 gender;
|
||||
uint8 gender = 0;
|
||||
if(merchant_id > 0) {
|
||||
NPC* tar = entity_list.GetNPCByID(merchant_id);
|
||||
if(tar) {
|
||||
@ -5533,7 +5533,7 @@ bool Merc::Suspend() {
|
||||
}
|
||||
|
||||
bool Merc::Unsuspend(bool setMaxStats) {
|
||||
Client* mercOwner;
|
||||
Client* mercOwner = nullptr;
|
||||
bool loaded = false;
|
||||
|
||||
if(GetMercOwner()) {
|
||||
|
||||
@ -92,13 +92,13 @@ Mob::Mob(const char* in_name,
|
||||
mana_timer(2000),
|
||||
spellend_timer(0),
|
||||
rewind_timer(30000), //Timer used for determining amount of time between actual player position updates for /rewind.
|
||||
bindwound_timer(10000),
|
||||
stunned_timer(0),
|
||||
spun_timer(0),
|
||||
bardsong_timer(6000),
|
||||
flee_timer(FLEE_CHECK_TIMER),
|
||||
bindwound_timer(10000),
|
||||
gravity_timer(1000),
|
||||
viral_timer(0)
|
||||
viral_timer(0),
|
||||
flee_timer(FLEE_CHECK_TIMER)
|
||||
|
||||
{
|
||||
targeted = 0;
|
||||
@ -879,7 +879,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
|
||||
// Changing the first string made it vanish, so it has some significance.
|
||||
if(lastname)
|
||||
sprintf(ns->spawn.DestructibleModel, lastname);
|
||||
sprintf(ns->spawn.DestructibleModel, "%s", lastname);
|
||||
// Changing the second string made no visible difference
|
||||
sprintf(ns->spawn.DestructibleName2, "%s", ns->spawn.name);
|
||||
// Putting a string in the final one that was previously empty had no visible effect.
|
||||
|
||||
17
zone/mob.h
17
zone/mob.h
@ -972,11 +972,6 @@ protected:
|
||||
Timer tic_timer;
|
||||
Timer mana_timer;
|
||||
|
||||
float rewind_x;
|
||||
float rewind_y;
|
||||
float rewind_z;
|
||||
Timer rewind_timer;
|
||||
|
||||
//spell casting vars
|
||||
Timer spellend_timer;
|
||||
uint16 casting_spell_id;
|
||||
@ -995,6 +990,11 @@ protected:
|
||||
uint8 bardsong_slot;
|
||||
uint32 bardsong_target_id;
|
||||
|
||||
float rewind_x;
|
||||
float rewind_y;
|
||||
float rewind_z;
|
||||
Timer rewind_timer;
|
||||
|
||||
// Currently 3 max nimbus particle effects at a time
|
||||
uint32 nimbus_effect1;
|
||||
uint32 nimbus_effect2;
|
||||
@ -1029,6 +1029,10 @@ protected:
|
||||
int16 rooted_mod; //Modifier to root break chance, defined when root is cast on a target.
|
||||
bool offhand;
|
||||
|
||||
// Bind wound
|
||||
Timer bindwound_timer;
|
||||
Mob* bindwound_target;
|
||||
|
||||
Timer stunned_timer;
|
||||
Timer spun_timer;
|
||||
Timer bardsong_timer;
|
||||
@ -1111,9 +1115,6 @@ protected:
|
||||
uint32 pDontSnareMeBefore;
|
||||
uint32 pDontCureMeBefore;
|
||||
|
||||
// Bind wound
|
||||
Timer bindwound_timer;
|
||||
Mob* bindwound_target;
|
||||
// hp event
|
||||
int nexthpevent;
|
||||
int nextinchpevent;
|
||||
|
||||
66
zone/net.cpp
66
zone/net.cpp
@ -1,4 +1,3 @@
|
||||
#define DONT_SHARED_OPCODES
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
@ -16,34 +15,11 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define DONT_SHARED_OPCODES
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/features.h"
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#ifdef _CRTDBG_MAP_ALLOC
|
||||
#undef new
|
||||
#endif
|
||||
#include <fstream>
|
||||
#ifdef _CRTDBG_MAP_ALLOC
|
||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
#ifdef _WINDOWS
|
||||
#include <conio.h>
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
volatile bool RunLoops = true;
|
||||
extern volatile bool ZoneLoaded;
|
||||
|
||||
#include "../common/queue.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/EQStream.h"
|
||||
@ -59,6 +35,7 @@ extern volatile bool ZoneLoaded;
|
||||
#include "../common/patches/patches.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "../common/StringUtil.h"
|
||||
#include "../common/platform.h"
|
||||
#include "../common/crash.h"
|
||||
#include "../common/ipc_mutex.h"
|
||||
@ -66,6 +43,7 @@ extern volatile bool ZoneLoaded;
|
||||
#include "../common/eqemu_exception.h"
|
||||
#include "../common/spdat.h"
|
||||
|
||||
#include "ZoneConfig.h"
|
||||
#include "masterentity.h"
|
||||
#include "worldserver.h"
|
||||
#include "net.h"
|
||||
@ -82,6 +60,33 @@ extern volatile bool ZoneLoaded;
|
||||
#include "client_logs.h"
|
||||
#include "questmgr.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _CRTDBG_MAP_ALLOC
|
||||
#undef new
|
||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <conio.h>
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include "../common/unix.h"
|
||||
#endif
|
||||
|
||||
volatile bool RunLoops = true;
|
||||
extern volatile bool ZoneLoaded;
|
||||
|
||||
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
NetConnection net;
|
||||
EntityList entity_list;
|
||||
@ -102,13 +107,6 @@ const SPDat_Spell_Struct* spells;
|
||||
void LoadSpells(EQEmu::MemoryMappedFile **mmf);
|
||||
int32 SPDAT_RECORDS = -1;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include "../common/unix.h"
|
||||
#endif
|
||||
|
||||
void Shutdown();
|
||||
extern void MapOpcodes();
|
||||
|
||||
|
||||
@ -110,10 +110,10 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
classattack_timer(1000),
|
||||
knightattack_timer(1000),
|
||||
assist_timer(AIassistcheck_delay),
|
||||
qglobal_purge_timer(30000),
|
||||
sendhpupdate_timer(1000),
|
||||
enraged_timer(1000),
|
||||
taunt_timer(TauntReuseTime * 1000),
|
||||
qglobal_purge_timer(30000)
|
||||
taunt_timer(TauntReuseTime * 1000)
|
||||
{
|
||||
//What is the point of this, since the names get mangled..
|
||||
Mob* mob = entity_list.GetMob(name);
|
||||
|
||||
@ -130,7 +130,7 @@ void SpawnGroupList::AddSpawnGroup(SpawnGroup* newGroup) {
|
||||
|
||||
SpawnGroup* SpawnGroupList::GetSpawnGroup(uint32 in_id) {
|
||||
if(groups.count(in_id) != 1)
|
||||
return(false);
|
||||
return nullptr;
|
||||
return(groups[in_id]);
|
||||
}
|
||||
|
||||
|
||||
@ -86,6 +86,9 @@ void Mob::ApplySpecialAttackMod(SkillType skill, int32 &dmg, int32 &mindmg) {
|
||||
case TIGER_CLAW:
|
||||
item_slot = SLOT_HANDS;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (item_slot >= 0){
|
||||
|
||||
@ -4484,12 +4484,13 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
|
||||
case SE_TriggerOnCast:
|
||||
{
|
||||
if(type == focusTriggerOnCast)
|
||||
|
||||
{
|
||||
if(MakeRandomInt(0, 100) <= focus_spell.base[i])
|
||||
value = focus_spell.base2[i];
|
||||
|
||||
else
|
||||
value = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -5102,7 +5103,7 @@ bool Mob::TryDivineSave()
|
||||
{
|
||||
SetHP(1);
|
||||
|
||||
uint16 EffectsToTry[] =
|
||||
int16 EffectsToTry[] =
|
||||
{
|
||||
aabonuses.DivineSaveChance[1],
|
||||
itembonuses.DivineSaveChance[1],
|
||||
|
||||
@ -2483,10 +2483,8 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) {
|
||||
thd1 = (TaskHistoryReplyData1_Struct*)Ptr;
|
||||
thd1->ActivityType = Task->Activity[i].Type;
|
||||
Ptr = (char *)thd1 + sizeof(TaskHistoryReplyData1_Struct);
|
||||
sprintf(Ptr, Task->Activity[i].Text1);
|
||||
Ptr = Ptr + strlen(Ptr) + 1;
|
||||
sprintf(Ptr, Task->Activity[i].Text2);
|
||||
Ptr = Ptr + strlen(Ptr) + 1;
|
||||
VARSTRUCT_ENCODE_STRING(Ptr, Task->Activity[i].Text1);
|
||||
VARSTRUCT_ENCODE_STRING(Ptr, Task->Activity[i].Text2);
|
||||
thd2 = (TaskHistoryReplyData2_Struct*)Ptr;
|
||||
thd2->GoalCount = Task->Activity[i].GoalCount;
|
||||
thd2->unknown04 = 0xffffffff;
|
||||
@ -2494,8 +2492,7 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) {
|
||||
thd2->ZoneID = Task->Activity[i].ZoneID;
|
||||
thd2->unknown16 = 0x00000000;
|
||||
Ptr = (char *)thd2 + sizeof(TaskHistoryReplyData2_Struct);
|
||||
sprintf(Ptr, Task->Activity[i].Text3);
|
||||
Ptr = Ptr + strlen(Ptr) + 1;
|
||||
VARSTRUCT_ENCODE_STRING(Ptr, Task->Activity[i].Text3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2141,7 +2141,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) {
|
||||
// This packet produces the SoandSo is browsing your Buy Lines message
|
||||
bb->Action = Barter_SellerBrowsing;
|
||||
|
||||
sprintf(bb->PlayerName, GetName());
|
||||
sprintf(bb->PlayerName, "%s", GetName());
|
||||
|
||||
Buyer->QueuePacket(outapp);
|
||||
|
||||
@ -2707,7 +2707,7 @@ void Client::BuyerItemSearch(const EQApplicationPacket *app) {
|
||||
pdest = strstr(Name, Criteria);
|
||||
|
||||
if (pdest != nullptr) {
|
||||
sprintf(bisr->Results[Count].ItemName, item->Name);
|
||||
sprintf(bisr->Results[Count].ItemName, "%s", item->Name);
|
||||
bisr->Results[Count].ItemID = item->ID;
|
||||
bisr->Results[Count].Unknown068 = item->Icon;
|
||||
bisr->Results[Count].Unknown072 = 0x00000000;
|
||||
|
||||
@ -25,21 +25,18 @@
|
||||
#include <map>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <process.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <process.h>
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@ -94,6 +94,8 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
@ -247,6 +249,8 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
|
||||
LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name);
|
||||
SendZoneCancel(zc);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
//OK, now we should know where were going...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user