Skip to content

Commit

Permalink
Merge pull request #1 from EQEmu/master
Browse files Browse the repository at this point in the history
Update from Root Repository
  • Loading branch information
briankinney authored Apr 12, 2019
2 parents b810e3a + 8f9a859 commit e8127f4
Show file tree
Hide file tree
Showing 52 changed files with 1,654 additions and 652 deletions.
95 changes: 95 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,101 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------

== 3/1/2019 ==
Noudess: Major faction conversion to use client data.

Pull request #802 New min/max personal faction per faction. Use of actual
client mods for race/class/deity.

This PR involves major changes to your database and your quests.

The clients recently exposed raw data included

- the min/max personal faction for each faction
- the actual faction id the client uses for each faction
- the actual mods that come into play when a PC cons an opponent that
determine your overall con to that faction.


The approach I took resulted in minimal change to the code base. I did
alter the code to enforce the new validated min/max from the client. This
min/max applies to personally earned faction. So if a faction has a min
of 0 and a max of 2000, that means your personally earned value can never
go below 0 or over 2000. The actual con, will, however often do so because
of class/race/deity modifications. I also changed the con ranges, per
Mackal's data that was proven to be accurate:

Ally = 1100+
Warmly = 750 to 1099
Kindly = 500 to 749
Amiable = 100 to 499
Indifferent = 0 to 99
Apprehensive = -1 to -100
Dubious = -101 to -500
Threateningly = -501 to -750
Ready to Attack = -751

The above means that dubious is a much smaller range now. For that reason
the scripts modify any custom faction base values to put them in the same
range, hopefully as the creators of the custom factions intended.

Also to be noted as characters that have a faction between -501 and -700
wont be dubious anymore, they will be threateningly. This is expected with
the new ranges, but might take players by suprise as the old ranges we used
were more liberal but were incorrect.

The database is changed extensively, but really only content. We're
translating faction_list to use the clients ids. As such every place a
faction_is is used, namely (see below) are being converted.

- faction_list
- faction_list_mod
- npc_faction (primary_faction field only)
- npc_faction_entries (faction_id field only)
- faction_values

Quests will also automatically be adjusted. This MUST be done after the
PR sql and before starting the server. This is automated by
eqemu_server.pl (or starting world)

Be assured, custom factions that you may have created, or obsolete or
duplicate factions in our original faction_list, that you may have used,
will be preserved. Anything that does not map directly is being moved to
the 5000 range in faction_list and any references are corrected to point
there.

A great example of this is Ebon Mask and Hall of the Ebon Mask. Many peqdb
style servers have both of these. Some have used one, some the other. We
map Ebon Mask to the clients Ebon mask and the Hall of the Ebon Mask gets
moved to the 5000 range, and all its references are preserved. However,
if you would like to make proper use of client mobs to Ebon mask, or other
factions that have duplicitous entries, I recommend you manually move to
using the correct one. In that way all of the new raw data mapped in from
the client into faction_list_mod will get used instead of what your db had
before these values were known.

In my experience converting 4 different server's data, there are only
about 20 factions moved into the 5000 range.

This PR has only 1 new, permanent table faction_base_data, which is taken
right from the client. The base field is left in case you want to mod your
server, but we are very sure that the client doesn't use a base. It uses
global mods to race or class for this as you'll see in the
new faction_list_mod.

The PR makes many backup tables, and two mapping tables that are used during
the conversion process to fix quests. This table was hand created by
analysis. This table serves no purpose after conversion except an audit
trail if we see any issues.

I will release a new PR that will clean up all these backups and temporary
tables in about a month.

== 2/7/2019 ==
Uleat: Put merc and bot classes on the same stance standard (mercs)
- Both classes will now use the same stance standard
- Pushed stance types up to EQEmu::constants

== 2/4/2019 ==
Uleat: Added command 'profanity' (aliased 'prof')
- This is a server-based tool for redacting any language that an admin deems as profanity (socially unacceptable within their community)
Expand Down
23 changes: 23 additions & 0 deletions client_files/export/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,29 @@ int main(int argc, char **argv) {
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();

std::string arg_1;

if (argv[1]) {
arg_1 = argv[1];
}

if (arg_1 == "spells") {
ExportSpells(&database);
return 0;
}
if (arg_1 == "skills") {
ExportSkillCaps(&database);
return 0;
}
if (arg_1 == "basedata") {
ExportBaseData(&database);
return 0;
}
if (arg_1 == "dbstring") {
ExportDBStrings(&database);
return 0;
}

ExportSpells(&database);
ExportSkillCaps(&database);
ExportBaseData(&database);
Expand Down
6 changes: 2 additions & 4 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ SET(common_sources
unix.cpp
xml_parser.cpp
platform.cpp
event/event_loop.cpp
json/jsoncpp.cpp
net/console_server.cpp
net/console_server_connection.cpp
Expand Down Expand Up @@ -209,8 +208,8 @@ SET(common_headers
version.h
xml_parser.h
zone_numbers.h
event/background_task.h
event/event_loop.h
event/task.h
event/timer.h
json/json.h
json/json-forwards.h
Expand Down Expand Up @@ -267,10 +266,9 @@ SET(common_headers
)

SOURCE_GROUP(Event FILES
event/background_task.h
event/event_loop.cpp
event/event_loop.h
event/timer.h
event/task.h
)

SOURCE_GROUP(Json FILES
Expand Down
29 changes: 13 additions & 16 deletions common/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,30 +171,27 @@ void Database::LoginIP(uint32 AccountID, const char* LoginIP) {
QueryDatabase(query);
}

int16 Database::CheckStatus(uint32 account_id) {
std::string query = StringFormat("SELECT `status`, UNIX_TIMESTAMP(`suspendeduntil`) as `suspendeduntil`, UNIX_TIMESTAMP() as `current`"
" FROM `account` WHERE `id` = %i", account_id);
int16 Database::CheckStatus(uint32 account_id)
{
std::string query = StringFormat(
"SELECT `status`, TIMESTAMPDIFF(SECOND, NOW(), `suspendeduntil`) FROM `account` WHERE `id` = %i",
account_id);

auto results = QueryDatabase(query);
if (!results.Success()) {
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
}

if (results.RowCount() != 1)
return 0;

auto row = results.begin();
int16 status = atoi(row[0]);
int32 suspendeduntil = 0;

// MariaDB initalizes with NULL if unix_timestamp() is out of range
if (row[1] != nullptr) {
suspendeduntil = atoi(row[1]);
}
auto row = results.begin();
int16 status = atoi(row[0]);
int32 date_diff = 0;

int32 current = atoi(row[2]);
if (row[1] != nullptr)
date_diff = atoi(row[1]);

if(suspendeduntil > current)
if (date_diff > 0)
return -1;

return status;
Expand Down
34 changes: 34 additions & 0 deletions common/emu_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,37 @@ EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category

return catOther;
}

const char *EQEmu::constants::GetStanceName(StanceType stance_type) {
switch (stance_type) {
case stanceUnknown:
return "Unknown";
case stancePassive:
return "Passive";
case stanceBalanced:
return "Balanced";
case stanceEfficient:
return "Efficient";
case stanceReactive:
return "Reactive";
case stanceAggressive:
return "Aggressive";
case stanceAssist:
return "Assist";
case stanceBurn:
return "Burn";
case stanceEfficient2:
return "Efficient2";
case stanceBurnAE:
return "BurnAE";
default:
return "Invalid";
}
}

int EQEmu::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
if (stance_type >= EQEmu::constants::stancePassive && stance_type <= EQEmu::constants::stanceBurnAE)
return (stance_type - EQEmu::constants::stancePassive);

return 0;
}
26 changes: 26 additions & 0 deletions common/emu_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,26 @@ namespace EQEmu
const size_t SAY_LINK_CLOSER_SIZE = 1;
const size_t SAY_LINK_MAXIMUM_SIZE = (SAY_LINK_OPENER_SIZE + SAY_LINK_BODY_SIZE + SAY_LINK_TEXT_SIZE + SAY_LINK_CLOSER_SIZE);

enum StanceType : int {
stanceUnknown = 0,
stancePassive,
stanceBalanced,
stanceEfficient,
stanceReactive,
stanceAggressive,
stanceAssist,
stanceBurn,
stanceEfficient2,
stanceBurnAE
};

const char *GetStanceName(StanceType stance_type);
int ConvertStanceTypeToIndex(StanceType stance_type);

const int STANCE_TYPE_FIRST = stancePassive;
const int STANCE_TYPE_LAST = stanceBurnAE;
const int STANCE_TYPE_COUNT = stanceBurnAE;

} /*constants*/

namespace profile {
Expand Down Expand Up @@ -287,6 +307,12 @@ namespace EQEmu

} // namespace bug

enum WaypointStatus : int {
RoamBoxPauseInProgress = -3,
QuestControlNoGrid = -2,
QuestControlGrid = -1
};

} /*EQEmu*/

#endif /*COMMON_EMU_CONSTANTS_H*/
Expand Down
3 changes: 3 additions & 0 deletions common/eq_stream_intf.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <string>
#include "emu_versions.h"
#include "eq_packet.h"
#include "net/daybreak_connection.h"

typedef enum {
ESTABLISHED,
Expand Down Expand Up @@ -56,6 +57,8 @@ class EQStreamInterface {
virtual const uint32 GetBytesSentPerSecond() const { return 0; }
virtual const uint32 GetBytesRecvPerSecond() const { return 0; }
virtual const EQEmu::versions::ClientVersion ClientVersion() const { return EQEmu::versions::ClientVersion::Unknown; }

virtual std::shared_ptr<EQ::Net::DaybreakConnection> GetRawConnection() = 0;
};

#endif /*EQSTREAMINTF_H_*/
4 changes: 4 additions & 0 deletions common/eq_stream_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ void EQStreamProxy::RemoveData() {
m_stream->RemoveData();
}

std::shared_ptr<EQ::Net::DaybreakConnection> EQStreamProxy::GetRawConnection() {
return m_stream->GetRawConnection();
}

bool EQStreamProxy::CheckState(EQStreamState state) {
if(m_stream)
return(m_stream->CheckState(state));
Expand Down
2 changes: 2 additions & 0 deletions common/eq_stream_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class EQStreamProxy : public EQStreamInterface {
virtual const uint32 GetBytesSentPerSecond() const;
virtual const uint32 GetBytesRecvPerSecond() const;

virtual std::shared_ptr<EQ::Net::DaybreakConnection> GetRawConnection();

protected:
std::shared_ptr<EQStreamInterface> const m_stream; //we own this stream object.
const StructStrategy *const m_structs; //we do not own this object.
Expand Down
42 changes: 0 additions & 42 deletions common/event/background_task.h

This file was deleted.

Empty file removed common/event/event_loop.cpp
Empty file.
Loading

0 comments on commit e8127f4

Please sign in to comment.