mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Merge branch 'master' of https://github.com/EQEmu/Server
Conflicts: common/debug.cpp common/debug.h zone/PlayerCorpse.cpp zone/beacon.cpp zone/client.cpp zone/net.cpp zone/tribute.cpp
This commit is contained in:
+53
-53
@@ -1,19 +1,19 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/debug.h"
|
||||
#include <stdlib.h>
|
||||
@@ -74,7 +74,7 @@ void Petition::SendPetitionToPlayer(Client* clientto) {
|
||||
return;
|
||||
}
|
||||
|
||||
Petition::Petition(uint32 id)
|
||||
Petition::Petition(uint32 id)
|
||||
{
|
||||
petid = id;
|
||||
charclass = 0;
|
||||
@@ -90,56 +90,56 @@ Petition::Petition(uint32 id)
|
||||
memset(lastgm, 0, sizeof(lastgm));
|
||||
memset(petitiontext, 0, sizeof(petitiontext));
|
||||
memset(gmtext, 0, sizeof(gmtext));
|
||||
|
||||
|
||||
//memset(this->zone, 0, sizeof(this->zone));
|
||||
zone = 1;
|
||||
}
|
||||
Petition* PetitionList::GetPetitionByID(uint32 id_in) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (iterator.GetData()->GetID() == id_in)
|
||||
Petition* PetitionList::GetPetitionByID(uint32 id_in) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (iterator.GetData()->GetID() == id_in)
|
||||
return iterator.GetData();
|
||||
iterator.Advance();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint32 PetitionList::GetTotalPetitions(){
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
iterator.Reset();
|
||||
uint32 total=0;
|
||||
while(iterator.MoreElements()) {
|
||||
while(iterator.MoreElements()) {
|
||||
total++;
|
||||
iterator.Advance();
|
||||
iterator.Advance();
|
||||
}
|
||||
return total;
|
||||
return total;
|
||||
}
|
||||
bool PetitionList::FindPetitionByAccountName(const char* acctname) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (!strcmp(acctname,iterator.GetData()->GetAccountName()))
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (!strcmp(acctname,iterator.GetData()->GetAccountName()))
|
||||
return true;
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool PetitionList::DeletePetitionByCharName(const char* charname) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (!strcmp(charname,iterator.GetData()->GetCharName())) {
|
||||
if(DeletePetition(iterator.GetData()->GetID())==0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void PetitionList::UpdateZoneListQueue() {
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_Petition, sizeof(ServerPetitionUpdate_Struct));
|
||||
@@ -216,7 +216,7 @@ void PetitionList::UpdatePetition(Petition* pet) {
|
||||
|
||||
void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
char *query = 0;
|
||||
uint32 affected_rows = 0;
|
||||
uint8 checkedout = 0;
|
||||
if (wpet->CheckedOut()) checkedout = 0;
|
||||
@@ -225,13 +225,13 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in DeletePetitionFromDB query '%s': %s", query, errbuf);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
char *query = 0;
|
||||
uint32 affected_rows = 0;
|
||||
uint8 checkedout = 0;
|
||||
if (wpet->CheckedOut()) checkedout = 1;
|
||||
@@ -248,14 +248,14 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) {
|
||||
void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
char *query = 0;
|
||||
uint32 affected_rows = 0;
|
||||
uint8 checkedout = 0;
|
||||
if (wpet->CheckedOut())
|
||||
checkedout = 1;
|
||||
else
|
||||
checkedout = 0;
|
||||
|
||||
|
||||
uint32 len = strlen(wpet->GetPetitionText());
|
||||
char* petitiontext = new char[2*len+1];
|
||||
memset(petitiontext, 0, 2*len+1);
|
||||
@@ -263,7 +263,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO petitions (petid, charname, accountname, lastgm, petitiontext, zone, urgency, charclass, charrace, charlevel, checkouts, unavailables, ischeckedout, senttime, gmtext) values (%i,'%s','%s','%s','%s',%i,%i,%i,%i,%i,%i,%i,%i,%i, '%s')", wpet->GetID(), wpet->GetCharName(), wpet->GetAccountName(), wpet->GetLastGM(), petitiontext, wpet->GetZone(), wpet->GetUrgency(), wpet->GetCharClass(), wpet->GetCharRace(), wpet->GetCharLevel(), wpet->GetCheckouts(), wpet->GetUnavails(), checkedout, wpet->GetSentTime(), wpet->GetGMText()), errbuf, 0, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in InsertPetitionToDB query '%s': %s", query, errbuf);
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(petitiontext);
|
||||
safe_delete_array(query);
|
||||
#if EQDEBUG >= 5
|
||||
@@ -275,9 +275,9 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
void ZoneDatabase::RefreshPetitionsFromDB()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
Petition* newpet;
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, accountname, lastgm, petitiontext, zone, urgency, charclass, charrace, charlevel, checkouts, unavailables, ischeckedout, senttime, gmtext from petitions order by petid"), errbuf, &result))
|
||||
{
|
||||
@@ -309,6 +309,6 @@ void ZoneDatabase::RefreshPetitionsFromDB()
|
||||
safe_delete_array(query);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user