Change space indentation to tabs

This commit is contained in:
j883376
2013-05-09 10:44:08 -04:00
parent ffcff4aea1
commit 4bdd8b2502
393 changed files with 22463 additions and 23238 deletions
+91 -91
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
// Test 1
@@ -195,21 +195,21 @@ void Client::ActivateAA(aaID activate){
uint32 aaremain_min = (aaremain / 60) % 60;
uint32 aaremain_sec = aaremain % 60;
if(aa2) {
if (aaremain_hr >= 1) //1 hour or more
Message(13, "You can use the ability %s again in %u hour(s) %u minute(s) %u seconds",
aa2->name, aaremain_hr, aaremain_min, aaremain_sec);
else //less than an hour
Message(13, "You can use the ability %s again in %u minute(s) %u seconds",
aa2->name, aaremain_min, aaremain_sec);
} else {
if (aaremain_hr >= 1) //1 hour or more
Message(13, "You can use this ability again in %u hour(s) %u minute(s) %u seconds",
aaremain_hr, aaremain_min, aaremain_sec);
else //less than an hour
Message(13, "You can use this ability again in %u minute(s) %u seconds",
aaremain_min, aaremain_sec);
}
if(aa2) {
if (aaremain_hr >= 1) //1 hour or more
Message(13, "You can use the ability %s again in %u hour(s) %u minute(s) %u seconds",
aa2->name, aaremain_hr, aaremain_min, aaremain_sec);
else //less than an hour
Message(13, "You can use the ability %s again in %u minute(s) %u seconds",
aa2->name, aaremain_min, aaremain_sec);
} else {
if (aaremain_hr >= 1) //1 hour or more
Message(13, "You can use this ability again in %u hour(s) %u minute(s) %u seconds",
aaremain_hr, aaremain_min, aaremain_sec);
else //less than an hour
Message(13, "You can use this ability again in %u minute(s) %u seconds",
aaremain_min, aaremain_sec);
}
return;
}
@@ -281,30 +281,30 @@ void Client::ActivateAA(aaID activate){
if(caa->reuse_time > 0)
{
uint32 timer_base = CalcAAReuseTimer(caa);
SendAATimer(AATimerID, 0, 0);
p_timers.Start(AATimerID + pTimerAAStart, timer_base);
SendAATimer(AATimerID, 0, 0);
p_timers.Start(AATimerID + pTimerAAStart, timer_base);
if(activate == aaImprovedHarmTouch || activate == aaLeechTouch)
{
p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime);
}
// Bards can cast instant cast AAs while they are casting another song
if (spells[caa->spell_id].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) {
if(!SpellFinished(caa->spell_id, entity_list.GetMob(target_id), 10, -1, -1, spells[caa->spell_id].ResistDiff, false)) {
//Reset on failed cast
SendAATimer(AATimerID, 0, 0xFFFFFF);
Message_StringID(15,ABILITY_FAILED);
p_timers.Clear(&database, AATimerID + pTimerAAStart);
return;
}
} else {
if(!CastSpell(caa->spell_id, target_id, 10, -1, -1, 0, -1, AATimerID + pTimerAAStart, timer_base, 1)) {
//Reset on failed cast
SendAATimer(AATimerID, 0, 0xFFFFFF);
Message_StringID(15,ABILITY_FAILED);
p_timers.Clear(&database, AATimerID + pTimerAAStart);
return;
}
}
// Bards can cast instant cast AAs while they are casting another song
if (spells[caa->spell_id].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) {
if(!SpellFinished(caa->spell_id, entity_list.GetMob(target_id), 10, -1, -1, spells[caa->spell_id].ResistDiff, false)) {
//Reset on failed cast
SendAATimer(AATimerID, 0, 0xFFFFFF);
Message_StringID(15,ABILITY_FAILED);
p_timers.Clear(&database, AATimerID + pTimerAAStart);
return;
}
} else {
if(!CastSpell(caa->spell_id, target_id, 10, -1, -1, 0, -1, AATimerID + pTimerAAStart, timer_base, 1)) {
//Reset on failed cast
SendAATimer(AATimerID, 0, 0xFFFFFF);
Message_StringID(15,ABILITY_FAILED);
p_timers.Clear(&database, AATimerID + pTimerAAStart);
return;
}
}
}
else
{
@@ -405,7 +405,7 @@ void Client::HandleAAAction(aaID activate) {
switch (GetClass())
{
case DRUID:
spell_id = 2760; //2644?
spell_id = 2760; //2644?
break;
case NECROMANCER:
spell_id = 2759; //2643?
@@ -496,7 +496,7 @@ void Client::HandleAAAction(aaID activate) {
break;
case aaActionFadingMemories:
// Do nothing since spell effect works correctly, but mana isn't used.
// Do nothing since spell effect works correctly, but mana isn't used.
break;
default:
@@ -602,10 +602,10 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
if(summon_count > MAX_SWARM_PETS)
summon_count = MAX_SWARM_PETS;
static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5,
static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5,
10, -10, 10, -10,
8, -8, 8, -8 };
static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5,
static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5,
10, 10, -10, -10,
8, 8, -8, -8 };
TempPets(true);
@@ -695,10 +695,10 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid
if(summon_count > MAX_SWARM_PETS)
summon_count = MAX_SWARM_PETS;
static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5,
static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5,
10, -10, 10, -10,
8, -8, 8, -8 };
static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5,
static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5,
10, 10, -10, -10,
8, 8, -8, -8 };
TempPets(true);
@@ -1113,19 +1113,19 @@ void Client::SendAATimers() {
}
void Client::SendAATable() {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespondAA, sizeof(AATable_Struct));
EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespondAA, sizeof(AATable_Struct));
AATable_Struct* aa2 = (AATable_Struct *)outapp->pBuffer;
AATable_Struct* aa2 = (AATable_Struct *)outapp->pBuffer;
aa2->aa_spent = GetAAPointsSpent();
uint32 i;
uint32 i;
for(i=0;i < MAX_PP_AA_ARRAY;i++){
aa2->aa_list[i].aa_skill = aa[i]->AA;
aa2->aa_list[i].aa_value = aa[i]->value;
aa2->aa_list[i].unknown08 = 0;
}
QueuePacket(outapp);
safe_delete(outapp);
QueuePacket(outapp);
safe_delete(outapp);
}
void Client::SendPreviousAA(uint32 id, int seq){
@@ -1251,7 +1251,7 @@ void Client::SendAA(uint32 id, int seq) {
Utilizes two new fields: sof_next_id (which is the next id in the series), sof_current_level (ranks the AA's as the current level)
1) If no AA's purchased only display the base levels of each AA series.
2) When you purchase an AA and its rank is maxed it sends the packet for the completed AA, and the packet
for the next aa in the series. The previous tier is removed from your window, and the new AA is displayed.
for the next aa in the series. The previous tier is removed from your window, and the new AA is displayed.
3) When you zone/buy your player profile will be checked and determine what AA can be displayed base on what you have already.
*/
@@ -1279,9 +1279,9 @@ void Client::SendAA(uint32 id, int seq) {
if (saa_pp->id == saa2->id)
break; //You already have this in the player profile.
else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value < saa_pp->max_level))
else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value < saa_pp->max_level))
return; //DISABLE DISPLAY HIGHER - You have not reached max level yet of your current AA.
else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value == saa_pp->max_level) && (saa_pp->sof_next_id == saa2->id))
else if ((saa_pp->sof_current_level < saa2->sof_current_level) && (aa_value == saa_pp->max_level) && (saa_pp->sof_next_id == saa2->id))
IsBaseLevel = false; //ALLOW DISPLAY HIGHER
}
}
@@ -1321,9 +1321,9 @@ void Client::SendAA(uint32 id, int seq) {
SendAA_Struct* saa_next = nullptr;
saa_next = zone->FindAA(saa->sof_next_id);
if (saa_next &&
(((GetClientVersionBit() == 4) && (saa_next->clientver > 4))
|| ((GetClientVersionBit() == 8) && (saa_next->clientver > 5))
|| ((GetClientVersionBit() == 16) && (saa_next->clientver > 6)))){
(((GetClientVersionBit() == 4) && (saa_next->clientver > 4))
|| ((GetClientVersionBit() == 8) && (saa_next->clientver > 5))
|| ((GetClientVersionBit() == 16) && (saa_next->clientver > 6)))){
saa->next_id=0xFFFFFFFF;
}
}
@@ -1359,7 +1359,7 @@ void Client::SendAA(uint32 id, int seq) {
if(value > 0)
{
// AA_Action stores the base ID
// AA_Action stores the base ID
const AA_DBAction *caa = &AA_Actions[saa->id - value + 1][value - 1];
if(caa && caa->reuse_time > 0)
@@ -1385,7 +1385,7 @@ void Client::SendAA(uint32 id, int seq) {
QueuePacket(outapp);
safe_delete(outapp);
//will outapp delete the buffer for us even though it didnt make it? --- Yes, it should
//will outapp delete the buffer for us even though it didnt make it? --- Yes, it should
}
void Client::SendAAList(){
@@ -1504,7 +1504,7 @@ void Client::ResetAA(){
for(itr=aa_points.begin();itr!=aa_points.end();itr++)
aa_points[itr->first] = 0;
for(int i = 0; i < _maxLeaderAA; ++i)
for(int i = 0; i < _maxLeaderAA; ++i)
m_pp.leader_abilities.ranks[i] = 0;
m_pp.group_leadership_points = 0;
@@ -1634,13 +1634,13 @@ void Client::InspectBuffs(Client* Inspector, int Rank)
//this really need to be renamed to LoadAAActions()
bool ZoneDatabase::LoadAAEffects() {
char errbuf[MYSQL_ERRMSG_SIZE];
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL_RES *result;
MYSQL_ROW row;
memset(AA_Actions, 0, sizeof(AA_Actions)); //I hope the compiler is smart about this size...
const char *query = "SELECT aaid,rank,reuse_time,spell_id,target,nonspell_action,nonspell_mana,nonspell_duration,"
" redux_aa,redux_rate,redux_aa2,redux_rate2 FROM aa_actions";
"redux_aa,redux_rate,redux_aa2,redux_rate2 FROM aa_actions";
if(RunQuery(query, static_cast<uint32>(strlen(query)), errbuf, &result)) {
//safe_delete_array(query);
@@ -1684,9 +1684,9 @@ bool ZoneDatabase::LoadAAEffects() {
//AndMetal: this may now be obsolete since we have Zone::GetTotalAALevels()
uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int total=0;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(slot) from aa_effects where aaid=%i", skill_id), errbuf, &result)) {
safe_delete_array(query);
@@ -1704,8 +1704,8 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) {
//this will allow us to count the number of effects for an AA by pulling the info from memory instead of the database. hopefully this will same some CPU cycles
uint8 Zone::GetTotalAALevels(uint32 skill_id) {
size_t sz = aa_effects[skill_id].size();
return sz >= 255 ? 255 : static_cast<uint8>(sz);
size_t sz = aa_effects[skill_id].size();
return sz >= 255 ? 255 : static_cast<uint8>(sz);
}
/*
@@ -1728,9 +1728,9 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){
return;
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT effectid, base1, base2, slot from aa_effects where aaid=%i order by slot asc", aa_struct->id), errbuf, &result)) {
int ndx=0;
while((row = mysql_fetch_row(result))!=nullptr) {
@@ -1749,9 +1749,9 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){
uint32 ZoneDatabase::CountAAs(){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int count=0;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(title_sid) from altadv_vars"), errbuf, &result)) {
if((row = mysql_fetch_row(result))!=nullptr)
@@ -1766,9 +1766,9 @@ uint32 ZoneDatabase::CountAAs(){
uint32 ZoneDatabase::CountAAEffects(){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int count=0;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(id) from aa_effects"), errbuf, &result)) {
if((row = mysql_fetch_row(result))!=nullptr){
@@ -1864,7 +1864,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id)
"WHERE "
"p.skill_id = a.prereq_skill"
"), "
"0) AS prereq_skill_index, "
"0) AS prereq_skill_index, "
"a.prereq_minpoints, "
"a.spell_type, "
"a.spell_refresh, "
@@ -1963,19 +1963,19 @@ void Client::DurationRampage(uint32 duration)
AA_SwarmPetInfo::AA_SwarmPetInfo()
{
target = 0;
owner_id = 0;
duration = nullptr;
target = 0;
owner_id = 0;
duration = nullptr;
}
AA_SwarmPetInfo::~AA_SwarmPetInfo()
{
target = 0;
owner_id = 0;
safe_delete(duration);
target = 0;
owner_id = 0;
safe_delete(duration);
}
Mob *AA_SwarmPetInfo::GetOwner()
{
return entity_list.GetMobID(owner_id);
return entity_list.GetMobID(owner_id);
}
+1394 -1394
View File
File diff suppressed because it is too large Load Diff
+154 -154
View File
@@ -1,155 +1,155 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(zone_sources
AA.cpp
aggro.cpp
attack.cpp
beacon.cpp
bonuses.cpp
bot.cpp
botspellsai.cpp
client.cpp
client_logs.cpp
client_mods.cpp
client_packet.cpp
client_process.cpp
command.cpp
doors.cpp
effects.cpp
embparser.cpp
embperl.cpp
embxs.cpp
entity.cpp
exp.cpp
fearpath.cpp
forage.cpp
groups.cpp
guild.cpp
guild_mgr.cpp
hate_list.cpp
horse.cpp
inventory.cpp
loottables.cpp
Map.cpp
merc.cpp
mob.cpp
MobAI.cpp
net.cpp
npc.cpp
NpcAI.cpp
Object.cpp
parser.cpp
pathing.cpp
perl_client.cpp
perl_doors.cpp
perl_entity.cpp
perl_groups.cpp
perl_hateentry.cpp
perl_mob.cpp
perl_npc.cpp
perl_object.cpp
perl_perlpacket.cpp
perl_PlayerCorpse.cpp
perl_questitem.cpp
perl_raids.cpp
perlpacket.cpp
perlparser.cpp
petitions.cpp
pets.cpp
PlayerCorpse.cpp
QGlobals.cpp
questmgr.cpp
QuestParserCollection.cpp
raids.cpp
spawn2.cpp
spawn2.h
spawngroup.cpp
special_attacks.cpp
spell_effects.cpp
spells.cpp
tasks.cpp
titles.cpp
tradeskills.cpp
trading.cpp
trap.cpp
tribute.cpp
updatemgr.cpp
watermap.cpp
waypoints.cpp
worldserver.cpp
zone.cpp
zone_logsys.cpp
zone_profile.cpp
ZoneConfig.cpp
zonedb.cpp
zonedbasync.cpp
zoning.cpp
AA.cpp
aggro.cpp
attack.cpp
beacon.cpp
bonuses.cpp
bot.cpp
botspellsai.cpp
client.cpp
client_logs.cpp
client_mods.cpp
client_packet.cpp
client_process.cpp
command.cpp
doors.cpp
effects.cpp
embparser.cpp
embperl.cpp
embxs.cpp
entity.cpp
exp.cpp
fearpath.cpp
forage.cpp
groups.cpp
guild.cpp
guild_mgr.cpp
hate_list.cpp
horse.cpp
inventory.cpp
loottables.cpp
Map.cpp
merc.cpp
mob.cpp
MobAI.cpp
net.cpp
npc.cpp
NpcAI.cpp
Object.cpp
parser.cpp
pathing.cpp
perl_client.cpp
perl_doors.cpp
perl_entity.cpp
perl_groups.cpp
perl_hateentry.cpp
perl_mob.cpp
perl_npc.cpp
perl_object.cpp
perl_perlpacket.cpp
perl_PlayerCorpse.cpp
perl_questitem.cpp
perl_raids.cpp
perlpacket.cpp
perlparser.cpp
petitions.cpp
pets.cpp
PlayerCorpse.cpp
QGlobals.cpp
questmgr.cpp
QuestParserCollection.cpp
raids.cpp
spawn2.cpp
spawn2.h
spawngroup.cpp
special_attacks.cpp
spell_effects.cpp
spells.cpp
tasks.cpp
titles.cpp
tradeskills.cpp
trading.cpp
trap.cpp
tribute.cpp
updatemgr.cpp
watermap.cpp
waypoints.cpp
worldserver.cpp
zone.cpp
zone_logsys.cpp
zone_profile.cpp
ZoneConfig.cpp
zonedb.cpp
zonedbasync.cpp
zoning.cpp
mod_functions.cpp
)
SET(zone_headers
AA.h
basic_functions.h
beacon.h
bot.h
botStructs.h
client.h
client_logs.h
client_packet.h
command.h
common.h
doors.h
embparser.h
embperl.h
embxs.h
entity.h
errmsg.h
event_codes.h
forage.h
groups.h
guild_mgr.h
hate_list.h
horse.h
map.h
masterentity.h
maxskill.h
message.h
merc.h
mob.h
net.h
npc.h
NpcAI.h
object.h
parser.h
pathing.h
perlpacket.h
perlparser.h
petitions.h
pets.h
PlayerCorpse.h
QGlobals.h
QuestInterface.h
questmgr.h
QuestParserCollection.h
raid.h
raids.h
skills.h
spawn2.cpp
spawn2.h
spawngroup.h
StringIDs.h
tasks.h
titles.h
trap.h
updatemgr.h
watermap.h
worldserver.h
zone.h
zone_profile.h
ZoneConfig.h
zonedb.h
zonedbasync.h
zonedump.h
AA.h
basic_functions.h
beacon.h
bot.h
botStructs.h
client.h
client_logs.h
client_packet.h
command.h
common.h
doors.h
embparser.h
embperl.h
embxs.h
entity.h
errmsg.h
event_codes.h
forage.h
groups.h
guild_mgr.h
hate_list.h
horse.h
map.h
masterentity.h
maxskill.h
message.h
merc.h
mob.h
net.h
npc.h
NpcAI.h
object.h
parser.h
pathing.h
perlpacket.h
perlparser.h
petitions.h
pets.h
PlayerCorpse.h
QGlobals.h
QuestInterface.h
questmgr.h
QuestParserCollection.h
raid.h
raids.h
skills.h
spawn2.cpp
spawn2.h
spawngroup.h
StringIDs.h
tasks.h
titles.h
trap.h
updatemgr.h
watermap.h
worldserver.h
zone.h
zone_profile.h
ZoneConfig.h
zonedb.h
zonedbasync.h
zonedump.h
)
ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
@@ -159,21 +159,21 @@ ADD_DEFINITIONS(-DZONE)
TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC)
SET_TARGET_PROPERTIES(zone PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(zone "Ws2_32.lib")
SET_TARGET_PROPERTIES(zone PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(zone "Ws2_32.lib")
ENDIF(MSVC)
IF(MINGW)
TARGET_LINK_LIBRARIES(zone "WS2_32")
TARGET_LINK_LIBRARIES(zone "WS2_32")
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(zone "dl")
TARGET_LINK_LIBRARIES(zone "z")
TARGET_LINK_LIBRARIES(zone "m")
TARGET_LINK_LIBRARIES(zone "rt")
TARGET_LINK_LIBRARIES(zone "pthread")
ADD_DEFINITIONS(-fPIC)
TARGET_LINK_LIBRARIES(zone "dl")
TARGET_LINK_LIBRARIES(zone "z")
TARGET_LINK_LIBRARIES(zone "m")
TARGET_LINK_LIBRARIES(zone "rt")
TARGET_LINK_LIBRARIES(zone "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
INCLUDE_DIRECTORIES(${VLD_INCLUDE_DIR})
+54 -54
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/MiscFunctions.h"
@@ -294,7 +294,7 @@ if(_node->node4 != nullptr) {
tmp = SeekNode( _node->nodes[1], x, y );
}
} else {
if(y < midy) { //quad 4
if(y < midy) { //quad 4
if(_node->nodes[2] != NODE_NONE && _node->nodes[3] != node_r)
tmp = SeekNode( _node->nodes[3], x, y );
} else { //quad 1
@@ -304,16 +304,16 @@ if(_node->node4 != nullptr) {
}
if( tmp != NODE_NONE ) return tmp;
#else
if(_node->nodes[0] == node_r) return(NODE_NONE); //prevent infinite recursion
if(_node->nodes[0] == node_r) return(NODE_NONE); //prevent infinite recursion
tmp = SeekNode( _node->nodes[0], x, y );
if( tmp != NODE_NONE ) return tmp;
if(_node->nodes[1] == node_r) return(NODE_NONE); //prevent infinite recursion
if(_node->nodes[1] == node_r) return(NODE_NONE); //prevent infinite recursion
tmp = SeekNode( _node->nodes[1], x, y );
if( tmp != NODE_NONE ) return tmp;
if(_node->nodes[2] == node_r) return(NODE_NONE); //prevent infinite recursion
if(_node->nodes[2] == node_r) return(NODE_NONE); //prevent infinite recursion
tmp = SeekNode( _node->nodes[2], x, y );
if( tmp != NODE_NONE ) return tmp;
if(_node->nodes[3] == node_r) return(NODE_NONE); //prevent infinite recursion
if(_node->nodes[3] == node_r) return(NODE_NONE); //prevent infinite recursion
tmp = SeekNode( _node->nodes[3], x, y );
if( tmp != NODE_NONE ) return tmp;
#endif
@@ -326,13 +326,13 @@ printf(" No node found.\n");
}
// maybe precalc edges.
int* Map::SeekFace( NodeRef node_r, float x, float y ) {
int* Map::SeekFace( NodeRef node_r, float x, float y ) {
if( node_r == NODE_NONE || node_r >= m_Nodes) {
return(nullptr);
}
const PNODE _node = &mNodes[node_r];
if(!(_node->flags & nodeFinal)) {
return(nullptr); //not a final node... could find the proper node...
return(nullptr); //not a final node... could find the proper node...
}
@@ -348,15 +348,15 @@ int* Map::SeekFace( NodeRef node_r, float x, float y ) {
const VERTEX &v3 = cf.c;
dx = v2.x - v1.x; dy = v2.y - v1.y;
nx = x - v1.x; ny = y - v1.y;
nx = x - v1.x; ny = y - v1.y;
if( dx*ny - dy*nx >0.0f ) continue;
dx = v3.x - v2.x; dy = v3.y - v2.y;
nx = x - v2.x; ny = y - v2.y;
nx = x - v2.x; ny = y - v2.y;
if( dx*ny - dy*nx >0.0f ) continue;
dx = v1.x - v3.x; dy = v1.y - v3.y;
nx = x - v3.x; ny = y - v3.y;
nx = x - v3.x; ny = y - v3.y;
if( dx*ny - dy*nx >0.0f ) continue;
*face++ = mFaceLists[_node->faces.offset + i];
@@ -396,14 +396,14 @@ bool Map::LineIntersectsZone(VERTEX start, VERTEX end, float step_mag, VERTEX *r
if((stepx == 0) && (stepy == 0) && (stepz == 0))
return false;
float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz);
float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz);
stepx = (stepx/factor)*step_mag;
stepy = (stepy/factor)*step_mag;
stepz = (stepz/factor)*step_mag;
NodeRef cnode, lnode, finalnode;
lnode = NODE_NONE; //last node visited
lnode = NODE_NONE; //last node visited
cnode = SeekNode(GetRoot(), start.x, start.y);
finalnode = SeekNode(GetRoot(), end.x, end.y);
@@ -416,22 +416,22 @@ bool Map::LineIntersectsZone(VERTEX start, VERTEX end, float step_mag, VERTEX *r
stepy = (float)end.y - cury;
stepz = (float)end.z - curz;
factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz);
factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz);
stepx = (stepx/factor)*step_mag;
stepy = (stepy/factor)*step_mag;
stepz = (stepz/factor)*step_mag;
cnode = SeekNode(GetRoot(), curx, cury);
cnode = SeekNode(GetRoot(), curx, cury);
if(cnode != lnode)
{
lnode = cnode;
lnode = cnode;
if(cnode == NODE_NONE)
return false;
if(LineIntersectsNode(cnode, start, end, result, on))
return(true);
return(true);
if(cnode == finalnode)
return false;
@@ -466,11 +466,11 @@ bool Map::LocWithinNode( NodeRef node_r, float x, float y ) const {
bool Map::LineIntersectsNode( NodeRef node_r, VERTEX p1, VERTEX p2, VERTEX *result, FACE **on) const {
_ZP(Map_LineIntersectsNode);
if( node_r == NODE_NONE || node_r >= m_Nodes) {
return(true); //can see through empty nodes, just allow LOS on error...
return(true); //can see through empty nodes, just allow LOS on error...
}
const PNODE _node = &mNodes[node_r];
if(!(_node->flags & nodeFinal)) {
return(true); //not a final node... not sure best action
return(true); //not a final node... not sure best action
}
unsigned long i;
@@ -512,7 +512,7 @@ float Map::FindBestZ( NodeRef node_r, VERTEX p1, VERTEX *result, FACE **on) cons
}
const PNODE _node = &mNodes[node_r];
if(!(_node->flags & nodeFinal)) {
return(BEST_Z_INVALID); //not a final node... could find the proper node...
return(BEST_Z_INVALID); //not a final node... could find the proper node...
}
VERTEX tmp_result; //dummy placeholder if they do not ask for a result.
@@ -541,7 +541,7 @@ printf("Start finding best Z...\n");
#endif
for(i = 0; i < _node->faces.count; i++) {
if(*cfl > m_Faces)
continue; //watch for invalid lists, they seem to happen, e.g. in eastwastes.map
continue; //watch for invalid lists, they seem to happen, e.g. in eastwastes.map
cur = &mFinalFaces[ *cfl ];
//printf("Intersecting with face %lu\n", *cfl);
@@ -564,7 +564,7 @@ printf("Start finding best Z...\n");
if(best_z != BEST_Z_INVALID) return best_z;
p1.z = p1.z + 10 ; // If we can't find a best Z, the NPC is probably just under the world. Try again from 10 units higher up.
p1.z = p1.z + 10 ; // If we can't find a best Z, the NPC is probably just under the world. Try again from 10 units higher up.
}
#ifdef DEBUG_BEST_Z
@@ -577,7 +577,7 @@ printf("Best Z found: %.2f\n", best_z);
bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result) const {
if( cface == nullptr ) {
return(false); //cant intersect a face we dont have... i guess
return(false); //cant intersect a face we dont have... i guess
}
const VERTEX &pa = cface->a;
@@ -608,7 +608,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
return(false);
//begin attempt 2
//#define RTOD 57.2957795 //radians to degrees constant.
//#define RTOD 57.2957795 //radians to degrees constant.
float d;
float denom,mu;
@@ -645,11 +645,11 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
// Calculate the position on the line that intersects the plane
denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z);
if (ABS(denom) < EPS) // Line and plane don't intersect
return(false);
if (ABS(denom) < EPS) // Line and plane don't intersect
return(false);
mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom;
if (mu < 0 || mu > 1) // Intersection not along line segment
return(false);
if (mu < 0 || mu > 1) // Intersection not along line segment
return(false);
p->x = p1.x + mu * (p2.x - p1.x);
p->y = p1.y + mu * (p2.y - p1.y);
p->z = p1.z + mu * (p2.z - p1.z);
@@ -682,7 +682,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
// if (ABS(total - 2*M_PI) > EPS)
total = (acos(a1) + acos(a2) + acos(a3)) * 57.2957795;
if (ABS(total - 360) > EPS)
return(false);
return(false);
return(true);
*/
@@ -737,13 +737,13 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
// Determine whether or not the intersection point is bounded by pa,pb,pc
#define Sign(p1, p2, p3) \
((p1->x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1->y - p3.y))
bool b1, b2, b3;
bool b1, b2, b3;
b1 = Sign(p, pa2, pb2) < 0.0f;
b2 = Sign(p, pb2, pc2) < 0.0f;
b3 = Sign(p, pc2, pa2) < 0.0f;
b1 = Sign(p, pa2, pb2) < 0.0f;
b2 = Sign(p, pb2, pc2) < 0.0f;
b3 = Sign(p, pc2, pa2) < 0.0f;
return ((b1 == b2) && (b2 == b3));
return ((b1 == b2) && (b2 == b3));
*/
/* //not working well, seems to block LOS a lot
@@ -805,16 +805,16 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
/*
Yet another method adapted from this code:
Vec3 pa1 = pa - p;
Vec3 pa2 = pb - p;
float d = pa1.cross(pa2).dot(n);
if (d < 0) return false;
Vec3 pa3 = pb - p;
d = pa2.cross(pa3).dot(n);
if (d < 0) return false;
d = pa3.cross(pa1).dot(n);
if (d < 0) return false;
return true;
Vec3 pa1 = pa - p;
Vec3 pa2 = pb - p;
float d = pa1.cross(pa2).dot(n);
if (d < 0) return false;
Vec3 pa3 = pb - p;
d = pa2.cross(pa3).dot(n);
if (d < 0) return false;
d = pa3.cross(pa1).dot(n);
if (d < 0) return false;
return true;
*/
//in practice, this seems to actually take longer
+310 -309
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -68,9 +68,10 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
float dist2;
if (iSpellTypes & SpellType_Escape) {
dist2 = 0; //DistNoRoot(*this); //WTF was up with this...
} else
dist2 = DistNoRoot(*tar);
dist2 = 0; //DistNoRoot(*this); //WTF was up with this...
}
else
dist2 = DistNoRoot(*tar);
bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once.
@@ -93,8 +94,8 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
((
(spells[AIspells[i].spellid].targettype==ST_AECaster || spells[AIspells[i].spellid].targettype==ST_AEBard)
&& dist2 <= spells[AIspells[i].spellid].aoerange*spells[AIspells[i].spellid].aoerange
) ||
dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range
) ||
dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range
)
&& (mana_cost <= GetMana() || GetMana() == GetMaxMana())
&& (AIspells[i].time_cancast+(MakeRandomInt(0, 4))) <= Timer::GetCurrentTime() //break up the spelling casting over a period of time.
@@ -102,11 +103,11 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
#if MobAI_DEBUG_Spells >= 21
cout << "Mob::AICastSpell: Casting: spellid=" << AIspells[i].spellid
<< ", tar=" << tar->GetName()
<< ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range *spells[AIspells[i].spellid].range
<< ", mana_cost[" << mana_cost << "]<=" << GetMana()
<< ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime()
<< ", type=" << AIspells[i].type << endl;
<< ", tar=" << tar->GetName()
<< ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range *spells[AIspells[i].spellid].range
<< ", mana_cost[" << mana_cost << "]<=" << GetMana()
<< ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime()
<< ", type=" << AIspells[i].type << endl;
#endif
switch (AIspells[i].type) {
@@ -155,12 +156,12 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
&& tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0
&& !(tar->IsPet() && tar->GetOwner()->IsClient() && this != tar) //no buffing PC's pets, but they can buff themself
)
{
if(!checked_los) {
if(!CheckLosFN(tar))
return(false);
checked_los = true;
}
{
if(!checked_los) {
if(!CheckLosFN(tar))
return(false);
checked_los = true;
}
uint32 tempTime = 0;
AIDoSpellCast(i, tar, mana_cost, &tempTime);
tar->SetDontBuffMeBefore(tempTime);
@@ -172,22 +173,22 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
case SpellType_InCombatBuff: {
if(MakeRandomInt(0,100) < 50)
{
AIDoSpellCast(i, tar, mana_cost);
AIDoSpellCast(i, tar, mana_cost);
return true;
}
break;
}
case SpellType_Escape: {
if (GetHPRatio() <= 5 )
{
AIDoSpellCast(i, tar, mana_cost);
if (GetHPRatio() <= 5 )
{
AIDoSpellCast(i, tar, mana_cost);
return true;
}
break;
}
case SpellType_Slow:
case SpellType_Debuff:
case SpellType_Slow:
case SpellType_Debuff:
case SpellType_Nuke: {
if (
manaR >= 10 && MakeRandomInt(0, 99) < 70
@@ -249,7 +250,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
}
case SpellType_Pet: {
//keep mobs from recasting pets when they have them.
//keep mobs from recasting pets when they have them.
if (!IsPet() && !GetPetID() && MakeRandomInt(0, 99) < 25) {
AIDoSpellCast(i, tar, mana_cost);
return true;
@@ -257,7 +258,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
break;
}
case SpellType_Lifetap: {
if ( GetHPRatio() <= 95
if (GetHPRatio() <= 95
&& MakeRandomInt(0, 99) < 50
&& tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0
) {
@@ -273,7 +274,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
}
case SpellType_Snare: {
if (
!tar->IsRooted()
!tar->IsRooted()
&& MakeRandomInt(0, 99) < 50
&& tar->DontSnareMeBefore() < Timer::GetCurrentTime()
&& tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0
@@ -359,8 +360,8 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float
if(caster->AI_HasSpells() == false)
return false;
if(caster->SpecAttacks[NPC_NO_BUFFHEAL_FRIENDS])
return false;
if(caster->SpecAttacks[NPC_NO_BUFFHEAL_FRIENDS])
return false;
if (iChance < 100) {
uint8 tmp = MakeRandomInt(0, 99);
@@ -376,8 +377,8 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float
//Only iterate through NPCs
LinkedListIterator<NPC*> iterator(npc_list);
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {
LinkedListIterator<NPC*> iterator(npc_list);
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {
NPC* mob = iterator.GetData();
//Since >90% of mobs will always be out of range, try to
@@ -393,7 +394,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float
t2 = 0 - t2;
if(t3 < 0)
t3 = 0 - t3;
if ( t1 > iRange
if (t1 > iRange
|| t2 > iRange
|| t3 > iRange
|| mob->DistNoRoot(*caster) > iRange2
@@ -761,7 +762,7 @@ void Client::AI_Process()
bool WaypointChanged, NodeReached;
VERTEX Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z,
GetFearSpeed(), WaypointChanged, NodeReached);
GetFearSpeed(), WaypointChanged, NodeReached);
if(WaypointChanged)
tar_ndx = 20;
@@ -1004,7 +1005,7 @@ void Mob::AI_Process() {
return;
bool engaged = IsEngaged();
bool doranged = false;
bool doranged = false;
// Begin: Additions for Wiz Fear Code
//
@@ -1037,7 +1038,7 @@ void Mob::AI_Process() {
bool WaypointChanged, NodeReached;
VERTEX Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z,
GetFearSpeed(), WaypointChanged, NodeReached);
GetFearSpeed(), WaypointChanged, NodeReached);
if(WaypointChanged)
tar_ndx = 20;
@@ -1086,11 +1087,11 @@ void Mob::AI_Process() {
#ifdef BOTS
if (IsPet() && GetOwner()->IsBot() && target == GetOwner())
{
// this blocks all pet attacks against owner..bot pet test (copied above check)
RemoveFromHateList(this);
return;
}
{
// this blocks all pet attacks against owner..bot pet test (copied above check)
RemoveFromHateList(this);
return;
}
#endif //BOTS
if(DivineAura())
@@ -1112,15 +1113,15 @@ void Mob::AI_Process() {
(!RuleB(NPC, LiveLikeEnrage) ||
(RuleB(NPC, LiveLikeEnrage) &&
((IsPet() && !IsCharmed() && GetOwner() && GetOwner()->IsClient()) ||
(CastToNPC()->GetSwarmOwner() && entity_list.GetMob(CastToNPC()->GetSwarmOwner())->IsClient())))))
(CastToNPC()->GetSwarmOwner() && entity_list.GetMob(CastToNPC()->GetSwarmOwner())->IsClient())))))
{
StartEnrage();
}
bool is_combat_range = CombatRange(target);
if (is_combat_range)
{
if (is_combat_range)
{
if (AImovement_timer->Check())
{
SetRunAnimSpeed(0);
@@ -1142,18 +1143,18 @@ void Mob::AI_Process() {
//try main hand first
if(attack_timer.Check()) {
if(IsNPC()) {
int16 n_atk = CastToNPC()->GetNumberOfAttacks();
if(n_atk <= 1) {
Attack(target, 13);
} else {
for(int i = 0; i < n_atk; ++i) {
Attack(target, 13);
}
}
} else {
Attack(target, 13);
}
if(IsNPC()) {
int16 n_atk = CastToNPC()->GetNumberOfAttacks();
if(n_atk <= 1) {
Attack(target, 13);
} else {
for(int i = 0; i < n_atk; ++i) {
Attack(target, 13);
}
}
} else {
Attack(target, 13);
}
if (target)
{
@@ -1191,7 +1192,7 @@ void Mob::AI_Process() {
if (GetFlurryChance())
npc_flurry = GetFlurryChance();
if (MakeRandomInt(0, 99) < npc_flurry)
if (MakeRandomInt(0, 99) < npc_flurry)
Flurry();
}
@@ -1209,8 +1210,8 @@ void Mob::AI_Process() {
if (SpecAttacks[SPECATK_RAMPAGE])
{
//simply based off dex for now, probably a better calc
if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5))
//simply based off dex for now, probably a better calc
if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5))
Rampage();
}
@@ -1218,7 +1219,7 @@ void Mob::AI_Process() {
{
//simply based off dex for now, probably a better calc
if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5))
if(MakeRandomInt(0, 100) < ((int)(GetDEX() / ((GetLevel() * 0.760) + 10.0)) + 5))
AreaRampage();
}
}
@@ -1253,30 +1254,30 @@ void Mob::AI_Process() {
} //end is within combat range
else {
//we cannot reach our target...
//underwater stuff only works with water maps in the zone!
if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) {
Mob *tar = hate_list.GetTop(this);
if(tar == target) {
WipeHateList();
Heal();
BuffFadeAll();
AIwalking_timer->Start(100);
pLastFightingDelayMoving = Timer::GetCurrentTime();
return;
} else if(tar != nullptr) {
SetTarget(tar);
return;
}
}
}
//underwater stuff only works with water maps in the zone!
if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) {
Mob *tar = hate_list.GetTop(this);
if(tar == target) {
WipeHateList();
Heal();
BuffFadeAll();
AIwalking_timer->Start(100);
pLastFightingDelayMoving = Timer::GetCurrentTime();
return;
} else if(tar != nullptr) {
SetTarget(tar);
return;
}
}
}
// See if we can summon the mob to us
if (!HateSummon())
{
//could not summon them, check ranged...
if(SpecAttacks[SPECATK_RANGED_ATK])
doranged = true;
doranged = true;
// Now pursue
// TODO: Check here for another person on hate list with close hate value
@@ -1351,13 +1352,13 @@ void Mob::AI_Process() {
else if (AIscanarea_timer->Check())
{
/*
* This is where NPCs look around to see if they want to attack anybody.
*
* if REVERSE_AGGRO is enabled, then this timer is disabled unless they
* have the npc_aggro flag on them, and aggro against clients is checked
* by the clients.
*
*/
* This is where NPCs look around to see if they want to attack anybody.
*
* if REVERSE_AGGRO is enabled, then this timer is disabled unless they
* have the npc_aggro flag on them, and aggro against clients is checked
* by the clients.
*
*/
_ZP(Mob_AI_Process_scanarea);
Mob* tmptar = entity_list.AICheckCloseAggro(this, GetAggroRange(), GetAssistRange());
@@ -1484,15 +1485,15 @@ void Mob::AI_Process() {
}
}
}
} // else if (AImovement_timer->Check())
}
}
} // else if (AImovement_timer->Check())
}
//Do Ranged attack here
if(doranged)
{
RangedAttack(target);
}
//Do Ranged attack here
if(doranged)
{
RangedAttack(target);
}
}
void NPC::AI_DoMovement() {
@@ -1550,13 +1551,13 @@ void NPC::AI_DoMovement() {
int16 gridno = CastToNPC()->GetGrid();
if (gridno > 0 || cur_wp==-2) {
if (movetimercompleted==true) { // time to pause at wp is over
if (gridno > 0 || cur_wp==-2) {
if (movetimercompleted==true) { // time to pause at wp is over
if (wandertype == 4 && cur_wp == CastToNPC()->GetMaxWp()) {
CastToNPC()->Depop(true); //depop and resart spawn timer
CastToNPC()->Depop(true); //depop and resart spawn timer
}
else if (wandertype == 6 && cur_wp == CastToNPC()->GetMaxWp()) {
CastToNPC()->Depop(false);//depop without spawn timer
CastToNPC()->Depop(false);//depop without spawn timer
}
else {
movetimercompleted=false;
@@ -1579,7 +1580,7 @@ void NPC::AI_DoMovement() {
//kick off event_waypoint depart
char temp[16];
sprintf(temp, "%d", cur_wp);
parse->EventNPC(EVENT_WAYPOINT_DEPART, CastToNPC(), nullptr, temp, 0);
parse->EventNPC(EVENT_WAYPOINT_DEPART, CastToNPC(), nullptr, temp, 0);
//setup our next waypoint, if we are still on our normal grid
//remember that the quest event above could have done anything it wanted with our grid
@@ -1590,8 +1591,8 @@ void NPC::AI_DoMovement() {
else {
DistractedFromGrid = false;
}
}
} // endif (movetimercompleted==true)
}
} // endif (movetimercompleted==true)
else if (!(AIwalking_timer->Enabled()))
{ // currently moving
if (cur_wp_x == GetX() && cur_wp_y == GetY())
@@ -1651,50 +1652,50 @@ void NPC::AI_DoMovement() {
}
}
}
else if (IsGuarding())
{
_ZP(Mob_AI_Process_guard);
bool CP2Moved;
if(!RuleB(Pathing, Guard) || !zone->pathing)
CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp);
else
{
if(!((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)))
{
bool WaypointChanged, NodeReached;
VERTEX Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached);
if(WaypointChanged)
tar_ndx = 20;
if(NodeReached)
entity_list.OpenDoorsNear(CastToNPC());
CP2Moved = CalculateNewPosition2(Goal.x, Goal.y, Goal.z, walksp);
}
else
CP2Moved = false;
}
if (!CP2Moved)
else if (IsGuarding())
{
if(moved) {
mlog(AI__WAYPOINTS, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z);
ClearFeignMemory();
moved=false;
SetMoving(false);
if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 )
_ZP(Mob_AI_Process_guard);
bool CP2Moved;
if(!RuleB(Pathing, Guard) || !zone->pathing)
CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp);
else
{
if(!((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)))
{
SetHeading(guard_heading);
} else {
FaceTarget(GetTarget());
bool WaypointChanged, NodeReached;
VERTEX Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached);
if(WaypointChanged)
tar_ndx = 20;
if(NodeReached)
entity_list.OpenDoorsNear(CastToNPC());
CP2Moved = CalculateNewPosition2(Goal.x, Goal.y, Goal.z, walksp);
}
SendPosition();
SetAppearance(GetGuardPointAnim());
else
CP2Moved = false;
}
}
}
if (!CP2Moved)
{
if(moved) {
mlog(AI__WAYPOINTS, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z);
ClearFeignMemory();
moved=false;
SetMoving(false);
if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 )
{
SetHeading(guard_heading);
} else {
FaceTarget(GetTarget());
}
SendPosition();
SetAppearance(GetGuardPointAnim());
}
}
}
}
// Note: Mob that caused this may not get added to the hate list until after this function call completes
@@ -1703,9 +1704,9 @@ void Mob::AI_Event_Engaged(Mob* attacker, bool iYellForHelp) {
return;
if(GetAppearance() != eaStanding)
{
SetAppearance(eaStanding);
}
{
SetAppearance(eaStanding);
}
if (iYellForHelp) {
if(IsPet()) {
@@ -1729,7 +1730,7 @@ void Mob::AI_Event_Engaged(Mob* attacker, bool iYellForHelp) {
{
if(!CastToNPC()->GetCombatEvent() && GetHP() > 0)
{
parse->EventNPC(EVENT_COMBAT, CastToNPC(), attacker, "1", 0);
parse->EventNPC(EVENT_COMBAT, CastToNPC(), attacker, "1", 0);
uint16 emoteid = GetEmoteID();
if(emoteid != 0)
CastToNPC()->DoNPCEmote(ENTERCOMBAT,emoteid);
@@ -1766,7 +1767,7 @@ void Mob::AI_Event_NoLongerEngaged() {
if(entity_list.GetNPCByID(this->GetID()))
{
uint16 emoteid = CastToNPC()->GetEmoteID();
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
if(emoteid != 0)
CastToNPC()->DoNPCEmote(LEAVECOMBAT,emoteid);
CastToNPC()->SetCombatEvent(false);
@@ -1861,28 +1862,28 @@ bool NPC::AI_IdleCastCheck() {
void Mob::StartEnrage()
{
// dont continue if already enraged
if (bEnraged)
return;
if (SpecAttackTimers[SPECATK_ENRAGE] && !SpecAttackTimers[SPECATK_ENRAGE]->Check())
return;
// see if NPC has possibility to enrage
if (!SpecAttacks[SPECATK_ENRAGE])
return;
// check if timer exists (should be true at all times)
if (SpecAttackTimers[SPECATK_ENRAGE])
{
// dont continue if already enraged
if (bEnraged)
return;
if (SpecAttackTimers[SPECATK_ENRAGE] && !SpecAttackTimers[SPECATK_ENRAGE]->Check())
return;
// see if NPC has possibility to enrage
if (!SpecAttacks[SPECATK_ENRAGE])
return;
// check if timer exists (should be true at all times)
if (SpecAttackTimers[SPECATK_ENRAGE])
{
safe_delete(SpecAttackTimers[SPECATK_ENRAGE]);
SpecAttackTimers[SPECATK_ENRAGE] = nullptr;
}
SpecAttackTimers[SPECATK_ENRAGE] = nullptr;
}
if (!SpecAttackTimers[SPECATK_ENRAGE])
{
SpecAttackTimers[SPECATK_ENRAGE] = new Timer(EnragedDurationTimer);
}
// start the timer. need to call IsEnraged frequently since we dont have callback timers :-/
SpecAttackTimers[SPECATK_ENRAGE]->Start();
bEnraged = true;
if (!SpecAttackTimers[SPECATK_ENRAGE])
{
SpecAttackTimers[SPECATK_ENRAGE] = new Timer(EnragedDurationTimer);
}
// start the timer. need to call IsEnraged frequently since we dont have callback timers :-/
SpecAttackTimers[SPECATK_ENRAGE]->Start();
bEnraged = true;
entity_list.MessageClose_StringID(this, true, 200, MT_NPCEnrage, NPC_ENRAGE_START, GetCleanName());
}
@@ -1898,13 +1899,13 @@ void Mob::ProcessEnrage(){
bool Mob::IsEnraged()
{
return bEnraged;
return bEnraged;
}
bool Mob::Flurry()
{
// this is wrong, flurry is extra attacks on the current target
Mob *target = GetTarget();
// this is wrong, flurry is extra attacks on the current target
Mob *target = GetTarget();
if (target) {
if (!IsPet()) {
entity_list.MessageClose_StringID(this, true, 200, MT_NPCFlurry, NPC_FLURRY, GetCleanName(), target->GetCleanName());
@@ -1914,7 +1915,7 @@ bool Mob::Flurry()
for (int i = 0; i < RuleI(Combat, MaxFlurryHits); i++)
Attack(target);
}
return true;
return true;
}
bool Mob::AddRampage(Mob *mob)
@@ -1922,18 +1923,18 @@ bool Mob::AddRampage(Mob *mob)
if(!mob)
return false;
if (!SpecAttacks[SPECATK_RAMPAGE])
return false;
if (!SpecAttacks[SPECATK_RAMPAGE])
return false;
for (int i = 0; i < RampageArray.size(); i++)
{
// if name is already on the list dont add it again
if (strcasecmp(mob->GetName(), RampageArray[i].c_str()) == 0)
return false;
for (int i = 0; i < RampageArray.size(); i++)
{
// if name is already on the list dont add it again
if (strcasecmp(mob->GetName(), RampageArray[i].c_str()) == 0)
return false;
}
std::string r_name = mob->GetName();
RampageArray.push_back(r_name);
return true;
return true;
}
void Mob::ClearRampage(){
@@ -1948,26 +1949,26 @@ bool Mob::Rampage()
} else {
entity_list.MessageClose_StringID(this, true, 200, MT_PetFlurry, NPC_RAMPAGE, GetCleanName());
}
for (int i = 0; i < RampageArray.size(); i++)
{
for (int i = 0; i < RampageArray.size(); i++)
{
if(index_hit >= RuleI(Combat, MaxRampageTargets))
break;
// range is important
// range is important
Mob *m_target = entity_list.GetMob(RampageArray[i].c_str());
if(m_target)
{
if(m_target)
{
if(m_target == GetTarget())
continue;
if (CombatRange(m_target))
if (CombatRange(m_target))
{
Attack(m_target);
Attack(m_target);
index_hit++;
}
}
}
}
}
if(index_hit < RuleI(Combat, MaxRampageTargets))
Attack(GetTarget());
return true;
return true;
}
void Mob::AreaRampage()
@@ -1985,166 +1986,166 @@ void Mob::AreaRampage()
}
uint32 Mob::GetLevelCon(uint8 mylevel, uint8 iOtherLevel) {
int16 diff = iOtherLevel - mylevel;
int16 diff = iOtherLevel - mylevel;
uint32 conlevel=0;
if (diff == 0)
return CON_WHITE;
else if (diff >= 1 && diff <= 2)
return CON_YELLOW;
else if (diff >= 3)
return CON_RED;
if (diff == 0)
return CON_WHITE;
else if (diff >= 1 && diff <= 2)
return CON_YELLOW;
else if (diff >= 3)
return CON_RED;
if (mylevel <= 8)
{
if (diff <= -4)
conlevel = CON_GREEN;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 9)
if (mylevel <= 8)
{
if (diff <= -6)
conlevel = CON_GREEN;
else if (diff <= -4)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -4)
conlevel = CON_GREEN;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 13)
else if (mylevel <= 9)
{
if (diff <= -7)
conlevel = CON_GREEN;
else if (diff <= -5)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -6)
conlevel = CON_GREEN;
else if (diff <= -4)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 13)
{
if (diff <= -7)
conlevel = CON_GREEN;
else if (diff <= -5)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 15)
{
if (diff <= -7)
conlevel = CON_GREEN;
else if (diff <= -5)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -7)
conlevel = CON_GREEN;
else if (diff <= -5)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 17)
{
if (diff <= -8)
conlevel = CON_GREEN;
else if (diff <= -6)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -8)
conlevel = CON_GREEN;
else if (diff <= -6)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 21)
{
if (diff <= -9)
conlevel = CON_GREEN;
else if (diff <= -7)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -9)
conlevel = CON_GREEN;
else if (diff <= -7)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 25)
{
if (diff <= -10)
conlevel = CON_GREEN;
else if (diff <= -8)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -10)
conlevel = CON_GREEN;
else if (diff <= -8)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 29)
{
if (diff <= -11)
conlevel = CON_GREEN;
else if (diff <= -9)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -11)
conlevel = CON_GREEN;
else if (diff <= -9)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 31)
{
if (diff <= -12)
conlevel = CON_GREEN;
else if (diff <= -9)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -12)
conlevel = CON_GREEN;
else if (diff <= -9)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 33)
{
if (diff <= -13)
conlevel = CON_GREEN;
else if (diff <= -10)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -13)
conlevel = CON_GREEN;
else if (diff <= -10)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 37)
{
if (diff <= -14)
conlevel = CON_GREEN;
else if (diff <= -11)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -14)
conlevel = CON_GREEN;
else if (diff <= -11)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 41)
{
if (diff <= -16)
conlevel = CON_GREEN;
else if (diff <= -12)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -16)
conlevel = CON_GREEN;
else if (diff <= -12)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 45)
{
if (diff <= -17)
conlevel = CON_GREEN;
else if (diff <= -13)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -17)
conlevel = CON_GREEN;
else if (diff <= -13)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 49)
{
if (diff <= -18)
conlevel = CON_GREEN;
else if (diff <= -14)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -18)
conlevel = CON_GREEN;
else if (diff <= -14)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 53)
{
if (diff <= -19)
conlevel = CON_GREEN;
else if (diff <= -15)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -19)
conlevel = CON_GREEN;
else if (diff <= -15)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else if (mylevel <= 55)
{
if (diff <= -20)
conlevel = CON_GREEN;
else if (diff <= -15)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -20)
conlevel = CON_GREEN;
else if (diff <= -15)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
else
{
if (diff <= -21)
conlevel = CON_GREEN;
else if (diff <= -16)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
if (diff <= -21)
conlevel = CON_GREEN;
else if (diff <= -16)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
return conlevel;
}
@@ -2400,9 +2401,9 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
uint32 ZoneDatabase::GetMaxNPCSpellsID() {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT max(id) from npc_spells"), errbuf, &result)) {
safe_delete_array(query);
+12 -12
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef NPCAI_H
@@ -34,7 +34,7 @@ Seems more like a bitwise comparison client side..
*/
#define DEFAULT_AGGRORADIUS 70
#define DEFAULT_FRENYRADIUS 70
#define MAX_SHIELDRADIUS 20
#define MAX_SHIELDRADIUS 20
uint32 GetLevelCon(uint8 PlayerLevel, uint8 NPCLevel);
+23 -23
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
@@ -345,7 +345,7 @@ void Object::Close() {
{
last_user = user;
// put any remaining items from the world container back into the player's inventory to avoid item loss
// if they close the container without removing all items
// if they close the container without removing all items
ItemInst* container = this->m_inst;
if(container != nullptr)
{
@@ -447,7 +447,7 @@ void Object::RandomSpawn(bool send_packet) {
bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
{
if(m_ground_spawn){//This is a Cool Groundspawn
respawn_timer.Start();
respawn_timer.Start();
}
if (m_type == OT_DROPPEDITEM) {
bool cursordelete = false;
@@ -456,7 +456,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
// the client updates itself and takes care of sending "duplicate lore item" messages
if(sender->CheckLoreConflict(m_inst->GetItem())) {
int16 loreslot = sender->GetInv().HasItem(m_inst->GetItem()->ID, 0, invWhereBank);
if(loreslot != SLOT_INVALID) // if the duplicate is in the bank, delete it.
if(loreslot != SLOT_INVALID) // if the duplicate is in the bank, delete it.
sender->DeleteItemInInventory(loreslot);
else
cursordelete = true; // otherwise, we delete the new one
@@ -465,13 +465,13 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
char buf[10];
snprintf(buf, 9, "%u", m_inst->GetItem()->ID);
buf[9] = '\0';
parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, buf, 0);
parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, buf, 0);
// Transfer item to client
sender->PutItemInInventory(SLOT_CURSOR, *m_inst, false);
sender->SendItemPacket(SLOT_CURSOR, m_inst, ItemPacketTrade);
if(cursordelete) // delete the item if it's a duplicate lore. We have to do this because the client expects the item packet
if(cursordelete) // delete the item if it's a duplicate lore. We have to do this because the client expects the item packet
sender->DeleteItemInInventory(SLOT_CURSOR);
if(!m_ground_spawn)
@@ -491,7 +491,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
// Remove object
database.DeleteObject(m_id);
if(!m_ground_spawn)
entity_list.RemoveEntity(this->GetID());
entity_list.RemoveEntity(this->GetID());
} else {
// Tradeskill item
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObjectAction, sizeof(ClickObjectAction_Struct));
@@ -559,7 +559,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char* query = 0;
uint32 database_id = 0;
uint32 item_id = 0;
@@ -602,7 +602,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob
void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char* query = 0;
uint32 item_id = 0;
int16 charges = 0;
@@ -640,9 +640,9 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
}
Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT max_x,max_y,max_z,min_x,min_y,heading,name,item,max_allowed,respawn_timer from ground_spawns where zoneid=%i and (version=%u OR version=-1) limit 50", zone_id, version), errbuf, &result))
{
@@ -672,7 +672,7 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro
void ZoneDatabase::DeleteObject(uint32 id)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char* query = 0;
// Construct query
uint32 len_query = MakeAnyLenString(&query,
+178 -178
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
/*
New class for handeling corpses and everything associated with them.
@@ -33,7 +33,7 @@ using namespace std;
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#endif
#include "masterentity.h"
@@ -194,14 +194,14 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna
// Mongrel: added see_invis and see_invis_undead
Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime)
// vesuvias - appearence fix
: Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid//bodytype added
,in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
in_npc->GetTexture(),in_npc->GetHelmTexture(),
0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0),
corpse_decay_timer(in_decaytime),
corpse_res_timer(0),
: Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid,//bodytype added
in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
in_npc->GetTexture(),in_npc->GetHelmTexture(),
0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0),
corpse_decay_timer(in_decaytime),
corpse_res_timer(0),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(0),
loot_cooldown_timer(10)
@@ -347,15 +347,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
if(!RuleB(Character, LeaveNakedCorpses) || RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) {
// cash
// Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't.
// (change to first client that supports 'death hover' mode, if not SoF.)
if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) {
SetCash(pp->copper, pp->silver, pp->gold, pp->platinum);
pp->copper = 0;
pp->silver = 0;
pp->gold = 0;
pp->platinum = 0;
}
// Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't.
// (change to first client that supports 'death hover' mode, if not SoF.)
if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) {
SetCash(pp->copper, pp->silver, pp->gold, pp->platinum);
pp->copper = 0;
pp->silver = 0;
pp->gold = 0;
pp->platinum = 0;
}
// get their tints
memcpy(item_tint, &client->GetPP().item_tint, sizeof(item_tint));
@@ -384,52 +384,52 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
}
}
// cursor queue // (change to first client that supports 'death hover' mode, if not SoF.)
if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) {
// cursor queue // (change to first client that supports 'death hover' mode, if not SoF.)
if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) {
// bumped starting assignment to 8001 because any in-memory 'slot 8000' item was moved above as 'slot 30'
// this was mainly for client profile state reflection..should match db player inventory entries now.
// bumped starting assignment to 8001 because any in-memory 'slot 8000' item was moved above as 'slot 30'
// this was mainly for client profile state reflection..should match db player inventory entries now.
iter_queue it;
for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); it++,i++) {
item = *it;
if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent))
{
std::list<uint32> slot_list = MoveItemToCorpse(client, item, i);
removed_list.merge(slot_list);
cursor = true;
}
iter_queue it;
for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); it++,i++) {
item = *it;
if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent))
{
std::list<uint32> slot_list = MoveItemToCorpse(client, item, i);
removed_list.merge(slot_list);
cursor = true;
}
}
}
if(removed_list.size() != 0) {
std::stringstream ss("");
ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID();
ss << " AND (";
std::list<uint32>::const_iterator iter = removed_list.begin();
bool first = true;
while(iter != removed_list.end()) {
if(first) {
first = false;
} else {
ss << " OR ";
}
ss << "slotid=" << (*iter);
iter++;
}
ss << ")";
database.RunQuery(ss.str().c_str(), ss.str().length());
}
if(removed_list.size() != 0) {
std::stringstream ss("");
ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID();
ss << " AND (";
std::list<uint32>::const_iterator iter = removed_list.begin();
bool first = true;
while(iter != removed_list.end()) {
if(first) {
first = false;
} else {
ss << " OR ";
}
ss << "slotid=" << (*iter);
iter++;
}
ss << ")";
database.RunQuery(ss.str().c_str(), ss.str().length());
}
if(cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false)
while(!client->GetInv().CursorEmpty())
client->DeleteItemInInventory(SLOT_CURSOR, 0, false, false);
}
else { // only visible cursor made it to corpse (client >= Sof and RespawnFromHover = true)
std::list<ItemInst*>::const_iterator start = client->GetInv().cursor_begin();
std::list<ItemInst*>::const_iterator finish = client->GetInv().cursor_end();
database.SaveCursor(client->CharacterID(), start, finish);
}
if(cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false)
while(!client->GetInv().CursorEmpty())
client->DeleteItemInInventory(SLOT_CURSOR, 0, false, false);
}
else { // only visible cursor made it to corpse (client >= Sof and RespawnFromHover = true)
std::list<ItemInst*>::const_iterator start = client->GetInv().cursor_begin();
std::list<ItemInst*>::const_iterator finish = client->GetInv().cursor_end();
database.SaveCursor(client->CharacterID(), start, finish);
}
client->CalcBonuses(); // will only affect offline profile viewing of dead characters..unneeded overhead
client->Save();
@@ -445,17 +445,17 @@ std::list<uint32> Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16
int bagindex;
int16 interior_slot;
ItemInst *interior_item;
std::list<uint32> returnlist;
std::list<uint32> returnlist;
AddItem(item->GetItem()->ID, item->GetCharges(), equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4));
returnlist.push_back(equipslot);
returnlist.push_back(equipslot);
// Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea.
if(item->IsType(ItemClassContainer) && ((equipslot >= 22 && equipslot <=30))) // Limit the bag check to inventory and cursor slots.
// Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea.
if(item->IsType(ItemClassContainer) && ((equipslot >= 22 && equipslot <=30))) // Limit the bag check to inventory and cursor slots.
{
for(bagindex = 0; bagindex <= 9; bagindex++)
{
// For empty bags in cursor queue, slot was previously being resolved as SLOT_INVALID (-1)
// For empty bags in cursor queue, slot was previously being resolved as SLOT_INVALID (-1)
interior_slot = Inventory::CalcSlotId(equipslot, bagindex);
interior_item = client->GetInv().GetItem(interior_slot);
@@ -468,16 +468,16 @@ std::list<uint32> Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16
}
}
client->DeleteItemInInventory(equipslot, 0, true, false);
return returnlist;
return returnlist;
}
// To be called from LoadFromDBData
// Mongrel: added see_invis and see_invis_undead
Corpse::Corpse(uint32 in_dbid, uint32 in_charid, char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard)
: Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture,
0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xff,
0,0,0,0,0,0,0,0,0),
0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xff,
0,0,0,0,0,0,0,0,0),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
corpse_res_timer(RuleI(Character, CorpseResTimeMS)),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
@@ -880,7 +880,7 @@ void Corpse::AllowMobLoot(Mob *them, uint8 slot)
// @merth: this function needs some work
void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) {
// Added 12/08. Started compressing loot struct on live.
// Added 12/08. Started compressing loot struct on live.
char tmp[10];
if(p_depop) {
SendLootReqErrorPacket(client, 0);
@@ -909,7 +909,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
}
uint8 tCanLoot = 1;
bool lootcoin = false;
bool lootcoin = false;
if(database.GetVariable("LootCoin", tmp, 9)) { lootcoin = (atoi(tmp) == 1); }
if(this->BeingLootedBy != 0xFFFFFFFF && this->BeingLootedBy != client->GetID()) {
@@ -1169,7 +1169,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
strcpy(corpse_name, orgname);
snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(), EntityList::RemoveNumbers(corpse_name));
buf[87] = '\0';
parse->EventPlayer(EVENT_LOOT, client, buf, 0);
parse->EventPlayer(EVENT_LOOT, client, buf, 0);
if ((RuleB(Character, EnableDiscoveredItems)))
{
@@ -1255,7 +1255,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
//now send messages to all interested parties
//creates a link for the item
char *link = 0, *link2 = 0; //just like a db query :-)
char *link = 0, *link2 = 0; //just like a db query :-)
client->MakeItemLink(link2, inst);
MakeAnyLenString(&link, "%c" "%s" "%s" "%c",
0x12,
@@ -1338,43 +1338,43 @@ void Corpse::QueryLoot(Client* to) {
for(; cur != end; cur++) {
ServerLootItem_Struct* sitem = *cur;
if (IsPlayerCorpse()) {
if (sitem->equipSlot >= 251 && sitem->equipSlot <= 340)
sitem->lootslot = 0xFFFF;
else
x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF;
if (IsPlayerCorpse()) {
if (sitem->equipSlot >= 251 && sitem->equipSlot <= 340)
sitem->lootslot = 0xFFFF;
else
x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF;
const Item_Struct* item = database.GetItem(sitem->item_id);
const Item_Struct* item = database.GetItem(sitem->item_id);
if (item)
to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast<int16>(sitem->lootslot), sitem->equipSlot, item->Name, item->ID, sitem->charges);
else
to->Message((sitem->lootslot == 0xFFFF), "Error: 0x%04x", sitem->item_id);
if (item)
to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast<int16>(sitem->lootslot), sitem->equipSlot, item->Name, item->ID, sitem->charges);
else
to->Message((sitem->lootslot == 0xFFFF), "Error: 0x%04x", sitem->item_id);
if (sitem->lootslot != 0xFFFF)
x++;
if (sitem->lootslot != 0xFFFF)
x++;
y++;
}
else {
sitem->lootslot=y;
const Item_Struct* item = database.GetItem(sitem->item_id);
y++;
}
else {
sitem->lootslot=y;
const Item_Struct* item = database.GetItem(sitem->item_id);
if (item)
to->Message(0, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges);
else
to->Message(0, "Error: 0x%04x", sitem->item_id);
if (item)
to->Message(0, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges);
else
to->Message(0, "Error: 0x%04x", sitem->item_id);
y++;
}
y++;
}
}
if (IsPlayerCorpse()) {
to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetDBID());
}
else {
to->Message(0, "%i %s on %s.", y, y==1?"item":"items", this->GetName());
}
if (IsPlayerCorpse()) {
to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetDBID());
}
else {
to->Message(0, "%i %s on %s.", y, y==1?"item":"items", this->GetName());
}
}
bool Corpse::Summon(Client* client, bool spell, bool CheckDistance)
@@ -1448,7 +1448,7 @@ void Corpse::Spawn() {
bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256];
char* query = new char[256];
uint32 query_length = 0;
uint32 affected_rows = 0;
@@ -1456,12 +1456,12 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in DeleteGraveyard query " << errbuf << endl;
cerr << "Error1 in DeleteGraveyard query " << errbuf << endl;
return false;
}
}
if (affected_rows == 0) {
cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << endl;
cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << endl;
return false;
}
@@ -1469,13 +1469,13 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error3 in DeleteGraveyard query " << errbuf << endl;
cerr << "Error3 in DeleteGraveyard query " << errbuf << endl;
return false;
}
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << endl;
cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << endl;
return false;
}
@@ -1483,7 +1483,7 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
}
uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256];
char* query = new char[256];
char* end = query;
uint32 affected_rows = 0;
@@ -1491,13 +1491,13 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << endl;
cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << endl;
return 0;
}
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << endl;
cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << endl;
return 0;
}
@@ -1505,7 +1505,7 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
}
uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256];
char* query = new char[256];
char* end = query;
uint32 affected_rows = 0;
uint32 new_graveyard_id = 0;
@@ -1514,13 +1514,13 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &new_graveyard_id)) {
safe_delete_array(query);
cerr << "Error1 in NewGraveyardRecord query " << errbuf << endl;
cerr << "Error1 in NewGraveyardRecord query " << errbuf << endl;
return 0;
}
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << endl;
cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << endl;
return 0;
}
@@ -1533,7 +1533,7 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard
}
uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256];
char* query = new char[256];
char* end = query;
uint32 affected_rows = 0;
@@ -1542,20 +1542,20 @@ uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 in
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << endl;
cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << endl;
return 0;
}
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << endl;
cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << endl;
return 0;
}
return dbid;
}
uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading, bool rezzed) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256+(datasize*2)];
char* query = new char[256+(datasize*2)];
char* end = query;
uint32 affected_rows = 0;
@@ -1567,13 +1567,13 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
safe_delete_array(query);
cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << endl;
cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << endl;
return 0;
}
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << endl;
cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << endl;
return 0;
}
if(rezzed){
@@ -1599,10 +1599,10 @@ void ZoneDatabase::MarkCorpseAsRezzed(uint32 dbid)
uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256+(datasize*2)];
char* query = new char[256+(datasize*2)];
char* end = query;
//MYSQL_RES *result;
//MYSQL_ROW row;
//MYSQL_RES *result;
//MYSQL_ROW row;
uint32 affected_rows = 0;
uint32 last_insert_id = 0;
@@ -1612,20 +1612,20 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin
*end++ = '\'';
end += sprintf(end,", charname='%s', zoneid=%u, instanceid=%u, charid=%d, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f, timeofdeath=Now(), IsBurried=0", charname, zoneid, instanceid, charid, x, y, z, heading);
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &last_insert_id)) {
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &last_insert_id)) {
safe_delete_array(query);
cerr << "Error1 in CreatePlayerCorpse query " << errbuf << endl;
cerr << "Error1 in CreatePlayerCorpse query " << errbuf << endl;
return 0;
}
}
safe_delete_array(query);
if (affected_rows == 0) {
cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << endl;
cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << endl;
return 0;
}
if (last_insert_id == 0) {
cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << endl;
cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << endl;
return 0;
}
@@ -1634,7 +1634,7 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin
bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256+(datasize*2)];
char* query = new char[256+(datasize*2)];
char* end = query;
uint32 affected_rows = 0;
uint32 last_insert_id = 0;
@@ -1668,9 +1668,9 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch
uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint32 CorpseCount = 0;
if (RunQuery(query, MakeAnyLenString(&query, "select count(*) from player_corpses where charid = '%u' and IsBurried = 1", char_id), errbuf, &result)) {
@@ -1689,9 +1689,9 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint32 CorpseCount = 0;
if (RunQuery(query, MakeAnyLenString(&query, "select count(*) from player_corpses where charid = '%u'", char_id), errbuf, &result)) {
@@ -1710,9 +1710,9 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint32 id = 0;
if (RunQuery(query, MakeAnyLenString(&query, "select id from player_corpses where charid = '%u'", char_id), errbuf, &result)) {
@@ -1744,9 +1744,9 @@ uint32 ZoneDatabase::GetPlayerCorpseItemAt(uint32 corpse_id, uint16 slotid) {
Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
Corpse* NewCorpse = 0;
unsigned long* lengths;
@@ -1778,7 +1778,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone
}
bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid,
float dest_x, float dest_y, float dest_z, float dest_heading)
float dest_x, float dest_y, float dest_z, float dest_heading)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
@@ -1789,20 +1789,20 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui
unsigned long* lengths;
if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET zoneid = %i, instanceid = %i, x = %f, y = %f, z = %f, "
"heading = %f, IsBurried = 0, WasAtGraveyard = 0 WHERE charid = %i",
dest_zoneid, dest_instanceid, dest_x, dest_y, dest_z, dest_heading, char_id), errbuf))
"heading = %f, IsBurried = 0, WasAtGraveyard = 0 WHERE charid = %i",
dest_zoneid, dest_instanceid, dest_x, dest_y, dest_z, dest_heading, char_id), errbuf))
LogFile->write(EQEMuLog::Error, "Error moving corpses, Query = %s, Error = %s\n", query, errbuf);
safe_delete_array(query);
if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, charname, data, timeofdeath, rezzed FROM player_corpses WHERE charid='%u'"
"ORDER BY timeofdeath", char_id), errbuf, &result))
"ORDER BY timeofdeath", char_id), errbuf, &result))
{
while((row = mysql_fetch_row(result)))
{
lengths = mysql_fetch_lengths(result);
NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), char_id, row[1], (uchar*) row[2], lengths[2], dest_x, dest_y,
dest_z, dest_heading, row[3],atoi(row[4])==1, false);
dest_z, dest_heading, row[3],atoi(row[4])==1, false);
if(NewCorpse) {
entity_list.AddCorpse(NewCorpse);
NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
@@ -1825,7 +1825,7 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui
bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new_instanceid, float new_x, float new_y, float new_z, float new_heading) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = new char[256];
char* query = new char[256];
char* end = query;
uint32 affected_rows = 0;
bool Result = false;
@@ -1833,11 +1833,11 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new
end += sprintf(end, "UPDATE player_corpses SET IsBurried=0, zoneid=%u, instanceid=%u, x=%f, y=%f, z=%f, heading=%f, timeofdeath=Now(), WasAtGraveyard=0 WHERE id=%u", new_zoneid, new_instanceid, new_x, new_y, new_z, new_heading, dbid);
if (RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
if (affected_rows == 1)
if (affected_rows == 1)
Result = true;
else
cerr << "Error2 in UnburyPlayerCorpse query: affected_rows NOT EQUAL to 1, as expected." << endl;
}
}
else
cerr << "Error1 in UnburyPlayerCorpse query " << errbuf << endl;
@@ -1848,9 +1848,9 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new
Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
Corpse* NewCorpse = 0;
unsigned long* lengths;
@@ -1876,9 +1876,9 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint32 query_length = 0;
unsigned long* lengths;
@@ -1908,9 +1908,9 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint32 CorpseID = 0;
MakeAnyLenString(&query, "SELECT id FROM player_corpses WHERE charid='%u' AND IsBurried=0 ORDER BY timeofdeath LIMIT 1", char_id);
@@ -1933,7 +1933,7 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE id=%d", dbid), errbuf)) {
cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl;
@@ -1947,7 +1947,7 @@ bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE charid=%d", charid), errbuf)) {
cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << endl;
@@ -1961,7 +1961,7 @@ bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where id=%d", dbid), errbuf)) {
cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << endl;
@@ -2024,9 +2024,9 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){
if(!dbid)
return;
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) FROM player_corpses WHERE id=%d and not timeofdeath=0", dbid), errbuf, &result)) {
safe_delete_array(query);
while ((row = mysql_fetch_row(result))) {
+12 -12
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef CORPSE_H
@@ -82,7 +82,7 @@ public:
void Delete();
void Bury();
virtual void Depop();
virtual void DepopCorpse();
virtual void DepopCorpse();
uint32 GetCopper() { return copper; }
uint32 GetSilver() { return silver; }
+12 -12
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream.h>
@@ -94,7 +94,7 @@ return false;
pquest_entry Quest::Test( int NpcId, int QuestObject )
{
for( int i=0;i<m_nQuests;i++ )
if( m_pQuests[ i ].m_iNpcId == NpcId && m_pQuests[ i ].m_iQuestObject == QuestObject )
if( m_pQuests[ i ].m_iNpcId == NpcId && m_pQuests[ i ].m_iQuestObject == QuestObject )
return &m_pQuests[ i ];
return NULL;
}
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef __QUEST_H__
#define __QUEST_H__
+10 -10
View File
@@ -10,23 +10,23 @@ class NPC;
class QuestInterface {
public:
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { }
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { }
virtual void EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { }
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { }
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { }
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { }
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { }
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { }
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { }
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { }
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { }
virtual bool HasQuestSub(uint32 npcid, const char *subname) { return false; }
virtual bool HasGlobalQuestSub(const char *subname) { return false; }
virtual bool PlayerHasQuestSub(const char *subname) { return false; }
virtual bool GlobalPlayerHasQuestSub(const char *subname) { return false; }
virtual bool GlobalPlayerHasQuestSub(const char *subname) { return false; }
virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname) { return false; }
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return false; }
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return false; }
virtual void AddVar(std::string name, std::string val) { }
virtual void ReloadQuests(bool reset_timers = true) { }
virtual uint32 GetIdentifier() { return 0; }
virtual void AddVar(std::string name, std::string val) { }
virtual void ReloadQuests(bool reset_timers = true) { }
virtual uint32 GetIdentifier() { return 0; }
};
#endif
File diff suppressed because it is too large Load Diff
+26 -26
View File
@@ -16,44 +16,44 @@
class QuestParserCollection {
public:
QuestParserCollection();
~QuestParserCollection();
QuestParserCollection();
~QuestParserCollection();
void RegisterQuestInterface(QuestInterface *qi, std::string ext);
void RegisterQuestInterface(QuestInterface *qi, std::string ext);
void AddVar(std::string name, std::string val);
void ReloadQuests(bool reset_timers = true);
void AddVar(std::string name, std::string val);
void ReloadQuests(bool reset_timers = true);
bool HasQuestSub(uint32 npcid, const char *subname);
bool HasQuestSub(uint32 npcid, const char *subname);
bool PlayerHasQuestSub(const char *subname);
bool SpellHasQuestSub(uint32 spell_id, const char *subname);
bool ItemHasQuestSub(ItemInst *itm, const char *subname);
bool ItemHasQuestSub(ItemInst *itm, const char *subname);
void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
private:
QuestInterface *GetQIByNPCQuest(uint32 npcid);
QuestInterface *GetQIByNPCQuest(uint32 npcid);
QuestInterface *GetQIByGlobalNPCQuest();
QuestInterface *GetQIByPlayerQuest();
QuestInterface *GetQIByGlobalPlayerQuest();
QuestInterface *GetQIBySpellQuest(uint32 spell_id);
QuestInterface *GetQIByItemQuest(std::string item_script);
QuestInterface *GetQIByPlayerQuest();
QuestInterface *GetQIByGlobalPlayerQuest();
QuestInterface *GetQIBySpellQuest(uint32 spell_id);
QuestInterface *GetQIByItemQuest(std::string item_script);
std::map<uint32, QuestInterface*> _interfaces;
std::map<uint32, std::string> _extensions;
std::list<QuestInterface*> _load_precedence;
std::map<uint32, QuestInterface*> _interfaces;
std::map<uint32, std::string> _extensions;
std::list<QuestInterface*> _load_precedence;
//0x00 = Unloaded
//0xFFFFFFFF = Failed to Load
std::map<uint32, uint32> _npc_quest_status;
//0x00 = Unloaded
//0xFFFFFFFF = Failed to Load
std::map<uint32, uint32> _npc_quest_status;
uint32 _global_npc_quest_status;
uint32 _player_quest_status;
uint32 _global_player_quest_status;
std::map<uint32, uint32> _spell_quest_status;
std::map<std::string, uint32> _item_quest_status;
uint32 _player_quest_status;
uint32 _global_player_quest_status;
std::map<uint32, uint32> _spell_quest_status;
std::map<std::string, uint32> _item_quest_status;
};
extern QuestParserCollection *parse;
+31 -30
View File
@@ -5,13 +5,13 @@
#define GENERIC_9_STRINGS 1 //%1 %2 %3 %4 %5 %6 %7 %8 %9
#define TARGET_OUT_OF_RANGE 100 //Your target is out of range, get closer!
#define TARGET_NOT_FOUND 101 //Target player not found.
#define CANNOT_BIND 105 //You cannot form an affinity with this area. Try a city.
#define CANNOT_BIND 105 //You cannot form an affinity with this area. Try a city.
#define SPELL_DOES_NOT_WORK_HERE 106 //This spell does not work here.
#define SPELL_DOES_NOT_WORK_PLANE 107 //This spell does not work on this plane.
#define CANT_SEE_TARGET 108 //You cannot see your target.
#define MGB_STRING 113 //The next group buff you cast will hit all targets in range.
#define ABILITY_FAILED 116 //Your ability failed. Timer has been reset.
#define ESCAPE 114 //You escape from combat, hiding yourself from view.
#define ABILITY_FAILED 116 //Your ability failed. Timer has been reset.
#define ESCAPE 114 //You escape from combat, hiding yourself from view.
#define TARGET_TOO_FAR 124 //Your target is too far away, get closer!
#define PROC_TOOLOW 126 //Your will is not sufficient to command this weapon.
#define PROC_PETTOOLOW 127 //Your pet's will is not sufficient to command its weapon.
@@ -99,7 +99,7 @@
#define MEND_WORSEN 351 //You have worsened your wounds!
#define MEND_FAIL 352 //You have failed to mend your wounds.
#define LDON_SENSE_TRAP2 367 //You have not detected any traps.
#define LOOT_LORE_ERROR 371 //You cannot loot this Lore Item. You already have one.
#define LOOT_LORE_ERROR 371 //You cannot loot this Lore Item. You already have one.
#define PICK_LORE 379 //You cannot pick up a lore item you already possess.
#define CONSENT_DENIED 390 //You do not have consent to summon that corpse.
#define DISCIPLINE_RDY 393 //You are ready to use a new discipline now.
@@ -126,10 +126,10 @@
#define OTHER_HIT_NONMELEE 434 //%1 was hit by non-melee for %2 points of damage.
#define SPELL_WORN_OFF_OF 436 //Your %1 spell has worn off of %2.
#define SPELL_WORN_OFF 437 //Your %1 spell has worn off.
#define PET_TAUNTING 438 //Taunting attacker, Master.
#define PET_TAUNTING 438 //Taunting attacker, Master.
#define INTERRUPT_SPELL 439 //Your spell is interrupted.
#define LOSE_LEVEL 442 //You LOST a level! You are now level %1!
#define GAIN_ABILITY_POINT 446 //You have gained an ability point! You now have %1 ability point%2.
#define GAIN_ABILITY_POINT 446 //You have gained an ability point! You now have %1 ability point%2.
#define GAIN_LEVEL 447 //You have gained a level! Welcome to level %1!
#define LANG_SKILL_IMPROVED 449 //Your language skills have improved.
#define OTHER_LOOTED_MESSAGE 466 //--%1 has looted a %2--
@@ -139,15 +139,15 @@
#define FACTION_BEST 471 //Your faction standing with %1 could not possibly get any better.
#define FACTION_BETTER 472 //Your faction standing with %1 got better.
#define PET_REPORT_HP 488 //I have %1 percent of my hit points left.
#define PET_NO_TAUNT 489 //No longer taunting attackers, Master.
#define PET_DO_TAUNT 490 //Taunting attackers as normal, Master.
#define PET_NO_TAUNT 489 //No longer taunting attackers, Master.
#define PET_DO_TAUNT 490 //Taunting attackers as normal, Master.
#define CORPSE_DECAY1 495 //This corpse will decay in %1 minute(s) %2 seconds.
#define DISC_LEVEL_ERROR 503 //You must be a level %1 ... to use this discipline.
#define DISCIPLINE_CANUSEIN 504 //You can use a new discipline in %1 minutes %2 seconds.
#define PVP_ON 552 //You are now player kill and follow the ways of Discord.
#define GENERIC_STRINGID_SAY 554 //%1 says '%T2'
#define CANNOT_WAKE 555 //%1 tells you, 'I am unable to wake %2, master.'
#define GUILD_NAME_IN_USE 711 //You cannot create a guild with that name, that guild already exists on this server.
#define GUILD_NAME_IN_USE 711 //You cannot create a guild with that name, that guild already exists on this server.
#define GM_GAINXP 1002 //[GM] You have gained %1 AXP and %2 EXP (%3).
#define FINISHING_BLOW 1009 //%1 scores a Finishing Blow!!
#define ASSASSINATES 1016 //%1 ASSASSINATES their victim!!
@@ -169,9 +169,9 @@
#define NPC_FLURRY 1045 //%1 executes a FLURRY of attacks on %2!
#define DISCIPLINE_FEARLESS 1076 //%1 becomes fearless.
#define DUEL_FINISHED 1088 //dont know text
#define EATING_MESSAGE 1091 //Chomp, chomp, chomp... %1 takes a bite from a %2.
#define DRINKING_MESSAGE 1093 //Glug, glug, glug... %1 takes a drink from a %2.
#define SUCCESSFUL_TAUNT 1095 //I'll teach you to interfere with me %3.
#define EATING_MESSAGE 1091 //Chomp, chomp, chomp... %1 takes a bite from a %2.
#define DRINKING_MESSAGE 1093 //Glug, glug, glug... %1 takes a drink from a %2.
#define SUCCESSFUL_TAUNT 1095 //I'll teach you to interfere with me %3.
#define PET_SIT_STRING 1130 //Changing position, Master.
#define PET_CALMING 1131 //Sorry, Master..calming down.
#define PET_FOLLOWING 1132 //Following you, Master.
@@ -180,26 +180,26 @@
#define PET_GETLOST_STRING 1135 //As you wish, oh great one.
#define PET_LEADERIS 1136 //My leader is %3.
#define I_FOLLOW_NOONE 1137 //I follow no one.
#define PET_ON_HOLD 1138 //Waiting for your order to attack, Master.
#define NOT_LEGAL_TARGET 1139 //I beg forgiveness, Master. That is not a legal target.
#define PET_ON_HOLD 1138 //Waiting for your order to attack, Master.
#define NOT_LEGAL_TARGET 1139 //I beg forgiveness, Master. That is not a legal target.
#define MERCHANT_BUSY 1143 //I'm sorry, I am busy right now.
#define MERCHANT_GREETING 1144 //Welcome to my shop, %3.
#define MERCHANT_HANDY_ITEM1 1145 //Hello there, %3. How about a nice %4?
#define MERCHANT_HANDY_ITEM2 1146 //Greetings, %3. You look like you could use a %4.
#define MERCHANT_HANDY_ITEM3 1147 //Hi there %3, just browsing? Have you seen the %4 I just got in?
#define MERCHANT_HANDY_ITEM3 1147 //Hi there %3, just browsing? Have you seen the %4 I just got in?
#define MERCHANT_HANDY_ITEM4 1148 //Welcome to my shop, %3. You would probably find a %4 handy.
#define AA_POINT 1197 //point
#define AA_POINTS 1215 //points
#define SPELL_FIZZLE_OTHER 1218 //%1's spell fizzles!
#define MISSED_NOTE_OTHER 1219 //A missed note brings %1's song to a close!
#define CORPSE_DECAY_NOW 1227 //This corpse is waiting to expire.
#define SURNAME_REJECTED 1374 //Your new surname was rejected. Please try a different name.
#define SURNAME_REJECTED 1374 //Your new surname was rejected. Please try a different name.
#define DUEL_DECLINE 1383 //%1 has declined your challenge to duel to the death.
#define DUEL_ACCEPTED 1384 //%1 has already accepted a duel with someone else.
#define DUEL_CONSIDERING 1385 //%1 is considering a duel with someone else.
#define PLAYER_REGAIN 1394 //You have control of yourself again.
#define REZZ_ALREADY_PENDING 1379 //You were unable to restore the corpse to life, but you may have success with a later attempt.
#define IN_USE 1406 //Someone else is using that. Try again later.
#define IN_USE 1406 //Someone else is using that. Try again later.
#define DUEL_FLED 1408 //%1 has defeated %2 in a duel to the death! %3 has fled like a cowardly dog!
#define MEMBER_OF_YOUR_GUILD 1429
#define OFFICER_OF_YOUR_GUILD 1430
@@ -216,7 +216,7 @@
#define SUSPEND_MINION_UNSUSPEND 3267 //%1 tells you, 'I live again...'
#define SUSPEND_MINION_SUSPEND 3268 //%1 tells you, 'By your command, master.'
#define ONLY_SUMMONED_PETS 3269 //3269 This effect only works with summoned pets.
#define SUSPEND_MINION_FIGHTING 3270 //Your pet must be at peace, first.
#define SUSPEND_MINION_FIGHTING 3270 //Your pet must be at peace, first.
#define TRADESKILL_MISSING_ITEM 3455 //You are missing a %1.
#define TRADESKILL_MISSING_COMPONENTS 3456 //Sorry, but you don't have everything you need for this recipe in your general inventory.
#define TRADESKILL_LEARN_RECIPE 3457 //You have learned the recipe %1!
@@ -236,14 +236,14 @@
#define MELEE_SILENCE 5806 //You *CANNOT* use this melee ability, you are suffering from amnesia!
#define DISCIPLINE_REUSE_MSG 5807 //You can use the ability %1 again in %2 hour(s) %3 minute(s) %4 seconds.
#define DISCIPLINE_REUSE_MSG2 5808 //You can use the ability %1 again in %2 minute(s) %3 seconds.
#define FAILED_TAUNT 5811 //You have failed to taunt your target.
#define FAILED_TAUNT 5811 //You have failed to taunt your target.
#define AA_NO_TARGET 5825 //You must first select a target for this ability!
#define FORAGE_MASTERY 6012 //Your forage mastery has enabled you to find something else!
#define GUILD_BANK_CANNOT_DEPOSIT 6097 // Cannot deposit this item. Containers must be empty, and only one of each LORE and no NO TRADE or TEMPORARY items may be deposited.
#define FORAGE_MASTERY 6012 //Your forage mastery has enabled you to find something else!
#define GUILD_BANK_CANNOT_DEPOSIT 6097 // Cannot deposit this item. Containers must be empty, and only one of each LORE and no NO TRADE or TEMPORARY items may be deposited.
#define GUILD_BANK_FULL 6098 // There is no more room in the Guild Bank.
#define GUILD_BANK_TRANSFERRED 6100 // '%1' transferred to Guild Bank from Deposits.
#define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank.
#define GENERIC_STRING 6688 //%1 (used to any basic message)
#define GENERIC_STRING 6688 //%1 (used to any basic message)
#define SENTINEL_TRIG_YOU 6724 //You have triggered your sentinel.
#define SENTINEL_TRIG_OTHER 6725 //%1 has triggered your sentinel.
#define IDENTIFY_SPELL 6765 //Item Lore: %1.
@@ -279,11 +279,11 @@
#define SHAKE_OFF_STUN 9077
#define STRIKETHROUGH_STRING 9078 //You strike through your opponent's defenses!
#define SPELL_REFLECT 9082 //%1's spell has been reflected by %2.
#define NEW_SPELLS_AVAIL 9149 //You have new spells available to you. Check the merchants near your guild master.
#define PET_NOW_FOCUSING 9254 //Focusing on one target, Master.
#define PET_NOT_FOCUSING 9263 //No longer focusing on one target, Master.
#define PET_NOT_CASTING 9264 //Not casting spells, Master.
#define PET_CASTING 9291 //Casting spells normally, Master.
#define NEW_SPELLS_AVAIL 9149 //You have new spells available to you. Check the merchants near your guild master.
#define PET_NOW_FOCUSING 9254 //Focusing on one target, Master.
#define PET_NOT_FOCUSING 9263 //No longer focusing on one target, Master.
#define PET_NOT_CASTING 9264 //Not casting spells, Master.
#define PET_CASTING 9291 //Casting spells normally, Master.
#define AE_RAMPAGE 11015 //%1 goes on a WILD RAMPAGE!
#define FACE_ACCEPTED 12028 //Facial features accepted.
#define SPELL_LEVEL_TO_LOW 12048 //You will have to achieve level %1 before you can scribe the %2.
@@ -329,9 +329,9 @@
#define DIVINE_AURA_NO_ATK 12695 //You can't attack while invulnerable!
#define TRY_ATTACKING_SOMEONE 12696 //Try attacking someone other than yourself, it's more productive.
#define BACKSTAB_WEAPON 12874 //You need a piercing weapon as your primary weapon in order to backstab
#define MORE_SKILLED_THAN_I 12931 //%1 tells you, 'You are more skilled than I! What could I possibly teach you?'
#define SURNAME_EXISTS 12939 //You already have a surname. Operation failed.
#define SURNAME_LEVEL 12940 //You can only submit a surname upon reaching the 20th level. Operation failed.
#define MORE_SKILLED_THAN_I 12931 //%1 tells you, 'You are more skilled than I! What could I possibly teach you?'
#define SURNAME_EXISTS 12939 //You already have a surname. Operation failed.
#define SURNAME_LEVEL 12940 //You can only submit a surname upon reaching the 20th level. Operation failed.
#define SURNAME_TOO_LONG 12942 //Surname must be less than 20 characters in length.
#define REPORT_ONCE 12945 //You may only submit a report once per time that you zone. Thank you.
#define NOW_INVISIBLE 12950 //%1 is now Invisible.
@@ -344,3 +344,4 @@
#define GENERIC_MISS 15041 //%1 missed %2
#endif
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "ZoneConfig.h"
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef __ZoneConfig_H
#define __ZoneConfig_H
+83 -85
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <stdlib.h>
@@ -125,48 +125,48 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
t2 = 0 - t2;
if(t3 < 0)
t3 = 0 - t3;
if( ( t1 > iAggroRange)
|| ( t2 > iAggroRange)
|| ( t3 > iAggroRange) ) {
towho->Message(0, "...%s is out of range (fast). distances (%.3f,%.3f,%.3f), range %.3f", mob->GetName(),
t1, t2, t3, iAggroRange);
return;
if(( t1 > iAggroRange)
|| ( t2 > iAggroRange)
|| ( t3 > iAggroRange) ) {
towho->Message(0, "...%s is out of range (fast). distances (%.3f,%.3f,%.3f), range %.3f", mob->GetName(),
t1, t2, t3, iAggroRange);
return;
}
if(mob->IsInvisible(this)) {
towho->Message(0, "...%s is invisible to me. ", mob->GetName());
return;
towho->Message(0, "...%s is invisible to me. ", mob->GetName());
return;
}
if((mob->IsClient() &&
(!mob->CastToClient()->Connected()
|| mob->CastToClient()->IsLD()
|| mob->CastToClient()->IsBecomeNPC()
|| mob->CastToClient()->GetGM()
)
))
(!mob->CastToClient()->Connected()
|| mob->CastToClient()->IsLD()
|| mob->CastToClient()->IsBecomeNPC()
|| mob->CastToClient()->GetGM()
)
))
{
towho->Message(0, "...%s is my owner. ", mob->GetName());
return;
towho->Message(0, "...%s is my owner. ", mob->GetName());
return;
}
if(mob == GetOwner()) {
towho->Message(0, "...%s a GM or is not connected. ", mob->GetName());
return;
towho->Message(0, "...%s a GM or is not connected. ", mob->GetName());
return;
}
float dist2 = mob->DistNoRoot(*this);
float dist2 = mob->DistNoRoot(*this);
float iAggroRange2 = iAggroRange*iAggroRange;
if( dist2 > iAggroRange2 ) {
towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(),
dist2, iAggroRange2);
return;
towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(),
dist2, iAggroRange2);
return;
}
if(GetINT() > 75 && mob->GetLevelCon(GetLevel()) == CON_GREEN ) {
towho->Message(0, "...%s is red to me (basically)", mob->GetName(),
dist2, iAggroRange2);
return;
towho->Message(0, "...%s is red to me (basically)", mob->GetName(),
dist2, iAggroRange2);
return;
}
if(verbose) {
@@ -224,15 +224,15 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
||
fv == FACTION_THREATENLY
)) {
towho->Message(0, "...%s faction not low enough. value='%s'", mob->GetName(), FactionValueToString(fv));
return;
towho->Message(0, "...%s faction not low enough. value='%s'", mob->GetName(), FactionValueToString(fv));
return;
}
if(fv == FACTION_THREATENLY) {
towho->Message(0, "...%s threatening to me, so they only have a %d chance per check of attacking.", mob->GetName());
towho->Message(0, "...%s threatening to me, so they only have a %d chance per check of attacking.", mob->GetName());
}
if(!CheckLosFN(mob)) {
towho->Message(0, "...%s is out of sight.", mob->GetName());
towho->Message(0, "...%s is out of sight.", mob->GetName());
}
towho->Message(0, "...%s meets all conditions, I should be attacking them.", mob->GetName());
@@ -262,7 +262,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
// Check If it's invisible and if we can see invis
// Check if it's a client, and that the client is connected and not linkdead,
// and that the client isn't Playing an NPC, with thier gm flag on
// and that the client isn't Playing an NPC, with thier gm flag on
// Check if it's not a Interactive NPC
// Trumpcard: The 1st 3 checks are low cost calcs to filter out unnessecary distance checks. Leave them at the beginning, they are the most likely occurence.
// Image: I moved this up by itself above faction and distance checks because if one of these return true, theres no reason to go through the other information
@@ -278,17 +278,17 @@ bool Mob::CheckWillAggro(Mob *mob) {
t2 = 0 - t2;
if(t3 < 0)
t3 = 0 - t3;
if( ( t1 > iAggroRange)
|| ( t2 > iAggroRange)
|| ( t3 > iAggroRange)
||(mob->IsInvisible(this))
|| (mob->IsClient() &&
(!mob->CastToClient()->Connected()
|| mob->CastToClient()->IsLD()
|| mob->CastToClient()->IsBecomeNPC()
|| mob->CastToClient()->GetGM()
)
))
if(( t1 > iAggroRange)
|| ( t2 > iAggroRange)
|| ( t3 > iAggroRange)
||(mob->IsInvisible(this))
|| (mob->IsClient() &&
(!mob->CastToClient()->Connected()
|| mob->CastToClient()->IsLD()
|| mob->CastToClient()->IsBecomeNPC()
|| mob->CastToClient()->GetGM()
)
))
{
return(false);
}
@@ -301,7 +301,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
return(false);
}
float dist2 = mob->DistNoRoot(*this);
float dist2 = mob->DistNoRoot(*this);
float iAggroRange2 = iAggroRange*iAggroRange;
if( dist2 > iAggroRange2 ) {
@@ -354,14 +354,14 @@ bool Mob::CheckWillAggro(Mob *mob) {
#endif
return(true);
}
}
}
#if EQDEBUG >= 6
printf("Is In zone?:%d\n", mob->InZone());
printf("Dist^2: %f\n", dist2);
printf("Range^2: %f\n", iAggroRange2);
printf("Faction: %d\n", fv);
printf("Int: %d\n", GetINT());
printf("Con: %d\n", GetLevelCon(mob->GetLevel()));
printf("Is In zone?:%d\n", mob->InZone());
printf("Dist^2: %f\n", dist2);
printf("Range^2: %f\n", iAggroRange2);
printf("Faction: %d\n", fv);
printf("Int: %d\n", GetINT());
printf("Con: %d\n", GetLevelCon(mob->GetLevel()));
#endif
return(false);
}
@@ -478,7 +478,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
if(useprimfaction || sender->GetReverseFactionCon(mob) <= FACTION_AMIABLE )
{
//attacking someone on same faction, or a friend
//Father Nitwit: make sure we can see them.
//Father Nitwit: make sure we can see them.
if(mob->CheckLosFN(sender)) {
#if (EQDEBUG>=5)
LogFile->write(EQEMuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
@@ -495,7 +495,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
/*
solar: 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
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
*/
@@ -557,7 +557,7 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
// solar: 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.
// first figure out if we're pets. we always look at the master's flags.
// no need to compare pets to anything
mob1 = our_owner ? our_owner : this;
mob2 = target_owner ? target_owner : target;
@@ -706,7 +706,7 @@ type', in which case, the answer is yes.
// solar: 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
// 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
bool Mob::IsBeneficialAllowed(Mob *target)
@@ -723,7 +723,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
// solar: see IsAttackAllowed for notes
// first figure out if we're pets. we always look at the master's flags.
// first figure out if we're pets. we always look at the master's flags.
// no need to compare pets to anything
mob1 = this->GetOwnerID() ? this->GetOwner() : this;
mob2 = target->GetOwnerID() ? target->GetOwner() : target;
@@ -757,7 +757,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
}
else if(_NPC(mob2)) // client to npc
{
/* fall through and swap positions */
/* fall through and swap positions */
}
else if(_BECOMENPC(mob2)) // client to becomenpc
{
@@ -914,17 +914,17 @@ bool Mob::CheckLos(Mob* other) {
float dist_z = tmp_z - trg_z;
if (dist_z < 0)
dist_z *= -1;
if (dist_x < dist_y && dist_z < dist_y)
if (dist_x < dist_y && dist_z < dist_y)
{
perwalk_x /= (dist_y/dist_x);
perwalk_z /= (dist_y/dist_z);
}
else if (dist_y < dist_x && dist_z < dist_x)
else if (dist_y < dist_x && dist_z < dist_x)
{
perwalk_y /= (dist_x/dist_y);
perwalk_z /= (dist_x/dist_z);
}
else if (dist_x < dist_z && dist_y < dist_z)
else if (dist_x < dist_z && dist_y < dist_z)
{
perwalk_x /= (dist_z/dist_x);
perwalk_y /= (dist_z/dist_y);
@@ -1003,7 +1003,7 @@ bool Mob::CheckLos(Mob* other) {
iface++;
}
/* solar: our aggro code isn't using this right now, just spells, so i'm
taking out the +-10 check for now to make it work right on hills
taking out the +-10 check for now to make it work right on hills
if (best_z - 10 > trg_z || best_z + 10 < trg_z)
{
return false;
@@ -1074,7 +1074,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
}
}
#if LOSDEBUG>=5
else {
else {
LogFile->write(EQEMuLog::Debug, "WTF, I have no node, what am I standing on??? (%.2f, %.2f).", myloc.x, myloc.y);
}
#endif
@@ -1096,7 +1096,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
}
}
#if LOSDEBUG>=5
else if(onode == NODE_NONE) {
else if(onode == NODE_NONE) {
LogFile->write(EQEMuLog::Debug, "WTF, They have no node, what are they standing on??? (%.2f, %.2f).", myloc.x, myloc.y);
}
#endif
@@ -1365,8 +1365,8 @@ int32 Mob::CheckHealAggroAmount(uint16 spellid, uint32 heal_possible) {
break;
}
default:{
break;
}
break;
}
}
}
if (IsBardSong(spell_id))
@@ -1413,7 +1413,7 @@ void Mob::AddFeignMemory(Client* attacker) {
void Mob::RemoveFromFeignMemory(Client* attacker) {
feign_memory_list.erase(attacker->CharacterID());
if(feign_memory_list.empty() && AIfeignremember_timer != nullptr)
AIfeignremember_timer->Disable();
AIfeignremember_timer->Disable();
if(feign_memory_list.empty())
{
minLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMin);
@@ -1424,14 +1424,14 @@ void Mob::RemoveFromFeignMemory(Client* attacker) {
}
void Mob::ClearFeignMemory() {
std::set<uint32>::iterator RememberedCharID = feign_memory_list.begin();
while (RememberedCharID != feign_memory_list.end())
{
Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID);
if(remember_client != nullptr) //Still in zone
remember_client->RemoveXTarget(this, false);
++RememberedCharID;
}
std::set<uint32>::iterator RememberedCharID = feign_memory_list.begin();
while (RememberedCharID != feign_memory_list.end())
{
Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID);
if(remember_client != nullptr) //Still in zone
remember_client->RemoveXTarget(this, false);
++RememberedCharID;
}
feign_memory_list.clear();
minLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMin);
@@ -1487,5 +1487,3 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
return false;
}
+132 -131
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#if EQDEBUG >= 5
@@ -48,7 +48,7 @@ extern WorldServer worldserver;
#ifdef _WINDOWS
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#endif
extern EntityList entity_list;
@@ -171,11 +171,11 @@ bool Mob::AttackAnimation(SkillType &skillinuse, int Hand, const ItemInst* weapo
type = animDualWield;
DoAnim(type);
return true;
return true;
}
// 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.
// and does other mitigation checks. 'this' is the mob being attacked.
bool Mob::CheckHitChance(Mob* other, SkillType skillinuse, int Hand, int16 chance_mod)
{
/*/
@@ -306,10 +306,10 @@ bool Mob::CheckHitChance(Mob* other, SkillType skillinuse, int Hand, int16 chanc
//Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect
//Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim)
hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] +
attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1] +
attacker->aabonuses.Accuracy[HIGHEST_SKILL+1] +
attacker->aabonuses.Accuracy[skillinuse] +
attacker->itembonuses.HitChance) / 15.0f;
attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1] +
attacker->aabonuses.Accuracy[HIGHEST_SKILL+1] +
attacker->aabonuses.Accuracy[skillinuse] +
attacker->itembonuses.HitChance) / 15.0f;
hitBonus += chance_mod; //Modifier applied from casted/disc skill attacks.
@@ -354,13 +354,13 @@ bool Mob::CheckHitChance(Mob* other, SkillType skillinuse, int Hand, int16 chanc
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
* and does other mitigation checks. 'this' is the mob being attacked.
* and does other mitigation checks. 'this' is the mob being attacked.
*
* special return values:
* -1 - block
* -2 - parry
* -3 - riposte
* -4 - dodge
* -1 - block
* -2 - parry
* -3 - riposte
* -4 - dodge
*
*/
float skill;
@@ -390,7 +390,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
if (CanRiposte && damage > 0 && CanThisClassRiposte() && !other->BehindMob(this, other->GetX(), other->GetY()))
{
riposte_chance = (100.0f + (float)defender->aabonuses.RiposteChance + (float)defender->spellbonuses.RiposteChance + (float)defender->itembonuses.RiposteChance) / 100.0f;
skill = GetSkill(RIPOSTE);
skill = GetSkill(RIPOSTE);
if (IsClient()) {
CastToClient()->CheckIncreaseSkill(RIPOSTE, other, -10);
}
@@ -504,7 +504,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
if (damage > 0 && CanThisClassDodge() && !other->BehindMob(this, other->GetX(), other->GetY()))
{
dodge_chance = (100.0f + (float)defender->spellbonuses.DodgeChance + (float)defender->itembonuses.DodgeChance) / 100.0f;
skill = CastToClient()->GetSkill(DODGE);
skill = CastToClient()->GetSkill(DODGE);
if (IsClient()) {
CastToClient()->CheckIncreaseSkill(DODGE, other, -10);
}
@@ -674,7 +674,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit)
{
thac0 = thac0cap;
}
d -= 10.0 * (a_diff / thac0);
d -= 10.0 * (a_diff / thac0);
}
else if(mit_roll > atk_roll)
{
@@ -688,7 +688,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit)
}
d += 10 * (m_diff / thac20);
d += 10 * (m_diff / thac20);
}
if(d < 0.0)
@@ -936,7 +936,7 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate
if (hate) *hate += dmg;
}
else if(GetOwner() && GetLevel() >= RuleI(Combat, PetAttackMagicLevel)){ //pets wouldn't actually use this but...
dmg = 1; //it gives us an idea if we can hit
dmg = 1; //it gives us an idea if we can hit
}
else if(SpecAttacks[SPECATK_MAGICAL]){
dmg = 1;
@@ -1111,7 +1111,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
//SetAttackTimer();
if (
(IsCasting() && GetClass() != BARD && !IsFromSpell)
(IsCasting() && GetClass() != BARD && !IsFromSpell)
|| other == nullptr
|| ((IsClient() && CastToClient()->dead) || (other->IsClient() && other->CastToClient()->dead))
|| (GetHP() < 0)
@@ -1261,7 +1261,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
//riposte
bool slippery_attack = false; // Part of hack to allow riposte to become a miss, but still allow a Strikethrough chance (like on Live)
if (damage == -3) {
if (damage == -3) {
if (bRiposte) return false;
else {
if (Hand == 14) {// Do we even have it & was attack with mainhand? If not, don't bother with other calculations
@@ -1305,7 +1305,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
other->AddToHateList(this, hate);
///////////////////////////////////////////////////////////
////// Send Attack Damage
////// Send Attack Damage
///////////////////////////////////////////////////////////
other->Damage(this, damage, SPELL_UNKNOWN, skillinuse);
@@ -1472,7 +1472,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
GetMerc()->Suspend();
}
parse->EventPlayer(EVENT_DEATH, this, "", 0);
parse->EventPlayer(EVENT_DEATH, this, "", 0);
if (killerMob != nullptr)
{
@@ -1721,7 +1721,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_
}
}
bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell) // Kaiyodo - base function has changed prototype, need to update overloaded version
bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell) // Kaiyodo - base function has changed prototype, need to update overloaded version
{
_ZP(NPC_Attack);
int damage = 0;
@@ -1741,10 +1741,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
//Check that we can attack before we calc heading and face our target
if (!IsAttackAllowed(other)) {
if (this->GetOwnerID())
this->Say_StringID(NOT_LEGAL_TARGET);
this->Say_StringID(NOT_LEGAL_TARGET);
if(other) {
if (other->IsClient())
other->CastToClient()->RemoveXTarget(this, false);
if (other->IsClient())
other->CastToClient()->RemoveXTarget(this, false);
RemoveFromHateList(other);
mlog(COMBAT__ATTACKS, "I am not allowed to attack %s", other->GetName());
}
@@ -1766,9 +1766,9 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
//figure out what weapon they are using, if any
const Item_Struct* weapon = nullptr;
if (Hand == 13 && equipment[SLOT_PRIMARY] > 0)
weapon = database.GetItem(equipment[SLOT_PRIMARY]);
weapon = database.GetItem(equipment[SLOT_PRIMARY]);
else if (equipment[SLOT_SECONDARY])
weapon = database.GetItem(equipment[SLOT_SECONDARY]);
weapon = database.GetItem(equipment[SLOT_SECONDARY]);
//We dont factor much from the weapon into the attack.
//Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons
@@ -1864,11 +1864,11 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
//check if we're hitting above our max or below it.
if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) {
mlog(COMBAT__DAMAGE, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane));
damage = (min_dmg+eleBane);
damage = (min_dmg+eleBane);
}
if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) {
mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane));
damage = (max_dmg+eleBane);
damage = (max_dmg+eleBane);
}
damage = mod_npc_damage(damage, skillinuse, Hand, &weapon_inst, other);
@@ -1930,7 +1930,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
if(GetHP() > 0 && other->GetHP() >= DeathHP) {
other->Damage(this, damage, SPELL_UNKNOWN, skillinuse, false); // Not avoidable client already had thier chance to Avoid
} else
} else
return false;
if (HasDied()) //killed by damage shield ect
@@ -1986,10 +1986,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
}
if (damage > 0)
return true;
return true;
else
return false;
return false;
}
void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic) {
@@ -2000,7 +2000,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillType attack_ski
if(attacked_timer.Check())
{
mlog(COMBAT__HITS, "Triggering EVENT_ATTACK due to attack by %s", other->GetName());
parse->EventNPC(EVENT_ATTACK, this, other, "", 0);
parse->EventNPC(EVENT_ATTACK, this, other, "", 0);
}
attacked_timer.Start(CombatEventTimer_expire);
@@ -2164,7 +2164,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
killerMob->TrySpellOnKill(killed_level,spell);
}
/* Send the EVENT_KILLED_MERIT event and update kill tasks
* for all group members */
* for all group members */
for (int i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (kg->members[i] != nullptr && kg->members[i]->IsClient()) { // If Group Member is Client
Client *c = kg->members[i]->CastToClient();
@@ -2357,7 +2357,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
this->DoNPCEmote(ONDEATH,emoteid);
if(oos->IsNPC())
{
parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0);
parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0);
uint16 emoteid = oos->GetEmoteID();
if(emoteid != 0)
oos->CastToNPC()->DoNPCEmote(KILLEDNPC,emoteid);
@@ -2374,13 +2374,13 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski
}
void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) {
assert(other != nullptr);
if (other == this)
return;
assert(other != nullptr);
if (other == this)
return;
if(damage < 0){
hate = 1;
}
if(damage < 0){
hate = 1;
}
bool wasengaged = IsEngaged();
Mob* owner = other->GetOwner();
@@ -2417,18 +2417,18 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
if(other->SpecAttacks[IMMUNE_AGGRO_ON])
return;
if(SpecAttacks[NPC_TUNNELVISION]) {
Mob *top = GetTarget();
if(top && top != other) {
hate *= RuleR(Aggro, TunnelVisionAggroMod);
}
}
if(SpecAttacks[NPC_TUNNELVISION]) {
Mob *top = GetTarget();
if(top && top != other) {
hate *= RuleR(Aggro, TunnelVisionAggroMod);
}
}
if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(other->GetX(), other->GetY(), other->GetZ())) {
return;
}
}
if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(other->GetX(), other->GetY(), other->GetZ())) {
return;
}
}
// first add self
// The damage on the hate list is used to award XP to the killer. This check is to prevent Killstealing.
@@ -2496,7 +2496,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
}
if (!wasengaged) {
if(IsNPC() && other->IsClient() && other->CastToClient())
parse->EventNPC(EVENT_AGGRO, this->CastToNPC(), other, "", 0);
parse->EventNPC(EVENT_AGGRO, this->CastToNPC(), other, "", 0);
AI_Event_Engaged(other, iYellForHelp);
adverrorinfo = 8293;
}
@@ -2550,8 +2550,8 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
//value for spells that effect pets. Unclear as to why. For now will convert all positive to be consistent.
if (attacker->IsOffHandAtk()){
int16 mitigation = attacker->itembonuses.DSMitigationOffHand +
attacker->spellbonuses.DSMitigationOffHand +
attacker->aabonuses.DSMitigationOffHand;
attacker->spellbonuses.DSMitigationOffHand +
attacker->aabonuses.DSMitigationOffHand;
DS -= DS*mitigation/100;
}
DS -= DS * attacker->itembonuses.DSMitigation / 100;
@@ -2607,13 +2607,13 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
// Assert: This function should only be called for hits by the mainhand, as damage bonuses apply only to the
// weapon in the primary slot. Be sure to check that Hand == 13 before calling.
// weapon in the primary slot. Be sure to check that Hand == 13 before calling.
// Assert: The caller should ensure that Weapon is actually a weapon before calling this function.
// The ItemInst::IsWeapon() method can be used to quickly determine this.
// The ItemInst::IsWeapon() method can be used to quickly determine this.
// Assert: This function should not be called if the player's level is below 28, as damage bonuses do not begin
// to apply until level 28.
// to apply until level 28.
// Assert: This function should not be called unless the player is a melee class, as casters do not receive a damage bonus.
@@ -2679,9 +2679,9 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
if( ucPlayerLevel == 65 && Weapon->Delay <= 59 )
{
// Consider these two facts:
// * Level 65 is the maximum level on many EQ Emu servers.
// * If you listed the levels of all characters logged on to a server, odds are that the number you'll
// see most frequently is level 65. That is, there are more level 65 toons than any other single level.
// * Level 65 is the maximum level on many EQ Emu servers.
// * If you listed the levels of all characters logged on to a server, odds are that the number you'll
// see most frequently is level 65. That is, there are more level 65 toons than any other single level.
//
// Therefore, if we can optimize this function for level 65 toons, we're speeding up the server!
//
@@ -2907,7 +2907,7 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
}
else
{
static const uint8 ucDelay46Levels28to52[] = {6, 6, 7, 8, 8, 8, 9, 10, 10, 11, 11, 11, 13, 13, 13, 14, 14, 15, 16, 16, 16, 17, 18, 20, 22};
static const uint8 ucDelay46Levels28to52[] = {6, 6, 7, 8, 8, 8, 9, 10, 10, 11, 11, 11, 13, 13, 13, 14, 14, 15, 16, 16, 16, 17, 18, 20, 22};
return ucDelay46Levels28to52[ucPlayerLevel-28] + ((Weapon->Delay-46) / 3);
}
@@ -3019,11 +3019,11 @@ int Mob::GetMonkHandToHandDamage(void)
// Kaiyodo - Determine a monk's fist damage. Table data from www.monkly-business.com
// saved as static array - this should speed this function up considerably
static int damage[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11,
12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,
14,14,15,15,15,15 };
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11,
12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,
14,14,15,15,15,15 };
// Have a look to see if we have epic fists on
@@ -3032,10 +3032,10 @@ int Mob::GetMonkHandToHandDamage(void)
else
{
int Level = GetLevel();
if (Level > 65)
return(19);
else
return damage[Level];
if (Level > 65)
return(19);
else
return damage[Level];
}
}
@@ -3045,16 +3045,16 @@ int Mob::GetMonkHandToHandDelay(void)
// saved as static array - this should speed this function up considerably
static int delayshuman[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,33,33,33,33,33,
32,32,32,32,32,31,31,31,31,31,30,30,30,29,29,29,28,28,28,27,
26,24,22,20,20,20 };
99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,33,33,33,33,33,
32,32,32,32,32,31,31,31,31,31,30,30,30,29,29,29,28,28,28,27,
26,24,22,20,20,20 };
static int delaysiksar[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,
33,33,33,33,33,32,32,32,32,32,31,31,31,30,30,30,29,29,29,28,
27,24,22,20,20,20 };
99,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,35,35,35,35,35,34,34,34,34,34,
33,33,33,33,33,32,32,32,32,32,31,31,31,30,30,30,29,29,29,28,
27,24,22,20,20,20 };
// Have a look to see if we have epic fists on
if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652)
@@ -3064,17 +3064,17 @@ int Mob::GetMonkHandToHandDelay(void)
int Level = GetLevel();
if (GetRace() == HUMAN)
{
if (Level > 65)
return(24);
else
return delayshuman[Level];
if (Level > 65)
return(24);
else
return delayshuman[Level];
}
else //heko: iksar table
{
if (Level > 65)
return(25);
else
return delaysiksar[Level];
if (Level > 65)
return(25);
else
return delaysiksar[Level];
}
}
}
@@ -3218,34 +3218,34 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
bool Mob::HasProcs() const
{
for (int i = 0; i < MAX_PROCS; i++)
if (PermaProcs[i].spellID != SPELL_UNKNOWN || SpellProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
for (int i = 0; i < MAX_PROCS; i++)
if (PermaProcs[i].spellID != SPELL_UNKNOWN || SpellProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
}
bool Mob::HasDefensiveProcs() const
{
for (int i = 0; i < MAX_PROCS; i++)
if (DefensiveProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
if (DefensiveProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
}
bool Mob::HasSkillProcs() const
{
for (int i = 0; i < MAX_PROCS; i++)
if (SkillProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
if (SkillProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
}
bool Mob::HasRangedProcs() const
{
for (int i = 0; i < MAX_PROCS; i++)
if (RangedProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
if (RangedProcs[i].spellID != SPELL_UNKNOWN)
return true;
return false;
}
bool Client::CheckDoubleAttack(bool tripleAttack) {
@@ -3300,8 +3300,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
if( spell_id != SPELL_UNKNOWN || attacker == nullptr )
avoidable = false;
// only apply DS if physical damage (no spell damage)
// damage shield calls this function with spell_id set, so its unavoidable
// only apply DS if physical damage (no spell damage)
// damage shield calls this function with spell_id set, so its unavoidable
if (attacker && damage > 0 && spell_id == SPELL_UNKNOWN && skill_used != ARCHERY && skill_used != THROWING) {
DamageShield(attacker);
@@ -3372,7 +3372,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
if(attacker->CastToClient()->GetFilter(FilterDamageShields) != FilterHide)
attacker->Message(15, "The Spellshield absorbed %d of %d points of damage", origdmg - damage, origdmg);
}
if (damage == 0 && attacker && origdmg != damage && IsClient()) {
if (damage == 0 && attacker && origdmg != damage && IsClient()) {
//Kayen: Probably need to add a filter for this - Not sure if this msg is correct but there should be a message for spell negate/runes.
Message(263, "%s tries to cast on you, but YOUR magical skin absorbs the spell.",attacker->GetCleanName());
}
@@ -3433,13 +3433,13 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
TryDeathSave();
}
//fade mez if we are mezzed
//fade mez if we are mezzed
if (IsMezzed()) {
mlog(COMBAT__HITS, "Breaking mez due to attack.");
BuffFadeByEffect(SE_Mez);
}
//check stun chances if bashing
//check stun chances if bashing
if (damage > 0 && ((skill_used == BASH || skill_used == KICK) && attacker))
{
// NPCs can stun with their bash/kick as soon as they recieve it.
@@ -3485,8 +3485,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
//see if root will break
if (IsRooted() && !FromDamageShield) { // neotoyko: only spells cancel root
/*Dev Quote 2010: http://forums.station.sony.com/eq/posts/list.m?topic_id=161443
The Viscid Roots AA does the following: Reduces the chance for root to break by X percent.
/*Dev Quote 2010: http://forums.station.sony.com/eq/posts/list.m?topic_id=161443
The Viscid Roots AA does the following: Reduces the chance for root to break by X percent.
There is no distinction of any kind between the caster inflicted damage, or anyone
else's damage. There is also no distinction between Direct and DOT damage in the root code.
There is however, a provision that if the damage inflicted is greater than 500 per hit, the
@@ -3521,8 +3521,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
SendHPUpdate();
} //end `if damage was done`
//send damage packet...
if(!iBuffTic) { //buff ticks do not send damage, instead they just call SendHPUpdate(), which is done below
//send damage packet...
if(!iBuffTic) { //buff ticks do not send damage, instead they just call SendHPUpdate(), which is done below
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct));
CombatDamage_Struct* a = (CombatDamage_Struct*)outapp->pBuffer;
a->target = GetID();
@@ -3551,8 +3551,8 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
//special crap for spell damage, looks hackish to me
char val1[20]={0};
owner->Message_StringID(MT_NonMelee,OTHER_HIT_NONMELEE,GetCleanName(),ConvertArray(damage,val1));
} else {
if(damage > 0) {
} else {
if(damage > 0) {
if(spell_id != SPELL_UNKNOWN)
filter = iBuffTic ? FilterDOT : FilterSpellDamage;
else
@@ -3583,9 +3583,9 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
}
}
else
entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee,HIT_NON_MELEE,attacker->GetCleanName(),GetCleanName(),ConvertArray(damage,val1));
} else {
if(damage > 0) {
entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee,HIT_NON_MELEE,attacker->GetCleanName(),GetCleanName(),ConvertArray(damage,val1));
} else {
if(damage > 0) {
if(spell_id != SPELL_UNKNOWN)
filter = iBuffTic ? FilterDOT : FilterSpellDamage;
else
@@ -3628,7 +3628,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
safe_delete(outapp);
} else {
//else, it is a buff tic...
//else, it is a buff tic...
// Everhood - So we can see our dot dmg like live shows it.
if(spell_id != SPELL_UNKNOWN && damage > 0 && attacker && attacker != this && attacker->IsClient()) {
//might filter on (attack_skill>200 && attack_skill<250), but I dont think we need it
@@ -3833,7 +3833,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) {
_ZP(Mob_TryWeaponProcA);
if(!on) {
SetTarget(nullptr);
LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
return;
}
@@ -4037,7 +4037,7 @@ void Mob::TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage)
{
critMod += GetCritDmgMob(skill) * 2; // To account for base crit mod being 200 not 100
damage = (damage * critMod) / 100;
entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, CRITICAL_HIT, GetCleanName(), itoa(damage));
entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, CRITICAL_HIT, GetCleanName(), itoa(damage));
}
}
}
@@ -4190,7 +4190,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillType skillinuse)
}
else
{
mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel());
mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel());
return false;
}
}
@@ -4207,8 +4207,8 @@ void Mob::DoRiposte(Mob* defender) {
if (HasDied()) return;
int16 DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[0] +
defender->spellbonuses.GiveDoubleRiposte[0] +
defender->itembonuses.GiveDoubleRiposte[0];
defender->spellbonuses.GiveDoubleRiposte[0] +
defender->itembonuses.GiveDoubleRiposte[0];
//Live AA - Double Riposte
if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) {
@@ -4383,3 +4383,4 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type)
return damage;
}
}
+43 -43
View File
@@ -25,7 +25,7 @@ char com_list[512];
int calc(char * stuff) {
int result = 0;
int i = 0;
int a = 0;
int a = 0;
static char temp[100];
int op = 0;
memset(temp,0x0,100);
@@ -105,15 +105,15 @@ int GetArgs(char * string)
char temp[255];
char c_name[255];
int params = 0;
//char *buffer = new char[512]; // this is never deleted, causes zone to crash
char *buffer = com_list;
memset(temp,0x0,255);
//memset(buffer,0x0,512);
//#ifdef WIN32
//strcpy(buffer,com_list);
//#else
//strncpy(buffer,com_list,sizeof(buffer)-1);
//#endif
//char *buffer = new char[512]; // this is never deleted, causes zone to crash
char *buffer = com_list;
memset(temp,0x0,255);
//memset(buffer,0x0,512);
//#ifdef WIN32
//strcpy(buffer,com_list);
//#else
//strncpy(buffer,com_list,sizeof(buffer)-1);
//#endif
int i=0;
while (*buffer)
{
@@ -136,39 +136,39 @@ int GetArgs(char * string)
}
return 0;
#else
if (strstr(string,"if")) { return 0; }
if (strstr(string,"sfollow")) { return 0; }
if (strstr(string,"save")) { return 0; }
if (strstr(string,"while")) { return 0; }
if (strstr(string,"break")) { return 1; }
if (strstr(string,"follow")) { return 1; }
if (strstr(string,"setallskill")) { return 1; }
if (strstr(string,"me")) { return 1; }
if (strstr(string,"flagcheck")) { return 1; }
if (strstr(string,"echo")) { return 1; }
if (strstr(string,"summonitem")) { return 1; }
if (strstr(string,"say")) { return 1; }
if (strstr(string,"emote")) { return 1; }
if (strstr(string,"shout")) { return 1; }
if (strstr(string,"depop")) { return 1; }
if (strstr(string,"cumflag")) { return 1; }
if (strstr(string,"exp")) { return 1; }
if (strstr(string,"level")) { return 1; }
if (strstr(string,"safemove")) { return 1; }
if (strstr(string,"rain")) { return 1; }
if (strstr(string,"snow")) { return 1; }
if (strstr(string,"pvp")) { return 1; }
if (strstr(string,"doanim")) { return 1; }
if (strstr(string,"dbspawnadd")) { return 2; }
if (strstr(string,"castspell")) { return 2; }
if (strstr(string,"flagcheck")) { return 2; }
if (strstr(string,"addskill")) { return 2; }
if (strstr(string,"write")) { return 2; }
if (strstr(string,"settarget")) { return 2; }
if (strstr(string,"givecash")) { return 4; }
if (strstr(string,"movepc")) { return 4; }
if (strstr(string,"spawn")) { return 6; }
return 0;
if (strstr(string,"if")) { return 0; }
if (strstr(string,"sfollow")) { return 0; }
if (strstr(string,"save")) { return 0; }
if (strstr(string,"while")) { return 0; }
if (strstr(string,"break")) { return 1; }
if (strstr(string,"follow")) { return 1; }
if (strstr(string,"setallskill")) { return 1; }
if (strstr(string,"me")) { return 1; }
if (strstr(string,"flagcheck")) { return 1; }
if (strstr(string,"echo")) { return 1; }
if (strstr(string,"summonitem")) { return 1; }
if (strstr(string,"say")) { return 1; }
if (strstr(string,"emote")) { return 1; }
if (strstr(string,"shout")) { return 1; }
if (strstr(string,"depop")) { return 1; }
if (strstr(string,"cumflag")) { return 1; }
if (strstr(string,"exp")) { return 1; }
if (strstr(string,"level")) { return 1; }
if (strstr(string,"safemove")) { return 1; }
if (strstr(string,"rain")) { return 1; }
if (strstr(string,"snow")) { return 1; }
if (strstr(string,"pvp")) { return 1; }
if (strstr(string,"doanim")) { return 1; }
if (strstr(string,"dbspawnadd")) { return 2; }
if (strstr(string,"castspell")) { return 2; }
if (strstr(string,"flagcheck")) { return 2; }
if (strstr(string,"addskill")) { return 2; }
if (strstr(string,"write")) { return 2; }
if (strstr(string,"settarget")) { return 2; }
if (strstr(string,"givecash")) { return 4; }
if (strstr(string,"movepc")) { return 4; }
if (strstr(string,"spawn")) { return 6; }
return 0;
#endif // 0
}
+13 -13
View File
@@ -1,24 +1,24 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
/*
solar: Beacon class, extends Mob. Used for AE rain spells to have a mob
solar: Beacon class, extends Mob. Used for AE rain spells to have a mob
target to center around.
*/
@@ -30,7 +30,7 @@ target to center around.
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#endif
#include "masterentity.h"
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef BEACON_H
+63 -62
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/spdat.h"
@@ -532,10 +532,10 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu
void Client::CalcEdibleBonuses(StatBonuses* newbon) {
#if EQDEBUG >= 11
cout<<"Client::CalcEdibleBonuses(StatBonuses* newbon)"<<endl;
cout<<"Client::CalcEdibleBonuses(StatBonuses* newbon)"<<endl;
#endif
// Search player slots for skill=14(food) and skill=15(drink)
uint32 i;
// Search player slots for skill=14(food) and skill=15(drink)
uint32 i;
bool food = false;
bool drink = false;
@@ -835,12 +835,12 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
case SE_ConsumeProjectile:
newbon->ConsumeProjectile += base1;
break;
case SE_ForageAdditionalItems:
newbon->ForageAdditionalItems += base1;
break;
case SE_Salvage:
newbon->SalvageChance += base1;
break;
case SE_ForageAdditionalItems:
newbon->ForageAdditionalItems += base1;
break;
case SE_Salvage:
newbon->SalvageChance += base1;
break;
case SE_ArcheryDamageModifier:
newbon->ArcheryDamageModifier += base1;
break;
@@ -952,7 +952,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
{
if(!newbon->SpellOnKill[i] || ((newbon->SpellOnKill[i] == base2) && (newbon->SpellOnKill[i+1] < base1)))
{
//base1 = chance, base2 = SpellID to be triggered, base3 = min npc level
//base1 = chance, base2 = SpellID to be triggered, base3 = min npc level
newbon->SpellOnKill[i] = base2;
newbon->SpellOnKill[i+1] = base1;
@@ -1275,7 +1275,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
break;
}
case SE_AttackSpeed2:
case SE_AttackSpeed2:
{
if ((effect_value - 100) > 0) { // Haste V2 - Stacks with V1 but does not Overcap
if ((effect_value - 100) > newbon->hastetype2) {
@@ -1283,17 +1283,17 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
}
}
break;
}
}
case SE_AttackSpeed3:
{
case SE_AttackSpeed3:
{
if (effect_value > 0) { // Haste V3 - Stacks and Overcaps
if (effect_value > newbon->hastetype3) {
newbon->hastetype3 = effect_value;
}
}
break;
}
}
case SE_AttackSpeed4:
{
@@ -1598,10 +1598,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
if (RuleB(Spells, AdditiveBonusValues) && item_bonus)
newbon->AvoidMeleeChance += effect_value;
else if((effect_value < 0) && (newbon->AvoidMeleeChance > effect_value))
else if((effect_value < 0) && (newbon->AvoidMeleeChance > effect_value))
newbon->AvoidMeleeChance = effect_value;
else if(newbon->AvoidMeleeChance < effect_value)
else if(newbon->AvoidMeleeChance < effect_value)
newbon->AvoidMeleeChance = effect_value;
break;
}
@@ -1625,7 +1625,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->DodgeChance += effect_value;
else if((effect_value < 0) && (newbon->DodgeChance > effect_value))
newbon->DodgeChance = effect_value;
newbon->DodgeChance = effect_value;
if(newbon->DodgeChance < effect_value)
newbon->DodgeChance = effect_value;
@@ -1638,7 +1638,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->ParryChance += effect_value;
else if((effect_value < 0) && (newbon->ParryChance > effect_value))
newbon->ParryChance = effect_value;
newbon->ParryChance = effect_value;
if(newbon->ParryChance < effect_value)
newbon->ParryChance = effect_value;
@@ -1651,7 +1651,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->DualWieldChance += effect_value;
else if((effect_value < 0) && (newbon->DualWieldChance > effect_value))
newbon->DualWieldChance = effect_value;
newbon->DualWieldChance = effect_value;
if(newbon->DualWieldChance < effect_value)
newbon->DualWieldChance = effect_value;
@@ -1665,7 +1665,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->DoubleAttackChance += effect_value;
else if((effect_value < 0) && (newbon->DoubleAttackChance > effect_value))
newbon->DoubleAttackChance = effect_value;
newbon->DoubleAttackChance = effect_value;
if(newbon->DoubleAttackChance < effect_value)
newbon->DoubleAttackChance = effect_value;
@@ -1676,9 +1676,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
{
if (RuleB(Spells, AdditiveBonusValues) && item_bonus)
newbon->TripleAttackChance += effect_value;
newbon->TripleAttackChance += effect_value;
else if((effect_value < 0) && (newbon->TripleAttackChance > effect_value))
else if((effect_value < 0) && (newbon->TripleAttackChance > effect_value))
newbon->TripleAttackChance = effect_value;
if(newbon->TripleAttackChance < effect_value)
@@ -1691,7 +1691,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
if (RuleB(Spells, AdditiveBonusValues) && item_bonus)
newbon->MeleeLifetap += spells[spell_id].base[i];
else if((effect_value < 0) && (newbon->MeleeLifetap > effect_value))
else if((effect_value < 0) && (newbon->MeleeLifetap > effect_value))
newbon->MeleeLifetap = spells[spell_id].base[i];
if(newbon->MeleeLifetap < spells[spell_id].base[i])
@@ -1731,8 +1731,8 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->Fearless = true;
break;
case SE_HundredHands:
{
case SE_HundredHands:
{
if (RuleB(Spells, AdditiveBonusValues) && item_bonus)
newbon->HundredHands += spells[spell_id].base[i];
@@ -1741,7 +1741,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
else if (effect_value < 0 && effect_value < newbon->HundredHands)
newbon->HundredHands = effect_value; //Decrease Weapon Delay
break;
}
}
case SE_MeleeSkillCheck:
{
@@ -1820,7 +1820,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->ProcChance += effect_value;
else if((effect_value < 0) && (newbon->DoubleAttackChance > effect_value))
newbon->ProcChance = effect_value;
newbon->ProcChance = effect_value;
if(newbon->ProcChance < effect_value)
newbon->ProcChance = effect_value;
@@ -2198,13 +2198,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->ConsumeProjectile += effect_value;
break;
case SE_ForageAdditionalItems:
newbon->ForageAdditionalItems += effect_value;
break;
case SE_ForageAdditionalItems:
newbon->ForageAdditionalItems += effect_value;
break;
case SE_Salvage:
newbon->SalvageChance += effect_value;
break;
case SE_Salvage:
newbon->SalvageChance += effect_value;
break;
case SE_ArcheryDamageModifier:
newbon->ArcheryDamageModifier += effect_value;
@@ -2443,9 +2443,9 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y, bool login)
uint16 oldexp = e_inst->GetExp();
if(login) {
parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0);
}
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0);
parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0);
}
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0);
if (e_inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
e_inst->ScaleItem();
@@ -2466,10 +2466,10 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y, bool login)
EvoItemInst* e_inst = (EvoItemInst*)a_inst;
uint16 oldexp = e_inst->GetExp();
if(login) {
parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0);
}
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0);
if(login) {
parse->EventItem(EVENT_ITEM_ENTERZONE, this, e_inst, e_inst->GetID(), 0);
}
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, e_inst->GetID(), 0);
if (e_inst->GetExp() != oldexp)
{
@@ -3345,17 +3345,17 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
itembonuses.ConsumeProjectile = effect_value;
break;
case SE_ForageAdditionalItems:
spellbonuses.ForageAdditionalItems = effect_value;
aabonuses.ForageAdditionalItems = effect_value;
itembonuses.ForageAdditionalItems = effect_value;
break;
case SE_ForageAdditionalItems:
spellbonuses.ForageAdditionalItems = effect_value;
aabonuses.ForageAdditionalItems = effect_value;
itembonuses.ForageAdditionalItems = effect_value;
break;
case SE_Salvage:
spellbonuses.SalvageChance = effect_value;
aabonuses.SalvageChance = effect_value;
itembonuses.SalvageChance = effect_value;
break;
case SE_Salvage:
spellbonuses.SalvageChance = effect_value;
aabonuses.SalvageChance = effect_value;
itembonuses.SalvageChance = effect_value;
break;
case SE_ArcheryDamageModifier:
spellbonuses.ArcheryDamageModifier = effect_value;
@@ -3500,3 +3500,4 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
}
}
}
+156 -156
View File
@@ -1288,7 +1288,7 @@ void Bot::GenerateArmorClass()
uint16 Bot::GetPrimarySkillValue()
{
SkillType skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill
SkillType skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill
bool equiped = m_inv.GetItem(SLOT_PRIMARY);
if(!equiped)
@@ -1297,7 +1297,7 @@ uint16 Bot::GetPrimarySkillValue()
}
else
{
uint8 type = m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType; //is this the best way to do this?
uint8 type = m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType; //is this the best way to do this?
switch(type)
{
case ItemType1HS: // 1H Slashing
@@ -1471,7 +1471,7 @@ void Bot::LoadAAs() {
MYSQL_RES* DatasetResult;
MYSQL_ROW DataRow;
int maxAAExpansion = RuleI(Bots, BotAAExpansion); //get expansion to get AAs up to
int maxAAExpansion = RuleI(Bots, BotAAExpansion); //get expansion to get AAs up to
botAAs.clear(); //start fresh
if(GetClass() == BERSERKER)
@@ -1502,7 +1502,7 @@ void Bot::LoadAAs() {
//Get level required for AA
if(RequiredLevel != AARequiredLevelAndCost.end())
req_level = RequiredLevel->second.Level;
req_level = RequiredLevel->second.Level;
else
req_level = (sendAA->class_type + i * sendAA->level_inc);
@@ -1903,7 +1903,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
{
if(!newbon->SpellOnKill[i] || ((newbon->SpellOnKill[i] == base2) && (newbon->SpellOnKill[i+1] < base1)))
{
//base1 = chance, base2 = SpellID to be triggered, base3 = min npc level
//base1 = chance, base2 = SpellID to be triggered, base3 = min npc level
newbon->SpellOnKill[i] = base2;
newbon->SpellOnKill[i+1] = base1;
@@ -2473,17 +2473,17 @@ void Bot::SaveBuffs() {
IsPersistent = 0;
if(!database.RunQuery(Query, MakeAnyLenString(&Query, "INSERT INTO botbuffs (BotId, SpellId, CasterLevel, DurationFormula, "
"TicsRemaining, PoisonCounters, DiseaseCounters, CurseCounters, CorruptionCounters, HitCount, MeleeRune, MagicRune, "
"DeathSaveSuccessChance, CasterAARank, Persistent) VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u);",
GetBotID(), buffs[BuffCount].spellid, buffs[BuffCount].casterlevel, spells[buffs[BuffCount].spellid].buffdurationformula,
buffs[BuffCount].ticsremaining,
CalculatePoisonCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
CalculateCurseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
buffs[BuffCount].numhits, buffs[BuffCount].melee_rune, buffs[BuffCount].magic_rune,
buffs[BuffCount].deathSaveSuccessChance,
buffs[BuffCount].deathsaveCasterAARank, IsPersistent), TempErrorMessageBuffer)) {
"TicsRemaining, PoisonCounters, DiseaseCounters, CurseCounters, CorruptionCounters, HitCount, MeleeRune, MagicRune, "
"DeathSaveSuccessChance, CasterAARank, Persistent) VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u);",
GetBotID(), buffs[BuffCount].spellid, buffs[BuffCount].casterlevel, spells[buffs[BuffCount].spellid].buffdurationformula,
buffs[BuffCount].ticsremaining,
CalculatePoisonCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
CalculateCurseCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0 ? buffs[BuffCount].counters : 0,
buffs[BuffCount].numhits, buffs[BuffCount].melee_rune, buffs[BuffCount].magic_rune,
buffs[BuffCount].deathSaveSuccessChance,
buffs[BuffCount].deathsaveCasterAARank, IsPersistent), TempErrorMessageBuffer)) {
errorMessage = std::string(TempErrorMessageBuffer);
safe_delete(Query);
Query = 0;
@@ -2527,15 +2527,15 @@ void Bot::LoadBuffs() {
buffs[BuffCount].casterlevel = atoi(DataRow[1]);
buffs[BuffCount].ticsremaining = atoi(DataRow[3]);
if(CalculatePoisonCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[4]);
} else if(CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[5]);
} else if(CalculateCurseCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[6]);
} else if(CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[7]);
}
if(CalculatePoisonCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[4]);
} else if(CalculateDiseaseCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[5]);
} else if(CalculateCurseCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[6]);
} else if(CalculateCorruptionCounters(buffs[BuffCount].spellid) > 0) {
buffs[BuffCount].counters = atoi(DataRow[7]);
}
buffs[BuffCount].numhits = atoi(DataRow[8]);
buffs[BuffCount].melee_rune = atoi(DataRow[9]);
buffs[BuffCount].magic_rune = atoi(DataRow[10]);
@@ -3340,7 +3340,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillType skil
}
}
if (damage == -3) {
if (damage == -3) {
DoRiposte(other);
if (HasDied())
return;
@@ -3591,7 +3591,7 @@ void Bot::AI_Process() {
for(int counter = 0; counter < g->GroupCount(); counter++) {
if(g->members[counter]) {
Mob* tar = g->members[counter]->GetTarget();
if(tar && tar->IsNPC() && tar->GetHateAmount(g->members[counter]) && IsAttackAllowed(g->members[counter]->GetTarget())) {
if(tar && tar->IsNPC() && tar->GetHateAmount(g->members[counter]) && IsAttackAllowed(g->members[counter]->GetTarget())) {
AddToHateList(tar, 1);
if(HasPet())
@@ -6185,7 +6185,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
item2 = database.GetItem(items[y]);
if(item2) {
if(botCanWear[y]) {
Say("Thank you for the %s, %s.", item2->Name, client->GetName());
Say("Thank you for the %s, %s.", item2->Name, client->GetName());
}
else {
Say("I can't use this %s!", item2->Name);
@@ -6565,7 +6565,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
//riposte
bool slippery_attack = false; // Part of hack to allow riposte to become a miss, but still allow a Strikethrough chance (like on Live)
if (damage == -3) {
if (damage == -3) {
if (FromRiposte) return false;
else {
if (Hand == SLOT_SECONDARY) {// Do we even have it & was attack with mainhand? If not, don't bother with other calculations
@@ -6609,7 +6609,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
}
///////////////////////////////////////////////////////////
////// Send Attack Damage
////// Send Attack Damage
///////////////////////////////////////////////////////////
other->Damage(this, damage, SPELL_UNKNOWN, skillinuse);
@@ -7218,8 +7218,8 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) {
int buff_tracker = -1;
int buff_slot = 0;
uint16 focusspellid = 0;
uint16 focusspell_tracker = 0;
uint16 focusspellid = 0;
uint16 focusspell_tracker = 0;
uint32 buff_max = GetMaxTotalSlots();
for (buff_slot = 0; buff_slot < buff_max; buff_slot++) {
focusspellid = buffs[buff_slot].spellid;
@@ -7419,7 +7419,7 @@ int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
return 0;
break;
default:
LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]);
LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]);
}
break;
@@ -7751,7 +7751,7 @@ int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
//this spits up a lot of garbage when calculating spell focuses
//since they have all kinds of extra effects on them.
default:
LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]);
LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]);
#endif
}
}
@@ -7811,13 +7811,13 @@ float Bot::GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_spe
bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
{
/* solar: 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.
* and does other mitigation checks. 'this' is the mob being attacked.
*
* special return values:
* -1 - block
* -2 - parry
* -3 - riposte
* -4 - dodge
* -1 - block
* -2 - parry
* -3 - riposte
* -4 - dodge
*
*/
if(GetAppearance() == eaDead)
@@ -7850,7 +7850,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
if (CanRiposte && damage > 0 && CanThisClassRiposte() && !other->BehindMob(this, other->GetX(), other->GetY()))
{
riposte_chance = (100.0f + (float)defender->GetAABonuses().RiposteChance + (float)defender->GetSpellBonuses().RiposteChance + (float)defender->GetItemBonuses().RiposteChance) / 100.0f;
skill = GetSkill(RIPOSTE);
skill = GetSkill(RIPOSTE);
if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetDEX()/200);
@@ -7953,7 +7953,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
if (damage > 0 && CanThisClassDodge() && !other->BehindMob(this, other->GetX(), other->GetY()))
{
dodge_chance = (100.0f + (float)defender->GetSpellBonuses().DodgeChance + (float)defender->GetItemBonuses().DodgeChance) / 100.0f;
skill = GetSkill(DODGE);
skill = GetSkill(DODGE);
if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetAGI()/200);
@@ -7994,7 +7994,7 @@ int Bot::GetMonkHandToHandDamage(void)
// Kaiyodo - Determine a monk's fist damage. Table data from www.monkly-business.com
// saved as static array - this should speed this function up considerably
static int damage[66] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
99, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,11,11,11,11,11,
12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,
@@ -8153,7 +8153,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillType skillinuse)
}
else
{
mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel());
mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel());
return false;
}
}
@@ -8170,8 +8170,8 @@ void Bot::DoRiposte(Mob* defender) {
//double riposte
int16 DoubleRipChance = defender->GetAABonuses().GiveDoubleRiposte[0] +
defender->GetSpellBonuses().GiveDoubleRiposte[0] +
defender->GetItemBonuses().GiveDoubleRiposte[0];
defender->GetSpellBonuses().GiveDoubleRiposte[0] +
defender->GetItemBonuses().GiveDoubleRiposte[0];
if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) {
mlog(COMBAT__ATTACKS, "Preforming a double riposte (%d percent chance)", DoubleRipChance);
@@ -8306,7 +8306,7 @@ void Bot::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit)
{
thac0 = thac0cap;
}
d -= 10.0 * (a_diff / thac0);
d -= 10.0 * (a_diff / thac0);
}
else if(mit_roll > atk_roll)
{
@@ -8317,7 +8317,7 @@ void Bot::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit)
{
thac20 = thac20cap;
}
d += 10 * (m_diff / thac20);
d += 10 * (m_diff / thac20);
}
if(d < 0.0)
@@ -8576,7 +8576,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime)
if(primaryweapondamage > 0){
if(level > 25){
max_hit = (((2*backstab_dmg) * GetDamageTable(BACKSTAB) / 100) * 10 * GetSkill(BACKSTAB) / 355) + ((level-25)/3) + 1;
max_hit = (((2*backstab_dmg) * GetDamageTable(BACKSTAB) / 100) * 10 * GetSkill(BACKSTAB) / 355) + ((level-25)/3) + 1;
hate = 20 * backstab_dmg * GetSkill(BACKSTAB) / 355;
}
else{
@@ -8591,7 +8591,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime)
}
else
{
// Trumpcard: Replaced switch statement with formula calc. This will give minhit increases all the way to 65.
// Trumpcard: Replaced switch statement with formula calc. This will give minhit increases all the way to 65.
min_hit = (level * ( level*5 - 105)) / 100;
}
@@ -8715,11 +8715,11 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
if(level >= RuleI(Combat, NPCBashKickLevel)){
bool canBash = false;
if((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) // Racial Slam
|| (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield
|| (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield
|| (m_inv.GetItem(SLOT_PRIMARY) && (m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HS
|| m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HB
|| m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HPierce)
&& GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash
&& GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash
canBash = true;
}
@@ -8742,11 +8742,11 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
case PALADIN:
if(level >= RuleI(Combat, NPCBashKickLevel)){
if((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) // Racial Slam
|| (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield
|| (m_inv.GetItem(SLOT_SECONDARY) && m_inv.GetItem(SLOT_SECONDARY)->GetItem()->ItemType == ItemTypeShield) //Using Shield
|| (m_inv.GetItem(SLOT_PRIMARY) && (m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HS
|| m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HB
|| m_inv.GetItem(SLOT_PRIMARY)->GetItem()->ItemType == ItemType2HPierce)
&& GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash
&& GetAA(aa2HandBash) >= 1)) { //Using 2 hand weapon, but has AA 2 Hand Bash
skill_to_use = BASH;
}
}
@@ -8828,10 +8828,10 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
int AtkRounds = 3;
int skillmod = 0;
if(MaxSkill(FRENZY) > 0)
skillmod = 100*GetSkill(FRENZY)/MaxSkill(FRENZY);
if(MaxSkill(FRENZY) > 0)
skillmod = 100*GetSkill(FRENZY)/MaxSkill(FRENZY);
int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100);
int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100);
int32 min_dmg = 0;
DoAnim(anim2HSlashing);
@@ -9415,7 +9415,7 @@ void Bot::SetAttackTimer() {
int speed = (int)((36 *(100+DelayMod)/100)*(100.0f+attack_speed)*PermaHaste);
//if(speed < RuleI(Combat, MinHastedDelay) && IsClient()) //lower bound
// speed = RuleI(Combat, MinHastedDelay);
TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36
TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36
}
} else {
//we have a weapon, use its delay
@@ -9462,8 +9462,8 @@ void Bot::SetAttackTimer() {
int32 Bot::Additional_SpellDmg(uint16 spell_id, bool bufftick)
{
int32 spell_dmg = 0;
spell_dmg += GetBotFocusEffect(BotfocusFF_Damage_Amount, spell_id);
spell_dmg += GetBotFocusEffect(BotfocusSpellDamage, spell_id);
spell_dmg += GetBotFocusEffect(BotfocusFF_Damage_Amount, spell_id);
spell_dmg += GetBotFocusEffect(BotfocusSpellDamage, spell_id);
//For DOTs you need to apply the damage over the duration of the dot to each tick (this is how live did it)
if (bufftick){
@@ -9495,8 +9495,8 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value) {
if (tt == ST_UndeadAE || tt == ST_Undead || tt == ST_Summoned) {
//undead/summoned spells
modifier += GetBotFocusEffect(BotfocusImprovedUndeadDamage, spell_id);
} else {
//damage spells.
} else {
//damage spells.
modifier += GetBotFocusEffect(BotfocusImprovedDamage, spell_id);
modifier += GetBotFocusEffect(BotfocusSpellEffectiveness, spell_id);
modifier += GetBotFocusEffect(BotfocusImprovedDamage2, spell_id);
@@ -9509,7 +9509,7 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value) {
}
//This adds the extra damage from the AA Unholy Touch, 450 per level to the AA Improved Harm TOuch.
if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch
if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch
value -= GetAA(aaUnholyTouch) * 450; //Unholy Touch
}
@@ -9544,7 +9544,7 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value) {
ratio += RuleI(Spells, WizCritRatio);
}
if(aabonuses.SpellCritDmgIncrease > 0) // wizards get an additional bonus
ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225%
ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225%
}
//Improved Harm Touch is a guaranteed crit if you have at least one level of SCF.
@@ -9598,8 +9598,8 @@ int32 Bot::Additional_Heal(uint16 spell_id)
{
int32 heal_amt = 0;
heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal, spell_id);
heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal2, spell_id);
heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal, spell_id);
heal_amt += GetBotFocusEffect(BotfocusAdditionalHeal2, spell_id);
if (heal_amt){
int duration = CalcBuffDuration(this, this, spell_id);
@@ -9901,7 +9901,7 @@ bool Bot::SpellEffect(Mob* caster, uint16 spell_id, float partial) {
Result = Mob::SpellEffect(caster, spell_id, partial);
// Franck-add: If healed/doted, a bot must show its new HP to its leader
// Franck-add: If healed/doted, a bot must show its new HP to its leader
if(IsGrouped()) {
Group *g = GetGroup();
if(g) {
@@ -11300,7 +11300,7 @@ bool Bot::IsGroupPrimaryHealer() {
case RANGER:
case BEASTLORD:
{
result = GroupHasPriestClass(g) ? false : true;
result = GroupHasPriestClass(g) ? false : true;
break;
}
default:
@@ -11335,7 +11335,7 @@ bool Bot::IsGroupPrimarySlower() {
}
case BEASTLORD:
{
result = (GroupHasShamanClass(g) || GroupHasEnchanterClass(g)) ? false : true;
result = (GroupHasShamanClass(g) || GroupHasEnchanterClass(g)) ? false : true;
break;
}
default:
@@ -11972,7 +11972,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(0, "#bot taunt [on|off] - Turns taunt on/off for targeted bot");
c->Message(0, "#bot stance [name] [stance (id)|list] - Sets/lists stance for named bot (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)");
c->Message(0, "#bot groupmessages [on|off] [bot name|all] - Turns group messages on/off for named bot/all bots.");
c->Message(0, "#bot defensive [bot name] - Causes warrior or knight bot to use defensive discipline / buff.");
c->Message(0, "#bot defensive [bot name] - Causes warrior or knight bot to use defensive discipline / buff.");
c->Message(0, "#bot healrotation help - Displays the commands available to manage BOT heal rotations.");
// TODO:
// c->Message(0, "#bot illusion <bot/client name or target> - Enchanter Bot cast an illusion buff spell on you or your target.");
@@ -12068,9 +12068,9 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
MYSQL_ROW DataRow;
c->Message(0, "-----------------#bot armorcolor help-----------------------------");
c->Message(0, "Armor: 17(Chest/Robe), 7(Arms), 9(Bracer), 12(Hands), 18(Legs), 19(Boots), 2(Helm)");
c->Message(0, "Armor: 17(Chest/Robe), 7(Arms), 9(Bracer), 12(Hands), 18(Legs), 19(Boots), 2(Helm)");
c->Message(0, "------------------------------------------------------------------");
c->Message(0, "Color: [red] [green] [blue] (enter a number from 0-255 for each");
c->Message(0, "Color: [red] [green] [blue] (enter a number from 0-255 for each");
c->Message(0, "------------------------------------------------------------------");
c->Message(0, "Example: #bot armorcolor 17 0 255 0 - this would make the chest bright green");
return;
@@ -12191,7 +12191,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "create") ){
c->Message(0, "Classes: 1(Warrior), 2(Cleric), 3(Paladin), 4(Ranger), 5(Sk), 6(Druid), 7(Monk), 8(Bard), 9(Rogue), 10(Shaman), 11(Necro), 12(Wiz), 13(Mag), 14(Ench), 15(Beast), 16(Bersek)");
c->Message(0, "Classes: 1(Warrior), 2(Cleric), 3(Paladin), 4(Ranger), 5(Sk), 6(Druid), 7(Monk), 8(Bard), 9(Rogue), 10(Shaman), 11(Necro), 12(Wiz), 13(Mag), 14(Ench), 15(Beast), 16(Bersek)");
c->Message(0, "------------------------------------------------------------------");
c->Message(0, "Races: 1(Human), 2(Barb), 3(Erudit), 4(Wood elf), 5(High elf), 6(Dark elf), 7(Half elf), 8(Dwarf), 9(Troll), 10(Ogre), 11(Halfling), 12(Gnome), 128(Iksar), 130(Vah shir), 330(Froglok), 522(Drakkin)");
c->Message(0, "------------------------------------------------------------------");
@@ -12281,7 +12281,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(bot && !listAll) {
// Specific bot only
if(bot->GetClass() != WARRIOR && bot->GetClass() != MONK && bot->GetClass() != BARD && bot->GetClass() != BERSERKER && bot->GetClass() != ROGUE)
if(bot->GetClass() != WARRIOR && bot->GetClass() != MONK && bot->GetClass() != BARD && bot->GetClass() != BERSERKER && bot->GetClass() != ROGUE)
c->Message(0, "Name: %s -- Class: %s -- Mana: %3.1f%%", bot->GetCleanName(), ClassIdToString(bot->GetClass()).c_str(), bot->GetManaRatio());
}
else {
@@ -12292,7 +12292,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
for(std::list<Bot*>::iterator botsListItr = spawnedBots.begin(); botsListItr != spawnedBots.end(); botsListItr++) {
Bot* tempBot = *botsListItr;
if(tempBot) {
if(tempBot->GetClass() != WARRIOR && tempBot->GetClass() != MONK && tempBot->GetClass() != BARD && tempBot->GetClass() != BERSERKER && tempBot->GetClass() != ROGUE)
if(tempBot->GetClass() != WARRIOR && tempBot->GetClass() != MONK && tempBot->GetClass() != BARD && tempBot->GetClass() != BERSERKER && tempBot->GetClass() != ROGUE)
c->Message(0, "Name: %s -- Class: %s -- Mana: %3.1f%%", tempBot->GetCleanName(), ClassIdToString(tempBot->GetClass()).c_str(), tempBot->GetManaRatio());
}
}
@@ -12835,7 +12835,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
}
if(hasruneer) {
if (c->GetLevel() <= 12) {
if (c->GetLevel() <= 12) {
runeer->Say("I need to be level 13 or higher for this...");
}
else if ((c->GetLevel() >= 13) && (c->GetLevel() <= 21)) {
@@ -12976,7 +12976,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
switch(CurerClass) {
case CLERIC:
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 1)) {
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 1)) {
Curer->Say("Trying to cure us of %s.", sep->arg[2]);
Curer->CastToBot()->Bot_Command_Cure(1, Curer->GetLevel());
}
@@ -13004,7 +13004,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
break;
case SHAMAN:
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 2)) {
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 2)) {
Curer->Say("Trying to cure us of %s.", sep->arg[2]);
Curer->CastToBot()->Bot_Command_Cure(1, Curer->GetLevel());
}
@@ -13580,11 +13580,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
}
}
if((hasevac) && (c->GetLevel() >= 18)) {
if((hasevac) && (c->GetLevel() >= 18)) {
evac->Say("Attempting to Evac you %s.", c->GetName());
evac->CastToClient()->CastSpell(2183, c->GetID(), 1, -1, -1);
}
else if((hasevac) && (c->GetLevel() <= 17)) {
else if((hasevac) && (c->GetLevel() <= 17)) {
evac->Say("I'm not level 18 yet.", c->GetName());
}
return;
@@ -13628,11 +13628,11 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
switch(SowerClass) {
case DRUID:
if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() >= 10) ) {
if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() >= 10) ) {
Sower->Say("Casting sow...");
Sower->CastSpell(278, c->GetID(), 1, -1, -1);
}
else if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() <= 10) ) {
else if ((!strcasecmp(sep->arg[2], "regular")) && (zone->CanCastOutdoor()) && (c->GetLevel() <= 10) ) {
Sower->Say("I'm not level 10 yet.");
}
else if ((!strcasecmp(sep->arg[2], "wolf")) && zone->CanCastOutdoor() && (c->GetLevel() >= 20)) {
@@ -13715,7 +13715,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
default:
c->Message(15, "You must have a Druid, Shaman, Ranger, or Beastlord in your group.");
c->Message(15, "You must have a Druid, Shaman, Ranger, or Beastlord in your group.");
break;
}
}
@@ -13806,7 +13806,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
switch(GaterClass) {
case DRUID:
if ((!strcasecmp(sep->arg[2], "karana")) && (c->GetLevel() >= 25) ) {
if ((!strcasecmp(sep->arg[2], "karana")) && (c->GetLevel() >= 25) ) {
Gater->Say("Casting Circle of Karana...");
Gater->CastSpell(550, c->GetID(), 1, -1, -1);
}
@@ -13940,7 +13940,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
case WIZARD:
if ((!strcasecmp(sep->arg[2], "commons")) && (c->GetLevel() >= 35) ) {
if ((!strcasecmp(sep->arg[2], "commons")) && (c->GetLevel() >= 35) ) {
Gater->Say("Casting Common Portal...");
Gater->CastSpell(566, c->GetID(), 1, -1, -1);
}
@@ -14117,7 +14117,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
switch(EndurerClass) {
case DRUID:
if (c->GetLevel() < 6) {
if (c->GetLevel() < 6) {
Endurer->Say("I'm not level 6 yet.");
}
else {
@@ -14127,7 +14127,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
break;
case SHAMAN:
if (c->GetLevel() < 12) {
if (c->GetLevel() < 12) {
Endurer->Say("I'm not level 12 yet.");
}
else {
@@ -14136,7 +14136,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
break;
case RANGER:
if (c->GetLevel() < 20) {
if (c->GetLevel() < 20) {
Endurer->Say("I'm not level 20 yet.");
}
else {
@@ -14145,7 +14145,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
break;
case ENCHANTER:
if (c->GetLevel() < 12) {
if (c->GetLevel() < 12) {
Endurer->Say("I'm not level 12 yet.");
}
else {
@@ -14154,14 +14154,14 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
break;
case BEASTLORD:
if (c->GetLevel() < 25) {
if (c->GetLevel() < 25) {
Endurer->Say("I'm not level 25 yet.");
}
}
else {
Endurer->Say("Casting Enduring Breath...");
Endurer->CastSpell(86, c->GetID(), 1, -1, -1);
}
break;
break;
default:
c->Message(15, "You must have a Druid, Shaman, Ranger, Enchanter, or Beastlord in your group.");
break;
@@ -14214,21 +14214,21 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
switch(InviserClass) {
case ENCHANTER:
if ((c->GetLevel() <= 14) && (!strcasecmp(sep->arg[2], "undead"))) {
if ((c->GetLevel() <= 14) && (!strcasecmp(sep->arg[2], "undead"))) {
Inviser->Say("I'm not level 14 yet.");
}
else if ((!c->IsInvisible(c)) && (!c->invisible_undead) && (c->GetLevel() >= 14) && (!strcasecmp(sep->arg[2], "undead"))) {
Inviser->Say("Casting invis undead...");
Inviser->CastSpell(235, c->GetID(), 1, -1, -1);
}
else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) {
else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) {
Inviser->Say("I'm not level 4 yet.");
}
else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 4) && (!strcasecmp(sep->arg[2], "live"))) {
Inviser->Say("Casting invisibilty...");
Inviser->CastSpell(42, c->GetID(), 1, -1, -1);
}
else if ((c->GetLevel() <= 6) && (!strcasecmp(sep->arg[2], "see"))) {
else if ((c->GetLevel() <= 6) && (!strcasecmp(sep->arg[2], "see"))) {
Inviser->Say("I'm not level 6 yet.");
}
else if ((c->GetLevel() >= 6) && (!strcasecmp(sep->arg[2], "see"))) {
@@ -14243,17 +14243,17 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
break;
case MAGICIAN:
if (!strcasecmp(sep->arg[2], "undead")) {
if (!strcasecmp(sep->arg[2], "undead")) {
Inviser->Say("I don't have that spell.");
}
else if ((c->GetLevel() <= 8) && (!strcasecmp(sep->arg[2], "live"))) {
else if ((c->GetLevel() <= 8) && (!strcasecmp(sep->arg[2], "live"))) {
Inviser->Say("I'm not level 8 yet.");
}
else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 8) && (!strcasecmp(sep->arg[2], "live"))) {
Inviser->Say("Casting invisibilty...");
Inviser->CastSpell(42, c->GetID(), 1, -1, -1);
}
else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "see"))) {
else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "see"))) {
Inviser->Say("I'm not level 16 yet.");
}
else if ((c->GetLevel() >= 16) && (!strcasecmp(sep->arg[2], "see"))) {
@@ -14268,21 +14268,21 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
break;
case WIZARD:
if ((c->GetLevel() <= 39) && (!strcasecmp(sep->arg[2], "undead"))) {
if ((c->GetLevel() <= 39) && (!strcasecmp(sep->arg[2], "undead"))) {
Inviser->Say("I'm not level 39 yet.");
}
else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 39) && (!strcasecmp(sep->arg[2], "undead"))) {
Inviser->Say("Casting invis undead...");
Inviser->CastSpell(235, c->GetID(), 1, -1, -1);
}
else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "live"))) {
else if ((c->GetLevel() <= 16) && (!strcasecmp(sep->arg[2], "live"))) {
Inviser->Say("I'm not level 16 yet.");
}
else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 16) && (!strcasecmp(sep->arg[2], "live"))) {
Inviser->Say("Casting invisibilty...");
Inviser->CastSpell(42, c->GetID(), 1, -1, -1);
}
else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "see"))) {
else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "see"))) {
Inviser->Say("I'm not level 6 yet.");
}
else if ((c->GetLevel() >= 4) && (!strcasecmp(sep->arg[2], "see"))) {
@@ -14315,10 +14315,10 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
break;
case DRUID:
if (!strcasecmp(sep->arg[2], "undead")) {
if (!strcasecmp(sep->arg[2], "undead")) {
Inviser->Say("I don't have that spell...");
}
else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) {
else if ((c->GetLevel() <= 4) && (!strcasecmp(sep->arg[2], "live"))) {
Inviser->Say("I'm not level 4 yet.");
}
else if ((!c->IsInvisible(c))&& (!c->invisible_undead) && (c->GetLevel() >= 18) && (!strcasecmp(sep->arg[2], "live"))) {
@@ -14332,7 +14332,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
else if ((c->GetLevel() >= 4) && (!strcasecmp(sep->arg[2], "live")) && (!zone->CanCastOutdoor())) {
Inviser->Say("I can't cast this spell indoors...");
}
else if ((c->GetLevel() <= 13) && (!strcasecmp(sep->arg[2], "see"))) {
else if ((c->GetLevel() <= 13) && (!strcasecmp(sep->arg[2], "see"))) {
Inviser->Say("I'm not level 13 yet.");
}
else if ((c->GetLevel() >= 13) && (!strcasecmp(sep->arg[2], "see"))) {
@@ -14391,7 +14391,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
switch(LeverClass) {
case DRUID:
if (c->GetLevel() <= 14) {
if (c->GetLevel() <= 14) {
Lever->Say("I'm not level 14 yet.");
}
else if (zone->CanCastOutdoor()) {
@@ -14486,7 +14486,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
switch(ResisterClass) {
case CLERIC:
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 6)) {
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 6)) {
Resister->Say("Casting poison protection...", sep->arg[2]);
Resister->CastToBot()->Bot_Command_Resist(1, Resister->GetLevel());
}
@@ -14519,7 +14519,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
break;
case SHAMAN:
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 20)) {
if (!strcasecmp(sep->arg[2], "poison") && (c->GetLevel() >= 20)) {
Resister->Say("Casting poison protection...", sep->arg[2]);
Resister->CastToBot()->Bot_Command_Resist(12, Resister->GetLevel());
}
@@ -15015,7 +15015,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
return;
}
if(!strcasecmp(sep->arg[1], "botgroup") && !strcasecmp(sep->arg[2], "load")) {
if(!strcasecmp(sep->arg[1], "botgroup") && !strcasecmp(sep->arg[2], "load")) {
// If client is grouped, check for aggro on each group member.
Group *g = c->GetGroup();
@@ -15027,7 +15027,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
// Fail if current group member is client and has aggro
// OR has a popuplated hate list (assume bot).
if((g->members[i]->IsClient() && g->members[i]->CastToClient()->GetAggroCount())
|| g->members[i]->IsEngaged()) {
|| g->members[i]->IsEngaged()) {
c->Message(0, "You can't spawn bots while your group is engaged.");
return;
}
@@ -15238,7 +15238,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(!strcasecmp(sep->arg[1], "haircolor") || !strcasecmp(sep->arg[1], "hair") || !strcasecmp(sep->arg[1], "beard") || !strcasecmp(sep->arg[1], "beardcolor") || !strcasecmp(sep->arg[1], "face")
|| !strcasecmp(sep->arg[1], "eyes") || !strcasecmp(sep->arg[1], "heritage") || !strcasecmp(sep->arg[1], "tattoo") || !strcasecmp(sep->arg[1], "details")) {
if(c->GetTarget() && c->GetTarget()->IsBot()) {
if (sep->IsNumber(2)) {
if (sep->IsNumber(2)) {
if (c->GetTarget()->CastToBot()->GetBotOwnerCharacterID() == c->CharacterID()) {
Bot *target = c->GetTarget()->CastToBot();
uint16 Race = target->GetRace();
@@ -15402,7 +15402,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
int stance = atoi(sep->arg[3]);
if(stance >= MaxStances || stance < 0){
c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)");
c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)");
return;
}
else {
@@ -15456,7 +15456,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
}
else {
c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)");
c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)");
}
return;
}
@@ -16074,7 +16074,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
Bot* tempBot = *botListItr;
if(tempBot->GetInHealRotation() && tempBot->GetHealRotationLeader() == tempBot) {
//list leaders and number of bots per rotation
c->Message(0, "Bot Heal Rotation- Leader: %s, Number of Members: %i, Timer: %1.1f", tempBot->GetCleanName(), tempBot->GetNumHealRotationMembers(), (float)(tempBot->GetHealRotationTimer()/1000));
c->Message(0, "Bot Heal Rotation- Leader: %s, Number of Members: %i, Timer: %1.1f", tempBot->GetCleanName(), tempBot->GetNumHealRotationMembers(), (float)(tempBot->GetHealRotationTimer()/1000));
}
}
}
@@ -16099,7 +16099,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
//list leader and number of members
c->Message(0, "Bot Heal Rotation- Leader: %s", leaderBot->GetCleanName());
c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f));
c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f));
for(list<Bot*>::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) {
Bot* tempBot = *botListItr;
@@ -16315,11 +16315,11 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
if(caster->AICastSpell(g->members[i], 100, SpellType_Heal))
return true;
}
else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < 95) {
else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < 95) {
if(caster->AICastSpell(g->members[i], 100, SpellType_Heal))
return true;
}
else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < 80) {
else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < 80) {
if(caster->AICastSpell(g->members[i], 100, SpellType_Heal))
return true;
}
@@ -16379,11 +16379,11 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
if(caster->AICastSpell(g->members[i], 100, SpellType_Heal))
return true;
}
else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < hpRatioToHeal) {
else if((g->members[i]->GetClass() == WARRIOR || g->members[i]->GetClass() == PALADIN || g->members[i]->GetClass() == SHADOWKNIGHT) && g->members[i]->GetHPRatio() < hpRatioToHeal) {
if(caster->AICastSpell(g->members[i], 100, SpellType_Heal))
return true;
}
else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < hpRatioToHeal) {
else if(g->members[i]->GetClass() == ENCHANTER && g->members[i]->GetHPRatio() < hpRatioToHeal) {
if(caster->AICastSpell(g->members[i], 100, SpellType_Heal))
return true;
}
@@ -16543,7 +16543,7 @@ void EntityList::AddBot(Bot *newBot, bool SendSpawnPacket, bool dontqueue) {
safe_delete(ns);
}
parse->EventNPC(EVENT_SPAWN, newBot, nullptr, "", 0);
parse->EventNPC(EVENT_SPAWN, newBot, nullptr, "", 0);
}
bot_list.push_back(newBot);
@@ -16653,7 +16653,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) {
{
if(iterator.GetData()->IsTrackable()) {
Mob* cur_entity = iterator.GetData();
int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient());
int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient());
const char *const MyArray[] = {
"a_","an_","Innkeep_","Barkeep_",
"Guard_","Merchant_","Lieutenant_",
@@ -16686,20 +16686,20 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) {
"stone_","lava_","_",""
};
unsigned int MyArraySize;
for ( MyArraySize = 0; true; MyArraySize++) { //Find empty string & get size
if (!(*(MyArray[MyArraySize]))) break; //Checks for null char in 1st pos
for ( MyArraySize = 0; true; MyArraySize++) { //Find empty string & get size
if (!(*(MyArray[MyArraySize]))) break; //Checks for null char in 1st pos
};
if (NamedOnly) {
bool ContinueFlag = false;
const char *CurEntityName = cur_entity->GetName(); //Call function once
for (int Index = 0; Index < MyArraySize; Index++) {
if (!strncasecmp(CurEntityName, MyArray[Index], strlen(MyArray[Index])) || (Extras)) {
iterator.Advance();
ContinueFlag = true;
break; //From Index for
};
};
if (ContinueFlag) continue; //Moved here or would apply to Index for
bool ContinueFlag = false;
const char *CurEntityName = cur_entity->GetName(); //Call function once
for (int Index = 0; Index < MyArraySize; Index++) {
if (!strncasecmp(CurEntityName, MyArray[Index], strlen(MyArray[Index])) || (Extras)) {
iterator.Advance();
ContinueFlag = true;
break; //From Index for
};
};
if (ContinueFlag) continue; //Moved here or would apply to Index for
};
CurrentCon = client->GetLevelCon(cur_entity->GetLevel());
@@ -16992,12 +16992,12 @@ bool Bot::HasOrMayGetAggro() {
Mob *topHate = GetTarget()->GetHateTop();
if(topHate == this)
mayGetAggro = true; //I currently have aggro
mayGetAggro = true; //I currently have aggro
else {
uint32 myHateAmt = GetTarget()->GetHateAmount(this);
uint32 topHateAmt = GetTarget()->GetHateAmount(topHate);
if(myHateAmt > 0 && topHateAmt > 0 && (uint8)((myHateAmt/topHateAmt)*100) > 90) //I have 90% as much hate as top, next action may give me aggro
if(myHateAmt > 0 && topHateAmt > 0 && (uint8)((myHateAmt/topHateAmt)*100) > 90) //I have 90% as much hate as top, next action may give me aggro
mayGetAggro = true;
}
}
@@ -17086,7 +17086,7 @@ bool Bot::UseDiscipline(uint32 spell_id, uint32 target) {
//make sure we can use it..
if(!IsValidSpell(spell_id)) {
Say("Not a valid spell");
Say("Not a valid spell");
return(false);
}
@@ -17155,7 +17155,7 @@ bool Bot::AddHealRotationMember( Bot* healer ) {
for(int i=0; i<3; i++){
healer->ClearHealRotationMembers();
healer->ClearHealRotationTargets();
healer->AddHealRotationTarget(entity_list.GetMob(_healRotationTargets[i])); // add all targets..
healer->AddHealRotationTarget(entity_list.GetMob(_healRotationTargets[i])); // add all targets..
}
healer->SetHealRotationTimer(tempBot->GetHealRotationTimer());
healer->SetHealRotationLeader(this);
@@ -17189,10 +17189,10 @@ bool Bot::AddHealRotationMember( Bot* healer ) {
}
bool Bot::RemoveHealRotationMember( Bot* healer ) {
if(healer && GetNumHealRotationMembers() > 0) {
if(healer && GetNumHealRotationMembers() > 0) {
Bot* leader = healer->GetHealRotationLeader();
Bot* prevBot = healer->GetPrevHealRotationMember();
Bot* nextBot = healer->GetNextHealRotationMember();
Bot* prevBot = healer->GetPrevHealRotationMember();
Bot* nextBot = healer->GetNextHealRotationMember();
if(healer == this) {
if(nextBot != this) {
@@ -17202,21 +17202,21 @@ bool Bot::RemoveHealRotationMember( Bot* healer ) {
}
//remove healer from list
healer->SetHealRotationTimer(0);
healer->ClearHealRotationMembers();
healer->SetHealRotationTimer(0);
healer->ClearHealRotationMembers();
healer->ClearHealRotationTargets();
healer->ClearHealRotationLeader();
healer->SetHasHealedThisCycle(false);
healer->SetHealRotationActive(false);
healer->SetInHealRotation(false);
healer->SetInHealRotation(false);
if(prevBot && nextBot && GetNumHealRotationMembers() > 1) {
//set previous rotation member's next member to new member
prevBot->SetNextHealRotationMember(nextBot);
if(prevBot && nextBot && GetNumHealRotationMembers() > 1) {
//set previous rotation member's next member to new member
prevBot->SetNextHealRotationMember(nextBot);
//set previous rotation member's next member to new member
nextBot->SetPrevHealRotationMember(prevBot);
}
//set previous rotation member's next member to new member
nextBot->SetPrevHealRotationMember(prevBot);
}
//update rotation data
list<Bot*> botList = GetBotsInHealRotation(leader);
@@ -17325,7 +17325,7 @@ bool Bot::AddHealRotationTarget( Mob *target, int index ) {
bool Bot::RemoveHealRotationTarget( Mob* target ) {
int index = 0;
bool removed = false;
if(target) {
if(target) {
//notify all heal rotation members to remove target
for(int i=0; i<MaxHealRotationTargets; i++){
if(_healRotationTargets[i] == target->GetID()) {
@@ -17366,17 +17366,17 @@ bool Bot::RemoveHealRotationTarget( int index ) {
void Bot::ClearHealRotationMembers() {
_healRotationMemberPrev = 0; // No previous member
_healRotationMemberNext = 0; // No next member
_healRotationMemberNext = 0; // No next member
}
void Bot::ClearHealRotationTargets() {
for(int i=0; i<MaxHealRotationTargets; i++){
_healRotationTargets[i] = 0;
}
for(int i=0; i<MaxHealRotationTargets; i++){
_healRotationTargets[i] = 0;
}
}
Mob* Bot::GetHealRotationTarget( ) {
Mob* tank = nullptr;
Mob* tank = nullptr;
Mob* first = nullptr;
Mob* target = nullptr;
int removeIndex = 0;
@@ -17428,18 +17428,18 @@ Mob* Bot::GetHealRotationTarget( ) {
if(tank)
return tank;
return first;
return first;
}
Mob* Bot::GetHealRotationTarget( uint8 index ) {
Mob* target = nullptr;
Mob* target = nullptr;
if(_healRotationTargets[index] > 0) {
//get target at specified index
target = entity_list.GetMob(_healRotationTargets[index]);
}
return target;
return target;
}
list<Bot*> Bot::GetBotsInHealRotation(Bot* rotationLeader) {
+31 -31
View File
@@ -139,7 +139,7 @@ public:
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false);
virtual bool HasRaid() { return (GetRaid() ? true : false); }
virtual bool HasRaid() { return (GetRaid() ? true : false); }
virtual bool HasGroup() { return (GetGroup() ? true : false); }
virtual Raid* GetRaid() { return entity_list.GetRaidByMob(this); }
virtual Group* GetGroup() { return entity_list.GetGroupByMob(this); }
@@ -166,7 +166,7 @@ public:
void CalcBotStats(bool showtext = true);
uint16 BotGetSpells(int spellslot) { return AIspells[spellslot].spellid; }
uint16 BotGetSpellType(int spellslot) { return AIspells[spellslot].type; }
uint16 BotGetSpellPriority(int spellslot) { return AIspells[spellslot].priority; }
uint16 BotGetSpellPriority(int spellslot) { return AIspells[spellslot].priority; }
virtual float GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand);
virtual bool AvoidDamage(Mob* other, int32 &damage, bool CanRiposte);
virtual int GetMonkHandToHandDamage(void);
@@ -240,45 +240,45 @@ public:
void ClearHealRotationLeader() { _healRotationLeader = 0; }
void ClearHealRotationMembers();
void ClearHealRotationTargets();
inline virtual int16 GetMaxStat();
inline virtual int16 GetMaxResist();
inline virtual int16 GetMaxSTR();
inline virtual int16 GetMaxSTA();
inline virtual int16 GetMaxDEX();
inline virtual int16 GetMaxAGI();
inline virtual int16 GetMaxINT();
inline virtual int16 GetMaxWIS();
inline virtual int16 GetMaxCHA();
inline virtual int16 GetMaxMR();
inline virtual int16 GetMaxPR();
inline virtual int16 GetMaxDR();
inline virtual int16 GetMaxCR();
inline virtual int16 GetMaxFR();
inline virtual int16 GetMaxCorrup();
int16 CalcATK();
int16 CalcSTR();
int16 CalcSTA();
int16 CalcDEX();
int16 CalcAGI();
int16 CalcINT();
int16 CalcWIS();
int16 CalcCHA();
inline virtual int16 GetMaxStat();
inline virtual int16 GetMaxResist();
inline virtual int16 GetMaxSTR();
inline virtual int16 GetMaxSTA();
inline virtual int16 GetMaxDEX();
inline virtual int16 GetMaxAGI();
inline virtual int16 GetMaxINT();
inline virtual int16 GetMaxWIS();
inline virtual int16 GetMaxCHA();
inline virtual int16 GetMaxMR();
inline virtual int16 GetMaxPR();
inline virtual int16 GetMaxDR();
inline virtual int16 GetMaxCR();
inline virtual int16 GetMaxFR();
inline virtual int16 GetMaxCorrup();
int16 CalcATK();
int16 CalcSTR();
int16 CalcSTA();
int16 CalcDEX();
int16 CalcAGI();
int16 CalcINT();
int16 CalcWIS();
int16 CalcCHA();
int16 CalcMR();
int16 CalcFR();
int16 CalcDR();
int16 CalcPR();
int16 CalcCR();
int16 CalcCorrup();
int32 CalcHPRegenCap();
int32 CalcManaRegenCap();
int32 CalcHPRegenCap();
int32 CalcManaRegenCap();
int32 LevelRegen();
int32 CalcHPRegen();
int32 CalcManaRegen();
uint32 CalcCurrentWeight();
int GroupLeadershipAAHealthEnhancement();
int GroupLeadershipAAManaEnhancement();
int GroupLeadershipAAHealthEnhancement();
int GroupLeadershipAAManaEnhancement();
int GroupLeadershipAAHealthRegeneration();
int GroupLeadershipAAOffenseEnhancement();
int GroupLeadershipAAOffenseEnhancement();
void CalcRestState();
int32 CalcMaxEndurance(); //This calculates the maximum endurance we can have
int32 CalcBaseEndurance(); //Calculates Base End
@@ -519,7 +519,7 @@ public:
inline virtual int16 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath; }
inline InspectMessage_Struct& GetInspectMessage() { return _botInspectMessage; }
inline InspectMessage_Struct& GetInspectMessage() { return _botInspectMessage; }
inline const InspectMessage_Struct& GetInspectMessage() const { return _botInspectMessage; }
// "SET" Class Methods
+74 -74
View File
@@ -340,7 +340,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
case ARCHETYPE_CASTER:
//TODO: probably more caster specific spell effects in here
if(IsEffectInSpell(selectedBotSpell.SpellId, SE_AttackSpeed) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ATK) ||
IsEffectInSpell(selectedBotSpell.SpellId, SE_STR) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ReverseDS))
IsEffectInSpell(selectedBotSpell.SpellId, SE_STR) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ReverseDS))
{
continue;
}
@@ -412,7 +412,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
if (hpr <= 5 || (IsNPC() && CastToNPC()->IsInteractive() && tar != this) )
#else
if(hpr > 15 && ((botClass == WIZARD) || (botClass == ENCHANTER) || (botClass == RANGER)))
mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells
mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells
if (hpr <= 15 || mayGetAggro)
#endif
@@ -423,7 +423,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
break;
if(IsInvulnerabilitySpell(botSpell.SpellId))
tar = this; //target self for invul type spells
tar = this; //target self for invul type spells
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
}
@@ -572,7 +572,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
//short duration buffs or other buffs only to be cast during combat.
if (IsSelfConversionSpell(selectedBotSpell.SpellId)) {
if(GetManaRatio() > 90.0f || GetHPRatio() < 50.0f || GetHPRatio() < (GetManaRatio() + 10.0f))
break; //don't cast if low hp, lots of mana, or if mana is higher than hps
break; //don't cast if low hp, lots of mana, or if mana is higher than hps
}
castedSpell = AIDoSpellCast(selectedBotSpell.SpellIndex, tar, selectedBotSpell.ManaCost);
@@ -836,7 +836,7 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
SetMana(hasMana);
extraMana = false;
}
else { //handle spell recast and recast timers
else { //handle spell recast and recast timers
if(GetClass() == BARD && IsGroupSpell(AIspells[i].spellid)) {
AIspells[i].time_cancast = (spells[AIspells[i].spellid].recast_time > (spells[AIspells[i].spellid].buffduration * 6000)) ? Timer::GetCurrentTime() + spells[AIspells[i].spellid].recast_time : Timer::GetCurrentTime() + spells[AIspells[i].spellid].buffduration * 6000;
//spellend_timer.Start(spells[AIspells[i].spellid].cast_time);
@@ -912,7 +912,7 @@ bool Bot::AI_IdleCastCheck() {
result = true;
}
// Pets class will first cast their pet, then buffs
else if(botClass == DRUID || botClass == MAGICIAN || botClass == SHADOWKNIGHT || botClass == SHAMAN || botClass == NECROMANCER || botClass == ENCHANTER || botClass == BEASTLORD || botClass == WIZARD) {
else if(botClass == DRUID || botClass == MAGICIAN || botClass == SHADOWKNIGHT || botClass == SHAMAN || botClass == NECROMANCER || botClass == ENCHANTER || botClass == BEASTLORD || botClass == WIZARD) {
if(!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Cure)) {
if (!AICastSpell(this, 100, SpellType_Pet)) {
if (!AICastSpell(this, 100, SpellType_Heal)) {
@@ -1492,88 +1492,88 @@ BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster) {
}
BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster) {
BotSpell result;
BotSpell result;
result.SpellId = 0;
result.SpellIndex = 0;
result.ManaCost = 0;
result.SpellId = 0;
result.SpellIndex = 0;
result.ManaCost = 0;
if(botCaster) {
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP);
if(botCaster) {
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP);
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
// Assuming all the spells have been loaded into this list by level and in descending order
if(IsRegularGroupHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
result.SpellId = botSpellListItr->SpellId;
result.SpellIndex = botSpellListItr->SpellIndex;
result.ManaCost = botSpellListItr->ManaCost;
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
// Assuming all the spells have been loaded into this list by level and in descending order
if(IsRegularGroupHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
result.SpellId = botSpellListItr->SpellId;
result.SpellIndex = botSpellListItr->SpellIndex;
result.ManaCost = botSpellListItr->ManaCost;
break;
}
}
}
break;
}
}
}
return result;
return result;
}
BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster) {
BotSpell result;
BotSpell result;
result.SpellId = 0;
result.SpellIndex = 0;
result.ManaCost = 0;
result.SpellId = 0;
result.SpellIndex = 0;
result.ManaCost = 0;
if(botCaster) {
std::list<BotSpell> botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime);
std::vector<AISpells_Struct> botSpellList = botCaster->GetBotSpells();
if(botCaster) {
std::list<BotSpell> botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime);
std::vector<AISpells_Struct> botSpellList = botCaster->GetBotSpells();
for(std::list<BotSpell>::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) {
// Assuming all the spells have been loaded into this list by level and in descending order
if(IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) {
for(std::list<BotSpell>::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) {
// Assuming all the spells have been loaded into this list by level and in descending order
if(IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) {
for (int i = botSpellList.size() - 1; i >= 0; i--) {
if (botSpellList[i].spellid <= 0 || botSpellList[i].spellid >= SPDAT_RECORDS) {
// this is both to quit early to save cpu and to avoid casting bad spells
// Bad info from database can trigger this incorrectly, but that should be fixed in DB, not here
continue;
}
if(botSpellList[i].spellid == botSpellListItr->SpellId && (botSpellList[i].type & SpellType_Heal) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
result.SpellId = botSpellListItr->SpellId;
result.SpellIndex = botSpellListItr->SpellIndex;
result.ManaCost = botSpellListItr->ManaCost;
}
}
break;
for (int i = botSpellList.size() - 1; i >= 0; i--) {
if (botSpellList[i].spellid <= 0 || botSpellList[i].spellid >= SPDAT_RECORDS) {
// this is both to quit early to save cpu and to avoid casting bad spells
// Bad info from database can trigger this incorrectly, but that should be fixed in DB, not here
continue;
}
}
}
return result;
}
BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) {
BotSpell result;
result.SpellId = 0;
result.SpellIndex = 0;
result.ManaCost = 0;
if(botCaster) {
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CompleteHeal);
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
// Assuming all the spells have been loaded into this list by level and in descending order
if(IsGroupCompleteHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
if(botSpellList[i].spellid == botSpellListItr->SpellId && (botSpellList[i].type & SpellType_Heal) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
result.SpellId = botSpellListItr->SpellId;
result.SpellIndex = botSpellListItr->SpellIndex;
result.ManaCost = botSpellListItr->ManaCost;
break;
}
}
}
break;
}
}
}
return result;
}
BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) {
BotSpell result;
result.SpellId = 0;
result.SpellIndex = 0;
result.ManaCost = 0;
if(botCaster) {
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CompleteHeal);
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
// Assuming all the spells have been loaded into this list by level and in descending order
if(IsGroupCompleteHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
result.SpellId = botSpellListItr->SpellId;
result.SpellIndex = botSpellListItr->SpellIndex;
result.ManaCost = botSpellListItr->ManaCost;
break;
}
}
}
return result;
}
@@ -2142,9 +2142,9 @@ int32 Bot::GetSpellRecastTimer(Bot *caster, int timer_index) {
bool Bot::CheckSpellRecastTimers(Bot *caster, int SpellIndex) {
if(caster) {
if(caster->AIspells[SpellIndex].time_cancast < Timer::GetCurrentTime()) { //checks spell recast
if(GetSpellRecastTimer(caster, spells[caster->AIspells[SpellIndex].spellid].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer
return true; //can cast spell
if(caster->AIspells[SpellIndex].time_cancast < Timer::GetCurrentTime()) { //checks spell recast
if(GetSpellRecastTimer(caster, spells[caster->AIspells[SpellIndex].spellid].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer
return true; //can cast spell
}
}
}
@@ -2180,8 +2180,8 @@ uint32 Bot::GetDisciplineRemainingTime(Bot *caster, int timer_index) {
bool Bot::CheckDisciplineRecastTimers(Bot *caster, int timer_index) {
if(caster) {
if(GetDisciplineRecastTimer(caster, timer_index) < Timer::GetCurrentTime()) { //checks for spells on the same timer
return true; //can cast spell
if(GetDisciplineRecastTimer(caster, timer_index) < Timer::GetCurrentTime()) { //checks for spells on the same timer
return true; //can cast spell
}
}
return false;
+385 -387
View File
File diff suppressed because it is too large Load Diff
+142 -174
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef CLIENT_H
#define CLIENT_H
@@ -61,10 +61,10 @@ extern TaskManager *taskmanager;
class CLIENTPACKET
{
public:
CLIENTPACKET();
~CLIENTPACKET();
EQApplicationPacket *app;
bool ack_req;
CLIENTPACKET();
~CLIENTPACKET();
EQApplicationPacket *app;
bool ack_req;
};
enum { //Type arguments to the Message* routines.
@@ -189,13 +189,13 @@ public:
#include "client_packet.h"
Client(EQStreamInterface * ieqs);
~Client();
~Client();
//abstract virtual function implementations requird by base abstract class
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false);
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false);
virtual bool HasRaid() { return (GetRaid() ? true : false); }
virtual bool HasRaid() { return (GetRaid() ? true : false); }
virtual bool HasGroup() { return (GetGroup() ? true : false); }
virtual Raid* GetRaid() { return entity_list.GetRaidByClient(this); }
virtual Group* GetGroup() { return entity_list.GetGroupByClient(this); }
@@ -207,14 +207,14 @@ public:
void AI_Process();
void AI_SpellCast();
void Trader_ShowItems();
void Trader_CustomerBrowsing(Client *Customer);
void Trader_CustomerBrowsing(Client *Customer);
void Trader_EndTrader();
void Trader_StartTrader();
uint8 WithCustomer(uint16 NewCustomer);
void KeyRingLoad();
void KeyRingAdd(uint32 item_id);
bool KeyRingCheck(uint32 item_id);
void KeyRingList();
void KeyRingList();
virtual bool IsClient() const { return true; }
virtual void DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw);
bool FinishConnState2(DBAsyncWork* dbaw);
@@ -233,13 +233,13 @@ public:
uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity);
ItemInst* FindTraderItemBySerialNumber(int32 SerialNumber);
void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot);
void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid);
void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid);
void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges);
void TradeRequestFailed(const EQApplicationPacket* app);
void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app);
void TraderUpdate(uint16 slot_id,uint32 trader_id);
void FinishTrade(Mob* with, ServerPacket* qspack = nullptr, bool finalizer = false);
void SendZonePoints();
void SendZonePoints();
void SendBuyerResults(char *SearchQuery, uint32 SearchID);
void ShowBuyLines(const EQApplicationPacket *app);
@@ -248,7 +248,7 @@ public:
void UpdateBuyLine(const EQApplicationPacket *app);
void BuyerItemSearch(const EQApplicationPacket *app);
void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; }
const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); }
const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); }
void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
virtual bool Process();
@@ -260,7 +260,7 @@ public:
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...);
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
void Message(uint32 type, const char* message, ...);
void QuestJournalledMessage(const char *npcname, const char* message);
void QuestJournalledMessage(const char *npcname, const char* message);
void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber);
void SendSound();
void LearnRecipe(uint32 recipeID);
@@ -289,13 +289,13 @@ public:
inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; }
inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); }
void WorldKick();
inline uint8 GetAnon() const { return m_pp.anon; }
inline uint8 GetAnon() const { return m_pp.anon; }
inline PlayerProfile_Struct& GetPP() { return m_pp; }
inline ExtendedProfile_Struct& GetEPP() { return m_epp; }
inline Inventory& GetInv() { return m_inv; }
inline const Inventory& GetInv() const { return m_inv; }
inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; }
inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; }
inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; }
inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; }
bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel);
@@ -323,7 +323,7 @@ public:
inline void SetBaseClass(uint32 i) { m_pp.class_=i; }
inline void SetBaseRace(uint32 i) { m_pp.race=i; }
inline void SetBaseGender(uint32 i) { m_pp.gender=i; }
inline void SetDeity(uint32 i) {m_pp.deity=i;deity=i;}
inline void SetDeity(uint32 i) {m_pp.deity=i;deity=i;}
inline uint8 GetLevel2() const { return m_pp.level2; }
inline uint16 GetBaseRace() const { return m_pp.race; }
@@ -346,11 +346,11 @@ public:
int32 CalcMaxMana();
int32 CalcBaseMana();
const int32& SetMana(int32 amount);
int32 CalcManaRegenCap();
int32 CalcManaRegenCap();
void ServerFilter(SetServerFilter_Struct* filter);
void BulkSendTraderInventory(uint32 char_id);
void SendSingleTraderItem(uint32 char_id, int uniqueid);
void SendSingleTraderItem(uint32 char_id, int uniqueid);
void BulkSendMerchantInventory(int merchant_id, int npcid);
inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; }
@@ -392,19 +392,19 @@ public:
int16 GetMaxStat() const;
int16 GetMaxResist() const;
int16 GetMaxSTR() const;
int16 GetMaxSTA() const;
int16 GetMaxDEX() const;
int16 GetMaxAGI() const;
int16 GetMaxINT() const;
int16 GetMaxWIS() const;
int16 GetMaxCHA() const;
int16 GetMaxMR() const;
int16 GetMaxPR() const;
int16 GetMaxDR() const;
int16 GetMaxCR() const;
int16 GetMaxFR() const;
int16 GetMaxCorrup() const;
int16 GetMaxSTR() const;
int16 GetMaxSTA() const;
int16 GetMaxDEX() const;
int16 GetMaxAGI() const;
int16 GetMaxINT() const;
int16 GetMaxWIS() const;
int16 GetMaxCHA() const;
int16 GetMaxMR() const;
int16 GetMaxPR() const;
int16 GetMaxDR() const;
int16 GetMaxCR() const;
int16 GetMaxFR() const;
int16 GetMaxCorrup() const;
inline uint8 GetBaseSTR() const { return m_pp.STR; }
inline uint8 GetBaseSTA() const { return m_pp.STA; }
inline uint8 GetBaseCHA() const { return m_pp.CHA; }
@@ -502,8 +502,8 @@ public:
//This gets the skill value of the item type equiped in the Primary Slot
uint16 GetPrimarySkillValue();
bool Flurry();
bool Rampage();
bool Flurry();
bool Rampage();
void DurationRampage(uint32 duration);
inline uint32 GetEXP() const { return m_pp.exp; }
@@ -526,17 +526,17 @@ public:
void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp);
void SendLeadershipEXPUpdate();
bool IsLeadershipEXPOn();
inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; }
inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; }
int GroupLeadershipAAHealthEnhancement();
int GroupLeadershipAAManaEnhancement();
int GroupLeadershipAAHealthRegeneration();
int GroupLeadershipAAOffenseEnhancement();
void InspectBuffs(Client* Inspector, int Rank);
uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); }
uint32 GetGroupPoints() { return(m_pp.group_leadership_points); }
uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); }
uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); }
uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); }
uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); }
uint32 GetGroupPoints() { return(m_pp.group_leadership_points); }
uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); }
uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); }
uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); }
virtual void SetLevel(uint8 set_level, bool command = false);
void GoToBind(uint8 bindnum = 0);
void GoToSafeCoords(uint16 zone_id, uint16 instance_id);
@@ -561,14 +561,14 @@ public:
inline const int32 GetInstanceID() const { return zone->GetInstanceID(); }
FACTION_VALUE GetReverseFactionCon(Mob* iOther);
FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc);
FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc);
int32 GetCharacterFactionLevel(int32 faction_id);
int32 GetModCharacterFactionLevel(int32 faction_id);
int32 GetModCharacterFactionLevel(int32 faction_id);
bool HatedByClass(uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction);
char* BuildFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp);
char* BuildFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp);
void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity);
void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp);
void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp);
int16 GetRawItemAC();
uint16 GetCombinedAC_TEST();
@@ -592,7 +592,7 @@ public:
void SendGuildChannel();
void SendGuildSpawnAppearance();
void SendGuildMembers();
void SendGuildList();
void SendGuildList();
void SendGuildJoin(GuildJoin_Struct* gj);
void RefreshGuildInfo();
@@ -602,7 +602,7 @@ public:
void SendEnduranceUpdate();
uint8 GetFace() const { return m_pp.face; }
void WhoAll(Who_All_Struct* whom);
void FriendsWho(char *FriendsString);
void FriendsWho(char *FriendsString);
void Stun(int duration);
void UnStun();
@@ -639,7 +639,7 @@ public:
void CheckSongSkillIncrease(uint16 spell_id);
bool CheckIncreaseSkill(SkillType skillid, Mob *against_who, int chancemodi = 0);
void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill);
void SetLanguageSkill(int langid, int value);
void SetLanguageSkill(int langid, int value);
void SetHoTT(uint32 mobid);
void ShowSkillsWindow();
void SendStatsWindow(Client* client, bool use_window);
@@ -679,7 +679,7 @@ public:
bool LootToStack(uint32 itemid);
void SetFeigned(bool in_feigned);
/// this cures timing issues cuz dead animation isn't done but server side feigning is?
inline bool GetFeigned() const { return(feigned); }
inline bool GetFeigned() const { return(feigned); }
EQStreamInterface* Connection() { return eqs; }
#ifdef PACKET_PROFILER
void DumpPacketProfile() { if(eqs) eqs->DumpPacketProfile(); }
@@ -713,22 +713,22 @@ public:
inline PTimerList &GetPTimers() { return(p_timers); }
//AA Methods
void SendAAList();
void ResetAA();
void SendAA(uint32 id, int seq=1);
void SendPreviousAA(uint32 id, int seq=1);
void BuyAA(AA_Action* action);
void SendAAList();
void ResetAA();
void SendAA(uint32 id, int seq=1);
void SendPreviousAA(uint32 id, int seq=1);
void BuyAA(AA_Action* action);
//this function is used by some AA stuff
void MemorizeSpell(uint32 slot,uint32 spellid,uint32 scribing);
void SetAATitle(const char *Title);
void SetTitleSuffix(const char *txt);
inline uint32 GetMaxAAXP(void) const { return max_AAXP; }
inline uint32 GetAAXP() const { return m_pp.expAA; }
inline uint32 GetAAXP() const { return m_pp.expAA; }
void SendAAStats();
void SendAATable();
void SendAATimers();
int GetAATimerID(aaID activate);
int CalcAAReuseTimer(const AA_DBAction *caa);
int GetAATimerID(aaID activate);
int CalcAAReuseTimer(const AA_DBAction *caa);
void ActivateAA(aaID activate);
void SendAATimer(uint32 ability, uint32 begin, uint32 end);
void EnableAAEffect(aaEffectType type, uint32 duration = 0);
@@ -745,7 +745,7 @@ public:
// Item methods
uint32 NukeItem(uint32 itemnum, uint8 where_to_check =
(invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor));
(invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor));
void SetTint(int16 slot_id, uint32 color);
void SetTint(int16 slot_id, Color_Struct& color);
void SetMaterial(int16 slot_id, uint32 item_id);
@@ -770,7 +770,7 @@ public:
void SendLootItemInPacket(const ItemInst* inst, int16 slot_id);
void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type);
bool IsValidSlot(uint32 slot);
bool IsBankSlot(uint32 slot);
bool IsBankSlot(uint32 slot);
inline bool IsTrader() const { return(Trader); }
inline bool IsBuyer() const { return(Buyer); }
@@ -786,14 +786,14 @@ public:
bool CheckTradeLoreConflict(Client* other);
void LinkDead();
void Insight(uint32 t_id);
bool CheckDoubleAttack(bool tripleAttack = false);
bool CheckDoubleAttack(bool tripleAttack = false);
//remove charges/multiple objects from inventory:
//bool DecreaseByType(uint32 type, uint8 amt);
bool DecreaseByID(uint32 type, uint8 amt);
uint8 SlotConvert2(uint8 slot); //Maybe not needed.
void Escape(); //AA Escape
void RemoveNoRent(bool client_update = true);
void RemoveNoRent(bool client_update = true);
void RemoveDuplicateLore(bool client_update = true);
void MoveSlotNotAllowed(bool client_update = true);
virtual void RangedAttack(Mob* other);
@@ -819,9 +819,9 @@ public:
void SendDisciplineUpdate();
bool UseDiscipline(uint32 spell_id, uint32 target);
bool CheckTitle(int titleset);
void EnableTitle(int titleset);
void RemoveTitle(int titleset);
bool CheckTitle(int titleset);
void EnableTitle(int titleset);
void RemoveTitle(int titleset);
#ifdef PACKET_UPDATE_MANAGER
inline UpdateManager *GetUpdateManager() { return(&update_manager); }
@@ -862,120 +862,87 @@ public:
void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...);
bool PendingTranslocate;
time_t TranslocateTime;
bool PendingSacrifice;
string SacrificeCaster;
struct Translocate_Struct PendingTranslocateData;
void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID);
bool PendingSacrifice;
string SacrificeCaster;
struct Translocate_Struct PendingTranslocateData;
void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID);
// Task System Methods
// Task System Methods
void LoadClientTaskState();
void RemoveClientTaskState();
void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1);
void SendTaskFailed(int TaskID, int TaskIndex);
void SendTaskComplete(int TaskIndex);
void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1);
void SendTaskFailed(int TaskID, int TaskIndex);
void SendTaskComplete(int TaskIndex);
inline void CancelTask(int TaskIndex) { if(taskstate) taskstate->CancelTask(this, TaskIndex); }
inline bool SaveTaskState()
{ return (taskmanager ? taskmanager->SaveClientState(this, taskstate) : false); }
inline bool SaveTaskState() { return (taskmanager ? taskmanager->SaveClientState(this, taskstate) : false); }
inline bool IsTaskStateLoaded() { return taskstate != nullptr; }
inline bool IsTaskActive(int TaskID)
{ return (taskstate ? taskstate->IsTaskActive(TaskID) : false); }
inline bool IsTaskActive(int TaskID) { return (taskstate ? taskstate->IsTaskActive(TaskID) : false); }
inline bool IsTaskActivityActive(int TaskID, int ActivityID)
{ return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); }
inline bool IsTaskActivityActive(int TaskID, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); }
inline ActivityState GetTaskActivityState(int index, int ActivityID)
{ return (taskstate ? taskstate->GetTaskActivityState(index, ActivityID) : ActivityHidden); }
inline ActivityState GetTaskActivityState(int index, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityState(index, ActivityID) : ActivityHidden); }
inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count)
{ if(taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count); }
inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count) { if(taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count); }
inline void ResetTaskActivity(int TaskID, int ActivityID)
{ if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); }
inline void ResetTaskActivity(int TaskID, int ActivityID) { if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); }
inline void UpdateTasksOnKill(int NPCTypeID)
{ if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); }
inline void UpdateTasksOnKill(int NPCTypeID) { if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); }
inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1)
{ if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); }
inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); }
inline void UpdateTasksOnExplore(int ExploreID)
{ if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); }
inline void UpdateTasksOnExplore(int ExploreID) { if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); }
inline bool UpdateTasksOnSpeakWith(int NPCTypeID)
{ if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; }
inline bool UpdateTasksOnSpeakWith(int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; }
inline bool UpdateTasksOnDeliver(uint32 *Items, int Cash, int NPCTypeID)
{ if(taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; }
inline bool UpdateTasksOnDeliver(uint32 *Items, int Cash, int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; }
inline void TaskSetSelector(Mob *mob, int TaskSetID)
{ if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); }
inline void TaskSetSelector(Mob *mob, int TaskSetID) { if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); }
inline void EnableTask(int TaskCount, int *TaskList)
{ if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); }
inline void EnableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); }
inline void DisableTask(int TaskCount, int *TaskList)
{ if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); }
inline void DisableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); }
inline bool IsTaskEnabled(int TaskID)
{ return (taskstate ? taskstate->IsTaskEnabled(TaskID) : false); }
inline bool IsTaskEnabled(int TaskID) { return (taskstate ? taskstate->IsTaskEnabled(TaskID) : false); }
inline void ProcessTaskProximities(float X, float Y, float Z)
{ if(taskstate) taskstate->ProcessTaskProximities(this, X, Y, Z); }
inline void ProcessTaskProximities(float X, float Y, float Z) { if(taskstate) taskstate->ProcessTaskProximities(this, X, Y, Z); }
inline void AssignTask(int TaskID, int NPCID)
{ if(taskstate) taskstate->AcceptNewTask(this, TaskID, NPCID); }
inline void AssignTask(int TaskID, int NPCID) { if(taskstate) taskstate->AcceptNewTask(this, TaskID, NPCID); }
inline int ActiveSpeakTask(int NPCID)
{ if(taskstate) return taskstate->ActiveSpeakTask(NPCID); else return 0; }
inline int ActiveSpeakTask(int NPCID) { if(taskstate) return taskstate->ActiveSpeakTask(NPCID); else return 0; }
inline int ActiveSpeakActivity(int NPCID, int TaskID)
{ if(taskstate) return taskstate->ActiveSpeakActivity(NPCID, TaskID); else return 0; }
inline int ActiveSpeakActivity(int NPCID, int TaskID) { if(taskstate) return taskstate->ActiveSpeakActivity(NPCID, TaskID); else return 0; }
inline void FailTask(int TaskID)
{ if(taskstate) taskstate->FailTask(this, TaskID); }
inline void FailTask(int TaskID) { if(taskstate) taskstate->FailTask(this, TaskID); }
inline int TaskTimeLeft(int TaskID)
{ return (taskstate ? taskstate->TaskTimeLeft(TaskID) : 0); }
inline int TaskTimeLeft(int TaskID) { return (taskstate ? taskstate->TaskTimeLeft(TaskID) : 0); }
inline int EnabledTaskCount(int TaskSetID)
{ return (taskstate ? taskstate->EnabledTaskCount(TaskSetID) : -1); }
inline int EnabledTaskCount(int TaskSetID) { return (taskstate ? taskstate->EnabledTaskCount(TaskSetID) : -1); }
inline int IsTaskCompleted(int TaskID)
{ return (taskstate ? taskstate->IsTaskCompleted(TaskID) : -1); }
inline int IsTaskCompleted(int TaskID) { return (taskstate ? taskstate->IsTaskCompleted(TaskID) : -1); }
inline void ShowClientTasks()
{ if(taskstate) taskstate->ShowClientTasks(this); }
inline void ShowClientTasks() { if(taskstate) taskstate->ShowClientTasks(this); }
inline void CancelAllTasks()
{ if(taskstate) taskstate->CancelAllTasks(this); }
inline void CancelAllTasks() { if(taskstate) taskstate->CancelAllTasks(this); }
inline int GetActiveTaskCount()
{ return (taskstate ? taskstate->GetActiveTaskCount() : 0); }
inline int GetActiveTaskCount() { return (taskstate ? taskstate->GetActiveTaskCount() : 0); }
inline int GetActiveTaskID(int index)
{ return (taskstate ? taskstate->GetActiveTaskID(index) : -1); }
inline int GetActiveTaskID(int index) { return (taskstate ? taskstate->GetActiveTaskID(index) : -1); }
inline int GetTaskStartTime(int index)
{ return (taskstate ? taskstate->GetTaskStartTime(index) : -1); }
inline int GetTaskStartTime(int index) { return (taskstate ? taskstate->GetTaskStartTime(index) : -1); }
inline bool IsTaskActivityCompleted(int index, int ActivityID)
{ return (taskstate ? taskstate->IsTaskActivityCompleted(index, ActivityID) : false); }
inline bool IsTaskActivityCompleted(int index, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityCompleted(index, ActivityID) : false); }
inline int GetTaskActivityDoneCount(int ClientTaskIndex, int ActivityID)
{ return (taskstate ? taskstate->GetTaskActivityDoneCount(ClientTaskIndex, ActivityID) :0); }
inline int GetTaskActivityDoneCount(int ClientTaskIndex, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCount(ClientTaskIndex, ActivityID) :0); }
inline int GetTaskActivityDoneCountFromTaskID(int TaskID, int ActivityID)
{ return (taskstate ? taskstate->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID) :0); }
inline int GetTaskActivityDoneCountFromTaskID(int TaskID, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID) :0); }
inline int ActiveTasksInSet(int TaskSet)
{ return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); }
inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); }
inline int CompletedTasksInSet(int TaskSet)
{ return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); }
inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); }
inline const EQClientVersion GetClientVersion() const { return ClientVersion; }
inline const uint32 GetClientVersionBit() const { return ClientVersionBit; }
@@ -1128,7 +1095,7 @@ public:
Timer* GetMercTimer() { return &merc_timer; };
const char* GetRacePlural(Client* client);
const char* GetClassPlural(Client* client);
void SendWebLink(const char* website);
void SendWebLink(const char* website);
bool StoreTurnInItems(Mob* with);
void DuplicateLoreMessage(uint32 ItemID);
@@ -1167,7 +1134,7 @@ protected:
friend class Mob;
void CalcItemBonuses(StatBonuses* newbon);
void AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug = false, bool isTribute = false);
int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat);
int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat);
void CalcEdibleBonuses(StatBonuses* newbon);
void CalcAABonuses(StatBonuses* newbon);
void ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon);
@@ -1219,22 +1186,22 @@ private:
void HandleTraderPriceUpdate(const EQApplicationPacket *app);
int16 CalcAC();
int16 GetACMit();
int16 GetACAvoid();
int16 CalcATK();
int CalcHaste();
int16 CalcAC();
int16 GetACMit();
int16 GetACAvoid();
int16 CalcATK();
int CalcHaste();
int16 CalcAlcoholPhysicalEffect();
int16 CalcSTR();
int16 CalcSTA();
int16 CalcDEX();
int16 CalcAGI();
int16 CalcINT();
int16 CalcWIS();
int16 CalcCHA();
int16 CalcAlcoholPhysicalEffect();
int16 CalcSTR();
int16 CalcSTA();
int16 CalcDEX();
int16 CalcAGI();
int16 CalcINT();
int16 CalcWIS();
int16 CalcCHA();
int16 CalcMR();
int16 CalcMR();
int16 CalcFR();
int16 CalcDR();
int16 CalcPR();
@@ -1253,13 +1220,13 @@ private:
uint32 pLastUpdate;
uint32 pLastUpdateWZ;
uint8 playeraction;
uint8 playeraction;
EQStreamInterface* eqs;
uint32 ip;
uint16 port;
CLIENT_CONN_STATUS client_state;
CLIENT_CONN_STATUS client_state;
uint32 character_id;
uint32 WID;
uint32 account_id;
@@ -1296,15 +1263,15 @@ private:
uint16 BoatID;
uint16 TrackingID;
uint16 CustomerID;
uint32 account_creation;
uint32 account_creation;
uint8 firstlogon;
uint32 mercid; // current merc
uint8 mercSlot; // selected merc slot
uint32 mercid; // current merc
uint8 mercSlot; // selected merc slot
bool Trader;
bool Buyer;
string BuyerWelcomeMessage;
bool AbilityTimer;
int Haste; //precalced value
int Haste; //precalced value
int32 max_end;
int32 cur_end;
@@ -1323,9 +1290,9 @@ private:
bool CanBeInZone();
void SendLogoutPackets();
bool AddPacket(const EQApplicationPacket *, bool);
bool AddPacket(EQApplicationPacket**, bool);
bool SendAllPackets();
bool AddPacket(const EQApplicationPacket *, bool);
bool AddPacket(EQApplicationPacket**, bool);
bool SendAllPackets();
LinkedList<CLIENTPACKET *> clientpackets;
//Zoning related stuff
@@ -1391,7 +1358,7 @@ private:
uint32 tribute_master_id;
FILE *SQL_log;
uint32 max_AAXP;
uint32 max_AAXP;
uint32 staminacount;
AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile
map<uint32,uint8> aa_points;
@@ -1404,7 +1371,7 @@ private:
int32 last_reported_mana;
int32 last_reported_endur;
unsigned int AggroCount; // How many mobs are aggro on us.
unsigned int AggroCount; // How many mobs are aggro on us.
unsigned int RestRegenHP;
unsigned int RestRegenMana;
@@ -1431,7 +1398,7 @@ private:
bool m_KnockBackExemption;
bool m_PortExemption;
bool m_SenseExemption;
std::map<uint32, uint32> alternate_currency;
std::map<uint32, uint32> alternate_currency;
//Connecting debug code.
enum { //connecting states, used for debugging only
@@ -1472,3 +1439,4 @@ private:
#include "parser.h"
#endif
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/features.h"
+11 -13
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef CLIENT_LOGS_H
@@ -60,5 +60,3 @@ extern ClientLogs client_logs;
#endif //CLIENT_LOGS
#endif
+13 -13
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "masterentity.h"
@@ -1319,7 +1319,7 @@ int16 Client::CalcINT() {
if(m_pp.intoxication)
{
int16 AlcINT = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1;
int16 AlcINT = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1;
if((AlcINT < (int)(0.2 * INT)))
INT = (int)(0.2f * (float)INT);
@@ -1348,7 +1348,7 @@ int16 Client::CalcWIS() {
if(m_pp.intoxication)
{
int16 AlcWIS = WIS - (int16)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1;
int16 AlcWIS = WIS - (int16)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1;
if((AlcWIS < (int)(0.2 * WIS)))
WIS = (int)(0.2f * (float)WIS);
+599 -599
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -223,8 +223,8 @@
void Handle_OP_AutoFire(const EQApplicationPacket *app);
void Handle_OP_Rewind(const EQApplicationPacket *app);
void Handle_OP_RaidCommand(const EQApplicationPacket *app);
void Handle_OP_Translocate(const EQApplicationPacket *app);
void Handle_OP_Sacrifice(const EQApplicationPacket *app);
void Handle_OP_Translocate(const EQApplicationPacket *app);
void Handle_OP_Sacrifice(const EQApplicationPacket *app);
void Handle_OP_AcceptNewTask(const EQApplicationPacket *app);
void Handle_OP_CancelTask(const EQApplicationPacket *app);
void Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app);
+31 -31
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
client_process.cpp:
Handles client login sequence and packets sent from client to zone
@@ -36,7 +36,7 @@
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#else
#include <pthread.h>
#include <sys/socket.h>
@@ -83,7 +83,7 @@ bool Client::Process() {
if(Connected() || IsLD())
{
// try to send all packets that weren't sent before
// try to send all packets that weren't sent before
if(!IsLD() && zoneinpacket_timer.Check()){
SendAllPackets();
}
@@ -258,7 +258,7 @@ bool Client::Process() {
AI_Process();
if (bindwound_timer.Check() && bindwound_target != 0) {
BindWound(bindwound_target, false);
BindWound(bindwound_target, false);
}
if(KarmaUpdateTimer)
@@ -409,7 +409,7 @@ bool Client::Process() {
{
entity_list.AEAttack(this, 30);
} else {
Attack(auto_attack_target, 13); // Kaiyodo - added attacking hand to arguments
Attack(auto_attack_target, 13); // Kaiyodo - added attacking hand to arguments
}
ItemInst *wpn = GetInv().GetItem(SLOT_PRIMARY);
TryWeaponProc(wpn, auto_attack_target, 13);
@@ -430,7 +430,7 @@ bool Client::Process() {
//triple attack: rangers, monks, warriors, berserkers over level 60
if((((GetClass() == MONK || GetClass() == WARRIOR || GetClass() == RANGER || GetClass() == BERSERKER)
&& GetLevel() >= 60) || SpecAttacks[SPECATK_TRIPLE])
&& CheckDoubleAttack(true))
&& CheckDoubleAttack(true))
{
tripleAttackSuccess = true;
Attack(auto_attack_target, 13, false);
@@ -793,7 +793,7 @@ void Client::OnDisconnect(bool hard_disconnect) {
MyRaid->MemberZoned(this);
if(this->IsClient()){
if(parse->PlayerHasQuestSub("EVENT_DISCONNECT")) {
if(parse->PlayerHasQuestSub("EVENT_DISCONNECT")) {
parse->EventPlayer(EVENT_DISCONNECT, this, "", 0);
}
}
@@ -968,7 +968,7 @@ void Client::BulkSendInventoryItems()
// LINKDEAD TRADE ITEMS
// If player went LD during a trade, they have items in the trade inventory
// slots. These items are now being put into their inventory (then queue up on cursor)
// slots. These items are now being put into their inventory (then queue up on cursor)
for (int16 trade_slot_id=3000; trade_slot_id<=3007; trade_slot_id++) {
const ItemInst* inst = m_inv[slot_id];
if (inst) {
@@ -982,7 +982,7 @@ void Client::BulkSendInventoryItems()
void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
const Item_Struct* handyitem = nullptr;
uint32 numItemSlots=80; //The max number of items passed in the transaction.
uint32 numItemSlots=80; //The max number of items passed in the transaction.
const Item_Struct *item;
std::list<MerchantList> merlist = zone->merchanttable[merchant_id];
std::list<MerchantList>::const_iterator itr;
@@ -1000,14 +1000,14 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
uint8 handychance = 0;
for(itr = merlist.begin();itr != merlist.end() && i<numItemSlots;itr++){
MerchantList ml = *itr;
if(GetLevel() < ml.level_required) {
continue;
}
if(GetLevel() < ml.level_required) {
continue;
}
int32 fac = merch ? merch->GetPrimaryFaction() : 0;
if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) {
continue;
}
int32 fac = merch ? merch->GetPrimaryFaction() : 0;
if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) {
continue;
}
handychance = MakeRandomInt(0, merlist.size() + tmp_merlist.size() - 1 );
@@ -1099,16 +1099,16 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
break;
default:
greet_id=MERCHANT_HANDY_ITEM4;
}
}
sprintf(handy_id,"%i",greet_id);
if(greet_id!=MERCHANT_GREETING)
Message_StringID(10,GENERIC_STRINGID_SAY,merch->GetCleanName(),handy_id,this->GetName(),handyitem->Name);
else
else
Message_StringID(10,GENERIC_STRINGID_SAY,merch->GetCleanName(),handy_id,this->GetName());
merch->CastToNPC()->FaceTarget(this->CastToMob());
}
}
// safe_delete_array(cpi);
}
@@ -1153,8 +1153,8 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
// corpse is in has shutdown since the rez spell was cast.
database.MarkCorpseAsRezzed(PendingRezzDBID);
_log(SPELLS__REZ, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i",
this->name, (uint16)spells[SpellID].base[0],
SpellID, ZoneID, InstanceID);
this->name, (uint16)spells[SpellID].base[0],
SpellID, ZoneID, InstanceID);
this->BuffFadeAll();
int SpellEffectDescNum = GetSpellEffectDescNum(SpellID);
@@ -1171,7 +1171,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
if(spells[SpellID].base[0] < 100 && spells[SpellID].base[0] > 0 && PendingRezzXP > 0)
{
SetEXP(((int)(GetEXP()+((float)((PendingRezzXP / 100) * spells[SpellID].base[0])))),
GetAAXP(),true);
GetAAXP(),true);
}
else if (spells[SpellID].base[0] == 100 && PendingRezzXP > 0) {
SetEXP((GetEXP() + PendingRezzXP), GetAAXP(), true);
@@ -1539,7 +1539,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
// now we should have a from_bucket, a to_bucket, an amount_to_take
// and an amount_to_add
// now we actually take it from the from bucket. if there's an error
// now we actually take it from the from bucket. if there's an error
// with the destination slot, they lose their money
*from_bucket -= amount_to_take;
// why are intentionally inducing a crash here rather than letting the code attempt to stumble on?
@@ -1614,8 +1614,8 @@ void Client::OPGMTraining(const EQApplicationPacket *app)
if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2)
return;
SkillType sk;
for (sk = _1H_BLUNT; sk <= HIGHEST_SKILL; sk = (SkillType)(sk+1)) {
SkillType sk;
for (sk = _1H_BLUNT; sk <= HIGHEST_SKILL; sk = (SkillType)(sk+1)) {
if(sk == TINKERING && GetRace() != GNOME) {
gmtrain->skills[sk] = 0; //Non gnomes can't tinker!
} else {
@@ -2083,7 +2083,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
if (corpse && corpse->IsCorpse()) {
_log(SPELLS__REZ, "Hover Rez in zone %s for corpse %s",
zone->GetShortName(), PendingRezzCorpseName.c_str());
zone->GetShortName(), PendingRezzCorpseName.c_str());
_log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed.");
+528 -522
View File
File diff suppressed because it is too large Load Diff
+16 -16
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
@@ -32,12 +32,12 @@ typedef void (*CmdFuncPtr)(Client *,const Seperator *);
// this is a command list item
/*struct cl_struct
{
char *command[CMDALIASES]; // the command(s)
char *desc; // description of command
CmdFuncPtr function; // the function to call
int access; // the required 'status' level
char *command[CMDALIASES]; // the command(s)
char *desc; // description of command
CmdFuncPtr function; // the function to call
int access; // the required 'status' level
struct cl_struct *next; // linked list
struct cl_struct *next; // linked list
};
extern struct cl_struct *commandlist; // the head of the list
+117 -117
View File
@@ -156,16 +156,16 @@ struct Buffs_Struct {
uint16 spellid;
uint8 casterlevel;
uint16 casterid; // Maybe change this to a pointer sometime, but gotta make sure it's 0'd when it no longer points to anything
char caster_name[64];
int32 ticsremaining;
uint32 counters;
char caster_name[64];
int32 ticsremaining;
uint32 counters;
uint32 numhits; //the number of physical hits this buff can take before it fades away, lots of druid armor spells take advantage of this mixed with powerful effects
uint32 melee_rune;
uint32 magic_rune;
uint8 deathSaveSuccessChance;
uint8 deathsaveCasterAARank;
bool persistant_buff;
bool client; //True if the caster is a client
bool persistant_buff;
bool client; //True if the caster is a client
bool UpdateClient;
};
@@ -224,14 +224,14 @@ struct StatBonuses {
DmgShieldType DamageShieldType;
int SpellDamageShield;
int SpellShield;
int ReverseDamageShield; // this is damage done to the mob when it attacks
int ReverseDamageShield; // this is damage done to the mob when it attacks
uint16 ReverseDamageShieldSpellID;
DmgShieldType ReverseDamageShieldType;
int movementspeed;
int16 haste;
int16 hastetype2;
int16 hastetype3;
int16 inhibitmelee;
int16 inhibitmelee;
float AggroRange; // when calculate just replace original value with this
float AssistRange;
int16 skillmod[HIGHEST_SKILL+1];
@@ -245,65 +245,65 @@ struct StatBonuses {
int8 hatemod;
int32 EnduranceReduction;
int16 StrikeThrough; // PoP: Strike Through %
int16 MeleeMitigation; //i = Shielding
int16 CriticalHitChance[HIGHEST_SKILL+2]; //i
int16 CriticalSpellChance; //i
int16 SpellCritDmgIncrease; //i
int16 DotCritDmgIncrease; //i
int16 CriticalHealChance; //i
int16 CriticalHealOverTime; //i
int16 CriticalDoTChance; //i
int16 CrippBlowChance; //
int16 AvoidMeleeChance; //AvoidMeleeChance/10 == % chance i = Avoidance
int16 RiposteChance; //i
int16 DodgeChance; //i
int16 ParryChance; //i
int16 DualWieldChance; //i
int16 DoubleAttackChance; //i
int16 TripleAttackChance; //i
int16 ResistSpellChance; //i
int16 ResistFearChance; //i
bool Fearless; //i
bool IsFeared; //i
int16 StunResist; //i
int16 MeleeSkillCheck; //i
uint8 MeleeSkillCheckSkill;
int16 HitChance; //HitChance/15 == % increase i = Accuracy (Item: Accuracy)
int16 HitChanceEffect[HIGHEST_SKILL+2]; //Spell effect Chance to Hit, straight percent increase
int16 DamageModifier[HIGHEST_SKILL+2]; //i
int16 MinDamageModifier[HIGHEST_SKILL+2]; //i
int16 ProcChance; // ProcChance/10 == % increase i = CombatEffects
int16 ExtraAttackChance;
int16 StrikeThrough; // PoP: Strike Through %
int16 MeleeMitigation; //i = Shielding
int16 CriticalHitChance[HIGHEST_SKILL+2]; //i
int16 CriticalSpellChance; //i
int16 SpellCritDmgIncrease; //i
int16 DotCritDmgIncrease; //i
int16 CriticalHealChance; //i
int16 CriticalHealOverTime; //i
int16 CriticalDoTChance; //i
int16 CrippBlowChance; //
int16 AvoidMeleeChance; //AvoidMeleeChance/10 == % chance i = Avoidance
int16 RiposteChance; //i
int16 DodgeChance; //i
int16 ParryChance; //i
int16 DualWieldChance; //i
int16 DoubleAttackChance; //i
int16 TripleAttackChance; //i
int16 ResistSpellChance; //i
int16 ResistFearChance; //i
bool Fearless; //i
bool IsFeared; //i
int16 StunResist; //i
int16 MeleeSkillCheck; //i
uint8 MeleeSkillCheckSkill;
int16 HitChance; //HitChance/15 == % increase i = Accuracy (Item: Accuracy)
int16 HitChanceEffect[HIGHEST_SKILL+2]; //Spell effect Chance to Hit, straight percent increase
int16 DamageModifier[HIGHEST_SKILL+2]; //i
int16 MinDamageModifier[HIGHEST_SKILL+2]; //i
int16 ProcChance; // ProcChance/10 == % increase i = CombatEffects
int16 ExtraAttackChance;
int16 DoTShielding;
int16 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger)
int16 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger)
uint16 DeathSave[4]; // Death Pact [0](value = 1 partial 2 = full) [1]=slot [2]=LvLimit [3]=HealAmt
int16 FlurryChance;
int16 FlurryChance;
int16 Accuracy[HIGHEST_SKILL+2]; //Accuracy/15 == % increase [Spell Effect: Accuracy)
int16 HundredHands; //extra haste, stacks with all other haste i
int16 HundredHands; //extra haste, stacks with all other haste i
int8 MeleeLifetap; //i
int16 HealRate; // Spell effect that influences effectiveness of heals
int16 MaxHPChange; // Spell Effect
int16 SkillDmgTaken[HIGHEST_SKILL+2]; // All Skills + -1
int32 HealAmt; // Item Effect
int32 SpellDmg; // Item Effect
int32 Clairvoyance; // Item Effect
int16 DSMitigation; // Item Effect
int16 DSMitigationOffHand; // Lowers damage shield from off hand attacks.
uint32 SpellTriggers[MAX_SPELL_TRIGGER]; // Innate/Spell/Item Spells that trigger when you cast
uint32 SpellOnKill[MAX_SPELL_TRIGGER*3]; // Chance to proc after killing a mob
uint32 SpellOnDeath[MAX_SPELL_TRIGGER*2]; // Chance to have effect cast when you die
int16 CritDmgMob[HIGHEST_SKILL+2]; // All Skills + -1
int16 SkillReuseTime[HIGHEST_SKILL+1]; // Reduces skill timers
int16 SkillDamageAmount[HIGHEST_SKILL+2]; // All Skills + -1
int16 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon
uint16 ItemManaRegenCap; // Increases the amount of mana you have can over the cap(aa effect)
int16 GravityEffect; // Indictor of spell effect
int16 HealRate; // Spell effect that influences effectiveness of heals
int16 MaxHPChange; // Spell Effect
int16 SkillDmgTaken[HIGHEST_SKILL+2]; // All Skills + -1
int32 HealAmt; // Item Effect
int32 SpellDmg; // Item Effect
int32 Clairvoyance; // Item Effect
int16 DSMitigation; // Item Effect
int16 DSMitigationOffHand; // Lowers damage shield from off hand attacks.
uint32 SpellTriggers[MAX_SPELL_TRIGGER]; // Innate/Spell/Item Spells that trigger when you cast
uint32 SpellOnKill[MAX_SPELL_TRIGGER*3]; // Chance to proc after killing a mob
uint32 SpellOnDeath[MAX_SPELL_TRIGGER*2]; // Chance to have effect cast when you die
int16 CritDmgMob[HIGHEST_SKILL+2]; // All Skills + -1
int16 SkillReuseTime[HIGHEST_SKILL+1]; // Reduces skill timers
int16 SkillDamageAmount[HIGHEST_SKILL+2]; // All Skills + -1
int16 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon
uint16 ItemManaRegenCap; // Increases the amount of mana you have can over the cap(aa effect)
int16 GravityEffect; // Indictor of spell effect
bool AntiGate; // spell effect that prevents gating
bool MagicWeapon; // spell effect that makes weapon magical
int16 IncreaseBlockChance; // overall block chance modifier
uint16 PersistantCasting; // chance to continue casting through a stun
int XPRateMod; //i
int XPRateMod; //i
int HPPercCap; //Spell effect that limits you to being healed/regening beyond a % of your max
int ManaPercCap; // ^^
int EndPercCap; // ^^
@@ -311,19 +311,19 @@ struct StatBonuses {
//uint16 BlockSpellEffect[EFFECT_COUNT]; // Prevents spells with certain effects from landing on you *no longer used
bool ImmuneToFlee; // Bypass the fleeing flag
uint16 VoiceGraft; // Stores the ID of the mob with which to talk through
uint16 SpellProcChance; // chance to proc from sympathetic spell effects
uint16 SpellProcChance; // chance to proc from sympathetic spell effects
uint16 CharmBreakChance; // chance to break charm
int16 SongRange; // increases range of beneficial bard songs
uint16 HPToManaConvert; // Uses HP to cast spells at specific conversion
uint16 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have.
int16 SongRange; // increases range of beneficial bard songs
uint16 HPToManaConvert; // Uses HP to cast spells at specific conversion
uint16 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have.
bool NegateEffects; // Check if you contain a buff with negate effect. (only spellbonuses)
int16 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage
uint16 NegateAttacks[2]; // 0 = bool HasEffect 1 = Buff Slot
int16 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage
uint16 NegateAttacks[2]; // 0 = bool HasEffect 1 = Buff Slot
uint16 MitigateMeleeRune[2]; // 0 = Mitigation value 1 = Buff Slot
uint16 MitigateSpellRune[2]; // 0 = Mitigation value 1 = Buff Slot
uint16 ManaAbsorbPercentDamage[2]; // 0 = Mitigation value 1 = Buff Slot
int16 ShieldBlock; // Chance to Shield Block
int16 BlockBehind; // Chance to Block Behind (with our without shield)
int16 ShieldBlock; // Chance to Shield Block
int16 BlockBehind; // Chance to Block Behind (with our without shield)
//bool AbsorbMagicAtt; // Magic Rune *Need to be implemented for NegateEffect
//bool MeleeRune; // Melee Rune *Need to be implemented for NegateEffect
@@ -336,51 +336,51 @@ struct StatBonuses {
int16 DoubleSpecialAttack; // Chance to to perform a double special attack (ie flying kick 2x)
int16 SpecialAttackKBProc[2]; // Chance to to do a knockback from special attacks. (0 = chance 1 = Skill)
uint8 FrontalStunResist; // Chance to resist a frontal stun
int16 BindWound; // Increase amount of HP by percent.
int16 MaxBindWound; // Increase max amount of HP you can bind wound.
int16 ChannelChanceSpells; // Modify chance to channel a spell.
int16 ChannelChanceItems; // Modify chance to channel a items.
int16 BindWound; // Increase amount of HP by percent.
int16 MaxBindWound; // Increase max amount of HP you can bind wound.
int16 ChannelChanceSpells; // Modify chance to channel a spell.
int16 ChannelChanceItems; // Modify chance to channel a items.
uint8 SeeInvis; // See Invs.
uint8 TripleBackstab; // Chance to triple backstab
bool FrontalBackstabMinDmg; // Allow frontal backstabs for min damage
uint8 FrontalBackstabChance; // Chance to backstab from the front for full damage
uint8 FrontalBackstabChance; // Chance to backstab from the front for full damage
uint8 ConsumeProjectile; // Chance to not consume arrow.
uint8 ForageAdditionalItems; // Chance to forage another item.
uint8 SalvageChance; // Chance to salvage a tradeskill components on fail.
uint16 ArcheryDamageModifier; // Increase Archery Damage by percent
uint8 ForageAdditionalItems; // Chance to forage another item.
uint8 SalvageChance; // Chance to salvage a tradeskill components on fail.
uint16 ArcheryDamageModifier; // Increase Archery Damage by percent
bool SecondaryDmgInc; // Allow off hand weapon to recieve damage bonus.
uint16 GiveDoubleAttack; // Allow classes to double attack with a specified chance.
int16 SlayUndead[2]; // Allow classes to do extra damage verse undead.(base1 = rate, base2 = damage mod)
int16 PetCriticalHit; // Allow pets to critical hit with % value.
int16 PetCriticalHit; // Allow pets to critical hit with % value.
int16 PetAvoidance; // Pet avoidance chance.
int16 CombatStability; // Melee damage mitigation.
int16 GiveDoubleRiposte[3]; // 0=Regular Chance, 1=Skill Attack Chance, 2=Skill
int16 CombatStability; // Melee damage mitigation.
int16 GiveDoubleRiposte[3]; // 0=Regular Chance, 1=Skill Attack Chance, 2=Skill
uint16 RaiseSkillCap[2]; // Raise a specific skill cap (1 = value, 2=skill)
int16 Ambidexterity; // Increase chance to duel wield by adding bonus 'skill'.
int16 PetMaxHP; // Increase the max hp of your pet.
int16 PetFlurry; // Chance for pet to flurry.
int16 Ambidexterity; // Increase chance to duel wield by adding bonus 'skill'.
int16 PetMaxHP; // Increase the max hp of your pet.
int16 PetFlurry; // Chance for pet to flurry.
uint8 MasteryofPast; // Can not fizzle spells below this level specified in value.
bool GivePetGroupTarget; // All pets to recieve group buffs. (Pet Affinity)
int16 RootBreakChance; // Chance root will break;
int16 UnfailingDivinity; // Improves chance that DI will fire + increase partial heal.
int16 ItemHPRegenCap; // Increase item regen cap.
int16 SEResist[MAX_RESISTABLE_EFFECTS*2]; // Resist chance by specific spell effects.
int16 OffhandRiposteFail; // chance for opponent to fail riposte with offhand attack.
int16 UnfailingDivinity; // Improves chance that DI will fire + increase partial heal.
int16 ItemHPRegenCap; // Increase item regen cap.
int16 SEResist[MAX_RESISTABLE_EFFECTS*2]; // Resist chance by specific spell effects.
int16 OffhandRiposteFail; // chance for opponent to fail riposte with offhand attack.
int16 ItemATKCap; // Raise item attack cap
int32 FinishingBlow[2]; // Chance to do a finishing blow for specified damage amount.
int32 FinishingBlow[2]; // Chance to do a finishing blow for specified damage amount.
uint16 FinishingBlowLvl[2]; // Sets max level an NPC can be affected by FB. (base1 = lv, base2= ???)
};
typedef struct
{
uint16 spellID;
uint16 chance;
uint16 base_spellID;
uint16 spellID;
uint16 chance;
uint16 base_spellID;
} tProc;
struct Shielders_Struct {
uint32 shielder_id;
uint16 shielder_bonus;
uint32 shielder_id;
uint16 shielder_bonus;
};
//eventually turn this into a typedef and
@@ -444,44 +444,44 @@ class Mob;
class Trade
{
public:
Trade(Mob* in_owner);
virtual ~Trade();
Trade(Mob* in_owner);
virtual ~Trade();
void Reset();
void SetTradeCash(uint32 in_pp, uint32 in_gp, uint32 in_sp, uint32 in_cp);
void Reset();
void SetTradeCash(uint32 in_pp, uint32 in_gp, uint32 in_sp, uint32 in_cp);
// Initiate a trade with another mob
// Also puts other mob into trader mode with this mob
void Start(uint32 mob_id, bool initiate_with=true);
// Initiate a trade with another mob
// Also puts other mob into trader mode with this mob
void Start(uint32 mob_id, bool initiate_with=true);
// Mob the owner is trading with
Mob* With();
// Mob the owner is trading with
Mob* With();
// Add item from cursor slot to trade bucket (automatically does bag data too)
void AddEntity(uint16 from_slot_id, uint16 trade_slot_id);
// Add item from cursor slot to trade bucket (automatically does bag data too)
void AddEntity(uint16 from_slot_id, uint16 trade_slot_id);
// Audit trade
void LogTrade();
// Audit trade
void LogTrade();
// Debug only method
#if (EQDEBUG >= 9)
void DumpTrade();
#endif
// Debug only method
#if (EQDEBUG >= 9)
void DumpTrade();
#endif
public:
// Object state
TradeState state;
int32 pp;
int32 gp;
int32 sp;
int32 cp;
// Object state
TradeState state;
int32 pp;
int32 gp;
int32 sp;
int32 cp;
private:
// Send item data for trade item to other person involved in trade
void SendItemData(const ItemInst* inst, int16 dest_slot_id);
// Send item data for trade item to other person involved in trade
void SendItemData(const ItemInst* inst, int16 dest_slot_id);
uint32 with_id;
Mob* owner;
uint32 with_id;
Mob* owner;
};
#endif
+45 -44
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -38,7 +38,7 @@ extern EntityList entity_list;
extern WorldServer worldserver;
Doors::Doors(const Door* door)
: close_timer(5000)
: close_timer(5000)
{
db_id = door->db_id;
door_id = door->door_id;
@@ -76,7 +76,7 @@ Doors::Doors(const Door* door)
}
Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype, uint16 dsize)
: close_timer(5000)
: close_timer(5000)
{
db_id = database.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
door_id = database.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
@@ -120,8 +120,8 @@ Doors::~Doors()
bool Doors::Process()
{
if(close_timer.Enabled() && close_timer.Check() && IsDoorOpen())
{
if(close_timer.Enabled() && close_timer.Check() && IsDoorOpen())
{
if (opentype == 40 || GetTriggerType() == 1)
{
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
@@ -135,7 +135,7 @@ bool Doors::Process()
triggered=false;
close_timer.Disable();
SetOpenState(false);
}
}
return true;
}
@@ -146,7 +146,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
_log(DOORS__INFO, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param);
_log(DOORS__INFO, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading);
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer;
md->doorid = door_id;
/////////////////////////////////////////////////////////////////
@@ -260,7 +260,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
}
// a key is required or the door is locked but can be picked or both
sender->Message(4, "This is locked..."); // debug spam - should probably go
if(sender->GetGM()) // GM can always open locks - should probably be changed to require a key
if(sender->GetGM()) // GM can always open locks - should probably be changed to require a key
{
sender->Message_StringID(4,DOORS_GM);
if(!IsDoorOpen() || (opentype == 58))
@@ -413,7 +413,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
}
}
if(((opentype == 57) || (opentype == 58)) && (strncmp(dest_zone, "NONE", strlen("NONE")) != 0))
if(((opentype == 57) || (opentype == 58)) && (strncmp(dest_zone, "NONE", strlen("NONE")) != 0))
{ // Teleport door!
if (( strncmp(dest_zone,zone_name,strlen(zone_name)) == 0) && (!keyneeded))
{
@@ -558,23 +558,23 @@ void Doors::ToggleState(Mob *sender)
}
void Doors::DumpDoor(){
LogFile->write(EQEMuLog::Debug,
"db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f",
db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading);
LogFile->write(EQEMuLog::Debug,
LogFile->write(EQEMuLog::Debug,
"db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f",
db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading);
LogFile->write(EQEMuLog::Debug,
"opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s",
opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed");
LogFile->write(EQEMuLog::Debug,
"dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f",
dest_zone, dest_x, dest_y, dest_z, dest_heading);
opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed");
LogFile->write(EQEMuLog::Debug,
"dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f",
dest_zone, dest_x, dest_y, dest_z, dest_heading);
}
int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL_RES *result;
MYSQL_ROW row;
query = new char[256];
sprintf(query, "SELECT MAX(id), count(*) FROM doors WHERE zone='%s' AND (version=%u OR version=-1)", zone_name, version);
if (RunQuery(query, strlen(query), errbuf, &result)) {
@@ -604,11 +604,11 @@ int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 v
int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 oMaxID = 0;
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL_RES *result;
MYSQL_ROW row;
query = new char[256];
sprintf(query, "SELECT MAX(id) FROM doors WHERE zone='%s' AND version=%u", zone_name, version);
if (RunQuery(query, strlen(query), errbuf, &result)) {
@@ -635,11 +635,11 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 oMaxID = 0;
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL_RES *result;
MYSQL_ROW row;
query = new char[256];
sprintf(query, "SELECT MAX(doorid) FROM doors WHERE zone='%s' AND (version=%u OR version=-1)", zone_name, version);
if (RunQuery(query, strlen(query), errbuf, &result)) {
@@ -667,9 +667,9 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) {
LogFile->write(EQEMuLog::Status, "Loading Doors from database...");
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
// Door tmpDoor;
MakeAnyLenString(&query, "SELECT id,doorid,zone,name,pos_x,pos_y,pos_z,heading,"
@@ -700,12 +700,12 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
into[r].nokeyring = atoi(row[12]);
into[r].trigger_door = atoi(row[13]);
into[r].trigger_type = atoi(row[14]);
strn0cpy(into[r].dest_zone, row[15], 32);
strn0cpy(into[r].dest_zone, row[15], 32);
into[r].dest_instance_id = atoi(row[16]);
into[r].dest_x = (float) atof(row[17]);
into[r].dest_y = (float) atof(row[18]);
into[r].dest_z = (float) atof(row[19]);
into[r].dest_heading = (float) atof(row[20]);
into[r].dest_x = (float) atof(row[17]);
into[r].dest_y = (float) atof(row[18]);
into[r].dest_z = (float) atof(row[19]);
into[r].dest_heading = (float) atof(row[20]);
into[r].door_param=atoi(row[21]);
into[r].invert_state=atoi(row[22]);
into[r].incline=atoi(row[23]);
@@ -788,3 +788,4 @@ void Doors::CreateDatabaseEntry()
}
database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), GetX(), GetY(), GetZ(), GetHeading(), GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize());
}
+20 -20
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "masterentity.h"
@@ -43,8 +43,8 @@ float Client::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
int32 Client::Additional_SpellDmg(uint16 spell_id, bool bufftick)
{
int32 spell_dmg = 0;
spell_dmg += GetFocusEffect(focusFF_Damage_Amount, spell_id);
spell_dmg += GetFocusEffect(focusSpellDamage, spell_id);
spell_dmg += GetFocusEffect(focusFF_Damage_Amount, spell_id);
spell_dmg += GetFocusEffect(focusSpellDamage, spell_id);
//For DOTs you need to apply the damage over the duration of the dot to each tick (this is how live did it)
if (bufftick){
@@ -89,8 +89,8 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
if (tt == ST_UndeadAE || tt == ST_Undead || tt == ST_Summoned) {
//undead/summoned spells
modifier += GetFocusEffect(focusImprovedUndeadDamage, spell_id);
} else {
//damage spells.
} else {
//damage spells.
modifier += GetFocusEffect(focusImprovedDamage, spell_id);
modifier += GetFocusEffect(focusSpellEffectiveness, spell_id);
modifier += GetFocusEffect(focusImprovedDamage2, spell_id);
@@ -103,12 +103,12 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
}
//This adds the extra damage from the AA Unholy Touch, 450 per level to the AA Improved Harm TOuch.
if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch
if (spell_id == SPELL_IMP_HARM_TOUCH) { //Improved Harm Touch
value -= GetAA(aaUnholyTouch) * 450; //Unholy Touch
}
// This adds the extra damage for the AA's Consumption of the Soul and Improved Consumption of the Soul, 200 per level to the AA Leech Curse for Shadowknights.
if (spell_id == SPELL_LEECH_TOUCH) { //Leech Touch
if (spell_id == SPELL_LEECH_TOUCH) { //Leech Touch
value -= GetAA(aaConsumptionoftheSoul) * 200; //Consumption of the Soul
value -= GetAA(aaImprovedConsumptionofSoul) * 200; //Improved Consumption of the Soul
}
@@ -138,7 +138,7 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
ratio += RuleI(Spells, WizCritRatio);
}
if(aabonuses.SpellCritDmgIncrease > 0) // wizards get an additional bonus
ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225%
ratio += aabonuses.SpellCritDmgIncrease * 1.5; //108%, 115%, 124%, close to Graffe's 207%, 215%, & 225%
}
//Improved Harm Touch is a guaranteed crit if you have at least one level of SCF.
@@ -235,8 +235,8 @@ int32 Client::Additional_Heal(uint16 spell_id)
{
int32 heal_amt = 0;
heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id);
heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id);
heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id);
heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id);
if (heal_amt){
int duration = CalcBuffDuration(this, this, spell_id);
+51 -51
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
//extends the parser to include perl
@@ -72,7 +72,7 @@ const char *QuestEventSubroutines[_LargestEventID] = {
"EVENT_PROXIMITY_SAY",
"EVENT_CAST",
"EVENT_SCALE_CALC",
"EVENT_ITEM_ENTERZONE",
"EVENT_ITEM_ENTERZONE",
"EVENT_TARGET_CHANGE",
"EVENT_HATE_LIST",
"EVENT_SPELL_EFFECT_CLIENT",
@@ -105,7 +105,7 @@ PerlembParser::PerlembParser(void) : Parser()
{
perl = nullptr;
eventQueueProcessing = false;
globalPlayerQuestLoaded = pQuestReadyToLoad;
globalPlayerQuestLoaded = pQuestReadyToLoad;
globalNPCQuestLoaded = nQuestReadyToLoad;
}
@@ -244,7 +244,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
bool isPlayerQuest = false;
bool isGlobalPlayerQuest = false;
bool isGlobalPlayerQuest = false;
bool isGlobalNPC = false;
bool isItemQuest = false;
bool isSpellQuest = false;
@@ -260,12 +260,12 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
{
if(!npcmob && mob) {
if(!iteminst) {
if(global) {
isGlobalPlayerQuest = true;
} else {
isPlayerQuest = true;
}
}
if(global) {
isGlobalPlayerQuest = true;
} else {
isPlayerQuest = true;
}
}
else
isItemQuest = true;
}
@@ -324,14 +324,14 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
LoadPlayerScript(zone->GetShortName());
}
}
else if(isGlobalPlayerQuest) {
packagename = "global_player";
else if(isGlobalPlayerQuest) {
packagename = "global_player";
if(!isloaded(packagename.c_str()))
{
LoadGlobalPlayerScript();
}
}
}
else
{
packagename = "spell_effect_";
@@ -350,16 +350,16 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
int charid = 0;
if (mob && mob->IsClient()) { // some events like waypoint and spawn don't have a player involved
if (mob && mob->IsClient()) { // some events like waypoint and spawn don't have a player involved
charid = mob->CastToClient()->CharacterID();
} else {
if(npcmob)
{
charid = -npcmob->GetNPCTypeID(); // make char id negative npc id as a fudge
charid = -npcmob->GetNPCTypeID(); // make char id negative npc id as a fudge
}
else if(mob && mob->IsNPC())
{
charid = -mob->CastToNPC()->GetNPCTypeID(); // make char id negative npc id as a fudge
charid = -mob->CastToNPC()->GetNPCTypeID(); // make char id negative npc id as a fudge
}
}
ExportVar(packagename.c_str(), "charid", charid);
@@ -593,7 +593,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
switch (event) {
case EVENT_SAY: {
if (npcmob && npcmob->GetAppearance() != eaDead)
npcmob->FaceTarget(mob);
npcmob->FaceTarget(mob);
ExportVar(packagename.c_str(), "data", objid);
ExportVar(packagename.c_str(), "text", data);
ExportVar(packagename.c_str(), "langid", extradata);
@@ -601,7 +601,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
case EVENT_ITEM: {
if (npcmob->GetAppearance() != eaDead)
npcmob->FaceTarget(mob);
npcmob->FaceTarget(mob);
//this is such a hack... why aren't these just set directly..
ExportVar(packagename.c_str(), "item1", GetVar("item1", objid).c_str());
ExportVar(packagename.c_str(), "item2", GetVar("item2", objid).c_str());
@@ -737,7 +737,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
break;
}
case EVENT_SCALE_CALC:
case EVENT_ITEM_ENTERZONE: {
case EVENT_ITEM_ENTERZONE: {
ExportVar(packagename.c_str(), "itemid", objid);
ExportVar(packagename.c_str(), "itemname", iteminst->GetItem()->Name);
break;
@@ -842,11 +842,11 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
else if(isSpellQuest)
{
if(mob) {
SendCommands(packagename.c_str(), sub_name, 0, mob, mob, nullptr);
} else {
SendCommands(packagename.c_str(), sub_name, 0, npcmob, mob, nullptr);
}
if(mob) {
SendCommands(packagename.c_str(), sub_name, 0, mob, mob, nullptr);
} else {
SendCommands(packagename.c_str(), sub_name, 0, npcmob, mob, nullptr);
}
}
else {
SendCommands(packagename.c_str(), sub_name, objid, npcmob, mob, nullptr);
@@ -857,27 +857,27 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
void PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true);
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true);
}
void PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data);
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data);
}
void PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data);
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data);
}
void PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true);
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true);
}
void PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {
EventCommon(evt, objid, nullptr, nullptr, item, client, extra_data);
EventCommon(evt, objid, nullptr, nullptr, item, client, extra_data);
}
void PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {
EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data);
EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data);
}
void PerlembParser::ReloadQuests(bool with_timers) {
@@ -915,7 +915,7 @@ void PerlembParser::ReloadQuests(bool with_timers) {
hasQuests.clear();
playerQuestLoaded.clear();
globalPlayerQuestLoaded = pQuestReadyToLoad;
globalNPCQuestLoaded = nQuestReadyToLoad;
globalNPCQuestLoaded = nQuestReadyToLoad;
itemQuestLoaded.clear();
spellQuestLoaded.clear();
}
@@ -1142,8 +1142,8 @@ int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater)
//LogFile->write(EQEMuLog::Debug, " finally settling on '%s'", filename.c_str());
// LogFile->write(EQEMuLog::Status, "Looking for quest file: '%s'", filename.c_str());
// todo: decide whether or not to delete the package to allow for script refreshes w/o restarting the server
// remember to guard against deleting the default package, on a similar note... consider deleting packages upon zone change
// todo: decide whether or not to delete the package to allow for script refreshes w/o restarting the server
// remember to guard against deleting the default package, on a similar note... consider deleting packages upon zone change
// try { perl->eval(std::string("delete_package(\"").append(packagename).append("\");").c_str()); }
// catch(...) {/*perl balked at us trynig to delete a non-existant package... no big deal.*/}
@@ -1192,7 +1192,7 @@ int PerlembParser::LoadGlobalNPCScript()
string filename = "quests/";
filename += QUEST_TEMPLATES_DIRECTORY;
filename += "/global_npc.pl";
filename += "/global_npc.pl";
string packagename = "global_npc";
try {
@@ -1225,8 +1225,8 @@ int PerlembParser::LoadPlayerScript(const char *zone_name)
string filename= "quests/";
filename += zone_name;
filename += "/player_v";
filename += itoa(zone->GetInstanceVersion());
filename += ".pl";
filename += itoa(zone->GetInstanceVersion());
filename += ".pl";
string packagename = "player";
packagename += "_";
packagename += zone_name;
@@ -1239,11 +1239,11 @@ int PerlembParser::LoadPlayerScript(const char *zone_name)
LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
}
if(!isloaded(packagename.c_str()))
if(!isloaded(packagename.c_str()))
{
filename= "quests/";
filename += zone_name;
filename += "/player.pl";
filename += zone_name;
filename += "/player.pl";
try {
perl->eval_file(packagename.c_str(), filename.c_str());
}
@@ -1253,7 +1253,7 @@ int PerlembParser::LoadPlayerScript(const char *zone_name)
}
}
//todo: change this to just read eval_file's %cache - duh!
//todo: change this to just read eval_file's %cache - duh!
if(!isloaded(packagename.c_str()))
{
filename = "quests/";
@@ -1296,7 +1296,7 @@ int PerlembParser::LoadGlobalPlayerScript()
string filename = "quests/";
filename += QUEST_TEMPLATES_DIRECTORY;
filename += "/global_player.pl";
filename += "/global_player.pl";
string packagename = "global_player";
try {
+16 -16
View File
@@ -41,13 +41,13 @@ typedef enum {
pQuestLoaded = 1,
pQuestUnloaded,
pQuestEventCast, // player.pl loaded, has an EVENT_CAST sub
pQuestReadyToLoad
pQuestReadyToLoad
} playerQuestMode;
typedef enum {
nQuestLoaded = 1,
nQuestUnloaded,
nQuestReadyToLoad
nQuestReadyToLoad
} GlobalNPCQuestMode;
typedef enum {
@@ -77,7 +77,7 @@ protected:
//if they do not have a quest or the default.
map<uint32, questMode> hasQuests; //npcid -> questMode
map<std::string, playerQuestMode> playerQuestLoaded; //zone shortname -> playerQuestMode
playerQuestMode globalPlayerQuestLoaded;
playerQuestMode globalPlayerQuestLoaded;
GlobalNPCQuestMode globalNPCQuestLoaded;
map<std::string, itemQuestMode> itemQuestLoaded; // package name - > itemQuestMode
map<uint32, spellQuestMode> spellQuestLoaded;
@@ -99,29 +99,29 @@ public:
//todo, consider making the following two methods static (need to check for perl!=null, first, then)
bool isloaded(const char *packagename) const;
//interface stuff
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
//interface stuff
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
virtual void EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
virtual bool HasQuestSub(uint32 npcid, const char *subname);
virtual bool HasQuestSub(uint32 npcid, const char *subname);
virtual bool HasGlobalQuestSub(const char *subname);
virtual bool PlayerHasQuestSub(const char *subname);
virtual bool GlobalPlayerHasQuestSub(const char *subname);
virtual bool GlobalPlayerHasQuestSub(const char *subname);
virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname);
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname);
virtual void ReloadQuests(bool with_timers = false);
virtual void AddVar(std::string name, std::string val) { Parser::AddVar(name, val); };
virtual uint32 GetIdentifier() { return 0xf8b05c11; }
virtual void ReloadQuests(bool with_timers = false);
virtual void AddVar(std::string name, std::string val) { Parser::AddVar(name, val); };
virtual uint32 GetIdentifier() { return 0xf8b05c11; }
int LoadScript(int npcid, const char * zone, Mob* activater=0);
int LoadScript(int npcid, const char * zone, Mob* activater=0);
int LoadGlobalNPCScript();
int LoadPlayerScript(const char *zone);
int LoadGlobalPlayerScript();
int LoadGlobalPlayerScript();
int LoadItemScript(ItemInst* iteminst, string packagename, itemQuestMode Qtype);
int LoadSpellScript(uint32 id);
+22 -22
View File
@@ -18,7 +18,7 @@ Eglin
#include "embxs.h"
#include "../common/features.h"
#ifndef GvCV_set
#define GvCV_set(gv,cv) (GvCV(gv) = (cv))
#define GvCV_set(gv,cv) (GvCV(gv) = (cv))
#endif
#ifdef EMBPERL_XS
@@ -166,19 +166,19 @@ void Embperl::DoInit() {
eval_pv(
"package EQEmuIO; "
// "&boot_EQEmuIO;"
"sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } "
"sub WRITE { } "
//dunno why I need to shift off fmt here, but it dosent like without it
"sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } "
"sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } "
"sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } "
"sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } "
"sub WRITE { } "
//dunno why I need to shift off fmt here, but it dosent like without it
"sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } "
"sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } "
"sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } "
//this ties us for all packages, just do it in quest since thats kinda 'our' package
"package quest;"
" if(tied *STDOUT) { untie(*STDOUT); }"
" if(tied *STDERR) { untie(*STDERR); }"
" tie *STDOUT, 'EQEmuIO';"
" tie *STDERR, 'EQEmuIO';"
,FALSE);
"package quest;"
" if(tied *STDOUT) { untie(*STDOUT); }"
" if(tied *STDERR) { untie(*STDERR); }"
" tie *STDOUT, 'EQEmuIO';"
" tie *STDERR, 'EQEmuIO';"
,FALSE);
#endif //EMBPERL_IO_CAPTURE
#ifdef EMBPERL_PLUGIN
@@ -310,26 +310,26 @@ void Embperl::dosub(const char * subname, const std::vector<std::string> * args,
#endif
in_use = true;
bool err = false;
dSP; /* initialize stack pointer */
ENTER; /* everything created after here */
SAVETMPS; /* ...is a temporary variable. */
PUSHMARK(SP); /* remember the stack pointer */
dSP; /* initialize stack pointer */
ENTER; /* everything created after here */
SAVETMPS; /* ...is a temporary variable. */
PUSHMARK(SP); /* remember the stack pointer */
if(args && args->size())
{
for(std::vector<std::string>::const_iterator i = args->begin(); i != args->end(); ++i)
{/* push the arguments onto the perl stack */
{/* push the arguments onto the perl stack */
XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length())));
}
}
PUTBACK; /* make local stack pointer global */
PUTBACK; /* make local stack pointer global */
call_pv(subname, mode); /*eval our code*/
SPAGAIN; /* refresh stack pointer */
SPAGAIN; /* refresh stack pointer */
if(SvTRUE(ERRSV))
{
err = true;
}
FREETMPS; /* free temp values */
LEAVE; /* ...and the XPUSHed "mortal" args.*/
FREETMPS; /* free temp values */
LEAVE; /* ...and the XPUSHed "mortal" args.*/
in_use = false;
if(err)
+13 -13
View File
@@ -29,10 +29,10 @@ extern "C" { //the perl headers dont do this for us...
};
#endif
#ifdef WIN32
#define snprintf _snprintf
#define snprintf _snprintf
#endif
//perl defines these macros and dosent clean them up, lazy bastards. -- I hate them too!
//perl defines these macros and dosent clean them up, lazy bastards. -- I hate them too!
#ifdef Copy
#undef Copy
#endif
@@ -81,7 +81,7 @@ protected:
void DoInit();
public:
Embperl(void); //This can throw errors! Buyer beware
Embperl(void); //This can throw errors! Buyer beware
~Embperl(void);
void Reinit();
@@ -90,7 +90,7 @@ public:
std::string lasterr(void) const { return errmsg;};
//evaluate an expression. throws string errors on fail
void eval(const char * code);
//execute a subroutine. throws lasterr on failure
//execute a subroutine. throws lasterr on failure
void dosub(const char * subname, const std::vector<std::string> * args = nullptr, int mode = G_SCALAR|G_DISCARD|G_EVAL);
//Access to perl variables
@@ -130,17 +130,17 @@ public:
HV *hv = get_hv(varname, TRUE);
hv_clear(hv);
// Iterate through key-value pairs, storing them in hash
for (it = vals.begin(); it != vals.end(); it++)
{
int keylen = static_cast<int>(it->first.length());
// Iterate through key-value pairs, storing them in hash
for (it = vals.begin(); it != vals.end(); it++)
{
int keylen = static_cast<int>(it->first.length());
SV *val = newSVpv(it->second.c_str(), it->second.length());
SV *val = newSVpv(it->second.c_str(), it->second.length());
// If val was not added to hash, reset reference count
if (hv_store(hv, it->first.c_str(), keylen, val, 0) == nullptr)
val->sv_refcnt = 0;
}
// If val was not added to hash, reset reference count
if (hv_store(hv, it->first.c_str(), keylen, val, 0) == nullptr)
val->sv_refcnt = 0;
}
}
//loads a file and compiles it into our interpreter (assuming it hasn't already been read in)
+42 -42
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifdef EMBPERL
@@ -28,36 +28,36 @@
const char *getItemName(unsigned itemid)
{
const Item_Struct* item = nullptr;
item = database.GetItem(itemid);
const Item_Struct* item = nullptr;
item = database.GetItem(itemid);
if (item)
return item->Name;
else
return nullptr;
if (item)
return item->Name;
else
return nullptr;
}
XS(XS_qc_getItemName); /* prototype to pass -Wmissing-prototypes */
XS(XS_qc_getItemName)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getItemName(itemid)");
{
unsigned itemid = (unsigned)SvUV(ST(0));
const char * RETVAL;
dXSTARG;
RETVAL = getItemName(itemid);
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
}
XSRETURN(1);
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getItemName(itemid)");
{
unsigned itemid = (unsigned)SvUV(ST(0));
const char * RETVAL;
dXSTARG;
RETVAL = getItemName(itemid);
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
}
XSRETURN(1);
}
EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */
EXTERN_C XS(boot_qc)
{
dXSARGS;
dXSARGS;
char file[256];
strncpy(file, __FILE__, 256);
file[255] = '\0';
@@ -69,11 +69,11 @@ EXTERN_C XS(boot_qc)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
XS_VERSION_BOOTCHECK ;
newXS(strcpy(buf, "quest::getItemName"), XS_qc_getItemName, file);
newXS(strcpy(buf, "quest::getItemName"), XS_qc_getItemName, file);
XSRETURN_YES;
XSRETURN_YES;
}
#ifdef EMBPERL_IO_CAPTURE
@@ -81,10 +81,10 @@ EXTERN_C XS(boot_qc)
XS(XS_EQEmuIO_PRINT); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQEmuIO_PRINT)
{
dXSARGS;
if (items < 2)
return;
// Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)");
dXSARGS;
if (items < 2)
return;
//Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)");
int r;
for(r = 1; r < items; r++) {
@@ -106,9 +106,9 @@ XS(XS_EQEmuIO_PRINT)
if(len > 0) {
LogFile->writebuf(EQEMuLog::Quest, str + pos, 1, len);
}
}
}
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
#endif //EMBPERL_IO_CAPTURE
@@ -118,9 +118,9 @@ XS(XS_EQEmuIO_PRINT)
XS(XS_command_add); /* prototype to pass -Wmissing-prototypes */
XS(XS_command_add)
{
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: commands::command_add(name, desc, access)");
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: commands::command_add(name, desc, access)");
char *name = SvPV_nolen(ST(0));
char *desc = SvPV_nolen(ST(1));
@@ -128,7 +128,7 @@ XS(XS_command_add)
command_add_perl(name, desc, access);
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
#endif //EMBPERL_COMMANDS
+88 -88
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <stdlib.h>
@@ -65,7 +65,7 @@ extern uint32 numclients;
extern PetitionList petition_list;
extern DBAsync *dbasync;
extern char errorname[32];
extern char errorname[32];
extern uint16 adverrornum;
Entity::Entity() {
@@ -300,24 +300,24 @@ EntityList::~EntityList() {
}
bool EntityList::CanAddHateForMob(Mob *p) {
LinkedListIterator<NPC*> iterator(npc_list);
int count = 0;
LinkedListIterator<NPC*> iterator(npc_list);
int count = 0;
iterator.Reset();
while( iterator.MoreElements())
{
NPC *npc=iterator.GetData();
if (npc->IsOnHatelist(p))
count++;
// no need to continue if we already hit the limit
if (count > 3)
return false;
iterator.Advance();
}
iterator.Reset();
while( iterator.MoreElements())
{
NPC *npc=iterator.GetData();
if (npc->IsOnHatelist(p))
count++;
// no need to continue if we already hit the limit
if (count > 3)
return false;
iterator.Advance();
}
if (count <= 2)
return true;
return false;
if (count <= 2)
return true;
return false;
}
void EntityList::AddClient(Client* client) {
@@ -619,7 +619,7 @@ void EntityList::AddCorpse(Corpse* corpse, uint32 in_id) {
void EntityList::AddNPC(NPC* npc, bool SendSpawnPacket, bool dontqueue) {
npc->SetID(GetFreeID());
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
uint16 emoteid = npc->GetEmoteID();
if(emoteid != 0)
@@ -671,7 +671,7 @@ void EntityList::AddMerc(Merc* merc, bool SendSpawnPacket, bool dontqueue) {
safe_delete(ns);
}
//parse->EventMERC(EVENT_SPAWN, merc, nullptr, "", 0);
//parse->EventMERC(EVENT_SPAWN, merc, nullptr, "", 0);
}
merc_list.Insert(merc);
@@ -1469,9 +1469,9 @@ void EntityList::ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget)
iterator.Reset();
while(iterator.MoreElements()) {
if (iterator.GetData()->IsAIControlled()) {
// replace the old mob with the new one
// replace the old mob with the new one
if (iterator.GetData()->RemoveFromHateList(pOldMob))
iterator.GetData()->AddToHateList(pNewTarget, 1, 0);
iterator.GetData()->AddToHateList(pNewTarget, 1, 0);
}
iterator.Advance();
}
@@ -1587,7 +1587,7 @@ void EntityList::RefreshClientXTargets(Client *c)
}
void EntityList::QueueClientsByTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender, Mob* SkipThisMob, bool ackreq, bool HoTT,
uint32 ClientVersionBits)
uint32 ClientVersionBits)
{
LinkedListIterator<Client*> iterator(client_list);
@@ -1678,8 +1678,8 @@ void EntityList::QueueCloseClients(Mob* sender, const EQApplicationPacket* app,
if ((!ignore_sender || ent != sender) && (ent != SkipThisMob)) {
eqFilterMode filter2 = ent->GetFilter(filter);
if(ent->Connected() &&
( filter==FilterNone
|| filter2 == FilterShow
(filter==FilterNone
|| filter2 == FilterShow
|| (filter2 == FilterShowGroupOnly && (sender == ent ||
(ent->GetGroup() && ent->GetGroup()->IsGroupMember(sender))))
|| (filter2 == FilterShowSelfOnly && ent==sender))
@@ -1732,13 +1732,13 @@ void EntityList::FilterQueueCloseClients(uint8 filter, uint8 required, Mob* send
required=1;
if(filterval==required){
if ((!ignore_sender || ent != sender) && (ent != SkipThisMob)
) {
) {
#ifdef PACKET_UPDATE_MANAGER
if(ent->Connected()) {
ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender));
}
#else
if(ent->Connected() && (ent->DistNoRoot(*sender) <= dist2 || dist == 0)) {
if(ent->Connected() && (ent->DistNoRoot(*sender) <= dist2 || dist == 0)) {
ent->QueuePacket(app, ackreq);
}
#endif
@@ -1778,8 +1778,8 @@ void EntityList::QueueCloseClients(Mob* sender, const EQApplicationPacket* app,
if(ent->Connected() &&
(filter==0 || (filter2==1 ||
(filter2==99 && entity_list.GetGroupByClient(ent)!=0 &&
entity_list.GetGroupByClient(ent)->IsGroupMember(sender))
|| (filter2==98 && ent==sender)))
entity_list.GetGroupByClient(ent)->IsGroupMember(sender))
|| (filter2==98 && ent==sender)))
#ifdef PACKET_UPDATE_MANAGER
) {
ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender));
@@ -3309,7 +3309,7 @@ void EntityList::DoubleAggro(Mob* who)
while(iterator.MoreElements())
{
if (iterator.GetData()->CheckAggro(who))
iterator.GetData()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who),iterator.GetData()->CastToNPC()->GetHateAmount(who)*2);
iterator.GetData()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who),iterator.GetData()->CastToNPC()->GetHateAmount(who)*2);
iterator.Advance();
}
}
@@ -3321,7 +3321,7 @@ void EntityList::HalveAggro(Mob* who)
while(iterator.MoreElements())
{
if (iterator.GetData()->CastToNPC()->CheckAggro(who))
iterator.GetData()->CastToNPC()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who)/2);
iterator.GetData()->CastToNPC()->SetHate(who,iterator.GetData()->CastToNPC()->GetHateAmount(who)/2);
iterator.Advance();
}
}
@@ -3728,7 +3728,7 @@ void EntityList::ProcessMove(Client *c, float x, float y, float z) {
//This is done to address the issue of this code not being reentrant
//because perl can call clear_proximity() while we're still iterating through the list
//This causes our list to become invalid but we don't know it. On GCC it's basic heap
//This causes our list to become invalid but we don't know it. On GCC it's basic heap
//corruption and it doesn't appear to catch it at all.
//MSVC it's a crash with 0xfeeefeee debug address (freed memory off the heap)
std::list<int>::iterator iter = skip_ids.begin();
@@ -3752,20 +3752,20 @@ void EntityList::ProcessMove(Client *c, float x, float y, float z) {
//cross a boundary, send the event.
bool old_in = true;
bool new_in = true;
if( last_x < l->min_x || last_x > l->max_x
|| last_y < l->min_y || last_y > l->max_y
|| last_z < l->min_z || last_z > l->max_z ) {
if(last_x < l->min_x || last_x > l->max_x
|| last_y < l->min_y || last_y > l->max_y
|| last_z < l->min_z || last_z > l->max_z ) {
old_in = false;
}
if( x < l->min_x || x > l->max_x
|| y < l->min_y || y > l->max_y
|| z < l->min_z || z > l->max_z ) {
if(x < l->min_x || x > l->max_x
|| y < l->min_y || y > l->max_y
|| z < l->min_z || z > l->max_z ) {
new_in = false;
}
if(old_in && !new_in) {
//we were in the proximity, we are no longer, send event exit
parse->EventNPC(EVENT_EXIT, d, c, "", 0);
parse->EventNPC(EVENT_EXIT, d, c, "", 0);
//Reentrant fix
iterator.Reset();
@@ -3795,12 +3795,12 @@ void EntityList::ProcessProximitySay(const char *Message, Client *c, uint8 langu
if(l == nullptr || !l->say)
continue;
if( c->GetX() < l->min_x || c->GetX() > l->max_x
|| c->GetY() < l->min_y || c->GetY() > l->max_y
|| c->GetZ() < l->min_z || c->GetZ() > l->max_z )
if(c->GetX() < l->min_x || c->GetX() > l->max_x
|| c->GetY() < l->min_y || c->GetY() > l->max_y
|| c->GetZ() < l->min_z || c->GetZ() > l->max_z )
continue;
parse->EventNPC(EVENT_PROXIMITY_SAY, d, c, Message, language);
parse->EventNPC(EVENT_PROXIMITY_SAY, d, c, Message, language);
}
}
@@ -4066,25 +4066,24 @@ bool Entity::CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z, float
void EntityList::QuestJournalledSayClose(Mob *sender, Client *QuestInitiator, float dist, const char* mobname, const char* message)
{
Client *c;
LinkedListIterator<Client*> iterator(client_list);
float dist2 = dist * dist;
Client *c;
LinkedListIterator<Client*> iterator(client_list);
float dist2 = dist * dist;
// Send the message to the quest initiator such that the client will enter it into the NPC Quest Journal
if(QuestInitiator) {
char *buf = new char[strlen(mobname) + strlen(message) + 10];
sprintf(buf, "%s says, '%s'", mobname, message);
QuestInitiator->QuestJournalledMessage(mobname, buf);
safe_delete_array(buf);
}
// Use the old method for all other nearby clients
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
{
c = iterator.GetData();
if(c && (c != QuestInitiator) && c->DistNoRoot(*sender) <= dist2)
c->Message_StringID(10, GENERIC_SAY, mobname, message);
}
// Send the message to the quest initiator such that the client will enter it into the NPC Quest Journal
if(QuestInitiator) {
char *buf = new char[strlen(mobname) + strlen(message) + 10];
sprintf(buf, "%s says, '%s'", mobname, message);
QuestInitiator->QuestJournalledMessage(mobname, buf);
safe_delete_array(buf);
}
// Use the old method for all other nearby clients
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
{
c = iterator.GetData();
if(c && (c != QuestInitiator) && c->DistNoRoot(*sender) <= dist2)
c->Message_StringID(10, GENERIC_SAY, mobname, message);
}
}
Corpse* EntityList::GetClosestCorpse(Mob* sender, const char* Name)
@@ -4110,7 +4109,7 @@ Corpse* EntityList::GetClosestCorpse(Mob* sender, const char* Name)
continue;
CurrentDistance = ((CurrentCorpse->GetY() - sender->GetY()) * (CurrentCorpse->GetY() - sender->GetY())) +
((CurrentCorpse->GetX() - sender->GetX()) * (CurrentCorpse->GetX() - sender->GetX()));
((CurrentCorpse->GetX() - sender->GetX()) * (CurrentCorpse->GetX() - sender->GetX()));
if(CurrentDistance < ClosestDistance)
{
@@ -4303,7 +4302,7 @@ Mob* EntityList::GetTargetForMez(Mob* caster)
if(!caster->CheckLosFN(d)){ //this is wasteful but can't really think of another way to do it
iterator.Advance(); //that wont have us trying to los the same target every time
continue; //it's only in combat so it's impact should be minimal.. but stil.
continue; //it's only in combat so it's impact should be minimal.. but stil.
}
return d;
}
@@ -4394,8 +4393,8 @@ void EntityList::SendUntargetable(Client *c)
continue;
}
if(!cur->IsTargetable()) {
cur->SendTargetable(false, c);
}
cur->SendTargetable(false, c);
}
}
iterator.Advance();
}
@@ -4415,7 +4414,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) {
iterator.Reset();
while(iterator.MoreElements()) {
while(iterator.MoreElements()) {
Client *ClientEntry = iterator.GetData();
@@ -4451,7 +4450,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) {
}
if(WhomLength && strncasecmp(Who->whom, ClientEntry->GetName(), WhomLength) &&
strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength))
strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength))
continue;
Entries++;
@@ -4541,7 +4540,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) {
}
if(WhomLength && strncasecmp(Who->whom, ClientEntry->GetName(), WhomLength) &&
strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength))
strncasecmp(guild_mgr.GetGuildName(ClientEntry->GuildID()), Who->whom, WhomLength))
continue;
string GuildName;
@@ -4619,7 +4618,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct* Who) {
WAPP3->Class_ = PlayerClass;
WAPP3->Level = PlayerLevel;
WAPP3->Level = PlayerLevel;
WAPP3->Race = PlayerRace;
@@ -4668,12 +4667,12 @@ void EntityList::UnMarkNPC(uint16 ID)
uint32 EntityList::CheckNPCsClose(Mob *center)
{
LinkedListIterator<NPC*> iterator(npc_list);
uint32 count = 0;
LinkedListIterator<NPC*> iterator(npc_list);
uint32 count = 0;
iterator.Reset();
while(iterator.MoreElements())
{
iterator.Reset();
while(iterator.MoreElements())
{
NPC *current = iterator.GetData();
if(!current)
{
@@ -5011,7 +5010,7 @@ void EntityList::HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode)
if((NewMode == HideCorpseAll) || ((NewMode == HideCorpseNPC) && (b->IsNPCCorpse())))
{
EQApplicationPacket outapp;
b->CreateDespawnPacket(&outapp, false);
b->CreateDespawnPacket(&outapp, false);
c->QueuePacket(&outapp);
}
else if(NewMode == HideCorpseAllButGroup)
@@ -5019,13 +5018,13 @@ void EntityList::HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode)
if(!g->IsGroupMember(b->GetOwnerName()))
{
EQApplicationPacket outapp;
b->CreateDespawnPacket(&outapp, false);
b->CreateDespawnPacket(&outapp, false);
c->QueuePacket(&outapp);
}
else if((CurrentMode == HideCorpseAll))
{
EQApplicationPacket outapp;
b->CreateSpawnPacket(&outapp);
b->CreateSpawnPacket(&outapp);
c->QueuePacket(&outapp);
}
}
@@ -5194,7 +5193,7 @@ Mob* EntityList::GetClosestMobByBodyType(Mob* sender, bodyType BodyType)
continue;
CurrentDistance = ((CurrentMob->GetY() - sender->GetY()) * (CurrentMob->GetY() - sender->GetY())) +
((CurrentMob->GetX() - sender->GetX()) * (CurrentMob->GetX() - sender->GetX()));
((CurrentMob->GetX() - sender->GetX()) * (CurrentMob->GetX() - sender->GetX()));
if(CurrentDistance < ClosestDistance)
{
@@ -5306,3 +5305,4 @@ Mob* EntityList::GetTargetForVirus(Mob* spreader)
return TargetsInRange[MakeRandomInt(0, TargetsInRange.size() - 1)];
}
+60 -60
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef ENTITY_H
#define ENTITY_H
@@ -81,14 +81,14 @@ public:
virtual bool IsTrap() const { return false; }
virtual bool IsBeacon() const { return false; }
virtual bool Process() { return false; }
virtual bool Process() { return false; }
virtual bool Save() { return true; }
virtual void Depop(bool StartSpawnTimer = false) {}
Client* CastToClient();
NPC* CastToNPC();
Mob* CastToMob();
Merc* CastToMerc();
NPC* CastToNPC();
Mob* CastToMob();
Merc* CastToMerc();
Corpse* CastToCorpse();
Object* CastToObject();
Doors* CastToDoors();
@@ -96,14 +96,14 @@ public:
Beacon* CastToBeacon();
const Client* CastToClient() const;
const NPC* CastToNPC() const;
const Mob* CastToMob() const;
const Merc* CastToMerc() const;
const NPC* CastToNPC() const;
const Mob* CastToMob() const;
const Merc* CastToMerc() const;
const Corpse* CastToCorpse() const;
const Object* CastToObject() const;
const Object* CastToObject() const;
// const Group* CastToGroup() const;
const Doors* CastToDoors() const;
const Trap* CastToTrap() const;
const Trap* CastToTrap() const;
const Beacon* CastToBeacon() const;
inline const uint16& GetID() const{ return id; }
@@ -148,8 +148,8 @@ public:
Client* GetRandomClient(float x, float y, float z, float Distance, Client *ExcludeClient = nullptr);
Group* GetGroupByMob(Mob* mob);
Group* GetGroupByClient(Client* client);
Group* GetGroupByID(uint32 id);
Group* GetGroupByLeaderName(char* leader);
Group* GetGroupByID(uint32 id);
Group* GetGroupByLeaderName(char* leader);
Raid* GetRaidByMob(Mob* mob);
Raid* GetRaidByClient(Client* client);
Raid* GetRaidByID(uint32 id);
@@ -173,12 +173,12 @@ public:
int RezzAllCorpsesByCharID(uint32 charid);
bool IsMobInZone(Mob *who);
void ClearClientPetitionQueue();
bool CanAddHateForMob(Mob *p);
void SendGuildMOTD(uint32 guild_id);
void SendGuildSpawnAppearance(uint32 guild_id);
void SendGuildMembers(uint32 guild_id);
void RefreshAllGuildInfo(uint32 guild_id);
void SendGuildList();
bool CanAddHateForMob(Mob *p);
void SendGuildMOTD(uint32 guild_id);
void SendGuildSpawnAppearance(uint32 guild_id);
void SendGuildMembers(uint32 guild_id);
void RefreshAllGuildInfo(uint32 guild_id);
void SendGuildList();
// void SendGuildJoin(GuildJoin_Struct* gj);
// Check group list for nullptr entries
void CheckGroupList (const char *fname, const int fline);
@@ -197,17 +197,17 @@ public:
Object* FindObject(uint32 object_id);
Object* FindNearbyObject(float x, float y, float z, float radius);
bool MakeDoorSpawnPacket(EQApplicationPacket* app, Client *client);
bool MakeTrackPacket(Client* client);
bool MakeTrackPacket(Client* client);
void SendTraders(Client* client);
void AddClient(Client*);
void AddNPC(NPC*, bool SendSpawnPacket = true, bool dontqueue = false);
void AddClient(Client*);
void AddNPC(NPC*, bool SendSpawnPacket = true, bool dontqueue = false);
void AddMerc(Merc*, bool SendSpawnPacket = true, bool dontqueue = false);
void AddCorpse(Corpse* pc, uint32 in_id = 0xFFFFFFFF);
void AddObject(Object*, bool SendSpawnPacket = true);
void AddGroup(Group*);
void AddGroup(Group*, uint32 id);
void AddObject(Object*, bool SendSpawnPacket = true);
void AddGroup(Group*);
void AddGroup(Group*, uint32 id);
void AddRaid(Raid *raid);
void AddRaid(Raid*, uint32 id);
void AddRaid(Raid*, uint32 id);
void AddDoor(Doors* door);
void AddTrap(Trap* trap);
void AddBeacon(Beacon *beacon);
@@ -259,39 +259,39 @@ public:
void Message_StringID(Mob *sender, bool skipsender, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
void MessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
void ChannelMessageFromWorld(const char* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, const char* message);
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, const char* message, ...);
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, const char* message, ...);
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
void ChannelMessageSend(Mob* to, uint8 chan_num, uint8 language, const char* message, ...);
void SendZoneSpawns(Client*);
void SendZoneSpawns(Client*);
void SendZonePVPUpdates(Client *);
void SendZoneSpawnsBulk(Client* client);
void Save();
void SendZoneCorpses(Client*);
void SendZoneCorpsesBulk(Client*);
void SendZoneObjects(Client* client);
void Save();
void SendZoneCorpses(Client*);
void SendZoneCorpsesBulk(Client*);
void SendZoneObjects(Client* client);
void SendZoneAppearance(Client *c);
void SendNimbusEffects(Client *c);
void SendUntargetable(Client *c);
void SendUntargetable(Client *c);
void DuelMessage(Mob* winner, Mob* loser, bool flee);
void QuestJournalledSayClose(Mob *sender, Client *QuestIntiator, float dist, const char* mobname, const char* message);
void QuestJournalledSayClose(Mob *sender, Client *QuestIntiator, float dist, const char* mobname, const char* message);
void GroupMessage(uint32 gid, const char *from, const char *message);
void ExpeditionWarning(uint32 minutes_left);
void RemoveFromTargets(Mob* mob, bool RemoveFromXTargets = false);
void RemoveFromXTargets(Mob* mob);
void RemoveFromAutoXTargets(Mob* mob);
void ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget);
void RemoveFromTargets(Mob* mob, bool RemoveFromXTargets = false);
void RemoveFromXTargets(Mob* mob);
void RemoveFromAutoXTargets(Mob* mob);
void ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget);
void QueueCloseClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, float dist=200, Mob* SkipThisMob = 0, bool ackreq = true,eqFilterType filter=FilterNone);
void QueueClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true);
void QueueClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true);
void QueueClientsStatus(Mob* sender, const EQApplicationPacket* app, bool ignore_sender = false, uint8 minstatus = 0, uint8 maxstatus = 0);
void QueueClientsGuild(Mob* sender, const EQApplicationPacket* app, bool ignore_sender = false, uint32 guildeqid = 0);
void QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struct *gbius, uint32 GuildID);
void QueueClientsByTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true, Mob* SkipThisMob = 0, bool ackreq = true,
bool HoTT = true, uint32 ClientVersionBits = 0xFFFFFFFF);
bool HoTT = true, uint32 ClientVersionBits = 0xFFFFFFFF);
void QueueClientsByXTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true);
void QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app);
void QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true);
void QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true);
void AEAttack(Mob *attacker, float dist, int Hand = 13, int count = 0, bool IsFromSpell = false);
void AETaunt(Client *caster, float range = 0);
@@ -299,7 +299,7 @@ public:
void MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true);
void AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true);
void RadialSetLogging(Mob *around, bool enabled, bool clients, bool non_clients, float range = 0);
void RadialSetLogging(Mob *around, bool enabled, bool clients, bool non_clients, float range = 0);
//trap stuff
Mob* GetTrapTrigger(Trap* trap);
@@ -316,7 +316,7 @@ public:
void SignalMobsByNPCID(uint32 npc_type, int signal_id);
void CountNPC(uint32* NPCCount, uint32* NPCLootCount, uint32* gmspawntype_count);
void DoZoneDump(ZSDump_Spawn2* spawn2dump, ZSDump_NPC* npcdump, ZSDump_NPC_Loot* npclootdump, NPCType* gmspawntype_dump);
void RemoveEntity(uint16 id);
void RemoveEntity(uint16 id);
void SendPetitionToAdmins(Petition* pet);
void SendPetitionToAdmins();
void AddLootToNPCS(uint32 item_id, uint32 count);
@@ -333,14 +333,14 @@ public:
void Evade(Mob *who);
void UpdateHoTT(Mob* target);
void Process();
void Process();
void ClearAggro(Mob* targ);
void ClearFeignAggro(Mob* targ);
void ClearZoneFeignAggro(Client* targ);
void AggroZone(Mob* who, int hate = 0);
bool Fighting(Mob* targ);
void RemoveFromHateLists(Mob* mob, bool settoone = false);
void RemoveFromHateLists(Mob* mob, bool settoone = false);
void RemoveDebuffs(Mob* caster);
@@ -370,8 +370,8 @@ public:
void SendGroupLeave(uint32 gid, const char *name);
void SendGroupJoin(uint32 gid, const char *name);
void SaveAllClientsTaskState();
void ReloadAllClientsTaskState(int TaskID=0);
void SaveAllClientsTaskState();
void ReloadAllClientsTaskState(int TaskID=0);
uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000);
uint16 CreateGroundObjectFromModel(const char *model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0);
@@ -398,7 +398,7 @@ public:
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
uint16 GetFreeID();
uint16 GetFreeID();
void RefreshAutoXTargets(Client *c);
void RefreshClientXTargets(Client *c);
@@ -443,8 +443,8 @@ private:
Bot* GetBotByBotName(std::string botName);
list<Bot*> GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacterID);
bool Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint16 iSpellTypes); // TODO: Evaluate this closesly in hopes to eliminate
void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff
bool Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint16 iSpellTypes); // TODO: Evaluate this closesly in hopes to eliminate
void ShowSpawnWindow(Client* client, int Distance, bool NamedOnly); // TODO: Implement ShowSpawnWindow in the bot class but it needs entity list stuff
private:
std::list<Bot*> bot_list;
#endif
+14 -13
View File
@@ -1,19 +1,19 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* Error messages for mysql clients */
/* error messages for the demon is in share/language/errmsg.sys */
@@ -57,3 +57,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_NAMEDPIPESETSTATE_ERROR 2018
#define CR_CANT_READ_CHARSET 2019
#define CR_NET_PACKET_TOO_LARGE 2020
+1 -1
View File
@@ -36,7 +36,7 @@ typedef enum {
EVENT_PROXIMITY_SAY,
EVENT_CAST,
EVENT_SCALE_CALC,
EVENT_ITEM_ENTERZONE,
EVENT_ITEM_ENTERZONE,
EVENT_TARGET_CHANGE, //target selected, target changed, or target removed
EVENT_HATE_LIST,
EVENT_SPELL_EFFECT_CLIENT,
+79 -79
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/features.h"
@@ -134,7 +134,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
if(GetGroup())
{
if((m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel()))
&& (RuleI(Character, KillsPerGroupLeadershipAA) > 0))
&& (RuleI(Character, KillsPerGroupLeadershipAA) > 0))
{
AddLeadershipEXP(GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA), 0);
Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
@@ -145,7 +145,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
else
{
if((m_pp.raid_leadership_points < MaxBankedRaidLeadershipPoints(GetLevel()))
&& (RuleI(Character, KillsPerRaidLeadershipAA) > 0))
&& (RuleI(Character, KillsPerRaidLeadershipAA) > 0))
{
AddLeadershipEXP(0, RAID_EXP_PER_POINT / RuleI(Character, KillsPerRaidLeadershipAA));
Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_EXP);
@@ -278,7 +278,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
//Message(15, "You have gained %d skill points!!", m_pp.aapoints - last_unspentAA);
char val1[20]={0};
Message_StringID(MT_Experience, GAIN_ABILITY_POINT,ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2.
Message_StringID(MT_Experience, GAIN_ABILITY_POINT,ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2.
//Message(15, "You now have %d skill points available to spend.", m_pp.aapoints);
}
@@ -307,7 +307,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
uint32 expneeded = GetEXPForLevel(MaxLevel);
if(set_exp > expneeded)
{
set_exp = expneeded;
set_exp = expneeded;
}
}
}
@@ -334,7 +334,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
uint32 expneeded = GetEXPForLevel(maxlevel);
if(set_exp > expneeded)
{
set_exp = expneeded;
set_exp = expneeded;
}
}
@@ -370,77 +370,77 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
void Client::SetLevel(uint8 set_level, bool command)
{
if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
LogFile->write(EQEMuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
return;
}
if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
LogFile->write(EQEMuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
return;
}
EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
lu->level = set_level;
if(m_pp.level2 != 0)
lu->level_old = m_pp.level2;
else
lu->level_old = level;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
lu->level = set_level;
if(m_pp.level2 != 0)
lu->level_old = m_pp.level2;
else
lu->level_old = level;
level = set_level;
level = set_level;
if(IsRaidGrouped())
{
Raid *r = this->GetRaid();
if(r){
r->UpdateLevel(GetName(), set_level);
}
}
if(set_level > m_pp.level2)
{
if(m_pp.level2 == 0)
m_pp.points += 5;
else
m_pp.points += (5 * (set_level - m_pp.level2));
if(IsRaidGrouped())
{
Raid *r = this->GetRaid();
if(r){
r->UpdateLevel(GetName(), set_level);
}
}
if(set_level > m_pp.level2)
{
if(m_pp.level2 == 0)
m_pp.points += 5;
else
m_pp.points += (5 * (set_level - m_pp.level2));
m_pp.level2 = set_level;
}
if(set_level > m_pp.level) {
parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
}
m_pp.level2 = set_level;
}
if(set_level > m_pp.level) {
parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
}
m_pp.level = set_level;
if (command){
m_pp.exp = GetEXPForLevel(set_level);
Message(15, "Welcome to level %i!", set_level);
lu->exp = 0;
}
else {
float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) /
( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
lu->exp = (uint32)(330.0f * tmpxp);
}
QueuePacket(outapp);
safe_delete(outapp);
this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change
m_pp.level = set_level;
if (command){
m_pp.exp = GetEXPForLevel(set_level);
Message(15, "Welcome to level %i!", set_level);
lu->exp = 0;
}
else {
float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) /
( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
lu->exp = (uint32)(330.0f * tmpxp);
}
QueuePacket(outapp);
safe_delete(outapp);
this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change
LogFile->write(EQEMuLog::Normal,"Setting Level for %s to %i", GetName(), set_level);
CalcBonuses();
if(!RuleB(Character, HealOnLevel))
{
int mhp = CalcMaxHP();
if(GetHP() > mhp)
SetHP(mhp);
}
else
{
SetHP(CalcMaxHP()); // Why not, lets give them a free heal
}
CalcBonuses();
if(!RuleB(Character, HealOnLevel))
{
int mhp = CalcMaxHP();
if(GetHP() > mhp)
SetHP(mhp);
}
else
{
SetHP(CalcMaxHP()); // Why not, lets give them a free heal
}
DoTributeUpdate();
SendHPUpdate();
SetMana(CalcMaxMana());
UpdateWho();
SendHPUpdate();
SetMana(CalcMaxMana());
UpdateWho();
if(GetMerc())
UpdateMercLevel();
Save();
Save();
}
// Note: The client calculates exp separately, we cant change this function
@@ -507,7 +507,7 @@ void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level) {
void Group::SplitExp(uint32 exp, Mob* other) {
if( other->CastToNPC()->MerchantType != 0 ) // Ensure NPC isn't a merchant
return;
return;
if(other->GetOwner() && other->GetOwner()->IsClient()) // Ensure owner isn't pc
return;
@@ -549,7 +549,7 @@ void Group::SplitExp(uint32 exp, Mob* other) {
if (membercount == 0)
return;
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr && members[i]->IsClient()) // If Group Member is Client
{
Client *cmember = members[i]->CastToClient();
@@ -596,7 +596,7 @@ void Raid::SplitExp(uint32 exp, Mob* other) {
if (membercount == 0)
return;
for (unsigned int x = 0; x < MAX_RAID_MEMBERS; x++) {
for (unsigned int x = 0; x < MAX_RAID_MEMBERS; x++) {
if (members[x].member != nullptr) // If Group Member is Client
{
Client *cmember = members[x].member;
@@ -672,5 +672,5 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
++gcount;
}
return false; // Default is false
return false; // Default is false
}
+26 -26
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
@@ -92,9 +92,9 @@ void Mob::CheckFlee() {
}
if(ratio < run_ratio)
{
if( RuleB(Combat, FleeIfNotAlone)
|| ( !RuleB(Combat, FleeIfNotAlone)
&& (entity_list.GetHatedCount(hate_top, this) == 0)))
if (RuleB(Combat, FleeIfNotAlone) ||
(!RuleB(Combat, FleeIfNotAlone) &&
(entity_list.GetHatedCount(hate_top, this) == 0)))
StartFleeing();
}
@@ -127,10 +127,10 @@ void Mob::ProcessFlee() {
}
float Mob::GetFearSpeed() {
if(flee_mode) {
//we know ratio < FLEE_HP_RATIO
float speed = GetRunspeed();
float ratio = GetHPRatio();
if(flee_mode) {
//we know ratio < FLEE_HP_RATIO
float speed = GetRunspeed();
float ratio = GetHPRatio();
// mob's movement will halt with a decent snare at HP specified by rule.
if (ratio <= RuleI(Combat, FleeSnareHPRatio) && GetSnaredAmount() > 40) {
@@ -140,11 +140,11 @@ float Mob::GetFearSpeed() {
if (ratio < FLEE_HP_MINSPEED)
ratio = FLEE_HP_MINSPEED;
speed = speed * 0.5 * ratio / 100;
speed = speed * 0.5 * ratio / 100;
return(speed);
}
return(GetRunspeed());
return(speed);
}
return(GetRunspeed());
}
void Mob::CalculateNewFearpoint()
@@ -251,7 +251,7 @@ void Mob::CalculateNewFearpoint()
fear_path_state = new MobFearState();
if(zone->pathing->FindNearestFear(fear_path_state, GetX(), GetY(), GetZ())) {
#ifdef FEAR_PATHING_DEBUG
LogFile->write(EQEMuLog::Debug, "Fear Pathing Start: found path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
LogFile->write(EQEMuLog::Debug, "Fear Pathing Start: found path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z);
#endif
//we found a fear node... were on our way..
@@ -373,7 +373,7 @@ void Mob::CalculateFearPosition() {
return;
}
#ifdef FEAR_PATHING_DEBUG
LogFile->write(EQEMuLog::Debug, "Fear Pathing: on path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
LogFile->write(EQEMuLog::Debug, "Fear Pathing: on path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z);
#endif
//we found a fear node... were on our way..
@@ -400,7 +400,7 @@ void Mob::CalculateFearPosition() {
if(zone->pathing->FindNearestFear(fear_path_state, GetX(), GetY(), GetZ())) {
#ifdef FEAR_PATHING_DEBUG
LogFile->write(EQEMuLog::Debug, "Fear Pathing: ran to find path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
LogFile->write(EQEMuLog::Debug, "Fear Pathing: ran to find path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z);
#endif
//we found a fear node... were on our way..
@@ -422,7 +422,7 @@ void Mob::CalculateFearPosition() {
//do not force a path if we are fleeing
if(!flee_mode && zone->pathing->FindNearestFear(fear_path_state, GetX(), GetY(), GetZ(), false)) {
#ifdef FEAR_PATHING_DEBUG
LogFile->write(EQEMuLog::Debug, "Fear Pathing: Bullshit Path from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
LogFile->write(EQEMuLog::Debug, "Fear Pathing: Bullshit Path from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
GetX(), GetY(), GetZ(), fear_path_state->x, fear_path_state->y, fear_path_state->z);
#endif
//we found a fear node... were on our way..
+35 -34
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -86,16 +86,16 @@ CREATE TABLE fishing (
// This allows EqEmu to have zone specific foraging - BoB
uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint8 index = 0;
uint32 item[FORAGE_ITEM_LIMIT];
uint32 chance[FORAGE_ITEM_LIMIT];
uint32 ret;
for (int c=0; c < FORAGE_ITEM_LIMIT; c++) {
for (int c=0; c < FORAGE_ITEM_LIMIT; c++) {
item[c] = 0;
}
@@ -104,7 +104,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
if (RunQuery(query, MakeAnyLenString(&query, "SELECT itemid,chance FROM forage WHERE zoneid= '%i' and level <= '%i' LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT), errbuf, &result))
{
safe_delete_array(query);
while ((row = mysql_fetch_row(result)) && (index < FORAGE_ITEM_LIMIT)) {
while ((row = mysql_fetch_row(result)) && (index < FORAGE_ITEM_LIMIT)) {
item[index] = atoi(row[0]);
chance[index] = atoi(row[1])+chancepool;
LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]);
@@ -144,9 +144,9 @@ LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[ind
uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint8 index = 0;
uint32 item[50];
@@ -156,7 +156,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
uint32 chancepool = 0;
uint32 ret = 0;
for (int c=0; c<50; c++) {
for (int c=0; c<50; c++) {
item[c]=0;
chance[c]=0;
}
@@ -164,7 +164,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
if (RunQuery(query, MakeAnyLenString(&query, "SELECT itemid,chance,npc_id,npc_chance FROM fishing WHERE (zoneid= '%i' || zoneid = 0) and skill_level <= '%i'",ZoneID, skill ), errbuf, &result))
{
safe_delete_array(query);
while ((row = mysql_fetch_row(result))&&(index<50)) {
while ((row = mysql_fetch_row(result))&&(index<50)) {
item[index] = atoi(row[0]);
chance[index] = atoi(row[1])+chancepool;
chancepool = chance[index];
@@ -286,9 +286,9 @@ void Client::GoFish()
13019, // Fresh Fish
13076, // Fish Scales
13076, // Fish Scales
7007, // Rusty Dagger
7007, // Rusty Dagger
7007 // Rusty Dagger
7007, // Rusty Dagger
7007 // Rusty Dagger
};
@@ -316,7 +316,7 @@ void Client::GoFish()
uint32 food_id = 0;
//25% chance to fish an item.
if (MakeRandomInt(0, 399) <= fishing_skill ) {
if (MakeRandomInt(0, 399) <= fishing_skill ) {
uint32 npc_id = 0;
uint8 npc_chance = 0;
food_id = database.GetZoneFishing(m_pp.zone_id, fishing_skill, npc_id, npc_chance);
@@ -366,7 +366,7 @@ void Client::GoFish()
safe_delete(inst);
}
parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0);
parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0);
}
else
{
@@ -382,7 +382,7 @@ void Client::GoFish()
Message_StringID(MT_Skills, FISHING_FAILED); //You didn't catch anything.
}
parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0);
parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0);
}
//chance to break fishing pole...
@@ -475,19 +475,20 @@ void Client::ForageItem(bool guarantee) {
safe_delete(inst);
}
parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0);
parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0);
int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems;
if(!guarantee && MakeRandomInt(0,99) < ChanceSecondForage) {
this->Message_StringID(MT_Skills, FORAGE_MASTERY);
this->ForageItem(true);
}
int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems;
if(!guarantee && MakeRandomInt(0,99) < ChanceSecondForage) {
this->Message_StringID(MT_Skills, FORAGE_MASTERY);
this->ForageItem(true);
}
} else {
Message_StringID(MT_Skills, FORAGE_FAILED);
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
}
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
}
CheckIncreaseSkill(FORAGE, nullptr, 5);
}
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef FORAGE_H
+256 -256
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "masterentity.h"
@@ -116,253 +116,252 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
if(copper == 0 && silver == 0 && gold == 0 && platinum == 0)
return;
uint32 i;
uint8 membercount = 0;
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr) {
uint32 i;
uint8 membercount = 0;
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr) {
membercount++;
}
}
membercount++;
}
}
if (membercount == 0)
return;
if (membercount == 0)
return;
uint32 mod;
//try to handle round off error a little better
if(membercount > 1) {
mod = platinum % membercount;
if((mod) > 0) {
platinum -= mod;
gold += 10 * mod;
}
mod = gold % membercount;
if((mod) > 0) {
gold -= mod;
silver += 10 * mod;
}
mod = silver % membercount;
if((mod) > 0) {
silver -= mod;
copper += 10 * mod;
}
}
uint32 mod;
//try to handle round off error a little better
if(membercount > 1) {
mod = platinum % membercount;
if((mod) > 0) {
platinum -= mod;
gold += 10 * mod;
}
mod = gold % membercount;
if((mod) > 0) {
gold -= mod;
silver += 10 * mod;
}
mod = silver % membercount;
if((mod) > 0) {
silver -= mod;
copper += 10 * mod;
}
}
//calculate the splits
//We can still round off copper pieces, but I dont care
uint32 sc;
uint32 cpsplit = copper / membercount;
sc = copper % membercount;
uint32 spsplit = silver / membercount;
uint32 gpsplit = gold / membercount;
uint32 ppsplit = platinum / membercount;
//calculate the splits
//We can still round off copper pieces, but I dont care
uint32 sc;
uint32 cpsplit = copper / membercount;
sc = copper % membercount;
uint32 spsplit = silver / membercount;
uint32 gpsplit = gold / membercount;
uint32 ppsplit = platinum / membercount;
char buf[128];
buf[63] = '\0';
string msg = "You receive";
bool one = false;
char buf[128];
buf[63] = '\0';
string msg = "You receive";
bool one = false;
if(ppsplit > 0) {
snprintf(buf, 63, " %u platinum", ppsplit);
msg += buf;
one = true;
}
if(gpsplit > 0) {
if(one)
msg += ",";
snprintf(buf, 63, " %u gold", gpsplit);
msg += buf;
one = true;
}
if(spsplit > 0) {
if(one)
msg += ",";
snprintf(buf, 63, " %u silver", spsplit);
msg += buf;
one = true;
}
if(cpsplit > 0) {
if(one)
msg += ",";
//this message is not 100% accurate for the splitter
//if they are receiving any roundoff
snprintf(buf, 63, " %u copper", cpsplit);
msg += buf;
one = true;
}
msg += " as your split";
if(ppsplit > 0) {
snprintf(buf, 63, " %u platinum", ppsplit);
msg += buf;
one = true;
}
if(gpsplit > 0) {
if(one)
msg += ",";
snprintf(buf, 63, " %u gold", gpsplit);
msg += buf;
one = true;
}
if(spsplit > 0) {
if(one)
msg += ",";
snprintf(buf, 63, " %u silver", spsplit);
msg += buf;
one = true;
}
if(cpsplit > 0) {
if(one)
msg += ",";
//this message is not 100% accurate for the splitter
//if they are receiving any roundoff
snprintf(buf, 63, " %u copper", cpsplit);
msg += buf;
one = true;
}
msg += " as your split";
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr && members[i]->IsClient()) { // If Group Member is Client
Client *c = members[i]->CastToClient();
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr && members[i]->IsClient()) { // If Group Member is Client
Client *c = members[i]->CastToClient();
//I could not get MoneyOnCorpse to work, so we use this
c->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true);
c->Message(2, msg.c_str());
}
}
}
}
}
bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 CharacterID)
{
bool InZone = true;
bool ismerc = false;
bool InZone = true;
bool ismerc = false;
// This method should either be passed a Mob*, if the new member is in this zone, or a nullptr Mob*
// and the name and CharacterID of the new member, if they are out of zone.
//
if(!newmember && !NewMemberName)
return false;
// This method should either be passed a Mob*, if the new member is in this zone, or a nullptr Mob*
// and the name and CharacterID of the new member, if they are out of zone.
//
if(!newmember && !NewMemberName)
return false;
if(GroupCount() >= MAX_GROUP_MEMBERS) //Sanity check for merging groups together.
if(GroupCount() >= MAX_GROUP_MEMBERS) //Sanity check for merging groups together.
return false;
if(!newmember)
InZone = false;
else
{
NewMemberName = newmember->GetCleanName();
if(newmember->IsClient())
CharacterID = newmember->CastToClient()->CharacterID();
if(newmember->IsMerc())
{
Client* owner = newmember->CastToMerc()->GetMercOwner();
if(owner)
{
CharacterID = owner->CastToClient()->CharacterID();
NewMemberName = newmember->GetName();
ismerc = true;
}
}
}
uint32 i = 0;
// See if they are already in the group
//
for (i = 0; i < MAX_GROUP_MEMBERS; ++i)
if(!strcasecmp(membername[i], NewMemberName))
return false;
if(!newmember)
InZone = false;
else
{
NewMemberName = newmember->GetCleanName();
// Put them in the group
for (i = 0; i < MAX_GROUP_MEMBERS; ++i)
{
if (membername[i][0] == '\0')
{
if(InZone)
members[i] = newmember;
if(newmember->IsClient())
CharacterID = newmember->CastToClient()->CharacterID();
if(newmember->IsMerc())
{
Client* owner = newmember->CastToMerc()->GetMercOwner();
if(owner)
{
CharacterID = owner->CastToClient()->CharacterID();
NewMemberName = newmember->GetName();
ismerc = true;
}
}
}
break;
}
}
uint32 i = 0;
if (i == MAX_GROUP_MEMBERS)
return false;
// See if they are already in the group
//
for (i = 0; i < MAX_GROUP_MEMBERS; ++i)
if(!strcasecmp(membername[i], NewMemberName))
return false;
// Put them in the group
for (i = 0; i < MAX_GROUP_MEMBERS; ++i)
{
if (membername[i][0] == '\0')
{
if(InZone)
members[i] = newmember;
break;
}
}
if (i == MAX_GROUP_MEMBERS)
return false;
strcpy(membername[i], NewMemberName);
strcpy(membername[i], NewMemberName);
MemberRoles[i] = 0;
int x=1;
int x=1;
//build the template join packet
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer;
strcpy(gj->membername, NewMemberName);
gj->action = groupActJoin;
//build the template join packet
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer;
strcpy(gj->membername, NewMemberName);
gj->action = groupActJoin;
gj->leader_aas = LeaderAbilities;
gj->leader_aas = LeaderAbilities;
for (i = 0;i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr && members[i] != newmember) {
//fill in group join & send it
if(members[i]->IsMerc())
{
strcpy(gj->yourname, members[i]->GetName());
}
else
{
strcpy(gj->yourname, members[i]->GetCleanName());
}
if(members[i]->IsClient()) {
members[i]->CastToClient()->QueuePacket(outapp);
for (i = 0;i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr && members[i] != newmember) {
//fill in group join & send it
if(members[i]->IsMerc())
{
strcpy(gj->yourname, members[i]->GetName());
}
else
{
strcpy(gj->yourname, members[i]->GetCleanName());
}
if(members[i]->IsClient()) {
members[i]->CastToClient()->QueuePacket(outapp);
//put new member into existing person's list
strcpy(members[i]->CastToClient()->GetPP().groupMembers[this->GroupCount()-1], NewMemberName);
}
//put new member into existing person's list
strcpy(members[i]->CastToClient()->GetPP().groupMembers[this->GroupCount()-1], NewMemberName);
}
//put this existing person into the new member's list
if(InZone && newmember->IsClient()) {
if(IsLeader(members[i]))
strcpy(newmember->CastToClient()->GetPP().groupMembers[0], members[i]->GetCleanName());
else {
strcpy(newmember->CastToClient()->GetPP().groupMembers[x], members[i]->GetCleanName());
x++;
}
}
}
}
if(InZone)
{
//put new member in his own list.
newmember->SetGrouped(true);
if(newmember->IsClient())
{
strcpy(newmember->CastToClient()->GetPP().groupMembers[x], NewMemberName);
newmember->CastToClient()->Save();
database.SetGroupID(NewMemberName, GetID(), newmember->CastToClient()->CharacterID(), false);
SendMarkedNPCsToMember(newmember->CastToClient());
NotifyMainTank(newmember->CastToClient(), 1);
NotifyMainAssist(newmember->CastToClient(), 1);
NotifyPuller(newmember->CastToClient(), 1);
}
if(newmember->IsMerc())
{
Client* owner = newmember->CastToMerc()->GetMercOwner();
if(owner)
{
database.SetGroupID(newmember->GetName(), GetID(), owner->CharacterID(), true);
}
//put this existing person into the new member's list
if(InZone && newmember->IsClient()) {
if(IsLeader(members[i]))
strcpy(newmember->CastToClient()->GetPP().groupMembers[0], members[i]->GetCleanName());
else {
strcpy(newmember->CastToClient()->GetPP().groupMembers[x], members[i]->GetCleanName());
x++;
}
}
}
}
if(InZone)
{
//put new member in his own list.
newmember->SetGrouped(true);
if(newmember->IsClient())
{
strcpy(newmember->CastToClient()->GetPP().groupMembers[x], NewMemberName);
newmember->CastToClient()->Save();
database.SetGroupID(NewMemberName, GetID(), newmember->CastToClient()->CharacterID(), false);
SendMarkedNPCsToMember(newmember->CastToClient());
NotifyMainTank(newmember->CastToClient(), 1);
NotifyMainAssist(newmember->CastToClient(), 1);
NotifyPuller(newmember->CastToClient(), 1);
}
if(newmember->IsMerc())
{
Client* owner = newmember->CastToMerc()->GetMercOwner();
if(owner)
{
database.SetGroupID(newmember->GetName(), GetID(), owner->CharacterID(), true);
}
}
#ifdef BOTS
for (i = 0;i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr && members[i]->IsBot()) {
members[i]->CastToBot()->CalcChanceToCast();
}
}
for (i = 0;i < MAX_GROUP_MEMBERS; i++) {
if (members[i] != nullptr && members[i]->IsBot()) {
members[i]->CastToBot()->CalcChanceToCast();
}
}
#endif //BOTS
}
else
database.SetGroupID(NewMemberName, GetID(), CharacterID, ismerc);
}
else
database.SetGroupID(NewMemberName, GetID(), CharacterID, ismerc);
safe_delete(outapp);
safe_delete(outapp);
return true;
return true;
}
void Group::AddMember(const char *NewMemberName)
{
// This method should be called when both the new member and the group leader are in a different zone to this one.
//
for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i)
if(!strcasecmp(membername[i], NewMemberName))
{
return;
}
// This method should be called when both the new member and the group leader are in a different zone to this one.
//
for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i)
if(!strcasecmp(membername[i], NewMemberName))
{
return;
}
for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i)
{
if (membername[i][0] == '\0')
{
strcpy(membername[i], NewMemberName);
for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i)
{
if (membername[i][0] == '\0')
{
strcpy(membername[i], NewMemberName);
MemberRoles[i] = 0;
break;
}
}
break;
}
}
}
@@ -374,7 +373,7 @@ void Group::QueuePacket(const EQApplicationPacket *app, bool ack_req)
members[i]->CastToClient()->QueuePacket(app, ack_req);
}
// solar: sends the rest of the group's hps to member. this is useful when
// solar: sends the rest of the group's hps to member. this is useful when
// someone first joins a group, but otherwise there shouldn't be a need to
// call it
void Group::SendHPPacketsTo(Mob *member)
@@ -413,7 +412,7 @@ void Group::SendHPPacketsFrom(Mob *member)
if(!member)
return;
member->CreateHPPacket(&hp_app);
member->CreateHPPacket(&hp_app);
EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct));
uint32 i;
@@ -482,26 +481,26 @@ void Group::MemberZoned(Mob* removemob) {
if(removemob == GetLeader())
SetLeader(nullptr);
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] == removemob) {
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] == removemob) {
members[i] = nullptr;
//should NOT clear the name, it is used for world communication.
break;
}
}
#ifdef BOTS
if (members[i] != nullptr && members[i]->IsBot()) {
members[i]->CastToBot()->CalcChanceToCast();
}
#endif //BOTS
}
if(removemob->IsClient() && HasRole(removemob, RoleAssist))
SetGroupAssistTarget(0);
}
if(removemob->IsClient() && HasRole(removemob, RoleAssist))
SetGroupAssistTarget(0);
if(removemob->IsClient() && HasRole(removemob, RoleTank))
SetGroupTankTarget(0);
if(removemob->IsClient() && HasRole(removemob, RoleTank))
SetGroupTankTarget(0);
if(removemob->IsClient() && HasRole(removemob, RolePuller))
SetGroupPullerTarget(0);
if(removemob->IsClient() && HasRole(removemob, RolePuller))
SetGroupPullerTarget(0);
}
bool Group::DelMemberOOZ(const char *Name) {
@@ -550,7 +549,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender)
memset(membername[i],0,64);
MemberRoles[i] = 0;
break;
}
}
}
//handle leader quitting group gracefully
@@ -604,7 +603,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender)
if(oldmember->IsClient())
oldmember->CastToClient()->QueuePacket(outapp);
}
}
if(oldmember->IsClient())
database.SetGroupID(oldmember->GetCleanName(), 0, oldmember->CastToClient()->CharacterID());
@@ -622,7 +621,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender)
if(HasRole(oldmember, RoleAssist))
{
SetGroupAssistTarget(0);
SetGroupAssistTarget(0);
UnDelegateMainAssist(oldmember->GetName());
}
@@ -771,7 +770,7 @@ void Group::GroupMessage(Mob* sender, uint8 language, uint8 lang_skill, const ch
}
uint32 Group::GetTotalGroupDamage(Mob* other) {
uint32 total = 0;
uint32 total = 0;
uint32 i;
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
@@ -825,7 +824,7 @@ void Group::DisbandGroup() {
entity_list.RemoveGroup(GetID());
if(GetID() != 0)
database.ClearGroup(GetID());
database.ClearGroup(GetID());
if(Leader && (Leader->IsLFP())) {
Leader->UpdateLFP();
@@ -920,12 +919,12 @@ uint32 Group::GetHighestLevel()
uint32 level = 1;
uint32 i;
for (i = 0; i < MAX_GROUP_MEMBERS; i++)
{
{
if (members[i])
{
{
if(members[i]->GetLevel() > level)
level = members[i]->GetLevel();
}
}
}
return level;
}
@@ -934,12 +933,12 @@ uint32 Group::GetLowestLevel()
uint32 level = 255;
uint32 i;
for (i = 0; i < MAX_GROUP_MEMBERS; i++)
{
{
if (members[i])
{
{
if(members[i]->GetLevel() < level)
level = members[i]->GetLevel();
}
}
}
return level;
}
@@ -947,10 +946,10 @@ uint32 i;
void Group::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float x, float y, float z, float heading)
{
uint32 i;
for (i = 0; i < MAX_GROUP_MEMBERS; i++)
{
for (i = 0; i < MAX_GROUP_MEMBERS; i++)
{
if (members[i] != nullptr && members[i]->IsClient() && members[i] != sender)
{
{
members[i]->CastToClient()->MovePC(zoneID, instance_id, x, y, z, heading, 0, ZoneSolicited);
}
}
@@ -958,11 +957,11 @@ void Group::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float
bool Group::LearnMembers() {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT name FROM group_id WHERE groupid=%lu", (unsigned long)GetID()),
errbuf,&result)){
errbuf,&result)){
safe_delete_array(query);
if(mysql_num_rows(result) < 1) { //could prolly be 2
mysql_free_result(result);
@@ -1102,7 +1101,7 @@ void Group::BalanceHP(int32 penalty)
{
if(members[gi]){
if((members[gi]->GetMaxHP() - dmgtaken) < 1){ //this way the ability will never kill someone
members[gi]->SetHP(1); //but it will come darn close
members[gi]->SetHP(1); //but it will come darn close
members[gi]->SendHPUpdate();
}
else{
@@ -1277,7 +1276,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
char *Query = nullptr;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET maintank='%s' WHERE gid=%i LIMIT 1",
MainTankName.c_str(), GetID()), errbuff))
MainTankName.c_str(), GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to set group main tank: %s\n", errbuff);
safe_delete_array(Query);
@@ -1326,7 +1325,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
char *Query = nullptr;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET assist='%s' WHERE gid=%i LIMIT 1",
MainAssistName.c_str(), GetID()), errbuff))
MainAssistName.c_str(), GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to set group main assist: %s\n", errbuff);
safe_delete_array(Query);
@@ -1375,7 +1374,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
char *Query = nullptr;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET puller='%s' WHERE gid=%i LIMIT 1",
PullerName.c_str(), GetID()), errbuff))
PullerName.c_str(), GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to set group main puller: %s\n", errbuff);
safe_delete_array(Query);
@@ -1529,7 +1528,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle)
char *Query = 0;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET maintank='' WHERE gid=%i LIMIT 1",
GetID()), errbuff))
GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to clear group main tank: %s\n", errbuff);
safe_delete_array(Query);
@@ -1583,7 +1582,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle)
char *Query = 0;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET assist='' WHERE gid=%i LIMIT 1",
GetID()), errbuff))
GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to clear group main assist: %s\n", errbuff);
safe_delete_array(Query);
@@ -1615,7 +1614,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle)
char *Query = 0;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET puller='' WHERE gid=%i LIMIT 1",
GetID()), errbuff))
GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to clear group main puller: %s\n", errbuff);
safe_delete_array(Query);
@@ -1758,7 +1757,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName)
char *Query = 0;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET marknpc='%s' WHERE gid=%i LIMIT 1",
NewNPCMarkerName, GetID()), errbuff))
NewNPCMarkerName, GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to set group mark npc: %s\n", errbuff);
safe_delete_array(Query);
@@ -1844,7 +1843,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName)
char *Query = 0;
if (!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE group_leaders SET marknpc='' WHERE gid=%i LIMIT 1",
GetID()), errbuff))
GetID()), errbuff))
LogFile->write(EQEMuLog::Error, "Unable to clear group marknpc: %s\n", errbuff);
safe_delete_array(Query);
@@ -2135,3 +2134,4 @@ bool Group::HasRole(Mob *m, uint8 Role)
}
return false;
}
+12 -12
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef GROUPS_H
#define GROUPS_H
@@ -125,7 +125,7 @@ public:
void SetNPCMarker(const char *NewNPCMarkerName);
void UnMarkNPC(uint16 ID);
void SendMarkedNPCsToMember(Client *c, bool Clear = false);
inline int GetLeadershipAA(int AAID) { return LeaderAbilities.ranks[AAID]; }
inline int GetLeadershipAA(int AAID) { return LeaderAbilities.ranks[AAID]; }
void ClearAllNPCMarks();
void QueueHPPacketsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app);
void ChangeLeader(Mob* newleader);
+12 -12
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "masterentity.h"
@@ -382,7 +382,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid,uint16 guild_id,const char* zone)
MYSQL_ROW row;
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_RES *result;
if (!RunQuery(query, MakeAnyLenString(&query,
"SELECT guild FROM doors where doorid=%i AND zone='%s'",
doorid-128, zone), errbuf, &result))
+31 -30
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "guild_mgr.h"
@@ -388,7 +388,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
if(pack->size != sizeof(ServerGuildRankUpdate_Struct))
{
_log(GUILDS__ERROR, "Received ServerOP_RankUpdate of incorrect size %d, expected %d",
pack->size, sizeof(ServerGuildRankUpdate_Struct));
pack->size, sizeof(ServerGuildRankUpdate_Struct));
return;
}
@@ -461,7 +461,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
char *Buffer = (char *)pack->pBuffer;
uint32 FromID = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
uint32 Count = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
uint32 Count = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
Client *c = entity_list.GetClientByCharID(FromID);
if (!c || !c->IsInAGuild())
@@ -647,7 +647,7 @@ GuildBankManager::~GuildBankManager()
bool GuildBankManager::Load(uint32 GuildID)
{
const char *LoadQuery = "SELECT `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `whofor` from `guild_bank` "
const char *LoadQuery = "SELECT `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `whofor` from `guild_bank` "
"WHERE `guildid` = %i";
char errbuf[MYSQL_ERRMSG_SIZE];
@@ -784,15 +784,15 @@ void GuildBankManager::SendGuildBank(Client *c)
if(!Item->Stackable)
gbius->Init(GuildBankItemUpdate, 1, i, GuildBankDepositArea, 1, Item->ID, Item->Icon, 1,
(*Iterator)->Items.DepositArea[i].Permissions, 0, 0);
(*Iterator)->Items.DepositArea[i].Permissions, 0, 0);
else
{
if((*Iterator)->Items.DepositArea[i].Quantity == Item->StackSize)
gbius->Init(GuildBankItemUpdate, 1, i, GuildBankDepositArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 0, 0);
(*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 0, 0);
else
gbius->Init(GuildBankItemUpdate, 1, i, GuildBankDepositArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 1, 0);
(*Iterator)->Items.DepositArea[i].Quantity, (*Iterator)->Items.DepositArea[i].Permissions, 1, 0);
}
strn0cpy(gbius->ItemName, Item->Name, sizeof(gbius->ItemName));
@@ -822,15 +822,15 @@ void GuildBankManager::SendGuildBank(Client *c)
if(!Item->Stackable)
gbius->Init(GuildBankItemUpdate, 1, i, GuildBankMainArea, 1, Item->ID, Item->Icon, 1,
(*Iterator)->Items.MainArea[i].Permissions, 0, Useable);
(*Iterator)->Items.MainArea[i].Permissions, 0, Useable);
else
{
if((*Iterator)->Items.MainArea[i].Quantity == Item->StackSize)
gbius->Init(GuildBankItemUpdate, 1, i, GuildBankMainArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 0, Useable);
(*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 0, Useable);
else
gbius->Init(GuildBankItemUpdate, 1, i, GuildBankMainArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 1, Useable);
(*Iterator)->Items.MainArea[i].Quantity, (*Iterator)->Items.MainArea[i].Permissions, 1, Useable);
}
strn0cpy(gbius->ItemName, Item->Name, sizeof(gbius->ItemName));
@@ -932,7 +932,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
}
const char *Query="INSERT INTO `guild_bank` (`guildid`, `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `WhoFor`) "
"VALUES (%i, %i, %i, %i, %i, '%s', %i, '%s')";
"VALUES (%i, %i, %i, %i, %i, '%s', %i, '%s')";
char errbuf[MYSQL_ERRMSG_SIZE];
@@ -1014,7 +1014,7 @@ int GuildBankManager::Promote(uint32 GuildID, int SlotID)
strn0cpy((*Iterator)->Items.MainArea[MainSlot].WhoFor, (*Iterator)->Items.DepositArea[SlotID].WhoFor, sizeof((*Iterator)->Items.MainArea[MainSlot].WhoFor));
const char *Query="UPDATE `guild_bank` SET `area` = 1, `slot` = %i WHERE `guildid` = %i AND `area` = 0 AND `slot` = %i LIMIT 1";
const char *Query="UPDATE `guild_bank` SET `area` = 1, `slot` = %i WHERE `guildid` = %i AND `area` = 0 AND `slot` = %i LIMIT 1";
char errbuf[MYSQL_ERRMSG_SIZE];
@@ -1043,10 +1043,10 @@ int GuildBankManager::Promote(uint32 GuildID, int SlotID)
{
if((*Iterator)->Items.MainArea[MainSlot].Quantity == Item->StackSize)
gbius.Init(GuildBankItemUpdate, 1, MainSlot, GuildBankMainArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 0, 0);
(*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 0, 0);
else
gbius.Init(GuildBankItemUpdate, 1, MainSlot, GuildBankMainArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 1, 0);
(*Iterator)->Items.MainArea[MainSlot].Quantity, 0, 1, 0);
}
strn0cpy(gbius.ItemName, Item->Name, sizeof(gbius.ItemName));
@@ -1077,7 +1077,7 @@ void GuildBankManager::SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Perm
return;
}
const char *Query="UPDATE `guild_bank` SET `permissions` = %i, `whofor` = '%s' WHERE `guildid` = %i AND `area` = 1 AND `slot` = %i LIMIT 1";
const char *Query="UPDATE `guild_bank` SET `permissions` = %i, `whofor` = '%s' WHERE `guildid` = %i AND `area` = 1 AND `slot` = %i LIMIT 1";
char errbuf[MYSQL_ERRMSG_SIZE];
@@ -1112,10 +1112,10 @@ void GuildBankManager::SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Perm
{
if((*Iterator)->Items.MainArea[SlotID].Quantity == Item->StackSize)
gbius.Init(GuildBankItemUpdate, 1, SlotID, GuildBankMainArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 0, 0);
(*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 0, 0);
else
gbius.Init(GuildBankItemUpdate, 1, SlotID, GuildBankMainArea, 1, Item->ID, Item->Icon,
(*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 1, 0);
(*Iterator)->Items.MainArea[SlotID].Quantity, (*Iterator)->Items.MainArea[SlotID].Permissions, 1, 0);
}
@@ -1126,7 +1126,7 @@ void GuildBankManager::SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Perm
entity_list.QueueClientsGuildBankItemUpdate(&gbius, GuildID);
}
ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity)
ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity)
{
std::list<GuildBank*>::iterator Iterator = GetGuildBank(GuildID);
@@ -1264,7 +1264,7 @@ bool GuildBankManager::DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, ui
const char *Query = "UPDATE `guild_bank` SET `qty` = %i where `guildid` = %i AND `area` = %i AND `slot` = %i LIMIT 1";
if(!database.RunQuery(query, MakeAnyLenString(&query, Query, BankArea[SlotID].Quantity - Quantity,
GuildID, Area, SlotID), errbuf))
GuildID, Area, SlotID), errbuf))
{
_log(GUILDS__BANK_ERROR, "Update item failed. %s : %s", query, errbuf);
@@ -1481,7 +1481,7 @@ bool GuildApproval::ProcessApproval()
{
if(owner && owner->GuildID() != 0)
{
owner->Message(10,"You are already in a guild! Guild request deleted.");
owner->Message(10,"You are already in a guild! Guild request deleted.");
return false;
}
if(deletion_timer->Check() || !owner)
@@ -1611,3 +1611,4 @@ void GuildApproval::GuildApproved()
owner->Message(0, "Your guild was created.");
owner = 0;
}
+109 -109
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
@@ -44,14 +44,14 @@ HateList::~HateList()
// checks if target still is in frenzy mode
void HateList::CheckFrenzyHate()
{
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
if (iterator.GetData()->ent->GetHPRatio() >= 20)
iterator.GetData()->bFrenzy = false;
iterator.Advance();
}
{
if (iterator.GetData()->ent->GetHPRatio() >= 20)
iterator.GetData()->bFrenzy = false;
iterator.Advance();
}
}
void HateList::Wipe()
@@ -62,8 +62,8 @@ void HateList::Wipe()
while(iterator.MoreElements())
{
Mob* m = iterator.GetData()->ent;
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0);
iterator.RemoveCurrent();
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0);
iterator.RemoveCurrent();
if(m->IsClient())
m->CastToClient()->DecrementAggroCount();
@@ -80,27 +80,27 @@ bool HateList::IsOnHateList(Mob *mob)
tHateEntry *HateList::Find(Mob *ent)
{
_ZP(HateList_Find);
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
if(iterator.GetData()->ent == ent)
return iterator.GetData();
iterator.Advance();
}
{
if(iterator.GetData()->ent == ent)
return iterator.GetData();
iterator.Advance();
}
return nullptr;
}
void HateList::Set(Mob* other, uint32 in_hate, uint32 in_dam)
{
tHateEntry *p = Find(other);
if(p)
{
tHateEntry *p = Find(other);
if(p)
{
if(in_dam > 0)
p->damage = in_dam;
p->damage = in_dam;
if(in_hate > 0)
p->hate = in_hate;
}
p->hate = in_hate;
}
}
Mob* HateList::GetDamageTop(Mob* hater)
@@ -111,10 +111,10 @@ Mob* HateList::GetDamageTop(Mob* hater)
Raid* r = nullptr;
uint32 dmg_amt = 0;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
{
grp = nullptr;
r = nullptr;
@@ -122,7 +122,7 @@ Mob* HateList::GetDamageTop(Mob* hater)
r = entity_list.GetRaidByClient(iterator.GetData()->ent->CastToClient());
}
grp = entity_list.GetGroupByMob(iterator.GetData()->ent);
grp = entity_list.GetGroupByMob(iterator.GetData()->ent);
if(iterator.GetData()->ent && r){
if(r->GetTotalRaidDamage(hater) >= dmg_amt)
@@ -132,20 +132,20 @@ Mob* HateList::GetDamageTop(Mob* hater)
}
}
else if (iterator.GetData()->ent != nullptr && grp != nullptr)
{
{
if (grp->GetTotalGroupDamage(hater) >= dmg_amt)
{
{
current = iterator.GetData()->ent;
dmg_amt = grp->GetTotalGroupDamage(hater);
}
}
else if (iterator.GetData()->ent != nullptr && (uint32)iterator.GetData()->damage >= dmg_amt)
{
}
}
else if (iterator.GetData()->ent != nullptr && (uint32)iterator.GetData()->damage >= dmg_amt)
{
current = iterator.GetData()->ent;
dmg_amt = iterator.GetData()->damage;
}
iterator.Advance();
}
}
iterator.Advance();
}
return current;
}
@@ -155,15 +155,15 @@ Mob* HateList::GetClosest(Mob *hater) {
float closedist = 99999.9f;
float thisdist;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements()) {
thisdist = iterator.GetData()->ent->DistNoRootNoZ(*hater);
if(iterator.GetData()->ent != nullptr && thisdist <= closedist) {
closedist = thisdist;
close = iterator.GetData()->ent;
}
iterator.Advance();
iterator.Advance();
}
if (close == 0 && hater->IsNPC())
@@ -177,7 +177,7 @@ Mob* HateList::GetClosest(Mob *hater) {
void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAddIfNotExist)
{
if(!ent)
return;
return;
if(ent->IsCorpse())
return;
@@ -193,17 +193,17 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd
p->bFrenzy = bFrenzy;
}
else if (iAddIfNotExist) {
p = new tHateEntry;
p->ent = ent;
p->damage = (in_dam>=0)?in_dam:0;
p->hate = in_hate;
p->bFrenzy = bFrenzy;
list.Append(p);
p = new tHateEntry;
p->ent = ent;
p->damage = (in_dam>=0)?in_dam:0;
p->hate = in_hate;
p->bFrenzy = bFrenzy;
list.Append(p);
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0);
if(ent->IsClient())
ent->CastToClient()->IncrementAggroCount();
}
}
}
bool HateList::RemoveEnt(Mob *ent)
@@ -216,14 +216,14 @@ bool HateList::RemoveEnt(Mob *ent)
{
if(iterator.GetData()->ent == ent)
{
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0);
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0);
iterator.RemoveCurrent();
found = true;
if(ent->IsClient())
ent->CastToClient()->DecrementAggroCount();
}
}
else
iterator.Advance();
}
@@ -234,21 +234,21 @@ void HateList::DoFactionHits(int32 nfl_id) {
_ZP(HateList_DoFactionHits);
if (nfl_id <= 0)
return;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
Client *p;
{
Client *p;
if (iterator.GetData()->ent && iterator.GetData()->ent->IsClient())
p = iterator.GetData()->ent->CastToClient();
else
p = nullptr;
if (iterator.GetData()->ent && iterator.GetData()->ent->IsClient())
p = iterator.GetData()->ent->CastToClient();
else
p = nullptr;
if (p)
if (p)
p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity());
iterator.Advance();
}
iterator.Advance();
}
}
Mob *HateList::GetTop(Mob *center)
@@ -260,13 +260,13 @@ Mob *HateList::GetTop(Mob *center)
if (RuleB(Aggro,SmartAggroList)){
Mob* topClientTypeInRange = nullptr;
int32 hateClientTypeInRange = -1;
int skipped_count = 0;
int skipped_count = 0;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
tHateEntry *cur = iterator.GetData();
tHateEntry *cur = iterator.GetData();
int16 aggroMod = 0;
if(!cur){
@@ -279,13 +279,13 @@ Mob *HateList::GetTop(Mob *center)
continue;
}
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
skipped_count++;
iterator.Advance();
continue;
}
}
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
skipped_count++;
iterator.Advance();
continue;
}
}
if(cur->ent->DivineAura() || cur->ent->IsMezzed() || cur->ent->IsFeared()){
if(hate == -1)
@@ -362,7 +362,7 @@ Mob *HateList::GetTop(Mob *center)
}
#endif //BOTS
if(!isTopClientType) {
if(!isTopClientType) {
if(top->IsMerc()) {
isTopClientType = true;
topClientTypeInRange = top;
@@ -373,28 +373,28 @@ Mob *HateList::GetTop(Mob *center)
return topClientTypeInRange;
return top;
}
}
else {
if(top == nullptr && skipped_count > 0) {
return center->GetTarget();
}
return center->GetTarget();
}
return top;
}
}
}
else{
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
int skipped_count = 0;
int skipped_count = 0;
while(iterator.MoreElements())
{
tHateEntry *cur = iterator.GetData();
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
skipped_count++;
iterator.Advance();
continue;
}
}
tHateEntry *cur = iterator.GetData();
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
skipped_count++;
iterator.Advance();
continue;
}
}
if(cur->ent != nullptr && ((cur->hate > hate) || cur->bFrenzy ))
{
@@ -404,8 +404,8 @@ Mob *HateList::GetTop(Mob *center)
iterator.Advance();
}
if(top == nullptr && skipped_count > 0) {
return center->GetTarget();
}
return center->GetTarget();
}
return top;
}
}
@@ -434,32 +434,32 @@ Mob *HateList::GetMostHate(){
Mob *HateList::GetRandom()
{
int count = 0;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
int count = 0;
LinkedListIterator<tHateEntry*> iterator(list);
iterator.Reset();
while(iterator.MoreElements())
{
iterator.Advance();
count++;
}
{
iterator.Advance();
count++;
}
if(!count)
return nullptr;
int random = MakeRandomInt(0, count-1);
iterator.Reset();
for (int i = 0; i < random; i++)
iterator.Advance();
return iterator.GetData()->ent;
int random = MakeRandomInt(0, count-1);
iterator.Reset();
for (int i = 0; i < random; i++)
iterator.Advance();
return iterator.GetData()->ent;
}
int32 HateList::GetEntHate(Mob *ent, bool damage)
{
tHateEntry *p;
p = Find(ent);
p = Find(ent);
if ( p && damage)
return p->damage;
return p->damage;
else if (p)
return p->hate;
else
+43 -43
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef HATELIST_H
@@ -22,41 +22,41 @@
class tHateEntry
{
public:
Mob *ent;
int32 damage, hate;
bool bFrenzy;
Mob *ent;
int32 damage, hate;
bool bFrenzy;
};
class HateList
{
public:
HateList();
~HateList();
HateList();
~HateList();
// adds a mob to the hatelist
void Add(Mob *ent, int32 in_hate=0, int32 in_dam=0, bool bFrenzy = false, bool iAddIfNotExist = true);
// sets existing hate
void Set(Mob *other, uint32 in_hate, uint32 in_dam);
// removes mobs from hatelist
bool RemoveEnt(Mob *ent);
// Remove all
void Wipe();
// ???
void DoFactionHits(int32 nfl_id);
// Gets Hate amount for mob
int32 GetEntHate(Mob *ent, bool damage = false);
// gets top hated mob
Mob *GetTop(Mob *center);
// gets any on the list
Mob *GetRandom();
// get closest mob or nullptr if list empty
Mob *GetClosest(Mob *hater);
// gets top mob or nullptr if hate list empty
Mob *GetDamageTop(Mob *hater);
// used to check if mob is on hatelist
bool IsOnHateList(Mob *);
// used to remove or add frenzy hate
void CheckFrenzyHate();
// adds a mob to the hatelist
void Add(Mob *ent, int32 in_hate=0, int32 in_dam=0, bool bFrenzy = false, bool iAddIfNotExist = true);
// sets existing hate
void Set(Mob *other, uint32 in_hate, uint32 in_dam);
// removes mobs from hatelist
bool RemoveEnt(Mob *ent);
// Remove all
void Wipe();
// ???
void DoFactionHits(int32 nfl_id);
// Gets Hate amount for mob
int32 GetEntHate(Mob *ent, bool damage = false);
// gets top hated mob
Mob *GetTop(Mob *center);
// gets any on the list
Mob *GetRandom();
// get closest mob or nullptr if list empty
Mob *GetClosest(Mob *hater);
// gets top mob or nullptr if hate list empty
Mob *GetDamageTop(Mob *hater);
// used to check if mob is on hatelist
bool IsOnHateList(Mob *);
// used to remove or add frenzy hate
void CheckFrenzyHate();
//Gets the target with the most hate regardless of things like frenzy etc.
Mob* GetMostHate();
@@ -64,7 +64,7 @@ public:
void SpellCast(Mob *caster, uint32 spell_id, float range);
bool IsEmpty();
bool IsEmpty();
void PrintToClient(Client *c);
//For accessing the hate list via perl; don't use for anything else
@@ -74,9 +74,9 @@ public:
void SetOwner(Mob *newOwner) { owner = newOwner; }
protected:
tHateEntry *Find(Mob *ent);
tHateEntry *Find(Mob *ent);
private:
LinkedList<tHateEntry*> list;
LinkedList<tHateEntry*> list;
Mob *owner;
};
+13 -18
View File
@@ -1,23 +1,21 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "masterentity.h"
#include "../common/Item.h"
@@ -127,18 +125,16 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
return nullptr;
}
else {
LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query, errbuf);
safe_delete_array(query);
return nullptr;
}
}
void Client::SummonHorse(uint16 spell_id) {
if (GetHorseId() != 0) {
Message(13,"You already have a Horse. Get off, Fatbutt!");
Message(13,"You already have a Horse. Get off, Fatbutt!");
return;
}
if(!Horse::IsHorseSpell(spell_id)) {
@@ -205,4 +201,3 @@ void Mob::CreateHorseSpawnPacket(EQApplicationPacket* app, const char* ownername
#endif
}
+11 -15
View File
@@ -1,24 +1,23 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef HORSES_H
#define HORSES_H
#include "../common/debug.h"
#include "npc.h"
@@ -42,7 +41,4 @@ protected:
static const NPCType *BuildHorseType(uint16 spell_id);
};
#endif
+225 -224
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "masterentity.h"
@@ -41,145 +41,145 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
ItemInst *cur = nullptr;
int i;
if(where_to_check & invWhereWorn) {
for (i=0; i<=21; i++) { // Equipped
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
if(where_to_check & invWhereWorn) {
for (i=0; i<=21; i++) { // Equipped
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
DeleteItemInInventory(i, 0, true);
}
}
// Power Source Slot
if (GetItemIDAt(9999) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(9999) != INVALID_ID)) {
cur = m_inv.GetItem(9999);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
// Power Source Slot
if (GetItemIDAt(9999) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(9999) != INVALID_ID)) {
cur = m_inv.GetItem(9999);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
if (GetClientVersion() >= EQClientSoF)
DeleteItemInInventory(9999, 0, true);
else
DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash
}
}
if (GetClientVersion() >= EQClientSoF)
DeleteItemInInventory(9999, 0, true);
else
DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash
}
}
if(where_to_check & invWhereCursor) {
if (GetItemIDAt(30) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(30) != INVALID_ID)) {
cur = m_inv.GetItem(30);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
if(where_to_check & invWhereCursor) {
if (GetItemIDAt(30) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(30) != INVALID_ID)) {
cur = m_inv.GetItem(30);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(30, 0, true);
}
DeleteItemInInventory(30, 0, true);
}
for (i=331; i<=340; i++) { // cursor's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
for (i=331; i<=340; i++) { // cursor's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
}
DeleteItemInInventory(i, 0, true);
}
}
}
if(where_to_check & invWherePersonal) {
for (i=22; i<=29; i++) { // Equipped
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
if(where_to_check & invWherePersonal) {
for (i=22; i<=29; i++) { // Equipped
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
DeleteItemInInventory(i, 0, true);
}
}
for (i=251; i<=330; i++) { // Main inventory's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
for (i=251; i<=330; i++) { // Main inventory's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
}
DeleteItemInInventory(i, 0, true);
}
}
}
if(where_to_check & invWhereBank) {
for (i=2000; i<=2023; i++) { // Bank slots
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
if(where_to_check & invWhereBank) {
for (i=2000; i<=2023; i++) { // Bank slots
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
DeleteItemInInventory(i, 0, true);
}
}
for (i=2031; i<=2270; i++) { // Bank's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
for (i=2031; i<=2270; i++) { // Bank's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
}
DeleteItemInInventory(i, 0, true);
}
}
}
if(where_to_check & invWhereSharedBank) {
for (i=2500; i<=2501; i++) { // Shared bank
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
if(where_to_check & invWhereSharedBank) {
for (i=2500; i<=2501; i++) { // Shared bank
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
DeleteItemInInventory(i, 0, true);
}
}
for (i=2531; i<=2550; i++) { // Shared bank's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
for (i=2531; i<=2550; i++) { // Shared bank's containers
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
cur = m_inv.GetItem(i);
if(cur && cur->GetItem()->Stackable) {
x += cur->GetCharges();
} else {
x++;
}
DeleteItemInInventory(i, 0, true);
}
}
}
DeleteItemInInventory(i, 0, true);
}
}
}
return x;
}
@@ -305,7 +305,7 @@ void Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
}
}
}
else { // Item was already in inventory & is a LORE item or was a GM only item. Give them a message about it.
else { // Item was already in inventory & is a LORE item or was a GM only item. Give them a message about it.
if (foundlore){
DuplicateLoreMessage(item_id);
//Message(0, "You already have a %s (%i) in your inventory!", item->Name, item_id);
@@ -447,14 +447,14 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
if(bagitem) {
int16 bagslot_id = Inventory::CalcSlotId(slot_id, bag_idx);
qsaudit->items[++parent_offset].char_slot = bagslot_id;
qsaudit->items[parent_offset].item_id = bagitem->GetID();
qsaudit->items[parent_offset].charges = bagitem->GetCharges();
qsaudit->items[parent_offset].aug_1 = bagitem->GetAugmentItemID(1);
qsaudit->items[parent_offset].aug_2 = bagitem->GetAugmentItemID(2);
qsaudit->items[parent_offset].aug_3 = bagitem->GetAugmentItemID(3);
qsaudit->items[parent_offset].aug_4 = bagitem->GetAugmentItemID(4);
qsaudit->items[parent_offset].aug_5 = bagitem->GetAugmentItemID(5);
qsaudit->items[++parent_offset].char_slot = bagslot_id;
qsaudit->items[parent_offset].item_id = bagitem->GetID();
qsaudit->items[parent_offset].charges = bagitem->GetCharges();
qsaudit->items[parent_offset].aug_1 = bagitem->GetAugmentItemID(1);
qsaudit->items[parent_offset].aug_2 = bagitem->GetAugmentItemID(2);
qsaudit->items[parent_offset].aug_3 = bagitem->GetAugmentItemID(3);
qsaudit->items[parent_offset].aug_4 = bagitem->GetAugmentItemID(4);
qsaudit->items[parent_offset].aug_5 = bagitem->GetAugmentItemID(5);
}
}
}
@@ -470,14 +470,14 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
const ItemInst* inst=nullptr;
if (slot_id==SLOT_CURSOR) {
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
if(update_db)
database.SaveCursor(character_id, s, e);
if(update_db)
database.SaveCursor(character_id, s, e);
}
else {
// Save change to database
inst = m_inv[slot_id];
if(update_db)
database.SaveInventory(character_id, inst, slot_id);
if(update_db)
database.SaveInventory(character_id, inst, slot_id);
}
if(client_update && IsValidSlot(slot_id)) {
@@ -958,10 +958,10 @@ bool Client::IsValidSlot(uint32 slot)
bool Client::IsBankSlot(uint32 slot)
{
if((slot >= 2000 && slot <= 2023) || // Bank
(slot >= 2031 && slot <= 2270) || // Bank bags
(slot >= 2500 && slot <= 2501) || // Shared bank
(slot >= 2531 && slot <= 2550)) // Shared bank bags
if ((slot >= 2000 && slot <= 2023) || // Bank
(slot >= 2031 && slot <= 2270) || // Bank bags
(slot >= 2500 && slot <= 2501) || // Shared bank
(slot >= 2531 && slot <= 2550)) // Shared bank bags
{
return true;
}
@@ -1464,30 +1464,30 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
const ItemInst* from_inst = m_inv[postaction_call?to_slot_id:from_slot_id];
if(from_inst) {
qsaudit->items[move_count].from_slot = from_slot_id;
qsaudit->items[move_count].to_slot = to_slot_id;
qsaudit->items[move_count].item_id = from_inst->GetID();
qsaudit->items[move_count].charges = from_inst->GetCharges();
qsaudit->items[move_count].aug_1 = from_inst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = from_inst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = from_inst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = from_inst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5);
qsaudit->items[move_count].from_slot = from_slot_id;
qsaudit->items[move_count].to_slot = to_slot_id;
qsaudit->items[move_count].item_id = from_inst->GetID();
qsaudit->items[move_count].charges = from_inst->GetCharges();
qsaudit->items[move_count].aug_1 = from_inst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = from_inst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = from_inst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = from_inst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5);
if(from_inst->IsType(ItemClassContainer)) {
for(uint8 bag_idx = 0; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) {
const ItemInst* from_baginst = from_inst->GetItem(bag_idx);
if(from_baginst) {
qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(from_slot_id, bag_idx);
qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(to_slot_id, bag_idx);
qsaudit->items[move_count].item_id = from_baginst->GetID();
qsaudit->items[move_count].charges = from_baginst->GetCharges();
qsaudit->items[move_count].aug_1 = from_baginst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = from_baginst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = from_baginst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = from_baginst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = from_baginst->GetAugmentItemID(5);
qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(from_slot_id, bag_idx);
qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(to_slot_id, bag_idx);
qsaudit->items[move_count].item_id = from_baginst->GetID();
qsaudit->items[move_count].charges = from_baginst->GetCharges();
qsaudit->items[move_count].aug_1 = from_baginst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = from_baginst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = from_baginst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = from_baginst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = from_baginst->GetAugmentItemID(5);
}
}
}
@@ -1497,30 +1497,30 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
const ItemInst* to_inst = m_inv[postaction_call?from_slot_id:to_slot_id];
if(to_inst) {
qsaudit->items[move_count].from_slot = to_slot_id;
qsaudit->items[move_count].to_slot = from_slot_id;
qsaudit->items[move_count].item_id = to_inst->GetID();
qsaudit->items[move_count].charges = to_inst->GetCharges();
qsaudit->items[move_count].aug_1 = to_inst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = to_inst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = to_inst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = to_inst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5);
qsaudit->items[move_count].from_slot = to_slot_id;
qsaudit->items[move_count].to_slot = from_slot_id;
qsaudit->items[move_count].item_id = to_inst->GetID();
qsaudit->items[move_count].charges = to_inst->GetCharges();
qsaudit->items[move_count].aug_1 = to_inst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = to_inst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = to_inst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = to_inst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5);
if(to_inst->IsType(ItemClassContainer)) {
for(uint8 bag_idx = 0; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) {
const ItemInst* to_baginst = to_inst->GetItem(bag_idx);
if(to_baginst) {
qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(to_slot_id, bag_idx);
qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(from_slot_id, bag_idx);
qsaudit->items[move_count].item_id = to_baginst->GetID();
qsaudit->items[move_count].charges = to_baginst->GetCharges();
qsaudit->items[move_count].aug_1 = to_baginst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = to_baginst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = to_baginst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = to_baginst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = to_baginst->GetAugmentItemID(5);
qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(to_slot_id, bag_idx);
qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(from_slot_id, bag_idx);
qsaudit->items[move_count].item_id = to_baginst->GetID();
qsaudit->items[move_count].charges = to_baginst->GetCharges();
qsaudit->items[move_count].aug_1 = to_baginst->GetAugmentItemID(1);
qsaudit->items[move_count].aug_2 = to_baginst->GetAugmentItemID(2);
qsaudit->items[move_count].aug_3 = to_baginst->GetAugmentItemID(3);
qsaudit->items[move_count].aug_4 = to_baginst->GetAugmentItemID(4);
qsaudit->items[move_count++].aug_5 = to_baginst->GetAugmentItemID(5);
}
}
}
@@ -1913,7 +1913,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const
return 0;
}
bool Client::LootToStack(uint32 itemid) { //Loots stackable items to existing stacks - Wiz
bool Client::LootToStack(uint32 itemid) { //Loots stackable items to existing stacks - Wiz
// @merth: Need to do loot code with new inventory struct
/*
const Item_Struct* item;
@@ -2079,7 +2079,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
_log(INVENTORY__BANDOLIER, "Char: %s activating set %i", GetName(), bss->number);
int16 slot;
int16 WeaponSlot;
ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory
ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory
// First we pull the items for this bandolier set out of their inventory, this makes space to put the
// currently equipped items back.
@@ -2091,7 +2091,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
// Check if the player has the item specified in the bandolier set on them.
//
slot = m_inv.HasItem(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id, 1,
invWhereWorn|invWherePersonal);
invWhereWorn|invWherePersonal);
// removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here
if (slot == SLOT_INVALID) {
@@ -2121,7 +2121,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
// the client does.
if(((BandolierSlot == bandolierAmmo) || (BandolierSlot == bandolierRange)) &&
BandolierItems[BandolierSlot] && BandolierItems[BandolierSlot]->IsStackable()){
BandolierItems[BandolierSlot] && BandolierItems[BandolierSlot]->IsStackable()){
int Charges = BandolierItems[BandolierSlot]->GetCharges();
// If there is more than one charge
if(Charges > 1) {
@@ -2145,12 +2145,12 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
if(InvItem) {
// If there was an item in that weapon slot, put it in the inventory
_log(INVENTORY__BANDOLIER, "returning item %s in weapon slot %i to inventory",
InvItem->GetItem()->Name, WeaponSlot);
InvItem->GetItem()->Name, WeaponSlot);
if(MoveItemToInventory(InvItem))
database.SaveInventory(character_id, 0, WeaponSlot);
else
_log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(),
InvItem->GetItem()->Name);
InvItem->GetItem()->Name);
safe_delete(InvItem);
}
@@ -2185,7 +2185,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
// If there was already an item in that weapon slot that we replaced, find a place to put it
if(!MoveItemToInventory(InvItem))
_log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(),
InvItem->GetItem()->Name);
InvItem->GetItem()->Name);
safe_delete(InvItem);
}
}
@@ -2196,13 +2196,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
ItemInst *InvItem = m_inv.PopItem(WeaponSlot);
if(InvItem) {
_log(INVENTORY__BANDOLIER, "Bandolier has no item for slot %i, returning item %s to inventory",
WeaponSlot, InvItem->GetItem()->Name);
WeaponSlot, InvItem->GetItem()->Name);
// If there was an item in that weapon slot, put it in the inventory
if(MoveItemToInventory(InvItem))
database.SaveInventory(character_id, 0, WeaponSlot);
else
_log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(),
InvItem->GetItem()->Name);
InvItem->GetItem()->Name);
safe_delete(InvItem);
}
}
@@ -2249,7 +2249,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges();
int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft ? ItemToReturn->GetCharges() :
ChargeSlotsLeft;
ChargeSlotsLeft;
InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove);
@@ -2274,22 +2274,22 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
uint8 BagSlot;
for (BagSlot=0; BagSlot<BagSize; BagSlot++) {
InvItem = m_inv.GetItem(BaseSlotID + BagSlot);
if(InvItem && (InvItem->GetItem()->ID == ItemID) &&
(InvItem->GetCharges() < InvItem->GetItem()->StackSize)) {
if (InvItem && (InvItem->GetItem()->ID == ItemID) &&
(InvItem->GetCharges() < InvItem->GetItem()->StackSize)) {
int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges();
int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft
? ItemToReturn->GetCharges() : ChargeSlotsLeft;
? ItemToReturn->GetCharges() : ChargeSlotsLeft;
InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove);
if(UpdateClient)
SendItemPacket(BaseSlotID + BagSlot, m_inv.GetItem(BaseSlotID + BagSlot),
ItemPacketTrade);
ItemPacketTrade);
database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot),
BaseSlotID + BagSlot);
BaseSlotID + BagSlot);
ItemToReturn->SetCharges(ItemToReturn->GetCharges() - ChargesToMove);
@@ -2357,41 +2357,42 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
}
void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) {
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
}
void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) {
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
}
void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) {
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
}
void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) {
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
ItemInst *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
database.SaveInventory(character_id, inst, slot_id);
}
}
std::string Inventory::GetCustomItemData(int16 slot_id, std::string identifier) {
ItemInst *inst = GetItem(slot_id);
if(inst) {
return inst->GetCustomData(identifier);
}
return "";
ItemInst *inst = GetItem(slot_id);
if(inst) {
return inst->GetCustomData(identifier);
}
return "";
}
+37 -37
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <stdio.h>
@@ -61,15 +61,15 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite
*copper = MakeRandomInt(mincoin, maxcoin);
*silver = MakeRandomInt(mincoin, maxcoin);
*gold = MakeRandomInt(mincoin, maxcoin);
if(*copper > cash) { *copper = cash; }
cash -= *copper;
if(*silver>(cash/10)) { *silver = (cash/10); }
cash -= *silver*10;
if(*gold > (cash/100)) { *gold = (cash/100); }
cash -= *gold*100;
}
if (cash < 0) {
cash = 0;
if(*copper > cash) { *copper = cash; }
cash -= *copper;
if(*silver>(cash/10)) { *silver = (cash/10); }
cash -= *silver*10;
if(*gold > (cash/100)) { *gold = (cash/100); }
cash -= *gold*100;
}
if (cash < 0) {
cash = 0;
}
*plat = cash / 1000;
cash -= *plat * 1000;
@@ -86,21 +86,21 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite
// Do items
for (uint32 i=0; i<lts->NumEntries; i++) {
for (uint32 k = 1; k <= lts->Entries[i].multiplier; k++) {
uint8 droplimit = lts->Entries[i].droplimit;
uint8 mindrop = lts->Entries[i].mindrop;
uint8 droplimit = lts->Entries[i].droplimit;
uint8 mindrop = lts->Entries[i].mindrop;
//LootTable Entry probability
float ltchance = 0.0f;
ltchance = lts->Entries[i].probability;
//LootTable Entry probability
float ltchance = 0.0f;
ltchance = lts->Entries[i].probability;
float drop_chance = 0.0f;
if(ltchance > 0.0 && ltchance < 100.0) {
drop_chance = MakeRandomFloat(0.0, 100.0);
}
float drop_chance = 0.0f;
if(ltchance > 0.0 && ltchance < 100.0) {
drop_chance = MakeRandomFloat(0.0, 100.0);
}
if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance < ltchance)) {
AddLootDropToNPC(npc,lts->Entries[i].lootdrop_id, itemlist, droplimit, mindrop);
}
if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance < ltchance)) {
AddLootDropToNPC(npc,lts->Entries[i].lootdrop_id, itemlist, droplimit, mindrop);
}
}
}
}
@@ -216,11 +216,11 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
// Equip rules are as follows:
// If the item has the NoPet flag set it will not be equipped.
// An empty slot takes priority. The first empty one that an item can
// fit into will be the one picked for the item.
// fit into will be the one picked for the item.
// AC is the primary choice for which item gets picked for a slot.
// If AC is identical HP is considered next.
// If an item can fit into multiple slots we'll pick the last one where
// it is an improvement.
// it is an improvement.
if (!item2->NoPet) {
for (int i=0; !found && i<MAX_WORN_INVENTORY; i++) {
@@ -297,7 +297,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
else if (foundslot == SLOT_HEAD) {
eslot = MATERIAL_HEAD;
}
else if (foundslot == SLOT_CHEST) {
else if (foundslot == SLOT_CHEST) {
eslot = MATERIAL_CHEST;
}
else if (foundslot == SLOT_ARMS) {
@@ -353,7 +353,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
if(wearchange && outapp) {
entity_list.QueueClients(this, outapp);
safe_delete(outapp);
safe_delete(outapp);
}
}
@@ -372,7 +372,7 @@ void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem) {
void NPC::AddLootTable() {
if (npctype_id != 0) { // check if it's a GM spawn
database.AddLootTableToNPC(this,loottable_id, &itemlist, &copper, &silver, &gold, &platinum);
database.AddLootTableToNPC(this,loottable_id, &itemlist, &copper, &silver, &gold, &platinum);
}
}
+15 -15
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef MAP_H
#define MAP_H
@@ -35,7 +35,7 @@ typedef struct _vertex{
_vertex()
{
x = y = z = 0.0f;
x = y = z = 0.0f;
};
_vertex(float ix, float iy, float iz)
@@ -44,7 +44,7 @@ typedef struct _vertex{
y = iy;
z = iz;
}
bool operator==(const _vertex &v1) const
bool operator==(const _vertex &v1) const
{
return((v1.x == x) && (v1.y == y) && (v1.z ==z));
}
@@ -83,7 +83,7 @@ typedef struct _mapHeader {
x>=0, y<0
*/
enum { //node flags
enum { //node flags
nodeFinal = 0x01
//7 more bits if theres something to use them for...
};
@@ -120,7 +120,7 @@ typedef uint16 NodeRef;
nodeHeader head;
unsigned int * pfaces;
char mask;
struct _node * node1, *node2, *node3, *node4;
struct _node * node1, *node2, *node3, *node4;
}NODE, *PNODE;*/
class Map {
+2 -2
View File
@@ -1,5 +1,5 @@
//Trumpcard: EntityLists are composed of multiple list types. This is the
//master that includes all types. When entity.h is required, many of these are as well.
//Trumpcard: EntityLists are composed of multiple list types. This is the
//master that includes all types. When entity.h is required, many of these are as well.
#include "entity.h"
#include "groups.h"
+325 -325
View File
File diff suppressed because it is too large Load Diff
+33 -33
View File
@@ -8,9 +8,9 @@ using namespace std;
#define MAXMERCS 1
#define MERC_DEBUG 0
#define TANK 1
#define HEALER 2
#define HEALER 2
#define MELEEDPS 9
#define CASTERDPS 12
#define CASTERDPS 12
const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this
enum MercStanceType {
@@ -30,7 +30,7 @@ struct MercSpell {
uint32 type; // 0 = never, must be one (and only one) of the defined values
int16 stance; // 0 = all, + = only this stance, - = all except this stance
int16 slot;
uint16 proc_chance;
uint16 proc_chance;
uint32 time_cancast; // when we can cast this spell next
};
@@ -156,12 +156,12 @@ public:
uint32 GetMercTemplateID() { return _MercTemplateID; }
uint32 GetMercType() { return _MercType; }
uint32 GetMercSubType() { return _MercSubType; }
uint8 GetProficiencyID() { return _ProficiencyID; }
uint8 GetTierID() { return _TierID; }
uint8 GetProficiencyID() { return _ProficiencyID; }
uint8 GetTierID() { return _TierID; }
uint32 GetCostFormula() { return _CostFormula; }
uint32 GetMercNameType() { return _NameType; }
uint32 GetStance() { return _currentStance; }
int GetHatedCount() { return _hatedCount; }
int GetHatedCount() { return _hatedCount; }
inline const uint8 GetClientVersion() const { return _OwnerClientVersion; }
@@ -174,8 +174,8 @@ public:
void CheckHateList();
bool CheckTaunt();
bool CheckAETaunt();
bool CheckConfidence();
bool TryHide();
bool CheckConfidence();
bool TryHide();
// stat functions
virtual void CalcBonuses();
@@ -267,15 +267,15 @@ public:
protected:
void CalcItemBonuses(StatBonuses* newbon);
void AddItemBonuses(const Item_Struct *item, StatBonuses* newbon);
int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat);
int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat);
int16 GetFocusEffect(focusType type, uint16 spell_id);
std::vector<MercSpell> merc_spells;
std::map<uint32,MercTimer> timers;
uint16 skills[HIGHEST_SKILL+1];
uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs
uint16 skills[HIGHEST_SKILL+1];
uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs
uint16 d_meele_texture1; //this is an item Material value
uint16 d_meele_texture2; //this is an item Material value (offhand)
uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation
@@ -283,22 +283,22 @@ protected:
private:
int16 CalcAC();
int16 GetACMit();
int16 GetACAvoid();
int16 acmod();
int16 CalcATK();
//int CalcHaste();
int16 CalcAC();
int16 GetACMit();
int16 GetACAvoid();
int16 acmod();
int16 CalcATK();
//int CalcHaste();
int16 CalcSTR();
int16 CalcSTA();
int16 CalcDEX();
int16 CalcAGI();
int16 CalcINT();
int16 CalcWIS();
int16 CalcCHA();
int16 CalcSTR();
int16 CalcSTA();
int16 CalcDEX();
int16 CalcAGI();
int16 CalcINT();
int16 CalcWIS();
int16 CalcCHA();
int16 CalcMR();
int16 CalcMR();
int16 CalcFR();
int16 CalcDR();
int16 CalcPR();
@@ -323,10 +323,10 @@ private:
void DoEnduranceUpkeep(); //does the endurance upkeep
void CalcRestState();
int GroupLeadershipAAHealthEnhancement();
int GroupLeadershipAAManaEnhancement();
int GroupLeadershipAAHealthEnhancement();
int GroupLeadershipAAManaEnhancement();
int GroupLeadershipAAHealthRegeneration();
int GroupLeadershipAAOffenseEnhancement();
int GroupLeadershipAAOffenseEnhancement();
void GetMercSize();
void GenerateAppearance();
@@ -362,8 +362,8 @@ private:
uint32 _MercTemplateID;
uint32 _MercType;
uint32 _MercSubType;
uint8 _ProficiencyID;
uint8 _TierID;
uint8 _ProficiencyID;
uint8 _TierID;
uint8 _CostFormula;
uint8 _NameType;
uint8 _OwnerClientVersion;
@@ -375,9 +375,9 @@ private:
bool _medding;
bool _suspended;
bool p_depop;
bool _check_confidence;
bool _lost_confidence;
int _hatedCount;
bool _check_confidence;
bool _lost_confidence;
int _hatedCount;
uint32 owner_char_id;
Timer endupkeep_timer;
Timer rest_timer;
+226 -229
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "masterentity.h"
@@ -31,59 +31,59 @@ extern EntityList entity_list;
extern Zone* zone;
extern WorldServer worldserver;
Mob::Mob(const char* in_name,
const char* in_lastname,
int32 in_cur_hp,
int32 in_max_hp,
uint8 in_gender,
uint16 in_race,
uint8 in_class,
bodyType in_bodytype,
uint8 in_deity,
uint8 in_level,
uint32 in_npctype_id,
float in_size,
float in_runspeed,
float in_heading,
float in_x_pos,
float in_y_pos,
float in_z_pos,
Mob::Mob(const char* in_name,
const char* in_lastname,
int32 in_cur_hp,
int32 in_max_hp,
uint8 in_gender,
uint16 in_race,
uint8 in_class,
bodyType in_bodytype,
uint8 in_deity,
uint8 in_level,
uint32 in_npctype_id,
float in_size,
float in_runspeed,
float in_heading,
float in_x_pos,
float in_y_pos,
float in_z_pos,
uint8 in_light,
uint8 in_texture,
uint8 in_helmtexture,
uint16 in_ac,
uint16 in_atk,
uint16 in_str,
uint16 in_sta,
uint16 in_dex,
uint16 in_agi,
uint16 in_int,
uint16 in_wis,
uint16 in_cha,
uint8 in_haircolor,
uint8 in_beardcolor,
uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye?
uint8 in_eyecolor2,
uint8 in_hairstyle,
uint8 in_luclinface,
uint8 in_beard,
uint32 in_drakkin_heritage,
uint32 in_drakkin_tattoo,
uint32 in_drakkin_details,
uint32 in_armor_tint[MAX_MATERIALS],
uint8 in_light,
uint8 in_texture,
uint8 in_helmtexture,
uint16 in_ac,
uint16 in_atk,
uint16 in_str,
uint16 in_sta,
uint16 in_dex,
uint16 in_agi,
uint16 in_int,
uint16 in_wis,
uint16 in_cha,
uint8 in_haircolor,
uint8 in_beardcolor,
uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye?
uint8 in_eyecolor2,
uint8 in_hairstyle,
uint8 in_luclinface,
uint8 in_beard,
uint32 in_drakkin_heritage,
uint32 in_drakkin_tattoo,
uint32 in_drakkin_details,
uint32 in_armor_tint[MAX_MATERIALS],
uint8 in_aa_title,
uint8 in_see_invis, // see through invis/ivu
uint8 in_see_invis_undead,
uint8 in_see_hide,
uint8 in_see_improved_hide,
int32 in_hp_regen,
int32 in_mana_regen,
uint8 in_qglobal,
uint8 in_maxlevel,
uint32 in_scalerate
) :
uint8 in_aa_title,
uint8 in_see_invis, // see through invis/ivu
uint8 in_see_invis_undead,
uint8 in_see_hide,
uint8 in_see_improved_hide,
int32 in_hp_regen,
int32 in_mana_regen,
uint8 in_qglobal,
uint8 in_maxlevel,
uint32 in_scalerate
) :
attack_timer(2000),
attack_dw_timer(2000),
ranged_timer(2000),
@@ -117,9 +117,9 @@ Mob::Mob(const char* in_name,
AI_Init();
SetMoving(false);
moved=false;
rewind_x = 0; //Stored x_pos for /rewind
rewind_y = 0; //Stored y_pos for /rewind
rewind_z = 0; //Stored z_pos for /rewind
rewind_x = 0; //Stored x_pos for /rewind
rewind_y = 0; //Stored y_pos for /rewind
rewind_z = 0; //Stored z_pos for /rewind
move_tic_count = 0;
_egnode = nullptr;
@@ -142,19 +142,19 @@ Mob::Mob(const char* in_name,
base_gender = in_gender;
base_race = in_race;
class_ = in_class;
bodytype = in_bodytype;
bodytype = in_bodytype;
orig_bodytype = in_bodytype;
deity = in_deity;
level = in_level;
npctype_id = in_npctype_id;
size = in_size;
base_size = size;
runspeed = in_runspeed;
runspeed = in_runspeed;
// sanity check
if (runspeed < 0 || runspeed > 20)
runspeed = 1.25f;
// sanity check
if (runspeed < 0 || runspeed > 20)
runspeed = 1.25f;
heading = in_heading;
x_pos = in_x_pos;
@@ -216,15 +216,15 @@ Mob::Mob(const char* in_name,
InitializeBuffSlots();
// clear the proc arrays
// clear the proc arrays
int i;
int j;
for (j = 0; j < MAX_PROCS; j++)
{
PermaProcs[j].spellID = SPELL_UNKNOWN;
PermaProcs[j].chance = 0;
PermaProcs[j].base_spellID = SPELL_UNKNOWN;
SpellProcs[j].spellID = SPELL_UNKNOWN;
{
PermaProcs[j].spellID = SPELL_UNKNOWN;
PermaProcs[j].chance = 0;
PermaProcs[j].base_spellID = SPELL_UNKNOWN;
SpellProcs[j].spellID = SPELL_UNKNOWN;
DefensiveProcs[j].spellID = SPELL_UNKNOWN;
DefensiveProcs[j].chance = 0;
@@ -235,7 +235,7 @@ Mob::Mob(const char* in_name,
SkillProcs[j].spellID = SPELL_UNKNOWN;
SkillProcs[j].chance = 0;
SkillProcs[j].base_spellID = SPELL_UNKNOWN;
}
}
for (i = 0; i < MAX_MATERIALS; i++)
{
@@ -262,7 +262,7 @@ Mob::Mob(const char* in_name,
_appearance = eaStanding;
pRunAnimSpeed = 0;
spellend_timer.Disable();
spellend_timer.Disable();
bardsong_timer.Disable();
bardsong = 0;
bardsong_target_id = 0;
@@ -292,7 +292,7 @@ Mob::Mob(const char* in_name,
silenced = false;
amnesiad = false;
inWater = false;
int m;
int m;
for (m = 0; m < MAX_SHIELDERS; m++)
{
shielder[m].shielder_id = 0;
@@ -360,7 +360,7 @@ Mob::Mob(const char* in_name,
nimbus_effect1 = 0;
nimbus_effect2 = 0;
nimbus_effect3 = 0;
m_targetable = true;
m_targetable = true;
flymode = FlyMode3;
// Pathing
@@ -412,14 +412,14 @@ Mob::~Mob()
entity_list.RemoveFromTargets(this, true);
if(trade) {
Mob *with = trade->With();
if(with && with->IsClient()) {
with->CastToClient()->FinishTrade(with);
with->trade->Reset();
}
delete trade;
}
if(trade) {
Mob *with = trade->With();
if(with && with->IsClient()) {
with->CastToClient()->FinishTrade(with);
with->trade->Reset();
}
delete trade;
}
if(HadTempPets()){
entity_list.DestroyTempPets(this);
@@ -460,15 +460,15 @@ void Mob::SetInvisible(uint8 state)
{
invisible = state;
SendAppearancePacket(AT_Invis, invisible);
// Invis and hide breaks charms
// Invis and hide breaks charms
if ((this->GetPetType() == petCharmed) && (invisible || hidden || improved_hidden))
{
Mob* formerpet = this->GetPet();
if ((this->GetPetType() == petCharmed) && (invisible || hidden || improved_hidden))
{
Mob* formerpet = this->GetPet();
if(formerpet)
formerpet->BuffFadeByEffect(SE_Charm);
}
if(formerpet)
formerpet->BuffFadeByEffect(SE_Charm);
}
}
//check to see if `this` is invisible to `other`
@@ -519,7 +519,7 @@ bool Mob::IsInvisible(Mob* other) const
}
float Mob::_GetMovementSpeed(int mod) const {
// List of movement speed modifiers, including AAs & spells:
// List of movement speed modifiers, including AAs & spells:
// http://everquest.allakhazam.com/db/item.html?item=1721;page=1;howmany=50#m10822246245352
if (IsRooted())
return 0.0f;
@@ -788,9 +788,9 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strcpy(ns->spawn.name, name);
if(IsClient())
{
{
strn0cpy(ns->spawn.lastName,lastname,sizeof(ns->spawn.lastName));
}
}
ns->spawn.heading = FloatToEQ19(heading);
ns->spawn.x = FloatToEQ19(x_pos);//((int32)x_pos)<<3;
ns->spawn.y = FloatToEQ19(y_pos);//((int32)y_pos)<<3;
@@ -827,10 +827,9 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.drakkin_heritage = drakkin_heritage;
ns->spawn.drakkin_tattoo = drakkin_tattoo;
ns->spawn.drakkin_details = drakkin_details;
ns->spawn.equip_chest2 = texture;
ns->spawn.equip_chest2 = texture;
// ns->spawn.invis2 = 0xff;//this used to be labeled beard.. if its not FF it will turn
//mob invis
// ns->spawn.invis2 = 0xff;//this used to be labeled beard.. if its not FF it will turn mob invis
if(helmtexture && helmtexture != 0xFF)
{
@@ -847,7 +846,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
// 1 - Same as #flymode 1
// 2 - Same as #flymode 2
// 3 - Mobs in water do not sink. A value of 3 in this field appears to be the default setting for all mobs
// (in water or not) according to 6.2 era packet collects.
// (in water or not) according to 6.2 era packet collects.
if(IsClient())
{
ns->spawn.flymode = FindType(SE_Levitate) ? 2 : 0;
@@ -897,7 +896,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.DestructibleUnk1 = 0x00000224; // Was 0x000001f5;
// These next 4 are mostly always sequential
// Originally they were 633, 634, 635, 636
// Changing them all to 633 - no visible effect.
// Changing them all to 633 - no visible effect.
// Changing them all to 636 - no visible effect.
// Reversing the order of these four numbers and then using #appearance gain had no visible change.
// Setting these four ids to zero had no visible effect when the catapult spawned, nor when #appearance was used.
@@ -961,7 +960,7 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
snprintf(buf, 9, "%i", GetNextHPEvent());
buf[9] = '\0';
SetNextHPEvent(-1);
parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 0);
parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 0);
}
}
@@ -973,7 +972,7 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
snprintf(buf, 9, "%i", GetNextIncHPEvent());
buf[9] = '\0';
SetNextIncHPEvent(-1);
parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 1);
parse->EventNPC(EVENT_HP, CastToNPC(), nullptr, buf, 1);
}
}
}
@@ -999,7 +998,7 @@ void Mob::SendHPUpdate()
if(IsGrouped())
{
group = entity_list.GetGroupByMob(this);
if(group) //not sure why this might be null, but it happens
if(group) //not sure why this might be null, but it happens
group->SendHPPacketsFrom(this);
}
@@ -1027,7 +1026,7 @@ void Mob::SendHPUpdate()
{
GetPet()->CastToClient()->QueuePacket(&hp_app, false);
}
#endif //MANAGE_HP_PACKETS
#endif //MANAGE_HP_PACKETS
// Update the damage state of destructible objects
if(IsNPC() && IsDestructibleObject())
@@ -1110,7 +1109,7 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) {
#ifdef PACKET_UPDATE_MANAGER
entity_list.QueueManaged(this, app, (iSendToSelf==0),false);
#else
if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount))
if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount))
{
entity_list.QueueClients(this, app, (iSendToSelf==0), false);
move_tic_count = 0;
@@ -1470,7 +1469,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture,
}
uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) {
//cout << "Gender in: " << (int)in_gender << endl;
//cout << "Gender in: " << (int)in_gender << endl;
if ((in_race > 0 && in_race <= GNOME )
|| in_race == IKSAR || in_race == VAHSHIR || in_race == FROGLOK || in_race == DRAKKIN
|| in_race == 15 || in_race == 50 || in_race == 57 || in_race == 70 || in_race == 98 || in_race == 118) {
@@ -1565,12 +1564,12 @@ void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32
}
void Mob::SendTargetable(bool on, Client *specific_target) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Untargetable, sizeof(Untargetable_Struct));
Untargetable_Struct *ut = (Untargetable_Struct*)outapp->pBuffer;
ut->id = GetID();
ut->targetable_flag = on == true ? 1 : 0;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Untargetable, sizeof(Untargetable_Struct));
Untargetable_Struct *ut = (Untargetable_Struct*)outapp->pBuffer;
ut->id = GetID();
ut->targetable_flag = on == true ? 1 : 0;
if(specific_target == nullptr) {
if(specific_target == nullptr) {
entity_list.QueueClients(this, outapp);
}
else if (specific_target->IsClient()) {
@@ -1694,10 +1693,10 @@ void Mob::TempName(const char *newname)
}
void Mob::SetTargetable(bool on) {
if(m_targetable != on) {
m_targetable = on;
SendTargetable(on);
}
if(m_targetable != on) {
m_targetable = on;
SendTargetable(on);
}
}
const int32& Mob::SetMana(int32 amount)
@@ -1802,8 +1801,8 @@ void Mob::SetOwnerID(uint16 NewOwnerID) {
//heko: for backstab
bool Mob::BehindMob(Mob* other, float playerx, float playery) const {
if (!other)
return true; // sure your behind your invisible friend?? (fall thru for sneak)
if (!other)
return true; // sure your behind your invisible friend?? (fall thru for sneak)
//see if player is behind mob
float angle, lengthb, vectorx, vectory;
float mobx = -(other->GetX()); // mob xlocation (inverse because eq is confused)
@@ -1953,7 +1952,7 @@ void Mob::SetAttackTimer() {
int speed = (int)((36 *(100+DelayMod)/100)*(100.0f+attack_speed)*PermaHaste);
if(speed < RuleI(Combat, MinHastedDelay) && IsClient()) //lower bound
speed = RuleI(Combat, MinHastedDelay);
TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36
TimerToUse->SetAtTrigger(speed, true); // Hand to hand, non-monk 2/36
}
} else {
//we have a weapon, use its delay
@@ -2001,8 +2000,8 @@ void Mob::SetAttackTimer() {
bool Mob::CanThisClassDualWield(void) const
{
if (!IsClient()) {
return(GetSkill(DUAL_WIELD) > 0);
} else {
return(GetSkill(DUAL_WIELD) > 0);
} else {
const ItemInst* inst = CastToClient()->GetInv().GetItem(SLOT_PRIMARY);
// 2HS, 2HB, or 2HP
if (inst && inst->IsType(ItemClassCommon)) {
@@ -2013,8 +2012,8 @@ bool Mob::CanThisClassDualWield(void) const
//No weapon in hand... using hand-to-hand...
//only monks and beastlords? can dual wield their fists.
if(class_ != MONK && class_ != MONKGM && class_ != BEASTLORD && class_ != BEASTLORDGM) {
return false;
}
return false;
}
}
return (CastToClient()->HasSkill(DUAL_WIELD)); // No skill = no chance
@@ -2023,14 +2022,14 @@ bool Mob::CanThisClassDualWield(void) const
bool Mob::CanThisClassDoubleAttack(void) const
{
if(!IsClient()) {
return(GetSkill(DOUBLE_ATTACK) > 0);
} else {
if(aabonuses.GiveDoubleAttack || itembonuses.GiveDoubleAttack || spellbonuses.GiveDoubleAttack) {
if(!IsClient()) {
return(GetSkill(DOUBLE_ATTACK) > 0);
} else {
if(aabonuses.GiveDoubleAttack || itembonuses.GiveDoubleAttack || spellbonuses.GiveDoubleAttack) {
return true;
}
return(CastToClient()->HasSkill(DOUBLE_ATTACK));
}
return(CastToClient()->HasSkill(DOUBLE_ATTACK));
}
}
bool Mob::IsWarriorClass(void) const
@@ -2068,38 +2067,38 @@ bool Mob::IsWarriorClass(void) const
bool Mob::CanThisClassParry(void) const
{
if(!IsClient()) {
return(GetSkill(PARRY) > 0);
} else {
return(CastToClient()->HasSkill(PARRY));
}
if(!IsClient()) {
return(GetSkill(PARRY) > 0);
} else {
return(CastToClient()->HasSkill(PARRY));
}
}
bool Mob::CanThisClassDodge(void) const
{
if(!IsClient()) {
return(GetSkill(DODGE) > 0);
} else {
return(CastToClient()->HasSkill(DODGE));
}
if(!IsClient()) {
return(GetSkill(DODGE) > 0);
} else {
return(CastToClient()->HasSkill(DODGE));
}
}
bool Mob::CanThisClassRiposte(void) const
{
if(!IsClient()) {
return(GetSkill(RIPOSTE) > 0);
} else {
return(CastToClient()->HasSkill(RIPOSTE));
}
if(!IsClient()) {
return(GetSkill(RIPOSTE) > 0);
} else {
return(CastToClient()->HasSkill(RIPOSTE));
}
}
bool Mob::CanThisClassBlock(void) const
{
if(!IsClient()) {
return(GetSkill(BLOCKSKILL) > 0);
} else {
return(CastToClient()->HasSkill(BLOCKSKILL));
}
return(GetSkill(BLOCKSKILL) > 0);
} else {
return(CastToClient()->HasSkill(BLOCKSKILL));
}
}
float Mob::Dist(const Mob &other) const {
@@ -2109,8 +2108,8 @@ float Mob::Dist(const Mob &other) const {
float zDiff = other.z_pos - z_pos;
return sqrtf( (xDiff * xDiff)
+ (yDiff * yDiff)
+ (zDiff * zDiff) );
+ (yDiff * yDiff)
+ (zDiff * zDiff) );
}
float Mob::DistNoZ(const Mob &other) const {
@@ -2119,7 +2118,7 @@ float Mob::DistNoZ(const Mob &other) const {
float yDiff = other.y_pos - y_pos;
return sqrtf( (xDiff * xDiff)
+ (yDiff * yDiff) );
+ (yDiff * yDiff) );
}
float Mob::DistNoRoot(const Mob &other) const {
@@ -2129,8 +2128,8 @@ float Mob::DistNoRoot(const Mob &other) const {
float zDiff = other.z_pos - z_pos;
return ( (xDiff * xDiff)
+ (yDiff * yDiff)
+ (zDiff * zDiff) );
+ (yDiff * yDiff)
+ (zDiff * zDiff) );
}
float Mob::DistNoRoot(float x, float y, float z) const {
@@ -2140,8 +2139,8 @@ float Mob::DistNoRoot(float x, float y, float z) const {
float zDiff = z - z_pos;
return ( (xDiff * xDiff)
+ (yDiff * yDiff)
+ (zDiff * zDiff) );
+ (yDiff * yDiff)
+ (zDiff * zDiff) );
}
float Mob::DistNoRootNoZ(float x, float y) const {
@@ -2149,8 +2148,7 @@ float Mob::DistNoRootNoZ(float x, float y) const {
float xDiff = x - x_pos;
float yDiff = y - y_pos;
return ( (xDiff * xDiff)
+ (yDiff * yDiff) );
return ( (xDiff * xDiff) + (yDiff * yDiff) );
}
float Mob::DistNoRootNoZ(const Mob &other) const {
@@ -2169,7 +2167,7 @@ float Mob::GetReciprocalHeading(Mob* target) {
float h = (target->GetHeading() / 256.0f) * 6.283184f;
// Calculate the reciprocal heading in radians
Result = h + 3.141592f;
Result = h + 3.141592f;
// Convert back to eq heading from radians
Result = (Result / 6.283184f) * 256.0f;
@@ -2255,8 +2253,8 @@ bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, fl
}
bool Mob::HateSummon() {
// check if mob has ability to summon
// 97% is the offical % that summoning starts on live, not 94
// check if mob has ability to summon
// 97% is the offical % that summoning starts on live, not 94
// if the mob can summon and is charmed, it can only summon mobs it has LoS to
Mob* mob_owner = nullptr;
if(GetOwnerID())
@@ -2264,23 +2262,23 @@ bool Mob::HateSummon() {
if (GetHPRatio() >= 98 || SpecAttacks[SPECATK_SUMMON] == false || !GetTarget() ||
(mob_owner && mob_owner->IsClient() && !CheckLosFN(GetTarget())))
return false;
return false;
// now validate the timer
if (!SpecAttackTimers[SPECATK_SUMMON])
{
SpecAttackTimers[SPECATK_SUMMON] = new Timer(6000);
SpecAttackTimers[SPECATK_SUMMON]->Start();
}
// now validate the timer
if (!SpecAttackTimers[SPECATK_SUMMON])
{
SpecAttackTimers[SPECATK_SUMMON] = new Timer(6000);
SpecAttackTimers[SPECATK_SUMMON]->Start();
}
// now check the timer
if (!SpecAttackTimers[SPECATK_SUMMON]->Check())
return false;
// now check the timer
if (!SpecAttackTimers[SPECATK_SUMMON]->Check())
return false;
// get summon target
SetTarget(GetHateTop());
if(target)
{
// get summon target
SetTarget(GetHateTop());
if(target)
{
if (target->IsClient())
target->CastToClient()->Message(15,"You have been summoned!");
entity_list.MessageClose(this, true, 500, 10, "%s says,'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() );
@@ -2303,7 +2301,7 @@ bool Mob::HateSummon() {
target->GMMove(x_pos, y_pos, z_pos, target->GetHeading());
}
return true;
return true;
}
return false;
}
@@ -2331,10 +2329,10 @@ void Mob::FaceTarget(Mob* MobToFace) {
}
}
if(IsNPC() && !IsEngaged()) {
CastToNPC()->GetRefaceTimer()->Start(15000);
CastToNPC()->GetRefaceTimer()->Enable();
}
if(IsNPC() && !IsEngaged()) {
CastToNPC()->GetRefaceTimer()->Start(15000);
CastToNPC()->GetRefaceTimer()->Enable();
}
}
bool Mob::RemoveFromHateList(Mob* mob)
@@ -2367,10 +2365,10 @@ void Mob::WipeHateList()
}
uint32 Mob::RandomTimer(int min,int max) {
int r = 14000;
int r = 14000;
if(min != 0 && max != 0 && min < max)
{
r = MakeRandomInt(min, max);
r = MakeRandomInt(min, max);
}
return r;
}
@@ -2593,7 +2591,7 @@ void Mob::Emote(const char *format, ...)
void Mob::QuestJournalledSay(Client *QuestInitiator, const char *str)
{
entity_list.QuestJournalledSayClose(this, QuestInitiator, 200, GetCleanName(), str);
entity_list.QuestJournalledSayClose(this, QuestInitiator, 200, GetCleanName(), str);
}
const char *Mob::GetCleanName()
@@ -2619,17 +2617,16 @@ void Mob::SetNextIncHPEvent( int inchpevent )
//warp for quest function,from sandy
void Mob::Warp( float x, float y, float z )
{
x_pos = x;
y_pos = y;
z_pos = z;
x_pos = x;
y_pos = y;
z_pos = z;
Mob* target = GetTarget();
if ( target ) {
FaceTarget( target );
}
SendPosition();
Mob* target = GetTarget();
if (target) {
FaceTarget( target );
}
SendPosition();
}
bool Mob::DivineAura() const
@@ -2757,7 +2754,7 @@ void Mob::ExecWeaponProc(uint16 spell_id, Mob *on) {
int32 twinproc_chance = 0;
if(IsClient())
twinproc_chance = CastToClient()->GetFocusEffect(focusTwincast, spell_id);
twinproc_chance = CastToClient()->GetFocusEffect(focusTwincast, spell_id);
if(twinproc_chance && (MakeRandomInt(0,99) < twinproc_chance))
twinproc = true;
@@ -2819,7 +2816,7 @@ void Mob::SetTarget(Mob* mob) {
if(IsNPC())
parse->EventNPC(EVENT_TARGET_CHANGE, CastToNPC(), mob, "", 0); //parse->Event(EVENT_TARGET_CHANGE, this->GetNPCTypeID(), 0, this->CastToNPC(), mob);
else if (IsClient())
parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0); //parse->Event(EVENT_TARGET_CHANGE, 0, "", (NPC*)nullptr, this->CastToClient());
parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0); //parse->Event(EVENT_TARGET_CHANGE, 0, "", (NPC*)nullptr, this->CastToClient());
if(IsPet() && GetOwner() && GetOwner()->IsClient())
GetOwner()->CastToClient()->UpdateXTargetType(MyPetTarget, mob);
@@ -3751,10 +3748,10 @@ void Mob::DelGlobal(const char *varname) {
}
if (!database.RunQuery(query,
MakeAnyLenString(&query,
"DELETE FROM quest_globals WHERE name='%s'"
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
MakeAnyLenString(&query,
"DELETE FROM quest_globals WHERE name='%s'"
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
{
//_log(QUESTS, "DelGlobal error deleting %s : %s", varname, errbuf);
}
@@ -4024,7 +4021,7 @@ bool Mob::TrySpellOnDeath()
}
if(spellbonuses.SpellOnDeath[i]) {
if(MakeRandomInt(0, 99) < static_cast<int>(spellbonuses.SpellOnDeath[i + 1])) {
if(MakeRandomInt(0, 99) < static_cast<int>(spellbonuses.SpellOnDeath[i + 1])) {
SpellFinished(spellbonuses.SpellOnDeath[i], this);
}
}
@@ -4061,7 +4058,7 @@ void Mob::SetGrouped(bool v)
if(IsClient())
{
parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0);
parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0);
if(!v)
CastToClient()->RemoveGroupXTargets();
@@ -4078,7 +4075,7 @@ void Mob::SetRaidGrouped(bool v)
if(IsClient())
{
parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0);
parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0);
}
}
@@ -4117,7 +4114,7 @@ int16 Mob::GetMeleeMinDamageMod_SE(uint16 skill)
{
int dmg_mod = 0;
dmg_mod = itembonuses.MinDamageModifier[skill] + spellbonuses.MinDamageModifier[skill] +
dmg_mod = itembonuses.MinDamageModifier[skill] + spellbonuses.MinDamageModifier[skill] +
itembonuses.MinDamageModifier[HIGHEST_SKILL+1] + spellbonuses.MinDamageModifier[HIGHEST_SKILL+1];
if(dmg_mod < -100)
@@ -4151,16 +4148,16 @@ int16 Mob::GetSkillDmgAmt(uint16 skill)
// All skill dmg(only spells do this) + Skill specific
skill_dmg += spellbonuses.SkillDamageAmount[HIGHEST_SKILL+1] + itembonuses.SkillDamageAmount[HIGHEST_SKILL+1] + aabonuses.SkillDamageAmount[HIGHEST_SKILL+1]
+ itembonuses.SkillDamageAmount[skill] + spellbonuses.SkillDamageAmount[skill] + aabonuses.SkillDamageAmount[skill];
+ itembonuses.SkillDamageAmount[skill] + spellbonuses.SkillDamageAmount[skill] + aabonuses.SkillDamageAmount[skill];
skill_dmg += spellbonuses.SkillDamageAmount2[HIGHEST_SKILL+1] + itembonuses.SkillDamageAmount2[HIGHEST_SKILL+1]
+ itembonuses.SkillDamageAmount2[skill] + spellbonuses.SkillDamageAmount2[skill];
+ itembonuses.SkillDamageAmount2[skill] + spellbonuses.SkillDamageAmount2[skill];
// Deplete the buff if needed
if (spellbonuses.SkillDamageAmount[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount[skill])
if (spellbonuses.SkillDamageAmount[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount[skill])
CheckHitsRemaining(0, false,false, SE_SkillDamageAmount,0,true,skill);
if (spellbonuses.SkillDamageAmount2[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount2[skill])
if (spellbonuses.SkillDamageAmount2[HIGHEST_SKILL+1] || spellbonuses.SkillDamageAmount2[skill])
CheckHitsRemaining(0, false,false, SE_SkillDamageAmount2,0,true,skill);
return skill_dmg;
@@ -4302,32 +4299,32 @@ void Mob::RemoveNimbusEffect(int effectid)
}
bool Mob::IsBoat() const {
return (race == 72 || race == 73 || race == 114 || race == 404 || race == 550 || race == 551 || race == 552);
return (race == 72 || race == 73 || race == 114 || race == 404 || race == 550 || race == 551 || race == 552);
}
void Mob::SetBodyType(bodyType new_body, bool overwrite_orig) {
bool needs_spawn_packet = false;
if(bodytype == 11 || bodytype >= 65 || new_body == 11 || new_body >= 65) {
needs_spawn_packet = true;
}
bool needs_spawn_packet = false;
if(bodytype == 11 || bodytype >= 65 || new_body == 11 || new_body >= 65) {
needs_spawn_packet = true;
}
if(overwrite_orig) {
orig_bodytype = new_body;
}
bodytype = new_body;
if(overwrite_orig) {
orig_bodytype = new_body;
}
bodytype = new_body;
if(needs_spawn_packet) {
EQApplicationPacket* app = new EQApplicationPacket;
CreateDespawnPacket(app, true);
entity_list.QueueClients(this, app);
CreateSpawnPacket(app, this);
entity_list.QueueClients(this, app);
safe_delete(app);
}
if(needs_spawn_packet) {
EQApplicationPacket* app = new EQApplicationPacket;
CreateDespawnPacket(app, true);
entity_list.QueueClients(this, app);
CreateSpawnPacket(app, this);
entity_list.QueueClients(this, app);
safe_delete(app);
}
}
void Mob::ModSkillDmgTaken(SkillType skill_num, int value)
void Mob::ModSkillDmgTaken(SkillType skill_num, int value)
{
if (skill_num <= HIGHEST_SKILL)
SkillDmgTaken_Mod[skill_num] = value;
@@ -4490,7 +4487,7 @@ bool Mob::PassLimitToSkill(uint16 spell_id, uint16 skill) {
// Faction Mods for Alliance type spells
void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) {
map <uint32, int32> :: const_iterator faction_bonus;
map <uint32, int32> :: const_iterator faction_bonus;
typedef std::pair <uint32, int32> NewFactionBonus;
faction_bonus = faction_bonuses.find(pFactionID);
@@ -4510,7 +4507,7 @@ void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) {
// Faction Mods from items
void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) {
map <uint32, int32> :: const_iterator faction_bonus;
map <uint32, int32> :: const_iterator faction_bonus;
typedef std::pair <uint32, int32> NewFactionBonus;
faction_bonus = item_faction_bonuses.find(pFactionID);
@@ -4529,7 +4526,7 @@ void Mob::AddItemFactionBonus(uint32 pFactionID,int32 bonus) {
}
int32 Mob::GetFactionBonus(uint32 pFactionID) {
map <uint32, int32> :: const_iterator faction_bonus;
map <uint32, int32> :: const_iterator faction_bonus;
faction_bonus = faction_bonuses.find(pFactionID);
if(faction_bonus != faction_bonuses.end())
{
@@ -4539,7 +4536,7 @@ int32 Mob::GetFactionBonus(uint32 pFactionID) {
}
int32 Mob::GetItemFactionBonus(uint32 pFactionID) {
map <uint32, int32> :: const_iterator faction_bonus;
map <uint32, int32> :: const_iterator faction_bonus;
faction_bonus = item_faction_bonuses.find(pFactionID);
if(faction_bonus != item_faction_bonuses.end())
{
+995 -995
View File
File diff suppressed because it is too large Load Diff
+41 -41
View File
@@ -1,20 +1,20 @@
#define DONT_SHARED_OPCODES
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/features.h"
@@ -40,7 +40,7 @@ using namespace std;
#define vsnprintf _vsnprintf
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#endif
volatile bool RunLoops = true;
@@ -115,8 +115,8 @@ void Shutdown();
extern void MapOpcodes();
int main(int argc, char** argv) {
RegisterExecutablePlatform(ExePlatformZone);
set_exception_handler();
RegisterExecutablePlatform(ExePlatformZone);
set_exception_handler();
const char *zone_name;
@@ -183,8 +183,8 @@ int main(int argc, char** argv) {
_log(ZONE__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION);
/*
* Setup nice signal handlers
*/
* Setup nice signal handlers
*/
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
_log(ZONE__INIT_ERR, "Could not set signal handler");
return 0;
@@ -215,7 +215,7 @@ int main(int argc, char** argv) {
_log(ZONE__INIT, "Loading items");
if (!database.LoadItems()) {
_log(ZONE__INIT_ERR, "Loading items FAILED!");
_log(ZONE__INIT, "Failed. But ignoring error and going on...");
_log(ZONE__INIT, "Failed. But ignoring error and going on...");
}
_log(ZONE__INIT, "Loading npc faction lists");
@@ -229,7 +229,7 @@ int main(int argc, char** argv) {
_log(ZONE__INIT_ERR, "Loading loot FAILED!");
CheckEQEMuErrorAndPause();
return 0;
}
}
_log(ZONE__INIT, "Loading skill caps");
if (!database.LoadSkillCaps()) {
_log(ZONE__INIT_ERR, "Loading skill caps FAILED!");
@@ -237,8 +237,8 @@ int main(int argc, char** argv) {
return 0;
}
_log(ZONE__INIT, "Loading spells");
EQEmu::MemoryMappedFile *mmf = nullptr;
_log(ZONE__INIT, "Loading spells");
EQEmu::MemoryMappedFile *mmf = nullptr;
LoadSpells(&mmf);
_log(ZONE__INIT, "Loading guilds");
@@ -283,13 +283,13 @@ int main(int argc, char** argv) {
taskmanager->LoadTasks();
}
parse = new QuestParserCollection();
parse = new QuestParserCollection();
#ifdef EMBPERL
PerlXSParser *pxs = new PerlXSParser();
parse->RegisterQuestInterface(pxs, "pl");
#endif
Parser *ps = new Parser();
//parse->RegisterQuestInterface(ps, "qst");
//parse->RegisterQuestInterface(ps, "qst");
//now we have our parser, load the quests
@@ -476,7 +476,7 @@ int main(int argc, char** argv) {
safe_delete(parse);
#ifdef EMBPERL
safe_delete(pxs);
safe_delete(pxs);
#endif
safe_delete(ps);
safe_delete(mmf);
@@ -514,8 +514,8 @@ void Shutdown()
uint32 NetConnection::GetIP()
{
char name[255+1];
size_t len = 0;
char name[255+1];
size_t len = 0;
hostent* host = 0;
if (gethostname(name, len) < 0 || len <= 0)
@@ -584,25 +584,25 @@ NetConnection::~NetConnection() {
}
void LoadSpells(EQEmu::MemoryMappedFile **mmf) {
int records = database.GetMaxSpellID() + 1;
int records = database.GetMaxSpellID() + 1;
try {
EQEmu::IPCMutex mutex("spells");
mutex.Lock();
*mmf = new EQEmu::MemoryMappedFile("shared/spells");
uint32 size = (*mmf)->Size();
if(size != (records * sizeof(SPDat_Spell_Struct))) {
EQ_EXCEPT("Zone", "Unable to load spells: (*mmf)->Size() != records * sizeof(SPDat_Spell_Struct)");
}
try {
EQEmu::IPCMutex mutex("spells");
mutex.Lock();
*mmf = new EQEmu::MemoryMappedFile("shared/spells");
uint32 size = (*mmf)->Size();
if(size != (records * sizeof(SPDat_Spell_Struct))) {
EQ_EXCEPT("Zone", "Unable to load spells: (*mmf)->Size() != records * sizeof(SPDat_Spell_Struct)");
}
spells = reinterpret_cast<SPDat_Spell_Struct*>((*mmf)->Get());
mutex.Unlock();
} catch(std::exception &ex) {
LogFile->write(EQEMuLog::Error, "Error loading spells: %s", ex.what());
return;
}
spells = reinterpret_cast<SPDat_Spell_Struct*>((*mmf)->Get());
mutex.Unlock();
} catch(std::exception &ex) {
LogFile->write(EQEMuLog::Error, "Error loading spells: %s", ex.what());
return;
}
SPDAT_RECORDS = records;
SPDAT_RECORDS = records;
}
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifdef _WINDOWS
#include <windows.h>
+258 -258
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -28,7 +28,7 @@ using namespace std;
#ifdef _WINDOWS
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#else
#include <stdlib.h>
#include <pthread.h>
@@ -56,55 +56,55 @@ extern EntityList entity_list;
NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float heading, int iflymode, bool IsCorpse)
: Mob(d->name,
d->lastname,
d->max_hp,
d->max_hp,
d->gender,
d->race,
d->class_,
(bodyType)d->bodytype,
d->deity,
d->level,
d->npc_id,
d->size,
d->runspeed,
heading,
x,
y,
z,
d->light,
d->texture,
d->helmtexture,
d->AC,
d->ATK,
d->STR,
d->STA,
d->DEX,
d->AGI,
d->INT,
d->WIS,
d->CHA,
d->haircolor,
d->beardcolor,
d->eyecolor1,
d->eyecolor2,
d->hairstyle,
d->luclinface,
d->beard,
d->drakkin_heritage,
d->drakkin_tattoo,
d->drakkin_details,
(uint32*)d->armor_tint,
0,
d->see_invis, // pass see_invis/see_ivu flags to mob constructor
d->see_invis_undead,
d->see_hide,
d->see_improved_hide,
d->hp_regen,
d->mana_regen,
d->qglobal,
d->maxlevel,
d->scalerate ),
d->lastname,
d->max_hp,
d->max_hp,
d->gender,
d->race,
d->class_,
(bodyType)d->bodytype,
d->deity,
d->level,
d->npc_id,
d->size,
d->runspeed,
heading,
x,
y,
z,
d->light,
d->texture,
d->helmtexture,
d->AC,
d->ATK,
d->STR,
d->STA,
d->DEX,
d->AGI,
d->INT,
d->WIS,
d->CHA,
d->haircolor,
d->beardcolor,
d->eyecolor1,
d->eyecolor2,
d->hairstyle,
d->luclinface,
d->beard,
d->drakkin_heritage,
d->drakkin_tattoo,
d->drakkin_details,
(uint32*)d->armor_tint,
0,
d->see_invis, // pass see_invis/see_ivu flags to mob constructor
d->see_invis_undead,
d->see_hide,
d->see_improved_hide,
d->hp_regen,
d->mana_regen,
d->qglobal,
d->maxlevel,
d->scalerate ),
attacked_timer(CombatEventTimer_expire),
swarm_timer(100),
classattack_timer(1000),
@@ -135,7 +135,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
platinum = 0;
max_dmg = d->max_dmg;
min_dmg = d->min_dmg;
attack_count = d->attack_count;
attack_count = d->attack_count;
grid = 0;
wp_m = 0;
max_wp=0;
@@ -152,11 +152,11 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
findable = d->findable;
trackable = d->trackable;
MR = d->MR;
CR = d->CR;
DR = d->DR;
FR = d->FR;
PR = d->PR;
MR = d->MR;
CR = d->CR;
DR = d->DR;
FR = d->FR;
PR = d->PR;
Corrup = d->Corrup;
STR = d->STR;
@@ -166,7 +166,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
INT = d->INT;
WIS = d->WIS;
CHA = d->CHA;
npc_mana = d->Mana;
npc_mana = d->Mana;
//quick fix of ordering if they screwed it up in the DB
if(max_dmg < min_dmg) {
@@ -195,8 +195,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
accuracy_rating = d->accuracy_rating;
ATK = d->ATK;
CalcMaxMana();
SetMana(GetMaxMana());
CalcMaxMana();
SetMana(GetMaxMana());
MerchantType = d->merchanttype;
adventure_template_id = d->adventure_template;
@@ -208,7 +208,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
guard_y = -1;
guard_z = -1;
guard_heading = 0;
guard_anim = eaStanding;
guard_anim = eaStanding;
roambox_distance = 0;
roambox_max_x = -2;
roambox_max_y = -2;
@@ -244,7 +244,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
slow_mitigation = d->slow_mitigation;
EntityList::RemoveNumbers(name);
entity_list.MakeNameUnique(name);
entity_list.MakeNameUnique(name);
npc_aggro = d->npc_aggro;
@@ -343,8 +343,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
ldon_locked_skill = 0;
ldon_trap_detected = 0;
}
reface_timer = new Timer(15000);
reface_timer->Disable();
reface_timer = new Timer(15000);
reface_timer->Disable();
qGlobals = nullptr;
guard_x_saved = 0;
guard_y_saved = 0;
@@ -393,7 +393,7 @@ NPC::~NPC()
faction_list.clear();
}
safe_delete(reface_timer);
safe_delete(reface_timer);
safe_delete(swarmInfoPtr);
safe_delete(qGlobals);
UninitializeBuffSlots();
@@ -444,7 +444,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) {
itemlist.erase(cur);
return;
}
else if (item->item_id == item_id && item->equipSlot == slot && quantity >= 1) {
else if (item->item_id == item_id && item->equipSlot == slot && quantity >= 1) {
//cout<<"NPC::RemoveItem"<<" equipSlot:"<<iterator.GetData()->equipSlot<<" quantity:"<< quantity<<endl;
if (item->charges <= quantity)
itemlist.erase(cur);
@@ -517,7 +517,7 @@ void NPC::QueryLoot(Client* to) {
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12);
}
else
LogFile->write(EQEMuLog::Error, "Database error, invalid item");
LogFile->write(EQEMuLog::Error, "Database error, invalid item");
x++;
}
to->Message(0, "%i items on %s.", x, GetName());
@@ -525,24 +525,24 @@ void NPC::QueryLoot(Client* to) {
void NPC::AddCash(uint16 in_copper, uint16 in_silver, uint16 in_gold, uint16 in_platinum) {
if(in_copper >= 0)
copper = in_copper;
else
copper = 0;
copper = in_copper;
else
copper = 0;
if(in_silver >= 0)
silver = in_silver;
else
silver = 0;
if(in_silver >= 0)
silver = in_silver;
else
silver = 0;
if(in_gold >= 0)
gold = in_gold;
else
gold = 0;
if(in_gold >= 0)
gold = in_gold;
else
gold = 0;
if(in_platinum >= 0)
platinum = in_platinum;
else
platinum = 0;
if(in_platinum >= 0)
platinum = in_platinum;
else
platinum = 0;
}
void NPC::AddCash() {
@@ -563,32 +563,32 @@ bool NPC::Process()
{
_ZP(NPC_Process);
adverrorinfo = 1;
adverrorinfo = 1;
if (IsStunned() && stunned_timer.Check())
{
this->stunned = false;
this->stunned_timer.Disable();
{
this->stunned = false;
this->stunned_timer.Disable();
this->spun_timer.Disable();
}
}
if (p_depop)
{
Mob* owner = entity_list.GetMob(this->ownerid);
if (owner != 0)
{
//if(GetBodyType() != BT_SwarmPet)
// owner->SetPetID(0);
if (p_depop)
{
Mob* owner = entity_list.GetMob(this->ownerid);
if (owner != 0)
{
//if(GetBodyType() != BT_SwarmPet)
// owner->SetPetID(0);
this->ownerid = 0;
this->petid = 0;
}
return false;
}
this->petid = 0;
}
return false;
}
adverrorinfo = 2;
adverrorinfo = 2;
SpellProcess();
SpellProcess();
if(tic_timer.Check())
if(tic_timer.Check())
{
BuffProcess();
@@ -604,7 +604,7 @@ bool NPC::Process()
if(oocregen > 0){ //should pull from Mob class
OOCRegen += GetMaxHP() * oocregen / 100;
}
//Lieka Edit: Fixing NPC regen. NPCs should regen to full during a set duration, not based on their HPs. Increase NPC's HPs by % of total HPs / tick.
//Lieka Edit:Fixing NPC regen.NPCs should regen to full during a set duration, not based on their HPs.Increase NPC's HPs by % of total HPs / tick.
if((GetHP() < GetMaxHP()) && !IsPet()) {
if(!IsEngaged()) {//NPC out of combat
if(hp_regen > OOCRegen)
@@ -648,7 +648,7 @@ bool NPC::Process()
}
}
}
}
}
if (sendhpupdate_timer.Check() && (IsTargeted() || (IsPet() && GetOwner() && GetOwner()->IsClient()))) {
if(!IsFullHP || cur_hp<max_hp){
@@ -676,14 +676,14 @@ bool NPC::Process()
DoGravityEffect();
}
if(reface_timer->Check() && !IsEngaged() && (guard_x == GetX() && guard_y == GetY() && guard_z == GetZ())) {
SetHeading(guard_heading);
SendPosition();
reface_timer->Disable();
}
if(reface_timer->Check() && !IsEngaged() && (guard_x == GetX() && guard_y == GetY() && guard_z == GetZ())) {
SetHeading(guard_heading);
SendPosition();
reface_timer->Disable();
}
if (IsMezzed())
return true;
if (IsMezzed())
return true;
if(IsStunned()) {
if(spun_timer.Check())
@@ -710,7 +710,7 @@ bool NPC::Process()
AI_Process();
return true;
return true;
}
uint32 NPC::CountLoot() {
@@ -755,7 +755,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
else
return false;
break;
}
}
case SE_CurrentHPOnce:
case SE_CurrentHP: {
if(this->GetHPRatio() < 100 && spells[spell_id].buffduration == 0)
@@ -763,7 +763,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
else
return false;
break;
}
}
case SE_HealOverTime: {
if(this->GetHPRatio() < 100)
@@ -771,10 +771,10 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
else
return false;
break;
}
}
case SE_DamageShield: {
return true;
}
}
case SE_NecPet:
case SE_SummonPet: {
if(GetPet()){
@@ -784,12 +784,12 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
return false;
}
break;
}
}
case SE_LocateCorpse:
case SE_SummonCorpse: {
return false; //Pfft, npcs don't need to summon corpses/locate corpses!
break;
}
}
default:
if(spells[spell_id].goodEffect == 1 && !(spells[spell_id].buffduration == 0 && this->GetHPRatio() == 100) && !IsEngaged())
return true;
@@ -984,10 +984,10 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL_ROW row;
uint32 tmp = 0;
uint32 tmp2 = 0;
uint32 last_insert_id = 0;
uint32 last_insert_id = 0;
switch (command) {
case 0: { // Create a new NPC and add all spawn related data
uint32 npc_type_id = 0;
@@ -1025,7 +1025,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
if (npc_type_id)
{
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO npc_types (id, name, level, race, class, hp, gender, texture, helmtexture, size, loottable_id, merchant_id, face, runspeed, prim_melee_type, sec_melee_type) values(%i,\"%s\",%i,%i,%i,%i,%i,%i,%i,%f,%i,%i,%i,%f,%i,%i)", npc_type_id, tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28), errbuf, 0, 0, &npc_type_id)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
@@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
else
{
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO npc_types (name, level, race, class, hp, gender, texture, helmtexture, size, loottable_id, merchant_id, face, runspeed, prim_melee_type, sec_melee_type) values(\"%s\",%i,%i,%i,%i,%i,%i,%i,%f,%i,%i,%i,%f,%i,%i)", tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28), errbuf, 0, 0, &npc_type_id)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
@@ -1042,21 +1042,21 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
safe_delete_array(query);
snprintf(tmpstr, sizeof(tmpstr), "%s-%s", zone, spawn->GetName());
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawngroup (id, name) values(%i, '%s')", tmp, tmpstr), errbuf, 0, 0, &spawngroupid)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
if(c) c->LogSQL(query);
safe_delete_array(query);
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) values('%s', %u, %f, %f, %f, %i, %f, %i)", zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), 1200, spawn->GetHeading(), spawngroupid), errbuf, 0, 0, &tmp)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
if(c) c->LogSQL(query);
safe_delete_array(query);
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawnentry (spawngroupID, npcID, chance) values(%i, %i, %i)", spawngroupid, npc_type_id, 100), errbuf, 0)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
@@ -1070,7 +1070,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
char tmpstr[64];
snprintf(tmpstr, sizeof(tmpstr), "%s%s%i", zone, spawn->GetName(),Timer::GetCurrentTime());
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawngroup (name) values('%s')", tmpstr), errbuf, 0, 0, &last_insert_id)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
@@ -1086,7 +1086,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
else
respawntime = 1200;
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) values('%s', %u, %f, %f, %f, %i, %f, %i)", zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), respawntime, spawn->GetHeading(), last_insert_id), errbuf, 0, 0, &spawnid)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
@@ -1094,7 +1094,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
safe_delete_array(query);
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawnentry (spawngroupID, npcID, chance) values(%i, %i, %i)", last_insert_id, tmp2, 100), errbuf, 0)) {
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query, errbuf);
safe_delete(query);
return false;
}
@@ -1318,7 +1318,7 @@ void NPC::PickPocket(Client* thief) {
bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false;
int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow);
if (/*!Equipped(item->ID) &&*/
!item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != SLOT_INVALID
!item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != SLOT_INVALID
/*&& steal_skill > item->StealSkill*/ )
{
slot[x] = slot_id;
@@ -1387,38 +1387,38 @@ void NPC::PickPocket(Client* thief) {
{
switch (steal_type)
{
case 0:{
if (amt > GetPlatinum())
amt = GetPlatinum();
SetPlatinum(GetPlatinum()-amt);
thief->AddMoneyToPP(0,0,0,amt,false);
thief->SendPickPocketResponse(this, amt, PickPocketPlatinum);
break;
}
case 1:{
if (amt > GetGold())
amt = GetGold();
SetGold(GetGold()-amt);
thief->AddMoneyToPP(0,0,amt,0,false);
thief->SendPickPocketResponse(this, amt, PickPocketGold);
break;
}
case 2:{
if (amt > GetSilver())
amt = GetSilver();
SetSilver(GetSilver()-amt);
thief->AddMoneyToPP(0,amt,0,0,false);
thief->SendPickPocketResponse(this, amt, PickPocketSilver);
break;
}
case 3:{
if (amt > GetCopper())
amt = GetCopper();
SetCopper(GetCopper()-amt);
thief->AddMoneyToPP(amt,0,0,0,false);
thief->SendPickPocketResponse(this, amt, PickPocketCopper);
break;
}
case 0:{
if (amt > GetPlatinum())
amt = GetPlatinum();
SetPlatinum(GetPlatinum()-amt);
thief->AddMoneyToPP(0,0,0,amt,false);
thief->SendPickPocketResponse(this, amt, PickPocketPlatinum);
break;
}
case 1:{
if (amt > GetGold())
amt = GetGold();
SetGold(GetGold()-amt);
thief->AddMoneyToPP(0,0,amt,0,false);
thief->SendPickPocketResponse(this, amt, PickPocketGold);
break;
}
case 2:{
if (amt > GetSilver())
amt = GetSilver();
SetSilver(GetSilver()-amt);
thief->AddMoneyToPP(0,amt,0,0,false);
thief->SendPickPocketResponse(this, amt, PickPocketSilver);
break;
}
case 3:{
if (amt > GetCopper())
amt = GetCopper();
SetCopper(GetCopper()-amt);
thief->AddMoneyToPP(amt,0,0,0,false);
thief->SendPickPocketResponse(this, amt, PickPocketCopper);
break;
}
}
}
else
@@ -1430,18 +1430,18 @@ void NPC::PickPocket(Client* thief) {
}
void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool remove) {
if(reset)
if(reset)
{
for(int i = 0; i < SPECATK_MAXNUM; i++)
{
SpecAttacks[i] = false;
safe_delete(SpecAttackTimers[i]);
}
}
}
const char* orig_parse = parse;
while (*parse)
{
while (*parse)
{
switch(*parse)
{
case 'E':
@@ -1569,7 +1569,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem
break;
}
parse++;
}
}
if(permtag == 1 && this->GetNPCTypeID() > 0)
{
@@ -1584,8 +1584,8 @@ bool Mob::HasNPCSpecialAtk(const char* parse) {
bool HasAllAttacks = true;
while (*parse && HasAllAttacks == true)
{
while (*parse && HasAllAttacks == true)
{
switch(*parse)
{
case 'E':
@@ -1730,7 +1730,7 @@ bool Mob::HasNPCSpecialAtk(const char* parse) {
break;
}
parse++;
}
}
return HasAllAttacks;
}
@@ -1847,7 +1847,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
return;
}
if(id == "max_mana")
if(id == "max_mana")
{
npc_mana = atoi(val.c_str());
CalcMaxMana();
@@ -1937,7 +1937,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
return;
}
if(id == "attack_count")
if(id == "attack_count")
{
attack_count = atoi(val.c_str());
return;
@@ -2070,26 +2070,26 @@ void NPC::LevelScale() {
void NPC::CalcNPCResists() {
if (!MR)
MR = (GetLevel() * 11)/10;
if (!CR)
CR = (GetLevel() * 11)/10;
if (!DR)
DR = (GetLevel() * 11)/10;
if (!FR)
FR = (GetLevel() * 11)/10;
if (!PR)
PR = (GetLevel() * 11)/10;
if (!MR)
MR = (GetLevel() * 11)/10;
if (!CR)
CR = (GetLevel() * 11)/10;
if (!DR)
DR = (GetLevel() * 11)/10;
if (!FR)
FR = (GetLevel() * 11)/10;
if (!PR)
PR = (GetLevel() * 11)/10;
if (!Corrup)
Corrup = 15;
Corrup = 15;
return;
}
void NPC::CalcNPCRegen() {
// Fix for lazy db-updaters (regen values left at 0)
if (GetCasterClass() != 'N' && mana_regen == 0)
mana_regen = (GetLevel() / 10) + 4;
// Fix for lazy db-updaters (regen values left at 0)
if (GetCasterClass() != 'N' && mana_regen == 0)
mana_regen = (GetLevel() / 10) + 4;
else if(mana_regen < 0)
mana_regen = 0;
else
@@ -2100,25 +2100,25 @@ void NPC::CalcNPCRegen() {
if(hp_regen == 0)
{
if(GetLevel() <= 6)
hp_regen = 1;
else if(GetLevel() > 6 && GetLevel() <= 10)
hp_regen = 2;
else if(GetLevel() > 10 && GetLevel() <= 15)
hp_regen = 3;
else if(GetLevel() > 15 && GetLevel() <= 20)
hp_regen = 5;
else if(GetLevel() > 20 && GetLevel() <= 30)
hp_regen = 7;
else if(GetLevel() > 30 && GetLevel() <= 35)
hp_regen = 9;
else if(GetLevel() > 35 && GetLevel() <= 40)
hp_regen = 12;
else if(GetLevel() > 40 && GetLevel() <= 45)
hp_regen = 18;
else if(GetLevel() > 45 && GetLevel() <= 50)
hp_regen = 21;
else
hp_regen = 30;
hp_regen = 1;
else if(GetLevel() > 6 && GetLevel() <= 10)
hp_regen = 2;
else if(GetLevel() > 10 && GetLevel() <= 15)
hp_regen = 3;
else if(GetLevel() > 15 && GetLevel() <= 20)
hp_regen = 5;
else if(GetLevel() > 20 && GetLevel() <= 30)
hp_regen = 7;
else if(GetLevel() > 30 && GetLevel() <= 35)
hp_regen = 9;
else if(GetLevel() > 35 && GetLevel() <= 40)
hp_regen = 12;
else if(GetLevel() > 40 && GetLevel() <= 45)
hp_regen = 18;
else if(GetLevel() > 45 && GetLevel() <= 50)
hp_regen = 21;
else
hp_regen = 30;
} else if(hp_regen < 0) {
hp_regen = 0;
} else
@@ -2138,16 +2138,16 @@ void NPC::CalcNPCDamage() {
max_dmg = ((((99000)*(GetLevel()-64))/400)*AC_adjust/10);
}
else if (GetLevel() >= 60 && GetLevel() <= 65){
if(min_dmg==0)
if(min_dmg==0)
min_dmg = (GetLevel()+(GetLevel()/3));
if(max_dmg==0)
max_dmg = (GetLevel()*3)*AC_adjust/10;
if(max_dmg==0)
max_dmg = (GetLevel()*3)*AC_adjust/10;
}
else if (GetLevel() >= 51 && GetLevel() <= 59){
if(min_dmg==0)
min_dmg = (GetLevel()+(GetLevel()/3));
if(max_dmg==0)
max_dmg = (GetLevel()*3)*AC_adjust/10;
if(min_dmg==0)
min_dmg = (GetLevel()+(GetLevel()/3));
if(max_dmg==0)
max_dmg = (GetLevel()*3)*AC_adjust/10;
}
else if (GetLevel() >= 40 && GetLevel() <= 50) {
if (min_dmg==0)
@@ -2156,15 +2156,15 @@ void NPC::CalcNPCDamage() {
max_dmg = (GetLevel()*3)*AC_adjust/10;
}
else if (GetLevel() >= 28 && GetLevel() <= 39) {
if (min_dmg==0)
if (min_dmg==0)
min_dmg = GetLevel() / 2;
if (max_dmg==0)
if (max_dmg==0)
max_dmg = ((GetLevel()*2)+2)*AC_adjust/10;
}
else if (GetLevel() <= 27) {
if (min_dmg==0)
if (min_dmg==0)
min_dmg=1;
if (max_dmg==0)
if (max_dmg==0)
max_dmg = (GetLevel()*2)*AC_adjust/10;
}
@@ -2228,42 +2228,42 @@ void NPC::SetSwarmTarget(int target_id)
int32 NPC::CalcMaxMana() {
if(npc_mana == 0) {
switch (GetCasterClass()) {
case 'I':
max_mana = (((GetINT()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana;
break;
case 'W':
max_mana = (((GetWIS()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana;
break;
case 'N':
default:
max_mana = 0;
break;
}
if (max_mana < 0) {
max_mana = 0;
}
switch (GetCasterClass()) {
case 'I':
max_mana = (((GetINT()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana;
break;
case 'W':
max_mana = (((GetWIS()/2)+1) * GetLevel()) + spellbonuses.Mana + itembonuses.Mana;
break;
case 'N':
default:
max_mana = 0;
break;
}
if (max_mana < 0) {
max_mana = 0;
}
return max_mana;
} else {
switch (GetCasterClass()) {
case 'I':
max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana;
break;
case 'W':
max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana;
break;
case 'N':
default:
max_mana = 0;
break;
}
if (max_mana < 0) {
max_mana = 0;
}
return max_mana;
} else {
switch (GetCasterClass()) {
case 'I':
max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana;
break;
case 'W':
max_mana = npc_mana + spellbonuses.Mana + itembonuses.Mana;
break;
case 'N':
default:
max_mana = 0;
break;
}
if (max_mana < 0) {
max_mana = 0;
}
return max_mana;
}
return max_mana;
}
}
void NPC::SignalNPC(int _signal_id)
+49 -49
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef NPC_H
#define NPC_H
@@ -34,7 +34,7 @@ using namespace std;
#include "../common/rulesys.h"
#ifdef _WINDOWS
#define M_PI 3.141592
#define M_PI 3.141592
#endif
#define LEAVECOMBAT 0
@@ -64,7 +64,7 @@ struct AISpells_Struct {
uint32 time_cancast; // when we can cast this spell next
int32 recast_delay;
int16 priority;
int16 resist_adjust;
int16 resist_adjust;
};
class AA_SwarmPetInfo;
@@ -134,7 +134,7 @@ public:
virtual void RangedAttack(Mob* other);
virtual void ThrowingAttack(Mob* other) { }
int32 GetNumberOfAttacks() const { return attack_count; }
int32 GetNumberOfAttacks() const { return attack_count; }
bool DatabaseCastAccepted(int spell_id);
bool IsFactionListAlly(uint32 other_faction);
@@ -156,7 +156,7 @@ public:
void AddLootTable();
void AddLootTable(uint32 ldid);
void DescribeAggro(Client *towho, Mob *mob, bool verbose);
void RemoveItem(uint32 item_id, uint16 quantity = 0, uint16 slot = 0);
void RemoveItem(uint32 item_id, uint16 quantity = 0, uint16 slot = 0);
void CheckMinMaxLevel(Mob *them);
void ClearItemList();
ServerLootItem_Struct* GetItem(int slot_id);
@@ -179,7 +179,7 @@ public:
inline void SetPlatinum(uint32 amt) { platinum = amt; }
virtual int32 CalcMaxMana();
virtual int32 CalcMaxMana();
void SetGrid(int32 grid_){ grid=grid_; }
void SetSp2(uint32 sg2){ spawn_group=sg2; }
void SetWaypointMax(uint16 wp_){ wp_m=wp_; }
@@ -197,9 +197,9 @@ public:
float GetGuardPointX() const { return guard_x; }
float GetGuardPointY() const { return guard_y; }
float GetGuardPointZ() const { return guard_z; }
float GetGuardPointH() const { return guard_heading; }
EmuAppearance GetGuardPointAnim() const { return guard_anim; }
void SaveGuardPointAnim(EmuAppearance anim) { guard_anim = anim; }
float GetGuardPointH() const { return guard_heading; }
EmuAppearance GetGuardPointAnim() const { return guard_anim; }
void SaveGuardPointAnim(EmuAppearance anim) { guard_anim = anim; }
void SetFlyMode(uint8 FlyMode){ flymode=FlyMode; }
uint32 GetFlyMode() const { return flymode; }
@@ -221,22 +221,22 @@ public:
inline int32 GetNPCFactionID() const { return npc_faction_id; }
inline int32 GetPrimaryFaction() const { return primary_faction; }
int32 GetNPCHate(Mob* in_ent) {return hate_list.GetEntHate(in_ent);}
bool IsOnHatelist(Mob*p) { return hate_list.IsOnHateList(p);}
int32 GetNPCHate(Mob* in_ent) {return hate_list.GetEntHate(in_ent);}
bool IsOnHatelist(Mob*p) { return hate_list.IsOnHateList(p);}
void SetNPCFactionID(int32 in) { npc_faction_id = in; database.GetFactionIdsForNPC(npc_faction_id, &faction_list, &primary_faction); }
float org_x, org_y, org_z, org_heading;
float org_x, org_y, org_z, org_heading;
uint32 GetMaxDMG() const {return max_dmg;}
uint32 GetMinDMG() const {return min_dmg;}
float GetSlowMitigation() const {return slow_mitigation;}
float GetAttackSpeed() const {return attack_speed;}
bool IsAnimal() const { return(bodytype == BT_Animal); }
uint16 GetPetSpellID() const {return pet_spell_id;}
void SetPetSpellID(uint16 amt) {pet_spell_id = amt;}
uint16 GetPetSpellID() const {return pet_spell_id;}
void SetPetSpellID(uint16 amt) {pet_spell_id = amt;}
uint32 GetMaxDamage(uint8 tlevel);
void SetTaunting(bool tog) {taunting = tog;}
void SetTaunting(bool tog) {taunting = tog;}
void PickPocket(Client* thief);
void StartSwarmTimer(uint32 duration) { swarm_timer.Start(duration); }
void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false);
@@ -244,7 +244,7 @@ public:
void CheckSignal();
//waypoint crap
int GetMaxWp() const { return max_wp; }
int GetMaxWp() const { return max_wp; }
void DisplayWaypointInfo(Client *to);
void CalculateNewWaypoint();
void AssignWaypoints(int32 grid);
@@ -256,7 +256,7 @@ public:
void ResumeWandering();
void PauseWandering(int pausetime);
void MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot);
void GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float m_y, float m_z);
void GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float m_y, float m_z);
uint32 GetEquipment(uint8 material_slot) const; // returns item id
int32 GetEquipmentMaterial(uint8 material_slot) const;
@@ -286,7 +286,7 @@ public:
inline void GiveNPCTypeData(NPCType *ours) { NPCTypedata_ours = ours; }
inline const uint32 GetNPCSpellsID() const { return npc_spells_id; }
ItemList itemlist; //kathgar - why is this public? Doing other things or I would check the code
ItemList itemlist; //kathgar - why is this public? Doing other things or I would check the code
NPCProximity* proximity;
Spawn2* respawn2;
@@ -326,7 +326,7 @@ public:
//The corpse we make can only be looted by people who got credit for the kill
const bool HasPrivateCorpse() const { return NPCTypedata->private_corpse; }
const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; }
const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; }
const char* GetRawNPCTypeName() const { return NPCTypedata->name; }
bool GetDepop() { return p_depop; }
@@ -336,17 +336,17 @@ public:
uint32 GetAdventureTemplate() const { return adventure_template_id; }
void AddSpellToNPCList(int16 iPriority, int16 iSpellID, uint16 iType, int16 iManaCost, int32 iRecastDelay, int16 iResistAdjust);
void RemoveSpellFromNPCList(int16 spell_id);
Timer *GetRefaceTimer() const { return reface_timer; }
const uint32 GetAltCurrencyType() const { return NPCTypedata->alt_currency_type; }
Timer *GetRefaceTimer() const { return reface_timer; }
const uint32 GetAltCurrencyType() const { return NPCTypedata->alt_currency_type; }
NPC_Emote_Struct* GetNPCEmote(uint16 emoteid, uint8 event_);
void DoNPCEmote(uint8 event_, uint16 emoteid);
bool CanTalk();
inline void SetSpellScale(float amt) { spellscale = amt; }
inline void SetSpellScale(float amt) { spellscale = amt; }
inline float GetSpellScale() { return spellscale; }
inline void SetHealScale(float amt) { healscale = amt; }
inline void SetHealScale(float amt) { healscale = amt; }
inline float GetHealScale() { return healscale; }
void AddQuestItem(ItemInst* inst) { questItems.Insert(inst); }
@@ -472,24 +472,24 @@ protected:
uint32 silver;
uint32 gold;
uint32 platinum;
int32 grid;
uint32 spawn_group;
int32 grid;
uint32 spawn_group;
uint16 wp_m;
int32 npc_faction_id;
int32 primary_faction;
Timer attacked_timer; //running while we are being attacked (damaged)
Timer swarm_timer;
Timer classattack_timer;
Timer swarm_timer;
Timer classattack_timer;
Timer knightattack_timer;
Timer assist_timer; //ask for help from nearby mobs
Timer assist_timer; //ask for help from nearby mobs
Timer qglobal_purge_timer;
bool combat_event; //true if we are in combat, false otherwise
Timer sendhpupdate_timer;
Timer sendhpupdate_timer;
Timer enraged_timer;
Timer *reface_timer;
Timer *reface_timer;
uint32 npc_spells_id;
uint8 casting_spell_AIindex;
@@ -504,15 +504,15 @@ protected:
uint32 max_dmg;
uint32 min_dmg;
int32 accuracy_rating;
int16 attack_count;
uint32 npc_mana;
float spellscale;
float healscale;
int16 attack_count;
uint32 npc_mana;
float spellscale;
float healscale;
//pet crap:
uint16 pet_spell_id;
bool taunting;
Timer taunt_timer; //for pet taunting
Timer taunt_timer; //for pet taunting
bool npc_aggro;
@@ -523,9 +523,9 @@ protected:
void _ClearWaypints();
int max_wp;
int save_wp;
float guard_x, guard_y, guard_z, guard_heading;
float guard_x, guard_y, guard_z, guard_heading;
float guard_x_saved, guard_y_saved, guard_z_saved, guard_heading_saved;
EmuAppearance guard_anim;
EmuAppearance guard_anim;
float roambox_max_x;
float roambox_max_y;
float roambox_min_x;
@@ -535,8 +535,8 @@ protected:
float roambox_movingto_y;
uint32 roambox_delay;
uint16 skills[HIGHEST_SKILL+1];
uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs
uint16 skills[HIGHEST_SKILL+1];
uint32 equipment[MAX_WORN_INVENTORY]; //this is an array of item IDs
uint16 d_meele_texture1; //this is an item Material value
uint16 d_meele_texture2; //this is an item Material value (offhand)
uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation
+16 -16
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef OBJECT_H
#define OBJECT_H
@@ -91,7 +91,7 @@ IT10725_ACTORDEF=Shuriken
#define OT_TEIRDALFORGE 0x20 //dark elf
#define OT_OGGOKFORGE 0x21 //ogre
#define OT_STORMGUARDF 0x22 //dwarven
#define OT_VALEFORGE 0x31 //halfling
#define OT_VALEFORGE 0x31 //halfling
// gnome forge 0x23 (ak'anon forge)
// barbarian forge 0x24 (northman forge)
//
@@ -175,12 +175,12 @@ public:
uint32 GetDBID();
uint32 GetType();
void SetType(uint32 type);
void SetDBID(uint32 dbid);
void SetType(uint32 type);
void SetDBID(uint32 dbid);
uint32 GetIcon();
void SetIcon(uint32 icon);
void SetIcon(uint32 icon);
uint32 GetItemID();
void SetItemID(uint32 itemid);
void SetItemID(uint32 itemid);
void GetObjectData(Object_Struct* Data);
void SetObjectData(Object_Struct* Data);
void GetLocation(float* x, float* y, float* z);
+171 -171
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -36,30 +36,30 @@ using namespace std;
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#endif
bool spells_loaded = false;
volatile bool RunLoops = true;
extern volatile bool ZoneLoaded;
#ifdef SHAREMEM
#include "../common/EMuShareMem.h"
extern LoadEMuShareMemDLL EMuShareMemDLL;
#ifndef WIN32
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include "../common/EMuShareMem.h"
extern LoadEMuShareMemDLL EMuShareMemDLL;
#ifndef WIN32
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#ifndef FREEBSD
union semun {
int val;
struct semid_ds *buf;
ushort *array;
struct seminfo *__buf;
void *__pad;
};
union semun {
int val;
struct semid_ds *buf;
ushort *array;
struct seminfo *__buf;
void *__pad;
};
#endif
#endif
#endif
#endif
@@ -674,20 +674,20 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
token[u]=(char)0;
} //cout << "end class";
/*for(y=0; y< 3;y++)
{
in.get(temp);
while(chrcmpI(&temp,&sep))
{
strncat(token,&temp,1);
a++;
in.get(temp);
}
spells[tempid].unknown1[y]=atoi(token);
cout << spells[tempid].unknown1[y] << '^';
a=0;
for(u=0;u<64;u++)
token[u]=(char)0;
/*for(y=0; y< 3;y++)
{
in.get(temp);
while(chrcmpI(&temp,&sep))
{
strncat(token,&temp,1);
a++;
in.get(temp);
}
spells[tempid].unknown1[y]=atoi(token);
cout << spells[tempid].unknown1[y] << '^';
a=0;
for(u=0;u<64;u++)
token[u]=(char)0;
}
in.get(temp);
@@ -754,23 +754,23 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
token[u]=(char)0;
for(y=0; y< 23;y++)
{
{
in.get(temp);
while(chrcmpI(&temp,&sep))
{
strncat(token,&temp,1);
a++;
in.get(temp);
}
}
spells[tempid].Spacing2[y]=atoi(token);
//cout << spells[tempid].base[y] << '^';
a=0;
for(u=0;u<64;u++)
token[u]=(char)0;
token[u]=(char)0;
}
in.get(temp);
while(chrcmpI(&temp,&sep))
in.get(temp);
while(chrcmpI(&temp,&sep))
{
strncat(token,&temp,1);
a++;
@@ -780,9 +780,9 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
//cout << spells[tempid].ResistDiff << '^';
a=0;
for(u=0;u<64;u++)
token[u]=(char)0;
token[u]=(char)0;
in.get(temp);
in.get(temp);
for(y=0; y< 2;y++)
{
in.get(temp);
@@ -799,8 +799,8 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
token[u]=(char)0;
}
in.get(temp);
while(chrcmpI(&temp,&sep))
in.get(temp);
while(chrcmpI(&temp,&sep))
{
strncat(token,&temp,1);
a++;
@@ -810,9 +810,9 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
//cout << spells[tempid].RecourseLink << '^';
a=0;
for(u=0;u<64;u++)
token[u]=(char)0;
token[u]=(char)0;
while(temp!='\n')
while(temp!='\n')
in.get(temp);
//cout << endl;
@@ -840,7 +840,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
void ZoneDatabase::UpdateAndDeleteAATimers(uint32 charid){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
char *query2 = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "delete from aa_timers where charid=%i and UNIX_TIMESTAMP(now())>=end",charid), errbuf)) {
@@ -855,7 +855,7 @@ void ZoneDatabase::UpdateAndDeleteAATimers(uint32 charid){
void ZoneDatabase::UpdateTimersClientConnected(uint32 charid){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "update aa_timers set end=(UNIX_TIMESTAMP(now())+(end-begin)),begin=UNIX_TIMESTAMP(now()) where charid=%i",charid), errbuf)) {
LogFile->write(EQEMuLog::Error, "UpdateAATimers query '%s' %s", query, errbuf);
}
@@ -864,8 +864,8 @@ void ZoneDatabase::UpdateTimersClientConnected(uint32 charid){
void ZoneDatabase::GetAATimers(uint32 charid){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT ability,begin,end from aa_timers WHERE charid=%i", charid), errbuf, &result)) {
@@ -887,8 +887,8 @@ void ZoneDatabase::GetAATimers(uint32 charid){
uint32 ZoneDatabase::GetTimerRemaining(uint32 charid,uint32 ability){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
uint32 remain=0;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT end-begin from aa_timers WHERE charid=%i and ability=%i", charid,ability), errbuf, &result)) {
@@ -906,7 +906,7 @@ uint32 ZoneDatabase::GetTimerRemaining(uint32 charid,uint32 ability){
void ZoneDatabase::UpdateAATimers(uint32 charid,uint32 endtime,uint32 begintime,uint32 ability){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
if(begintime==0){
if (!RunQuery(query, MakeAnyLenString(&query, "replace into aa_timers (charid,end,begin,ability) values(%i,UNIX_TIMESTAMP(now())+%i,UNIX_TIMESTAMP(now()),%i)",charid,endtime,ability), errbuf)) {
LogFile->write(EQEMuLog::Error, "UpdateAATimers query '%s' %s", query, errbuf);
@@ -1148,7 +1148,7 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid)
return 100;
break;
default:
LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit effect %d", spells[modspellid].base[i]);
LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit effect %d", spells[modspellid].base[i]);
}
break;
case SE_LimitCastTime:
@@ -1167,7 +1167,7 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid)
return 100;
break;
default:
LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit spelltype %d", spells[modspellid].base[i]);
LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown limit spelltype %d", spells[modspellid].base[i]);
}
break;
case SE_LimitMinDur:
@@ -1182,7 +1182,7 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid)
modifier -= modspell.base[i];
break;
default:
LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown effectid %d", modspell.effectid[i]);
LogFile->write(EQEMuLog::Normal, "GenericFocus: unknown effectid %d", modspell.effectid[i]);
}
}
@@ -1212,7 +1212,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
uint32 duration = 0;
uint32 reuse = 0;
switch(disc_in->disc_id){
switch(disc_in->disc_id){
// Shared?
case discResistant: { // Resistant
// 1 minute duration
@@ -1223,7 +1223,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
duration = 60;
reuse = 60*60;
entity_list.MessageClose(this, false, 100, 0, "%s has become more resistant!", GetName());
break;
break;
}
case discFearless: { // Fearless
// 11 second duration
@@ -1235,20 +1235,20 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
reuse = 60*60;
entity_list.MessageClose_StringID(this, false, 100, 0, DISCIPLINE_FEARLESS, GetName());
//entity_list.MessageClose(this, false, 100, 0, "%s becomes fearless!", GetName());
break;
break;
}
case discWhirlwind: { // Counterattack/Whirlwind/Furious
// warrior level 56
// rogue/monk level 53
// 9 second duration
// 1 hour reuse
if ( (GetClass() == WARRIOR && GetLevel() <= 56)
if ((GetClass() == WARRIOR && GetLevel() <= 56)
||(GetLevel() <= 53)
) return;
duration = 9;
reuse = 60*60;
entity_list.MessageClose(this, false, 100, 0, "%s\'s face becomes twisted with fury!", GetName());
break;
break;
}
case discFellstrike: { // Duelist/Innerflame/Fellstrike
// monk level 56
@@ -1257,21 +1257,21 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// 12 second duration
// 30 minute reuse
// min 4*base hand/weapon damage
if ( (GetClass() == MONK && GetLevel() <= 55)
if ((GetClass() == MONK && GetLevel() <= 55)
||(GetClass() == WARRIOR && GetLevel() <= 58)
||(GetClass() == ROGUE && GetLevel() <= 59)
) return;
duration = 12;
reuse = 60*30;
entity_list.MessageClose(this, false, 100, 0, "%s\'s muscles bulge with force of will!", GetName());
break;
break;
}
case discBlindingSpeed: { // Blindingspeed/Hundredfist
// rogue level 58
// monk level 57
// 15 second duration
// 30 minute reuse
if ( (GetClass() == MONK && GetLevel() <= 58)
if ((GetClass() == MONK && GetLevel() <= 58)
||(GetClass() == ROGUE && GetLevel() <= 57)
) return;
//disc_timer.Start(1000*60*30);
@@ -1279,20 +1279,20 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
duration = 15;
reuse = 60*30;
Message(0, "This discipline not implemented..");
break;
break;
}
case discDeadeye: { // Deadeye/Charge
// warrior level 53
// rogue level 54
// 14 second duration
// 30 minute reuse
if ( (GetClass() == WARRIOR && GetLevel() <= 53)
if ((GetClass() == WARRIOR && GetLevel() <= 53)
||(GetClass() == ROGUE && GetLevel() <= 54)
) return;
duration = 14;
reuse = 60*30;
entity_list.MessageClose(this, false, 100, 0, "%s feels unstopable!", GetName());
break;
break;
}
// Warrior
case discEvasive: { // Evasive
@@ -1303,7 +1303,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// -15% out
duration = 3*60;
reuse = 15*60;
break;
break;
}
case discMightystrike: { // Mightystrike
// level 54
@@ -1312,7 +1312,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// Auto crit
duration = 10;
reuse = 60*60;
break;
break;
}
case discDefensive: { // Defensive
// level 55
@@ -1325,7 +1325,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
reuse = 10*60;
else
reuse = 15*60;
break;
break;
}
case discPrecise: { // Precise
// level 57
@@ -1335,7 +1335,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// +35% out
duration = 3*60;
reuse = 30*60;
break;
break;
}
case discAggressive: { // Aggressive
// level 60
@@ -1345,7 +1345,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// +35% out
duration = 3*60;
reuse = 27*60;
break;
break;
}
// Monk
case discStonestance: { // Stonestance
@@ -1355,7 +1355,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
reuse = 3*60;
else
reuse = 12*60;
break;
break;
}
case discThunderkick: { // Thunderkick
// level 52
@@ -1364,7 +1364,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 7*60;
duration = 5*60; //hack for now, checked in combat and expired once used.
break;
break;
}
case discVoidance: { // Voidance
// level 54
@@ -1373,7 +1373,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 60*60;
duration = 8;
break;
break;
}
case discSilentfist: { // Silentfist
// level 59
@@ -1385,7 +1385,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 7*60;
duration = 5*60; //hack for now, checked in combat and expired once used.
break;
break;
}
case discAshenhand: { // Ashenhand
// level 60
@@ -1394,7 +1394,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// Chance to slay
reuse = 72*60;
duration = 5*60; //hack for now, checked in combat and expired once used.
break;
break;
}
// Rogue
case discNimble: { // Nimble
@@ -1407,7 +1407,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 30*60;
duration = 12;
break;
break;
}
case discKinesthetics: { // Kinesthetics
// level 57
@@ -1420,7 +1420,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 30*60;
duration = 18;
break;
break;
}
// Paladin
case discHolyforge: { // Holyforge
@@ -1434,7 +1434,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 72*60;
duration = 5*60;
break;
break;
}
case discSanctification: { // Sanctification
// level 60
@@ -1443,7 +1443,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// Spell immunity
reuse = 72*60;
duration = 15;
break;
break;
}
// Ranger
case discTrueshot: { // Trueshot
@@ -1457,7 +1457,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 72*60;
duration = 2*60;
break;
break;
}
case discWeaponshield: { // Weaponshield
// level 60
@@ -1466,7 +1466,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// auto parry
reuse = 72*60;
duration = 20;
break;
break;
}
// Bard
case discDeftdance: { // Deftdance
@@ -1480,7 +1480,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 72*60;
duration = 10;
break;
break;
}
case discPuretone: { // Puretone
// level 60
@@ -1489,7 +1489,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// Auto instrument
reuse = 72*60;
duration = 4*60;
break;
break;
}
// Shadow knight
case discUnholyAura: { // Unholy
@@ -1502,7 +1502,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else
reuse = 72*60;
duration = 5*60; //hack for now, checked in combat and expired once used.
break;
break;
}
case discLeechCurse: { // Leech curse
// level 60
@@ -1511,18 +1511,18 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// Heal self for each point of melee damage done
reuse = 72*60;
duration = 15;
break;
break;
}
// Default
case 0:{ // Timer request
break;
}
default:
LogFile->write(EQEMuLog::Error, "Unknown Discipline requested by client: %s class: %i Disciline:%i", GetName(), class_,disc_in->disc_id);
return;
}
LogFile->write(EQEMuLog::Error, "Unknown Discipline requested by client: %s class: %i Disciline:%i", GetName(), class_,disc_in->disc_id);
return;
}
if(reuse != 0) {
if(reuse != 0) {
p_timers.Start(pTimerDisciplineReuse, reuse);
//nonpersistent timer for the 'discipline ready' message
disc_timer.Start(1000*reuse);
@@ -1541,37 +1541,37 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
while(iterator.MoreElements()) {
Mob* mob = iterator.GetData();
if (group){
// Client casting group spell with out target group buffs enabled
// Skip non group members
if ( caster->IsClient()
&& !caster->CastToClient()->TGB()
&& GetGroupByMob(mob) != 0
&& !GetGroupByMob(mob)->IsGroupMember(caster)
) {
LogFile->write(EQEMuLog::Debug, "Group spell skipping %s", mob->GetName());
iterator.Advance();
continue;
}
// Client casting group spell with target group buffs enabled
else if ( caster->IsClient()
&& caster->CastToClient()->TGB()
&& GetGroupByMob(mob) != 0
&& GetGroupByMob(mob)->IsGroupMember(caster)
){
LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s's Group", mob->GetName());
GetGroupByMob(mob)->CastGroupSpell(caster, spell_id);
iterator.Advance();
continue;
}
else if ( caster->IsClient()
&& caster->CastToClient()->TGB()
&& GetGroupByMob(mob) == 0
&& mob == center
){
LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s", mob->GetName());
caster->SpellOnTarget(spell_id, mob);
return;
}
// Client casting group spell with out target group buffs enabled
// Skip non group members
if (caster->IsClient()
&& !caster->CastToClient()->TGB()
&& GetGroupByMob(mob) != 0
&& !GetGroupByMob(mob)->IsGroupMember(caster)
) {
LogFile->write(EQEMuLog::Debug, "Group spell skipping %s", mob->GetName());
iterator.Advance();
continue;
}
// Client casting group spell with target group buffs enabled
else if (caster->IsClient()
&& caster->CastToClient()->TGB()
&& GetGroupByMob(mob) != 0
&& GetGroupByMob(mob)->IsGroupMember(caster)
){
LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s's Group", mob->GetName());
GetGroupByMob(mob)->CastGroupSpell(caster, spell_id);
iterator.Advance();
continue;
}
else if (caster->IsClient()
&& caster->CastToClient()->TGB()
&& GetGroupByMob(mob) == 0
&& mob == center
){
LogFile->write(EQEMuLog::Debug, "Group spell TGB on %s", mob->GetName());
caster->SpellOnTarget(spell_id, mob);
return;
}
}
if (
mob->DistNoZ(*center) <= dist
@@ -1586,66 +1586,66 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
else if(caster->IsNPC() && !caster->CastToNPC()->IsInteractive()) {
#else
else if(caster->IsNPC()) {
#endif
// Npc
#endif
// Npc
if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard) {
// printf("NPC Spell casted on %s\n", mob->GetName());
//printf("NPC Spell casted on %s\n", mob->GetName());
caster->SpellOnTarget(spell_id, mob);
}
else if (mob->IsAIControlled() && spells[spell_id].targettype == ST_AEBard) {
// printf("NPC mgb/aebard spell casted on %s\n", mob->GetName());
//printf("NPC mgb/aebard spell casted on %s\n", mob->GetName());
caster->SpellOnTarget(spell_id, mob);
}
else {
// printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype);
//printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype);
}
}
#ifdef IPC
else if(caster->IsNPC() && caster->CastToNPC()->IsInteractive()) {
// Interactive npc
else if(caster->IsNPC() && caster->CastToNPC()->IsInteractive()) {
// Interactive npc
if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard && spells[spell_id].targettype != ST_GroupTeleport) {
// printf("IPC Spell casted on %s\n", mob->GetName());
//printf("IPC Spell casted on %s\n", mob->GetName());
caster->SpellOnTarget(spell_id, mob);
}
else if (!mob->IsAIControlled() && (spells[spell_id].targettype == ST_AEBard||group) && mob->CastToClient()->GetPVP() == caster->CastToClient()->GetPVP()) {
if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) {
iterator.Advance();
continue;
}
// printf("IPC mgb/aebard spell casted on %s\n", mob->GetName());
if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) {
iterator.Advance();
continue;
}
//printf("IPC mgb/aebard spell casted on %s\n", mob->GetName());
caster->SpellOnTarget(spell_id, mob);
}
else {
// printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype);
//printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype);
}
}
#endif
else if (caster->IsClient() && !(caster->CastToClient()->IsBecomeNPC())) {
else if (caster->IsClient() && !(caster->CastToClient()->IsBecomeNPC())) {
// Client
if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard){
// printf("Client Spell casted on %s\n", mob->GetName());
//printf("Client Spell casted on %s\n", mob->GetName());
caster->SpellOnTarget(spell_id, mob);
}
else if(spells[spell_id].targettype == ST_GroupTeleport && mob->IsClient() && mob->isgrouped && caster->isgrouped && entity_list.GetGroupByMob(caster))
{
Group* caster_group = entity_list.GetGroupByMob(caster);
if(caster_group != 0 && caster_group->IsGroupMember(mob))
caster->SpellOnTarget(spell_id,mob);
if(caster_group != 0 && caster_group->IsGroupMember(mob))
caster->SpellOnTarget(spell_id,mob);
}
else if (mob->IsClient() && (spells[spell_id].targettype == ST_AEBard||group) && mob->CastToClient()->GetPVP() == caster->CastToClient()->GetPVP()) {
if (group && GetGroupByMob(mob) != GetGroupByMob(caster)) {
iterator.Advance();
continue;
}
iterator.Advance();
continue;
}
else if (mob->IsClient() && spells[spell_id].targettype == ST_AEBard && mob->CastToClient()->GetPVP() == caster->CastToClient()->GetPVP())
caster->SpellOnTarget(spell_id, mob);
#ifdef IPC
else if (mob->IsNPC() && mob->CastToNPC()->IsInteractive()) {
if (group && GetGroupByMob(mob) != GetGroupByMob(caster))
continue;
caster->SpellOnTarget(spell_id, mob);
else if (mob->IsNPC() && mob->CastToNPC()->IsInteractive()) {
if (group && GetGroupByMob(mob) != GetGroupByMob(caster))
continue;
caster->SpellOnTarget(spell_id, mob);
}
#endif
#endif
}
}
else if (caster->IsClient()) {
@@ -1662,9 +1662,9 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
// Queries the loottable: adds item & coin to the npc
void ZoneDatabase::AddLootTableToNPC(uint32 loottable_id, ItemList* itemlist, uint32* copper, uint32* silver, uint32* gold, uint32* plat) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
*copper = 0;
*silver = 0;
*gold = 0;
@@ -1747,12 +1747,12 @@ void ZoneDatabase::AddLootTableToNPC(uint32 loottable_id, ItemList* itemlist, ui
// maxdrops = size of the array npcd
void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
// This is Wiz's updated Pool Looting functionality. Eventually, the database format should be moved over to use this
// or implemented to support both methods. (A unique identifier in lootable_entries indicates to roll for a pool item
// This is Wiz's updated Pool Looting functionality. Eventually, the database format should be moved over to use this
// or implemented to support both methods. (A unique identifier in lootable_entries indicates to roll for a pool item
// in another table.
#ifdef POOLLOOTING
uint32 chancepool = 0;
@@ -1782,14 +1782,14 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
uint32 res;
i = 0;
if (chancepool!=0) //avoid divide by zero if some mobs have 0 for chancepool
{
res = rand()%chancepool;
}
else
{
res = 0;
}
if (chancepool!=0) //avoid divide by zero if some mobs have 0 for chancepool
{
res = rand()%chancepool;
}
else
{
res = 0;
}
while (items[i] != 0)
{
@@ -1821,7 +1821,7 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
safe_delete_array(query);
while ((row = mysql_fetch_row(result)))
{
uint8 LootDropMod=1; // place holder till I put it in a database variable to make it configurable.
uint8 LootDropMod=1; // place holder till I put it in a database variable to make it configurable.
if( (rand()%100) < ((atoi(row[4]) * LootDropMod)) )
{
uint32 itemid = atoi(row[1]);
+11 -14
View File
@@ -1,25 +1,22 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef OLDCODE_H
#define OLDCODE_H
#endif
+18 -18
View File
@@ -84,37 +84,37 @@ public:
int ParseCommands(std::string text, int line, int justcheck, uint32 npcid, Mob* other, Mob* mob, std::string filename=string("none"));
int ParseIf(std::string text);
int pcalc(const char * string);
void ParseVars(std::string& text, uint32 npcid, Mob* mob);
void ParseVars(std::string& text, uint32 npcid, Mob* mob);
void Replace(std::string& string1, std::string repstr, std::string rep, int all=0);
void scanformat(char *string, const char *format, char arg[10][1024]);
bool SetNPCqstID(uint32 iNPCID, int32 iValue);
char * strrstr(char* string, const char * sub);
char * strrstr(char* string, const char * sub);
virtual void SendCommands(const char * event, uint32 npcid, NPC* npcmob, Mob* mob);
int HasQuestFile(uint32 npcid);
//interface stuff
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {}
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {}
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {}
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {}
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {}
virtual bool HasQuestSub(uint32 npcid, const char *subname) { return HasQuestFile(npcid) != 0; }
virtual bool PlayerHasQuestSub(const char *subname) { return true; }
virtual bool GlobalPlayerHasQuestSub(const char *subname) { return true; }
virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname) { return true; }
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return true; }
virtual void AddVar(std::string varname, std::string varval);
//interface stuff
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {}
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {}
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {}
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {}
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {}
virtual bool HasQuestSub(uint32 npcid, const char *subname) { return HasQuestFile(npcid) != 0; }
virtual bool PlayerHasQuestSub(const char *subname) { return true; }
virtual bool GlobalPlayerHasQuestSub(const char *subname) { return true; }
virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname) { return true; }
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return true; }
virtual void AddVar(std::string varname, std::string varval);
virtual void ReloadQuests(bool with_timers = false);
virtual uint32 GetIdentifier() { return 0x04629fff; }
virtual uint32 GetIdentifier() { return 0x04629fff; }
private:
//void Event(int event, uint32 npcid, const char * data, Mob* npcmob, Mob* mob);
//changed - Eglin. more reasonable (IMHO) than changing every single referance to the global pointer.
//void Event(int event, uint32 npcid, const char * data, Mob* npcmob, Mob* mob);
//changed - Eglin. more reasonable (IMHO) than changing every single referance to the global pointer.
//that's what you get for using globals! :)
virtual void Event(QuestEventID event, uint32 npcid, const char * data, NPC* npcmob, Mob* mob, uint32 extradata = 0);
virtual void Event(QuestEventID event, uint32 npcid, const char * data, NPC* npcmob, Mob* mob, uint32 extradata = 0);
uint32 pMaxNPCID;
int32* pNPCqstID;
+31 -30
View File
@@ -13,7 +13,7 @@
#include "zone.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#define snprintf _snprintf
#endif
//#define PATHDEBUG
@@ -114,7 +114,7 @@ bool PathManager::loadPaths(FILE *PathFile)
fread(&Head, sizeof(Head), 1, PathFile);
LogFile->write(EQEMuLog::Status, "Path File Header: Version %ld, PathNodes %ld",
(long)Head.version, (long)Head.PathNodeCount);
(long)Head.version, (long)Head.PathNodeCount);
if(Head.version != 2)
{
@@ -163,7 +163,7 @@ void PathManager::PrintPathing()
for(uint32 i = 0; i < Head.PathNodeCount; ++i)
{
printf("PathNode: %2d id %2d. (%8.3f, %8.3f, %8.3f), BestZ: %8.3f\n",
i, PathNodes[i].id, PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, PathNodes[i].bestz);
i, PathNodes[i].id, PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, PathNodes[i].bestz);
if(PathNodes[i].Neighbours[0].id == -1)
@@ -178,7 +178,7 @@ void PathManager::PrintPathing()
break;
printf(" Neighbour: %2d, Distance %8.3f", PathNodes[i].Neighbours[j].id,
PathNodes[i].Neighbours[j].distance);
PathNodes[i].Neighbours[j].distance);
if(PathNodes[i].Neighbours[j].Teleport)
printf(" ***** TELEPORT *****");
@@ -294,7 +294,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
AStarEntry.GCost = CurrentNode.GCost + PathNodes[CurrentNode.PathNodeID].Neighbours[i].distance;
float FCost = AStarEntry.HCost + AStarEntry.GCost;
float FCost = AStarEntry.HCost + AStarEntry.GCost;
#ifdef PATHDEBUG
printf("Node: %i, Open Neighbour %i has HCost %8.3f, GCost %8.3f (Total Cost: %8.3f)\n",
CurrentNode.PathNodeID,
@@ -314,7 +314,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
{
AlreadyInOpenList = true;
float GCostToNode = CurrentNode.GCost + PathNodes[CurrentNode.PathNodeID].Neighbours[i].distance;
float GCostToNode = CurrentNode.GCost + PathNodes[CurrentNode.PathNodeID].Neighbours[i].distance;
if(GCostToNode < (*OpenListIterator).GCost)
{
@@ -361,7 +361,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
_ZP(Pathing_FindRoute_FromVertices);
_log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z);
_log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z);
list<int> noderoute;
@@ -381,10 +381,10 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
for(uint32 i = 0 ; i < Head.PathNodeCount; ++i)
{
if((ABS(Start.x - PathNodes[i].v.x) <= CandidateNodeRangeXY) &&
(ABS(Start.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) &&
(ABS(Start.z - PathNodes[i].v.z) <= CandidateNodeRangeZ))
(ABS(Start.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) &&
(ABS(Start.z - PathNodes[i].v.z) <= CandidateNodeRangeZ))
{
TempNode.id = i;
TempNode.id = i;
TempNode.Distance = VertexDistanceNoRoot(Start, PathNodes[i].v);
SortedByDistance.push_back(TempNode);
@@ -420,10 +420,10 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
for(uint32 i = 0 ; i < Head.PathNodeCount; ++i)
{
if((ABS(End.x - PathNodes[i].v.x) <= CandidateNodeRangeXY) &&
(ABS(End.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) &&
(ABS(End.z - PathNodes[i].v.z) <= CandidateNodeRangeZ))
(ABS(End.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) &&
(ABS(End.z - PathNodes[i].v.z) <= CandidateNodeRangeZ))
{
TempNode.id = i;
TempNode.id = i;
TempNode.Distance = VertexDistanceNoRoot(End, PathNodes[i].v);
SortedByDistance.push_back(TempNode);
}
@@ -479,7 +479,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
break;
if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Second)].v, 1.0f, nullptr, nullptr)
&& zone->pathing->NoHazards(Start, PathNodes[(*Second)].v))
&& zone->pathing->NoHazards(Start, PathNodes[(*Second)].v))
{
noderoute.erase(First);
@@ -512,7 +512,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
break;
if(!zone->zonemap->LineIntersectsZone(End, PathNodes[(*Second)].v, 1.0f, nullptr, nullptr)
&& zone->pathing->NoHazards(End, PathNodes[(*Second)].v))
&& zone->pathing->NoHazards(End, PathNodes[(*Second)].v))
{
noderoute.erase(First);
@@ -673,7 +673,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
VERTEX From(GetX(), GetY(), GetZ());
VERTEX HeadPosition(From.x, From.y, From.z + (GetSize() < 6.0 ? 6 : GetSize()) * HEAD_POSITION);
VERTEX HeadPosition(From.x, From.y, From.z + (GetSize() < 6.0 ? 6 : GetSize()) * HEAD_POSITION);
VERTEX To(ToX, ToY, ToZ);
@@ -761,8 +761,8 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
if((RouteSize == 2)
|| ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck))
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check()))
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check()))
{
mlog(PATHING__DEBUG, " Checking distance to target.");
float Distance = VertexDistanceNoRoot(From, To);
@@ -770,7 +770,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
mlog(PATHING__DEBUG, " Distance between From and To (NoRoot) is %8.3f", Distance);
if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
{
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr, nullptr))
PathingLOSState = HaveLOS;
@@ -836,7 +836,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
mlog(PATHING__DEBUG, " Now moving to node %i", NextNode);
return zone->pathing->GetPathNodeCoordinates(NextNode);
return zone->pathing->GetPathNodeCoordinates(NextNode);
}
else
{
@@ -853,8 +853,8 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
int RouteSize = Route.size();
if((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck))
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check())
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check())
{
mlog(PATHING__DEBUG, " Checking distance to target.");
@@ -863,7 +863,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
mlog(PATHING__DEBUG, " Distance between From and To (NoRoot) is %8.3f", Distance);
if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
{
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr, nullptr))
PathingLOSState = HaveLOS;
@@ -901,7 +901,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
float Distance = VertexDistanceNoRoot(From, To);
if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
{
mlog(PATHING__DEBUG, " Checking for short LOS at distance %8.3f.", Distance);
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr, nullptr))
@@ -1053,7 +1053,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
float Distance = VertexDistanceNoRoot(From, To);
if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
{
mlog(PATHING__DEBUG, " Checking for long LOS at distance %8.3f.", Distance);
@@ -1121,10 +1121,10 @@ int PathManager::FindNearestPathNode(VERTEX Position)
for(uint32 i = 0 ; i < Head.PathNodeCount; ++i)
{
if((ABS(Position.x - PathNodes[i].v.x) <= CandidateNodeRangeXY) &&
(ABS(Position.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) &&
(ABS(Position.z - PathNodes[i].v.z) <= CandidateNodeRangeZ))
(ABS(Position.y - PathNodes[i].v.y) <= CandidateNodeRangeXY) &&
(ABS(Position.z - PathNodes[i].v.z) <= CandidateNodeRangeZ))
{
TempNode.id = i;
TempNode.id = i;
TempNode.Distance = VertexDistanceNoRoot(Position, PathNodes[i].v);
SortedByDistance.push_back(TempNode);
@@ -1193,7 +1193,7 @@ bool PathManager::NoHazardsAccurate(VERTEX From, VERTEX To)
stepx = (float)To.x - curx;
stepy = (float)To.y - cury;
stepz = (float)To.z - curz;
float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz);
float factor = sqrt(stepx*stepx + stepy*stepy + stepz*stepz);
stepx = (stepx/factor)*step_size;
stepy = (stepy/factor)*step_size;
stepz = (stepz/factor)*step_size;
@@ -1955,7 +1955,7 @@ void PathManager::DisconnectNodeToNode(int32 Node1, int32 Node2)
bool disconnect_a_from_b = false;
if(NodesConnected(a, b))
disconnect_a_from_b = true;
disconnect_a_from_b = true;
bool disconnect_b_from_a = false;
if(NodesConnected(b, a))
@@ -2295,3 +2295,4 @@ void PathManager::SortNodes()
safe_delete_array(PathNodes);
PathNodes = t_PathNodes;
}
+11 -13
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -18,11 +18,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -36,7 +36,7 @@
#include "PlayerCorpse.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -804,8 +804,6 @@ XS(boot_Corpse)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "GetCharID"), XS_Corpse_GetCharID, file, "$");
+29 -29
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -1696,7 +1696,7 @@ XS(XS_Client_TakeMoneyFromPP)
{
dXSARGS;
if (items < 2 || items > 3)
Perl_croak(aTHX_ "Usage: Client::TakeMoneyFromPP(THIS, copper, updateclient=false)");
Perl_croak(aTHX_ "Usage: Client::TakeMoneyFromPP(THIS, copper, updateclient=false)");
{
Client * THIS;
bool RETVAL;
@@ -3897,8 +3897,8 @@ XS(XS_Client_GetClientVersionBit)
if (items != 1)
Perl_croak(aTHX_ "Usage: Client::GetClientVersionBit(THIS)");
{
Client * THIS;
uint32 RETVAL;
Client * THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Client")) {
@@ -5453,8 +5453,8 @@ XS(XS_Client_GetItemInInventory)
Perl_croak(aTHX_ "Usage: Client::GetItemInInventory(THIS, slot_id)");
{
Client * THIS;
int16 slot_id = (int16)SvIV(ST(1));
ItemInst *RETVAL = nullptr;
int16 slot_id = (int16)SvIV(ST(1));
ItemInst *RETVAL = nullptr;
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -5465,8 +5465,8 @@ XS(XS_Client_GetItemInInventory)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetInv().GetItem(slot_id);
ST(0) = sv_newmortal();
RETVAL = THIS->GetInv().GetItem(slot_id);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL);
}
XSRETURN(1);
@@ -5480,9 +5480,9 @@ XS(XS_Client_SetCustomItemData)
Perl_croak(aTHX_ "Usage: Client::SetCustomItemData(THIS, slot_id, identifier, value)");
{
Client * THIS;
int16 slot_id = (int16)SvIV(ST(1));
Const_char* identifier = SvPV_nolen(ST(2));
Const_char* value = SvPV_nolen(ST(3));
int16 slot_id = (int16)SvIV(ST(1));
Const_char* identifier = SvPV_nolen(ST(2));
Const_char* value = SvPV_nolen(ST(3));
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -5493,7 +5493,7 @@ XS(XS_Client_SetCustomItemData)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->GetInv().SetCustomItemData(THIS->CharacterID(), slot_id, std::string(identifier), std::string(value));
THIS->GetInv().SetCustomItemData(THIS->CharacterID(), slot_id, std::string(identifier), std::string(value));
}
XSRETURN_EMPTY;
}
@@ -5506,9 +5506,9 @@ XS(XS_Client_GetCustomItemData)
Perl_croak(aTHX_ "Usage: Client::GetCustomItemData(THIS, slot_id, identifier)");
{
Client * THIS;
int16 slot_id = (int16)SvIV(ST(1));
Const_char* identifier = SvPV_nolen(ST(2));
Const_char * RETVAL;
int16 slot_id = (int16)SvIV(ST(1));
Const_char* identifier = SvPV_nolen(ST(2));
Const_char * RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Client")) {
@@ -5520,9 +5520,9 @@ XS(XS_Client_GetCustomItemData)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
std::string ret_val = THIS->GetInv().GetCustomItemData(slot_id, std::string(identifier));
RETVAL = ret_val.c_str();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
std::string ret_val = THIS->GetInv().GetCustomItemData(slot_id, std::string(identifier));
RETVAL = ret_val.c_str();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
}
XSRETURN(1);
}
+13 -15
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -36,7 +36,7 @@
#include "doors.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -737,8 +737,6 @@ XS(boot_Doors)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "GetID"),XS_Doors_GetID, file, "$");
newXSproto(strcpy(buf, "SetModelName"),XS_Doors_SetModelName, file, "$$");
+13 -13
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -37,7 +37,7 @@
#include "entity.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
+13 -15
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -36,7 +36,7 @@
#include "groups.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -632,8 +632,6 @@ XS(boot_Group)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$");
+5 -4
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2009 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2009 EQEMu Development Team (http://eqemulator.net)
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
@@ -9,11 +9,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -139,3 +139,4 @@ XS(boot_HateEntry)
}
#endif //EMBPERL_XS_CLASSES
+31 -33
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -18,11 +18,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -40,7 +40,7 @@ typedef const char Const_char;
#include "client.h"
#include "../common/spdat.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -5872,9 +5872,9 @@ XS(XS_Mob_NPCSpecialAttacks)
{
Mob * THIS;
char* parse = (char *)SvPV_nolen(ST(1));
int permtag = (int)SvIV(ST(2));
bool reset = items == 4 ? (bool)SvTRUE(ST(3)) : true;
bool remove = items == 5 ? (bool)SvTRUE(ST(4)) : false;
int permtag = (int)SvIV(ST(2));
bool reset = items == 4 ? (bool)SvTRUE(ST(3)) : true;
bool remove = items == 5 ? (bool)SvTRUE(ST(4)) : false;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -6792,7 +6792,7 @@ XS(XS_Mob_ProjectileAnim)
{
dXSARGS;
if (items < 3 || items > 8)
Perl_croak(aTHX_ "Usage: Mob::ProjectileAnim(THIS, mob, item_id, IsArrow?, speed, angle, tilt, arc)");
Perl_croak(aTHX_ "Usage: Mob::ProjectileAnim(THIS, mob, item_id, IsArrow?, speed, angle, tilt, arc)");
{
Mob * THIS;
@@ -7407,7 +7407,7 @@ XS(XS_Mob_DoKnockback)
Perl_croak(aTHX_ "Usage: Mob::DoKnockback(THIS, caster, pushback, pushup)");
{
Mob * THIS;
Mob * caster;
Mob * caster;
uint32 pushback = (uint16)SvUV(ST(2));
uint32 pushup = (uint16)SvUV(ST(2));
@@ -7477,7 +7477,7 @@ XS(XS_Mob_SetRunning)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetRunning(value);
THIS->SetRunning(value);
}
XSRETURN_EMPTY;
}
@@ -7502,7 +7502,7 @@ XS(XS_Mob_IsRunning)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsRunning();
RETVAL = THIS->IsRunning();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
@@ -7518,7 +7518,7 @@ XS(XS_Mob_SetBodyType)
{
Mob * THIS;
int32 type = (int32)SvIV(ST(1));
bool overwrite_orig = false;
bool overwrite_orig = false;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -7529,11 +7529,11 @@ XS(XS_Mob_SetBodyType)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if(items == 3) {
overwrite_orig = (bool)SvTRUE(ST(2));
}
if(items == 3) {
overwrite_orig = (bool)SvTRUE(ST(2));
}
THIS->SetBodyType((bodyType)type, overwrite_orig);
THIS->SetBodyType((bodyType)type, overwrite_orig);
}
XSRETURN_EMPTY;
}
@@ -7584,7 +7584,7 @@ XS(XS_Mob_SetLD)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SendAppearancePacket(AT_Linkdead, value);
THIS->SendAppearancePacket(AT_Linkdead, value);
}
XSRETURN_EMPTY;
}
@@ -7735,7 +7735,7 @@ XS(XS_Mob_SetAllowBeneficial)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetAllowBeneficial(value);
THIS->SetAllowBeneficial(value);
}
XSRETURN_EMPTY;
}
@@ -7811,7 +7811,7 @@ XS(XS_Mob_ModVulnerability)
Perl_croak(aTHX_ "Usage: Mob::ModVulnerability(THIS, resist, value)");
{
Mob * THIS;
uint8 resist = (uint8)SvIV(ST(1));
uint8 resist = (uint8)SvIV(ST(1));
int16 value = (int16)SvIV(ST(2));
if (sv_derived_from(ST(0), "Mob")) {
@@ -7902,8 +7902,8 @@ XS(XS_Mob_DoArcheryAttackDmg)
{
Mob * THIS;
Mob* target;
ItemInst* RangeWeapon = nullptr;
ItemInst* Ammo = nullptr;
ItemInst* RangeWeapon = nullptr;
ItemInst* Ammo = nullptr;
uint16 weapon_damage = (uint16)SvIV(ST(4));
int16 chance_mod = (int16)SvIV(ST(5));
int16 focus = (int16)SvIV(ST(6));
@@ -7940,7 +7940,7 @@ XS(XS_Mob_DoThrowingAttackDmg)
{
Mob * THIS;
Mob* target;
ItemInst* RangeWeapon = nullptr;
ItemInst* RangeWeapon = nullptr;
Item_Struct* item = nullptr;
uint16 weapon_damage = (uint16)SvIV(ST(4));
int16 chance_mod = (int16)SvIV(ST(5));
@@ -7988,7 +7988,7 @@ XS(XS_Mob_SetDisableMelee)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetDisableMelee(value);
THIS->SetDisableMelee(value);
}
XSRETURN_EMPTY;
}
@@ -8086,8 +8086,6 @@ XS(boot_Mob)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "IsClient"), XS_Mob_IsClient, file, "$");
@@ -8351,7 +8349,7 @@ XS(boot_Mob)
newXSproto(strcpy(buf, "SetDeltas"), XS_Mob_SetDeltas, file, "$$$$$");
newXSproto(strcpy(buf, "SetLD"), XS_Mob_SetLD, file, "$$");
newXSproto(strcpy(buf, "SetTargetDestSteps"), XS_Mob_SetTargetDestSteps, file, "$$");
newXSproto(strcpy(buf, "SetTargetable"), XS_Mob_SetTargetable, file, "$$");
newXSproto(strcpy(buf, "SetTargetable"), XS_Mob_SetTargetable, file, "$$");
newXSproto(strcpy(buf, "MakeTempPet"), XS_Mob_MakeTempPet, file, "$$;$$$$");
newXSproto(strcpy(buf, "ModSkillDmgTaken"), XS_Mob_ModSkillDmgTaken, file, "$$$");
newXSproto(strcpy(buf, "GetModSkillDmgTaken"), XS_Mob_GetModSkillDmgTaken, file, "$$");
+15 -17
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -38,7 +38,7 @@ typedef const char Const_char;
#include "npc.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -852,8 +852,8 @@ XS(XS_NPC_GetMinDMG)
if (items != 1)
Perl_croak(aTHX_ "Usage: NPC::GetMinDMG(THIS)");
{
NPC * THIS;
uint32 RETVAL;
NPC * THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "NPC")) {
@@ -2154,8 +2154,6 @@ XS(boot_NPC)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "SignalNPC"), XS_NPC_SignalNPC, file, "$$");
+11 -13
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -18,11 +18,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -36,7 +36,7 @@
#include "object.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -927,8 +927,6 @@ XS(boot_Object)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "Depop"),XS_Object_Depop, file, "$");
newXSproto(strcpy(buf, "Repop"),XS_Object_Repop, file, "$");
+16 -16
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -36,7 +36,7 @@
#include "perlpacket.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -47,9 +47,9 @@ XS(XS_PerlPacket_new)
if (items < 1 || items > 3)
Perl_croak(aTHX_ "Usage: PerlPacket::new(CLASS, opcode= \"OP_Unknown\", len= 0)");
{
char *CLASS = (char *)SvPV_nolen(ST(0));
PerlPacket *RETVAL;
const char *opcode;
char *CLASS = (char *)SvPV_nolen(ST(0));
PerlPacket *RETVAL;
const char *opcode;
uint32 len;
if (items < 2)
+12 -12
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -7,13 +7,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -201,7 +201,7 @@ XS(XS_QuestItem_GetAugment)
Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, augment_id)");
{
ItemInst* THIS;
int16 slot_id = (int16)SvIV(ST(1));
int16 slot_id = (int16)SvIV(ST(1));
ItemInst* RETVAL;
if (sv_derived_from(ST(0), "QuestItem")) {
@@ -213,8 +213,8 @@ XS(XS_QuestItem_GetAugment)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetAugment(slot_id);
ST(0) = sv_newmortal();
RETVAL = THIS->GetAugment(slot_id);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL);
}
XSRETURN(1);
@@ -240,7 +240,7 @@ XS(XS_QuestItem_GetID)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->ID;
RETVAL = THIS->GetItem()->ID;
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
@@ -272,8 +272,8 @@ XS(boot_QuestItem)
newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$");
newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$");
newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$");
newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$");
newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$");
newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$");
newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$");
XSRETURN_YES;
}
+13 -15
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by ExtUtils::ParseXS version 2.18 from the
* contents of raids.h.xs. Do not edit this file, edit raids.h.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by ExtUtils::ParseXS version 2.18 from the
* contents of raids.h.xs. Do not edit this file, edit raids.h.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -37,7 +37,7 @@
#include "raids.h"
#include "client.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -593,8 +593,6 @@ XS(boot_Raid)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$");
+13 -17
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <stdlib.h>
@@ -137,12 +137,10 @@ void PerlPacket::SetString(uint32 pos, char *str) {
#pragma pack(1)
struct EQ1319 {
int32 part13:13,
part19:19;
int32 part13:13, part19:19;
};
struct EQ1913 {
int32 part19:19,
part13:13;
int32 part19:19, part13:13;
};
#pragma pack()
@@ -191,5 +189,3 @@ float PerlPacket::GetFloat(uint32 pos) {
return(*p);
}
+11 -14
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef PERLPACKET_H
#define PERLPACKET_H
@@ -62,7 +62,4 @@ protected:
unsigned char *packet;
};
#endif
+185 -185
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
@@ -159,7 +159,7 @@ void PerlXSParser::SendCommands(const char * pkgprefix, const char *event, uint3
perl->dosub(std::string(pkgprefix).append("::").append(event).c_str());
#ifdef EMBPERL_XS_CLASSES
std::string eval_str = (std::string)"$" + (std::string)pkgprefix + (std::string)"::client = undef;";
std::string eval_str = (std::string)"$" + (std::string)pkgprefix + (std::string)"::client = undef;";
eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::npc = undef;";
eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::questitem = undef;";
eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::entity_list = undef;";
@@ -277,8 +277,8 @@ XS(XS__echo); // prototype to pass -Wmissing-prototypes
XS(XS__echo) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: echo(id#, str)");
if (items != 2)
Perl_croak(aTHX_ "Usage: echo(id#, str)");
quest_manager.echo(SvUV(ST(0)), SvPV_nolen(ST(1)));
@@ -471,7 +471,7 @@ XS(XS__setstat)
XSRETURN_EMPTY;
}
XS(XS__incstat); //old setstat command aza
XS(XS__incstat); //old setstat command aza
XS(XS__incstat)
{
dXSARGS;
@@ -1878,79 +1878,79 @@ XS(XS__clear_zone_flag)
XS(XS__summonburriedplayercorpse);
XS(XS__summonburriedplayercorpse)
{
dXSARGS;
if (items != 5)
Perl_croak(aTHX_ "Usage: summonburriedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)");
dXSARGS;
if (items != 5)
Perl_croak(aTHX_ "Usage: summonburriedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)");
bool RETVAL;
uint32 char_id = (int)SvIV(ST(0));
float dest_x = (float)SvIV(ST(1));
float dest_y = (float)SvIV(ST(2));
float dest_z = (float)SvIV(ST(3));
float dest_heading = (float)SvIV(ST(4));
bool RETVAL;
uint32 char_id = (int)SvIV(ST(0));
float dest_x = (float)SvIV(ST(1));
float dest_y = (float)SvIV(ST(2));
float dest_z = (float)SvIV(ST(3));
float dest_heading = (float)SvIV(ST(4));
RETVAL = quest_manager.summonburriedplayercorpse(char_id, dest_x, dest_y, dest_z, dest_heading);
RETVAL = quest_manager.summonburriedplayercorpse(char_id, dest_x, dest_y, dest_z, dest_heading);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
XSRETURN(1);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
XSRETURN(1);
}
XS(XS__summonallplayercorpses);
XS(XS__summonallplayercorpses)
{
dXSARGS;
if (items != 5)
Perl_croak(aTHX_ "Usage: summonallplayercorpses(char_id,dest_x,dest_y,dest_z,dest_heading)");
dXSARGS;
if (items != 5)
Perl_croak(aTHX_ "Usage: summonallplayercorpses(char_id,dest_x,dest_y,dest_z,dest_heading)");
bool RETVAL;
uint32 char_id = (int)SvIV(ST(0));
float dest_x = (float)SvIV(ST(1));
float dest_y = (float)SvIV(ST(2));
float dest_z = (float)SvIV(ST(3));
float dest_heading = (float)SvIV(ST(4));
bool RETVAL;
uint32 char_id = (int)SvIV(ST(0));
float dest_x = (float)SvIV(ST(1));
float dest_y = (float)SvIV(ST(2));
float dest_z = (float)SvIV(ST(3));
float dest_heading = (float)SvIV(ST(4));
RETVAL = quest_manager.summonallplayercorpses(char_id, dest_x, dest_y, dest_z, dest_heading);
RETVAL = quest_manager.summonallplayercorpses(char_id, dest_x, dest_y, dest_z, dest_heading);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
XSRETURN(1);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
XSRETURN(1);
}
XS(XS__getplayerburriedcorpsecount);
XS(XS__getplayerburriedcorpsecount)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: getplayerburriedcorpsecount(char_id)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: getplayerburriedcorpsecount(char_id)");
uint32 RETVAL;
dXSTARG;
uint32 RETVAL;
dXSTARG;
uint32 char_id = (int)SvIV(ST(0));
uint32 char_id = (int)SvIV(ST(0));
RETVAL = quest_manager.getplayerburriedcorpsecount(char_id);
XSprePUSH; PUSHu((IV)RETVAL);
RETVAL = quest_manager.getplayerburriedcorpsecount(char_id);
XSprePUSH; PUSHu((IV)RETVAL);
XSRETURN(1);
XSRETURN(1);
}
XS(XS__buryplayercorpse);
XS(XS__buryplayercorpse)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: buryplayercorpse(char_id)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: buryplayercorpse(char_id)");
uint32 RETVAL;
dXSTARG;
uint32 RETVAL;
dXSTARG;
uint32 char_id = (int)SvIV(ST(0));
uint32 char_id = (int)SvIV(ST(0));
RETVAL = quest_manager.buryplayercorpse(char_id);
XSprePUSH; PUSHu((IV)RETVAL);
RETVAL = quest_manager.buryplayercorpse(char_id);
XSprePUSH; PUSHu((IV)RETVAL);
XSRETURN(1);
XSRETURN(1);
}
XS(XS__forcedooropen);
@@ -2022,14 +2022,14 @@ XS(XS__toggledoorstate)
XS(XS__isdooropen);
XS(XS__isdooropen)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: isdooropen(doorid)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: isdooropen(doorid)");
bool RETVAL;
dXSTARG;
bool RETVAL;
dXSTARG;
uint32 doorid = (int)SvIV(ST(0));
uint32 doorid = (int)SvIV(ST(0));
RETVAL = quest_manager.isdooropen(doorid);
XSprePUSH; PUSHu((IV)RETVAL);
@@ -2210,9 +2210,9 @@ XS(XS__npcfeature)
XS(XS__createbotcount);
XS(XS__createbotcount)
{
dXSARGS;
int RETVAL;
dXSTARG;
dXSARGS;
int RETVAL;
dXSTARG;
RETVAL = quest_manager.createbotcount();
XSprePUSH; PUSHi((IV)RETVAL);
@@ -2223,9 +2223,9 @@ XS(XS__createbotcount)
XS(XS__spawnbotcount);
XS(XS__spawnbotcount)
{
dXSARGS;
int RETVAL;
dXSTARG;
dXSARGS;
int RETVAL;
dXSTARG;
RETVAL = quest_manager.spawnbotcount();
XSprePUSH; PUSHi((IV)RETVAL);
@@ -2236,9 +2236,9 @@ XS(XS__spawnbotcount)
XS(XS__botquest);
XS(XS__botquest)
{
dXSARGS;
bool RETVAL;
dXSTARG;
dXSARGS;
bool RETVAL;
dXSTARG;
RETVAL = quest_manager.botquest();
XSprePUSH; PUSHu((IV)RETVAL);
@@ -2338,7 +2338,7 @@ XS(XS__istaskenabled);
XS(XS__istaskenabled)
{
dXSARGS;
bool RETVAL;
bool RETVAL;
dXSTARG;
if(items == 1) {
@@ -2356,7 +2356,7 @@ XS(XS__istaskactive);
XS(XS__istaskactive)
{
dXSARGS;
bool RETVAL;
bool RETVAL;
dXSTARG;
if(items == 1) {
@@ -2374,7 +2374,7 @@ XS(XS__istaskactivityactive);
XS(XS__istaskactivityactive)
{
dXSARGS;
bool RETVAL;
bool RETVAL;
dXSTARG;
if(items == 2) {
@@ -2393,7 +2393,7 @@ XS(XS__gettaskactivitydonecount);
XS(XS__gettaskactivitydonecount)
{
dXSARGS;
uint32 RETVAL;
uint32 RETVAL;
dXSTARG;
if(items == 2) {
@@ -2495,7 +2495,7 @@ XS(XS__tasktimeleft);
XS(XS__tasktimeleft)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2514,7 +2514,7 @@ XS(XS__istaskcompleted);
XS(XS__istaskcompleted)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2533,7 +2533,7 @@ XS(XS__enabledtaskcount);
XS(XS__enabledtaskcount)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2552,7 +2552,7 @@ XS(XS__firsttaskinset);
XS(XS__firsttaskinset)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2571,7 +2571,7 @@ XS(XS__lasttaskinset);
XS(XS__lasttaskinset)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2590,7 +2590,7 @@ XS(XS__nexttaskinset);
XS(XS__nexttaskinset)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 2) {
@@ -2609,7 +2609,7 @@ XS(XS__activespeaktask);
XS(XS__activespeaktask)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 0) {
@@ -2627,7 +2627,7 @@ XS(XS__activespeakactivity);
XS(XS__activespeakactivity)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2646,7 +2646,7 @@ XS(XS__activetasksinset);
XS(XS__activetasksinset)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2665,7 +2665,7 @@ XS(XS__completedtasksinset);
XS(XS__completedtasksinset)
{
dXSARGS;
int RETVAL;
int RETVAL;
dXSTARG;
if(items == 1) {
@@ -2685,7 +2685,7 @@ XS(XS__istaskappropriate);
XS(XS__istaskappropriate)
{
dXSARGS;
bool RETVAL;
bool RETVAL;
dXSTARG;
if(items == 1) {
@@ -2702,13 +2702,13 @@ XS(XS__istaskappropriate)
XS(XS__popup); // prototype to pass -Wmissing-prototypes
XS(XS__popup) {
dXSARGS;
dXSARGS;
int popupid = 0;
int buttons = 0;
int duration = 0;
if((items < 2) || (items > 5))
Perl_croak(aTHX_ "Usage: popup(windowtitle, text, popupid, buttons, duration)");
Perl_croak(aTHX_ "Usage: popup(windowtitle, text, popupid, buttons, duration)");
if(items >= 3)
popupid = (int)SvIV(ST(2));
@@ -2719,9 +2719,9 @@ XS(XS__istaskappropriate)
if(items == 5)
duration = (int)SvIV(ST(4));
quest_manager.popup(SvPV_nolen(ST(0)), SvPV_nolen(ST(1)), popupid, buttons, duration);
quest_manager.popup(SvPV_nolen(ST(0)), SvPV_nolen(ST(1)), popupid, buttons, duration);
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
XS(XS__clearspawntimers);
XS(XS__clearspawntimers)
@@ -3089,11 +3089,11 @@ XS(XS__saylink) {
Const_char * RETVAL;
char text[250];
char text2[250];
bool silent = false;
bool silent = false;
strcpy(text,(char *)SvPV_nolen(ST(0)));
if(items >= 2) {
silent = ((int)SvIV(ST(1))) == 0 ? false : true;
}
if(items >= 2) {
silent = ((int)SvIV(ST(1))) == 0 ? false : true;
}
if (items == 3)
strcpy(text2,(char *)SvPV_nolen(ST(2)));
else
@@ -3137,12 +3137,12 @@ XS(XS__SetRunning)
XS(XS__IsRunning);
XS(XS__IsRunning)
{
dXSARGS;
if (items >= 1)
Perl_croak(aTHX_ "Usage: IsRunning()");
dXSARGS;
if (items >= 1)
Perl_croak(aTHX_ "Usage: IsRunning()");
bool RETVAL;
dXSTARG;
bool RETVAL;
dXSTARG;
RETVAL = quest_manager.IsRunning();
@@ -3154,14 +3154,14 @@ XS(XS__IsRunning)
XS(XS__IsEffectInSpell);
XS(XS__IsEffectInSpell)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: IsEffectInSpell(spell_id, effect_id)");
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: IsEffectInSpell(spell_id, effect_id)");
uint32 spell_id = (uint32)SvUV(ST(0));
uint32 effect_id = (uint32)SvUV(ST(1));
bool RETVAL;
dXSTARG;
bool RETVAL;
dXSTARG;
RETVAL = IsEffectInSpell(spell_id, effect_id);
@@ -3173,13 +3173,13 @@ XS(XS__IsEffectInSpell)
XS(XS__IsBeneficialSpell);
XS(XS__IsBeneficialSpell)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: IsBeneficialSpell(spell_id)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: IsBeneficialSpell(spell_id)");
uint32 spell_id = (uint32)SvUV(ST(0));
bool RETVAL;
dXSTARG;
bool RETVAL;
dXSTARG;
RETVAL = BeneficialSpell(spell_id);
@@ -3191,13 +3191,13 @@ XS(XS__IsBeneficialSpell)
XS(XS__GetSpellResistType);
XS(XS__GetSpellResistType)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetSpellResistType(spell_id)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetSpellResistType(spell_id)");
uint32 spell_id = (uint32)SvUV(ST(0));
int32 spell_val = 0;
dXSTARG;
dXSTARG;
spell_val = GetSpellResistType(spell_id);
XSRETURN_UV(spell_val);
@@ -3206,13 +3206,13 @@ XS(XS__GetSpellResistType)
XS(XS__GetSpellTargetType);
XS(XS__GetSpellTargetType)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetSpellTargetType(spell_id)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetSpellTargetType(spell_id)");
uint32 spell_id = (uint32)SvUV(ST(0));
int32 spell_val = 0;
dXSTARG;
dXSTARG;
spell_val = GetSpellTargetType(spell_id);
XSRETURN_UV(spell_val);
@@ -3243,54 +3243,54 @@ XS(XS_FactionValue) {
XS(XS__enabletitle);
XS(XS__enabletitle)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: enabletitle(titleset)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: enabletitle(titleset)");
int titleset = (int)SvIV(ST(0));
int titleset = (int)SvIV(ST(0));
quest_manager.enabletitle(titleset);
quest_manager.enabletitle(titleset);
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
XS(XS__checktitle);
XS(XS__checktitle)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: checktitle(titleset)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: checktitle(titleset)");
bool RETVAL;
int titleset = (int)SvIV(ST(0));
bool RETVAL;
int titleset = (int)SvIV(ST(0));
RETVAL = quest_manager.checktitle(titleset);
RETVAL = quest_manager.checktitle(titleset);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
XSRETURN(1);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
XSRETURN(1);
}
XS(XS__removetitle);
XS(XS__removetitle)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: removetitle(titleset)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: removetitle(titleset)");
int titleset = (int)SvIV(ST(0));
int titleset = (int)SvIV(ST(0));
quest_manager.removetitle(titleset);
quest_manager.removetitle(titleset);
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
XS(XS__wearchange);
XS(XS__wearchange)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: wearchange(slot, texture)");
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: wearchange(slot, texture)");
uint8 slot = (int)SvUV(ST(0));
uint16 texture = (int)SvUV(ST(1));
@@ -3320,72 +3320,72 @@ XS(XS__voicetell)
XS(XS__LearnRecipe);
XS(XS__LearnRecipe)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: LearnRecipe(recipe_id)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: LearnRecipe(recipe_id)");
uint32 recipe_id = (uint32)SvIV(ST(0));
uint32 recipe_id = (uint32)SvIV(ST(0));
quest_manager.LearnRecipe(recipe_id);
quest_manager.LearnRecipe(recipe_id);
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
XS(XS__SendMail);
XS(XS__SendMail)
{
dXSARGS;
if (items != 4)
Perl_croak(aTHX_ "Usage: SendMail(to, from, subject, message)");
dXSARGS;
if (items != 4)
Perl_croak(aTHX_ "Usage: SendMail(to, from, subject, message)");
char *to = (char *)SvPV_nolen(ST(0));
char *from = (char *)SvPV_nolen(ST(1));
char *subject = (char *)SvPV_nolen(ST(2));
char *message = (char *)SvPV_nolen(ST(3));
char *to = (char *)SvPV_nolen(ST(0));
char *from = (char *)SvPV_nolen(ST(1));
char *subject = (char *)SvPV_nolen(ST(2));
char *message = (char *)SvPV_nolen(ST(3));
quest_manager.SendMail(to, from, subject, message);
quest_manager.SendMail(to, from, subject, message);
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
XS(XS__GetZoneID);
XS(XS__GetZoneID)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetZoneID(zone)");
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetZoneID(zone)");
char *zone = (char *)SvPV_nolen(ST(0));
int32 id = quest_manager.GetZoneID(zone);
char *zone = (char *)SvPV_nolen(ST(0));
int32 id = quest_manager.GetZoneID(zone);
XSRETURN_IV(id);
XSRETURN_IV(id);
}
XS(XS__GetZoneLongName);
XS(XS__GetZoneLongName)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetZoneLongName(zone)");
dXSTARG;
char *zone = (char *)SvPV_nolen(ST(0));
Const_char* RETVAL = quest_manager.GetZoneLongName(zone);
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetZoneLongName(zone)");
dXSTARG;
char *zone = (char *)SvPV_nolen(ST(0));
Const_char* RETVAL = quest_manager.GetZoneLongName(zone);
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
XSRETURN(1);
}
XS(XS__GetTimeSeconds);
XS(XS__GetTimeSeconds)
{
dXSARGS;
if (items != 0)
Perl_croak(aTHX_ "Usage: GetTimeSeconds()");
dXSARGS;
if (items != 0)
Perl_croak(aTHX_ "Usage: GetTimeSeconds()");
uint32 seconds = 0;
dXSTARG;
dXSTARG;
seconds = Timer::GetTimeSeconds();
seconds = Timer::GetTimeSeconds();
XSRETURN_UV(seconds);
}
@@ -3570,7 +3570,7 @@ EXTERN_C XS(boot_quest)
newXS(strcpy(buf, "addloot"), XS__addloot, file);
newXS(strcpy(buf, "zone"), XS__zone, file);
newXS(strcpy(buf, "settimer"), XS__settimer, file);
newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file);
newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file);
newXS(strcpy(buf, "stoptimer"), XS__stoptimer, file);
newXS(strcpy(buf, "stopalltimers"), XS__stopalltimers, file);
newXS(strcpy(buf, "emote"), XS__emote, file);
@@ -3742,14 +3742,14 @@ EXTERN_C XS(boot_quest)
newXS(strcpy(buf, "removetitle"), XS__removetitle, file);
newXS(strcpy(buf, "wearchange"), XS__wearchange, file);
newXS(strcpy(buf, "voicetell"), XS__voicetell, file);
newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file);
newXS(strcpy(buf, "SendMail"), XS__SendMail, file);
newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file);
newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file);
newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file);
newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file);
newXS(strcpy(buf, "SendMail"), XS__SendMail, file);
newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file);
newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file);
newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file);
newXS(strcpy(buf, "handleturnin"), XS__handleturnin, file);
newXS(strcpy(buf, "completehandin"), XS__completehandin, file);
newXS(strcpy(buf, "resethandin"), XS__resethandin, file);
newXS(strcpy(buf, "completehandin"), XS__completehandin, file);
newXS(strcpy(buf, "resethandin"), XS__resethandin, file);
newXS(strcpy(buf, "clearhandin"), XS__clearhandin, file);
newXS(strcpy(buf, "crosszonesignalclientbycharid"), XS__crosszonesignalclientbycharid, file);
newXS(strcpy(buf, "crosszonesignalclientbyname"), XS__crosszonesignalclientbyname, file);
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
//extends the perl parser to use C methods
+17 -17
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <stdlib.h>
@@ -219,7 +219,7 @@ void PetitionList::UpdatePetition(Petition* pet) {
void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 affected_rows = 0;
uint8 checkedout = 0;
if (wpet->CheckedOut()) checkedout = 0;
@@ -234,7 +234,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) {
void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 affected_rows = 0;
uint8 checkedout = 0;
if (wpet->CheckedOut()) checkedout = 1;
@@ -251,7 +251,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) {
void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 affected_rows = 0;
uint8 checkedout = 0;
if (wpet->CheckedOut())
@@ -278,9 +278,9 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
void ZoneDatabase::RefreshPetitionsFromDB()
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
Petition* newpet;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, accountname, lastgm, petitiontext, zone, urgency, charclass, charrace, charlevel, checkouts, unavailables, ischeckedout, senttime, gmtext from petitions order by petid"), errbuf, &result))
{
+24 -24
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef PETITIONS_H
#define PETITIONS_H
@@ -40,14 +40,14 @@ public:
uint32 GetCharRace() { return charrace; }
uint32 GetCharClass() { return charclass; }
uint32 GetUrgency() { return urgency; }
//char* GetZone() { return this->zone; }
//char* GetZone() { return this->zone; }
uint32 GetZone() { return this->zone; }
char* GetCharName() { return charname; }
char* GetAccountName() { return accountname; }
char* GetLastGM() { return lastgm; }
char* GetCharName() { return charname; }
char* GetAccountName() { return accountname; }
char* GetLastGM() { return lastgm; }
time_t GetSentTime() { return senttime; }
char* GetPetitionText() { return petitiontext; }
char* GetGMText() { return gmtext; }
char* GetPetitionText() { return petitiontext; }
char* GetGMText() { return gmtext; }
bool CheckedOut() { return ischeckedout; }
@@ -75,12 +75,12 @@ public:
protected:
uint32 petid;
char charname[64];
char accountname[32];
char lastgm[64];
char petitiontext[1024];
char gmtext[1024];
//char zone[32];
char charname[64];
char accountname[32];
char lastgm[64];
char petitiontext[1024];
char gmtext[1024];
//char zone[32];
uint32 zone;
uint32 urgency; // 0 = green, 1 = yellow, 2 = red
uint32 charclass;
@@ -112,7 +112,7 @@ public:
private:
LinkedList<Petition*> list;
uint32 last_insert_id;
Mutex PList_Mutex;
Mutex PList_Mutex;
};
#endif
+22 -22
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/spdat.h"
@@ -445,10 +445,10 @@ bool ZoneDatabase::GetPetEntry(const char *pet_type, PetRecord *into) {
bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetRecord *into) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 querylen = 0;
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL_RES *result;
MYSQL_ROW row;
if (petpower <= 0) {
querylen = MakeAnyLenString(&query,
@@ -480,7 +480,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
mysql_free_result(result);
}
else {
LogFile->write(EQEMuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query, errbuf);
safe_delete_array(query);
}
return(false);
@@ -579,7 +579,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) {
buffs[i].ticsremaining = pet_buffs[i].duration;
buffs[i].casterlevel = pet_buffs[i].level;
buffs[i].casterid = 0;
buffs[i].counters = pet_buffs[i].counters;
buffs[i].counters = pet_buffs[i].counters;
buffs[i].numhits = spells[pet_buffs[i].spellid].numhits;
}
else {
@@ -649,14 +649,14 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
// are loaded after that, up to a max depth of 5. (Arbitrary limit
// so we don't go into an endless loop if the DB data is cyclic for
// some reason.)
// A slot will only get an item put in it if it is empty. That way
// A slot will only get an item put in it if it is empty. That way
// an equipmentset can overload a slot for the set(s) it includes.
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
uint32 querylen = 0;
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL_RES *result;
MYSQL_ROW row;
int depth = 0;
int32 curset = equipmentset;
int32 nextset = -1;
@@ -697,7 +697,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
mysql_free_result(result);
}
else {
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf);
safe_delete_array(query);
}
curset = nextset;
@@ -713,7 +713,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
}
else
{
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf);
LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query, errbuf);
safe_delete_array(query);
return false;
}
+1 -14
View File
@@ -44,21 +44,8 @@ protected:
eStandingPetOrder pStandingPetOrder;
bool taunting;
Timer taunt_timer; //for pet taunting
Timer taunt_timer; //for pet taunting
};*/
#endif
+81 -76
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
/*
@@ -109,12 +109,12 @@ void QuestManager::Process() {
//make sure the mob is still in zone.
if(entity_list.IsMobInZone(cur->mob)){
if(cur->mob->IsNPC()) {
parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0);
parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0);
}
else {
//this is inheriently unsafe if we ever make it so more than npc/client start timers
parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0);
}
//this is inheriently unsafe if we ever make it so more than npc/client start timers
parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0);
}
//we MUST reset our iterator since the quest could have removed/added any
//number of timers... worst case we have to check a bunch of timers twice
@@ -204,7 +204,7 @@ void QuestManager::ClearAllTimers() {
//quest perl functions
void QuestManager::echo(int colour, const char *str) {
entity_list.MessageClose(initiator, false, 200, colour, str);
entity_list.MessageClose(initiator, false, 200, colour, str);
}
void QuestManager::say(const char *str) {
@@ -213,12 +213,12 @@ void QuestManager::say(const char *str) {
return;
}
else {
if(RuleB(NPC, EnableNPCQuestJournal) && initiator) {
owner->QuestJournalledSay(initiator, str);
}
else {
owner->Say(str);
}
if(RuleB(NPC, EnableNPCQuestJournal) && initiator) {
owner->QuestJournalledSay(initiator, str);
}
else {
owner->Say(str);
}
}
}
@@ -558,7 +558,7 @@ void QuestManager::shout2(const char *str) {
void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint32 to_guilddbid, uint32 to_minstatus) {
if(send_to_world)
worldserver.SendEmoteMessage(0, to_guilddbid, to_minstatus, color, "%s", str);
worldserver.SendEmoteMessage(0, to_guilddbid, to_minstatus, color, "%s", str);
else
entity_list.MessageStatus(to_guilddbid, to_minstatus, color, "%s", str);
}
@@ -797,21 +797,21 @@ void QuestManager::surname(const char *name) {
}
void QuestManager::permaclass(int class_id) {
//Makes the client the class specified
//Makes the client the class specified
initiator->SetBaseClass(class_id);
initiator->Save(2);
initiator->Kick();
}
void QuestManager::permarace(int race_id) {
//Makes the client the race specified
//Makes the client the race specified
initiator->SetBaseRace(race_id);
initiator->Save(2);
initiator->Kick();
}
void QuestManager::permagender(int gender_id) {
//Makes the client the gender specified
//Makes the client the gender specified
initiator->SetBaseGender(gender_id);
initiator->Save(2);
initiator->Kick();
@@ -837,9 +837,9 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
( RuleB(Spells, UseCHAScribeHack) && spells[curspell].effectid[EFFECT_COUNT - 1] != 10 )
)
{
if (book_slot == -1) //no more book slots
if (book_slot == -1) //no more book slots
break;
if(!IsDiscipline(curspell) && !initiator->HasSpellScribed(curspell)) { //isn't a discipline & we don't already have it scribed
if(!IsDiscipline(curspell) && !initiator->HasSpellScribed(curspell)) { //isn't a discipline & we don't already have it scribed
if (SpellGlobalRule) {
// Bool to see if the character has the required QGlobal to scribe it if one exists in the Spell_Globals table
SpellGlobalCheckResult = initiator->SpellGlobalCheck(curspell, Char_ID);
@@ -855,7 +855,7 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
}
}
}
return count; //how many spells were scribed successfully
return count; //how many spells were scribed successfully
}
uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) {
@@ -906,7 +906,7 @@ uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) {
} //if we get to this point, there's already a discipline in this slot, so we skip it
}
}
}
}
}
return count; //how many disciplines were learned successfully
}
@@ -980,7 +980,7 @@ void QuestManager::pvp(const char *mode) {
void QuestManager::movepc(int zone_id, float x, float y, float z, float heading) {
if (initiator && initiator->IsClient())
initiator->MovePC(zone_id, x, y, z, heading);
initiator->MovePC(zone_id, x, y, z, heading);
}
void QuestManager::gmmove(float x, float y, float z) {
@@ -989,23 +989,26 @@ void QuestManager::gmmove(float x, float y, float z) {
}
void QuestManager::movegrp(int zoneid, float x, float y, float z) {
if (initiator && initiator->IsClient())
if (initiator && initiator->IsClient())
{
Group *g = entity_list.GetGroupByClient(initiator);
if (g != nullptr){
if (g != nullptr) {
g->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f);
} else {
}
else {
Raid *r = entity_list.GetRaidByClient(initiator);
if (r != nullptr){
if (r != nullptr) {
uint32 gid = r->GetGroup(initiator);
if (gid >= 0 && gid < 12) {
r->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f, gid);
} else {
}
else {
initiator->MovePC(zoneid, x, y, z, 0.0f);
}
} else {
}
else {
initiator->MovePC(zoneid, x, y, z, 0.0f);
}
}
}
}
}
@@ -1195,7 +1198,7 @@ void QuestManager::setglobal(const char *varname, const char *newvalue, int opti
/* options value determines the availability of global variables to NPCs when a quest begins
------------------------------------------------------------------
value npcid player zone
value npcid player zone
------------------------------------------------------------------
0 this this this
1 all this this
@@ -1206,7 +1209,7 @@ void QuestManager::setglobal(const char *varname, const char *newvalue, int opti
6 this all all
7 all all all
*/
if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved
if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved
{
qgCharid=initiator->CharacterID();
}
@@ -1332,7 +1335,7 @@ void QuestManager::delglobal(const char *varname) {
int qgZoneid=zone->GetZoneID();
int qgCharid=0;
int qgNpcid=owner->GetNPCTypeID();
if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved
if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved
{
qgCharid=initiator->CharacterID();
}
@@ -1342,10 +1345,10 @@ void QuestManager::delglobal(const char *varname) {
qgCharid=-qgNpcid; // make char id negative npc id as a fudge
}
if (!database.RunQuery(query,
MakeAnyLenString(&query,
"DELETE FROM quest_globals WHERE name='%s'"
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
MakeAnyLenString(&query,
"DELETE FROM quest_globals WHERE name='%s'"
" && (npcid=0 || npcid=%i) && (charid=0 || charid=%i) && (zoneid=%i || zoneid=0)",
varname,qgNpcid,qgCharid,qgZoneid),errbuf))
{
cerr << "delglobal error deleting " << varname << " : " << errbuf << endl;
}
@@ -1887,7 +1890,8 @@ void QuestManager::npcfeature(char *feature, int setting)
void QuestManager::popup(char *title, char *text, uint32 popupid, uint32 buttons, uint32 Duration)
{
if(initiator) initiator->SendPopupToClient(title, text, popupid, buttons, Duration);
if(initiator)
initiator->SendPopupToClient(title, text, popupid, buttons, Duration);
}
#ifdef BOTS
@@ -2127,7 +2131,7 @@ bool QuestManager::istaskappropriate(int task) {
return false;
}
void QuestManager::clearspawntimers() {
if(zone) {
if(zone) {
//TODO: Dec 19, 2008, replace with code updated for current spawn timers.
LinkedListIterator<Spawn2*> iterator(zone->spawn2_list);
iterator.Reset();
@@ -2159,7 +2163,7 @@ int QuestManager::getlevel(uint8 type)
else if(type == 1)
{
Group *g = entity_list.GetGroupByClient(initiator);
if (g != nullptr)
if (g != nullptr)
return (g->GetAvgLevel());
else
return 0;
@@ -2167,7 +2171,7 @@ int QuestManager::getlevel(uint8 type)
else if(type == 2)
{
Raid *r = entity_list.GetRaidByClient(initiator);
if (r != nullptr)
if (r != nullptr)
return (r->GetAvgLevel());
else
return 0;
@@ -2304,7 +2308,7 @@ void QuestManager::UpdateSpawnTimer(uint32 id, uint32 newTime)
}
}
// used to set the number of an item in the selected merchant's temp item list. Defaults to zero if no quantity is specified.
// used to set the number of an item in the selected merchant's temp item list. Defaults to zero if no quantity is specified.
void QuestManager::MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity) {
Mob* merchant = entity_list.GetMobByNpcTypeID(NPCid);
@@ -2475,9 +2479,9 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) {
MYSQL_ROW row;
int sayid = 0;
int sz = strlen(Phrase);
char *escaped_string = new char[sz * 2];
database.DoEscapeString(escaped_string, Phrase, sz);
int sz = strlen(Phrase);
char *escaped_string = new char[sz * 2];
database.DoEscapeString(escaped_string, Phrase, sz);
// Query for an existing phrase and id in the saylink table
if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT `id` FROM `saylink` WHERE `phrase` = '%s'", escaped_string),errbuf,&result))
@@ -2490,7 +2494,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) {
}
mysql_free_result(result);
}
else // Add a new saylink entry to the database and query it again for the new sayid number
else // Add a new saylink entry to the database and query it again for the new sayid number
{
safe_delete_array(query);
@@ -2516,7 +2520,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, char* LinkName) {
}
}
safe_delete_array(query);
safe_delete_array(escaped_string);
safe_delete_array(escaped_string);
if(silent)
sayid = sayid + 750000;
@@ -2631,17 +2635,17 @@ uint8 QuestManager::FactionValue()
}
void QuestManager::enabletitle(int titleset) {
initiator->EnableTitle(titleset);
initiator->EnableTitle(titleset);
}
bool QuestManager::checktitle(int titleset) {
return initiator->CheckTitle(titleset);
return initiator->CheckTitle(titleset);
}
void QuestManager::removetitle(int titleset) {
initiator->RemoveTitle(titleset);
initiator->RemoveTitle(titleset);
}
void QuestManager::wearchange(uint8 slot, uint16 texture)
@@ -2684,24 +2688,24 @@ void QuestManager::voicetell(char *str, int macronum, int racenum, int gendernum
}
void QuestManager::LearnRecipe(uint32 recipe_id) {
if(!initiator)
return;
initiator->LearnRecipe(recipe_id);
if(!initiator)
return;
initiator->LearnRecipe(recipe_id);
}
void QuestManager::SendMail(const char *to, const char *from, const char *subject, const char *message) {
if(to == nullptr || from == nullptr || subject == nullptr || message == nullptr) {
return;
}
if(to == nullptr || from == nullptr || subject == nullptr || message == nullptr) {
return;
}
uint32 message_len = strlen(message) + 1;
ServerPacket* pack = new ServerPacket(ServerOP_UCSMailMessage, sizeof(ServerMailMessageHeader_Struct) + message_len);
uint32 message_len = strlen(message) + 1;
ServerPacket* pack = new ServerPacket(ServerOP_UCSMailMessage, sizeof(ServerMailMessageHeader_Struct) + message_len);
ServerMailMessageHeader_Struct* mail = (ServerMailMessageHeader_Struct*) pack->pBuffer;
strn0cpy(mail->to, to, 64);
strn0cpy(mail->from, from, 64);
strn0cpy(mail->subject, subject, 128);
strcpy(mail->message, message);
strn0cpy(mail->to, to, 64);
strn0cpy(mail->from, from, 64);
strn0cpy(mail->subject, subject, 128);
strcpy(mail->message, message);
worldserver.SendPacket(pack);
safe_delete(pack);
@@ -2715,16 +2719,16 @@ uint16 QuestManager::CreateDoor(const char* model, float x, float y, float z, fl
}
int32 QuestManager::GetZoneID(const char *zone) {
return static_cast<int32>(database.GetZoneID(zone));
return static_cast<int32>(database.GetZoneID(zone));
}
const char* QuestManager::GetZoneLongName(const char *zone) {
char *long_name;
database.GetZoneLongName(zone, &long_name);
std::string ln = long_name;
safe_delete_array(long_name);
char *long_name;
database.GetZoneLongName(zone, &long_name);
std::string ln = long_name;
safe_delete_array(long_name);
return ln.c_str();
return ln.c_str();
}
bool QuestManager::TurnInItem(uint32 itm, int charges)
@@ -2793,3 +2797,4 @@ void QuestManager::CrossZoneMessagePlayerByName(uint32 Type, const char *CharNam
worldserver.SendPacket(pack);
safe_delete(pack);
}
+25 -25
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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 free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
This program is 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.
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
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
*/
#ifndef __QUEST_MANAGER_H__
#define __QUEST_MANAGER_H__
@@ -62,7 +62,7 @@ public:
void addloot(int item_id, int charges = 0, bool equipitem = true);
void Zone(const char *zone_name);
void settimer(const char *timer_name, int seconds);
void settimerMS(const char *timer_name, int milliseconds);
void settimerMS(const char *timer_name, int milliseconds);
void stoptimer(const char *timer_name);
void stopalltimers();
void emote(const char *str);
@@ -80,7 +80,7 @@ public:
// void cumflag();
// void flagnpc(uint32 flag_num, uint8 flag_value);
// void flagcheck(uint32 flag_to_check, uint32 flag_to_set);
// bool isflagset(int flag_num);
// bool isflagset(int flag_num);
void changedeity(int diety_id);
void exp(int amt);
void level(int newlevel);
@@ -190,15 +190,15 @@ public:
int activetasksinset(int taskset);
int completedtasksinset(int taskset);
bool istaskappropriate(int task);
void clearspawntimers();
void clearspawntimers();
void ze(int type, const char *str);
void we(int type, const char *str);
int getlevel(uint8 type);
int collectitems(uint32 item_id, bool remove);
int collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove);
void enabletitle(int titleset);
bool checktitle(int titlecheck);
void removetitle(int titlecheck);
int getlevel(uint8 type);
int collectitems(uint32 item_id, bool remove);
int collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove);
void enabletitle(int titleset);
bool checktitle(int titlecheck);
void removetitle(int titlecheck);
uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000);
uint16 CreateGroundObjectFromModel(const char* model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0);
@@ -227,11 +227,11 @@ public:
uint8 FactionValue();
void wearchange(uint8 slot, uint16 texture);
void voicetell(char *str, int macronum, int racenum, int gendernum);
void LearnRecipe(uint32 recipe_id);
void SendMail(const char *to, const char *from, const char *subject, const char *message);
void LearnRecipe(uint32 recipe_id);
void SendMail(const char *to, const char *from, const char *subject, const char *message);
uint16 CreateDoor( const char* model, float x, float y, float z, float heading, uint8 opentype, uint16 size);
int32 GetZoneID(const char *zone);
const char *GetZoneLongName(const char *zone);
int32 GetZoneID(const char *zone);
const char *GetZoneLongName(const char *zone);
//not in here because it retains perl types
//thing ChooseRandom(array_of_things)
@@ -275,7 +275,7 @@ protected:
class QuestTimer {
public:
inline QuestTimer(int duration, Mob *_mob, string _name) : mob(_mob), name(_name), Timer_(duration) { Timer_.Start(duration, false); }
Mob* mob;
Mob* mob;
string name;
Timer Timer_;
};
+27 -27
View File
@@ -1,25 +1,25 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/*
Code for generell handling of priority Queues.
Implemention of queues from "Algoritms in C" by Robert Sedgewick.
Copyright Monty Program KB.
By monty.
Code for generell handling of priority Queues.
Implemention of queues from "Algoritms in C" by Robert Sedgewick.
Copyright Monty Program KB.
By monty.
*/
#ifndef _queues_h
@@ -29,13 +29,13 @@ extern "C" {
#endif
typedef struct st_queue {
byte **root;
void *first_cmp_arg;
uint elements;
uint max_elements;
uint offset_to_key; /* compare is done on element+offset */
int max_at_top; /* Set if queue_top gives max */
int (*compare)(void *, byte *,byte *);
byte **root;
void *first_cmp_arg;
uint elements;
uint max_elements;
uint offset_to_key; /* compare is done on element+offset */
int max_at_top; /* Set if queue_top gives max */
int (*compare)(void *, byte *,byte *);
} QUEUE;
#define queue_top(queue) ((queue)->root[1])
@@ -44,11 +44,11 @@ typedef struct st_queue {
#define queue_replaced(queue) _downheap(queue,1)
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, int (*compare)(void *,byte *, byte *),
void *first_cmp_arg);
pbool max_at_top, int (*compare)(void *,byte *, byte *),
void *first_cmp_arg);
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, int (*compare)(void *,byte *, byte *),
void *first_cmp_arg);
pbool max_at_top, int (*compare)(void *,byte *, byte *),
void *first_cmp_arg);
void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,byte *element);
byte *queue_remove(QUEUE *queue,uint idx);

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