mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
Merge git://github.com/EQEmu/Server into Development
This commit is contained in:
commit
9561a3fd3e
@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 09/24/2014 ==
|
||||
Uleat: Re-ordered server opcodes and handlers to give them some predictability of location (I need this for the inventory re-enumeration.)
|
||||
demonstar55: Added helper function bool EQEmu::IsTradeskill(uint32 skill)
|
||||
|
||||
== 09/23/2014 ==
|
||||
Kayen: Spell recourse effects will now be applied AFTER the base spells effects have been applied (consistent with live).
|
||||
|
||||
@ -55,8 +55,9 @@ SET(common_sources
|
||||
rulesys.cpp
|
||||
serverinfo.cpp
|
||||
shareddb.cpp
|
||||
skills.cpp
|
||||
spdat.cpp
|
||||
string_util.cpp
|
||||
string_util.cpp
|
||||
struct_strategy.cpp
|
||||
tcp_connection.cpp
|
||||
tcp_server.cpp
|
||||
@ -102,6 +103,7 @@ SET(common_headers
|
||||
crash.h
|
||||
crc16.h
|
||||
crc32.h
|
||||
data_verification.h
|
||||
database.h
|
||||
dbcore.h
|
||||
debug.h
|
||||
|
||||
@ -38,6 +38,11 @@ T ClampUpper(const T& value, const T& upper) {
|
||||
return std::min(value, upper);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
||||
return value >= lower && value <= upper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -26,12 +26,6 @@
|
||||
#include "dbcore.h"
|
||||
#include "linked_list.h"
|
||||
#include "eq_packet_structs.h"
|
||||
/*#include "eq_stream.h"
|
||||
#include "guilds.h"
|
||||
#include "misc_functions.h"
|
||||
#include "mutex.h"
|
||||
#include "item.h"
|
||||
#include "extprofile.h"*/
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
40
common/skills.cpp
Normal file
40
common/skills.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "skills.h"
|
||||
|
||||
bool EQEmu::IsTradeskill(uint32 skill)
|
||||
{
|
||||
switch (skill) {
|
||||
case SkillFishing:
|
||||
case SkillMakePoison:
|
||||
case SkillTinkering:
|
||||
case SkillResearch:
|
||||
case SkillAlchemy:
|
||||
case SkillBaking:
|
||||
case SkillTailoring:
|
||||
case SkillBlacksmithing:
|
||||
case SkillFletching:
|
||||
case SkillBrewing:
|
||||
case SkillPottery:
|
||||
case SkillJewelryMaking:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -260,4 +260,9 @@ typedef enum {
|
||||
#define HIGHEST_SKILL FRENZY
|
||||
*/
|
||||
|
||||
// for skill related helper functions
|
||||
namespace EQEmu {
|
||||
bool IsTradeskill(uint32 skill);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -29,6 +29,7 @@ public:
|
||||
TEST_ADD(DataVerificationTest::Clamp);
|
||||
TEST_ADD(DataVerificationTest::ClampUpper);
|
||||
TEST_ADD(DataVerificationTest::ClampLower);
|
||||
TEST_ADD(DataVerificationTest::ValueWithin);
|
||||
}
|
||||
|
||||
~DataVerificationTest() {
|
||||
@ -89,6 +90,19 @@ public:
|
||||
TEST_ASSERT_EQUALS(vi1, 500);
|
||||
TEST_ASSERT_EQUALS(vi2, 750);
|
||||
}
|
||||
|
||||
void ValueWithin() {
|
||||
float value_f = 500.0f;
|
||||
int value_i = 500;
|
||||
|
||||
TEST_ASSERT(EQEmu::ValueWithin(value_f, 0.0f, 1000.0f));
|
||||
TEST_ASSERT(!EQEmu::ValueWithin(value_f, 0.0f, 400.0f));
|
||||
TEST_ASSERT(!EQEmu::ValueWithin(value_f, 600.0f, 900.0f));
|
||||
|
||||
TEST_ASSERT(EQEmu::ValueWithin(value_i, 0, 1000));
|
||||
TEST_ASSERT(!EQEmu::ValueWithin(value_i, 0, 400));
|
||||
TEST_ASSERT(!EQEmu::ValueWithin(value_i, 600, 900));
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1790,28 +1790,15 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
||||
return Charerrors == 0;
|
||||
}
|
||||
|
||||
void Client::SetClassStartingSkills( PlayerProfile_Struct *pp )
|
||||
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp)
|
||||
{
|
||||
for(uint32 i = 0; i <= HIGHEST_SKILL; ++i) {
|
||||
if(pp->skills[i] == 0) {
|
||||
if(i >= SkillSpecializeAbjure && i <= SkillSpecializeEvocation) {
|
||||
for (uint32 i = 0; i <= HIGHEST_SKILL; ++i) {
|
||||
if (pp->skills[i] == 0) {
|
||||
if (i >= SkillSpecializeAbjure && i <= SkillSpecializeEvocation)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i == SkillMakePoison ||
|
||||
i == SkillTinkering ||
|
||||
i == SkillResearch ||
|
||||
i == SkillAlchemy ||
|
||||
i == SkillBaking ||
|
||||
i == SkillTailoring ||
|
||||
i == SkillBlacksmithing ||
|
||||
i == SkillFletching ||
|
||||
i == SkillBrewing ||
|
||||
i == SkillPottery ||
|
||||
i == SkillJewelryMaking ||
|
||||
i == SkillBegging) {
|
||||
if (EQEmu::IsTradeskill(i) || i == SkillBegging)
|
||||
continue;
|
||||
}
|
||||
|
||||
pp->skills[i] = database.GetSkillCap(pp->class_, (SkillUseTypes)i, 1);
|
||||
}
|
||||
|
||||
@ -284,9 +284,11 @@ int main(int argc, char** argv) {
|
||||
database.ClearRaid();
|
||||
database.ClearRaidDetails();
|
||||
_log(WORLD__INIT, "Loading items..");
|
||||
if (!database.LoadItems()) {
|
||||
if (!database.LoadItems())
|
||||
_log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring");
|
||||
}
|
||||
_log(WORLD__INIT, "Loading skill caps..");
|
||||
if (!database.LoadSkillCaps())
|
||||
_log(WORLD__INIT_ERR, "Error: Could not load skill cap data. But ignoring");
|
||||
_log(WORLD__INIT, "Loading guilds..");
|
||||
guild_mgr.LoadGuilds();
|
||||
//rules:
|
||||
|
||||
@ -48,6 +48,7 @@
|
||||
#include "../common/guilds.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/data_verification.h"
|
||||
#include "petitions.h"
|
||||
#include "npc_ai.h"
|
||||
#include "../common/skills.h"
|
||||
@ -10490,7 +10491,13 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app)
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer;
|
||||
if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) {
|
||||
LogFile->write(EQEMuLog::Debug, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mptbs->Action == 0) {
|
||||
const Item_Struct *BaseItem = database.GetItem(mptbs->ItemID);
|
||||
if (BaseItem) {
|
||||
|
||||
@ -497,7 +497,6 @@ void EntityList::MobProcess()
|
||||
if (!it->second->Process()) {
|
||||
Mob *mob = it->second;
|
||||
uint16 tempid = it->first;
|
||||
++it; // we don't erase here because the destructor will
|
||||
if (mob->IsNPC()) {
|
||||
entity_list.RemoveNPC(mob->CastToNPC()->GetID());
|
||||
} else if (mob->IsMerc()) {
|
||||
@ -525,7 +524,12 @@ void EntityList::MobProcess()
|
||||
}
|
||||
entity_list.RemoveClient(mob->GetID());
|
||||
}
|
||||
entity_list.RemoveMob(tempid);
|
||||
|
||||
if(entity_list.RemoveMob(tempid)) {
|
||||
it = mob_list.begin();
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
|
||||
@ -301,6 +301,7 @@ luabind::scope lua_register_packet() {
|
||||
.def("ReadFixedLengthString", &Lua_Packet::ReadFixedLengthString);
|
||||
}
|
||||
|
||||
//TODO: Reorder these to match emu_oplist.h again
|
||||
luabind::scope lua_register_packet_opcodes() {
|
||||
return luabind::class_<Opcodes>("Opcode")
|
||||
.enum_("constants")
|
||||
|
||||
@ -1178,8 +1178,14 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc
|
||||
}
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
i = atoi(row[0]); /* Potion belt slot number */
|
||||
pp->potionbelt.items[i].item_id = atoi(row[1]);
|
||||
pp->potionbelt.items[i].icon = atoi(row[2]);
|
||||
uint32 item_id = atoi(row[1]);
|
||||
const Item_Struct *item = database.GetItem(item_id);
|
||||
|
||||
if(item) {
|
||||
pp->potionbelt.items[i].item_id = item_id;
|
||||
pp->potionbelt.items[i].icon = atoi(row[2]);
|
||||
strncpy(pp->potionbelt.items[i].item_name, item->Name, 64);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user