This commit is contained in:
Paul Coene 2015-02-01 09:34:04 -05:00
commit 1ff2a043f4
137 changed files with 6979 additions and 2499 deletions

View File

@ -1,5 +1,50 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 01/31/2015 ==
Trevius: Fixed FindGroundZ() and GetGroundZ() to once again utilize the X and Y arguments that are passed to them.
== 01/30/2015 ==
Akkadius: Implemented event type "EVENT_ENVIRONMENTAL_DAMAGE"
- This event triggers when taking any sort of environmental damage. Example use:
sub EVENT_ENVIRONMENTAL_DAMAGE{
quest::debug("EVENT_ENVIRONMENTAL_DAMAGE");
quest::debug("env_damage is " . $env_damage);
quest::debug("env_damage_type is " . $env_damage_type);
quest::debug("env_final_damage is " . $env_final_damage);
}
Result: (Test falling in Velks): http://i.imgur.com/tPRL7yL.png
- Implemented LUA counterpart of this same implementation above
Akkadius (Bobaski): Add PoK New Merchant sql/git/optional/2015_01_30_poknowledge_spell_vendors.sql
== 01/29/2015 ==
Trevius: Added more information to Mercenary Logging.
Trevius: Added potential fix for Mercenaries that fail to unsuspend.
Trevius: Added a new "statscale" field to the merc_stats table that can be used to quickly balance Mercenary Stats based on Level.
Trevius: The new "statscale" field now combines with the Mercs::ScaleRate rule value (default 100 percent for both).
== 01/28/2015 ==
Akkadius: Added Logs::DebugQuest category per request from Trevius (Great idea)
- Exported quest::debug(log_message, [debug_level = 1)
- Example:
quest::debug("This is a test debug message, level 1 (default)");
quest::debug("This is a test debug message, level 1", 1);
quest::debug("This is a test debug message, level 2", 2);
quest::debug("This is a test debug message, level 3", 3);
Result: http://i.imgur.com/6VoafGE.png
- Uses traditional logging system to output this category
- Required MySQL Source in Database version 9070
== 01/27/2015 ==
Trevius: Removed "Mercenary Debug:" from the Mercenary Log entries.
Trevius: Resolved duplicate "You have no Mercenaries" messages when zoning without owning a Mercenary.
Trevius: Mercenaries should now always be able to unsuspend if the timer is up.
Trevius: More work on Mercenaries and Grouping to reduce bugs and redundant queries.
Uleat: Finished ClientVersion update to include patch file and namespace updates - don't forget to copy the renamed 'patch_UF.conf' into your eqemu directory.)
== 01/26/2015 ==
Uleat: Changed Corpse::MoveItemToCorpse() to allow 'by address' passing of removed item slot list. Fixed a bug that kept soul-bound items inside of bags from attuning properly
== 01/25/2015 ==
Trevius: Fixed an issue where Mercenaries were causing several DB queries per second while suspended.
Trevius: Added Logs::Mercenaries to the new Logging System. Logging of Mercenary information is off by default with the required SQL.
@ -7,7 +52,7 @@ Trevius: Added Logs::Mercenaries to the new Logging System. Logging of Mercenar
== 01/24/2015 ==
Uleat: Added equipment light source functionality to all mob derived classes (may still need tweaking...)
Notes:
- In addition to equipment light sources, innate npc type light sources have already been activated
- In addition to equipment light sources, innate npc_type light sources have already been activated
- Valid light source values are 0 thru 15 (values are bitmask checked and limited to 0x0F)
- Not all classes handle equipment light sources the same way due to their equipment/loot list configurations
- Spell (casting?) light sources may be implemented at some point..more information is needed
@ -18,7 +63,7 @@ Notes:
Akkadius: Massive Log System overhaul, see: http://wiki.eqemulator.org/p?Logging_System_Overhaul&frm=Main
== 01/21/2015 ==
Uleat: Added `light` field to npctypes load query (all six clients tested positive for functionality.)
Uleat: Added `light` field to npc_types load query (all six clients tested positive for functionality.)
Note: This only affects 'innate' light. Equipment (other) light is still in-work.
Optional SQL: utils/sql/git/optional/2015_01_21_NPC_Types_Light_Field_Primer.sql

View File

@ -71,7 +71,7 @@ SET(common_sources
patches/rof.cpp
patches/rof2.cpp
patches/titanium.cpp
patches/underfoot.cpp
patches/uf.cpp
SocketLib/Base64.cpp
SocketLib/File.cpp
SocketLib/HttpdCookies.cpp
@ -216,11 +216,11 @@ SET(common_headers
patches/titanium_itemfields.h
patches/titanium_ops.h
patches/titanium_structs.h
patches/underfoot.h
patches/underfoot_constants.h
patches/underfoot_itemfields.h
patches/underfoot_ops.h
patches/underfoot_structs.h
patches/uf.h
patches/uf_constants.h
patches/uf_itemfields.h
patches/uf_ops.h
patches/uf_structs.h
SocketLib/Base64.h
SocketLib/File.h
SocketLib/HttpdCookies.h
@ -269,18 +269,18 @@ SOURCE_GROUP(Patches FILES
patches/titanium_ops.h
patches/titanium_constants.h
patches/titanium_structs.h
patches/underfoot.h
patches/underfoot_itemfields.h
patches/underfoot_ops.h
patches/underfoot_constants.h
patches/underfoot_structs.h
patches/uf.h
patches/uf_itemfields.h
patches/uf_ops.h
patches/uf_constants.h
patches/uf_structs.h
patches/patches.cpp
patches/sod.cpp
patches/sof.cpp
patches/rof.cpp
patches/rof2.cpp
patches/titanium.cpp
patches/underfoot.cpp
patches/uf.cpp
)
SOURCE_GROUP(SocketLib FILES
@ -330,7 +330,7 @@ ADD_LIBRARY(common ${common_sources} ${common_headers})
IF(UNIX)
ADD_DEFINITIONS(-fPIC)
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
ENDIF(UNIX)

View File

@ -7,14 +7,14 @@ static const uint32 BIT_Client62 = 1;
static const uint32 BIT_Titanium = 2;
static const uint32 BIT_SoF = 4;
static const uint32 BIT_SoD = 8;
static const uint32 BIT_Underfoot = 16;
static const uint32 BIT_UF = 16;
static const uint32 BIT_RoF = 32;
static const uint32 BIT_RoF2 = 64;
static const uint32 BIT_TitaniumAndEarlier = 0x00000003;
static const uint32 BIT_SoFAndLater = 0xFFFFFFFC;
static const uint32 BIT_SoDAndLater = 0xFFFFFFF8;
static const uint32 BIT_UnderfootAndLater = 0xFFFFFFF0;
static const uint32 BIT_UFAndLater = 0xFFFFFFF0;
static const uint32 BIT_RoFAndLater = 0xFFFFFFE0;
static const uint32 BIT_RoF2AndLater = 0xFFFFFFC0;
static const uint32 BIT_AllClients = 0xFFFFFFFF;
@ -23,10 +23,10 @@ enum class ClientVersion
{
Unknown = 0,
Client62, // Build: 'Aug 4 2005 15:40:59'
Tit, // Build: 'Oct 31 2005 10:33:37'
Titanium, // Build: 'Oct 31 2005 10:33:37'
SoF, // Build: 'Sep 7 2007 09:11:49'
SoD, // Build: 'Dec 19 2008 15:22:49'
Und, // Build: 'Jun 8 2010 16:44:32'
UF, // Build: 'Jun 8 2010 16:44:32'
RoF, // Build: 'Dec 10 2012 17:35:44'
RoF2, // Build: 'May 10 2013 23:30:08'
@ -49,14 +49,14 @@ static const char* ClientVersionName(ClientVersion version)
return "ClientVersion::Unknown";
case ClientVersion::Client62:
return "ClientVersion::Client62";
case ClientVersion::Tit:
return "ClientVersion::Tit";
case ClientVersion::Titanium:
return "ClientVersion::Titanium";
case ClientVersion::SoF:
return "ClientVersion::SoF";
case ClientVersion::SoD:
return "ClientVersion::SoD";
case ClientVersion::Und:
return "ClientVersion::Und";
case ClientVersion::UF:
return "ClientVersion::UF";
case ClientVersion::RoF:
return "ClientVersion::RoF";
case ClientVersion::RoF2:

View File

@ -1991,7 +1991,7 @@ void Database::SetRaidGroupLeaderInfo(uint32 gid, uint32 rid)
if (results.RowsAffected() != 0)
return;
query = StringFormat("INSERT INTO raid_leaders(gid, rid, marknpc, leadershipaa, maintank, assist, puller, mentoree, mentor_percent) VALUES(%lu, %lu, '', '', '', '', '', '', 0)",
query = StringFormat("REPLACE INTO raid_leaders(gid, rid, marknpc, leadershipaa, maintank, assist, puller, mentoree, mentor_percent) VALUES(%lu, %lu, '', '', '', '', '', '', 0)",
(unsigned long)gid, (unsigned long)rid);
results = QueryDatabase(query);

View File

@ -107,9 +107,9 @@ public:
/* General Information Queries */
bool AddBannedIP(char* bannedIP, const char* notes); //Lieka Edit: Add IP address to the Banned_IPs table.
bool AddBannedIP(char* bannedIP, const char* notes); //Add IP address to the Banned_IPs table.
bool AddGMIP(char* ip_address, char* name);
bool CheckBannedIPs(const char* loginIP); //Lieka Edit: Check incomming connection against banned IP table.
bool CheckBannedIPs(const char* loginIP); //Check incoming connection against banned IP table.
bool CheckGMIPs(const char* loginIP, uint32 account_id);
bool CheckNameFilter(const char* name, bool surname = false);
bool CheckUsedName(const char* name);
@ -118,7 +118,7 @@ public:
uint32 GetAccountIDByChar(uint32 char_id);
uint32 GetAccountIDByName(const char* accname, int16* status = 0, uint32* lsid = 0);
uint32 GetCharacterID(const char *name);
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0,float* oX = 0, float* oY = 0, float* oZ = 0);
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0);
uint32 GetGuildIDByCharID(uint32 char_id);
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);

View File

@ -104,7 +104,7 @@ EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConne
RelayCount = 0;
RemoteID = iRemoteID;
pOldFormat = false;
ConnectionType = Incomming;
ConnectionType = Incoming;
TCPMode = modePacket;
PacketMode = packetModeZone;
#if TCPN_DEBUG_Memory >= 7
@ -714,7 +714,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
SendNetErrorPacket("Switch to RelayServer mode by a Relay Client");
break;
}
if (ConnectionType != Incomming) {
if (ConnectionType != Incoming) {
SendNetErrorPacket("Switch to RelayServer mode on outgoing connection");
break;
}
@ -735,7 +735,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
SendNetErrorPacket("New RelayClient: wrong size, expected 11");
break;
}
if (ConnectionType != Incomming) {
if (ConnectionType != Incoming) {
SendNetErrorPacket("New RelayClient: illegal on outgoing connection");
break;
}
@ -755,7 +755,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
}
EmuTCPConnection* con = Server->FindConnection(*((uint32*)data));
if (con) {
if (ConnectionType == Incomming) {
if (ConnectionType == Incoming) {
if (con->GetRelayLink() != this) {
SendNetErrorPacket("Delete RelayClient: RelayLink != this");
break;

View File

@ -368,7 +368,7 @@ enum {
#define AT_DamageState 44 // The damage state of a destructible object (0 through 4)
//#define AT_Trader 300 // Bazzar Trader Mode
// solar: animations for AT_Anim
// animations for AT_Anim
#define ANIM_FREEZE 102
#define ANIM_STAND 0x64
#define ANIM_SIT 0x6e

View File

@ -492,7 +492,7 @@ uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) {
/*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE,
/*SoF*/ SoF::consts::MAP_CORPSE_SIZE,
/*SoD*/ SoD::consts::MAP_CORPSE_SIZE,
/*Underfoot*/ Underfoot::consts::MAP_CORPSE_SIZE,
/*Underfoot*/ UF::consts::MAP_CORPSE_SIZE,
/*RoF*/ RoF::consts::MAP_CORPSE_SIZE,
/*RoF2*/ RoF2::consts::MAP_CORPSE_SIZE,
@ -522,7 +522,7 @@ uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) {
/*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE,
/*SoF*/ SoF::consts::MAP_INSPECT_SIZE,
/*SoD*/ SoD::consts::MAP_INSPECT_SIZE,
/*Underfoot*/ Underfoot::consts::MAP_INSPECT_SIZE,
/*Underfoot*/ UF::consts::MAP_INSPECT_SIZE,
/*RoF*/ RoF::consts::MAP_INSPECT_SIZE,
/*RoF2*/ RoF2::consts::MAP_INSPECT_SIZE,
@ -800,7 +800,7 @@ bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion) {
/*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*Underfoot*/ Underfoot::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*Underfoot*/ UF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*RoF*/ RoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*RoF2*/ RoF2::limits::ALLOWS_EMPTY_BAG_IN_BAG,
@ -821,7 +821,7 @@ bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion) {
/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*Underfoot*/ Underfoot::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*Underfoot*/ UF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*RoF*/ RoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*RoF2*/ RoF2::limits::ALLOWS_CLICK_CAST_FROM_BAG,
@ -882,7 +882,7 @@ bool EQLimits::CoinHasWeight(ClientVersion clientVersion) {
/*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT,
/*SoF*/ SoF::limits::COIN_HAS_WEIGHT,
/*SoD*/ SoD::limits::COIN_HAS_WEIGHT,
/*Underfoot*/ Underfoot::limits::COIN_HAS_WEIGHT,
/*Underfoot*/ UF::limits::COIN_HAS_WEIGHT,
/*RoF*/ RoF::limits::COIN_HAS_WEIGHT,
/*RoF2*/ RoF::limits::COIN_HAS_WEIGHT,

View File

@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/patches/titanium_constants.h"
#include "../common/patches/sof_constants.h"
#include "../common/patches/sod_constants.h"
#include "../common/patches/underfoot_constants.h"
#include "../common/patches/uf_constants.h"
#include "../common/patches/rof_constants.h"
#include "../common/patches/rof2_constants.h"

View File

@ -540,7 +540,7 @@ struct SpawnAppearance_Struct
};
// solar: this is used inside profile
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
@ -1268,7 +1268,7 @@ struct Animation_Struct {
/*04*/
};
// solar: this is what causes the caster to animate and the target to
// this is what causes the caster to animate and the target to
// get the particle effects around them when a spell is cast
// also causes a buff icon
struct Action_Struct
@ -1292,7 +1292,7 @@ struct Action_Struct
/* 31 */
};
// solar: this is what prints the You have been struck. and the regular
// this is what prints the You have been struck. and the regular
// melee messages like You try to pierce, etc. It's basically the melee
// and spell damage message
struct CombatDamage_Struct
@ -1811,7 +1811,7 @@ struct RandomReq_Struct {
uint32 high;
};
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
/* 9/23/03 reply to /random command */
struct RandomReply_Struct {
/* 00 */ uint32 low;
/* 04 */ uint32 high;

View File

@ -206,8 +206,14 @@ class EQStream : public EQStreamInterface {
void init(bool resetSession=true);
public:
EQStream() { init(); remote_ip = 0; remote_port = 0; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); sessionAttempts = 0; streamactive=false; }
EQStream(sockaddr_in addr) { init(); remote_ip=addr.sin_addr.s_addr; remote_port=addr.sin_port; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); }
EQStream() { init(); remote_ip = 0; remote_port = 0; State = UNESTABLISHED;
StreamType = UnknownStream; compressed = true; encoded = false; app_opcode_size = 2;
bytes_sent = 0; bytes_recv = 0; create_time = Timer::GetTimeSeconds(); sessionAttempts = 0;
streamactive = false; }
EQStream(sockaddr_in addr) { init(); remote_ip = addr.sin_addr.s_addr;
remote_port = addr.sin_port; State = UNESTABLISHED; StreamType = UnknownStream;
compressed = true; encoded = false; app_opcode_size = 2; bytes_sent = 0; bytes_recv = 0;
create_time = Timer::GetTimeSeconds(); }
virtual ~EQStream() { RemoveData(); SetState(CLOSED); }
void SetMaxLen(uint32 length) { MaxLen=length; }

View File

@ -116,12 +116,12 @@ struct sockaddr_in address;
return true;
}
EQStream *EQStreamFactory::Pop()
std::shared_ptr<EQStream> EQStreamFactory::Pop()
{
EQStream *s=nullptr;
std::shared_ptr<EQStream> s = nullptr;
MNewStreams.lock();
if (NewStreams.size()) {
s=NewStreams.front();
s = NewStreams.front();
NewStreams.pop();
s->PutInUse();
}
@ -130,7 +130,7 @@ EQStream *s=nullptr;
return s;
}
void EQStreamFactory::Push(EQStream *s)
void EQStreamFactory::Push(std::shared_ptr<EQStream> s)
{
MNewStreams.lock();
NewStreams.push(s);
@ -139,17 +139,16 @@ void EQStreamFactory::Push(EQStream *s)
void EQStreamFactory::ReaderLoop()
{
fd_set readset;
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
int num;
int length;
unsigned char buffer[2048];
sockaddr_in from;
int socklen=sizeof(sockaddr_in);
timeval sleep_time;
//time_t now;
fd_set readset;
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
int num;
int length;
unsigned char buffer[2048];
sockaddr_in from;
int socklen = sizeof(sockaddr_in);
timeval sleep_time;
ReaderRunning = true;
ReaderRunning=true;
while(sock!=-1) {
MReaderRunning.lock();
if (!ReaderRunning)
@ -180,10 +179,10 @@ timeval sleep_time;
// What do we wanna do?
} else {
MStreams.lock();
stream_itr=Streams.find(std::make_pair(from.sin_addr.s_addr, from.sin_port));
stream_itr = Streams.find(std::make_pair(from.sin_addr.s_addr, from.sin_port));
if (stream_itr == Streams.end()) {
if (buffer[1]==OP_SessionRequest) {
EQStream *s = new EQStream(from);
std::shared_ptr<EQStream> s = std::make_shared<EQStream>(from);
s->SetStreamType(StreamType);
Streams[std::make_pair(from.sin_addr.s_addr, from.sin_port)]=s;
WriterWork.Signal();
@ -194,13 +193,13 @@ timeval sleep_time;
}
MStreams.unlock();
} else {
EQStream *curstream = stream_itr->second;
std::shared_ptr<EQStream> curstream = stream_itr->second;
//dont bother processing incoming packets for closed connections
if(curstream->CheckClosed())
curstream = nullptr;
else
curstream->PutInUse();
MStreams.unlock(); //the in use flag prevents the stream from being deleted while we are using it.
//the in use flag prevents the stream from being deleted while we are using it.
if(curstream) {
curstream->AddBytesRecv(length);
@ -208,6 +207,7 @@ timeval sleep_time;
curstream->SetLastPacketTime(Timer::GetCurrentTime());
curstream->ReleaseFromUse();
}
MStreams.unlock();
}
}
}
@ -220,10 +220,10 @@ void EQStreamFactory::CheckTimeout()
MStreams.lock();
unsigned long now=Timer::GetCurrentTime();
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
for(stream_itr=Streams.begin();stream_itr!=Streams.end();) {
EQStream *s = stream_itr->second;
for(stream_itr = Streams.begin(); stream_itr != Streams.end();) {
std::shared_ptr<EQStream> s = stream_itr->second;
s->CheckTimeout(now, stream_timeout);
@ -235,10 +235,9 @@ void EQStreamFactory::CheckTimeout()
//give it a little time for everybody to finish with it
} else {
//everybody is done, we can delete it now
std::map<std::pair<uint32, uint16>,EQStream *>::iterator temp=stream_itr;
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator temp = stream_itr;
++stream_itr;
//let whoever has the stream outside delete it
delete temp->second;
temp->second = nullptr;
Streams.erase(temp);
continue;
}
@ -251,21 +250,17 @@ void EQStreamFactory::CheckTimeout()
void EQStreamFactory::WriterLoop()
{
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
bool havework=true;
std::vector<EQStream *> wants_write;
std::vector<EQStream *>::iterator cur,end;
bool decay=false;
uint32 stream_count;
Timer DecayTimer(20);
WriterRunning=true;
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
bool havework=true;
std::vector<std::shared_ptr<EQStream>> wants_write;
std::vector<std::shared_ptr<EQStream>>::iterator cur, end;
bool decay = false;
uint32 stream_count;
Timer DecayTimer(20);
WriterRunning = true;
DecayTimer.Enable();
while(sock!=-1) {
//if (!havework) {
//WriterWork.Wait();
//}
MWriterRunning.lock();
if (!WriterRunning)
break;
@ -309,7 +304,7 @@ Timer DecayTimer(20);
Sleep(10);
MStreams.lock();
stream_count=Streams.size();
stream_count = Streams.size();
MStreams.unlock();
if (!stream_count) {
WriterWork.Wait();

View File

@ -2,6 +2,7 @@
#define _EQSTREAMFACTORY_H
#include <memory>
#include <queue>
#include <map>
@ -26,10 +27,10 @@ class EQStreamFactory : private Timeoutable {
EQStreamType StreamType;
std::queue<EQStream *> NewStreams;
std::queue<std::shared_ptr<EQStream>> NewStreams;
Mutex MNewStreams;
std::map<std::pair<uint32, uint16>,EQStream *> Streams;
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>> Streams;
Mutex MStreams;
virtual void CheckTimeout();
@ -42,8 +43,8 @@ class EQStreamFactory : private Timeoutable {
EQStreamFactory(EQStreamType type, uint32 timeout = 135000) : Timeoutable(5000), stream_timeout(timeout) { ReaderRunning=false; WriterRunning=false; StreamType=type; sock=-1; }
EQStreamFactory(EQStreamType type, int port, uint32 timeout = 135000);
EQStream *Pop();
void Push(EQStream *s);
std::shared_ptr<EQStream> Pop();
void Push(std::shared_ptr<EQStream> s);
bool Open();
bool Open(unsigned long port) { Port=port; return Open(); }

View File

@ -9,13 +9,12 @@ EQStreamIdentifier::~EQStreamIdentifier() {
m_identified.front()->ReleaseFromUse();
m_identified.pop();
}
std::vector<Record *>::iterator cur, end;
std::vector<Record>::iterator cur, end;
cur = m_streams.begin();
end = m_streams.end();
for(; cur != end; ++cur) {
Record *r = *cur;
r->stream->ReleaseFromUse();
delete r;
Record &r = *cur;
r.stream->ReleaseFromUse();
}
std::vector<Patch *>::iterator curp, endp;
curp = m_patches.begin();
@ -35,35 +34,34 @@ void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const cha
}
void EQStreamIdentifier::Process() {
std::vector<Record *>::iterator cur;
std::vector<Record>::iterator cur;
std::vector<Patch *>::iterator curp, endp;
//foreach pending stream.
cur = m_streams.begin();
while(cur != m_streams.end()) {
Record *r = *cur;
Record &r = *cur;
//first see if this stream has expired
if(r->expire.Check(false)) {
if(r.expire.Check(false)) {
//this stream has failed to match any pattern in our timeframe.
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
r->stream->ReleaseFromUse();
delete r;
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
r.stream->ReleaseFromUse();
cur = m_streams.erase(cur);
continue;
}
//then make sure the stream is still active
//if stream hasn't finished initializing then continue;
if(r->stream->GetState() == UNESTABLISHED)
if(r.stream->GetState() == UNESTABLISHED)
{
++cur;
continue;
}
if(r->stream->GetState() != ESTABLISHED) {
if(r.stream->GetState() != ESTABLISHED) {
//the stream closed before it was identified.
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
switch(r->stream->GetState())
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
switch(r.stream->GetState())
{
case ESTABLISHED:
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established");
@ -81,8 +79,7 @@ void EQStreamIdentifier::Process() {
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
break;
}
r->stream->ReleaseFromUse();
delete r;
r.stream->ReleaseFromUse();
cur = m_streams.erase(cur);
continue;
}
@ -99,23 +96,23 @@ void EQStreamIdentifier::Process() {
Patch *p = *curp;
//ask the stream to see if it matches the supplied signature
EQStream::MatchState res = r->stream->CheckSignature(&p->signature);
EQStream::MatchState res = r.stream->CheckSignature(&p->signature);
switch(res) {
case EQStream::MatchNotReady:
//the stream has not received enough packets to compare with this signature
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
all_ready = false;
break;
case EQStream::MatchSuccessful: {
//yay, a match.
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
r->stream->SetActive(true);
r.stream->SetActive(true);
//might want to do something less-specific here... some day..
EQStreamInterface *s = new EQStreamProxy(r->stream, p->structs, p->opcodes);
EQStreamInterface *s = new EQStreamProxy(r.stream, p->structs, p->opcodes);
m_identified.push(s);
found_one = true;
@ -123,7 +120,7 @@ void EQStreamIdentifier::Process() {
}
case EQStream::MatchFailed:
//do nothing...
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
break;
}
}
@ -131,14 +128,13 @@ void EQStreamIdentifier::Process() {
//if we checked all patches and did not find a match.
if(all_ready && !found_one) {
//the stream cannot be identified.
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
r->stream->ReleaseFromUse();
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
r.stream->ReleaseFromUse();
}
//if we found a match, or were not able to identify it
if(found_one || all_ready) {
//cannot print ip/port here. r->stream is invalid.
delete r;
//cannot print ip/port here. r.stream is invalid.
cur = m_streams.erase(cur);
} else {
++cur;
@ -146,8 +142,8 @@ void EQStreamIdentifier::Process() {
} //end foreach stream
}
void EQStreamIdentifier::AddStream(EQStream *&eqs) {
m_streams.push_back(new Record(eqs));
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStream> &eqs) {
m_streams.push_back(Record(eqs));
eqs = nullptr;
}
@ -159,7 +155,7 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() {
return(res);
}
EQStreamIdentifier::Record::Record(EQStream *s)
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStream> s)
: stream(s),
expire(STREAM_IDENT_WAIT_MS)
{

View File

@ -5,6 +5,7 @@
#include "timer.h"
#include <vector>
#include <queue>
#include <memory>
#define STREAM_IDENT_WAIT_MS 10000
@ -21,7 +22,7 @@ public:
//main processing interface
void Process();
void AddStream(EQStream *& eqs);
void AddStream(std::shared_ptr<EQStream> &eqs);
EQStreamInterface *PopIdentified();
protected:
@ -39,11 +40,11 @@ protected:
//pending streams..
class Record {
public:
Record(EQStream *s);
EQStream *stream; //we own this
Record(std::shared_ptr<EQStream> s);
std::shared_ptr<EQStream> stream; //we own this
Timer expire;
};
std::vector<Record *> m_streams; //we own these objects, and the streams contained in them.
std::vector<Record> m_streams; //we own these objects, and the streams contained in them.
std::queue<EQStreamInterface *> m_identified; //we own these objects
};

View File

@ -5,7 +5,7 @@
#include "struct_strategy.h"
EQStreamProxy::EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes)
EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes)
: m_stream(stream),
m_structs(structs),
m_opcodes(opcodes)
@ -15,7 +15,6 @@ EQStreamProxy::EQStreamProxy(EQStream *&stream, const StructStrategy *structs, O
}
EQStreamProxy::~EQStreamProxy() {
//delete m_stream; //released by the stream factory.
}
std::string EQStreamProxy::Describe() const {
@ -85,12 +84,6 @@ const uint32 EQStreamProxy::GetBytesRecvPerSecond() const
void EQStreamProxy::ReleaseFromUse() {
m_stream->ReleaseFromUse();
//this is so ugly, but I cant think of a better way to deal with
//it right now...
if(!m_stream->IsInUse()) {
delete this;
}
}
void EQStreamProxy::RemoveData() {

View File

@ -4,8 +4,9 @@
#include "types.h"
#include "eq_stream_intf.h"
#include "eq_stream.h"
#include <memory>
class EQStream;
class StructStrategy;
class OpcodeManager;
class EQApplicationPacket;
@ -13,7 +14,7 @@ class EQApplicationPacket;
class EQStreamProxy : public EQStreamInterface {
public:
//takes ownership of the stream.
EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes);
EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes);
virtual ~EQStreamProxy();
//EQStreamInterface:
@ -35,7 +36,7 @@ public:
virtual const uint32 GetBytesRecvPerSecond() const;
protected:
EQStream *const m_stream; //we own this stream object.
std::shared_ptr<EQStream> const m_stream; //we own this stream object.
const StructStrategy *const m_structs; //we do not own this object.
//this is a pointer to a pointer to make it less likely that a packet will
//reference an invalid opcode manager when they are being reloaded.

View File

@ -72,7 +72,7 @@ namespace Console {
LightRed = 12,
LightMagenta = 13,
Yellow = 14,
White = 15,
White = 15
};
}
@ -174,7 +174,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const
process_log << time_stamp << " " << message << std::endl;
}
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category) {
switch (log_category) {
case Logs::Status:
case Logs::Normal:
@ -197,7 +197,7 @@ uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){
}
}
std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category){
std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category) {
switch (log_category) {
case Logs::Status:
case Logs::Normal:
@ -220,7 +220,7 @@ std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category){
}
}
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
switch (log_category) {
case Logs::Status:
case Logs::Normal:
@ -317,7 +317,7 @@ void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
void EQEmuLogSys::CloseFileLogs()
{
if (process_log.is_open()){
if (process_log.is_open()) {
process_log.close();
}
}

View File

@ -26,11 +26,11 @@
#include "types.h"
namespace Logs{
namespace Logs {
enum DebugLevel {
General = 1, /* 1 - Low-Level general debugging, useful info on single line */
Moderate, /* 2 - Informational based, used in functions, when particular things load */
Detail, /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
Detail /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
};
/*
@ -77,6 +77,7 @@ namespace Logs{
MySQLError,
MySQLQuery,
Mercenaries,
QuestDebug,
MaxCategoryID /* Don't Remove this*/
};
@ -120,6 +121,7 @@ namespace Logs{
"MySQL Error",
"MySQL Query",
"Mercenaries",
"Quest Debug"
};
}
@ -141,7 +143,7 @@ public:
be checked against to see if that piped output is set to actually process it for the category and debug level
*/
void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...);
void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */
void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */
void StartFileLogs(const std::string &log_name = ""); /* Used to declare the processes file log and to keep it open for later use */
/*
@ -154,7 +156,7 @@ public:
log_to_gmsay[category_id] = [1-3] - Sets debug level for category to output to gmsay
*/
struct LogSettings{
struct LogSettings {
uint8 log_to_file;
uint8 log_to_console;
uint8 log_to_gmsay;

View File

@ -1441,6 +1441,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) {
m_ornamenticon = 0;
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
m_recast_timestamp = 0;
}
ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
@ -1466,6 +1467,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
m_ornamenticon = 0;
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
m_recast_timestamp = 0;
}
ItemInst::ItemInst(ItemInstTypes use_type) {
@ -1486,6 +1488,7 @@ ItemInst::ItemInst(ItemInstTypes use_type) {
m_ornamenticon = 0;
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
m_recast_timestamp = 0;
}
// Make a copy of an ItemInst object
@ -1539,6 +1542,7 @@ ItemInst::ItemInst(const ItemInst& copy)
m_ornamenticon = copy.m_ornamenticon;
m_ornamentidfile = copy.m_ornamentidfile;
m_ornament_hero_model = copy.m_ornament_hero_model;
m_recast_timestamp = copy.m_recast_timestamp;
}
// Clean up container contents

View File

@ -403,6 +403,8 @@ public:
void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; }
uint32 GetOrnamentHeroModel(int32 material_slot = -1) const;
void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; }
uint32 GetRecastTimestamp() const { return m_recast_timestamp; }
void SetRecastTimestamp(uint32 in) { m_recast_timestamp = in; }
void Initialize(SharedDatabase *db = nullptr);
void ScaleItem();
@ -450,6 +452,7 @@ protected:
uint32 m_ornamenticon;
uint32 m_ornamentidfile;
uint32 m_ornament_hero_model;
uint32 m_recast_timestamp;
//
// Items inside of this item (augs or contents);

View File

@ -3,7 +3,7 @@
#include "patches.h"
#include "titanium.h"
#include "underfoot.h"
#include "uf.h"
#include "sof.h"
#include "sod.h"
#include "rof.h"
@ -13,7 +13,7 @@ void RegisterAllPatches(EQStreamIdentifier &into) {
Titanium::Register(into);
SoF::Register(into);
SoD::Register(into);
Underfoot::Register(into);
UF::Register(into);
RoF::Register(into);
RoF2::Register(into);
}
@ -22,7 +22,7 @@ void ReloadAllPatches() {
Titanium::Reload();
SoF::Reload();
SoD::Reload();
Underfoot::Reload();
UF::Reload();
RoF::Reload();
RoF2::Reload();
}

View File

@ -25,14 +25,14 @@ namespace RoF
char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth);
// server to client inventory location converters
static inline structs::ItemSlotStruct ServerToRoFSlot(uint32 ServerSlot);
static inline structs::MainInvItemSlotStruct ServerToRoFMainInvSlot(uint32 ServerSlot);
static inline uint32 ServerToRoFCorpseSlot(uint32 ServerCorpse);
static inline structs::ItemSlotStruct ServerToRoFSlot(uint32 serverSlot);
static inline structs::MainInvItemSlotStruct ServerToRoFMainInvSlot(uint32 serverSlot);
static inline uint32 ServerToRoFCorpseSlot(uint32 serverCorpseSlot);
// client to server inventory location converters
static inline uint32 RoFToServerSlot(structs::ItemSlotStruct RoFSlot);
static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct RoFSlot);
static inline uint32 RoFToServerCorpseSlot(uint32 RoFCorpse);
static inline uint32 RoFToServerSlot(structs::ItemSlotStruct rofSlot);
static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct rofSlot);
static inline uint32 RoFToServerCorpseSlot(uint32 rofCorpseSlot);
// server to client text link converter
static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink);
@ -4650,7 +4650,7 @@ namespace RoF
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
//Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
Log.Out(Logs::General, Logs::Netcode, "[RoF] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
emu->from_slot = RoFToServerSlot(eq->from_slot);
emu->to_slot = RoFToServerSlot(eq->to_slot);
IN(number_in_stack);
@ -5000,7 +5000,7 @@ namespace RoF
hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0;
hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot;
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.last_cast_time = inst->GetRecastTimestamp();
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
@ -5507,7 +5507,7 @@ namespace RoF
return item_serial;
}
static inline structs::ItemSlotStruct ServerToRoFSlot(uint32 ServerSlot)
static inline structs::ItemSlotStruct ServerToRoFSlot(uint32 serverSlot)
{
structs::ItemSlotStruct RoFSlot;
RoFSlot.SlotType = INVALID_INDEX;
@ -5519,17 +5519,17 @@ namespace RoF
uint32 TempSlot = 0;
if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // Main Inventory and Cursor
if (serverSlot < 56 || serverSlot == MainPowerSource) { // Main Inventory and Cursor
RoFSlot.SlotType = maps::MapPossessions;
RoFSlot.MainSlot = ServerSlot;
RoFSlot.MainSlot = serverSlot;
if (ServerSlot == MainPowerSource)
if (serverSlot == MainPowerSource)
RoFSlot.MainSlot = slots::MainPowerSource;
else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory
else if (serverSlot >= MainCursor) // Cursor and Extended Corpse Inventory
RoFSlot.MainSlot += 3;
else if (ServerSlot >= MainAmmo) // (> 20)
else if (serverSlot >= MainAmmo) // (> 20)
RoFSlot.MainSlot += 1;
}
@ -5538,9 +5538,9 @@ namespace RoF
RoFSlot.MainSlot = ServerSlot - 31;
}*/
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) { // (> 250 && < 341)
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END) { // (> 250 && < 341)
RoFSlot.SlotType = maps::MapPossessions;
TempSlot = ServerSlot - 1;
TempSlot = serverSlot - 1;
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
@ -5548,14 +5548,14 @@ namespace RoF
RoFSlot.MainSlot = slots::MainCursor;
}
else if (ServerSlot >= EmuConstants::TRIBUTE_BEGIN && ServerSlot <= EmuConstants::TRIBUTE_END) { // Tribute
else if (serverSlot >= EmuConstants::TRIBUTE_BEGIN && serverSlot <= EmuConstants::TRIBUTE_END) { // Tribute
RoFSlot.SlotType = maps::MapTribute;
RoFSlot.MainSlot = ServerSlot - EmuConstants::TRIBUTE_BEGIN;
RoFSlot.MainSlot = serverSlot - EmuConstants::TRIBUTE_BEGIN;
}
else if (ServerSlot >= EmuConstants::BANK_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END) {
else if (serverSlot >= EmuConstants::BANK_BEGIN && serverSlot <= EmuConstants::BANK_BAGS_END) {
RoFSlot.SlotType = maps::MapBank;
TempSlot = ServerSlot - EmuConstants::BANK_BEGIN;
TempSlot = serverSlot - EmuConstants::BANK_BEGIN;
RoFSlot.MainSlot = TempSlot;
if (TempSlot > 30) { // (> 30)
@ -5564,9 +5564,9 @@ namespace RoF
}
}
else if (ServerSlot >= EmuConstants::SHARED_BANK_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END) {
else if (serverSlot >= EmuConstants::SHARED_BANK_BEGIN && serverSlot <= EmuConstants::SHARED_BANK_BAGS_END) {
RoFSlot.SlotType = maps::MapSharedBank;
TempSlot = ServerSlot - EmuConstants::SHARED_BANK_BEGIN;
TempSlot = serverSlot - EmuConstants::SHARED_BANK_BEGIN;
RoFSlot.MainSlot = TempSlot;
if (TempSlot > 30) { // (> 30)
@ -5575,9 +5575,9 @@ namespace RoF
}
}
else if (ServerSlot >= EmuConstants::TRADE_BEGIN && ServerSlot <= EmuConstants::TRADE_BAGS_END) {
else if (serverSlot >= EmuConstants::TRADE_BEGIN && serverSlot <= EmuConstants::TRADE_BAGS_END) {
RoFSlot.SlotType = maps::MapTrade;
TempSlot = ServerSlot - EmuConstants::TRADE_BEGIN;
TempSlot = serverSlot - EmuConstants::TRADE_BEGIN;
RoFSlot.MainSlot = TempSlot;
if (TempSlot > 30) {
@ -5599,18 +5599,18 @@ namespace RoF
*/
}
else if (ServerSlot >= EmuConstants::WORLD_BEGIN && ServerSlot <= EmuConstants::WORLD_END) {
else if (serverSlot >= EmuConstants::WORLD_BEGIN && serverSlot <= EmuConstants::WORLD_END) {
RoFSlot.SlotType = maps::MapWorld;
TempSlot = ServerSlot - EmuConstants::WORLD_BEGIN;
TempSlot = serverSlot - EmuConstants::WORLD_BEGIN;
RoFSlot.MainSlot = TempSlot;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
return RoFSlot;
}
static inline structs::MainInvItemSlotStruct ServerToRoFMainInvSlot(uint32 ServerSlot)
static inline structs::MainInvItemSlotStruct ServerToRoFMainInvSlot(uint32 serverSlot)
{
structs::MainInvItemSlotStruct RoFSlot;
RoFSlot.MainSlot = INVALID_INDEX;
@ -5620,16 +5620,16 @@ namespace RoF
uint32 TempSlot = 0;
if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // (< 52)
RoFSlot.MainSlot = ServerSlot;
if (serverSlot < 56 || serverSlot == MainPowerSource) { // (< 52)
RoFSlot.MainSlot = serverSlot;
if (ServerSlot == MainPowerSource)
if (serverSlot == MainPowerSource)
RoFSlot.MainSlot = slots::MainPowerSource;
else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory
else if (serverSlot >= MainCursor) // Cursor and Extended Corpse Inventory
RoFSlot.MainSlot += 3;
else if (ServerSlot >= MainAmmo) // Ammo and Personl Inventory
else if (serverSlot >= MainAmmo) // Ammo and Personl Inventory
RoFSlot.MainSlot += 1;
/*else if (ServerSlot >= MainCursor) { // Cursor
@ -5640,33 +5640,33 @@ namespace RoF
}*/
}
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) {
TempSlot = ServerSlot - 1;
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END) {
TempSlot = serverSlot - 1;
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
return RoFSlot;
}
static inline uint32 ServerToRoFCorpseSlot(uint32 ServerCorpse)
static inline uint32 ServerToRoFCorpseSlot(uint32 serverCorpseSlot)
{
return (ServerCorpse + 1);
return (serverCorpseSlot + 1);
}
static inline uint32 RoFToServerSlot(structs::ItemSlotStruct RoFSlot)
static inline uint32 RoFToServerSlot(structs::ItemSlotStruct rofSlot)
{
uint32 ServerSlot = INVALID_INDEX;
uint32 TempSlot = 0;
if (RoFSlot.SlotType == maps::MapPossessions && RoFSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (RoFSlot.MainSlot == slots::MainPowerSource)
if (rofSlot.SlotType == maps::MapPossessions && rofSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (rofSlot.MainSlot == slots::MainPowerSource)
TempSlot = MainPowerSource;
else if (RoFSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = RoFSlot.MainSlot - 3;
else if (rofSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.MainSlot - 3;
/*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory/corpse slots
// Need to figure out what to do when we get these
@ -5679,61 +5679,61 @@ namespace RoF
// For now, it's probably best to leave as-is and let this work itself out in the inventory rework.
}*/
else if (RoFSlot.MainSlot >= slots::MainAmmo) // Ammo and Main Inventory
TempSlot = RoFSlot.MainSlot - 1;
else if (rofSlot.MainSlot >= slots::MainAmmo) // Ammo and Main Inventory
TempSlot = rofSlot.MainSlot - 1;
else // Worn Slots
TempSlot = RoFSlot.MainSlot;
TempSlot = rofSlot.MainSlot;
if (RoFSlot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
if (rofSlot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
ServerSlot = TempSlot;
}
else if (RoFSlot.SlotType == maps::MapBank) {
else if (rofSlot.SlotType == maps::MapBank) {
TempSlot = EmuConstants::BANK_BEGIN;
if (RoFSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
if (rofSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((rofSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
else
TempSlot += RoFSlot.MainSlot;
TempSlot += rofSlot.MainSlot;
ServerSlot = TempSlot;
}
else if (RoFSlot.SlotType == maps::MapSharedBank) {
else if (rofSlot.SlotType == maps::MapSharedBank) {
TempSlot = EmuConstants::SHARED_BANK_BEGIN;
if (RoFSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
if (rofSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((rofSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
else
TempSlot += RoFSlot.MainSlot;
TempSlot += rofSlot.MainSlot;
ServerSlot = TempSlot;
}
else if (RoFSlot.SlotType == maps::MapTrade) {
else if (rofSlot.SlotType == maps::MapTrade) {
TempSlot = EmuConstants::TRADE_BEGIN;
if (RoFSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
if (rofSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((rofSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
// OLD CODE:
//TempSlot += 100 + (RoFSlot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot;
else
TempSlot += RoFSlot.MainSlot;
TempSlot += rofSlot.MainSlot;
ServerSlot = TempSlot;
}
else if (RoFSlot.SlotType == maps::MapWorld) {
else if (rofSlot.SlotType == maps::MapWorld) {
TempSlot = EmuConstants::WORLD_BEGIN;
if (RoFSlot.MainSlot >= SUB_BEGIN)
TempSlot += RoFSlot.MainSlot;
if (rofSlot.MainSlot >= SUB_BEGIN)
TempSlot += rofSlot.MainSlot;
ServerSlot = TempSlot;
}
@ -5747,26 +5747,26 @@ namespace RoF
ServerSlot = TempSlot;
}*/
else if (RoFSlot.SlotType == maps::MapGuildTribute) {
else if (rofSlot.SlotType == maps::MapGuildTribute) {
ServerSlot = INVALID_INDEX;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.SlotType, rofSlot.Unknown02, rofSlot.MainSlot, rofSlot.SubSlot, rofSlot.AugSlot, rofSlot.Unknown01, ServerSlot);
return ServerSlot;
}
static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct RoFSlot)
static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct rofSlot)
{
uint32 ServerSlot = INVALID_INDEX;
uint32 TempSlot = 0;
if (RoFSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (RoFSlot.MainSlot == slots::MainPowerSource)
if (rofSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (rofSlot.MainSlot == slots::MainPowerSource)
TempSlot = MainPowerSource;
else if (RoFSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = RoFSlot.MainSlot - 3;
else if (rofSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.MainSlot - 3;
/*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory slots
// Need to figure out what to do when we get these
@ -5774,26 +5774,26 @@ namespace RoF
// Same as above
}*/
else if (RoFSlot.MainSlot >= slots::MainAmmo) // Main Inventory and Ammo Slots
TempSlot = RoFSlot.MainSlot - 1;
else if (rofSlot.MainSlot >= slots::MainAmmo) // Main Inventory and Ammo Slots
TempSlot = rofSlot.MainSlot - 1;
else
TempSlot = RoFSlot.MainSlot;
TempSlot = rofSlot.MainSlot;
if (RoFSlot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot + 1;
if (rofSlot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
ServerSlot = TempSlot;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.MainSlot, rofSlot.SubSlot, rofSlot.AugSlot, rofSlot.Unknown01, ServerSlot);
return ServerSlot;
}
static inline uint32 RoFToServerCorpseSlot(uint32 RoFCorpse)
static inline uint32 RoFToServerCorpseSlot(uint32 rofCorpseSlot)
{
return (RoFCorpse - 1);
return (rofCorpseSlot - 1);
}
static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink)

View File

@ -1,5 +1,5 @@
#ifndef RoF_H_
#define RoF_H_
#ifndef ROF_H_
#define ROF_H_
#include "../struct_strategy.h"
@ -32,6 +32,4 @@ namespace RoF {
};
#endif /*RoF_H_*/
#endif /*ROF_H_*/

View File

@ -25,14 +25,14 @@ namespace RoF2
char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth, ItemPacketType packet_type);
// server to client inventory location converters
static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot, ItemPacketType PacketType = ItemPacketInvalid);
static inline structs::MainInvItemSlotStruct ServerToRoF2MainInvSlot(uint32 ServerSlot);
static inline uint32 ServerToRoF2CorpseSlot(uint32 ServerCorpse);
static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 serverSlot, ItemPacketType PacketType = ItemPacketInvalid);
static inline structs::MainInvItemSlotStruct ServerToRoF2MainInvSlot(uint32 serverSlot);
static inline uint32 ServerToRoF2CorpseSlot(uint32 serverCorpseSlot);
// client to server inventory location converters
static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot, ItemPacketType PacketType = ItemPacketInvalid);
static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct RoF2Slot);
static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse);
static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct rof2Slot, ItemPacketType PacketType = ItemPacketInvalid);
static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct rof2Slot);
static inline uint32 RoF2ToServerCorpseSlot(uint32 rof2CorpseSlot);
// server to client text link converter
static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink);
@ -4720,7 +4720,7 @@ namespace RoF2
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
Log.Out(Logs::General, Logs::Netcode, "[RoF2] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
emu->from_slot = RoF2ToServerSlot(eq->from_slot);
emu->to_slot = RoF2ToServerSlot(eq->to_slot);
IN(number_in_stack);
@ -5069,7 +5069,7 @@ namespace RoF2
hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0;
hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot;
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.last_cast_time = inst->GetRecastTimestamp();
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
@ -5589,7 +5589,7 @@ namespace RoF2
return item_serial;
}
static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot, ItemPacketType PacketType)
static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 serverSlot, ItemPacketType PacketType)
{
structs::ItemSlotStruct RoF2Slot;
RoF2Slot.SlotType = INVALID_INDEX;
@ -5601,25 +5601,25 @@ namespace RoF2
uint32 TempSlot = 0;
if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // Main Inventory and Cursor
if (serverSlot < 56 || serverSlot == MainPowerSource) { // Main Inventory and Cursor
if (PacketType == ItemPacketLoot)
{
RoF2Slot.SlotType = maps::MapCorpse;
RoF2Slot.MainSlot = ServerSlot - EmuConstants::CORPSE_BEGIN;
RoF2Slot.MainSlot = serverSlot - EmuConstants::CORPSE_BEGIN;
}
else
{
RoF2Slot.SlotType = maps::MapPossessions;
RoF2Slot.MainSlot = ServerSlot;
RoF2Slot.MainSlot = serverSlot;
}
if (ServerSlot == MainPowerSource)
if (serverSlot == MainPowerSource)
RoF2Slot.MainSlot = slots::MainPowerSource;
else if (ServerSlot >= MainCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory
else if (serverSlot >= MainCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory
RoF2Slot.MainSlot += 3;
else if (ServerSlot >= MainAmmo) // (> 20)
else if (serverSlot >= MainAmmo) // (> 20)
RoF2Slot.MainSlot += 1;
}
@ -5628,9 +5628,9 @@ namespace RoF2
RoF2Slot.MainSlot = ServerSlot - 31;
}*/
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) { // (> 250 && < 341)
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END) { // (> 250 && < 341)
RoF2Slot.SlotType = maps::MapPossessions;
TempSlot = ServerSlot - 1;
TempSlot = serverSlot - 1;
RoF2Slot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
@ -5638,14 +5638,14 @@ namespace RoF2
RoF2Slot.MainSlot = slots::MainCursor;
}
else if (ServerSlot >= EmuConstants::TRIBUTE_BEGIN && ServerSlot <= EmuConstants::TRIBUTE_END) { // Tribute
else if (serverSlot >= EmuConstants::TRIBUTE_BEGIN && serverSlot <= EmuConstants::TRIBUTE_END) { // Tribute
RoF2Slot.SlotType = maps::MapTribute;
RoF2Slot.MainSlot = ServerSlot - EmuConstants::TRIBUTE_BEGIN;
RoF2Slot.MainSlot = serverSlot - EmuConstants::TRIBUTE_BEGIN;
}
else if (ServerSlot >= EmuConstants::BANK_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END) {
else if (serverSlot >= EmuConstants::BANK_BEGIN && serverSlot <= EmuConstants::BANK_BAGS_END) {
RoF2Slot.SlotType = maps::MapBank;
TempSlot = ServerSlot - EmuConstants::BANK_BEGIN;
TempSlot = serverSlot - EmuConstants::BANK_BEGIN;
RoF2Slot.MainSlot = TempSlot;
if (TempSlot > 30) { // (> 30)
@ -5654,9 +5654,9 @@ namespace RoF2
}
}
else if (ServerSlot >= EmuConstants::SHARED_BANK_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END) {
else if (serverSlot >= EmuConstants::SHARED_BANK_BEGIN && serverSlot <= EmuConstants::SHARED_BANK_BAGS_END) {
RoF2Slot.SlotType = maps::MapSharedBank;
TempSlot = ServerSlot - EmuConstants::SHARED_BANK_BEGIN;
TempSlot = serverSlot - EmuConstants::SHARED_BANK_BEGIN;
RoF2Slot.MainSlot = TempSlot;
if (TempSlot > 30) { // (> 30)
@ -5665,9 +5665,9 @@ namespace RoF2
}
}
else if (ServerSlot >= EmuConstants::TRADE_BEGIN && ServerSlot <= EmuConstants::TRADE_BAGS_END) {
else if (serverSlot >= EmuConstants::TRADE_BEGIN && serverSlot <= EmuConstants::TRADE_BAGS_END) {
RoF2Slot.SlotType = maps::MapTrade;
TempSlot = ServerSlot - EmuConstants::TRADE_BEGIN;
TempSlot = serverSlot - EmuConstants::TRADE_BEGIN;
RoF2Slot.MainSlot = TempSlot;
if (TempSlot > 30) {
@ -5689,18 +5689,18 @@ namespace RoF2
*/
}
else if (ServerSlot >= EmuConstants::WORLD_BEGIN && ServerSlot <= EmuConstants::WORLD_END) {
else if (serverSlot >= EmuConstants::WORLD_BEGIN && serverSlot <= EmuConstants::WORLD_END) {
RoF2Slot.SlotType = maps::MapWorld;
TempSlot = ServerSlot - EmuConstants::WORLD_BEGIN;
TempSlot = serverSlot - EmuConstants::WORLD_BEGIN;
RoF2Slot.MainSlot = TempSlot;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
return RoF2Slot;
}
static inline structs::MainInvItemSlotStruct ServerToRoF2MainInvSlot(uint32 ServerSlot)
static inline structs::MainInvItemSlotStruct ServerToRoF2MainInvSlot(uint32 serverSlot)
{
structs::MainInvItemSlotStruct RoF2Slot;
RoF2Slot.MainSlot = INVALID_INDEX;
@ -5710,16 +5710,16 @@ namespace RoF2
uint32 TempSlot = 0;
if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // (< 52)
RoF2Slot.MainSlot = ServerSlot;
if (serverSlot < 56 || serverSlot == MainPowerSource) { // (< 52)
RoF2Slot.MainSlot = serverSlot;
if (ServerSlot == MainPowerSource)
if (serverSlot == MainPowerSource)
RoF2Slot.MainSlot = slots::MainPowerSource;
else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory
else if (serverSlot >= MainCursor) // Cursor and Extended Corpse Inventory
RoF2Slot.MainSlot += 3;
else if (ServerSlot >= MainAmmo) // Ammo and Personl Inventory
else if (serverSlot >= MainAmmo) // Ammo and Personl Inventory
RoF2Slot.MainSlot += 1;
/*else if (ServerSlot >= MainCursor) { // Cursor
@ -5730,33 +5730,33 @@ namespace RoF2
}*/
}
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) {
TempSlot = ServerSlot - 1;
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END) {
TempSlot = serverSlot - 1;
RoF2Slot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
return RoF2Slot;
}
static inline uint32 ServerToRoF2CorpseSlot(uint32 ServerCorpse)
static inline uint32 ServerToRoF2CorpseSlot(uint32 serverCorpseSlot)
{
return (ServerCorpse - EmuConstants::CORPSE_BEGIN + 1);
return (serverCorpseSlot - EmuConstants::CORPSE_BEGIN + 1);
}
static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot, ItemPacketType PacketType)
static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct rof2Slot, ItemPacketType PacketType)
{
uint32 ServerSlot = INVALID_INDEX;
uint32 TempSlot = 0;
if (RoF2Slot.SlotType == maps::MapPossessions && RoF2Slot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (RoF2Slot.MainSlot == slots::MainPowerSource)
if (rof2Slot.SlotType == maps::MapPossessions && rof2Slot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (rof2Slot.MainSlot == slots::MainPowerSource)
TempSlot = MainPowerSource;
else if (RoF2Slot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = RoF2Slot.MainSlot - 3;
else if (rof2Slot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = rof2Slot.MainSlot - 3;
/*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory/corpse slots
// Need to figure out what to do when we get these
@ -5769,61 +5769,61 @@ namespace RoF2
// For now, it's probably best to leave as-is and let this work itself out in the inventory rework.
}*/
else if (RoF2Slot.MainSlot >= slots::MainAmmo) // Ammo and Main Inventory
TempSlot = RoF2Slot.MainSlot - 1;
else if (rof2Slot.MainSlot >= slots::MainAmmo) // Ammo and Main Inventory
TempSlot = rof2Slot.MainSlot - 1;
else // Worn Slots
TempSlot = RoF2Slot.MainSlot;
TempSlot = rof2Slot.MainSlot;
if (RoF2Slot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1;
if (rof2Slot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rof2Slot.SubSlot + 1;
ServerSlot = TempSlot;
}
else if (RoF2Slot.SlotType == maps::MapBank) {
else if (rof2Slot.SlotType == maps::MapBank) {
TempSlot = EmuConstants::BANK_BEGIN;
if (RoF2Slot.SubSlot >= SUB_BEGIN)
TempSlot += ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1;
if (rof2Slot.SubSlot >= SUB_BEGIN)
TempSlot += ((rof2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rof2Slot.SubSlot + 1;
else
TempSlot += RoF2Slot.MainSlot;
TempSlot += rof2Slot.MainSlot;
ServerSlot = TempSlot;
}
else if (RoF2Slot.SlotType == maps::MapSharedBank) {
else if (rof2Slot.SlotType == maps::MapSharedBank) {
TempSlot = EmuConstants::SHARED_BANK_BEGIN;
if (RoF2Slot.SubSlot >= SUB_BEGIN)
TempSlot += ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1;
if (rof2Slot.SubSlot >= SUB_BEGIN)
TempSlot += ((rof2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rof2Slot.SubSlot + 1;
else
TempSlot += RoF2Slot.MainSlot;
TempSlot += rof2Slot.MainSlot;
ServerSlot = TempSlot;
}
else if (RoF2Slot.SlotType == maps::MapTrade) {
else if (rof2Slot.SlotType == maps::MapTrade) {
TempSlot = EmuConstants::TRADE_BEGIN;
if (RoF2Slot.SubSlot >= SUB_BEGIN)
TempSlot += ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1;
if (rof2Slot.SubSlot >= SUB_BEGIN)
TempSlot += ((rof2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rof2Slot.SubSlot + 1;
// OLD CODE:
//TempSlot += 100 + (RoF2Slot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot;
else
TempSlot += RoF2Slot.MainSlot;
TempSlot += rof2Slot.MainSlot;
ServerSlot = TempSlot;
}
else if (RoF2Slot.SlotType == maps::MapWorld) {
else if (rof2Slot.SlotType == maps::MapWorld) {
TempSlot = EmuConstants::WORLD_BEGIN;
if (RoF2Slot.MainSlot >= SUB_BEGIN)
TempSlot += RoF2Slot.MainSlot;
if (rof2Slot.MainSlot >= SUB_BEGIN)
TempSlot += rof2Slot.MainSlot;
ServerSlot = TempSlot;
}
@ -5837,30 +5837,30 @@ namespace RoF2
ServerSlot = TempSlot;
}*/
else if (RoF2Slot.SlotType == maps::MapGuildTribute) {
else if (rof2Slot.SlotType == maps::MapGuildTribute) {
ServerSlot = INVALID_INDEX;
}
else if (RoF2Slot.SlotType == maps::MapCorpse) {
ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN;
else if (rof2Slot.SlotType == maps::MapCorpse) {
ServerSlot = rof2Slot.MainSlot + EmuConstants::CORPSE_BEGIN;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rof2Slot.SlotType, rof2Slot.Unknown02, rof2Slot.MainSlot, rof2Slot.SubSlot, rof2Slot.AugSlot, rof2Slot.Unknown01, ServerSlot);
return ServerSlot;
}
static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct RoF2Slot)
static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct rof2Slot)
{
uint32 ServerSlot = INVALID_INDEX;
uint32 TempSlot = 0;
if (RoF2Slot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (RoF2Slot.MainSlot == slots::MainPowerSource)
if (rof2Slot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (rof2Slot.MainSlot == slots::MainPowerSource)
TempSlot = MainPowerSource;
else if (RoF2Slot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = RoF2Slot.MainSlot - 3;
else if (rof2Slot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = rof2Slot.MainSlot - 3;
/*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory slots
// Need to figure out what to do when we get these
@ -5868,26 +5868,26 @@ namespace RoF2
// Same as above
}*/
else if (RoF2Slot.MainSlot >= slots::MainAmmo) // Main Inventory and Ammo Slots
TempSlot = RoF2Slot.MainSlot - 1;
else if (rof2Slot.MainSlot >= slots::MainAmmo) // Main Inventory and Ammo Slots
TempSlot = rof2Slot.MainSlot - 1;
else
TempSlot = RoF2Slot.MainSlot;
TempSlot = rof2Slot.MainSlot;
if (RoF2Slot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1;
if (rof2Slot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rof2Slot.SubSlot + 1;
ServerSlot = TempSlot;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rof2Slot.MainSlot, rof2Slot.SubSlot, rof2Slot.AugSlot, rof2Slot.Unknown01, ServerSlot);
return ServerSlot;
}
static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse)
static inline uint32 RoF2ToServerCorpseSlot(uint32 rof2CorpseSlot)
{
return (RoF2Corpse + EmuConstants::CORPSE_BEGIN - 1);
return (rof2CorpseSlot + EmuConstants::CORPSE_BEGIN - 1);
}
static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink)

View File

@ -1,5 +1,5 @@
#ifndef RoF2_H_
#define RoF2_H_
#ifndef ROF2_H_
#define ROF2_H_
#include "../struct_strategy.h"
@ -32,6 +32,4 @@ namespace RoF2 {
};
#endif /*RoF2_H_*/
#endif /*ROF2_H_*/

View File

@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef RoF2_CONSTANTS_H_
#define RoF2_CONSTANTS_H_
#ifndef ROF2_CONSTANTS_H_
#define ROF2_CONSTANTS_H_
#include "../types.h"
@ -193,7 +193,7 @@ namespace RoF2 {
}; //end namespace RoF2
#endif /*RoF2_CONSTANTS_H_*/
#endif /*ROF2_CONSTANTS_H_*/
/*
RoF2 Notes:

View File

@ -439,4 +439,3 @@ These fields must be in the order of how they are serialized!
#undef C
#undef S
#undef F

View File

@ -174,5 +174,6 @@ D(OP_WhoAllRequest)
D(OP_ZoneChange)
D(OP_ZoneEntry)
// End RoF Encodes/Decodes
#undef E
#undef D

View File

@ -1,5 +1,5 @@
#ifndef RoF2_STRUCTS_H_
#define RoF2_STRUCTS_H_
#ifndef ROF2_STRUCTS_H_
#define ROF2_STRUCTS_H_
namespace RoF2 {
namespace structs {
@ -1394,7 +1394,7 @@ struct Animation_Struct {
/*04*/
};
// solar: this is what causes the caster to animate and the target to
// this is what causes the caster to animate and the target to
// get the particle effects around them when a spell is cast
// also causes a buff icon
struct Action_Struct
@ -1445,7 +1445,7 @@ struct ActionAlt_Struct
/*56*/
};
// solar: this is what prints the You have been struck. and the regular
// this is what prints the You have been struck. and the regular
// melee messages like You try to pierce, etc. It's basically the melee
// and spell damage message
struct CombatDamage_Struct
@ -1997,7 +1997,7 @@ struct RandomReq_Struct {
uint32 high;
};
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
/* 9/23/03 reply to /random command */
struct RandomReply_Struct {
/* 00 */ uint32 low;
/* 04 */ uint32 high;
@ -4881,4 +4881,4 @@ struct MercenaryMerchantResponse_Struct {
}; //end namespace structs
}; //end namespace RoF2
#endif /*RoF2_STRUCTS_H_*/
#endif /*ROF2_STRUCTS_H_*/

View File

@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef RoF_CONSTANTS_H_
#define RoF_CONSTANTS_H_
#ifndef ROF_CONSTANTS_H_
#define ROF_CONSTANTS_H_
#include "../types.h"
@ -192,7 +192,7 @@ namespace RoF {
}; //end namespace RoF
#endif /*RoF_CONSTANTS_H_*/
#endif /*ROF_CONSTANTS_H_*/
/*
RoF Notes:

View File

@ -439,4 +439,3 @@ These fields must be in the order of how they are serialized!
#undef C
#undef S
#undef F

View File

@ -162,5 +162,6 @@ D(OP_TributeItem)
D(OP_WhoAllRequest)
D(OP_ZoneChange)
D(OP_ZoneEntry)
#undef E
#undef D

View File

@ -1,5 +1,5 @@
#ifndef RoF_STRUCTS_H_
#define RoF_STRUCTS_H_
#ifndef ROF_STRUCTS_H_
#define ROF_STRUCTS_H_
namespace RoF {
namespace structs {
@ -1425,7 +1425,7 @@ struct Animation_Struct {
/*04*/
};
// solar: this is what causes the caster to animate and the target to
// this is what causes the caster to animate and the target to
// get the particle effects around them when a spell is cast
// also causes a buff icon
struct Action_Struct
@ -1476,7 +1476,7 @@ struct ActionAlt_Struct
/*56*/
};
// solar: this is what prints the You have been struck. and the regular
// this is what prints the You have been struck. and the regular
// melee messages like You try to pierce, etc. It's basically the melee
// and spell damage message
struct CombatDamage_Struct
@ -2028,7 +2028,7 @@ struct RandomReq_Struct {
uint32 high;
};
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
/* 9/23/03 reply to /random command */
struct RandomReply_Struct {
/* 00 */ uint32 low;
/* 04 */ uint32 high;
@ -4897,4 +4897,4 @@ struct MercenaryMerchantResponse_Struct {
}; //end namespace structs
}; //end namespace RoF
#endif /*RoF_STRUCTS_H_*/
#endif /*ROF_STRUCTS_H_*/

View File

@ -26,11 +26,11 @@ namespace SoD
// server to client inventory location converters
static inline uint32 ServerToSoDSlot(uint32 ServerSlot);
static inline uint32 ServerToSoDCorpseSlot(uint32 ServerCorpse);
static inline uint32 ServerToSoDCorpseSlot(uint32 serverCorpseSlot);
// client to server inventory location converters
static inline uint32 SoDToServerSlot(uint32 SoDSlot);
static inline uint32 SoDToServerCorpseSlot(uint32 SoDCorpse);
static inline uint32 SoDToServerSlot(uint32 sodSlot);
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot);
// server to client text link converter
static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink);
@ -3242,7 +3242,7 @@ namespace SoD
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(Logs::General, Logs::Netcode, "[SoD] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = SoDToServerSlot(eq->from_slot);
emu->to_slot = SoDToServerSlot(eq->to_slot);
@ -3548,7 +3548,7 @@ namespace SoD
hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0;
hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot;
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.last_cast_time = inst->GetRecastTimestamp();
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
@ -3961,54 +3961,54 @@ namespace SoD
return item_serial;
}
static inline uint32 ServerToSoDSlot(uint32 ServerSlot)
static inline uint32 ServerToSoDSlot(uint32 serverSlot)
{
uint32 SoDSlot = 0;
if (ServerSlot >= MainAmmo && ServerSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
SoDSlot = ServerSlot + 1;
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END)
SoDSlot = ServerSlot + 11;
else if (ServerSlot >= EmuConstants::BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END)
SoDSlot = ServerSlot + 1;
else if (ServerSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END)
SoDSlot = ServerSlot + 1;
else if (ServerSlot == MainPowerSource)
if (serverSlot >= MainAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
SoDSlot = serverSlot + 1;
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END)
SoDSlot = serverSlot + 11;
else if (serverSlot >= EmuConstants::BANK_BAGS_BEGIN && serverSlot <= EmuConstants::BANK_BAGS_END)
SoDSlot = serverSlot + 1;
else if (serverSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && serverSlot <= EmuConstants::SHARED_BANK_BAGS_END)
SoDSlot = serverSlot + 1;
else if (serverSlot == MainPowerSource)
SoDSlot = slots::MainPowerSource;
else
SoDSlot = ServerSlot;
SoDSlot = serverSlot;
return SoDSlot;
}
static inline uint32 ServerToSoDCorpseSlot(uint32 ServerCorpse)
static inline uint32 ServerToSoDCorpseSlot(uint32 serverCorpseSlot)
{
//uint32 SoDCorpse;
return (ServerCorpse + 1);
return (serverCorpseSlot + 1);
}
static inline uint32 SoDToServerSlot(uint32 SoDSlot)
static inline uint32 SoDToServerSlot(uint32 sodSlot)
{
uint32 ServerSlot = 0;
if (SoDSlot >= slots::MainAmmo && SoDSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
ServerSlot = SoDSlot - 1;
else if (SoDSlot >= consts::GENERAL_BAGS_BEGIN && SoDSlot <= consts::CURSOR_BAG_END)
ServerSlot = SoDSlot - 11;
else if (SoDSlot >= consts::BANK_BAGS_BEGIN && SoDSlot <= consts::BANK_BAGS_END)
ServerSlot = SoDSlot - 1;
else if (SoDSlot >= consts::SHARED_BANK_BAGS_BEGIN && SoDSlot <= consts::SHARED_BANK_BAGS_END)
ServerSlot = SoDSlot - 1;
else if (SoDSlot == slots::MainPowerSource)
if (sodSlot >= slots::MainAmmo && sodSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
ServerSlot = sodSlot - 1;
else if (sodSlot >= consts::GENERAL_BAGS_BEGIN && sodSlot <= consts::CURSOR_BAG_END)
ServerSlot = sodSlot - 11;
else if (sodSlot >= consts::BANK_BAGS_BEGIN && sodSlot <= consts::BANK_BAGS_END)
ServerSlot = sodSlot - 1;
else if (sodSlot >= consts::SHARED_BANK_BAGS_BEGIN && sodSlot <= consts::SHARED_BANK_BAGS_END)
ServerSlot = sodSlot - 1;
else if (sodSlot == slots::MainPowerSource)
ServerSlot = MainPowerSource;
else
ServerSlot = SoDSlot;
ServerSlot = sodSlot;
return ServerSlot;
}
static inline uint32 SoDToServerCorpseSlot(uint32 SoDCorpse)
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot)
{
//uint32 ServerCorpse;
return (SoDCorpse - 1);
return (sodCorpseSlot - 1);
}
static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink)

View File

@ -1,5 +1,5 @@
#ifndef SoD_H_
#define SoD_H_
#ifndef SOD_H_
#define SOD_H_
#include "../struct_strategy.h"
@ -32,6 +32,4 @@ namespace SoD {
};
#endif /*SoD_H_*/
#endif /*SOD_H_*/

View File

@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SoD_CONSTANTS_H_
#define SoD_CONSTANTS_H_
#ifndef SOD_CONSTANTS_H_
#define SOD_CONSTANTS_H_
#include "../types.h"
@ -189,7 +189,7 @@ namespace SoD {
}; //end namespace SoD
#endif /*SoD_CONSTANTS_H_*/
#endif /*SOD_CONSTANTS_H_*/
/*
SoD Notes:

View File

@ -436,4 +436,3 @@ These fields must be in the order of how they are serialized!
#undef C
#undef S
#undef F

View File

@ -120,5 +120,6 @@ D(OP_TradeSkillCombine)
D(OP_TributeItem)
D(OP_WearChange)
D(OP_WhoAllRequest)
#undef E
#undef D

View File

@ -1,5 +1,5 @@
#ifndef SoD_STRUCTS_H_
#define SoD_STRUCTS_H_
#ifndef SOD_STRUCTS_H_
#define SOD_STRUCTS_H_
namespace SoD {
namespace structs {
@ -538,7 +538,7 @@ struct SpawnAppearance_Struct
};
// solar: this is used inside profile
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
@ -1196,7 +1196,7 @@ struct Animation_Struct {
/*04*/
};
// solar: this is what causes the caster to animate and the target to
// this is what causes the caster to animate and the target to
// get the particle effects around them when a spell is cast
// also causes a buff icon
struct Action_Struct
@ -1248,7 +1248,7 @@ struct ActionAlt_Struct // ActionAlt_Struct - Size: 56 bytes
/*0056*/
};
// solar: this is what prints the You have been struck. and the regular
// this is what prints the You have been struck. and the regular
// melee messages like You try to pierce, etc. It's basically the melee
// and spell damage message
struct CombatDamage_Struct
@ -1791,7 +1791,7 @@ struct RandomReq_Struct {
uint32 high;
};
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
/* 9/23/03 reply to /random command */
struct RandomReply_Struct {
/* 00 */ uint32 low;
/* 04 */ uint32 high;
@ -4412,4 +4412,4 @@ struct MercenaryAssign_Struct {
}; //end namespace structs
}; //end namespace SoD
#endif /*SoD_STRUCTS_H_*/
#endif /*SOD_STRUCTS_H_*/

View File

@ -25,12 +25,12 @@ namespace SoF
char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth);
// server to client inventory location converters
static inline uint32 ServerToSoFSlot(uint32 ServerSlot);
static inline uint32 ServerToSoFCorpseSlot(uint32 ServerCorpse);
static inline uint32 ServerToSoFSlot(uint32 serverSlot);
static inline uint32 ServerToSoFCorpseSlot(uint32 serverCorpseSlot);
// client to server inventory location converters
static inline uint32 SoFToServerSlot(uint32 SoFSlot);
static inline uint32 SoFToServerCorpseSlot(uint32 SoFCorpse);
static inline uint32 SoFToServerSlot(uint32 sofSlot);
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot);
// server to client text link converter
static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink);
@ -2580,7 +2580,7 @@ namespace SoF
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(Logs::General, Logs::Netcode, "[SoF] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = SoFToServerSlot(eq->from_slot);
emu->to_slot = SoFToServerSlot(eq->to_slot);
@ -2872,7 +2872,7 @@ namespace SoF
hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0;
hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot;
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.last_cast_time = inst->GetRecastTimestamp();
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
@ -3281,56 +3281,56 @@ namespace SoF
return item_serial;
}
static inline uint32 ServerToSoFSlot(uint32 ServerSlot)
static inline uint32 ServerToSoFSlot(uint32 serverSlot)
{
uint32 SoFSlot = 0;
if (ServerSlot >= MainAmmo && ServerSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
SoFSlot = ServerSlot + 1;
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END)
SoFSlot = ServerSlot + 11;
else if (ServerSlot >= EmuConstants::BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END)
SoFSlot = ServerSlot + 1;
else if (ServerSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END)
SoFSlot = ServerSlot + 1;
else if (ServerSlot == MainPowerSource)
if (serverSlot >= MainAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
SoFSlot = serverSlot + 1;
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END)
SoFSlot = serverSlot + 11;
else if (serverSlot >= EmuConstants::BANK_BAGS_BEGIN && serverSlot <= EmuConstants::BANK_BAGS_END)
SoFSlot = serverSlot + 1;
else if (serverSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && serverSlot <= EmuConstants::SHARED_BANK_BAGS_END)
SoFSlot = serverSlot + 1;
else if (serverSlot == MainPowerSource)
SoFSlot = slots::MainPowerSource;
else
SoFSlot = ServerSlot;
SoFSlot = serverSlot;
return SoFSlot;
}
static inline uint32 ServerToSoFCorpseSlot(uint32 ServerCorpse)
static inline uint32 ServerToSoFCorpseSlot(uint32 serverCorpseSlot)
{
//uint32 SoFCorpse;
return (ServerCorpse + 1);
return (serverCorpseSlot + 1);
}
static inline uint32 SoFToServerSlot(uint32 SoFSlot)
static inline uint32 SoFToServerSlot(uint32 sofSlot)
{
uint32 ServerSlot = 0;
if (SoFSlot >= slots::MainAmmo && SoFSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
ServerSlot = SoFSlot - 1;
else if (SoFSlot >= consts::GENERAL_BAGS_BEGIN && SoFSlot <= consts::CURSOR_BAG_END)
ServerSlot = SoFSlot - 11;
else if (SoFSlot >= consts::BANK_BAGS_BEGIN && SoFSlot <= consts::BANK_BAGS_END)
ServerSlot = SoFSlot - 1;
else if (SoFSlot >= consts::SHARED_BANK_BAGS_BEGIN && SoFSlot <= consts::SHARED_BANK_BAGS_END)
ServerSlot = SoFSlot - 1;
else if (SoFSlot == slots::MainPowerSource)
if (sofSlot >= slots::MainAmmo && sofSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
ServerSlot = sofSlot - 1;
else if (sofSlot >= consts::GENERAL_BAGS_BEGIN && sofSlot <= consts::CURSOR_BAG_END)
ServerSlot = sofSlot - 11;
else if (sofSlot >= consts::BANK_BAGS_BEGIN && sofSlot <= consts::BANK_BAGS_END)
ServerSlot = sofSlot - 1;
else if (sofSlot >= consts::SHARED_BANK_BAGS_BEGIN && sofSlot <= consts::SHARED_BANK_BAGS_END)
ServerSlot = sofSlot - 1;
else if (sofSlot == slots::MainPowerSource)
ServerSlot = MainPowerSource;
else
ServerSlot = SoFSlot;
ServerSlot = sofSlot;
return ServerSlot;
}
static inline uint32 SoFToServerCorpseSlot(uint32 SoFCorpse)
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot)
{
//uint32 ServerCorpse;
return (SoFCorpse - 1);
return (sofCorpseSlot - 1);
}
static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink)

View File

@ -1,5 +1,5 @@
#ifndef SoF_H_
#define SoF_H_
#ifndef SOF_H_
#define SOF_H_
#include "../struct_strategy.h"
@ -32,6 +32,4 @@ namespace SoF {
};
#endif /*SoF_H_*/
#endif /*SOF_H_*/

View File

@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SoF_CONSTANTS_H_
#define SoF_CONSTANTS_H_
#ifndef SOF_CONSTANTS_H_
#define SOF_CONSTANTS_H_
#include "../types.h"
@ -189,7 +189,7 @@ namespace SoF {
}; //end namespace SoF
#endif /*SoF_CONSTANTS_H_*/
#endif /*SOF_CONSTANTS_H_*/
/*
SoF Notes:

View File

@ -436,4 +436,3 @@ These fields must be in the order of how they are serialized!
#undef C
#undef S
#undef F

View File

@ -1226,4 +1226,3 @@
0xFFFFFFFF,
// 1217 (0x4c1) opcodes counted

View File

@ -103,5 +103,6 @@ D(OP_TradeSkillCombine)
D(OP_TributeItem)
D(OP_WearChange)
D(OP_WhoAllRequest)
#undef E
#undef D

View File

@ -1,5 +1,5 @@
#ifndef SoF_STRUCTS_H_
#define SoF_STRUCTS_H_
#ifndef SOF_STRUCTS_H_
#define SOF_STRUCTS_H_
namespace SoF {
namespace structs {
@ -515,7 +515,7 @@ struct SpawnAppearance_Struct
};
// solar: this is used inside profile
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
@ -1172,7 +1172,7 @@ struct Animation_Struct {
/*04*/
};
// solar: this is what causes the caster to animate and the target to
// this is what causes the caster to animate and the target to
// get the particle effects around them when a spell is cast
// also causes a buff icon
struct Action_Struct
@ -1224,7 +1224,7 @@ struct ActionAlt_Struct // ActionAlt_Struct - Size: 56 bytes
/*0056*/
};
// solar: this is what prints the You have been struck. and the regular
// this is what prints the You have been struck. and the regular
// melee messages like You try to pierce, etc. It's basically the melee
// and spell damage message
struct CombatDamage_Struct
@ -1768,7 +1768,7 @@ struct RandomReq_Struct {
uint32 high;
};
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
/* 9/23/03 reply to /random command */
struct RandomReply_Struct {
/* 00 */ uint32 low;
/* 04 */ uint32 high;
@ -4118,4 +4118,4 @@ struct AltCurrencySellItem_Struct {
}; //end namespace structs
}; //end namespace SoF
#endif /*SoF_STRUCTS_H_*/
#endif /*SOF_STRUCTS_H_*/

View File

@ -1,6 +1,6 @@
#define E(x) static void Encode_##x(EQApplicationPacket **p, EQStream *dest, bool ack_req);
#define E(x) static void Encode_##x(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
#define D(x) static void Decode_##x(EQApplicationPacket *p);

View File

@ -1,5 +1,5 @@
#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, EQStream *dest, bool ack_req)
#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req)
#define DECODE(x) void Strategy::Decode_##x(EQApplicationPacket *__packet)
#define StructDist(in, f1, f2) (uint32(&in->f2)-uint32(&in->f1))

View File

@ -23,12 +23,12 @@ namespace Titanium
char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth);
// server to client inventory location converters
static inline int16 ServerToTitaniumSlot(uint32 ServerSlot);
static inline int16 ServerToTitaniumCorpseSlot(uint32 ServerCorpse);
static inline int16 ServerToTitaniumSlot(uint32 serverSlot);
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot);
// client to server inventory location converters
static inline uint32 TitaniumToServerSlot(int16 TitaniumSlot);
static inline uint32 TitaniumToServerCorpseSlot(int16 TitaniumCorpse);
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot);
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot);
// server to client text link converter
static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink);
@ -113,7 +113,7 @@ namespace Titanium
const ClientVersion Strategy::GetClientVersion() const
{
return ClientVersion::Tit;
return ClientVersion::Titanium;
}
#include "ss_define.h"
@ -1774,7 +1774,7 @@ namespace Titanium
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(Logs::General, Logs::Netcode, "[Titanium] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = TitaniumToServerSlot(eq->from_slot);
emu->to_slot = TitaniumToServerSlot(eq->to_slot);
@ -2004,7 +2004,7 @@ namespace Titanium
inst->IsScaling() ? inst->GetExp() / 100 : 0,
//merchant_slot, //instance ID, bullshit for now
(merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot,
0, // item recast timer timestamp field (aka..last_cast_time field in SoF+ clients)
inst->GetRecastTimestamp(),
(stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges),
inst->IsAttuned() ? 1 : 0,
0
@ -2062,34 +2062,34 @@ namespace Titanium
return serialization;
}
static inline int16 ServerToTitaniumSlot(uint32 ServerSlot)
static inline int16 ServerToTitaniumSlot(uint32 serverSlot)
{
//int16 TitaniumSlot;
if (ServerSlot == INVALID_INDEX)
if (serverSlot == INVALID_INDEX)
return INVALID_INDEX;
return ServerSlot; // deprecated
return serverSlot; // deprecated
}
static inline int16 ServerToTitaniumCorpseSlot(uint32 ServerCorpse)
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot)
{
//int16 TitaniumCorpse;
return ServerCorpse;
return serverCorpseSlot;
}
static inline uint32 TitaniumToServerSlot(int16 TitaniumSlot)
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot)
{
//uint32 ServerSlot;
if (TitaniumSlot == INVALID_INDEX)
if (titaniumSlot == INVALID_INDEX)
return INVALID_INDEX;
return TitaniumSlot; // deprecated
return titaniumSlot; // deprecated
}
static inline uint32 TitaniumToServerCorpseSlot(int16 TitaniumCorpse)
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot)
{
//uint32 ServerCorpse;
return TitaniumCorpse;
return titaniumCorpseSlot;
}
static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink)

View File

@ -1,5 +1,5 @@
#ifndef Titanium_H_
#define Titanium_H_
#ifndef TITANIUM_H_
#define TITANIUM_H_
#include "../struct_strategy.h"
@ -32,6 +32,4 @@ namespace Titanium {
};
#endif /*Titanium_H_*/
#endif /*TITANIUM_H_*/

View File

@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef Titanium_CONSTANTS_H_
#define Titanium_CONSTANTS_H_
#ifndef TITANIUM_CONSTANTS_H_
#define TITANIUM_CONSTANTS_H_
#include "../types.h"
@ -188,7 +188,7 @@ namespace Titanium {
}; //end namespace Titanium
#endif /*Titanium_CONSTANTS_H_*/
#endif /*TITANIUM_CONSTANTS_H_*/
/*
Titanium Notes:

View File

@ -167,8 +167,8 @@ These fields must be in the order of how they are serialized!
/* 156 */ I(Scroll.Level2)
/* 157 */ I(Scroll.Level)
/* 158 */ C("0")
#undef I
#undef C
#undef S
#undef F

View File

@ -75,5 +75,6 @@ D(OP_TradeSkillCombine)
D(OP_TributeItem)
D(OP_WearChange)
D(OP_WhoAllRequest)
#undef E
#undef D

View File

@ -1,5 +1,5 @@
#ifndef Titanium_STRUCTS_H_
#define Titanium_STRUCTS_H_
#ifndef TITANIUM_STRUCTS_H_
#define TITANIUM_STRUCTS_H_
namespace Titanium {
namespace structs {
@ -438,7 +438,7 @@ struct SpawnAppearance_Struct
};
// solar: this is used inside profile
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
@ -1054,7 +1054,7 @@ struct Animation_Struct {
/*04*/
};
// solar: this is what causes the caster to animate and the target to
// this is what causes the caster to animate and the target to
// get the particle effects around them when a spell is cast
// also causes a buff icon
struct Action_Struct
@ -1078,7 +1078,7 @@ struct Action_Struct
/* 31 */
};
// solar: this is what prints the You have been struck. and the regular
// this is what prints the You have been struck. and the regular
// melee messages like You try to pierce, etc. It's basically the melee
// and spell damage message
struct CombatDamage_Struct
@ -1516,7 +1516,7 @@ struct RandomReq_Struct {
uint32 high;
};
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
/* 9/23/03 reply to /random command */
struct RandomReply_Struct {
/* 00 */ uint32 low;
/* 04 */ uint32 high;
@ -3332,4 +3332,4 @@ struct LFGuild_GuildToggle_Struct
}; //end namespace structs
}; //end namespace Titanium
#endif /*Titanium_STRUCTS_H_*/
#endif /*TITANIUM_STRUCTS_H_*/

View File

@ -1,6 +1,6 @@
#include "../global_define.h"
#include "../eqemu_logsys.h"
#include "underfoot.h"
#include "uf.h"
#include "../opcodemgr.h"
#include "../eq_stream_ident.h"
@ -10,33 +10,33 @@
#include "../misc_functions.h"
#include "../string_util.h"
#include "../item.h"
#include "underfoot_structs.h"
#include "uf_structs.h"
#include "../rulesys.h"
#include <iostream>
#include <sstream>
namespace Underfoot
namespace UF
{
static const char *name = "Underfoot";
static const char *name = "UF";
static OpcodeManager *opcodes = nullptr;
static Strategy struct_strategy;
char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth);
// server to client inventory location converters
static inline uint32 ServerToUnderfootSlot(uint32 ServerSlot);
static inline uint32 ServerToUnderFootCorpseSlot(uint32 ServerCorpse);
static inline uint32 ServerToUFSlot(uint32 serverSlot);
static inline uint32 ServerToUFCorpseSlot(uint32 serverCorpseSlot);
// client to server inventory location converters
static inline uint32 UnderfootToServerSlot(uint32 UnderfootSlot);
static inline uint32 UnderfootToServerCorpseSlot(uint32 UnderfootCorpse);
static inline uint32 UFToServerSlot(uint32 ufSlot);
static inline uint32 UFToServerCorpseSlot(uint32 ufCorpseSlot);
// server to client text link converter
static inline void ServerToUnderfootTextLink(std::string& underfootTextLink, const std::string& serverTextLink);
static inline void ServerToUFTextLink(std::string& ufTextLink, const std::string& serverTextLink);
// client to server text link converter
static inline void UnderfootToServerTextLink(std::string& serverTextLink, const std::string& underfootTextLink);
static inline void UFToServerTextLink(std::string& serverTextLink, const std::string& ufTextLink);
void Register(EQStreamIdentifier &into)
{
@ -102,7 +102,7 @@ namespace Underfoot
{
//all opcodes default to passthrough.
#include "ss_register.h"
#include "underfoot_ops.h"
#include "uf_ops.h"
}
std::string Strategy::Describe() const
@ -115,7 +115,7 @@ namespace Underfoot
const ClientVersion Strategy::GetClientVersion() const
{
return ClientVersion::Und;
return ClientVersion::UF;
}
#include "ss_define.h"
@ -164,7 +164,7 @@ namespace Underfoot
eq->unknown000 = 1;
OUT(npcid);
eq->slot = ServerToUnderfootSlot(emu->slot);
eq->slot = ServerToUFSlot(emu->slot);
OUT(charges);
OUT(sell_price);
@ -215,7 +215,7 @@ namespace Underfoot
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
OUT(merchant_entity_id);
eq->slot_id = ServerToUnderfootSlot(emu->slot_id);
eq->slot_id = ServerToUFSlot(emu->slot_id);
OUT(charges);
OUT(cost);
@ -227,7 +227,7 @@ namespace Underfoot
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
eq->inventorySlot = ServerToUnderfootSlot(emu->inventorySlot);
eq->inventorySlot = ServerToUFSlot(emu->inventorySlot);
OUT(success);
FINISH_ENCODE();
@ -441,7 +441,7 @@ namespace Underfoot
std::string old_message = emu->message;
std::string new_message;
ServerToUnderfootTextLink(new_message, old_message);
ServerToUFTextLink(new_message, old_message);
//in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36;
in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39;
@ -593,8 +593,8 @@ namespace Underfoot
ENCODE_LENGTH_EXACT(DeleteItem_Struct);
SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct);
eq->from_slot = ServerToUnderfootSlot(emu->from_slot);
eq->to_slot = ServerToUnderfootSlot(emu->to_slot);
eq->from_slot = ServerToUFSlot(emu->from_slot);
eq->to_slot = ServerToUFSlot(emu->to_slot);
OUT(number_in_stack);
FINISH_ENCODE();
@ -755,7 +755,7 @@ namespace Underfoot
std::string old_message = emu->message;
std::string new_message;
ServerToUnderfootTextLink(new_message, old_message);
ServerToUFTextLink(new_message, old_message);
//if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm)
// new_message = new_message.substr(0, 512);
@ -807,7 +807,7 @@ namespace Underfoot
for (int i = 0; i < 9; ++i) {
if (old_message_array[i].length() == 0) { break; }
ServerToUnderfootTextLink(new_message_array[i], old_message_array[i]);
ServerToUFTextLink(new_message_array[i], old_message_array[i]);
new_message_size += new_message_array[i].length() + 1;
}
@ -1287,7 +1287,7 @@ namespace Underfoot
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
SETUP_DIRECT_ENCODE(ItemVerifyReply_Struct, structs::ItemVerifyReply_Struct);
eq->slot = ServerToUnderfootSlot(emu->slot);
eq->slot = ServerToUFSlot(emu->slot);
OUT(spell);
OUT(target);
@ -1344,7 +1344,7 @@ namespace Underfoot
OUT(lootee);
OUT(looter);
eq->slot_id = ServerToUnderFootCorpseSlot(emu->slot_id);
eq->slot_id = ServerToUFCorpseSlot(emu->slot_id);
OUT(auto_loot);
FINISH_ENCODE();
@ -1506,8 +1506,8 @@ namespace Underfoot
ENCODE_LENGTH_EXACT(MoveItem_Struct);
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
eq->from_slot = ServerToUnderfootSlot(emu->from_slot);
eq->to_slot = ServerToUnderfootSlot(emu->to_slot);
eq->from_slot = ServerToUFSlot(emu->from_slot);
eq->to_slot = ServerToUFSlot(emu->to_slot);
OUT(number_in_stack);
FINISH_ENCODE();
@ -2093,7 +2093,7 @@ namespace Underfoot
else
eq->window = emu->window;
OUT(type);
eq->invslot = ServerToUnderfootSlot(emu->invslot);
eq->invslot = ServerToUFSlot(emu->invslot);
strn0cpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile));
FINISH_ENCODE();
@ -2290,7 +2290,7 @@ namespace Underfoot
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
OUT(npcid);
eq->itemslot = ServerToUnderfootSlot(emu->itemslot);
eq->itemslot = ServerToUFSlot(emu->itemslot);
OUT(quantity);
OUT(price);
@ -2399,7 +2399,7 @@ namespace Underfoot
std::string old_message = &emu->message[strlen(emu->sayer)];
std::string new_message;
ServerToUnderfootTextLink(new_message, old_message);
ServerToUFTextLink(new_message, old_message);
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
in->size = strlen(emu->sayer) + new_message.length() + 25;
@ -2469,7 +2469,7 @@ namespace Underfoot
std::string old_message = InBuffer; // start 'Reward' as string
std::string new_message;
ServerToUnderfootTextLink(new_message, old_message);
ServerToUFTextLink(new_message, old_message);
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
@ -2570,7 +2570,7 @@ namespace Underfoot
ENCODE_LENGTH_EXACT(TributeItem_Struct);
SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct);
eq->slot = ServerToUnderfootSlot(emu->slot);
eq->slot = ServerToUFSlot(emu->slot);
OUT(quantity);
OUT(tribute_master_id);
OUT(tribute_points);
@ -3060,7 +3060,7 @@ namespace Underfoot
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
IN(npcid);
emu->slot = UnderfootToServerSlot(eq->slot);
emu->slot = UFToServerSlot(eq->slot);
IN(charges);
IN(sell_price);
@ -3073,7 +3073,7 @@ namespace Underfoot
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
IN(merchant_entity_id);
emu->slot_id = UnderfootToServerSlot(eq->slot_id);
emu->slot_id = UFToServerSlot(eq->slot_id);
IN(charges);
IN(cost);
@ -3086,7 +3086,7 @@ namespace Underfoot
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
IN(merchant_entity_id);
emu->slot_id = UnderfootToServerSlot(eq->slot_id);
emu->slot_id = UFToServerSlot(eq->slot_id);
FINISH_DIRECT_DECODE();
}
@ -3096,7 +3096,7 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
emu->inventorySlot = UnderfootToServerSlot(eq->inventorySlot);
emu->inventorySlot = UFToServerSlot(eq->inventorySlot);
IN(success);
FINISH_DIRECT_DECODE();
@ -3118,7 +3118,7 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::AugmentItem_Struct);
SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct);
emu->container_slot = UnderfootToServerSlot(eq->container_slot);
emu->container_slot = UFToServerSlot(eq->container_slot);
emu->augment_slot = eq->augment_slot;
FINISH_DIRECT_DECODE();
@ -3184,7 +3184,7 @@ namespace Underfoot
IN(slot);
IN(spell_id);
emu->inventoryslot = UnderfootToServerSlot(eq->inventoryslot);
emu->inventoryslot = UFToServerSlot(eq->inventoryslot);
IN(target_id);
IN(cs_unknown1);
IN(cs_unknown2);
@ -3218,7 +3218,7 @@ namespace Underfoot
std::string old_message = InBuffer;
std::string new_message;
UnderfootToServerTextLink(new_message, old_message);
UFToServerTextLink(new_message, old_message);
//__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1;
__packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
@ -3312,7 +3312,7 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::Consume_Struct);
SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct);
emu->slot = UnderfootToServerSlot(eq->slot);
emu->slot = UFToServerSlot(eq->slot);
IN(auto_consumed);
IN(type);
@ -3339,8 +3339,8 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::DeleteItem_Struct);
SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct);
emu->from_slot = UnderfootToServerSlot(eq->from_slot);
emu->to_slot = UnderfootToServerSlot(eq->to_slot);
emu->from_slot = UFToServerSlot(eq->from_slot);
emu->to_slot = UFToServerSlot(eq->to_slot);
IN(number_in_stack);
FINISH_DIRECT_DECODE();
@ -3352,7 +3352,7 @@ namespace Underfoot
std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset
std::string new_message;
UnderfootToServerTextLink(new_message, old_message);
UFToServerTextLink(new_message, old_message);
__packet->size = sizeof(Emote_Struct);
__packet->pBuffer = new unsigned char[__packet->size];
@ -3519,7 +3519,7 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::ItemVerifyRequest_Struct);
SETUP_DIRECT_DECODE(ItemVerifyRequest_Struct, structs::ItemVerifyRequest_Struct);
emu->slot = UnderfootToServerSlot(eq->slot);
emu->slot = UFToServerSlot(eq->slot);
IN(target);
FINISH_DIRECT_DECODE();
@ -3546,7 +3546,7 @@ namespace Underfoot
IN(lootee);
IN(looter);
emu->slot_id = UnderfootToServerCorpseSlot(eq->slot_id);
emu->slot_id = UFToServerCorpseSlot(eq->slot_id);
IN(auto_loot);
FINISH_DIRECT_DECODE();
@ -3557,10 +3557,10 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(Logs::General, Logs::Netcode, "[UF] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = UnderfootToServerSlot(eq->from_slot);
emu->to_slot = UnderfootToServerSlot(eq->to_slot);
emu->from_slot = UFToServerSlot(eq->from_slot);
emu->to_slot = UFToServerSlot(eq->to_slot);
IN(number_in_stack);
FINISH_DIRECT_DECODE();
@ -3622,7 +3622,7 @@ namespace Underfoot
SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct);
IN(type);
emu->invslot = UnderfootToServerSlot(eq->invslot);
emu->invslot = UFToServerSlot(eq->invslot);
emu->window = (uint8)eq->window;
strn0cpy(emu->txtfile, eq->txtfile, sizeof(emu->txtfile));
@ -3672,7 +3672,7 @@ namespace Underfoot
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
IN(npcid);
emu->itemslot = UnderfootToServerSlot(eq->itemslot);
emu->itemslot = UFToServerSlot(eq->itemslot);
IN(quantity);
IN(price);
@ -3700,7 +3700,7 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::NewCombine_Struct);
SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct);
emu->container_slot = UnderfootToServerSlot(eq->container_slot);
emu->container_slot = UFToServerSlot(eq->container_slot);
IN(guildtribute_slot);
FINISH_DIRECT_DECODE();
@ -3711,7 +3711,7 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::TributeItem_Struct);
SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct);
emu->slot = UnderfootToServerSlot(eq->slot);
emu->slot = UFToServerSlot(eq->slot);
IN(quantity);
IN(tribute_master_id);
IN(tribute_points);
@ -3781,11 +3781,11 @@ namespace Underfoot
const Item_Struct *item = inst->GetUnscaledItem();
//Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Serialize called for: %s", item->Name);
Underfoot::structs::ItemSerializationHeader hdr;
UF::structs::ItemSerializationHeader hdr;
hdr.stacksize = stackable ? charges : 1;
hdr.unknown004 = 0;
int32 slot_id = ServerToUnderfootSlot(slot_id_in);
int32 slot_id = ServerToUFSlot(slot_id_in);
hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot;
hdr.price = inst->GetPrice();
@ -3793,17 +3793,17 @@ namespace Underfoot
hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0;
hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot;
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.last_cast_time = inst->GetRecastTimestamp();
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
hdr.unknown048 = 0;
hdr.unknown052 = 0;
hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0;
ss.write((const char*)&hdr, sizeof(Underfoot::structs::ItemSerializationHeader));
ss.write((const char*)&hdr, sizeof(UF::structs::ItemSerializationHeader));
if (item->EvolvingLevel > 0) {
Underfoot::structs::EvolvingItem evotop;
UF::structs::EvolvingItem evotop;
evotop.unknown001 = 0;
evotop.unknown002 = 0;
evotop.unknown003 = 0;
@ -3812,7 +3812,7 @@ namespace Underfoot
evotop.progress = 95.512;
evotop.Activated = 1;
evotop.evomaxlevel = 7;
ss.write((const char*)&evotop, sizeof(Underfoot::structs::EvolvingItem));
ss.write((const char*)&evotop, sizeof(UF::structs::EvolvingItem));
}
//ORNAMENT IDFILE / ICON -
uint16 ornaIcon = 0;
@ -3832,13 +3832,13 @@ namespace Underfoot
ss.write((const char*)&null_term, sizeof(uint8)); //no idfile
}
Underfoot::structs::ItemSerializationHeaderFinish hdrf;
UF::structs::ItemSerializationHeaderFinish hdrf;
hdrf.ornamentIcon = ornaIcon;
hdrf.unknown060 = 0; //This is Always 0.. or it breaks shit..
hdrf.unknown061 = 0; //possibly ornament / special ornament
hdrf.isCopied = 0; //Flag for item to be 'Copied'
hdrf.ItemClass = item->ItemClass;
ss.write((const char*)&hdrf, sizeof(Underfoot::structs::ItemSerializationHeaderFinish));
ss.write((const char*)&hdrf, sizeof(UF::structs::ItemSerializationHeaderFinish));
if (strlen(item->Name) > 0)
{
@ -3870,8 +3870,8 @@ namespace Underfoot
ss.write((const char*)&null_term, sizeof(uint8));
}
Underfoot::structs::ItemBodyStruct ibs;
memset(&ibs, 0, sizeof(Underfoot::structs::ItemBodyStruct));
UF::structs::ItemBodyStruct ibs;
memset(&ibs, 0, sizeof(UF::structs::ItemBodyStruct));
ibs.id = item->ID;
ibs.weight = item->Weight;
@ -3956,7 +3956,7 @@ namespace Underfoot
ibs.FactionAmt4 = item->FactionAmt4;
ibs.FactionMod4 = item->FactionMod4;
ss.write((const char*)&ibs, sizeof(Underfoot::structs::ItemBodyStruct));
ss.write((const char*)&ibs, sizeof(UF::structs::ItemBodyStruct));
//charm text
if (strlen(item->CharmFile) > 0)
@ -3969,8 +3969,8 @@ namespace Underfoot
ss.write((const char*)&null_term, sizeof(uint8));
}
Underfoot::structs::ItemSecondaryBodyStruct isbs;
memset(&isbs, 0, sizeof(Underfoot::structs::ItemSecondaryBodyStruct));
UF::structs::ItemSecondaryBodyStruct isbs;
memset(&isbs, 0, sizeof(UF::structs::ItemSecondaryBodyStruct));
isbs.augtype = item->AugType;
isbs.augrestrict = item->AugRestrict;
@ -3996,7 +3996,7 @@ namespace Underfoot
isbs.book = item->Book;
isbs.booktype = item->BookType;
ss.write((const char*)&isbs, sizeof(Underfoot::structs::ItemSecondaryBodyStruct));
ss.write((const char*)&isbs, sizeof(UF::structs::ItemSecondaryBodyStruct));
if (strlen(item->Filename) > 0)
{
@ -4008,8 +4008,8 @@ namespace Underfoot
ss.write((const char*)&null_term, sizeof(uint8));
}
Underfoot::structs::ItemTertiaryBodyStruct itbs;
memset(&itbs, 0, sizeof(Underfoot::structs::ItemTertiaryBodyStruct));
UF::structs::ItemTertiaryBodyStruct itbs;
memset(&itbs, 0, sizeof(UF::structs::ItemTertiaryBodyStruct));
itbs.loregroup = item->LoreGroup;
itbs.artifact = item->ArtifactFlag;
@ -4030,13 +4030,13 @@ namespace Underfoot
itbs.no_transfer = item->NoTransfer;
itbs.expendablearrow = item->ExpendableArrow;
ss.write((const char*)&itbs, sizeof(Underfoot::structs::ItemTertiaryBodyStruct));
ss.write((const char*)&itbs, sizeof(UF::structs::ItemTertiaryBodyStruct));
// Effect Structures Broken down to allow variable length strings for effect names
int32 effect_unknown = 0;
Underfoot::structs::ClickEffectStruct ices;
memset(&ices, 0, sizeof(Underfoot::structs::ClickEffectStruct));
UF::structs::ClickEffectStruct ices;
memset(&ices, 0, sizeof(UF::structs::ClickEffectStruct));
ices.effect = item->Click.Effect;
ices.level2 = item->Click.Level2;
@ -4047,7 +4047,7 @@ namespace Underfoot
ices.recast = item->RecastDelay;
ices.recast_type = item->RecastType;
ss.write((const char*)&ices, sizeof(Underfoot::structs::ClickEffectStruct));
ss.write((const char*)&ices, sizeof(UF::structs::ClickEffectStruct));
if (strlen(item->ClickName) > 0)
{
@ -4061,8 +4061,8 @@ namespace Underfoot
ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7
Underfoot::structs::ProcEffectStruct ipes;
memset(&ipes, 0, sizeof(Underfoot::structs::ProcEffectStruct));
UF::structs::ProcEffectStruct ipes;
memset(&ipes, 0, sizeof(UF::structs::ProcEffectStruct));
ipes.effect = item->Proc.Effect;
ipes.level2 = item->Proc.Level2;
@ -4070,7 +4070,7 @@ namespace Underfoot
ipes.level = item->Proc.Level;
ipes.procrate = item->ProcRate;
ss.write((const char*)&ipes, sizeof(Underfoot::structs::ProcEffectStruct));
ss.write((const char*)&ipes, sizeof(UF::structs::ProcEffectStruct));
if (strlen(item->ProcName) > 0)
{
@ -4084,15 +4084,15 @@ namespace Underfoot
ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5
Underfoot::structs::WornEffectStruct iwes;
memset(&iwes, 0, sizeof(Underfoot::structs::WornEffectStruct));
UF::structs::WornEffectStruct iwes;
memset(&iwes, 0, sizeof(UF::structs::WornEffectStruct));
iwes.effect = item->Worn.Effect;
iwes.level2 = item->Worn.Level2;
iwes.type = item->Worn.Type;
iwes.level = item->Worn.Level;
ss.write((const char*)&iwes, sizeof(Underfoot::structs::WornEffectStruct));
ss.write((const char*)&iwes, sizeof(UF::structs::WornEffectStruct));
if (strlen(item->WornName) > 0)
{
@ -4106,15 +4106,15 @@ namespace Underfoot
ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6
Underfoot::structs::WornEffectStruct ifes;
memset(&ifes, 0, sizeof(Underfoot::structs::WornEffectStruct));
UF::structs::WornEffectStruct ifes;
memset(&ifes, 0, sizeof(UF::structs::WornEffectStruct));
ifes.effect = item->Focus.Effect;
ifes.level2 = item->Focus.Level2;
ifes.type = item->Focus.Type;
ifes.level = item->Focus.Level;
ss.write((const char*)&ifes, sizeof(Underfoot::structs::WornEffectStruct));
ss.write((const char*)&ifes, sizeof(UF::structs::WornEffectStruct));
if (strlen(item->FocusName) > 0)
{
@ -4128,15 +4128,15 @@ namespace Underfoot
ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6
Underfoot::structs::WornEffectStruct ises;
memset(&ises, 0, sizeof(Underfoot::structs::WornEffectStruct));
UF::structs::WornEffectStruct ises;
memset(&ises, 0, sizeof(UF::structs::WornEffectStruct));
ises.effect = item->Scroll.Effect;
ises.level2 = item->Scroll.Level2;
ises.type = item->Scroll.Type;
ises.level = item->Scroll.Level;
ss.write((const char*)&ises, sizeof(Underfoot::structs::WornEffectStruct));
ss.write((const char*)&ises, sizeof(UF::structs::WornEffectStruct));
if (strlen(item->ScrollName) > 0)
{
@ -4151,8 +4151,8 @@ namespace Underfoot
ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6
// Bard Effect?
Underfoot::structs::WornEffectStruct ibes;
memset(&ibes, 0, sizeof(Underfoot::structs::WornEffectStruct));
UF::structs::WornEffectStruct ibes;
memset(&ibes, 0, sizeof(UF::structs::WornEffectStruct));
ibes.effect = item->Bard.Effect;
ibes.level2 = item->Bard.Level2;
@ -4160,7 +4160,7 @@ namespace Underfoot
ibes.level = item->Bard.Level;
//ibes.unknown6 = 0xffffffff;
ss.write((const char*)&ibes, sizeof(Underfoot::structs::WornEffectStruct));
ss.write((const char*)&ibes, sizeof(UF::structs::WornEffectStruct));
/*
if(strlen(item->BardName) > 0)
@ -4174,8 +4174,8 @@ namespace Underfoot
ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6
// End of Effects
Underfoot::structs::ItemQuaternaryBodyStruct iqbs;
memset(&iqbs, 0, sizeof(Underfoot::structs::ItemQuaternaryBodyStruct));
UF::structs::ItemQuaternaryBodyStruct iqbs;
memset(&iqbs, 0, sizeof(UF::structs::ItemQuaternaryBodyStruct));
iqbs.scriptfileid = item->ScriptFileID;
iqbs.quest_item = item->QuestItemFlag;
@ -4240,7 +4240,7 @@ namespace Underfoot
}
}
ss.write((const char*)&iqbs, sizeof(Underfoot::structs::ItemQuaternaryBodyStruct));
ss.write((const char*)&iqbs, sizeof(UF::structs::ItemQuaternaryBodyStruct));
for (int x = 0; x < 10; ++x) {
@ -4262,62 +4262,62 @@ namespace Underfoot
return item_serial;
}
static inline uint32 ServerToUnderfootSlot(uint32 ServerSlot)
static inline uint32 ServerToUFSlot(uint32 serverSlot)
{
uint32 UnderfootSlot = 0;
if (ServerSlot >= MainAmmo && ServerSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
UnderfootSlot = ServerSlot + 1;
else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END)
UnderfootSlot = ServerSlot + 11;
else if (ServerSlot >= EmuConstants::BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END)
UnderfootSlot = ServerSlot + 1;
else if (ServerSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END)
UnderfootSlot = ServerSlot + 1;
else if (ServerSlot == MainPowerSource)
if (serverSlot >= MainAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
UnderfootSlot = serverSlot + 1;
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END)
UnderfootSlot = serverSlot + 11;
else if (serverSlot >= EmuConstants::BANK_BAGS_BEGIN && serverSlot <= EmuConstants::BANK_BAGS_END)
UnderfootSlot = serverSlot + 1;
else if (serverSlot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && serverSlot <= EmuConstants::SHARED_BANK_BAGS_END)
UnderfootSlot = serverSlot + 1;
else if (serverSlot == MainPowerSource)
UnderfootSlot = slots::MainPowerSource;
else
UnderfootSlot = ServerSlot;
UnderfootSlot = serverSlot;
return UnderfootSlot;
}
static inline uint32 ServerToUnderFootCorpseSlot(uint32 ServerCorpse)
static inline uint32 ServerToUFCorpseSlot(uint32 serverCorpseSlot)
{
//uint32 UnderfootCorpse;
return (ServerCorpse + 1);
return (serverCorpseSlot + 1);
}
static inline uint32 UnderfootToServerSlot(uint32 UnderfootSlot)
static inline uint32 UFToServerSlot(uint32 ufSlot)
{
uint32 ServerSlot = 0;
if (UnderfootSlot >= slots::MainAmmo && UnderfootSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
ServerSlot = UnderfootSlot - 1;
else if (UnderfootSlot >= consts::GENERAL_BAGS_BEGIN && UnderfootSlot <= consts::CURSOR_BAG_END)
ServerSlot = UnderfootSlot - 11;
else if (UnderfootSlot >= consts::BANK_BAGS_BEGIN && UnderfootSlot <= consts::BANK_BAGS_END)
ServerSlot = UnderfootSlot - 1;
else if (UnderfootSlot >= consts::SHARED_BANK_BAGS_BEGIN && UnderfootSlot <= consts::SHARED_BANK_BAGS_END)
ServerSlot = UnderfootSlot - 1;
else if (UnderfootSlot == slots::MainPowerSource)
if (ufSlot >= slots::MainAmmo && ufSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots
ServerSlot = ufSlot - 1;
else if (ufSlot >= consts::GENERAL_BAGS_BEGIN && ufSlot <= consts::CURSOR_BAG_END)
ServerSlot = ufSlot - 11;
else if (ufSlot >= consts::BANK_BAGS_BEGIN && ufSlot <= consts::BANK_BAGS_END)
ServerSlot = ufSlot - 1;
else if (ufSlot >= consts::SHARED_BANK_BAGS_BEGIN && ufSlot <= consts::SHARED_BANK_BAGS_END)
ServerSlot = ufSlot - 1;
else if (ufSlot == slots::MainPowerSource)
ServerSlot = MainPowerSource;
else
ServerSlot = UnderfootSlot;
ServerSlot = ufSlot;
return ServerSlot;
}
static inline uint32 UnderfootToServerCorpseSlot(uint32 UnderfootCorpse)
static inline uint32 UFToServerCorpseSlot(uint32 ufCorpseSlot)
{
//uint32 ServerCorpse;
return (UnderfootCorpse - 1);
return (ufCorpseSlot - 1);
}
static inline void ServerToUnderfootTextLink(std::string& underfootTextLink, const std::string& serverTextLink)
static inline void ServerToUFTextLink(std::string& ufTextLink, const std::string& serverTextLink)
{
if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
underfootTextLink = serverTextLink;
ufTextLink = serverTextLink;
return;
}
@ -4326,7 +4326,7 @@ namespace Underfoot
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) {
if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) {
underfootTextLink.append(segments[segment_iter]);
ufTextLink.append(segments[segment_iter]);
// TODO: log size mismatch error
continue;
}
@ -4336,32 +4336,32 @@ namespace Underfoot
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
// Diff: ^^^^^ ^
underfootTextLink.push_back('\x12');
underfootTextLink.append(segments[segment_iter].substr(0, 31));
underfootTextLink.append(segments[segment_iter].substr(36, 5));
ufTextLink.push_back('\x12');
ufTextLink.append(segments[segment_iter].substr(0, 31));
ufTextLink.append(segments[segment_iter].substr(36, 5));
if (segments[segment_iter][41] == '0')
underfootTextLink.push_back(segments[segment_iter][42]);
ufTextLink.push_back(segments[segment_iter][42]);
else
underfootTextLink.push_back('F');
ufTextLink.push_back('F');
underfootTextLink.append(segments[segment_iter].substr(43));
underfootTextLink.push_back('\x12');
ufTextLink.append(segments[segment_iter].substr(43));
ufTextLink.push_back('\x12');
}
else {
underfootTextLink.append(segments[segment_iter]);
ufTextLink.append(segments[segment_iter]);
}
}
}
static inline void UnderfootToServerTextLink(std::string& serverTextLink, const std::string& underfootTextLink)
static inline void UFToServerTextLink(std::string& serverTextLink, const std::string& ufTextLink)
{
if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (underfootTextLink.find('\x12') == std::string::npos)) {
serverTextLink = underfootTextLink;
if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (ufTextLink.find('\x12') == std::string::npos)) {
serverTextLink = ufTextLink;
return;
}
auto segments = SplitString(underfootTextLink, '\x12');
auto segments = SplitString(ufTextLink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) {
@ -4390,4 +4390,4 @@ namespace Underfoot
}
}
}
// end namespace Underfoot
// end namespace UF

View File

@ -1,11 +1,11 @@
#ifndef Underfoot_H_
#define Underfoot_H_
#ifndef UF_H_
#define UF_H_
#include "../struct_strategy.h"
class EQStreamIdentifier;
namespace Underfoot {
namespace UF {
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
@ -27,11 +27,9 @@ namespace Underfoot {
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "underfoot_ops.h"
#include "uf_ops.h"
};
};
#endif /*Underfoot_H_*/
#endif /*UF_H_*/

View File

@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef Underfoot_CONSTANTS_H_
#define Underfoot_CONSTANTS_H_
#ifndef UF_CONSTANTS_H_
#define UF_CONSTANTS_H_
#include "../types.h"
namespace Underfoot {
namespace UF {
namespace maps {
typedef enum : int16 {
// this needs work to match actual client equivilents
@ -187,12 +187,12 @@ namespace Underfoot {
static const bool COIN_HAS_WEIGHT = false;
}
}; //end namespace Underfoot
}; //end namespace UF
#endif /*Underfoot_CONSTANTS_H_*/
#endif /*UF_CONSTANTS_H_*/
/*
Underfoot Notes:
UF Notes:
** Integer-based inventory **
ok Possessions: 0 - 31 (Corpse: 23 - 54 [Offset 23])
ok [Equipment: 0 - 22]

View File

@ -436,4 +436,3 @@ These fields must be in the order of how they are serialized!
#undef C
#undef S
#undef F

View File

@ -129,5 +129,6 @@ D(OP_TradeSkillCombine)
D(OP_TributeItem)
D(OP_WearChange)
D(OP_WhoAllRequest)
#undef E
#undef D

View File

@ -1,7 +1,7 @@
#ifndef Underfoot_STRUCTS_H_
#define Underfoot_STRUCTS_H_
#ifndef UF_STRUCTS_H_
#define UF_STRUCTS_H_
namespace Underfoot {
namespace UF {
namespace structs {
@ -1250,7 +1250,7 @@ struct Animation_Struct {
/*04*/
};
// solar: this is what causes the caster to animate and the target to
// this is what causes the caster to animate and the target to
// get the particle effects around them when a spell is cast
// also causes a buff icon
struct Action_Struct
@ -1305,7 +1305,7 @@ struct ActionAlt_Struct
/*64*/
};
// solar: this is what prints the You have been struck. and the regular
// this is what prints the You have been struck. and the regular
// melee messages like You try to pierce, etc. It's basically the melee
// and spell damage message
struct CombatDamage_Struct
@ -1849,7 +1849,7 @@ struct RandomReq_Struct {
uint32 high;
};
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
/* 9/23/03 reply to /random command */
struct RandomReply_Struct {
/* 00 */ uint32 low;
/* 04 */ uint32 high;
@ -4531,6 +4531,6 @@ struct MercenaryAssign_Struct {
};
}; //end namespace structs
}; //end namespace Underfoot
}; //end namespace UF
#endif /*Underfoot_STRUCTS_H_*/
#endif /*UF_STRUCTS_H_*/

View File

@ -79,6 +79,7 @@ public:
inline const uint32 GetTimerTime() const { return timer_time; }
inline const uint32 GetStartTime() const { return start_time; }
inline const pTimerType GetType() const { return _type; }
inline const uint32 GetReadyTimestamp() const { return start_time + timer_time; }
inline bool Enabled() { return enabled; }

View File

@ -101,6 +101,7 @@ RULE_INT ( Character, FoodLossPerUpdate, 35) // How much food/water you lose per
RULE_INT ( Character, BaseInstrumentSoftCap, 36) // Softcap for instrument mods, 36 commonly referred to as "3.6" as well.
RULE_INT ( Character, BaseRunSpeedCap, 158) // Base Run Speed Cap, on live it's 158% which will give you a runspeed of 1.580 hard capped to 225.
RULE_INT ( Character, OrnamentationAugmentType, 20) //Ornamentation Augment Type
RULE_REAL(Character, EnvironmentDamageMulipliter, 1)
RULE_CATEGORY_END()
RULE_CATEGORY( Mercs )

View File

@ -51,7 +51,7 @@
#define ServerOP_AcceptWorldEntrance 0x0024
#define ServerOP_ZAAuth 0x0025
#define ServerOP_ZAAuthFailed 0x0026
#define ServerOP_ZoneIncClient 0x0027 // Incomming client
#define ServerOP_ZoneIncClient 0x0027 // Incoming client
#define ServerOP_ClientListKA 0x0028
#define ServerOP_ChangeWID 0x0029
#define ServerOP_IPLookup 0x002A
@ -307,7 +307,7 @@ struct ServerZoneStateChange_struct {
bool makestatic;
};
struct ServerZoneIncommingClient_Struct {
struct ServerZoneIncomingClient_Struct {
uint32 zoneid; // in case the zone shut down, boot it back up
uint16 instanceid; // instance id if it exists for booting up
uint32 ip; // client's IP address

View File

@ -382,191 +382,214 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv,
// Retrieve shared bank inventory based on either account or character
bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
{
std::string query;
if (is_charid)
query = StringFormat("SELECT sb.slotid, sb.itemid, sb.charges, "
"sb.augslot1, sb.augslot2, sb.augslot3, "
"sb.augslot4, sb.augslot5, sb.augslot6, sb.custom_data "
"FROM sharedbank sb INNER JOIN character_data ch "
"ON ch.account_id=sb.acctid WHERE ch.id = %i", id);
"sb.augslot1, sb.augslot2, sb.augslot3, "
"sb.augslot4, sb.augslot5, sb.augslot6, sb.custom_data "
"FROM sharedbank sb INNER JOIN character_data ch "
"ON ch.account_id=sb.acctid WHERE ch.id = %i",
id);
else
query = StringFormat("SELECT slotid, itemid, charges, "
"augslot1, augslot2, augslot3, "
"augslot4, augslot5, augslot6, custom_data "
"FROM sharedbank WHERE acctid=%i", id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str());
return false;
}
"augslot1, augslot2, augslot3, "
"augslot4, augslot5, augslot6, custom_data "
"FROM sharedbank WHERE acctid=%i",
id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Database::GetSharedBank(uint32 account_id): %s",
results.ErrorMessage().c_str());
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = (int16)atoi(row[0]);
uint32 item_id = (uint32)atoi(row[1]);
int8 charges = (int8)atoi(row[2]);
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = (int16)atoi(row[0]);
uint32 item_id = (uint32)atoi(row[1]);
int8 charges = (int8)atoi(row[2]);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoi(row[3]);
aug[1] = (uint32)atoi(row[4]);
aug[2] = (uint32)atoi(row[5]);
aug[3] = (uint32)atoi(row[6]);
aug[4] = (uint32)atoi(row[7]);
aug[2] = (uint32)atoi(row[5]);
aug[3] = (uint32)atoi(row[6]);
aug[4] = (uint32)atoi(row[7]);
aug[5] = (uint32)atoi(row[8]);
const Item_Struct* item = GetItem(item_id);
const Item_Struct *item = GetItem(item_id);
if (!item) {
Log.Out(Logs::General, Logs::Error,
"Warning: %s %i has an invalid item_id %i in inventory slot %i",
((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id);
continue;
}
if (!item) {
Log.Out(Logs::General, Logs::Error,
"Warning: %s %i has an invalid item_id %i in inventory slot %i",
((is_charid == true) ? "charid" : "acctid"), id, item_id, slot_id);
continue;
}
int16 put_slot_id = INVALID_INDEX;
int16 put_slot_id = INVALID_INDEX;
ItemInst* inst = CreateBaseItem(item, charges);
if (inst && item->ItemClass == ItemClassCommon) {
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
if (aug[i])
ItemInst *inst = CreateBaseItem(item, charges);
if (inst && item->ItemClass == ItemClassCommon) {
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
if (aug[i])
inst->PutAugment(this, i, aug[i]);
}
}
}
}
if(!row[9])
continue;
if (row[9]) {
std::string data_str(row[9]);
std::string idAsString;
std::string value;
bool use_id = true;
std::string data_str(row[9]);
std::string idAsString;
std::string value;
bool use_id = true;
for (int i = 0; i < data_str.length(); ++i) {
if (data_str[i] == '^') {
if (!use_id) {
inst->SetCustomData(idAsString, value);
idAsString.clear();
value.clear();
}
use_id = !use_id;
continue;
}
for(int i = 0; i < data_str.length(); ++i) {
if(data_str[i] == '^') {
if(!use_id) {
inst->SetCustomData(idAsString, value);
idAsString.clear();
value.clear();
}
use_id = !use_id;
continue;
}
char v = data_str[i];
if (use_id)
idAsString.push_back(v);
else
value.push_back(v);
}
}
char v = data_str[i];
if(use_id)
idAsString.push_back(v);
else
value.push_back(v);
}
put_slot_id = inv->PutItem(slot_id, *inst);
safe_delete(inst);
put_slot_id = inv->PutItem(slot_id, *inst);
safe_delete(inst);
// Save ptr to item in inventory
if (put_slot_id != INVALID_INDEX)
continue;
// Save ptr to item in inventory
if (put_slot_id != INVALID_INDEX)
continue;
Log.Out(Logs::General, Logs::Error,
"Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i",
((is_charid == true) ? "charid" : "acctid"), id, item_id, slot_id);
Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i",
((is_charid==true)? "charid": "acctid"), id, item_id, slot_id);
if (is_charid)
SaveInventory(id, nullptr, slot_id);
if (is_charid)
SaveInventory(id, nullptr, slot_id);
}
return true;
}
// Overloaded: Retrieve character inventory based on character id
bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
{
// Retrieve character inventory
std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model "
"FROM inventory WHERE charid = %i ORDER BY slotid", char_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
return false;
}
std::string query =
StringFormat("SELECT slotid, itemid, charges, color, augslot1, augslot2, augslot3, augslot4, augslot5, "
"augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model FROM "
"inventory WHERE charid = %i ORDER BY slotid",
char_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the "
"following SQL Queries:\nalter table inventory add instnodrop "
"tinyint(1) unsigned default 0 not null;\n");
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
uint32 item_id = atoi(row[1]);
uint16 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
auto timestamps = GetItemRecastTimestamps(char_id);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
uint32 item_id = atoi(row[1]);
uint16 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
aug[0] = (uint32)atoul(row[4]);
aug[1] = (uint32)atoul(row[5]);
aug[2] = (uint32)atoul(row[6]);
aug[3] = (uint32)atoul(row[7]);
aug[4] = (uint32)atoul(row[8]);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoul(row[4]);
aug[1] = (uint32)atoul(row[5]);
aug[2] = (uint32)atoul(row[6]);
aug[3] = (uint32)atoul(row[7]);
aug[4] = (uint32)atoul(row[8]);
aug[5] = (uint32)atoul(row[9]);
bool instnodrop = (row[10] && (uint16)atoi(row[10]))? true: false;
bool instnodrop = (row[10] && (uint16)atoi(row[10])) ? true : false;
uint32 ornament_icon = (uint32)atoul(row[12]);
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const Item_Struct* item = GetItem(item_id);
const Item_Struct *item = GetItem(item_id);
if (!item) {
Log.Out(Logs::General, Logs::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id);
continue;
}
if (!item) {
Log.Out(Logs::General, Logs::Error,
"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id,
slot_id);
continue;
}
int16 put_slot_id = INVALID_INDEX;
int16 put_slot_id = INVALID_INDEX;
ItemInst* inst = CreateBaseItem(item, charges);
ItemInst *inst = CreateBaseItem(item, charges);
if (inst == nullptr)
continue;
if(row[11]) {
std::string data_str(row[11]);
std::string idAsString;
std::string value;
bool use_id = true;
if (row[11]) {
std::string data_str(row[11]);
std::string idAsString;
std::string value;
bool use_id = true;
for(int i = 0; i < data_str.length(); ++i) {
if(data_str[i] == '^') {
if(!use_id) {
inst->SetCustomData(idAsString, value);
idAsString.clear();
value.clear();
}
for (int i = 0; i < data_str.length(); ++i) {
if (data_str[i] == '^') {
if (!use_id) {
inst->SetCustomData(idAsString, value);
idAsString.clear();
value.clear();
}
use_id = !use_id;
continue;
}
use_id = !use_id;
continue;
}
char v = data_str[i];
if(use_id)
idAsString.push_back(v);
else
value.push_back(v);
}
}
char v = data_str[i];
if (use_id)
idAsString.push_back(v);
else
value.push_back(v);
}
}
inst->SetOrnamentIcon(ornament_icon);
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentHeroModel(ornament_hero_model);
if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable))
inst->SetAttuned(true);
if (instnodrop ||
(((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) ||
slot_id == MainPowerSource) &&
inst->GetItem()->Attuneable))
inst->SetAttuned(true);
if (color > 0)
inst->SetColor(color);
if (color > 0)
inst->SetColor(color);
if(charges==0x7FFF)
inst->SetCharges(-1);
else if (charges == 0 && inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
if (charges == 0x7FFF)
inst->SetCharges(-1);
else if (charges == 0 &&
inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
inst->SetCharges(1);
else
inst->SetCharges(charges);
inst->SetCharges(charges);
if (item->RecastDelay) {
if (timestamps.count(item->RecastType))
inst->SetRecastTimestamp(timestamps.at(item->RecastType));
else
inst->SetRecastTimestamp(0);
}
if (item->ItemClass == ItemClassCommon) {
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
@ -575,114 +598,116 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
}
}
if (slot_id >= 8000 && slot_id <= 8999)
{
put_slot_id = inv->PushCursor(*inst);
}
else if (slot_id >= 3111 && slot_id <= 3179)
{
// Admins: please report any occurrences of this error
Log.Out(Logs::General, Logs::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id);
put_slot_id = inv->PushCursor(*inst);
}
else
{
if (slot_id >= 8000 && slot_id <= 8999) {
put_slot_id = inv->PushCursor(*inst);
} else if (slot_id >= 3111 && slot_id <= 3179) {
// Admins: please report any occurrences of this error
Log.Out(Logs::General, Logs::Error, "Warning: Defunct location for item in inventory: "
"charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...",
char_id, item_id, slot_id);
put_slot_id = inv->PushCursor(*inst);
} else {
put_slot_id = inv->PutItem(slot_id, *inst);
}
safe_delete(inst);
safe_delete(inst);
// Save ptr to item in inventory
if (put_slot_id == INVALID_INDEX) {
Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id);
}
}
// Save ptr to item in inventory
if (put_slot_id == INVALID_INDEX) {
Log.Out(Logs::General, Logs::Error,
"Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",
char_id, item_id, slot_id);
}
}
// Retrieve shared inventory
// Retrieve shared inventory
return GetSharedBank(char_id, inv, true);
}
// Overloaded: Retrieve character inventory based on account_id and character name
bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) {
bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
{
// Retrieve character inventory
std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model "
"FROM inventory INNER JOIN character_data ch "
"ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid",
name, account_id);
auto results = QueryDatabase(query);
if (!results.Success()){
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
return false;
std::string query =
StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, "
"ornamentidfile, ornament_hero_model "
"FROM inventory INNER JOIN character_data ch "
"ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid",
name, account_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the "
"following SQL Queries:\nalter table inventory add instnodrop "
"tinyint(1) unsigned default 0 not null;\n");
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
uint32 item_id = atoi(row[1]);
int8 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
uint32 item_id = atoi(row[1]);
int8 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoi(row[4]);
aug[1] = (uint32)atoi(row[5]);
aug[2] = (uint32)atoi(row[6]);
aug[3] = (uint32)atoi(row[7]);
aug[4] = (uint32)atoi(row[8]);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoi(row[4]);
aug[1] = (uint32)atoi(row[5]);
aug[2] = (uint32)atoi(row[6]);
aug[3] = (uint32)atoi(row[7]);
aug[4] = (uint32)atoi(row[8]);
aug[5] = (uint32)atoi(row[9]);
bool instnodrop = (row[10] && (uint16)atoi(row[10])) ? true : false;
bool instnodrop = (row[10] && (uint16)atoi(row[10])) ? true : false;
uint32 ornament_icon = (uint32)atoul(row[12]);
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const Item_Struct* item = GetItem(item_id);
int16 put_slot_id = INVALID_INDEX;
if(!item)
continue;
ItemInst* inst = CreateBaseItem(item, charges);
const Item_Struct *item = GetItem(item_id);
int16 put_slot_id = INVALID_INDEX;
if (!item)
continue;
ItemInst *inst = CreateBaseItem(item, charges);
if (inst == nullptr)
continue;
inst->SetAttuned(instnodrop);
inst->SetAttuned(instnodrop);
if(row[11]) {
std::string data_str(row[11]);
std::string idAsString;
std::string value;
bool use_id = true;
if (row[11]) {
std::string data_str(row[11]);
std::string idAsString;
std::string value;
bool use_id = true;
for(int i = 0; i < data_str.length(); ++i) {
if(data_str[i] == '^') {
if(!use_id) {
inst->SetCustomData(idAsString, value);
idAsString.clear();
value.clear();
}
for (int i = 0; i < data_str.length(); ++i) {
if (data_str[i] == '^') {
if (!use_id) {
inst->SetCustomData(idAsString, value);
idAsString.clear();
value.clear();
}
use_id = !use_id;
continue;
}
use_id = !use_id;
continue;
}
char v = data_str[i];
if(use_id)
idAsString.push_back(v);
else
value.push_back(v);
char v = data_str[i];
if (use_id)
idAsString.push_back(v);
else
value.push_back(v);
}
}
}
}
inst->SetOrnamentIcon(ornament_icon);
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentHeroModel(ornament_hero_model);
if (color > 0)
inst->SetColor(color);
if (color > 0)
inst->SetColor(color);
inst->SetCharges(charges);
inst->SetCharges(charges);
if (item->ItemClass == ItemClassCommon) {
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
@ -691,43 +716,77 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
}
}
if (slot_id>=8000 && slot_id <= 8999)
put_slot_id = inv->PushCursor(*inst);
else
put_slot_id = inv->PutItem(slot_id, *inst);
if (slot_id >= 8000 && slot_id <= 8999)
put_slot_id = inv->PushCursor(*inst);
else
put_slot_id = inv->PutItem(slot_id, *inst);
safe_delete(inst);
safe_delete(inst);
// Save ptr to item in inventory
if (put_slot_id == INVALID_INDEX)
Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id);
// Save ptr to item in inventory
if (put_slot_id == INVALID_INDEX)
Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: name=%s, "
"acctid=%i, item_id=%i, slot_id=%i",
name, account_id, item_id, slot_id);
}
}
// Retrieve shared inventory
// Retrieve shared inventory
return GetSharedBank(account_id, inv, false);
}
std::map<uint32, uint32> SharedDatabase::GetItemRecastTimestamps(uint32 char_id)
{
std::map<uint32, uint32> timers;
std::string query = StringFormat("SELECT recast_type,timestamp FROM character_item_recast WHERE id=%u", char_id);
auto results = QueryDatabase(query);
if (!results.Success() || results.RowCount() == 0)
return timers;
void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) {
for (auto row = results.begin(); row != results.end(); ++row)
timers[atoul(row[0])] = atoul(row[1]);
return timers; // RVO or move assigned
}
uint32 SharedDatabase::GetItemRecastTimestamp(uint32 char_id, uint32 recast_type)
{
std::string query = StringFormat("SELECT timestamp FROM character_item_recast WHERE id=%u AND recast_type=%u",
char_id, recast_type);
auto results = QueryDatabase(query);
if (!results.Success() || results.RowCount() == 0)
return 0;
auto row = results.begin();
return static_cast<uint32>(atoul(row[0]));
}
void SharedDatabase::ClearOldRecastTimestamps(uint32 char_id)
{
// This actually isn't strictly live-like. Live your recast timestamps are forever
std::string query =
StringFormat("DELETE FROM character_item_recast WHERE id = %u and timestamp < UNIX_TIMESTAMP()", char_id);
QueryDatabase(query);
}
void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id)
{
item_count = -1;
max_id = 0;
const std::string query = "SELECT MAX(id), count(*) FROM items";
auto results = QueryDatabase(query);
if (!results.Success()) {
return;
return;
}
if (results.RowCount() == 0)
return;
return;
auto row = results.begin();
auto row = results.begin();
if(row[0])
max_id = atoi(row[0]);
if (row[0])
max_id = atoi(row[0]);
if (row[1])
if (row[1])
item_count = atoi(row[1]);
}

View File

@ -11,6 +11,7 @@
#include "fixed_memory_variable_hash_set.h"
#include <list>
#include <map>
class EvolveInfo;
class Inventory;
@ -69,6 +70,9 @@ class SharedDatabase : public Database
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
bool GetInventory(uint32 char_id, Inventory* inv);
bool GetInventory(uint32 account_id, char* name, Inventory* inv);
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type);
void ClearOldRecastTimestamps(uint32 char_id);
bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin);

View File

@ -19,7 +19,7 @@
/*
solar: General outline of spell casting process
General outline of spell casting process
1.
a) Client clicks a spell bar gem, ability, or item. client_process.cpp

View File

@ -618,7 +618,7 @@ typedef enum {
#define DF_Permanent 50
// solar: note this struct is historical, we don't actually need it to be
// note this struct is historical, we don't actually need it to be
// aligned to anything, but for maintaining it it is kept in the order that
// the fields in the text file are. the numbering is not offset, but field
// number. note that the id field is counted as 0, this way the numbers

View File

@ -256,7 +256,7 @@ bool atobool(const char* iBool) {
return false;
}
// solar: removes the crap and turns the underscores into spaces.
// removes the crap and turns the underscores into spaces.
char *CleanMobName(const char *in, char *out)
{
unsigned i, j;

View File

@ -5,6 +5,7 @@
#include "eq_stream.h"
#include <map>
#include <memory>
//note: all encoders and decoders must be valid functions.
@ -17,7 +18,7 @@ StructStrategy::StructStrategy() {
}
}
void StructStrategy::Encode(EQApplicationPacket **p, EQStream *dest, bool ack_req) const {
void StructStrategy::Encode(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req) const {
if((*p)->GetOpcodeBypass() != 0) {
PassEncoder(p, dest, ack_req);
return;
@ -35,7 +36,7 @@ void StructStrategy::Decode(EQApplicationPacket *p) const {
}
void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bool ack_req) {
void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, std::shared_ptr<EQStream> dest, bool ack_req) {
EQApplicationPacket *p = *in_p;
*in_p = nullptr;
@ -49,7 +50,7 @@ void StructStrategy::ErrorDecoder(EQApplicationPacket *p) {
p->SetOpcode(OP_Unknown);
}
void StructStrategy::PassEncoder(EQApplicationPacket **p, EQStream *dest, bool ack_req) {
void StructStrategy::PassEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req) {
dest->FastQueuePacket(p, ack_req);
}

View File

@ -7,11 +7,12 @@ class EQStream;
#include "clientversions.h"
#include <string>
#include <memory>
class StructStrategy {
public:
//the encoder takes ownership of the supplied packet, and may enqueue multiple resulting packets into the stream
typedef void (*Encoder)(EQApplicationPacket **p, EQStream *dest, bool ack_req);
typedef void(*Encoder)(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
//the decoder may only edit the supplied packet, producing a single packet for eqemu to consume.
typedef void (*Decoder)(EQApplicationPacket *p);
@ -19,7 +20,7 @@ public:
virtual ~StructStrategy() {}
//this method takes an eqemu struct, and enqueues the produced structs into the stream.
void Encode(EQApplicationPacket **p, EQStream *dest, bool ack_req) const;
void Encode(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req) const;
//this method takes an EQ wire struct, and converts it into an eqemu struct
void Decode(EQApplicationPacket *p) const;
@ -29,10 +30,10 @@ public:
protected:
//some common coders:
//Print an error saying unknown struct/opcode and drop it
static void ErrorEncoder(EQApplicationPacket **p, EQStream *dest, bool ack_req);
static void ErrorEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
static void ErrorDecoder(EQApplicationPacket *p);
//pass the packet through without modification (emu == EQ) (default)
static void PassEncoder(EQApplicationPacket **p, EQStream *dest, bool ack_req);
static void PassEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
static void PassDecoder(EQApplicationPacket *p);
Encoder encoders[_maxEmuOpcode];

View File

@ -69,7 +69,7 @@ TCPConnection::TCPConnection()
//server version
TCPConnection::TCPConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
: ConnectionType(Incomming),
: ConnectionType(Incoming),
connection_socket(in_socket),
id(ID),
rIP(irIP),
@ -104,7 +104,7 @@ TCPConnection::~TCPConnection() {
}
#if TCPN_DEBUG_Memory >= 5
else {
std::cout << "Deconstructor on incomming TCP# " << GetID() << std::endl;
std::cout << "Deconstructor on incoming TCP# " << GetID() << std::endl;
}
#endif
safe_delete_array(recvbuf);

View File

@ -55,7 +55,7 @@
#ifndef DEF_eConnectionType
#define DEF_eConnectionType
enum eConnectionType {Incomming, Outgoing};
enum eConnectionType {Incoming, Outgoing};
#endif

View File

@ -30,7 +30,7 @@
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9069
#define CURRENT_BINARY_DATABASE_VERSION 9073
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
#ifndef WIN32

View File

@ -24,7 +24,7 @@
extern ErrorLog *server_log;
extern LoginServer server;
Client::Client(EQStream *c, LSClientVersion v)
Client::Client(std::shared_ptr<EQStream> c, LSClientVersion v)
{
connection = c;
version = v;

View File

@ -59,7 +59,7 @@ public:
/**
* Constructor, sets our connection to c and version to v
*/
Client(EQStream *c, LSClientVersion v);
Client(std::shared_ptr<EQStream> c, LSClientVersion v);
/**
* Destructor.
@ -129,11 +129,11 @@ public:
/**
* Gets the connection for this client.
*/
EQStream *GetConnection() { return connection; }
std::shared_ptr<EQStream> GetConnection() { return connection; }
EQEmu::Random random;
private:
EQStream *connection;
std::shared_ptr<EQStream> connection;
LSClientVersion version;
LSClientStatus status;

View File

@ -94,7 +94,7 @@ ClientManager::~ClientManager()
void ClientManager::Process()
{
ProcessDisconnect();
EQStream *cur = titanium_stream->Pop();
std::shared_ptr<EQStream> cur = titanium_stream->Pop();
while(cur)
{
struct in_addr in;
@ -141,7 +141,7 @@ void ClientManager::ProcessDisconnect()
list<Client*>::iterator iter = clients.begin();
while(iter != clients.end())
{
EQStream *c = (*iter)->GetConnection();
std::shared_ptr<EQStream> c = (*iter)->GetConnection();
if(c->CheckClosed())
{
server_log->Log(log_network, "Client disconnected from the server, removing client.");

View File

@ -485,7 +485,7 @@ Clientlist::Clientlist(int ChatPort) {
}
}
Client::Client(EQStream *eqs) {
Client::Client(std::shared_ptr<EQStream> eqs) {
ClientStream = eqs;
@ -574,7 +574,7 @@ void Clientlist::CheckForStaleConnections(Client *c) {
void Clientlist::Process() {
EQStream *eqs;
std::shared_ptr<EQStream> eqs;
while((eqs = chatsf->Pop())) {

View File

@ -84,10 +84,10 @@ struct CharacterEntry {
class Client {
public:
Client(EQStream* eqs);
Client(std::shared_ptr<EQStream> eqs);
~Client();
EQStream *ClientStream;
std::shared_ptr<EQStream> ClientStream;
void AddCharacter(int CharID, const char *CharacterName, int Level);
void ClearCharacters() { Characters.clear(); }
void SendMailBoxes();

View File

@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
else
sprintf(combinedKey, "%s", MailKey.c_str());
Log.Out(Logs::Detail, Logs::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey);
Log.Out(Logs::Detail, Logs::UCS_Server, "DB key is [%s], Client key is [%s]", (row[0] ? row[0] : ""), combinedKey);
return !strcmp(row[0], combinedKey);
}

View File

@ -325,7 +325,7 @@ sub OpCodes_Fetch{
3 => ["Titanium", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_Titanium.conf"],
4 => ["Secrets of Faydwer", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_SoF.conf"],
5 => ["Seeds of Destruction", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_SoD.conf"],
6 => ["Underfoot", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_Underfoot.conf"],
6 => ["Underfoot", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_UF.conf"],
7 => ["Rain of Fear", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_RoF.conf"],
8 => ["Rain of Fear 2", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_RoF2.conf"],
);

View File

@ -323,6 +323,10 @@
9067|2015_01_21_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'light'|empty|
9068|2015_01_15_logsys_categories_table.sql|SHOW TABLES LIKE 'logsys_categories'|empty|
9069|2015_01_25_logsys_Mercenaries_category.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Mercenaries'|empty|
9070|2015_01_28_quest_debug_log_category.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Quest Debug'|empty|
9071|2015_01_29_merc_stats_table_update.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'statscale'|empty|
9072|2015_01_30_merc_attack_delay.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'attack_delay'|empty|
9073|2015_01_31_character_item_recast.sql|SHOW TABLES LIKE 'character_item_recast'|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -1,8 +1,6 @@
DELIMITER $$
use peqdb
CREATE DEFINER=`eqemu`@`%` PROCEDURE `MyFaction`(charname text)
CREATE PROCEDURE `MyFaction`(charname text)
BEGIN
declare class_mod text default "";
declare race_mod text default "";
@ -24,7 +22,9 @@ SELECT race_mod as R, class_mod as C, deity_mod as D, f.name as faction, f.id, v
@race_bump := IFNULL((select m.mod from faction_list_mod m where faction_id = f.id && race_mod != "" && mod_name = race_mod),0) as race_bump,
@deity_bump := IFNULL((select m.mod from faction_list_mod m where faction_id = f.id && race_mod != "" && mod_name = deity_mod),0) as deity_bump,
v.current_value + f.base + @class_bump + @race_bump + @deity_bump as TOTAL
FROM peqdb.faction_values v
FROM faction_values v
inner join faction_list f on f.id = v.faction_id
where v.char_id = (select id from character_data where name=charname) ;
END
END $$
DELIMITER ;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
INSERT INTO `logsys_categories` (`log_category_id`, `log_category_description`, `log_to_gmsay`) VALUES ('38', 'Quest Debug', '1');

View File

@ -0,0 +1 @@
ALTER TABLE `merc_stats` ADD `statscale` int( 11 ) NOT NULL DEFAULT '100' AFTER `runspeed`;

View File

@ -0,0 +1,3 @@
ALTER TABLE `merc_stats` ADD `attack_delay` TINYINT(3) UNSIGNED DEFAULT '30' NOT NULL AFTER `attack_speed`;
UPDATE `merc_stats` SET `attack_delay` = 36 + 36 * (`attack_speed` / 100);
UPDATE `merc_stats` SET `attack_delay` = 30 WHERE `attack_speed` = 0;

View File

@ -0,0 +1,7 @@
CREATE TABLE `character_item_recast` (
`id` int(11) UNSIGNED NOT NULL DEFAULT 0,
`recast_type` smallint(11) UNSIGNED NOT NULL DEFAULT 0,
`timestamp` int(11) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(`id`, `recast_type`),
KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = latin1;

View File

@ -102,6 +102,7 @@ Client::~Client() {
//let the stream factory know were done with this stream
eqs->Close();
eqs->ReleaseFromUse();
safe_delete(eqs);
}
void Client::SendLogServer()
@ -845,7 +846,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
char ConnectionType;
if(ClientVersionBit & BIT_UnderfootAndLater)
if(ClientVersionBit & BIT_UFAndLater)
ConnectionType = 'U';
else if(ClientVersionBit & BIT_SoFAndLater)
ConnectionType = 'S';
@ -1102,7 +1103,7 @@ void Client::EnterWorld(bool TryBootup) {
const char *zone_name=database.GetZoneName(zoneID, true);
if (zs) {
// warn the world we're comming, so it knows not to shutdown
zs->IncommingClient(this);
zs->IncomingClient(this);
}
else {
if (TryBootup) {
@ -1116,17 +1117,20 @@ void Client::EnterWorld(bool TryBootup) {
return;
}
else {
Log.Out(Logs::Detail, Logs::World_Server,"Requested zone %s is no running.",zone_name);
Log.Out(Logs::Detail, Logs::World_Server,"Requested zone %s is not running.",zone_name);
ZoneUnavail();
return;
}
}
pwaitingforbootup = 0;
if(!cle) {
return;
}
cle->SetChar(charid, char_name);
database.UpdateLiveChar(char_name, GetAccountID());
Log.Out(Logs::Detail, Logs::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID);
// database.SetAuthentication(account_id, char_name, zone_name, ip);
if (seencharsel) {
if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) {
@ -1612,7 +1616,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
int Charerrors = 0;
// solar: if this is increased you'll have to add a column to the classrace
// if this is increased you'll have to add a column to the classrace
// table below
#define _TABLE_RACES 16
@ -1674,7 +1678,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
{ /*Enchanter*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, false, true},
{ /*Beastlord*/ false, true, false, false, false, false, false, false, true, true, false, false, true, true, false, false},
{ /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false}
};//Initial table by kathgar, editted by Wiz for accuracy, solar too
};
if (!cc)
return false;
@ -1707,7 +1711,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
return false;
}
// solar: add up the base values for this class/race
// add up the base values for this class/race
// this is what they start with, and they have stat_points more
// that can distributed
bSTR = BaseClass[classtemp][0] + BaseRace[racetemp][0];
@ -1721,7 +1725,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
bTOTAL = bSTR + bSTA + bAGI + bDEX + bWIS + bINT + bCHA;
cTOTAL = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA;
// solar: the first check makes sure the total is exactly what was expected.
// the first check makes sure the total is exactly what was expected.
// this will catch all the stat cheating, but there's still the issue
// of reducing CHA or INT or something, to use for STR, so we check
// that none are lower than the base or higher than base + stat_points

View File

@ -109,7 +109,7 @@ private:
bool HandleDeleteCharacterPacket(const EQApplicationPacket *app);
bool HandleZoneChangePacket(const EQApplicationPacket *app);
EQStreamInterface* const eqs;
EQStreamInterface* eqs;
};
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);

View File

@ -93,6 +93,8 @@ ClientListEntry::~ClientListEntry() {
Camp(); // updates zoneserver's numplayers
client_list.RemoveCLEReferances(this);
}
for (auto &elem : tell_queue)
safe_delete_array(elem);
tell_queue.clear();
}
@ -234,6 +236,8 @@ void ClientListEntry::ClearVars(bool iAll) {
pLFG = 0;
gm = 0;
pClientVersion = 0;
for (auto &elem : tell_queue)
safe_delete_array(elem);
tell_queue.clear();
}
@ -310,6 +314,7 @@ void ClientListEntry::ProcessTellQueue()
pack->Deflate();
Server()->SendPacket(pack);
safe_delete(pack);
safe_delete_array(*it);
it = tell_queue.erase(it);
}
return;

View File

@ -394,7 +394,7 @@ int main(int argc, char** argv) {
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
InterserverTimer.Trigger();
uint8 ReconnectCounter = 100;
EQStream* eqs;
std::shared_ptr<EQStream> eqs;
EmuTCPConnection* tcpc;
EQStreamInterface *eqsi;
@ -412,6 +412,8 @@ int main(int argc, char** argv) {
stream_identifier.AddStream(eqs); //takes the stream
}
eqs = nullptr;
//give the stream identifier a chance to do its work....
stream_identifier.Process();

View File

@ -32,7 +32,7 @@ extern std::vector<RaceClassAllocation> character_create_allocations;
extern std::vector<RaceClassCombos> character_create_race_class_combos;
// solar: the current stuff is at the bottom of this function
// the current stuff is at the bottom of this function
void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) {
Inventory *inv;
uint8 has_home = 0;

View File

@ -665,7 +665,7 @@ bool ZoneServer::Process() {
}
case ServerOP_ZoneToZoneRequest: {
//
// solar: ZoneChange is received by the zone the player is in, then the
// ZoneChange is received by the zone the player is in, then the
// zone sends a ZTZ which ends up here. This code then find the target
// (ingress point) and boots it if needed, then sends the ZTZ to it.
// The ingress server will decide wether the player can enter, then will
@ -1405,10 +1405,10 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a
LSBootUpdate(iZoneID, iInstanceID);
}
void ZoneServer::IncommingClient(Client* client) {
void ZoneServer::IncomingClient(Client* client) {
BootingUp = true;
auto pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncommingClient_Struct));
ServerZoneIncommingClient_Struct* s = (ServerZoneIncommingClient_Struct*) pack->pBuffer;
auto pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncomingClient_Struct));
ServerZoneIncomingClient_Struct* s = (ServerZoneIncomingClient_Struct*) pack->pBuffer;
s->zoneid = GetZoneID();
s->instanceid = GetInstanceID();
s->wid = client->GetWID();

View File

@ -40,7 +40,7 @@ public:
bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false);
void TriggerBootup(uint32 iZoneID = 0, uint32 iInstanceID = 0, const char* iAdminName = 0, bool iMakeStatic = false);
void Disconnect() { tcpc->Disconnect(); }
void IncommingClient(Client* client);
void IncomingClient(Client* client);
void LSBootUpdate(uint32 zoneid, uint32 iInstanceID = 0, bool startup = false);
void LSSleepUpdate(uint32 zoneid);
void LSShutDownUpdate(uint32 zoneid);

View File

@ -481,7 +481,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
}
/*
solar: returns false if attack should not be allowed
returns false if attack should not be allowed
I try to list every type of conflict that's possible here, so it's easy
to see how the decision is made. Yea, it could be condensed and made
faster, but I'm doing it this way to make it readable and easy to modify
@ -550,7 +550,7 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
}
}
// solar: the format here is a matrix of mob type vs mob type.
// the format here is a matrix of mob type vs mob type.
// redundant ones are omitted and the reverse is tried if it falls through.
// first figure out if we're pets. we always look at the master's flags.
@ -701,7 +701,7 @@ type', in which case, the answer is yes.
}
// solar: this is to check if non detrimental things are allowed to be done
// this is to check if non detrimental things are allowed to be done
// to the target. clients cannot affect npcs and vice versa, and clients
// cannot affect other clients that are not of the same pvp flag as them.
// also goes for their pets
@ -717,7 +717,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
if (target->GetAllowBeneficial())
return true;
// solar: see IsAttackAllowed for notes
// see IsAttackAllowed for notes
// first figure out if we're pets. we always look at the master's flags.
// no need to compare pets to anything
@ -1233,7 +1233,7 @@ void Mob::ClearFeignMemory() {
AIfeignremember_timer->Disable();
}
bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
bool Mob::PassCharismaCheck(Mob* caster, uint16 spell_id) {
/*
Charm formula is correct based on over 50 hours of personal live parsing - Kayen
@ -1260,9 +1260,9 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
return true;
if (RuleB(Spells, CharismaCharmDuration))
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster,0,0,true,true);
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster,false,0,true,true);
else
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster, 0,0, false, true);
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster, false,0, false, true);
//2: The mob makes a resistance check against the charm
if (resist_check == 100)
@ -1286,8 +1286,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
{
// Assume this is a harmony/pacify spell
// If 'Lull' spell resists, do a second resist check with a charisma modifier AND regular resist checks. If resists agian you gain aggro.
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster, true);
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster, false,0,true);
if (resist_check == 100)
return true;
}

View File

@ -343,7 +343,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
{
/* solar: called when a mob is attacked, does the checks to see if it's a hit
/* called when a mob is attacked, does the checks to see if it's a hit
* and does other mitigation checks. 'this' is the mob being attacked.
*
* special return values:
@ -1378,7 +1378,7 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes att
if(spell_id==0)
spell_id = SPELL_UNKNOWN;
// cut all PVP spell damage to 2/3 -solar
// cut all PVP spell damage to 2/3
// Blasting ourselfs is considered PvP
//Don't do PvP mitigation if the caster is damaging himself
if(other && other->IsClient() && (other != this) && damage > 0) {
@ -2545,7 +2545,7 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
}
}
// solar: this is called from Damage() when 'this' is attacked by 'other.
// this is called from Damage() when 'this' is attacked by 'other.
// 'this' is the one being attacked
// 'other' is the attacker
// a damage shield causes damage (or healing) to whoever attacks the wearer

View File

@ -18,7 +18,7 @@
/*
solar: Beacon class, extends Mob. Used for AE rain spells to have a mob
Beacon class, extends Mob. Used for AE rain spells to have a mob
target to center around.
*/
@ -48,7 +48,7 @@ class Zone;
extern EntityList entity_list;
extern Zone* zone;
// solar: if lifetime is 0 this is a permanent beacon.. not sure if that'll be
// if lifetime is 0 this is a permanent beacon.. not sure if that'll be
// useful for anything
Beacon::Beacon(Mob *at_mob, int lifetime)
:Mob

View File

@ -2976,7 +2976,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
//Special custom cases for loading effects on to NPC from 'npc_spels_effects' table
if (IsAISpellEffect) {
//Non-Focused Effect to modify incomming spell damage by resist type.
//Non-Focused Effect to modify incoming spell damage by resist type.
case SE_FcSpellVulnerability:
ModVulnerability(base2, effect_value);
break;

Some files were not shown because too many files have changed in this diff Show More