mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Remove trailing whitespace
This commit is contained in:
+13
-13
@@ -468,7 +468,7 @@ void Client::HandleAAAction(aaID activate) {
|
||||
case aaActionEscape:
|
||||
Escape();
|
||||
break;
|
||||
|
||||
|
||||
// Don't think this code is used any longer for Bestial Alignment as the AA has a spell_id and no nonspell_action.
|
||||
case aaActionBeastialAlignment:
|
||||
switch(GetBaseRace()) {
|
||||
@@ -1961,21 +1961,21 @@ void Client::DurationRampage(uint32 duration)
|
||||
}
|
||||
}
|
||||
|
||||
AA_SwarmPetInfo::AA_SwarmPetInfo()
|
||||
{
|
||||
target = 0;
|
||||
owner_id = 0;
|
||||
AA_SwarmPetInfo::AA_SwarmPetInfo()
|
||||
{
|
||||
target = 0;
|
||||
owner_id = 0;
|
||||
duration = nullptr;
|
||||
}
|
||||
|
||||
AA_SwarmPetInfo::~AA_SwarmPetInfo()
|
||||
{
|
||||
target = 0;
|
||||
owner_id = 0;
|
||||
safe_delete(duration);
|
||||
AA_SwarmPetInfo::~AA_SwarmPetInfo()
|
||||
{
|
||||
target = 0;
|
||||
owner_id = 0;
|
||||
safe_delete(duration);
|
||||
}
|
||||
|
||||
Mob *AA_SwarmPetInfo::GetOwner()
|
||||
{
|
||||
return entity_list.GetMobID(owner_id);
|
||||
Mob *AA_SwarmPetInfo::GetOwner()
|
||||
{
|
||||
return entity_list.GetMobID(owner_id);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ enum { //leadership AA indexes
|
||||
groupAAFindPathToPC,
|
||||
groupAAHealthOfTargetsTarget,
|
||||
groupAA15,
|
||||
|
||||
|
||||
raidAAMarkNPC, //0x10, things assume this is the first raid ability
|
||||
raidAANPCHealth,
|
||||
raidAADelegateMainAssist,
|
||||
@@ -91,13 +91,13 @@ enum { //leadership AA indexes
|
||||
raidAAHealthOfTargetsTarget,
|
||||
raidAA14,
|
||||
raidAA15,
|
||||
|
||||
|
||||
_maxLeaderAA //=32
|
||||
};
|
||||
|
||||
#define MAX_LEADERSHIP_TIERS 6
|
||||
//each progression should be 0 terminated to mark it as the end.
|
||||
static const uint8 LeadershipAACosts[_maxLeaderAA][MAX_LEADERSHIP_TIERS] = {
|
||||
static const uint8 LeadershipAACosts[_maxLeaderAA][MAX_LEADERSHIP_TIERS] = {
|
||||
{ 1, 2, 3, 0, 0, 0 }, //groupAAMarkNPC
|
||||
{ 2, 0, 0, 0, 0, 0 }, //groupAANPCHealth
|
||||
{ 4, 0, 0, 0, 0, 0 }, //groupAADelegateMainAssist - Have seen DelegateMainAssist come in with two different codes.
|
||||
@@ -114,7 +114,7 @@ static const uint8 LeadershipAACosts[_maxLeaderAA][MAX_LEADERSHIP_TIERS] = {
|
||||
{ 4, 0, 0, 0, 0, 0 }, //groupAAFindPathToPC
|
||||
{ 7, 0, 0, 0, 0, 0 }, //groupAAHealthOfTargetsTarget
|
||||
{ 0, 0, 0, 0, 0, 0 }, //groupAA15
|
||||
|
||||
|
||||
{ 5, 6, 7, 0, 0, 0 }, //raidAAMarkNPC //0x10
|
||||
{ 4, 0, 0, 0, 0, 0 }, //raidAANPCHealth
|
||||
{ 6, 7, 8, 0, 0, 0 }, //raidAADelegateMainAssist
|
||||
@@ -151,16 +151,16 @@ typedef enum { //AA IDs
|
||||
aaInnateDiseaseProtection = 57, //works
|
||||
aaInnateRunSpeed = 62, //works
|
||||
aaInnateRegeneration = 65, //works
|
||||
aaInnateMetabolism = 68,
|
||||
aaInnateMetabolism = 68,
|
||||
aaInnateLungCapacity = 71, //handled by client
|
||||
aaFirstAid = 74, //untested
|
||||
aaHealingAdept = 77, //untested
|
||||
aaHealingGift = 80, //untested
|
||||
aaSpellCastingMastery = 83, //untested
|
||||
aaSpellCastingReinforcement = 86, //untested
|
||||
aaMentalClarity = 89,
|
||||
aaMentalClarity = 89,
|
||||
aaSpellCastingFury = 92, //untested
|
||||
aaChanellingFocus = 95,
|
||||
aaChanellingFocus = 95,
|
||||
aaSpellCastingSubtlety = 98, //untested
|
||||
aaSpellCastingExpertise = 101, //untested
|
||||
aaSpellCastingDeftness = 104, //untested
|
||||
@@ -181,18 +181,18 @@ typedef enum { //AA IDs
|
||||
aaQuickEvacuation = 137, //untested
|
||||
aaExodus = 140, //untested
|
||||
aaQuickDamage = 141, //untested
|
||||
aaEnhancedRoot = 144,
|
||||
aaEnhancedRoot = 144,
|
||||
aaDireCharm = 145, //untested
|
||||
aaCannibalization = 146, //DB
|
||||
aaQuickBuff = 147, //untested
|
||||
aaAlchemyMastery = 150,
|
||||
aaAlchemyMastery = 150,
|
||||
aaRabidBear = 153, //DB
|
||||
aaManaBurn = 154, //DB
|
||||
aaImprovedFamiliar = 155, //untested, implemented?
|
||||
aaNexusGate = 156, //DB
|
||||
aaUnknown54 = 157,
|
||||
aaPermanentIllusion = 158,
|
||||
aaJewelCraftMastery = 159,
|
||||
aaUnknown54 = 157,
|
||||
aaPermanentIllusion = 158,
|
||||
aaJewelCraftMastery = 159,
|
||||
aaGatherMana = 162, //DB
|
||||
aaMendCompanion = 163, //DB
|
||||
aaQuickSummoning = 164, //untested
|
||||
@@ -210,11 +210,11 @@ typedef enum { //AA IDs
|
||||
aaFleshToBone = 186, //DB
|
||||
aaCallToCorpse = 187, //DB
|
||||
aaDivineStun = 188, //DB
|
||||
aaImprovedLayOnHands = 189,
|
||||
aaSlayUndead = 190,
|
||||
aaImprovedLayOnHands = 189,
|
||||
aaSlayUndead = 190,
|
||||
aaActOfValor = 193, //DB
|
||||
aaHolySteed = 194, //DB
|
||||
aaFearless = 195,
|
||||
aaFearless = 195,
|
||||
aa2HandBash = 196, //works. handled by client?
|
||||
aaInnateCamouflage = 197, //DB
|
||||
aaAmbidexterity = 198, //untested
|
||||
@@ -224,24 +224,24 @@ typedef enum { //AA IDs
|
||||
aaUnholySteed = 206, //DB
|
||||
aaImprovedHarmTouch = 207, //untested
|
||||
aaLeechTouch = 208, //DB
|
||||
aaDeathPeace = 209,
|
||||
aaDeathPeace = 209,
|
||||
aaSoulAbrasion = 210, //untested
|
||||
aaInstrumentMastery = 213, //untested
|
||||
aaUnknown91 = 216, //not used
|
||||
aaUnknown92 = 219, //not used
|
||||
aaUnknown93 = 222, //not used
|
||||
aaJamFest = 225,
|
||||
aaJamFest = 225,
|
||||
aaUnknown95 = 228,
|
||||
aaSonicCall = 229,
|
||||
aaSonicCall = 229,
|
||||
aaCriticalMend = 230, //untested
|
||||
aaPurifyBody = 233, //DB
|
||||
aaChainCombo = 234,
|
||||
aaChainCombo = 234,
|
||||
aaRapidFeign = 237, //works
|
||||
aaReturnKick = 240,
|
||||
aaReturnKick = 240,
|
||||
aaEscape = 243, //DB
|
||||
aaPoisonMastery = 244,
|
||||
aaPoisonMastery = 244,
|
||||
aaDoubleRiposte = 247, //untested
|
||||
aaQuickHide = 250,
|
||||
aaQuickHide = 250,
|
||||
aaQuickThrow = 253, //corrected from dbstr_us.txt
|
||||
aaPurgePoison = 254, //DB
|
||||
aaFlurry = 255, //untested
|
||||
@@ -252,14 +252,14 @@ typedef enum { //AA IDs
|
||||
aaSpellCastingReinforcementMastery = 266, //untested
|
||||
aaSpellCastingFuryMastery = 267, //untested
|
||||
aaExtendedNotes = 270, //untested
|
||||
aaDragonPunch = 273,
|
||||
aaDragonPunch = 273,
|
||||
aaStrongRoot = 274, //DB
|
||||
aaSingingMastery = 275, //untested
|
||||
aaBodyAndMindRejuvenation = 278, //added
|
||||
aaPhysicalEnhancement = 279, //untested
|
||||
aaAdvTrapNegotiation = 280, //untested
|
||||
aaAcrobatics = 283, //untested
|
||||
aaScribbleNotes = 286,
|
||||
aaScribbleNotes = 286,
|
||||
aaChaoticStab = 287, //untested
|
||||
aaPetDiscipline = 288, //added
|
||||
aaHobbleofSpirits = 289, //DB
|
||||
@@ -315,45 +315,45 @@ typedef enum { //AA IDs
|
||||
aaSuspendedMinion = 526, //untested
|
||||
aaSpiritCall = 528, //DB
|
||||
aaCelestialRenewal = 531, //DB
|
||||
aaAllegiantFamiliar = 533,
|
||||
aaAllegiantFamiliar = 533,
|
||||
aaHandofPiety = 534, //DB
|
||||
aaMithanielsBinding = 537, //untested
|
||||
aaMendingoftheTranquil = 539,
|
||||
aaRagingFlurry = 542,
|
||||
aaGuardianoftheForest = 545, //DB
|
||||
aaMendingoftheTranquil = 539,
|
||||
aaRagingFlurry = 542,
|
||||
aaGuardianoftheForest = 545, //DB
|
||||
aaSpiritoftheWood = 548, //DB
|
||||
aaBestialFrenzy = 551, //untested
|
||||
aaHarmoniousAttack = 556, //untested
|
||||
aaKnightsAdvantage = 561,
|
||||
aaFerocity = 564,
|
||||
aaViscidRoots = 567,
|
||||
aaKnightsAdvantage = 561,
|
||||
aaFerocity = 564,
|
||||
aaViscidRoots = 567,
|
||||
aaSionachiesCrescendo = 568, //untested
|
||||
aaAyonaesTutelage = 571,
|
||||
aaFeignedMinion = 574,
|
||||
aaUnfailingDivinity = 577,
|
||||
aaAnimationEmpathy = 580, // Implemented
|
||||
aaRushtoJudgement = 583,
|
||||
aaLivingShield = 586,
|
||||
aaAyonaesTutelage = 571,
|
||||
aaFeignedMinion = 574,
|
||||
aaUnfailingDivinity = 577,
|
||||
aaAnimationEmpathy = 580, // Implemented
|
||||
aaRushtoJudgement = 583,
|
||||
aaLivingShield = 586,
|
||||
aaConsumptionoftheSoul = 589, //untested
|
||||
aaBoastfulBellow = 592, //DB
|
||||
aaFervrentBlessing = 593, //untested
|
||||
aaTouchoftheWicked = 596, //untested
|
||||
aaPunishingBlade = 599,
|
||||
aaSpeedoftheKnight = 602,
|
||||
aaShroudofStealth = 605,
|
||||
aaNimbleEvasion = 606,
|
||||
aaTechniqueofMasterWu = 611,
|
||||
aaPunishingBlade = 599,
|
||||
aaSpeedoftheKnight = 602,
|
||||
aaShroudofStealth = 605,
|
||||
aaNimbleEvasion = 606,
|
||||
aaTechniqueofMasterWu = 611,
|
||||
aaHostoftheElements = 616, //DB
|
||||
aaCallofXuzl = 619, //DB
|
||||
aaHastenedStealth = 622,
|
||||
aaIngenuity = 625,
|
||||
aaFleetofFoot = 628,
|
||||
aaFadingMemories = 630,
|
||||
aaTacticalMastery = 631,
|
||||
aaTheftofLife = 634,
|
||||
aaHastenedStealth = 622,
|
||||
aaIngenuity = 625,
|
||||
aaFleetofFoot = 628,
|
||||
aaFadingMemories = 630,
|
||||
aaTacticalMastery = 631,
|
||||
aaTheftofLife = 634,
|
||||
aaFuryofMagic = 637,
|
||||
aaFuryofMagicMastery2 = 640, //whats the difference?
|
||||
aaProjectIllusion = 643,
|
||||
aaProjectIllusion = 643,
|
||||
aaHeadshot = 644, //added
|
||||
aaEntrap = 645, //DB
|
||||
aaUnholyTouch = 646, //untested
|
||||
@@ -422,7 +422,7 @@ typedef enum { //AA IDs
|
||||
aaImmobilizingBash = 852,
|
||||
aaViciousSmash = 855,
|
||||
aaRadiantCure2 = 860, //whats the difference?
|
||||
aaPurification = 863,
|
||||
aaPurification = 863,
|
||||
aaPrecisionofthePathfinder = 864,
|
||||
aaCoatofThistles = 867,
|
||||
aaFlamingArrows = 872, //untested
|
||||
@@ -578,7 +578,7 @@ typedef enum { //AA IDs
|
||||
aaCripplingStrike2 = 1352, //whats the difference?
|
||||
aaStunningKick2 = 1353, //whats the difference?
|
||||
aaEyeGouge2 = 1358, //whats the difference?
|
||||
|
||||
|
||||
//Dragons of Norrath
|
||||
//good info here: http://www.eqthieves.com/exp-don-progression.htm and here: http://everquest.allakhazam.com/db/guides.html?guide=811
|
||||
aaGiftoftheDarkReign = 1361, //from dbstr_us.txt
|
||||
@@ -591,8 +591,8 @@ typedef enum { //AA IDs
|
||||
aaEmbraceoftheKeepers = 1368, //from dbstr_us.txt
|
||||
aaPoweroftheKeepers = 1369, //from dbstr_us.txt
|
||||
aaSanctityoftheKeepers = 1370, //from dbstr_us.txt
|
||||
|
||||
//Veteran AAs
|
||||
|
||||
//Veteran AAs
|
||||
aaLessonoftheDevoted = 1371, //from dbstr_us.txt
|
||||
aaInfusionoftheFaithful = 1372, //from dbstr_us.txt
|
||||
aaChaoticJester = 1373, //from dbstr_us.txt
|
||||
@@ -1076,7 +1076,7 @@ typedef enum { //AA IDs
|
||||
aaEchoingCries =1155,
|
||||
aaViciousFrenzy =1158,
|
||||
aaCrazedOnslaught =1163,
|
||||
aaFrenziedDefense2 =1166,//implemented as bonus
|
||||
aaFrenziedDefense2 =1166,//implemented as bonus
|
||||
aaOverwhelmingAttack =1172,
|
||||
aaFuriousRage =1175,
|
||||
aaBloodPact =1178,
|
||||
@@ -1500,7 +1500,7 @@ typedef enum { //AA IDs
|
||||
aaMassEnchantTemporite =7740,
|
||||
|
||||
aaLayonHandsRank16 =7866, //Duplicate ID with aaExtendedAstralProjection!
|
||||
|
||||
|
||||
aaHarmTouch =7800,//First 10 AA cost 0 per rank
|
||||
aaHarmToch2 =7810,//Next 6+ AA cost 3 +1inc per rank
|
||||
aaLayonHands =7850,//First 10 AA cost 0 per rank
|
||||
|
||||
+78
-78
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -64,15 +64,15 @@ Map* Map::LoadMapfile(const char* in_zonename, const char *directory) {
|
||||
char zBuf[64];
|
||||
char cWork[256];
|
||||
Map* ret = 0;
|
||||
|
||||
|
||||
//have to convert to lower because the short names im getting
|
||||
//are not all lower anymore, copy since strlwr edits the str.
|
||||
strn0cpy(zBuf, in_zonename, 64);
|
||||
|
||||
|
||||
if(directory == nullptr)
|
||||
directory = MAP_DIR;
|
||||
snprintf(cWork, 250, "%s/%s.map", directory, strlwr(zBuf));
|
||||
|
||||
|
||||
if ((fp = fopen( cWork, "rb" ))) {
|
||||
ret = new Map();
|
||||
if(ret != nullptr) {
|
||||
@@ -96,7 +96,7 @@ Map::Map() {
|
||||
_maxz = FLT_MIN;
|
||||
_maxx = FLT_MIN;
|
||||
_maxy = FLT_MIN;
|
||||
|
||||
|
||||
m_Faces = 0;
|
||||
m_Nodes = 0;
|
||||
m_FaceLists = 0;
|
||||
@@ -122,22 +122,22 @@ bool Map::loadMap(FILE *fp) {
|
||||
printf("Invalid map version 0x%lx\n", (unsigned long)head.version);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
printf("Map header: %lu faces, %u nodes, %lu facelists\n", (unsigned long)head.face_count, (unsigned int)head.node_count, (unsigned long)head.facelist_count);
|
||||
|
||||
m_Faces = head.face_count;
|
||||
m_Nodes = head.node_count;
|
||||
m_FaceLists = head.facelist_count;
|
||||
|
||||
|
||||
/* fread(&m_Vertex, 4, 1, fp);
|
||||
fread(&m_Faces , 4, 1, fp);*/
|
||||
// mFinalVertex = new VERTEX[m_Vertex];
|
||||
mFinalFaces = new FACE [m_Faces];
|
||||
mNodes = new NODE[m_Nodes];
|
||||
mFaceLists = new uint32[m_FaceLists];
|
||||
|
||||
|
||||
// fread(mFinalVertex, m_Vertex, sizeof(VERTEX), fp);
|
||||
|
||||
|
||||
//this was changed to this loop from the single read because valgrind was
|
||||
//hanging on this read otherwise... I dont pretend to understand it.
|
||||
#ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
|
||||
@@ -155,7 +155,7 @@ bool Map::loadMap(FILE *fp) {
|
||||
return(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
|
||||
for(r = 0; r < m_Nodes; r++) {
|
||||
if(fread(mNodes+r, sizeof(NODE), 1, fp) != 1) {
|
||||
@@ -169,7 +169,7 @@ bool Map::loadMap(FILE *fp) {
|
||||
return(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
|
||||
for(r = 0; r < m_FaceLists; r++) {
|
||||
if(fread(mFaceLists+r, sizeof(uint32), 1, fp) != 1) {
|
||||
@@ -183,8 +183,8 @@ bool Map::loadMap(FILE *fp) {
|
||||
return(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* mRoot = new NODE();
|
||||
RecLoadNode(mRoot, fp );*/
|
||||
|
||||
@@ -248,7 +248,7 @@ for(m = 0; m < _node->faces.count; m++) {
|
||||
FACE *c = &mFinalFaces[ *cfl ];
|
||||
printf(" %lu (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f)\n",
|
||||
*cfl, c->a.x, c->a.y, c->a.z,
|
||||
c->b.x, c->b.y, c->b.z,
|
||||
c->b.x, c->b.y, c->b.z,
|
||||
c->c.x, c->c.y, c->c.z);
|
||||
cfl++;
|
||||
}*/
|
||||
@@ -257,24 +257,24 @@ for(m = 0; m < _node->faces.count; m++) {
|
||||
}
|
||||
#ifdef DEBUG_SEEK
|
||||
printf(" Kids: %u, %u, %u, %u\n", _node->nodes[0], _node->nodes[1], _node->nodes[2], _node->nodes[3]);
|
||||
|
||||
|
||||
printf(" Contained In Box: (%.2f -> %.2f, %.2f -> %.2f)\n", _node->minx, _node->maxx, _node->miny, _node->maxy);
|
||||
|
||||
|
||||
/*printf(" Node found has children.\n");
|
||||
if(_node->node1 != nullptr) {
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
_node->node1->minx, _node->node1->maxx, _node->node1->miny, _node->node1->maxy);
|
||||
}
|
||||
if(_node->node2 != nullptr) {
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
_node->node2->minx, _node->node2->maxx, _node->node2->miny, _node->node2->maxy);
|
||||
}
|
||||
if(_node->node3 != nullptr) {
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
_node->node3->minx, _node->node3->maxx, _node->node3->miny, _node->node3->maxy);
|
||||
}
|
||||
if(_node->node4 != nullptr) {
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
printf("\tNode: (%.2f -> %.2f, %.2f -> %.2f)\n",
|
||||
_node->node4->minx, _node->node4->maxx, _node->node4->miny, _node->node4->maxy);
|
||||
}*/
|
||||
#endif
|
||||
@@ -334,8 +334,8 @@ int* Map::SeekFace( NodeRef node_r, float x, float y ) {
|
||||
if(!(_node->flags & nodeFinal)) {
|
||||
return(nullptr); //not a final node... could find the proper node...
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//printf("Seeking face for (%.2f, %.2f) with root 0x%x.\n", x, y, _node);
|
||||
float dx,dy;
|
||||
float nx,ny;
|
||||
@@ -346,19 +346,19 @@ int* Map::SeekFace( NodeRef node_r, float x, float y ) {
|
||||
const VERTEX &v1 = cf.a;
|
||||
const VERTEX &v2 = cf.b;
|
||||
const VERTEX &v3 = cf.c;
|
||||
|
||||
|
||||
dx = v2.x - v1.x; dy = v2.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;
|
||||
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;
|
||||
if( dx*ny - dy*nx >0.0f ) continue;
|
||||
|
||||
|
||||
*face++ = mFaceLists[_node->faces.offset + i];
|
||||
}
|
||||
*face = -1;
|
||||
@@ -388,7 +388,7 @@ bool Map::LineIntersectsZone(VERTEX start, VERTEX end, float step_mag, VERTEX *r
|
||||
curz = start.z;
|
||||
|
||||
VERTEX cur = start;
|
||||
|
||||
|
||||
stepx = end.x - start.x;
|
||||
stepy = end.y - start.y;
|
||||
stepz = end.z - start.z;
|
||||
@@ -421,7 +421,7 @@ bool Map::LineIntersectsZone(VERTEX start, VERTEX end, float step_mag, VERTEX *r
|
||||
stepx = (stepx/factor)*step_mag;
|
||||
stepy = (stepy/factor)*step_mag;
|
||||
stepz = (stepz/factor)*step_mag;
|
||||
|
||||
|
||||
cnode = SeekNode(GetRoot(), curx, cury);
|
||||
if(cnode != lnode)
|
||||
{
|
||||
@@ -432,7 +432,7 @@ bool Map::LineIntersectsZone(VERTEX start, VERTEX end, float step_mag, VERTEX *r
|
||||
|
||||
if(LineIntersectsNode(cnode, start, end, result, on))
|
||||
return(true);
|
||||
|
||||
|
||||
if(cnode == finalnode)
|
||||
return false;
|
||||
}
|
||||
@@ -472,12 +472,12 @@ bool Map::LineIntersectsNode( NodeRef node_r, VERTEX p1, VERTEX p2, VERTEX *resu
|
||||
if(!(_node->flags & nodeFinal)) {
|
||||
return(true); //not a final node... not sure best action
|
||||
}
|
||||
|
||||
|
||||
unsigned long i;
|
||||
|
||||
|
||||
PFACE cur;
|
||||
const uint32 *cfl = mFaceLists + _node->faces.offset;
|
||||
|
||||
|
||||
for(i = 0; i < _node->faces.count; i++) {
|
||||
if(*cfl > m_Faces)
|
||||
continue; //watch for invalid lists, they seem to happen
|
||||
@@ -514,14 +514,14 @@ float Map::FindBestZ( NodeRef node_r, VERTEX p1, VERTEX *result, FACE **on) cons
|
||||
if(!(_node->flags & nodeFinal)) {
|
||||
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.
|
||||
if(result == nullptr)
|
||||
result = &tmp_result;
|
||||
|
||||
|
||||
VERTEX p2(p1);
|
||||
p2.z = BEST_Z_INVALID;
|
||||
|
||||
|
||||
float best_z = BEST_Z_INVALID;
|
||||
int zAttempt;
|
||||
|
||||
@@ -531,7 +531,7 @@ float Map::FindBestZ( NodeRef node_r, VERTEX p1, VERTEX *result, FACE **on) cons
|
||||
|
||||
// If we don't find a bestZ on the first attempt, we try again from a position CurrentZ + 10 higher
|
||||
// This is in case the pathing between waypoints temporarily sends the NPC below ground level.
|
||||
//
|
||||
//
|
||||
for(zAttempt=1; zAttempt<=2; zAttempt++) {
|
||||
|
||||
const uint32 *cfl = mFaceLists + _node->faces.offset;
|
||||
@@ -549,7 +549,7 @@ printf("Start finding best Z...\n");
|
||||
#ifdef DEBUG_BEST_Z
|
||||
printf(" %lu (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f)\n",
|
||||
*cfl, cur->a.x, cur->a.y, cur->a.z,
|
||||
cur->b.x, cur->b.y, cur->b.z,
|
||||
cur->b.x, cur->b.y, cur->b.z,
|
||||
cur->c.x, cur->c.y, cur->c.z);
|
||||
printf("Found a z: %.2f\n", result->z);
|
||||
#endif
|
||||
@@ -579,14 +579,14 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
if( cface == nullptr ) {
|
||||
return(false); //cant intersect a face we dont have... i guess
|
||||
}
|
||||
|
||||
|
||||
const VERTEX &pa = cface->a;
|
||||
const VERTEX &pb = cface->b;
|
||||
const VERTEX &pc = cface->c;
|
||||
|
||||
|
||||
//quick bounding box checks
|
||||
float tbb;
|
||||
|
||||
|
||||
tbb = Vmin3(x, pa, pb, pc);
|
||||
if(p1.x < tbb && p2.x < tbb)
|
||||
return(false);
|
||||
@@ -596,7 +596,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
tbb = Vmin3(z, pa, pb, pc);
|
||||
if(p1.z < tbb && p2.z < tbb)
|
||||
return(false);
|
||||
|
||||
|
||||
tbb = Vmax3(x, pa, pb, pc);
|
||||
if(p1.x > tbb && p2.x > tbb)
|
||||
return(false);
|
||||
@@ -606,16 +606,16 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
tbb = Vmax3(z, pa, pb, pc);
|
||||
if(p1.z > tbb && p2.z > tbb)
|
||||
return(false);
|
||||
|
||||
|
||||
//begin attempt 2
|
||||
//#define RTOD 57.2957795 //radians to degrees constant.
|
||||
|
||||
float d;
|
||||
float denom,mu;
|
||||
VERTEX n, intersect;
|
||||
|
||||
|
||||
// FACE *thisface = &mFinalFaces[ _node->pfaces[ i ] ];
|
||||
|
||||
|
||||
VERTEX *p = &intersect;
|
||||
if(result != nullptr)
|
||||
p = result;
|
||||
@@ -635,14 +635,14 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
n.z = cface->nz;
|
||||
d = cface->nd;
|
||||
#endif
|
||||
|
||||
|
||||
//try inverting the normals...
|
||||
n.x = -n.x;
|
||||
n.y = -n.y;
|
||||
n.z = -n.z;
|
||||
d = - n.x * pa.x - n.y * pa.y - n.z * pa.z; //recalc
|
||||
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
@@ -676,7 +676,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
a1 = pa1.x*pa2.x + pa1.y*pa2.y + pa1.z*pa2.z;
|
||||
a2 = pa2.x*pa3.x + pa2.y*pa3.y + pa2.z*pa3.z;
|
||||
a3 = pa3.x*pa1.x + pa3.y*pa1.y + pa3.z*pa1.z;
|
||||
|
||||
|
||||
//holy hell these 3 acos are slow, we need to rewrite this...
|
||||
// total = (acos(a1) + acos(a2) + acos(a3));
|
||||
// if (ABS(total - 2*M_PI) > EPS)
|
||||
@@ -687,7 +687,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
return(true);
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
//yet another failed method, project triangle and point into
|
||||
//2 space based on largest component of the normal
|
||||
//and check the triangle there.
|
||||
@@ -704,7 +704,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
tz = -n.z;
|
||||
else
|
||||
tz = n.z;
|
||||
|
||||
|
||||
VERTEX pa2, pb2, pc2;
|
||||
if(tx < ty) {
|
||||
//keep x
|
||||
@@ -733,7 +733,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
pc2.x = pc.x; pc2.y = pc.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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))
|
||||
@@ -745,10 +745,10 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
|
||||
return ((b1 == b2) && (b2 == b3));
|
||||
*/
|
||||
|
||||
|
||||
/* //not working well, seems to block LOS a lot
|
||||
|
||||
//a new check based on barycentric coordinates, stolen from
|
||||
//a new check based on barycentric coordinates, stolen from
|
||||
//http://www.flipcode.com/cgi-bin/fcmsg.cgi?thread_show=7766
|
||||
float xcp, ycp, xab, yab, xac, yac;
|
||||
float divb;
|
||||
@@ -802,7 +802,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
|
||||
return(true);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Yet another method adapted from this code:
|
||||
Vec3 pa1 = pa - p;
|
||||
@@ -816,7 +816,7 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
if (d < 0) return false;
|
||||
return true;
|
||||
*/
|
||||
|
||||
|
||||
//in practice, this seems to actually take longer
|
||||
//than the arc cosine method above...
|
||||
n.x = -n.x;
|
||||
@@ -824,55 +824,55 @@ bool Map::LineIntersectsFace( PFACE cface, VERTEX p1, VERTEX p2, VERTEX *result)
|
||||
n.z = -n.z;
|
||||
VERTEX pa1,pa2,pa3, tmp;
|
||||
float t;
|
||||
|
||||
|
||||
//pa1 = pa - p
|
||||
pa1.x = pa.x - p->x;
|
||||
pa1.y = pa.y - p->y;
|
||||
pa1.z = pa.z - p->z;
|
||||
|
||||
|
||||
//pa2 = pb - p
|
||||
pa2.x = pb.x - p->x;
|
||||
pa2.y = pb.y - p->y;
|
||||
pa2.z = pb.z - p->z;
|
||||
|
||||
|
||||
//tmp = pa1 cross pa2
|
||||
tmp.x = pa1.y * pa2.z - pa1.z * pa2.y;
|
||||
tmp.y = pa1.z * pa2.x - pa1.x * pa2.z;
|
||||
tmp.z = pa1.x * pa2.y - pa1.y * pa2.x;
|
||||
|
||||
|
||||
//t = tmp dot n
|
||||
t = tmp.x * n.x + tmp.y * n.y + tmp.z * n.z;
|
||||
if(t < 0)
|
||||
return(false);
|
||||
//printf("t = %f\n", t);
|
||||
|
||||
|
||||
//pa3 = pb - p
|
||||
pa3.x = pc.x - p->x;
|
||||
pa3.y = pc.y - p->y;
|
||||
pa3.z = pc.z - p->z;
|
||||
|
||||
|
||||
//tmp = pa2 cross pa3
|
||||
tmp.x = pa2.y * pa3.z - pa2.z * pa3.y;
|
||||
tmp.y = pa2.z * pa3.x - pa2.x * pa3.z;
|
||||
tmp.z = pa2.x * pa3.y - pa2.y * pa3.x;
|
||||
|
||||
|
||||
//t = tmp dot n
|
||||
t = tmp.x * n.x + tmp.y * n.y + tmp.z * n.z;
|
||||
if(t < 0)
|
||||
return(false);
|
||||
//printf("t = %f\n", t);
|
||||
|
||||
|
||||
//tmp = pa3 cross pa1
|
||||
tmp.x = pa3.y * pa1.z - pa3.z * pa1.y;
|
||||
tmp.y = pa3.z * pa1.x - pa3.x * pa1.z;
|
||||
tmp.z = pa3.x * pa1.y - pa3.y * pa1.x;
|
||||
|
||||
|
||||
//t = tmp dot n
|
||||
t = tmp.x * n.x + tmp.y * n.y + tmp.z * n.z;
|
||||
if(t < 0)
|
||||
return(false);
|
||||
//printf("t = %f\n", t);
|
||||
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -890,7 +890,7 @@ bool Map::LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, V
|
||||
cur.x = start.x;
|
||||
cur.y = start.y;
|
||||
cur.z = start.z;
|
||||
|
||||
|
||||
step.x = end.x - start.x;
|
||||
step.y = end.y - start.y;
|
||||
step.z = end.z - start.z;
|
||||
@@ -914,7 +914,7 @@ bool Map::LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, V
|
||||
step.y = -0.001f;
|
||||
if (step.z < 0 && step.z > -0.001f)
|
||||
step.z = -0.001f;
|
||||
|
||||
|
||||
NodeRef cnode, lnode;
|
||||
lnode = 0;
|
||||
//while we are not past end
|
||||
@@ -926,7 +926,7 @@ bool Map::LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, V
|
||||
if (cnode == NODE_NONE)
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
VERTEX me;
|
||||
me.x = cur.x;
|
||||
me.y = cur.y;
|
||||
@@ -948,7 +948,7 @@ bool Map::LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, V
|
||||
}
|
||||
lnode = cnode;
|
||||
}
|
||||
|
||||
|
||||
//move 1 step
|
||||
if (cur.x != end.x)
|
||||
cur.x += step.x;
|
||||
@@ -956,7 +956,7 @@ bool Map::LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, V
|
||||
cur.y += step.y;
|
||||
if (cur.z != end.z)
|
||||
cur.z += step.z;
|
||||
|
||||
|
||||
//watch for end conditions
|
||||
if ( (cur.x > end.x && end.x >= start.x) || (cur.x < end.x && end.x <= start.x) || (step.x == 0) ) {
|
||||
cur.x = end.x;
|
||||
@@ -968,7 +968,7 @@ bool Map::LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, V
|
||||
cur.z = end.z;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//walked entire line and didnt run into anything...
|
||||
return(false);
|
||||
}
|
||||
@@ -980,19 +980,19 @@ float Map::FindClosestZ(VERTEX p ) const
|
||||
std::list<float> ZSet;
|
||||
|
||||
NodeRef NodeR = SeekNode(MAP_ROOT_NODE, p.x, p.y);
|
||||
|
||||
|
||||
if( NodeR == NODE_NONE || NodeR >= m_Nodes)
|
||||
return 0;
|
||||
|
||||
|
||||
PNODE CurrentNode = &mNodes[NodeR];
|
||||
|
||||
if(!(CurrentNode->flags & nodeFinal))
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
|
||||
VERTEX p1(p), p2(p), Result;
|
||||
|
||||
p1.z = 999999;
|
||||
|
||||
|
||||
p2.z = BEST_Z_INVALID;
|
||||
|
||||
const uint32 *CurrentFaceList = mFaceLists + CurrentNode->faces.offset;
|
||||
@@ -1006,7 +1006,7 @@ float Map::FindClosestZ(VERTEX p ) const
|
||||
|
||||
if(CurrentFace->nz > 0 && LineIntersectsFace(CurrentFace, p1, p2, &Result))
|
||||
ZSet.push_back(Result.z);
|
||||
|
||||
|
||||
CurrentFaceList++;
|
||||
|
||||
}
|
||||
|
||||
+180
-180
File diff suppressed because it is too large
Load Diff
+63
-63
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -42,10 +42,10 @@ extern EntityList entity_list;
|
||||
Object::Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst)
|
||||
: respawn_timer(0), decay_timer(300000)
|
||||
{
|
||||
|
||||
|
||||
user = nullptr;
|
||||
last_user = nullptr;
|
||||
|
||||
|
||||
// Initialize members
|
||||
m_id = id;
|
||||
m_type = type;
|
||||
@@ -62,7 +62,7 @@ Object::Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& object,
|
||||
decay_timer.Disable();
|
||||
}
|
||||
respawn_timer.Disable();
|
||||
|
||||
|
||||
// Set drop_id to zero - it will be set when added to zone with SetID()
|
||||
m_data.drop_id = 0;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ Object::Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& object,
|
||||
Object::Object(const ItemInst* inst, char* name,float max_x,float min_x,float max_y,float min_y,float z,float heading,uint32 respawntimer)
|
||||
: respawn_timer(respawntimer), decay_timer(300000)
|
||||
{
|
||||
|
||||
|
||||
user = nullptr;
|
||||
last_user = nullptr;
|
||||
m_max_x=max_x;
|
||||
@@ -94,7 +94,7 @@ Object::Object(const ItemInst* inst, char* name,float max_x,float min_x,float ma
|
||||
respawn_timer.Disable();
|
||||
strcpy(m_data.object_name, name);
|
||||
RandomSpawn(false);
|
||||
|
||||
|
||||
// Hardcoded portion for unknown members
|
||||
m_data.unknown024 = 0x7f001194;
|
||||
m_data.unknown076 = 0x0000d5fe;
|
||||
@@ -107,7 +107,7 @@ Object::Object(Client* client, const ItemInst* inst)
|
||||
{
|
||||
user = nullptr;
|
||||
last_user = nullptr;
|
||||
|
||||
|
||||
// Initialize members
|
||||
m_id = 0;
|
||||
m_inst = (inst) ? inst->Clone() : nullptr;
|
||||
@@ -122,7 +122,7 @@ Object::Object(Client* client, const ItemInst* inst)
|
||||
m_data.y = client->GetY();
|
||||
m_data.z = client->GetZ();
|
||||
m_data.zone_id = zone->GetZoneID();
|
||||
|
||||
|
||||
decay_timer.Start();
|
||||
respawn_timer.Disable();
|
||||
|
||||
@@ -130,7 +130,7 @@ Object::Object(Client* client, const ItemInst* inst)
|
||||
m_data.unknown024 = 0x7f001194;
|
||||
m_data.unknown076 = 0x0000d5fe;
|
||||
m_data.unknown084 = 0xFFFFFFFF;
|
||||
|
||||
|
||||
// Set object name
|
||||
if (inst) {
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
@@ -145,7 +145,7 @@ Object::Object(Client* client, const ItemInst* inst)
|
||||
if (len_copy > sizeof(DEFAULT_OBJECT_NAME_SUFFIX)) {
|
||||
len_copy = sizeof(DEFAULT_OBJECT_NAME_SUFFIX);
|
||||
}
|
||||
|
||||
|
||||
memcpy(&m_data.object_name[0], inst->GetItem()->IDFile, len_idfile);
|
||||
memcpy(&m_data.object_name[len_idfile], DEFAULT_OBJECT_NAME_SUFFIX, len_copy);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ Object::Object(const ItemInst *inst, float x, float y, float z, float heading, u
|
||||
{
|
||||
user = nullptr;
|
||||
last_user = nullptr;
|
||||
|
||||
|
||||
// Initialize members
|
||||
m_id = 0;
|
||||
m_inst = (inst) ? inst->Clone() : nullptr;
|
||||
@@ -176,7 +176,7 @@ Object::Object(const ItemInst *inst, float x, float y, float z, float heading, u
|
||||
m_data.y = y;
|
||||
m_data.z = z;
|
||||
m_data.zone_id = zone->GetZoneID();
|
||||
|
||||
|
||||
if (decay_time)
|
||||
decay_timer.Start();
|
||||
|
||||
@@ -186,7 +186,7 @@ Object::Object(const ItemInst *inst, float x, float y, float z, float heading, u
|
||||
m_data.unknown024 = 0x7f001194;
|
||||
m_data.unknown076 = 0x0000d5fe;
|
||||
m_data.unknown084 = 0xFFFFFFFF;
|
||||
|
||||
|
||||
// Set object name
|
||||
if (inst) {
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
@@ -201,7 +201,7 @@ Object::Object(const ItemInst *inst, float x, float y, float z, float heading, u
|
||||
if (len_copy > sizeof(DEFAULT_OBJECT_NAME_SUFFIX)) {
|
||||
len_copy = sizeof(DEFAULT_OBJECT_NAME_SUFFIX);
|
||||
}
|
||||
|
||||
|
||||
memcpy(&m_data.object_name[0], inst->GetItem()->IDFile, len_idfile);
|
||||
memcpy(&m_data.object_name[len_idfile], DEFAULT_OBJECT_NAME_SUFFIX, len_copy);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ Object::Object(const char *model, float x, float y, float z, float heading, uint
|
||||
last_user = nullptr;
|
||||
ItemInst* inst = nullptr;
|
||||
inst = new ItemInst(ItemUseWorldContainer);
|
||||
|
||||
|
||||
// Initialize members
|
||||
m_id = 0;
|
||||
m_inst = (inst) ? inst->Clone() : nullptr;
|
||||
@@ -263,7 +263,7 @@ void Object::SetID(uint16 set_id)
|
||||
{
|
||||
// Invoke base class
|
||||
Entity::SetID(set_id);
|
||||
|
||||
|
||||
// Store new id as drop_id
|
||||
m_data.drop_id = (uint32)this->GetID();
|
||||
}
|
||||
@@ -272,7 +272,7 @@ void Object::SetID(uint16 set_id)
|
||||
void Object::ResetState()
|
||||
{
|
||||
safe_delete(m_inst);
|
||||
|
||||
|
||||
m_id = 0;
|
||||
m_type = 0;
|
||||
m_icon = 0;
|
||||
@@ -289,7 +289,7 @@ bool Object::Save()
|
||||
// Doesn't yet exist, add now
|
||||
m_id = database.AddObject(m_type, m_icon, m_data, m_inst);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ uint16 Object::VarSave()
|
||||
else {
|
||||
// Doesn't yet exist, add now
|
||||
m_id = database.AddObject(m_type, m_icon, m_data, m_inst);
|
||||
}
|
||||
}
|
||||
return m_id;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ void Object::Delete(bool reset_state)
|
||||
if (m_id != 0) {
|
||||
database.DeleteObject(m_id);
|
||||
}
|
||||
|
||||
|
||||
if (reset_state) {
|
||||
ResetState();
|
||||
}
|
||||
@@ -325,7 +325,7 @@ void Object::PutItem(uint8 index, const ItemInst* inst)
|
||||
LogFile->write(EQEMuLog::Error, "Object::PutItem: Invalid index specified (%i)", index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (m_inst && m_inst->IsType(ItemClassContainer)) {
|
||||
if (inst) {
|
||||
m_inst->PutItem(index, *inst);
|
||||
@@ -369,7 +369,7 @@ void Object::DeleteItem(uint8 index)
|
||||
{
|
||||
if (m_inst && m_inst->IsType(ItemClassContainer)) {
|
||||
m_inst->DeleteItem(index);
|
||||
|
||||
|
||||
// This is _highly_ inefficient, but for now it will work: Save entire object to database
|
||||
Save();
|
||||
}
|
||||
@@ -379,14 +379,14 @@ void Object::DeleteItem(uint8 index)
|
||||
ItemInst* Object::PopItem(uint8 index)
|
||||
{
|
||||
ItemInst* inst = nullptr;
|
||||
|
||||
|
||||
if (m_inst && m_inst->IsType(ItemClassContainer)) {
|
||||
inst = m_inst->PopItem(index);
|
||||
|
||||
|
||||
// This is _highly_ inefficient, but for now it will work: Save entire object to database
|
||||
Save();
|
||||
}
|
||||
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ bool Object::Process(){
|
||||
database.DeleteObject(m_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(m_ground_spawn && respawn_timer.Check()){
|
||||
RandomSpawn(true);
|
||||
}
|
||||
@@ -432,11 +432,11 @@ bool Object::Process(){
|
||||
void Object::RandomSpawn(bool send_packet) {
|
||||
if(!m_ground_spawn)
|
||||
return;
|
||||
|
||||
|
||||
m_data.x = MakeRandomFloat(m_min_x, m_max_x);
|
||||
m_data.y = MakeRandomFloat(m_min_y, m_max_y);
|
||||
respawn_timer.Disable();
|
||||
|
||||
|
||||
if(send_packet) {
|
||||
EQApplicationPacket app;
|
||||
CreateSpawnPacket(&app);
|
||||
@@ -452,7 +452,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
if (m_type == OT_DROPPEDITEM) {
|
||||
bool cursordelete = false;
|
||||
if (m_inst && sender) {
|
||||
// if there is a lore conflict, delete the offending item from the server inventory
|
||||
// if there is a lore conflict, delete the offending item from the server inventory
|
||||
// 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);
|
||||
@@ -470,10 +470,10 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
// 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
|
||||
sender->DeleteItemInInventory(SLOT_CURSOR);
|
||||
|
||||
sender->DeleteItemInInventory(SLOT_CURSOR);
|
||||
|
||||
if(!m_ground_spawn)
|
||||
safe_delete(m_inst);
|
||||
|
||||
@@ -481,13 +481,13 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
sender->SetTradeskillObject(nullptr);
|
||||
user = nullptr;
|
||||
}
|
||||
|
||||
|
||||
// Send click to all clients (removes entity on client)
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct));
|
||||
memcpy(outapp->pBuffer, click_object, sizeof(ClickObject_Struct));
|
||||
entity_list.QueueClients(nullptr, outapp, false);
|
||||
safe_delete(outapp);
|
||||
|
||||
|
||||
// Remove object
|
||||
database.DeleteObject(m_id);
|
||||
if(!m_ground_spawn)
|
||||
@@ -496,7 +496,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
// Tradeskill item
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObjectAction, sizeof(ClickObjectAction_Struct));
|
||||
ClickObjectAction_Struct* coa = (ClickObjectAction_Struct*)outapp->pBuffer;
|
||||
|
||||
|
||||
//TODO: there is prolly a better way to do this.
|
||||
//if this is not the main user, send them a close and a message
|
||||
if(user == nullptr || user == sender)
|
||||
@@ -507,12 +507,12 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
}
|
||||
m_inuse = true;
|
||||
coa->type = m_type;
|
||||
coa->unknown16 = 0x0a;
|
||||
|
||||
coa->unknown16 = 0x0a;
|
||||
|
||||
coa->drop_id = click_object->drop_id;
|
||||
coa->player_id = click_object->player_id;
|
||||
coa->icon = m_icon;
|
||||
|
||||
|
||||
if(sender->IsLooting())
|
||||
{
|
||||
coa->open = 0x00;
|
||||
@@ -521,16 +521,16 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
|
||||
sender->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
|
||||
|
||||
//if the object allready had a user, we are done
|
||||
if(user != nullptr)
|
||||
return(false);
|
||||
|
||||
|
||||
// Starting to use this object
|
||||
sender->SetTradeskillObject(this);
|
||||
|
||||
|
||||
user = sender;
|
||||
|
||||
|
||||
// Send items inside of container
|
||||
|
||||
if (m_inst && m_inst->IsType(ItemClassContainer)) {
|
||||
@@ -538,7 +538,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
//Clear out no-drop and no-rent items first if different player opens it
|
||||
if(user != last_user)
|
||||
m_inst->ClearByFlags(byFlagSet, byFlagSet);
|
||||
|
||||
|
||||
EQApplicationPacket* outapp=new EQApplicationPacket(OP_ClientReady,0);
|
||||
sender->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
@@ -551,7 +551,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -560,28 +560,28 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
|
||||
|
||||
uint32 database_id = 0;
|
||||
uint32 item_id = 0;
|
||||
int16 charges = 0;
|
||||
|
||||
|
||||
if (inst && inst->GetItem()) {
|
||||
item_id = inst->GetItem()->ID;
|
||||
charges = inst->GetCharges();
|
||||
}
|
||||
|
||||
|
||||
// SQL Escape object_name
|
||||
uint32 len = strlen(object.object_name) * 2 + 1;
|
||||
char* object_name = new char[len];
|
||||
DoEscapeString(object_name, object.object_name, strlen(object.object_name));
|
||||
|
||||
|
||||
// Construct query
|
||||
uint32 len_query = MakeAnyLenString(&query,
|
||||
"insert into object (zoneid, xpos, ypos, zpos, heading, itemid, charges, objectname, "
|
||||
"type, icon) values (%i, %f, %f, %f, %f, %i, %i, '%s', %i, %i)",
|
||||
object.zone_id, object.x, object.y, object.z, object.heading,
|
||||
item_id, charges, object_name, type, icon);
|
||||
|
||||
|
||||
// Save new record for object
|
||||
if (!RunQuery(query, len_query, errbuf, nullptr, nullptr, &database_id)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to insert object: %s", errbuf);
|
||||
@@ -592,7 +592,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob
|
||||
SaveWorldContainer(object.zone_id, database_id, inst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(object_name);
|
||||
safe_delete_array(query);
|
||||
return database_id;
|
||||
@@ -603,27 +603,27 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
|
||||
|
||||
uint32 item_id = 0;
|
||||
int16 charges = 0;
|
||||
|
||||
|
||||
if (inst && inst->GetItem()) {
|
||||
item_id = inst->GetItem()->ID;
|
||||
charges = inst->GetCharges();
|
||||
}
|
||||
|
||||
|
||||
// SQL Escape object_name
|
||||
uint32 len = strlen(object.object_name) * 2 + 1;
|
||||
char* object_name = new char[len];
|
||||
DoEscapeString(object_name, object.object_name, strlen(object.object_name));
|
||||
|
||||
|
||||
// Construct query
|
||||
uint32 len_query = MakeAnyLenString(&query,
|
||||
"update object set zoneid=%i, xpos=%f, ypos=%f, zpos=%f, heading=%f, "
|
||||
"itemid=%i, charges=%i, objectname='%s', type=%i, icon=%i where id=%i",
|
||||
object.zone_id, object.x, object.y, object.z, object.heading,
|
||||
item_id, charges, object_name, type, icon, id);
|
||||
|
||||
|
||||
// Save new record for object
|
||||
if (!RunQuery(query, len_query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to update object: %s", errbuf);
|
||||
@@ -634,7 +634,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
||||
SaveWorldContainer(object.zone_id, id, inst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(object_name);
|
||||
safe_delete_array(query);
|
||||
}
|
||||
@@ -643,7 +643,7 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro
|
||||
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))
|
||||
{
|
||||
safe_delete_array(query);
|
||||
@@ -673,11 +673,11 @@ void ZoneDatabase::DeleteObject(uint32 id)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
|
||||
|
||||
// Construct query
|
||||
uint32 len_query = MakeAnyLenString(&query,
|
||||
"delete from object where id=%i", id);
|
||||
|
||||
|
||||
// Save new record for object
|
||||
if (!RunQuery(query, len_query, errbuf)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to delete object: %s", errbuf);
|
||||
@@ -686,7 +686,7 @@ void ZoneDatabase::DeleteObject(uint32 id)
|
||||
// Delete contained items, if any
|
||||
// DeleteWorldContainer(id);
|
||||
//}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ uint32 Object::GetIcon()
|
||||
}
|
||||
|
||||
float Object::GetX()
|
||||
{
|
||||
{
|
||||
return this->m_data.x;
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ uint32 Object::GetItemID()
|
||||
void Object::SetItemID(uint32 itemid)
|
||||
{
|
||||
safe_delete(this->m_inst);
|
||||
|
||||
|
||||
if (itemid)
|
||||
{
|
||||
this->m_inst = database.CreateItem(itemid);
|
||||
|
||||
+102
-102
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -86,7 +86,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna
|
||||
isSoF = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(isSoF)
|
||||
{
|
||||
DBPlayerCorpse_Struct* dbpcs = (DBPlayerCorpse_Struct*) in_data;
|
||||
@@ -216,9 +216,9 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
|
||||
itemlist = *in_itemlist;
|
||||
in_itemlist->clear();
|
||||
}
|
||||
|
||||
|
||||
SetCash(in_npc->GetCopper(), in_npc->GetSilver(), in_npc->GetGold(), in_npc->GetPlatinum());
|
||||
|
||||
|
||||
npctype_id = in_npctypeid;
|
||||
SetPKItem(0);
|
||||
charid = 0;
|
||||
@@ -226,7 +226,7 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
|
||||
p_depop = false;
|
||||
strcpy(orgname, in_npc->GetName());
|
||||
strcpy(name, in_npc->GetName());
|
||||
// Added By Hogie
|
||||
// Added By Hogie
|
||||
for(int count = 0; count < 100; count++) {
|
||||
if ((level >= npcCorpseDecayTimes[count].minlvl) && (level <= npcCorpseDecayTimes[count].maxlvl)) {
|
||||
corpse_decay_timer.SetTimer(npcCorpseDecayTimes[count].seconds*1000);
|
||||
@@ -261,7 +261,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
0,
|
||||
client->GetGender(),
|
||||
client->GetRace(),
|
||||
client->GetClass(),
|
||||
client->GetClass(),
|
||||
BT_Humanoid, // bodytype added
|
||||
client->GetDeity(),
|
||||
client->GetLevel(),
|
||||
@@ -339,7 +339,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
platinum = 0;
|
||||
strcpy(orgname, pp->name);
|
||||
strcpy(name, pp->name);
|
||||
|
||||
|
||||
//become_npc was not being initialized which led to some pretty funky things with newly created corpses
|
||||
become_npc = false;
|
||||
|
||||
@@ -356,13 +356,13 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
pp->gold = 0;
|
||||
pp->platinum = 0;
|
||||
}
|
||||
|
||||
|
||||
// get their tints
|
||||
memcpy(item_tint, &client->GetPP().item_tint, sizeof(item_tint));
|
||||
|
||||
|
||||
// solar: TODO soulbound items need not be added to corpse, but they need
|
||||
// to go into the regular slots on the player, out of bags
|
||||
|
||||
|
||||
// worn + inventory + cursor
|
||||
std::list<uint32> removed_list;
|
||||
bool cursor = false;
|
||||
@@ -372,15 +372,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
item = client->GetInv().GetItem(9999);
|
||||
if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) {
|
||||
std::list<uint32> slot_list = MoveItemToCorpse(client, item, 9999);
|
||||
removed_list.merge(slot_list);
|
||||
removed_list.merge(slot_list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
item = client->GetInv().GetItem(i);
|
||||
if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) {
|
||||
std::list<uint32> slot_list = MoveItemToCorpse(client, item, i);
|
||||
removed_list.merge(slot_list);
|
||||
removed_list.merge(slot_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
|
||||
// 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;
|
||||
@@ -401,7 +401,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(removed_list.size() != 0) {
|
||||
std::stringstream ss("");
|
||||
ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID();
|
||||
@@ -423,7 +423,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
|
||||
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);
|
||||
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();
|
||||
@@ -434,7 +434,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
|
||||
client->CalcBonuses(); // will only affect offline profile viewing of dead characters..unneeded overhead
|
||||
client->Save();
|
||||
} //end "not leaving naked corpses"
|
||||
|
||||
|
||||
Rezzed(false);
|
||||
Save();
|
||||
}
|
||||
@@ -501,7 +501,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, char* in_charname, ItemList* in
|
||||
charid = in_charid;
|
||||
itemlist = *in_itemlist;
|
||||
in_itemlist->clear();
|
||||
|
||||
|
||||
strcpy(orgname, in_charname);
|
||||
strcpy(name, in_charname);
|
||||
this->copper = in_copper;
|
||||
@@ -548,7 +548,7 @@ bool Corpse::Save() {
|
||||
return true;
|
||||
if (!pIsChanged)
|
||||
return true;
|
||||
|
||||
|
||||
uint32 tmp = this->CountItems();
|
||||
uint32 tmpsize = sizeof(DBPlayerCorpse_Struct) + (tmp * sizeof(player_lootitem::ServerLootItem_Struct));
|
||||
DBPlayerCorpse_Struct* dbpc = (DBPlayerCorpse_Struct*) new uchar[tmpsize];
|
||||
@@ -595,7 +595,7 @@ bool Corpse::Save() {
|
||||
dbpc->drakkin_heritage = drakkin_heritage;
|
||||
dbpc->drakkin_tattoo = drakkin_tattoo;
|
||||
dbpc->drakkin_details = drakkin_details;
|
||||
|
||||
|
||||
uint32 x = 0;
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
@@ -672,7 +672,7 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui
|
||||
ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data)
|
||||
{
|
||||
ServerLootItem_Struct *sitem = 0, *sitem2;
|
||||
|
||||
|
||||
// find the item
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
@@ -699,7 +699,7 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct**
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return sitem;
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ uint32 Corpse::GetWornItem(int16 equipSlot) const {
|
||||
return item->item_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -740,7 +740,7 @@ void Corpse::RemoveItem(uint16 lootslot)
|
||||
void Corpse::RemoveItem(ServerLootItem_Struct* item_data)
|
||||
{
|
||||
uint8 material;
|
||||
|
||||
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
@@ -754,9 +754,9 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data)
|
||||
material = Inventory::CalcMaterialFromSlot(sitem->equipSlot);
|
||||
if(material != 0xFF)
|
||||
SendWearChange(material);
|
||||
|
||||
|
||||
safe_delete(sitem);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -787,7 +787,7 @@ bool Corpse::IsEmpty() const {
|
||||
bool Corpse::Process() {
|
||||
if (p_depop)
|
||||
return false;
|
||||
|
||||
|
||||
if(corpse_delay_timer.Check())
|
||||
{
|
||||
for (int i=0; i<MAX_LOOTERS; i++)
|
||||
@@ -800,8 +800,8 @@ bool Corpse::Process() {
|
||||
if(zone->HasGraveyard()) {
|
||||
Save();
|
||||
p_depop = true;
|
||||
database.GraveyardPlayerCorpse(dbid, zone->graveyard_zoneid(),
|
||||
(zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->graveyard_x(),
|
||||
database.GraveyardPlayerCorpse(dbid, zone->graveyard_zoneid(),
|
||||
(zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->graveyard_x(),
|
||||
zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading());
|
||||
corpse_graveyard_timer.Disable();
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct));
|
||||
@@ -813,7 +813,7 @@ bool Corpse::Process() {
|
||||
LogFile->write(EQEMuLog::Debug, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid()));
|
||||
dbid = 0;
|
||||
}
|
||||
|
||||
|
||||
corpse_graveyard_timer.Disable();
|
||||
return false;
|
||||
}
|
||||
@@ -842,7 +842,7 @@ bool Corpse::Process() {
|
||||
corpse_decay_timer.Disable();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -921,14 +921,14 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
else if(GetPKItem() == -1 && CanMobLoot(client->CharacterID())) { tCanLoot = 3; } //pvp loot all items, variable cash
|
||||
else if(GetPKItem() == 1 && CanMobLoot(client->CharacterID())) { tCanLoot = 4; } //pvp loot 1 item, variable cash
|
||||
else if(GetPKItem() > 1 && CanMobLoot(client->CharacterID())) { tCanLoot = 5; } //pvp loot 1 set item, variable cash
|
||||
|
||||
|
||||
if(tCanLoot == 1) { if(client->Admin() < 100 || !client->GetGM()) { SendLootReqErrorPacket(client, 2); } }
|
||||
|
||||
if(tCanLoot >= 2 || (tCanLoot == 1 && client->Admin() >= 100 && client->GetGM())) {
|
||||
this->BeingLootedBy = client->GetID();
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct));
|
||||
moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer;
|
||||
|
||||
|
||||
d->response = 1;
|
||||
d->unknown1 = 0x42;
|
||||
d->unknown2 = 0xef;
|
||||
@@ -978,7 +978,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
}
|
||||
|
||||
outapp->priority = 6;
|
||||
client->QueuePacket(outapp);
|
||||
client->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
if(tCanLoot == 5) {
|
||||
int pkitem = GetPKItem();
|
||||
@@ -999,21 +999,21 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
|
||||
|
||||
uint8 containercount = 0;
|
||||
int corpselootlimit;
|
||||
|
||||
|
||||
if(client->GetClientVersion() >= EQClientRoF) { corpselootlimit = 34; }
|
||||
else if(client->GetClientVersion() >= EQClientSoF) { corpselootlimit = 32; }
|
||||
else if(client->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; }
|
||||
else { corpselootlimit = 30; }
|
||||
|
||||
|
||||
for(; cur != end; cur++) {
|
||||
ServerLootItem_Struct* item_data = *cur;
|
||||
item_data->lootslot = 0xFFFF;
|
||||
|
||||
|
||||
// Dont display the item if it's in a bag
|
||||
|
||||
|
||||
// Added cursor queue slots to corpse item visibility list. Nothing else should be making it to corpse.
|
||||
if(!IsPlayerCorpse() || item_data->equipSlot <= 30 || item_data->equipSlot == 9999 || tCanLoot>=3 ||
|
||||
(item_data->equipSlot >= 8000 && item_data->equipSlot <= 8999)) {
|
||||
@@ -1040,12 +1040,12 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
client->Message(0, "Remove items and re-loot corpse to access remaining inventory.");
|
||||
client->Message(0, "(%s contains %i additional %s.)", GetName(), (i - corpselootlimit), (i - corpselootlimit) == 1 ? "item" : "items");
|
||||
}
|
||||
|
||||
|
||||
if(IsPlayerCorpse() && i == 0 && itemlist.size() > 0) { // somehow, player corpse contains items, but client doesn't see them...
|
||||
client->Message(13, "This corpse contains items that are inaccessable!");
|
||||
client->Message(15, "Contact a GM for item replacement, if necessary.");
|
||||
client->Message(15, "BUGGED CORPSE [DBID: %i, Name: %s, Item Count: %i]", GetDBID(), GetName(), itemlist.size());
|
||||
|
||||
|
||||
cur = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
for(; cur != end; cur++) {
|
||||
@@ -1057,7 +1057,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Disgrace: Client seems to require that we send the packet back...
|
||||
client->QueuePacket(app);
|
||||
|
||||
@@ -1111,7 +1111,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
|
||||
const Item_Struct* item = 0;
|
||||
ItemInst *inst = 0;
|
||||
ServerLootItem_Struct* item_data = nullptr, *bag_item_data[10];
|
||||
|
||||
|
||||
memset(bag_item_data, 0, sizeof(bag_item_data));
|
||||
if(GetPKItem()>1)
|
||||
item = database.GetItem(GetPKItem());
|
||||
@@ -1124,7 +1124,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
|
||||
{
|
||||
item = database.GetItem(item_data->item_id);
|
||||
}
|
||||
|
||||
|
||||
if (item != 0)
|
||||
{
|
||||
if(item_data)
|
||||
@@ -1205,7 +1205,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
|
||||
}
|
||||
else if (admin<=255){
|
||||
if ((zone->lootvar<8) && (zone->lootvar>0))
|
||||
client->LogLoot(client,this,item);
|
||||
client->LogLoot(client,this,item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1248,10 +1248,10 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(GetPKItem()!=-1)
|
||||
SetPKItem(0);
|
||||
|
||||
|
||||
//now send messages to all interested parties
|
||||
|
||||
//creates a link for the item
|
||||
@@ -1299,7 +1299,7 @@ void Corpse::EndLoot(Client* client, const EQApplicationPacket* app) {
|
||||
outapp->size = 0;
|
||||
client->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
|
||||
|
||||
//client->Save(); //inventory operations auto-commit
|
||||
this->BeingLootedBy = 0xFFFFFFFF;
|
||||
if (this->IsEmpty())
|
||||
@@ -1311,9 +1311,9 @@ void Corpse::EndLoot(Client* client, const EQApplicationPacket* app) {
|
||||
void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
{
|
||||
Mob::FillSpawnStruct(ns, ForWho);
|
||||
|
||||
|
||||
ns->spawn.max_hp = 120;
|
||||
|
||||
|
||||
if (IsPlayerCorpse())
|
||||
ns->spawn.NPC = 3;
|
||||
else
|
||||
@@ -1330,7 +1330,7 @@ void Corpse::QueryLoot(Client* to) {
|
||||
end = itemlist.end();
|
||||
|
||||
int corpselootlimit;
|
||||
|
||||
|
||||
if (to->GetClientVersion() >= EQClientSoF) { corpselootlimit = 32; }
|
||||
else if (to->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; }
|
||||
else { corpselootlimit = 30; }
|
||||
@@ -1343,14 +1343,14 @@ void Corpse::QueryLoot(Client* to) {
|
||||
sitem->lootslot = 0xFFFF;
|
||||
else
|
||||
x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF;
|
||||
|
||||
|
||||
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 (sitem->lootslot != 0xFFFF)
|
||||
x++;
|
||||
|
||||
@@ -1359,7 +1359,7 @@ void Corpse::QueryLoot(Client* to) {
|
||||
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
|
||||
@@ -1397,7 +1397,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
bool consented = false;
|
||||
std::list<std::string>::iterator itr;
|
||||
@@ -1451,15 +1451,15 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
|
||||
char* query = new char[256];
|
||||
uint32 query_length = 0;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
|
||||
query_length = sprintf(query,"UPDATE zone SET graveyard_id=0 WHERE zoneidnumber=%u AND version=0", zone_id);
|
||||
|
||||
|
||||
if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) {
|
||||
safe_delete_array(query);
|
||||
cerr << "Error1 in DeleteGraveyard query " << errbuf << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (affected_rows == 0) {
|
||||
cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << endl;
|
||||
return false;
|
||||
@@ -1473,7 +1473,7 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
|
||||
return false;
|
||||
}
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
if (affected_rows == 0) {
|
||||
cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << endl;
|
||||
return false;
|
||||
@@ -1486,16 +1486,16 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
|
||||
char* query = new char[256];
|
||||
char* end = query;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
|
||||
end += sprintf(end,"UPDATE zone SET graveyard_id=%u WHERE zoneidnumber=%u AND version=0", graveyard_id, zone_id);
|
||||
|
||||
|
||||
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
|
||||
safe_delete_array(query);
|
||||
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;
|
||||
return 0;
|
||||
@@ -1509,16 +1509,16 @@ uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard
|
||||
char* end = query;
|
||||
uint32 affected_rows = 0;
|
||||
uint32 new_graveyard_id = 0;
|
||||
|
||||
|
||||
end += sprintf(end,"INSERT INTO graveyard SET zone_id=%u, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f", graveyard_zoneid, graveyard_x, graveyard_y, graveyard_z, graveyard_heading);
|
||||
|
||||
|
||||
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &new_graveyard_id)) {
|
||||
safe_delete_array(query);
|
||||
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;
|
||||
return 0;
|
||||
@@ -1536,17 +1536,17 @@ uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 in
|
||||
char* query = new char[256];
|
||||
char* end = query;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
|
||||
// We probably don't want a graveyard located in an instance.
|
||||
end += sprintf(end,"Update player_corpses SET zoneid=%u, instanceid=0, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f, WasAtGraveyard=1 WHERE id=%d", zoneid, x, y, z, heading, dbid);
|
||||
|
||||
|
||||
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
|
||||
safe_delete_array(query);
|
||||
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;
|
||||
return 0;
|
||||
@@ -1558,20 +1558,20 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
|
||||
char* query = new char[256+(datasize*2)];
|
||||
char* end = query;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
|
||||
end += sprintf(end, "Update player_corpses SET data=");
|
||||
*end++ = '\'';
|
||||
end += DoEscapeString(end, (char*)data, datasize);
|
||||
*end++ = '\'';
|
||||
end += sprintf(end,", charname='%s', zoneid=%u, instanceid=%u, charid=%d, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f WHERE id=%d", charname, zoneid, instanceid, charid, x, y, z, heading, dbid);
|
||||
|
||||
|
||||
if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
|
||||
safe_delete_array(query);
|
||||
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;
|
||||
return 0;
|
||||
@@ -1605,20 +1605,20 @@ uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uin
|
||||
//MYSQL_ROW row;
|
||||
uint32 affected_rows = 0;
|
||||
uint32 last_insert_id = 0;
|
||||
|
||||
|
||||
end += sprintf(end, "Insert into player_corpses SET data=");
|
||||
*end++ = '\'';
|
||||
end += DoEscapeString(end, (char*)data, datasize);
|
||||
*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)) {
|
||||
safe_delete_array(query);
|
||||
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;
|
||||
return 0;
|
||||
@@ -1640,7 +1640,7 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch
|
||||
uint32 last_insert_id = 0;
|
||||
bool result = false;
|
||||
DBPlayerCorpse_Struct* dbpcs = (DBPlayerCorpse_Struct*) data;
|
||||
|
||||
|
||||
if (dbid != 0) {
|
||||
if(RuleB(Character, LeaveCorpses) == true && dbpcs->level >= RuleI(Character, DeathItemLossLevel)){
|
||||
end += sprintf(end, "Insert into player_corpses_backup SET data=");
|
||||
@@ -1648,7 +1648,7 @@ bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const ch
|
||||
end += DoEscapeString(end, (char*)data, datasize);
|
||||
*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, id=%u", charname, zoneid, instanceid, charid, x, y, z, heading, dbid);
|
||||
|
||||
|
||||
if (RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) {
|
||||
if (affected_rows == 1)
|
||||
result = true;
|
||||
@@ -1672,7 +1672,7 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
|
||||
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)) {
|
||||
row = mysql_fetch_row(result);
|
||||
CorpseCount = atoi(row[0]);
|
||||
@@ -1681,7 +1681,7 @@ uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) {
|
||||
else {
|
||||
cerr << "Error in GetPlayerBurriedCorpseCount query '" << query << "' " << errbuf << endl;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
return CorpseCount;
|
||||
@@ -1693,7 +1693,7 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
|
||||
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)) {
|
||||
row = mysql_fetch_row(result);
|
||||
CorpseCount = atoi(row[0]);
|
||||
@@ -1702,7 +1702,7 @@ uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) {
|
||||
else {
|
||||
cerr << "Error in GetPlayerCorpseCount query '" << query << "' " << errbuf << endl;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
return CorpseCount;
|
||||
@@ -1714,7 +1714,7 @@ uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) {
|
||||
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)) {
|
||||
for (int i=0; i<corpse;i++) {
|
||||
row = mysql_fetch_row(result);
|
||||
@@ -1725,7 +1725,7 @@ uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) {
|
||||
else {
|
||||
cerr << "Error in GetPlayerCorpseID query '" << query << "' " << errbuf << endl;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
return id;
|
||||
@@ -1749,7 +1749,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone
|
||||
MYSQL_ROW row;
|
||||
Corpse* NewCorpse = 0;
|
||||
unsigned long* lengths;
|
||||
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, charname, data, timeofdeath, rezzed FROM player_corpses WHERE charid='%u' AND IsBurried=1 ORDER BY timeofdeath LIMIT 1", char_id), errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
@@ -1771,7 +1771,7 @@ Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zone
|
||||
else {
|
||||
cerr << "Error in SummonBurriedPlayerCorpse query '" << query << "' " << errbuf << endl;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
return NewCorpse;
|
||||
@@ -1794,7 +1794,7 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui
|
||||
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))
|
||||
{
|
||||
@@ -1817,7 +1817,7 @@ bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, ui
|
||||
}
|
||||
else
|
||||
LogFile->write(EQEMuLog::Error, "Error in SummonAllPlayerCorpses Query = %s, Error = %s\n", query, errbuf);
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
return (CorpseCount > 0);
|
||||
@@ -1829,9 +1829,9 @@ bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new
|
||||
char* end = query;
|
||||
uint32 affected_rows = 0;
|
||||
bool Result = false;
|
||||
|
||||
|
||||
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)
|
||||
Result = true;
|
||||
@@ -1853,7 +1853,7 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
|
||||
MYSQL_ROW row;
|
||||
Corpse* NewCorpse = 0;
|
||||
unsigned long* lengths;
|
||||
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, charid, charname, x, y, z, heading, data, timeofdeath, rezzed, WasAtGraveyard FROM player_corpses WHERE id='%u'", player_corpse_id), errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
@@ -1868,7 +1868,7 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
|
||||
cerr << "Error in LoadPlayerCorpse query '" << query << "' " << errbuf << endl;
|
||||
cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n";
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
return NewCorpse;
|
||||
@@ -1880,7 +1880,7 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
uint32 query_length = 0;
|
||||
|
||||
|
||||
unsigned long* lengths;
|
||||
|
||||
if(!RuleB(Zone, EnableShadowrest))
|
||||
@@ -1902,7 +1902,7 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1912,7 +1912,7 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
|
||||
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);
|
||||
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
||||
if (mysql_num_rows(result)!= 0){
|
||||
@@ -1926,7 +1926,7 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
|
||||
safe_delete_array(query);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
return CorpseID;
|
||||
}
|
||||
@@ -1934,13 +1934,13 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
|
||||
bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
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;
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
return true;
|
||||
}
|
||||
@@ -1948,13 +1948,13 @@ bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) {
|
||||
bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
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;
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
return true;
|
||||
}
|
||||
@@ -1962,13 +1962,13 @@ bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) {
|
||||
bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
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;
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
return true;
|
||||
}
|
||||
@@ -1976,7 +1976,7 @@ bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) {
|
||||
// these functions operate with a material slot, which is from 0 to 8
|
||||
uint32 Corpse::GetEquipment(uint8 material_slot) const {
|
||||
int invslot;
|
||||
|
||||
|
||||
if(material_slot > 8)
|
||||
{
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
struct QGlobal
|
||||
{
|
||||
QGlobal() { }
|
||||
QGlobal(std::string g_name, uint32 c_id, uint32 n_id, uint32 z_id, std::string n_value, uint32 expire_date)
|
||||
QGlobal(std::string g_name, uint32 c_id, uint32 n_id, uint32 z_id, std::string n_value, uint32 expire_date)
|
||||
: name(g_name), char_id(c_id), npc_id(n_id), zone_id(z_id), value(n_value), expdate(expire_date) { id = 0; }
|
||||
std::string name;
|
||||
uint32 char_id;
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
//assumes cacheA is already a valid or empty list and doesn't check for valid items.
|
||||
static void Combine(std::list<QGlobal> &cacheA, std::list<QGlobal> cacheB, uint32 npcID, uint32 charID, uint32 zoneID);
|
||||
|
||||
|
||||
void PurgeExpiredGlobals();
|
||||
void LoadByNPCID(uint32 npcID); //npc
|
||||
void LoadByCharID(uint32 charID); //client
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ bool ZoneDatabase::OpenQuery(char* zonename) {
|
||||
strcpy( Quest::m_pQuests[ l_cnt ].m_pQuestText, row[1] );
|
||||
Quest::m_pQuests[ l_cnt ].m_pQuestEnd = new char[ strlen( row[2] )+1 ];
|
||||
strcpy( Quest::m_pQuests[ l_cnt ].m_pQuestEnd, row[2] );
|
||||
|
||||
|
||||
Quest::m_pQuests[ l_cnt ].m_iNpcId = atoi( row[3] );
|
||||
Quest::m_pQuests[ l_cnt ].m_iQuestObject= atoi( row[4] );
|
||||
Quest::m_pQuests[ l_cnt ].m_iQuestPrice = atoi( row[5] );
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ typedef struct _tag_quest_entry{
|
||||
|
||||
|
||||
class Quest{
|
||||
public:
|
||||
public:
|
||||
Quest();
|
||||
~Quest();
|
||||
static pquest_entry Test(int NpcId, int QuestObject);
|
||||
|
||||
@@ -51,7 +51,7 @@ void QuestParserCollection::ReloadQuests(bool reset_timers) {
|
||||
|
||||
bool QuestParserCollection::HasQuestSub(uint32 npcid, const char *subname) {
|
||||
std::map<uint32, uint32>::iterator iter = _npc_quest_status.find(npcid);
|
||||
|
||||
|
||||
if(iter != _npc_quest_status.end()) {
|
||||
//loaded or failed to load
|
||||
if(iter->second != QuestFailedToLoad) {
|
||||
@@ -97,7 +97,7 @@ bool QuestParserCollection::PlayerHasQuestSub(const char *subname) {
|
||||
if(qi) {
|
||||
_global_player_quest_status = qi->GetIdentifier();
|
||||
}
|
||||
|
||||
|
||||
qi = GetQIByPlayerQuest();
|
||||
if(qi) {
|
||||
_player_quest_status = qi->GetIdentifier();
|
||||
@@ -207,7 +207,7 @@ void QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::s
|
||||
qi->EventPlayer(evt, client, data, extra_data);
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
if(_global_player_quest_status != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator iter = _interfaces.find(_global_player_quest_status);
|
||||
if(iter != _interfaces.end())
|
||||
@@ -435,7 +435,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest() {
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
//second look for /quests/zone/player.ext (precedence)
|
||||
filename = "quests/";
|
||||
@@ -555,7 +555,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id) {
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -580,7 +580,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script)
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
+3
-3
@@ -86,7 +86,7 @@
|
||||
#define INVIS_BEGIN_BREAK 275 //You feel yourself starting to appear.
|
||||
#define DISCIPLINE_CONLOST 278 //You lose the concentration to remain in your fighting discipline.
|
||||
#define REZ_REGAIN 289 //You regain some experience from resurrection.
|
||||
#define DUP_LORE 290 //Duplicate lore items are not allowed.
|
||||
#define DUP_LORE 290 //Duplicate lore items are not allowed.
|
||||
#define TGB_ON 293 //Target other group buff is *ON*.
|
||||
#define TGB_OFF 294 //Target other group buff is *OFF*.
|
||||
#define LDON_SENSE_TRAP1 306 //You do not Sense any traps.
|
||||
@@ -171,7 +171,7 @@
|
||||
#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 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.
|
||||
@@ -269,7 +269,7 @@
|
||||
#define MAX_RAID_LEADERSHIP_POINTS 8591 //
|
||||
#define LEADERSHIP_EXP_ON 8653 //
|
||||
#define LEADERSHIP_EXP_OFF 8654 //
|
||||
#define CURRENT_SPELL_EFFECTS 8757 //%1's current spell effects:
|
||||
#define CURRENT_SPELL_EFFECTS 8757 //%1's current spell effects:
|
||||
#define GAIN_GROUP_LEADERSHIP_EXP 8788 //
|
||||
#define GAIN_RAID_LEADERSHIP_EXP 8789 //
|
||||
#define BUFF_MINUTES_REMAINING 8799 //%1 (%2 minutes remaining)
|
||||
|
||||
+2
-2
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
+3
-3
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -37,7 +37,7 @@ class ZoneConfig : public EQEmuConfig {
|
||||
|
||||
// Produce a const singleton
|
||||
static const ZoneConfig *get() {
|
||||
if (_zone_config == nullptr)
|
||||
if (_zone_config == nullptr)
|
||||
LoadConfig();
|
||||
return(_zone_config);
|
||||
}
|
||||
|
||||
+77
-77
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -41,7 +41,7 @@ void EntityList::CheckClientAggro(Client *around) {
|
||||
Mob* mob = iterator.GetData();
|
||||
if(mob->IsClient()) //also ensures that mob != around
|
||||
continue;
|
||||
|
||||
|
||||
if(mob->CheckWillAggro(around)) {
|
||||
if(mob->IsEngaged())
|
||||
{
|
||||
@@ -57,24 +57,24 @@ void EntityList::CheckClientAggro(Client *around) {
|
||||
|
||||
void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbose) {
|
||||
float d2 = d*d;
|
||||
|
||||
|
||||
towho->Message(0, "Describing aggro for %s", from_who->GetName());
|
||||
|
||||
|
||||
bool engaged = from_who->IsEngaged();
|
||||
if(engaged) {
|
||||
Mob *top = from_who->GetHateTop();
|
||||
towho->Message(0, ".. I am currently fighting with %s", top == nullptr?"(nullptr)":top->GetName());
|
||||
}
|
||||
bool check_npcs = from_who->WillAggroNPCs();
|
||||
|
||||
|
||||
if(verbose) {
|
||||
char namebuf[256];
|
||||
|
||||
|
||||
int my_primary = from_who->GetPrimaryFaction();
|
||||
Mob *own = from_who->GetOwner();
|
||||
if(own != nullptr)
|
||||
my_primary = own->GetPrimaryFaction();
|
||||
|
||||
|
||||
if(my_primary == 0) {
|
||||
strcpy(namebuf, "(No faction)");
|
||||
} else if(my_primary < 0) {
|
||||
@@ -85,16 +85,16 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
|
||||
}
|
||||
towho->Message(0, ".. I am on faction %s (%d)\n", namebuf, my_primary);
|
||||
}
|
||||
|
||||
|
||||
LinkedListIterator<Mob*> iterator(mob_list);
|
||||
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {
|
||||
Mob* mob = iterator.GetData();
|
||||
if(mob->IsClient()) //also ensures that mob != around
|
||||
continue;
|
||||
|
||||
|
||||
if(mob->DistNoRoot(*from_who) > d2)
|
||||
continue;
|
||||
|
||||
|
||||
if(engaged) {
|
||||
uint32 amm = from_who->GetHateAmount(mob);
|
||||
if(amm == 0) {
|
||||
@@ -113,7 +113,7 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
|
||||
void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
//this logic is duplicated from below, try to keep it up to date.
|
||||
float iAggroRange = GetAggroRange();
|
||||
|
||||
|
||||
float t1, t2, t3;
|
||||
t1 = mob->GetX() - GetX();
|
||||
t2 = mob->GetY() - GetY();
|
||||
@@ -132,7 +132,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
t1, t2, t3, iAggroRange);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(mob->IsInvisible(this)) {
|
||||
towho->Message(0, "...%s is invisible to me. ", mob->GetName());
|
||||
return;
|
||||
@@ -142,14 +142,14 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
|| mob->CastToClient()->IsLD()
|
||||
|| mob->CastToClient()->IsBecomeNPC()
|
||||
|| mob->CastToClient()->GetGM()
|
||||
)
|
||||
)
|
||||
))
|
||||
{
|
||||
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;
|
||||
@@ -162,13 +162,13 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
if(verbose) {
|
||||
int my_primary = GetPrimaryFaction();
|
||||
int mob_primary = mob->GetPrimaryFaction();
|
||||
@@ -178,7 +178,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
own = mob->GetOwner();
|
||||
if(mob_primary > 0 && own != nullptr)
|
||||
mob_primary = own->GetPrimaryFaction();
|
||||
|
||||
|
||||
if(mob_primary == 0) {
|
||||
towho->Message(0, "...%s has no primary faction", mob->GetName());
|
||||
} else if(mob_primary < 0) {
|
||||
@@ -214,9 +214,9 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FACTION_VALUE fv = mob->GetReverseFactionCon(this);
|
||||
|
||||
|
||||
if(!(
|
||||
fv == FACTION_SCOWLS
|
||||
||
|
||||
@@ -230,12 +230,12 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
if(fv == FACTION_THREATENLY) {
|
||||
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());
|
||||
|
||||
towho->Message(0, "...%s meets all conditions, I should be attacking them.", mob->GetName());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -249,24 +249,24 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
|
||||
//sometimes if a client has some lag while zoning into a dangerous place while either invis or a GM
|
||||
//they will aggro mobs even though it's supposed to be impossible, to lets make sure we've finished connecting
|
||||
if (mob->IsClient()) {
|
||||
if (mob->IsClient()) {
|
||||
if (!mob->CastToClient()->ClientFinishedLoading() || mob->CastToClient()->IsHoveringForRespawn())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Mob *ownr = mob->GetOwner();
|
||||
if(ownr && ownr->IsClient() && !ownr->CastToClient()->ClientFinishedLoading())
|
||||
return false;
|
||||
|
||||
float iAggroRange = GetAggroRange();
|
||||
|
||||
|
||||
// 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
|
||||
// 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
|
||||
|
||||
|
||||
float t1, t2, t3;
|
||||
t1 = mob->GetX() - GetX();
|
||||
t2 = mob->GetY() - GetY();
|
||||
@@ -287,7 +287,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
|| mob->CastToClient()->IsLD()
|
||||
|| mob->CastToClient()->IsBecomeNPC()
|
||||
|| mob->CastToClient()->GetGM()
|
||||
)
|
||||
)
|
||||
))
|
||||
{
|
||||
return(false);
|
||||
@@ -308,11 +308,11 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
// Skip it, out of range
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//Image: Get their current target and faction value now that its required
|
||||
//this function call should seem backwards
|
||||
FACTION_VALUE fv = mob->GetReverseFactionCon(this);
|
||||
|
||||
|
||||
// Make sure they're still in the zone
|
||||
// Are they in range?
|
||||
// Are they kos?
|
||||
@@ -362,7 +362,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
printf("Faction: %d\n", fv);
|
||||
printf("Int: %d\n", GetINT());
|
||||
printf("Con: %d\n", GetLevelCon(mob->GetLevel()));
|
||||
#endif
|
||||
#endif
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -381,11 +381,11 @@ Mob* EntityList::AICheckCloseAggro(Mob* sender, float iAggroRange, float iAssist
|
||||
//float distZ;
|
||||
while(iterator.MoreElements()) {
|
||||
Mob* mob = iterator.GetData();
|
||||
|
||||
|
||||
if(sender->CheckWillAggro(mob)) {
|
||||
return(mob);
|
||||
}
|
||||
|
||||
|
||||
iterator.Advance();
|
||||
}
|
||||
//LogFile->write(EQEMuLog::Debug, "Check aggro for %s no target.", sender->GetName());
|
||||
@@ -407,7 +407,7 @@ int EntityList::GetHatedCount(Mob *attacker, Mob *exclude) {
|
||||
NPC* mob = iterator.GetData();
|
||||
|
||||
if(!mob || (mob == exclude)) continue;
|
||||
|
||||
|
||||
if(!mob->IsEngaged()) continue;
|
||||
|
||||
if(mob->IsFeared() || mob->IsMezzed()) continue;
|
||||
@@ -419,7 +419,7 @@ int EntityList::GetHatedCount(Mob *attacker, Mob *exclude) {
|
||||
float AggroRange = mob->GetAggroRange();
|
||||
|
||||
// Square it because we will be using DistNoRoot
|
||||
|
||||
|
||||
AggroRange = AggroRange * AggroRange;
|
||||
|
||||
if(mob->DistNoRoot(*attacker) > AggroRange) continue;
|
||||
@@ -438,9 +438,9 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
|
||||
return;
|
||||
if (sender->GetPrimaryFaction() == 0 )
|
||||
return; // well, if we dont have a faction set, we're gonna be indiff to everybody
|
||||
|
||||
|
||||
LinkedListIterator<NPC*> iterator(npc_list);
|
||||
|
||||
|
||||
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {
|
||||
NPC* mob = iterator.GetData();
|
||||
if(!mob){
|
||||
@@ -480,8 +480,8 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
|
||||
//attacking someone on same faction, or a friend
|
||||
//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",
|
||||
#if (EQDEBUG>=5)
|
||||
LogFile->write(EQEMuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
|
||||
sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ()));
|
||||
#endif
|
||||
mob->AddToHateList(attacker, 1, 0, false);
|
||||
@@ -528,7 +528,7 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
|
||||
return false;
|
||||
else if(our_owner && our_owner == target)
|
||||
return false;
|
||||
|
||||
|
||||
//cannot hurt untargetable mobs
|
||||
bodyType bt = target->GetBodyType();
|
||||
|
||||
@@ -553,10 +553,10 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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.
|
||||
// no need to compare pets to anything
|
||||
mob1 = our_owner ? our_owner : this;
|
||||
@@ -571,7 +571,7 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
|
||||
{
|
||||
c1 = mob1->CastToClient();
|
||||
c2 = mob2->CastToClient();
|
||||
|
||||
|
||||
if // if both are pvp they can fight
|
||||
(
|
||||
c1->GetPVP() &&
|
||||
@@ -590,19 +590,19 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
|
||||
return false;
|
||||
}
|
||||
else if(_NPC(mob2)) // client vs npc
|
||||
{
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(_BECOMENPC(mob2)) // client vs becomenpc
|
||||
{
|
||||
c1 = mob1->CastToClient();
|
||||
becomenpc = mob2->CastToClient();
|
||||
|
||||
|
||||
if(c1->GetLevel() > becomenpc->GetBecomeNPCLevel())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(_CLIENTCORPSE(mob2)) // client vs client corpse
|
||||
{
|
||||
return false;
|
||||
@@ -722,7 +722,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
|
||||
return true;
|
||||
|
||||
// solar: see IsAttackAllowed for notes
|
||||
|
||||
|
||||
// first figure out if we're pets. we always look at the master's flags.
|
||||
// no need to compare pets to anything
|
||||
mob1 = this->GetOwnerID() ? this->GetOwner() : this;
|
||||
@@ -880,7 +880,7 @@ bool Mob::CombatRange(Mob* other)
|
||||
// prevention of ridiculously sized hit boxes
|
||||
if (size_mod > 10000)
|
||||
size_mod = size_mod / 7;
|
||||
|
||||
|
||||
if (DistNoRoot(*other) <= size_mod)
|
||||
{
|
||||
return true;
|
||||
@@ -1036,16 +1036,16 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
|
||||
#endif
|
||||
}
|
||||
_ZP(Mob_CheckLosFN);
|
||||
|
||||
|
||||
VERTEX myloc;
|
||||
VERTEX oloc;
|
||||
|
||||
|
||||
#define LOS_DEFAULT_HEIGHT 6.0f
|
||||
|
||||
|
||||
myloc.x = GetX();
|
||||
myloc.y = GetY();
|
||||
myloc.z = GetZ() + (GetSize()==0.0?LOS_DEFAULT_HEIGHT:GetSize())/2 * HEAD_POSITION;
|
||||
|
||||
|
||||
oloc.x = posX;
|
||||
oloc.y = posY;
|
||||
oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION;
|
||||
@@ -1053,11 +1053,11 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
|
||||
#if LOSDEBUG>=5
|
||||
LogFile->write(EQEMuLog::Debug, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize);
|
||||
#endif
|
||||
|
||||
|
||||
FACE *onhit;
|
||||
NodeRef mynode;
|
||||
NodeRef onode;
|
||||
|
||||
|
||||
VERTEX hit;
|
||||
//see if anything in our node is in the way
|
||||
mynode = zone->zonemap->SeekNode( zone->zonemap->GetRoot(), myloc.x, myloc.y);
|
||||
@@ -1067,7 +1067,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
|
||||
LogFile->write(EQEMuLog::Debug, "Check LOS for %s target position, cannot see.", GetName());
|
||||
LogFile->write(EQEMuLog::Debug, "\tPoly: (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f)\n",
|
||||
onhit->a.x, onhit->a.y, onhit->a.z,
|
||||
onhit->b.x, onhit->b.y, onhit->b.z,
|
||||
onhit->b.x, onhit->b.y, onhit->b.z,
|
||||
onhit->c.x, onhit->c.y, onhit->c.z);
|
||||
#endif
|
||||
return(false);
|
||||
@@ -1078,7 +1078,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
|
||||
LogFile->write(EQEMuLog::Debug, "WTF, I have no node, what am I standing on??? (%.2f, %.2f).", myloc.x, myloc.y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//see if they are in a different node.
|
||||
//if so, see if anything in their node is blocking me.
|
||||
if(! zone->zonemap->LocWithinNode(mynode, oloc.x, oloc.y)) {
|
||||
@@ -1089,7 +1089,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
|
||||
LogFile->write(EQEMuLog::Debug, "Check LOS for %s target position, cannot see (2).", GetName());
|
||||
LogFile->write(EQEMuLog::Debug, "\tPoly: (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f)\n",
|
||||
onhit->a.x, onhit->a.y, onhit->a.z,
|
||||
onhit->b.x, onhit->b.y, onhit->b.z,
|
||||
onhit->b.x, onhit->b.y, onhit->b.z,
|
||||
onhit->c.x, onhit->c.y, onhit->c.z);
|
||||
#endif
|
||||
return(false);
|
||||
@@ -1101,23 +1101,23 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if(zone->zonemap->LineIntersectsZone(myloc, oloc, CHECK_LOS_STEP, &onhit)) {
|
||||
#if LOSDEBUG>=5
|
||||
LogFile->write(EQEMuLog::Debug, "Check LOS for %s target %s, cannot see.", GetName(), other->GetName() );
|
||||
LogFile->write(EQEMuLog::Debug, "\tPoly: (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f)\n",
|
||||
onhit->a.x, onhit->a.y, onhit->a.z,
|
||||
onhit->b.x, onhit->b.y, onhit->b.z,
|
||||
onhit->b.x, onhit->b.y, onhit->b.z,
|
||||
onhit->c.x, onhit->c.y, onhit->c.z);
|
||||
#endif
|
||||
return(false);
|
||||
}*/
|
||||
|
||||
|
||||
#if LOSDEBUG>=5
|
||||
LogFile->write(EQEMuLog::Debug, "Check LOS for %s target position, CAN SEE.", GetName());
|
||||
#endif
|
||||
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -1189,8 +1189,8 @@ int32 Mob::CheckAggroAmount(uint16 spellid, bool isproc) {
|
||||
int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], this->GetLevel(), spell_id);
|
||||
if (val < 0)
|
||||
{
|
||||
AggroAmount -= val*2;
|
||||
}
|
||||
AggroAmount -= val*2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_ResistMagic:
|
||||
@@ -1245,7 +1245,7 @@ int32 Mob::CheckAggroAmount(uint16 spellid, bool isproc) {
|
||||
}
|
||||
case SE_Amnesia:
|
||||
case SE_Silence:{
|
||||
AggroAmount += slevel*2;
|
||||
AggroAmount += slevel*2;
|
||||
break;
|
||||
}
|
||||
case SE_Destroy:{
|
||||
@@ -1287,7 +1287,7 @@ int32 Mob::CheckAggroAmount(uint16 spellid, bool isproc) {
|
||||
}
|
||||
case SE_CancelMagic:
|
||||
case SE_DispelDetrimental:{
|
||||
AggroAmount += slevel;
|
||||
AggroAmount += slevel;
|
||||
break;
|
||||
}
|
||||
case SE_ReduceHate:
|
||||
@@ -1313,7 +1313,7 @@ int32 Mob::CheckAggroAmount(uint16 spellid, bool isproc) {
|
||||
AggroAmount = AggroAmount * RuleI(Aggro, SongAggroMod) / 100;
|
||||
if (GetOwner() && IsPet())
|
||||
AggroAmount = AggroAmount * RuleI(Aggro, PetSpellAggroMod) / 100;
|
||||
|
||||
|
||||
if(AggroAmount > 0)
|
||||
{
|
||||
|
||||
@@ -1333,8 +1333,8 @@ int32 Mob::CheckAggroAmount(uint16 spellid, bool isproc) {
|
||||
//every time you cast on live you get a certain amount of "this is a spell" aggro
|
||||
//confirmed by EQ devs to be 100 exactly at level 85. From their wording it doesn't seem like it's affected
|
||||
//by hate modifiers either.
|
||||
//AggroAmount += (slevel*slevel/72);
|
||||
// Saved so I can reimplement it;
|
||||
//AggroAmount += (slevel*slevel/72);
|
||||
// Saved so I can reimplement it;
|
||||
// this should only be on the spell to aggro the npc not every spell
|
||||
|
||||
}
|
||||
@@ -1385,7 +1385,7 @@ int32 Mob::CheckHealAggroAmount(uint16 spellid, uint32 heal_possible) {
|
||||
|
||||
//Live AA - Spell casting subtlety
|
||||
HateMod += aabonuses.hatemod + spellbonuses.hatemod + itembonuses.hatemod;
|
||||
|
||||
|
||||
AggroAmount = (AggroAmount * HateMod) / 100;
|
||||
|
||||
//made up number probably scales a bit differently on live but it seems like it will be close enough
|
||||
@@ -1425,7 +1425,7 @@ void Mob::RemoveFromFeignMemory(Client* attacker) {
|
||||
|
||||
void Mob::ClearFeignMemory() {
|
||||
std::set<uint32>::iterator RememberedCharID = feign_memory_list.begin();
|
||||
while (RememberedCharID != feign_memory_list.end())
|
||||
while (RememberedCharID != feign_memory_list.end())
|
||||
{
|
||||
Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID);
|
||||
if(remember_client != nullptr) //Still in zone
|
||||
@@ -1461,15 +1461,15 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
|
||||
|
||||
//2: The mob makes a resistance check against the charm
|
||||
if (resist_check == 100)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
|
||||
else
|
||||
{
|
||||
if (caster->IsClient())
|
||||
{
|
||||
//3: At maxed ability, Total Domination has a 50% chance of preventing the charm break that otherwise would have occurred.
|
||||
//3: At maxed ability, Total Domination has a 50% chance of preventing the charm break that otherwise would have occurred.
|
||||
uint16 TotalDominationBonus = caster->aabonuses.CharmBreakChance + caster->spellbonuses.CharmBreakChance + caster->itembonuses.CharmBreakChance;
|
||||
|
||||
|
||||
if (MakeRandomInt(0, 100) < TotalDominationBonus)
|
||||
return true;
|
||||
|
||||
@@ -1481,7 +1481,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
|
||||
{
|
||||
// Assume this is a harmony/pacify spell
|
||||
if (resist_check == 100)
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
+268
-268
File diff suppressed because it is too large
Load Diff
@@ -113,7 +113,7 @@ int GetArgs(char * string)
|
||||
//strcpy(buffer,com_list);
|
||||
//#else
|
||||
//strncpy(buffer,com_list,sizeof(buffer)-1);
|
||||
//#endif
|
||||
//#endif
|
||||
int i=0;
|
||||
while (*buffer)
|
||||
{
|
||||
|
||||
+3
-3
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -122,7 +122,7 @@ void Beacon::AELocationSpell(Mob *caster, uint16 cast_spell_id, int16 resist_adj
|
||||
{
|
||||
if(!IsValidSpell(cast_spell_id) || !caster)
|
||||
return;
|
||||
|
||||
|
||||
caster_id = caster->GetID();
|
||||
spell_id = cast_spell_id;
|
||||
this->resist_adjust = resist_adjust;
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ class Beacon : public Mob
|
||||
public:
|
||||
Beacon(Mob *at_mob, int lifetime);
|
||||
~Beacon();
|
||||
|
||||
|
||||
//abstract virtual function implementations requird by base abstract class
|
||||
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) { return; }
|
||||
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
|
||||
|
||||
+194
-194
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -3577,7 +3577,7 @@ void Bot::AI_Process() {
|
||||
|
||||
if(!IsEngaged()) {
|
||||
if(GetFollowID()) {
|
||||
if(BotOwner && BotOwner->GetTarget() && BotOwner->GetTarget()->IsNPC() && (BotOwner->GetTarget()->GetHateAmount(BotOwner)
|
||||
if(BotOwner && BotOwner->GetTarget() && BotOwner->GetTarget()->IsNPC() && (BotOwner->GetTarget()->GetHateAmount(BotOwner)
|
||||
|| BotOwner->CastToClient()->AutoAttackEnabled()) && IsAttackAllowed(BotOwner->GetTarget())) {
|
||||
AddToHateList(BotOwner->GetTarget(), 1);
|
||||
|
||||
@@ -6361,8 +6361,8 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skil
|
||||
|
||||
SendHPUpdate();
|
||||
|
||||
if(this == from) {
|
||||
return;
|
||||
if(this == from) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Aggro the bot's group members
|
||||
|
||||
+121
-121
@@ -17,7 +17,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(tar->GetAppearance() == eaDead) {
|
||||
if((tar->IsClient() && tar->CastToClient()->GetFeigned()) || tar->IsBot()) {
|
||||
// do nothing
|
||||
@@ -45,10 +45,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
//TODO
|
||||
//Check if single target or AoE mez is best
|
||||
//if (TARGETS ON MT IS => 3 THEN botSpell = AoEMez)
|
||||
@@ -67,17 +67,17 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(!(!addMob->IsImmuneToSpell(botSpell.SpellId, this) && addMob->CanBuffStack(botSpell.SpellId, botLevel, true) >= 0))
|
||||
break;
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, addMob, botSpell.ManaCost);
|
||||
|
||||
if(castedSpell) {
|
||||
char* gmsg = 0;
|
||||
|
||||
|
||||
MakeAnyLenString(&gmsg, "Attempting to mez %s.", addMob->GetCleanName());
|
||||
|
||||
if(gmsg && GetGroupMessagesOn())
|
||||
BotGroupSay(this, gmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
uint8 hpr = (uint8)tar->GetHPRatio();
|
||||
bool hasAggro = false;
|
||||
bool isPrimaryHealer = false;
|
||||
|
||||
|
||||
if(HasGroup()) {
|
||||
isPrimaryHealer = IsGroupPrimaryHealer();
|
||||
}
|
||||
@@ -192,12 +192,12 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
hpRatioToCast = isPrimaryHealer?100.0f:0.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//If we're at specified mana % or below, don't heal as hybrid
|
||||
if(tar->GetHPRatio() <= hpRatioToCast)
|
||||
botSpell = GetBestBotSpellForRegularSingleTargetHeal(this);
|
||||
}
|
||||
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
botSpell = GetBestBotSpellForRegularSingleTargetHeal(this);
|
||||
|
||||
@@ -230,7 +230,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
// TODO: Replace this code with logic that calculates the delay based on number of clerics in rotation
|
||||
// and ignores heals for anyone except the main tank
|
||||
if(!IsHealOverTimeSpell(botSpell.SpellId)) {
|
||||
if(IsCompleteHealSpell(botSpell.SpellId)) {
|
||||
if(IsCompleteHealSpell(botSpell.SpellId)) {
|
||||
// Complete Heal 4 second rotation
|
||||
tar->SetDontHealMeBefore(Timer::GetCurrentTime() + 4000);
|
||||
}
|
||||
@@ -274,7 +274,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
@@ -289,9 +289,9 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
break;
|
||||
|
||||
uint32 TempDontRootMeBefore = tar->DontRootMeBefore();
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost, &TempDontRootMeBefore);
|
||||
|
||||
|
||||
if(TempDontRootMeBefore != tar->DontRootMeBefore())
|
||||
tar->SetDontRootMeBefore(TempDontRootMeBefore);
|
||||
}
|
||||
@@ -321,7 +321,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
// Validate target
|
||||
|
||||
if(!((spells[selectedBotSpell.SpellId].targettype == ST_Target || spells[selectedBotSpell.SpellId].targettype == ST_Pet || tar == this ||
|
||||
if(!((spells[selectedBotSpell.SpellId].targettype == ST_Target || spells[selectedBotSpell.SpellId].targettype == ST_Pet || tar == this ||
|
||||
spells[selectedBotSpell.SpellId].targettype == ST_Group || spells[selectedBotSpell.SpellId].targettype == ST_GroupTeleport ||
|
||||
(botClass == BARD && spells[selectedBotSpell.SpellId].targettype == ST_AEBard))
|
||||
&& !tar->IsImmuneToSpell(selectedBotSpell.SpellId, this)
|
||||
@@ -362,7 +362,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(botClass == ENCHANTER && IsEffectInSpell(selectedBotSpell.SpellId, SE_Rune))
|
||||
{
|
||||
float manaRatioToCast = 75.0f;
|
||||
|
||||
|
||||
switch(this->GetBotStance())
|
||||
{
|
||||
case BotStanceEfficient:
|
||||
@@ -381,7 +381,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//If we're at specified mana % or below, don't rune as enchanter
|
||||
if(this->GetManaRatio() <= manaRatioToCast)
|
||||
break;
|
||||
@@ -407,13 +407,13 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
case SpellType_Escape: {
|
||||
uint8 hpr = (uint8)GetHPRatio();
|
||||
bool mayGetAggro = false;
|
||||
|
||||
#ifdef IPC
|
||||
|
||||
#ifdef IPC
|
||||
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
|
||||
|
||||
|
||||
if (hpr <= 15 || mayGetAggro)
|
||||
#endif
|
||||
{
|
||||
@@ -421,10 +421,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
break;
|
||||
|
||||
|
||||
if(IsInvulnerabilitySpell(botSpell.SpellId))
|
||||
tar = this; //target self for invul type spells
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
|
||||
}
|
||||
break;
|
||||
@@ -435,14 +435,14 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
if(botClass == CLERIC || botClass == ENCHANTER)
|
||||
{
|
||||
float manaRatioToCast = 75.0f;
|
||||
|
||||
|
||||
switch(this->GetBotStance())
|
||||
{
|
||||
case BotStanceEfficient:
|
||||
@@ -463,7 +463,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//If we're at specified mana % or below, don't nuke as cleric or enchanter
|
||||
if(this->GetManaRatio() <= manaRatioToCast)
|
||||
break;
|
||||
@@ -479,7 +479,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(botClass == PALADIN || botClass == DRUID || botClass == CLERIC || botClass == ENCHANTER || botClass == WIZARD) {
|
||||
if(botSpell.SpellId == 0) {
|
||||
uint8 stunChance = (tar->IsCasting() ? 30: 15);
|
||||
|
||||
|
||||
if(botClass == PALADIN)
|
||||
stunChance = 50;
|
||||
|
||||
@@ -501,8 +501,8 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(!(!tar->IsImmuneToSpell(botSpell.SpellId, this) && (tar->CanBuffStack(botSpell.SpellId, botLevel, true) >= 0)))
|
||||
break;
|
||||
|
||||
if(IsFearSpell(botSpell.SpellId)) {
|
||||
|
||||
if(IsFearSpell(botSpell.SpellId)) {
|
||||
// don't let fear cast if the npc isn't snared or rooted
|
||||
if(tar->GetSnaredAmount() == -1) {
|
||||
if(!tar->IsRooted())
|
||||
@@ -519,10 +519,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
botSpell = GetFirstBotSpellBySpellType(this, iSpellTypes);
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
@@ -546,13 +546,13 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
break;
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SpellType_InCombatBuff: {
|
||||
|
||||
|
||||
if(botClass == SHAMAN) {
|
||||
checked_los = true;
|
||||
|
||||
@@ -589,7 +589,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
@@ -610,7 +610,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
@@ -623,9 +623,9 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
break;
|
||||
|
||||
uint32 TempDontSnareMeBefore = tar->DontSnareMeBefore();
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost, &TempDontSnareMeBefore);
|
||||
|
||||
|
||||
if(TempDontSnareMeBefore != tar->DontSnareMeBefore())
|
||||
tar->SetDontSnareMeBefore(TempDontSnareMeBefore);
|
||||
}
|
||||
@@ -679,19 +679,19 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
switch (botClass) {
|
||||
case ENCHANTER: {
|
||||
botSpell = GetBestBotSpellForMagicBasedSlow(this);
|
||||
break;
|
||||
}
|
||||
case SHAMAN:
|
||||
case SHAMAN:
|
||||
case BEASTLORD: {
|
||||
botSpell = GetBestBotSpellForDiseaseBasedSlow(this);
|
||||
|
||||
|
||||
if(botSpell.SpellId == 0 || ((tar->GetMR() - 50) < (tar->GetDR() + spells[botSpell.SpellId].ResistDiff)))
|
||||
botSpell = GetBestBotSpellForMagicBasedSlow(this);
|
||||
break;
|
||||
@@ -703,12 +703,12 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(!(!tar->IsImmuneToSpell(botSpell.SpellId, this) && tar->CanBuffStack(botSpell.SpellId, botLevel, true) >= 0))
|
||||
break;
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
|
||||
|
||||
if(castedSpell) {
|
||||
char* gmsg = 0;
|
||||
|
||||
|
||||
MakeAnyLenString(&gmsg, "Attempting to slow %s.", tar->GetCleanName());
|
||||
|
||||
if(gmsg && GetGroupMessagesOn())
|
||||
@@ -723,10 +723,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
botSpell = GetBestBotSpellForResistDebuff(this, tar);
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
@@ -749,7 +749,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
break;
|
||||
|
||||
|
||||
uint32 TempDontCureMeBeforeTime = tar->DontCureMeBefore();
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost, &TempDontCureMeBeforeTime);
|
||||
@@ -758,7 +758,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(botClass != BARD) {
|
||||
if(IsGroupSpell(botSpell.SpellId)){
|
||||
Group *g;
|
||||
|
||||
|
||||
if(this->HasGroup()) {
|
||||
Group *g = this->GetGroup();
|
||||
|
||||
@@ -814,8 +814,8 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
||||
float dist2 = 0;
|
||||
|
||||
if (AIspells[i].type & SpellType_Escape) {
|
||||
dist2 = 0;
|
||||
} else
|
||||
dist2 = 0;
|
||||
} else
|
||||
dist2 = DistNoRoot(*tar);
|
||||
|
||||
if (((((spells[AIspells[i].spellid].targettype==ST_GroupTeleport && AIspells[i].type==2)
|
||||
@@ -853,14 +853,14 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
||||
|
||||
bool Bot::AI_PursueCastCheck() {
|
||||
bool result = false;
|
||||
|
||||
|
||||
if (AIautocastspell_timer->Check(false)) {
|
||||
_ZP(Bot_AI_Process_pursue_cast);
|
||||
|
||||
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
|
||||
mlog(AI__SPELLS, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
|
||||
|
||||
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) {
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) {
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Nuke)) {
|
||||
@@ -873,12 +873,12 @@ bool Bot::AI_PursueCastCheck() {
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!AIautocastspell_timer->Enabled())
|
||||
AIautocastspell_timer->Start(RandomTimer(100, 250), false);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -892,10 +892,10 @@ bool Bot::AI_IdleCastCheck() {
|
||||
#endif
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
//Ok, IdleCastCheck depends of class.
|
||||
//Ok, IdleCastCheck depends of class.
|
||||
// Healers WITHOUT pets will check if a heal is needed before buffing.
|
||||
uint8 botClass = GetClass();
|
||||
|
||||
|
||||
if(botClass == CLERIC || botClass == PALADIN || botClass == RANGER) {
|
||||
if(!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Cure)) {
|
||||
if (!AICastSpell(this, 100, SpellType_Heal)) {
|
||||
@@ -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)) {
|
||||
@@ -930,24 +930,24 @@ bool Bot::AI_IdleCastCheck() {
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else if(botClass == BARD) {
|
||||
// bard bots
|
||||
if(!AICastSpell(this, 100, SpellType_Cure)) {
|
||||
if(!AICastSpell(this, 100, SpellType_Heal)) {
|
||||
if(!AICastSpell(this, 100, SpellType_Buff)) {
|
||||
//
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
if(!AIautocastspell_timer->Enabled())
|
||||
AIautocastspell_timer->Start(RandomTimer(1000, 5000), false);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1148,7 +1148,7 @@ bool Bot::AI_EngagedCastCheck() {
|
||||
failedToCast = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1172,7 +1172,7 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
|
||||
|
||||
if(!AI_HasSpells())
|
||||
return false;
|
||||
|
||||
|
||||
if(tar->GetAppearance() == eaDead) {
|
||||
if((tar->IsClient() && tar->CastToClient()->GetFeigned()) || tar->IsBot()) {
|
||||
// do nothing
|
||||
@@ -1321,7 +1321,7 @@ std::list<BotSpell> Bot::GetBotSpellsBySpellType(Bot* botCaster, uint16 spellTyp
|
||||
|
||||
BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1340,7 +1340,7 @@ BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForFastHeal(Bot *botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1376,7 +1376,7 @@ BotSpell Bot::GetBestBotSpellForFastHeal(Bot *botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1413,7 +1413,7 @@ BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1432,7 +1432,7 @@ BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1443,7 +1443,7 @@ BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1468,7 +1468,7 @@ BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1493,7 +1493,7 @@ BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1507,7 +1507,7 @@ BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1518,7 +1518,7 @@ BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1555,7 +1555,7 @@ BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1569,7 +1569,7 @@ BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1580,7 +1580,7 @@ BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1594,7 +1594,7 @@ BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1605,7 +1605,7 @@ BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForMagicBasedSlow(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1619,7 +1619,7 @@ BotSpell Bot::GetBestBotSpellForMagicBasedSlow(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1630,7 +1630,7 @@ BotSpell Bot::GetBestBotSpellForMagicBasedSlow(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForDiseaseBasedSlow(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1644,7 +1644,7 @@ BotSpell Bot::GetBestBotSpellForDiseaseBasedSlow(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1660,7 +1660,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) {
|
||||
|
||||
std::list<NPC*> npc_list;
|
||||
entity_list.GetNPCList(npc_list);
|
||||
|
||||
|
||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) {
|
||||
NPC* npc = *itr;
|
||||
|
||||
@@ -1691,7 +1691,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) {
|
||||
|
||||
BotSpell Bot::GetBestBotMagicianPetSpell(Bot *botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1753,7 +1753,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) {
|
||||
else if(botCaster->GetLevel() < 30) {
|
||||
// Under level 30
|
||||
int counter = MakeRandomInt(0, 3);
|
||||
|
||||
|
||||
switch(counter) {
|
||||
case 0:
|
||||
result = std::string("SumWater");
|
||||
@@ -1775,7 +1775,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) {
|
||||
else {
|
||||
// Over level 30
|
||||
int counter = MakeRandomInt(0, 4);
|
||||
|
||||
|
||||
switch(counter) {
|
||||
case 0:
|
||||
result = std::string("SumWater");
|
||||
@@ -1802,7 +1802,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType targetType) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1816,7 +1816,7 @@ BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1855,7 +1855,7 @@ BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType
|
||||
|
||||
BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* target) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1867,7 +1867,7 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ
|
||||
|
||||
if((target->GetMR() > maxTargetResistValue) && (target->GetCR() > maxTargetResistValue) && (target->GetFR() > maxTargetResistValue))
|
||||
selectLureNuke = true;
|
||||
|
||||
|
||||
|
||||
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffectAndTargetType(botCaster, SE_CurrentHP, ST_Target);
|
||||
|
||||
@@ -1885,18 +1885,18 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ
|
||||
spellSelected = true;
|
||||
}
|
||||
else if(IsPureNukeSpell(botSpellListItr->SpellId)) {
|
||||
if(((target->GetMR() < target->GetCR()) || (target->GetMR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_MAGIC)
|
||||
if(((target->GetMR() < target->GetCR()) || (target->GetMR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_MAGIC)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
{
|
||||
spellSelected = true;
|
||||
}
|
||||
else if(((target->GetCR() < target->GetMR()) || (target->GetCR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_COLD)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
else if(((target->GetCR() < target->GetMR()) || (target->GetCR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_COLD)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
{
|
||||
spellSelected = true;
|
||||
}
|
||||
else if(((target->GetFR() < target->GetCR()) || (target->GetFR() < target->GetMR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_FIRE)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
{
|
||||
spellSelected = true;
|
||||
}
|
||||
@@ -1927,7 +1927,7 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ
|
||||
|
||||
BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1945,14 +1945,14 @@ BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsDebuffSpell(botSpellList[i].spellid))
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsDebuffSpell(botSpellList[i].spellid))
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
&& CheckSpellRecastTimers(botCaster, i)) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1963,14 +1963,14 @@ BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
|
||||
if(!tar)
|
||||
return result;
|
||||
|
||||
|
||||
int level_mod = (tar->GetLevel() - botCaster->GetLevel())* (tar->GetLevel() - botCaster->GetLevel()) / 2;
|
||||
if(tar->GetLevel() - botCaster->GetLevel() < 0)
|
||||
{
|
||||
@@ -1981,7 +1981,7 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
bool needsFireResistDebuff = (tar->GetFR() + level_mod) > 100 ? true: false;
|
||||
bool needsPoisonResistDebuff = (tar->GetPR() + level_mod) > 100 ? true: false;
|
||||
bool needsDiseaseResistDebuff = (tar->GetDR() + level_mod) > 100 ? true: false;
|
||||
|
||||
|
||||
if(botCaster && botCaster->AI_HasSpells()) {
|
||||
std::vector<AISpells_Struct> botSpellList = botCaster->GetBotSpells();
|
||||
|
||||
@@ -1992,19 +1992,19 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsResistDebuffSpell(botSpellList[i].spellid))
|
||||
&& ((needsMagicResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistMagic)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsResistDebuffSpell(botSpellList[i].spellid))
|
||||
&& ((needsMagicResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistMagic)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsColdResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistCold)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsFireResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistFire)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsPoisonResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistPoison)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsDiseaseResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistDisease)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll)))
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
&& CheckSpellRecastTimers(botCaster, i)) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2016,14 +2016,14 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
BotSpell result;
|
||||
bool spellSelected = false;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
|
||||
if(!tar)
|
||||
return result;
|
||||
|
||||
|
||||
int countNeedsCured = 0;
|
||||
bool isPoisoned = tar->FindType(SE_PoisonCounter);
|
||||
bool isDiseased = tar->FindType(SE_DiseaseCounter);
|
||||
@@ -2032,7 +2032,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
|
||||
if(botCaster && botCaster->AI_HasSpells()) {
|
||||
std::list<BotSpell> cureList = GetBotSpellsBySpellType(botCaster, SpellType_Cure);
|
||||
|
||||
|
||||
if(tar->HasGroup()) {
|
||||
Group *g = tar->GetGroup();
|
||||
|
||||
@@ -2045,12 +2045,12 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Check for group cure first
|
||||
if(countNeedsCured > 2) {
|
||||
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
|
||||
BotSpell selectedBotSpell = *itr;
|
||||
|
||||
|
||||
if(IsGroupSpell(itr->SpellId) && CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
|
||||
if(selectedBotSpell.SpellId == 0)
|
||||
continue;
|
||||
@@ -2087,7 +2087,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
if(!spellSelected) {
|
||||
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
|
||||
BotSpell selectedBotSpell = *itr;
|
||||
|
||||
|
||||
if(CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
|
||||
if(selectedBotSpell.SpellId == 0)
|
||||
continue;
|
||||
@@ -2195,17 +2195,17 @@ void Bot::CalcChanceToCast() {
|
||||
_spellCastingChances[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BotStanceType botStance = GetBotStance();
|
||||
uint8 botClass = GetClass();
|
||||
bool isPrimaryHealer = false;
|
||||
bool isPrimarySlower = false;
|
||||
|
||||
|
||||
if(HasGroup()) {
|
||||
isPrimaryHealer = IsGroupPrimaryHealer();
|
||||
isPrimarySlower = IsGroupPrimarySlower();
|
||||
}
|
||||
|
||||
|
||||
//Nuke
|
||||
switch(botClass)
|
||||
{
|
||||
@@ -3187,7 +3187,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) {
|
||||
|
||||
if(GetBotStance() >= MaxStances)
|
||||
return 0;
|
||||
|
||||
|
||||
switch (spellType) {
|
||||
case SpellType_Nuke: {
|
||||
index = SpellType_NukeIndex;
|
||||
@@ -3217,7 +3217,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) {
|
||||
index = SpellType_LifetapIndex;
|
||||
break;
|
||||
}
|
||||
case SpellType_Snare: {
|
||||
case SpellType_Snare: {
|
||||
index = SpellType_SnareIndex;
|
||||
break;
|
||||
}
|
||||
@@ -3257,7 +3257,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) {
|
||||
|
||||
if(index >= MaxSpellTypes)
|
||||
return 0;
|
||||
|
||||
|
||||
chance = _spellCastingChances[botStance][index];
|
||||
|
||||
return chance;
|
||||
|
||||
+184
-184
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -129,7 +129,7 @@ enum {
|
||||
HideCorpseNPC = 5
|
||||
};
|
||||
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
Empty = 0,
|
||||
Auto = 1,
|
||||
@@ -167,8 +167,8 @@ struct XTarget_Struct
|
||||
uint16 ID;
|
||||
char Name[65];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const uint32 POPUPID_UPDATE_SHOWSTATSWINDOW = 1000000;
|
||||
|
||||
struct ClientReward
|
||||
@@ -389,7 +389,7 @@ public:
|
||||
inline virtual int16 GetPR() const { return PR; }
|
||||
inline virtual int16 GetCR() const { return CR; }
|
||||
inline virtual int16 GetCorrup() const { return Corrup; }
|
||||
|
||||
|
||||
int16 GetMaxStat() const;
|
||||
int16 GetMaxResist() const;
|
||||
int16 GetMaxSTR() const;
|
||||
@@ -442,15 +442,15 @@ public:
|
||||
inline virtual int16 GetSpellDmg() const { return itembonuses.SpellDmg; }
|
||||
inline virtual int16 GetClair() const { return itembonuses.Clairvoyance; }
|
||||
inline virtual int16 GetDSMit() const { return itembonuses.DSMitigation; }
|
||||
|
||||
|
||||
inline virtual int16 GetSingMod() const { return itembonuses.singingMod; }
|
||||
inline virtual int16 GetBrassMod() const { return itembonuses.brassMod; }
|
||||
inline virtual int16 GetPercMod() const { return itembonuses.percussionMod; }
|
||||
inline virtual int16 GetStringMod() const { return itembonuses.stringedMod; }
|
||||
inline virtual int16 GetWindMod() const { return itembonuses.windMod; }
|
||||
|
||||
|
||||
inline virtual int16 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; }
|
||||
|
||||
|
||||
int32 Additional_SpellDmg(uint16 spell_id, bool bufftick = false);
|
||||
int32 Additional_Heal(uint16 spell_id);
|
||||
float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false);
|
||||
@@ -489,7 +489,7 @@ public:
|
||||
int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen()
|
||||
int32 GetEndurance() const {return cur_end;} //This gets our current endurance
|
||||
int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call
|
||||
int32 CalcEnduranceRegenCap();
|
||||
int32 CalcEnduranceRegenCap();
|
||||
int32 CalcHPRegenCap();
|
||||
inline uint8 GetEndurancePercent() { return (uint8)((float)cur_end / (float)max_end * 100.0f); }
|
||||
void SetEndurance(int32 newEnd); //This sets the current endurance to the new value
|
||||
@@ -744,7 +744,7 @@ public:
|
||||
int16 acmod();
|
||||
|
||||
// Item methods
|
||||
uint32 NukeItem(uint32 itemnum, uint8 where_to_check =
|
||||
uint32 NukeItem(uint32 itemnum, uint8 where_to_check =
|
||||
(invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor));
|
||||
void SetTint(int16 slot_id, uint32 color);
|
||||
void SetTint(int16 slot_id, Color_Struct& color);
|
||||
@@ -967,7 +967,7 @@ public:
|
||||
|
||||
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); }
|
||||
|
||||
@@ -1170,12 +1170,12 @@ protected:
|
||||
int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat);
|
||||
void CalcEdibleBonuses(StatBonuses* newbon);
|
||||
void CalcAABonuses(StatBonuses* newbon);
|
||||
void ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon);
|
||||
void ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon);
|
||||
void MakeBuffFadePacket(uint16 spell_id, int slot_id, bool send_message = true);
|
||||
bool client_data_loaded;
|
||||
|
||||
int16 GetFocusEffect(focusType type, uint16 spell_id);
|
||||
int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id);
|
||||
int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id);
|
||||
|
||||
Mob* bind_sight_target;
|
||||
|
||||
@@ -1298,7 +1298,7 @@ private:
|
||||
uint16 CustomerID;
|
||||
uint32 account_creation;
|
||||
uint8 firstlogon;
|
||||
uint32 mercid; // current merc
|
||||
uint32 mercid; // current merc
|
||||
uint8 mercSlot; // selected merc slot
|
||||
bool Trader;
|
||||
bool Buyer;
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -32,9 +32,9 @@ void ClientLogs::subscribe(EQEMuLog::LogIDs id, Client *c) {
|
||||
return;
|
||||
if(c == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
//make sure they arnt allready subscribed.
|
||||
|
||||
|
||||
vector<Client *>::iterator cur,end;
|
||||
cur = entries[id].begin();
|
||||
end = entries[id].end();
|
||||
@@ -44,7 +44,7 @@ void ClientLogs::subscribe(EQEMuLog::LogIDs id, Client *c) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("%s has been subscribed to %d\n", c->GetName(), id);
|
||||
entries[id].push_back(c);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ void ClientLogs::unsubscribe(EQEMuLog::LogIDs id, Client *c) {
|
||||
return;
|
||||
if(c == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
vector<Client *>::iterator cur,end;
|
||||
cur = entries[id].begin();
|
||||
end = entries[id].end();
|
||||
|
||||
+7
-7
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -39,19 +39,19 @@ public:
|
||||
static void EQEmuIO_buf(EQEMuLog::LogIDs id, const char *buf, uint8 size, uint32 count);
|
||||
static void EQEmuIO_fmt(EQEMuLog::LogIDs id, const char *fmt, va_list ap);
|
||||
static void EQEmuIO_pva(EQEMuLog::LogIDs id, const char *prefix, const char *fmt, va_list ap);
|
||||
|
||||
|
||||
void subscribe(EQEMuLog::LogIDs id, Client *c);
|
||||
void unsubscribe(EQEMuLog::LogIDs id, Client *c);
|
||||
void subscribeAll(Client *c);
|
||||
void unsubscribeAll(Client *c);
|
||||
void clear(); //unsubscribes everybody
|
||||
|
||||
|
||||
void msg(EQEMuLog::LogIDs id, const char *buf);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
vector<Client *> entries[EQEMuLog::MaxLogID];
|
||||
|
||||
|
||||
static char _buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH+1];
|
||||
};
|
||||
|
||||
|
||||
+119
-119
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -39,9 +39,9 @@ int16 Client::GetMaxStat() const {
|
||||
return (RuleI(Character, StatCap));
|
||||
|
||||
int level = GetLevel();
|
||||
|
||||
|
||||
int16 base = 0;
|
||||
|
||||
|
||||
if (level < 61) {
|
||||
base = 255;
|
||||
}
|
||||
@@ -54,16 +54,16 @@ int16 Client::GetMaxStat() const {
|
||||
else {
|
||||
base = 330;
|
||||
}
|
||||
|
||||
|
||||
return(base);
|
||||
}
|
||||
|
||||
int16 Client::GetMaxResist() const
|
||||
int16 Client::GetMaxResist() const
|
||||
{
|
||||
int level = GetLevel();
|
||||
|
||||
int16 base = 500;
|
||||
|
||||
|
||||
if(level > 60)
|
||||
base += ((level - 60) * 5);
|
||||
|
||||
@@ -229,7 +229,7 @@ int32 Client::CalcHPRegenCap()
|
||||
int cap = RuleI(Character, ItemHealthRegenCap) + itembonuses.HeroicSTA/25;
|
||||
|
||||
cap += aabonuses.ItemHPRegenCap + spellbonuses.ItemHPRegenCap + itembonuses.ItemHPRegenCap;
|
||||
|
||||
|
||||
return (cap * RuleI(Character, HPRegenMultiplier) / 100);
|
||||
}
|
||||
|
||||
@@ -247,19 +247,19 @@ int32 Client::CalcMaxHP() {
|
||||
max_hp += spellbonuses.HP + aabonuses.HP;
|
||||
|
||||
max_hp += GroupLeadershipAAHealthEnhancement();
|
||||
|
||||
|
||||
max_hp += max_hp * (spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000;
|
||||
|
||||
|
||||
if (cur_hp > max_hp)
|
||||
cur_hp = max_hp;
|
||||
|
||||
|
||||
int hp_perc_cap = spellbonuses.HPPercCap;
|
||||
if(hp_perc_cap) {
|
||||
int curHP_cap = (max_hp * hp_perc_cap) / 100;
|
||||
if (cur_hp > curHP_cap)
|
||||
cur_hp = curHP_cap;
|
||||
}
|
||||
|
||||
|
||||
return max_hp;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ uint16 Mob::GetClassLevelFactor(){
|
||||
multiplier = 290;
|
||||
else if (mlevel < 70)
|
||||
multiplier = 300;
|
||||
else
|
||||
else
|
||||
multiplier = 311;
|
||||
break;
|
||||
}
|
||||
@@ -379,19 +379,19 @@ int32 Client::CalcBaseHP()
|
||||
SoDPost255 = 0;
|
||||
|
||||
int hp_factor = GetClassHPFactor();
|
||||
|
||||
|
||||
if (level < 41) {
|
||||
base_hp = (5 + (GetLevel() * hp_factor / 12) +
|
||||
base_hp = (5 + (GetLevel() * hp_factor / 12) +
|
||||
((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
|
||||
}
|
||||
else if (level < 81) {
|
||||
base_hp = (5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 90) +
|
||||
base_hp = (5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 90) +
|
||||
((NormalSTA - SoDPost255) * (GetLevel() - 40) * hp_factor / 1800));
|
||||
}
|
||||
else {
|
||||
base_hp = (5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 90) +
|
||||
else {
|
||||
base_hp = (5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 90) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 45));
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ int32 Client::CalcBaseHP()
|
||||
Post255 = (GetSTA()-255)/2;
|
||||
else
|
||||
Post255 = 0;
|
||||
|
||||
|
||||
base_hp = (5)+(GetLevel()*lm/10) + (((GetSTA()-Post255)*GetLevel()*lm/3000)) + ((Post255*GetLevel())*lm/6000);
|
||||
}
|
||||
return base_hp;
|
||||
@@ -420,7 +420,7 @@ uint32 Client::GetClassHPFactor() {
|
||||
// Base HP over level 80 is factor / 10
|
||||
// HP per STA point per level is factor / 30 for level 80+
|
||||
// HP per STA under level 40 is the level 80 HP Per STA / 120, and for over 40 it is / 60.
|
||||
|
||||
|
||||
switch(GetClass())
|
||||
{
|
||||
case DRUID:
|
||||
@@ -461,14 +461,14 @@ uint32 Client::GetClassHPFactor() {
|
||||
// This should return the combined AC of all the items the player is wearing.
|
||||
int16 Client::GetRawItemAC() {
|
||||
int16 Total = 0;
|
||||
|
||||
|
||||
for (int16 slot_id=0; slot_id<21; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if (inst && inst->IsType(ItemClassCommon)) {
|
||||
Total += inst->GetItem()->AC;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Total;
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ int16 Client::acmod() {
|
||||
int level = GetLevel();
|
||||
if(agility < 1 || level < 1)
|
||||
return(0);
|
||||
|
||||
|
||||
if (agility <=74){
|
||||
if (agility == 1)
|
||||
return -24;
|
||||
@@ -602,7 +602,7 @@ int16 Client::acmod() {
|
||||
return 27;
|
||||
else if (level <= 39)
|
||||
return 37;
|
||||
else
|
||||
else
|
||||
return 44;
|
||||
}
|
||||
else if (agility == 100 && level >= 7){
|
||||
@@ -872,7 +872,7 @@ int16 Client::CalcAC() {
|
||||
}
|
||||
int displayed = 0;
|
||||
displayed += ((avoidance+mitigation)*1000)/847; //natural AC
|
||||
|
||||
|
||||
//Iksar AC, untested
|
||||
if (GetRace() == IKSAR) {
|
||||
displayed += 12;
|
||||
@@ -883,20 +883,20 @@ int16 Client::CalcAC() {
|
||||
if (iksarlevel > 0)
|
||||
displayed += iksarlevel * 12 / 10;
|
||||
}
|
||||
|
||||
|
||||
// Shield AC bonus for HeroicSTR
|
||||
if(itembonuses.HeroicSTR) {
|
||||
bool equiped = CastToClient()->m_inv.GetItem(14);
|
||||
if(equiped) {
|
||||
uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType;
|
||||
if(shield == ItemTypeShield)
|
||||
if(shield == ItemTypeShield)
|
||||
displayed += itembonuses.HeroicSTR/2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//spell AC bonuses are added directly to natural total
|
||||
displayed += spellbonuses.AC;
|
||||
|
||||
|
||||
AC = displayed;
|
||||
return(AC);
|
||||
}
|
||||
@@ -907,19 +907,19 @@ int16 Client::GetACMit() {
|
||||
if (m_pp.class_ == WIZARD || m_pp.class_ == MAGICIAN || m_pp.class_ == NECROMANCER || m_pp.class_ == ENCHANTER) {
|
||||
mitigation = (GetSkill(DEFENSE) + itembonuses.HeroicAGI/10)/4 + (itembonuses.AC+1);
|
||||
mitigation -= 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mitigation = (GetSkill(DEFENSE) + itembonuses.HeroicAGI/10)/3 + ((itembonuses.AC*4)/3);
|
||||
if(m_pp.class_ == MONK)
|
||||
mitigation += GetLevel() * 13/10; //the 13/10 might be wrong, but it is close...
|
||||
}
|
||||
|
||||
|
||||
// Shield AC bonus for HeroicSTR
|
||||
if(itembonuses.HeroicSTR) {
|
||||
bool equiped = CastToClient()->m_inv.GetItem(14);
|
||||
if(equiped) {
|
||||
uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType;
|
||||
if(shield == ItemTypeShield)
|
||||
if(shield == ItemTypeShield)
|
||||
mitigation += itembonuses.HeroicSTR/2;
|
||||
}
|
||||
}
|
||||
@@ -932,7 +932,7 @@ int16 Client::GetACAvoid() {
|
||||
int avoidance = (acmod() + ((GetSkill(DEFENSE) + itembonuses.HeroicAGI/10)*16)/9);
|
||||
if (avoidance < 0)
|
||||
avoidance = 0;
|
||||
|
||||
|
||||
return(avoidance*1000/847);
|
||||
}
|
||||
|
||||
@@ -940,7 +940,7 @@ int32 Client::CalcMaxMana()
|
||||
{
|
||||
switch(GetCasterClass())
|
||||
{
|
||||
case 'I':
|
||||
case 'I':
|
||||
case 'W': {
|
||||
max_mana = (CalcBaseMana() + itembonuses.Mana + spellbonuses.Mana + GroupLeadershipAAManaEnhancement());
|
||||
break;
|
||||
@@ -958,18 +958,18 @@ int32 Client::CalcMaxMana()
|
||||
if (max_mana < 0) {
|
||||
max_mana = 0;
|
||||
}
|
||||
|
||||
|
||||
if (cur_mana > max_mana) {
|
||||
cur_mana = max_mana;
|
||||
}
|
||||
|
||||
|
||||
int mana_perc_cap = spellbonuses.ManaPercCap;
|
||||
if(mana_perc_cap) {
|
||||
int curMana_cap = (max_mana * mana_perc_cap) / 100;
|
||||
if (cur_mana > curMana_cap)
|
||||
cur_mana = curMana_cap;
|
||||
}
|
||||
|
||||
|
||||
#if EQDEBUG >= 11
|
||||
LogFile->write(EQEMuLog::Debug, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
|
||||
#endif
|
||||
@@ -986,11 +986,11 @@ int32 Client::CalcBaseMana()
|
||||
int ConvertedWisInt = 0;
|
||||
switch(GetCasterClass())
|
||||
{
|
||||
case 'I':
|
||||
case 'I':
|
||||
WisInt = GetINT();
|
||||
|
||||
if (GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
|
||||
|
||||
|
||||
if (WisInt > 100) {
|
||||
ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
|
||||
if (WisInt > 201) {
|
||||
@@ -1001,7 +1001,7 @@ int32 Client::CalcBaseMana()
|
||||
ConvertedWisInt = WisInt;
|
||||
}
|
||||
|
||||
if (GetLevel() < 41) {
|
||||
if (GetLevel() < 41) {
|
||||
wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
|
||||
base_mana = (GetLevel() * 15);
|
||||
}
|
||||
@@ -1045,7 +1045,7 @@ int32 Client::CalcBaseMana()
|
||||
ConvertedWisInt = WisInt;
|
||||
}
|
||||
|
||||
if (GetLevel() < 41) {
|
||||
if (GetLevel() < 41) {
|
||||
wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
|
||||
base_mana = (GetLevel() * 15);
|
||||
}
|
||||
@@ -1073,7 +1073,7 @@ int32 Client::CalcBaseMana()
|
||||
max_m = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'N': {
|
||||
max_m = 0;
|
||||
break;
|
||||
@@ -1091,11 +1091,11 @@ int32 Client::CalcBaseMana()
|
||||
return max_m;
|
||||
}
|
||||
|
||||
int32 Client::CalcBaseManaRegen()
|
||||
int32 Client::CalcBaseManaRegen()
|
||||
{
|
||||
uint8 clevel = GetLevel();
|
||||
int32 regen = 0;
|
||||
if (IsSitting() || (GetHorseId() != 0))
|
||||
if (IsSitting() || (GetHorseId() != 0))
|
||||
{
|
||||
if(HasSkill(MEDITATE))
|
||||
regen = (((GetSkill(MEDITATE) / 10) + (clevel - (clevel / 4))) / 4) + 4;
|
||||
@@ -1108,12 +1108,12 @@ int32 Client::CalcBaseManaRegen()
|
||||
return regen;
|
||||
}
|
||||
|
||||
int32 Client::CalcManaRegen()
|
||||
int32 Client::CalcManaRegen()
|
||||
{
|
||||
uint8 clevel = GetLevel();
|
||||
int32 regen = 0;
|
||||
//this should be changed so we dont med while camping, etc...
|
||||
if (IsSitting() || (GetHorseId() != 0))
|
||||
if (IsSitting() || (GetHorseId() != 0))
|
||||
{
|
||||
BuffFadeBySitModifier();
|
||||
if(HasSkill(MEDITATE)) {
|
||||
@@ -1129,7 +1129,7 @@ int32 Client::CalcManaRegen()
|
||||
this->medding = false;
|
||||
regen = 2 + spellbonuses.ManaRegen + itembonuses.ManaRegen;
|
||||
}
|
||||
|
||||
|
||||
//AAs
|
||||
regen += aabonuses.ManaRegen;
|
||||
|
||||
@@ -1141,10 +1141,10 @@ int32 Client::CalcManaRegenCap()
|
||||
int32 cap = RuleI(Character, ItemManaRegenCap) + aabonuses.ItemManaRegenCap;
|
||||
switch(GetCasterClass())
|
||||
{
|
||||
case 'I':
|
||||
case 'I':
|
||||
cap += (itembonuses.HeroicINT / 25);
|
||||
break;
|
||||
case 'W':
|
||||
case 'W':
|
||||
cap += (itembonuses.HeroicWIS / 25);
|
||||
break;
|
||||
}
|
||||
@@ -1225,39 +1225,39 @@ int16 Client::CalcAlcoholPhysicalEffect()
|
||||
|
||||
int16 Client::CalcSTR() {
|
||||
int16 val = m_pp.STR + itembonuses.STR + spellbonuses.STR + CalcAlcoholPhysicalEffect();
|
||||
|
||||
|
||||
int16 mod = aabonuses.STR;
|
||||
|
||||
|
||||
if(val>255 && GetLevel() <= 60)
|
||||
val = 255;
|
||||
STR = val + mod;
|
||||
|
||||
|
||||
if(STR < 1)
|
||||
STR = 1;
|
||||
|
||||
int m = GetMaxSTR();
|
||||
if(STR > m)
|
||||
STR = m;
|
||||
|
||||
|
||||
return(STR);
|
||||
}
|
||||
|
||||
int16 Client::CalcSTA() {
|
||||
int16 val = m_pp.STA + itembonuses.STA + spellbonuses.STA + CalcAlcoholPhysicalEffect();;
|
||||
|
||||
|
||||
int16 mod = aabonuses.STA;
|
||||
|
||||
|
||||
if(val>255 && GetLevel() <= 60)
|
||||
val = 255;
|
||||
STA = val + mod;
|
||||
|
||||
|
||||
if(STA < 1)
|
||||
STA = 1;
|
||||
|
||||
int m = GetMaxSTA();
|
||||
if(STA > m)
|
||||
STA = m;
|
||||
|
||||
|
||||
return(STA);
|
||||
}
|
||||
|
||||
@@ -1269,7 +1269,7 @@ int16 Client::CalcAGI() {
|
||||
val = 255;
|
||||
|
||||
int16 str = GetSTR();
|
||||
|
||||
|
||||
//Encumbered penalty
|
||||
if(weight > (str * 10)) {
|
||||
//AGI is halved when we double our weight, zeroed (defaults to 1) when we triple it. this includes AGI from AAs
|
||||
@@ -1285,26 +1285,26 @@ int16 Client::CalcAGI() {
|
||||
int m = GetMaxAGI();
|
||||
if(AGI > m)
|
||||
AGI = m;
|
||||
|
||||
|
||||
return(AGI);
|
||||
}
|
||||
|
||||
int16 Client::CalcDEX() {
|
||||
int16 val = m_pp.DEX + itembonuses.DEX + spellbonuses.DEX - CalcAlcoholPhysicalEffect();;
|
||||
|
||||
|
||||
int16 mod = aabonuses.DEX;
|
||||
|
||||
|
||||
if(val>255 && GetLevel() <= 60)
|
||||
val = 255;
|
||||
DEX = val + mod;
|
||||
|
||||
|
||||
if(DEX < 1)
|
||||
DEX = 1;
|
||||
|
||||
int m = GetMaxDEX();
|
||||
if(DEX > m)
|
||||
DEX = m;
|
||||
|
||||
|
||||
return(DEX);
|
||||
}
|
||||
|
||||
@@ -1312,11 +1312,11 @@ int16 Client::CalcINT() {
|
||||
int16 val = m_pp.INT + itembonuses.INT + spellbonuses.INT;
|
||||
|
||||
int16 mod = aabonuses.INT;
|
||||
|
||||
|
||||
if(val>255 && GetLevel() <= 60)
|
||||
val = 255;
|
||||
INT = val + mod;
|
||||
|
||||
|
||||
if(m_pp.intoxication)
|
||||
{
|
||||
int16 AlcINT = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1;
|
||||
@@ -1333,15 +1333,15 @@ int16 Client::CalcINT() {
|
||||
int m = GetMaxINT();
|
||||
if(INT > m)
|
||||
INT = m;
|
||||
|
||||
|
||||
return(INT);
|
||||
}
|
||||
|
||||
int16 Client::CalcWIS() {
|
||||
int16 val = m_pp.WIS + itembonuses.WIS + spellbonuses.WIS;
|
||||
|
||||
|
||||
int16 mod = aabonuses.WIS;
|
||||
|
||||
|
||||
if(val>255 && GetLevel() <= 60)
|
||||
val = 255;
|
||||
WIS = val + mod;
|
||||
@@ -1362,26 +1362,26 @@ int16 Client::CalcWIS() {
|
||||
int m = GetMaxWIS();
|
||||
if(WIS > m)
|
||||
WIS = m;
|
||||
|
||||
|
||||
return(WIS);
|
||||
}
|
||||
|
||||
int16 Client::CalcCHA() {
|
||||
int16 val = m_pp.CHA + itembonuses.CHA + spellbonuses.CHA;
|
||||
|
||||
|
||||
int16 mod = aabonuses.CHA;
|
||||
|
||||
|
||||
if(val>255 && GetLevel() <= 60)
|
||||
val = 255;
|
||||
CHA = val + mod;
|
||||
|
||||
|
||||
if(CHA < 1)
|
||||
CHA = 1;
|
||||
|
||||
int m = GetMaxCHA();
|
||||
if(CHA > m)
|
||||
CHA = m;
|
||||
|
||||
|
||||
return(CHA);
|
||||
}
|
||||
|
||||
@@ -1409,7 +1409,7 @@ int Client::CalcHaste() {
|
||||
} else {
|
||||
cap = RuleI(Character, HasteCap);
|
||||
}
|
||||
|
||||
|
||||
if(h > cap) h = cap;
|
||||
|
||||
h += spellbonuses.hastetype3;
|
||||
@@ -1419,14 +1419,14 @@ int Client::CalcHaste() {
|
||||
|
||||
if (spellbonuses.inhibitmelee){
|
||||
if (h >= 0)
|
||||
h -= spellbonuses.inhibitmelee;
|
||||
|
||||
else
|
||||
h -= spellbonuses.inhibitmelee;
|
||||
|
||||
else
|
||||
h -=((100+h)*spellbonuses.inhibitmelee/100);
|
||||
}
|
||||
|
||||
|
||||
Haste = h;
|
||||
return(Haste);
|
||||
return(Haste);
|
||||
}
|
||||
|
||||
//The AA multipliers are set to be 5, but were 2 on WR
|
||||
@@ -1487,12 +1487,12 @@ int16 Client::CalcMR()
|
||||
default:
|
||||
MR = 20;
|
||||
}
|
||||
|
||||
|
||||
MR += itembonuses.MR + spellbonuses.MR + aabonuses.MR;
|
||||
|
||||
|
||||
if(GetClass() == WARRIOR)
|
||||
MR += GetLevel() / 2;
|
||||
|
||||
|
||||
if(MR < 1)
|
||||
MR = 1;
|
||||
|
||||
@@ -1557,21 +1557,21 @@ int16 Client::CalcFR()
|
||||
default:
|
||||
FR = 20;
|
||||
}
|
||||
|
||||
|
||||
int c = GetClass();
|
||||
if(c == RANGER) {
|
||||
FR += 4;
|
||||
|
||||
|
||||
int l = GetLevel();
|
||||
if(l > 49)
|
||||
FR += l - 49;
|
||||
}
|
||||
|
||||
|
||||
FR += itembonuses.FR + spellbonuses.FR + aabonuses.FR;
|
||||
|
||||
|
||||
if(FR < 1)
|
||||
FR = 1;
|
||||
|
||||
|
||||
if(FR > GetMaxFR())
|
||||
FR = GetMaxFR();
|
||||
|
||||
@@ -1633,25 +1633,25 @@ int16 Client::CalcDR()
|
||||
default:
|
||||
DR = 15;
|
||||
}
|
||||
|
||||
|
||||
int c = GetClass();
|
||||
if(c == PALADIN) {
|
||||
DR += 8;
|
||||
|
||||
|
||||
int l = GetLevel();
|
||||
if(l > 49)
|
||||
DR += l - 49;
|
||||
|
||||
} else if(c == SHADOWKNIGHT) {
|
||||
DR += 4;
|
||||
|
||||
|
||||
int l = GetLevel();
|
||||
if(l > 49)
|
||||
DR += l - 49;
|
||||
}
|
||||
|
||||
|
||||
DR += itembonuses.DR + spellbonuses.DR + aabonuses.DR;
|
||||
|
||||
|
||||
if(DR < 1)
|
||||
DR = 1;
|
||||
|
||||
@@ -1716,25 +1716,25 @@ int16 Client::CalcPR()
|
||||
default:
|
||||
PR = 15;
|
||||
}
|
||||
|
||||
|
||||
int c = GetClass();
|
||||
if(c == ROGUE) {
|
||||
PR += 8;
|
||||
|
||||
|
||||
int l = GetLevel();
|
||||
if(l > 49)
|
||||
PR += l - 49;
|
||||
|
||||
} else if(c == SHADOWKNIGHT) {
|
||||
PR += 4;
|
||||
|
||||
|
||||
int l = GetLevel();
|
||||
if(l > 49)
|
||||
PR += l - 49;
|
||||
}
|
||||
|
||||
|
||||
PR += itembonuses.PR + spellbonuses.PR + aabonuses.PR;
|
||||
|
||||
|
||||
if(PR < 1)
|
||||
PR = 1;
|
||||
|
||||
@@ -1799,18 +1799,18 @@ int16 Client::CalcCR()
|
||||
default:
|
||||
CR = 25;
|
||||
}
|
||||
|
||||
|
||||
int c = GetClass();
|
||||
if(c == RANGER) {
|
||||
CR += 4;
|
||||
|
||||
|
||||
int l = GetLevel();
|
||||
if(l > 49)
|
||||
CR += l - 49;
|
||||
}
|
||||
|
||||
|
||||
CR += itembonuses.CR + spellbonuses.CR + aabonuses.CR;
|
||||
|
||||
|
||||
if(CR < 1)
|
||||
CR = 1;
|
||||
|
||||
@@ -1823,7 +1823,7 @@ int16 Client::CalcCR()
|
||||
int16 Client::CalcCorrup()
|
||||
{
|
||||
Corrup = GetBaseCorrup() + itembonuses.Corrup + spellbonuses.Corrup + aabonuses.Corrup;
|
||||
|
||||
|
||||
if(Corrup > GetMaxCorrup())
|
||||
Corrup = GetMaxCorrup();
|
||||
|
||||
@@ -1838,13 +1838,13 @@ int16 Client::CalcATK() {
|
||||
uint16 Mob::GetInstrumentMod(uint16 spell_id) const {
|
||||
if(GetClass() != BARD)
|
||||
return(10);
|
||||
|
||||
|
||||
uint16 effectmod = 10;
|
||||
|
||||
|
||||
//this should never use spell modifiers...
|
||||
//if a spell grants better modifers, they are copied into the item mods
|
||||
//because the spells are supposed to act just like having the intrument.
|
||||
|
||||
|
||||
//item mods are in 10ths of percent increases
|
||||
switch(spells[spell_id].skill) {
|
||||
case PERCUSSION_INSTRUMENTS:
|
||||
@@ -1899,7 +1899,7 @@ uint16 Mob::GetInstrumentMod(uint16 spell_id) const {
|
||||
effectmod = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(spells[spell_id].skill == SINGING)
|
||||
{
|
||||
effectmod += 2*GetAA(aaSingingMastery);
|
||||
@@ -1916,24 +1916,24 @@ uint16 Mob::GetInstrumentMod(uint16 spell_id) const {
|
||||
|
||||
if(effectmod < 10)
|
||||
effectmod = 10;
|
||||
|
||||
|
||||
_log(SPELLS__BARDS, "%s::GetInstrumentMod() spell=%d mod=%d\n", GetName(), spell_id, effectmod);
|
||||
|
||||
|
||||
return(effectmod);
|
||||
}
|
||||
|
||||
void Client::CalcMaxEndurance()
|
||||
{
|
||||
max_end = CalcBaseEndurance() + spellbonuses.Endurance + itembonuses.Endurance;
|
||||
|
||||
|
||||
if (max_end < 0) {
|
||||
max_end = 0;
|
||||
}
|
||||
|
||||
|
||||
if (cur_end > max_end) {
|
||||
cur_end = max_end;
|
||||
}
|
||||
|
||||
|
||||
int end_perc_cap = spellbonuses.EndPercCap;
|
||||
if(end_perc_cap) {
|
||||
int curEnd_cap = (max_end * end_perc_cap) / 100;
|
||||
@@ -1966,7 +1966,7 @@ int32 Client::CalcBaseEndurance()
|
||||
ConvertedStats = Stats;
|
||||
}
|
||||
|
||||
if (GetLevel() < 41) {
|
||||
if (GetLevel() < 41) {
|
||||
sta_end = (GetLevel() * 75 * ConvertedStats / 1000);
|
||||
base_endurance = (GetLevel() * 15);
|
||||
}
|
||||
@@ -1988,24 +1988,24 @@ int32 Client::CalcBaseEndurance()
|
||||
int at_most_800 = Stats;
|
||||
if(at_most_800 > 800)
|
||||
at_most_800 = 800;
|
||||
|
||||
|
||||
int Bonus400to800 = 0;
|
||||
int HalfBonus400to800 = 0;
|
||||
int Bonus800plus = 0;
|
||||
int HalfBonus800plus = 0;
|
||||
|
||||
|
||||
int BonusUpto800 = int( at_most_800 / 4 ) ;
|
||||
if(Stats > 400) {
|
||||
Bonus400to800 = int( (at_most_800 - 400) / 4 );
|
||||
HalfBonus400to800 = int( max( ( at_most_800 - 400 ), 0 ) / 8 );
|
||||
|
||||
|
||||
if(Stats > 800) {
|
||||
Bonus800plus = int( (Stats - 800) / 8 ) * 2;
|
||||
HalfBonus800plus = int( (Stats - 800) / 16 );
|
||||
}
|
||||
}
|
||||
int bonus_sum = BonusUpto800 + Bonus400to800 + HalfBonus400to800 + Bonus800plus + HalfBonus800plus;
|
||||
|
||||
|
||||
base_end = LevelBase;
|
||||
|
||||
//take all of the sums from above, then multiply by level*0.075
|
||||
@@ -2023,7 +2023,7 @@ int32 Client::CalcEnduranceRegen() {
|
||||
|
||||
int32 Client::CalcEnduranceRegenCap() {
|
||||
int cap = (RuleI(Character, ItemEnduranceRegenCap) + itembonuses.HeroicSTR/25 + itembonuses.HeroicDEX/25 + itembonuses.HeroicAGI/25 + itembonuses.HeroicSTA/25);
|
||||
|
||||
|
||||
return (cap * RuleI(Character, EnduranceRegenMultiplier) / 100);
|
||||
}
|
||||
|
||||
|
||||
@@ -4824,7 +4824,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app)
|
||||
void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app)
|
||||
{
|
||||
VERIFY_PACKET_LENGTH(OP_RezzAnswer, app, Resurrect_Struct);
|
||||
|
||||
|
||||
const Resurrect_Struct* ra = (const Resurrect_Struct*) app->pBuffer;
|
||||
|
||||
_log(SPELLS__REZ, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s",
|
||||
@@ -6742,7 +6742,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
|
||||
memberToDisband->CastToMerc()->Suspend();
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// ...but other members can only remove themselves
|
||||
group->DelMember(this,false);
|
||||
|
||||
@@ -13774,7 +13774,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app)
|
||||
std::list<MercStanceInfo> mercStanceList = zone->merc_stance_list[merc->GetMercTemplateID()];
|
||||
list<MercStanceInfo>::iterator iter = mercStanceList.begin();
|
||||
while(iter != mercStanceList.end()) {
|
||||
numStances++;
|
||||
numStances++;
|
||||
iter++;
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@
|
||||
void Handle_OP_AcceptNewTask(const EQApplicationPacket *app);
|
||||
void Handle_OP_CancelTask(const EQApplicationPacket *app);
|
||||
void Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app);
|
||||
void Handle_OP_KeyRing(const EQApplicationPacket *app);
|
||||
void Handle_OP_KeyRing(const EQApplicationPacket *app);
|
||||
void Handle_OP_FriendsWho(const EQApplicationPacket *app);
|
||||
void Handle_OP_Bandolier(const EQApplicationPacket *app);
|
||||
void Handle_OP_PopupResponse(const EQApplicationPacket *app);
|
||||
@@ -247,7 +247,7 @@
|
||||
void Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *app);
|
||||
void Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app);
|
||||
void Handle_OP_AdventureStatsRequest(const EQApplicationPacket *app);
|
||||
void Handle_OP_AdventureLeaderboardRequest(const EQApplicationPacket *app);
|
||||
void Handle_OP_AdventureLeaderboardRequest(const EQApplicationPacket *app);
|
||||
void Handle_OP_RespawnWindow(const EQApplicationPacket *app);
|
||||
void Handle_OP_GroupUpdate(const EQApplicationPacket *app);
|
||||
void Handle_OP_SetStartCity(const EQApplicationPacket *app);
|
||||
|
||||
+104
-104
@@ -1,20 +1,20 @@
|
||||
/* 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
|
||||
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
|
||||
|
||||
|
||||
client_process.cpp:
|
||||
Handles client login sequence and packets sent from client to zone
|
||||
*/
|
||||
@@ -87,7 +87,7 @@ bool Client::Process() {
|
||||
if(!IsLD() && zoneinpacket_timer.Check()){
|
||||
SendAllPackets();
|
||||
}
|
||||
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
update_manager.Process();
|
||||
#endif
|
||||
@@ -146,12 +146,12 @@ bool Client::Process() {
|
||||
if(RespawnFromHoverTimer.Check())
|
||||
HandleRespawnFromHover(0);
|
||||
}
|
||||
|
||||
|
||||
if(IsTracking() && (GetClientVersion() >= EQClientSoD) && TrackingTimer.Check())
|
||||
DoTracking();
|
||||
|
||||
if(hpupdate_timer.Check())
|
||||
SendHPUpdate();
|
||||
SendHPUpdate();
|
||||
|
||||
if(mana_timer.Check())
|
||||
SendManaUpdatePacket();
|
||||
@@ -163,7 +163,7 @@ bool Client::Process() {
|
||||
m_pp.y = m_pp.binds[0].y;
|
||||
m_pp.z = m_pp.binds[0].z;
|
||||
Save();
|
||||
|
||||
|
||||
Group *mygroup = GetGroup();
|
||||
if (mygroup) // && zone.GetZoneID() != m_pp.binds[0].zoneId
|
||||
{
|
||||
@@ -177,7 +177,7 @@ bool Client::Process() {
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
if(charm_update_timer.Check())
|
||||
{
|
||||
CalcItemScale();
|
||||
@@ -212,12 +212,12 @@ bool Client::Process() {
|
||||
}
|
||||
instalog = true;
|
||||
}
|
||||
|
||||
|
||||
if (IsStunned() && stunned_timer.Check()) {
|
||||
this->stunned = false;
|
||||
this->stunned_timer.Disable();
|
||||
}
|
||||
|
||||
|
||||
if(!m_CheatDetectMoved)
|
||||
{
|
||||
m_TimeSinceLastPositionCheck = Timer::GetCurrentTime();
|
||||
@@ -232,7 +232,7 @@ bool Client::Process() {
|
||||
} else {
|
||||
song_target = entity_list.GetMob(bardsong_target_id);
|
||||
}
|
||||
|
||||
|
||||
if (song_target == nullptr) {
|
||||
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
|
||||
} else {
|
||||
@@ -253,10 +253,10 @@ bool Client::Process() {
|
||||
CheckMercSuspendTimer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(IsAIControlled())
|
||||
AI_Process();
|
||||
|
||||
|
||||
if (bindwound_timer.Check() && bindwound_target != 0) {
|
||||
BindWound(bindwound_target, false);
|
||||
}
|
||||
@@ -277,7 +277,7 @@ bool Client::Process() {
|
||||
qGlobals->PurgeExpiredGlobals();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool may_use_attacks = false;
|
||||
/*
|
||||
Things which prevent us from attacking:
|
||||
@@ -290,11 +290,11 @@ bool Client::Process() {
|
||||
*/
|
||||
if(auto_attack) {
|
||||
if(!IsAIControlled() && !dead
|
||||
&& !(spellend_timer.Enabled() && (spells[casting_spell_id].classes[7] < 1 && spells[casting_spell_id].classes[7] > 65))
|
||||
&& !(spellend_timer.Enabled() && (spells[casting_spell_id].classes[7] < 1 && spells[casting_spell_id].classes[7] > 65))
|
||||
&& !IsStunned() && !IsFeared() && !IsMezzed() && GetAppearance() != eaDead && !IsMeleeDisabled()
|
||||
)
|
||||
may_use_attacks = true;
|
||||
|
||||
|
||||
if(may_use_attacks && ranged_timer.Enabled()) {
|
||||
//if the range timer is enabled, we need to consider it
|
||||
if(!ranged_timer.Check(false)) {
|
||||
@@ -342,13 +342,13 @@ bool Client::Process() {
|
||||
}
|
||||
else
|
||||
ranged_timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Mob *auto_attack_target = GetTarget();
|
||||
if (auto_attack && auto_attack_target != nullptr && may_use_attacks && attack_timer.Check())
|
||||
if (auto_attack && auto_attack_target != nullptr && may_use_attacks && attack_timer.Check())
|
||||
{
|
||||
//check if change
|
||||
//only check on primary attack.. sorry offhand you gotta wait!
|
||||
@@ -390,18 +390,18 @@ bool Client::Process() {
|
||||
los_status = false;
|
||||
}
|
||||
|
||||
if (!CombatRange(auto_attack_target))
|
||||
if (!CombatRange(auto_attack_target))
|
||||
{
|
||||
//duplicate message not wanting to see it.
|
||||
//Message_StringID(MT_TooFarAway,TARGET_TOO_FAR);
|
||||
}
|
||||
else if (auto_attack_target == this)
|
||||
else if (auto_attack_target == this)
|
||||
{
|
||||
Message_StringID(MT_TooFarAway,TRY_ATTACKING_SOMEONE);
|
||||
}
|
||||
else if (!los_status)
|
||||
{
|
||||
//you can't see your target
|
||||
//you can't see your target
|
||||
}
|
||||
else if (auto_attack_target->GetHP() > -10) // -10 so we can watch people bleed in PvP
|
||||
{
|
||||
@@ -413,10 +413,10 @@ bool Client::Process() {
|
||||
}
|
||||
ItemInst *wpn = GetInv().GetItem(SLOT_PRIMARY);
|
||||
TryWeaponProc(wpn, auto_attack_target, 13);
|
||||
|
||||
|
||||
bool tripleAttackSuccess = false;
|
||||
if( auto_attack_target && CanThisClassDoubleAttack() ) {
|
||||
|
||||
|
||||
CheckIncreaseSkill(DOUBLE_ATTACK, auto_attack_target, -10);
|
||||
if(CheckDoubleAttack()) {
|
||||
//should we allow rampage on double attack?
|
||||
@@ -426,7 +426,7 @@ bool Client::Process() {
|
||||
Attack(auto_attack_target, 13, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//triple attack: rangers, monks, warriors, berserkers over level 60
|
||||
if((((GetClass() == MONK || GetClass() == WARRIOR || GetClass() == RANGER || GetClass() == BERSERKER)
|
||||
&& GetLevel() >= 60) || SpecAttacks[SPECATK_TRIPLE])
|
||||
@@ -435,33 +435,33 @@ bool Client::Process() {
|
||||
tripleAttackSuccess = true;
|
||||
Attack(auto_attack_target, 13, false);
|
||||
}
|
||||
|
||||
|
||||
//quad attack, does this belong here??
|
||||
if(SpecAttacks[SPECATK_QUAD] && CheckDoubleAttack(true))
|
||||
if(SpecAttacks[SPECATK_QUAD] && CheckDoubleAttack(true))
|
||||
{
|
||||
Attack(auto_attack_target, 13, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Live AA - Flurry, Rapid Strikes ect (Flurry does not require Triple Attack).
|
||||
int16 flurrychance = aabonuses.FlurryChance + spellbonuses.FlurryChance + itembonuses.FlurryChance;
|
||||
|
||||
if (auto_attack_target && flurrychance)
|
||||
{
|
||||
if(MakeRandomInt(0, 100) < flurrychance)
|
||||
if(MakeRandomInt(0, 100) < flurrychance)
|
||||
{
|
||||
Message_StringID(MT_NPCFlurry, 128);
|
||||
Attack(auto_attack_target, 13, false);
|
||||
Attack(auto_attack_target, 13, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int16 ExtraAttackChanceBonus = spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance;
|
||||
|
||||
if (auto_attack_target && ExtraAttackChanceBonus) {
|
||||
ItemInst *wpn = GetInv().GetItem(SLOT_PRIMARY);
|
||||
if(wpn){
|
||||
if(wpn->GetItem()->ItemType == ItemType2HS ||
|
||||
if(wpn->GetItem()->ItemType == ItemType2HS ||
|
||||
wpn->GetItem()->ItemType == ItemType2HB ||
|
||||
wpn->GetItem()->ItemType == ItemType2HPierce )
|
||||
{
|
||||
@@ -474,7 +474,7 @@ bool Client::Process() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GetClass() == WARRIOR || GetClass() == BERSERKER) {
|
||||
if(!dead && !berserk && this->GetHPRatio() < 30) {
|
||||
entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName());
|
||||
@@ -485,10 +485,10 @@ bool Client::Process() {
|
||||
this->berserk = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(auto_attack && may_use_attacks && auto_attack_target != nullptr
|
||||
&& CanThisClassDualWield() && attack_dw_timer.Check())
|
||||
{
|
||||
&& CanThisClassDualWield() && attack_dw_timer.Check())
|
||||
{
|
||||
// Range check
|
||||
if(!CombatRange(auto_attack_target)) {
|
||||
// this is a duplicate message don't use it.
|
||||
@@ -500,11 +500,11 @@ bool Client::Process() {
|
||||
}
|
||||
else if (!los_status)
|
||||
{
|
||||
//you can't see your target
|
||||
//you can't see your target
|
||||
}
|
||||
else if(auto_attack_target->GetHP() > -10) {
|
||||
float DualWieldProbability = 0.0f;
|
||||
|
||||
|
||||
int16 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity;
|
||||
DualWieldProbability = (GetSkill(DUAL_WIELD) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max
|
||||
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
||||
@@ -520,7 +520,7 @@ bool Client::Process() {
|
||||
}
|
||||
ItemInst *wpn = GetInv().GetItem(SLOT_SECONDARY);
|
||||
TryWeaponProc(wpn, auto_attack_target, 14);
|
||||
|
||||
|
||||
if( CanThisClassDoubleAttack() && CheckDoubleAttack()) {
|
||||
if(CheckAAEffect(aaEffectRampage)) {
|
||||
entity_list.AEAttack(this, 30, 14);
|
||||
@@ -532,7 +532,7 @@ bool Client::Process() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
adverrorinfo = 2;
|
||||
if (position_timer.Check()) {
|
||||
if (IsAIControlled())
|
||||
@@ -548,7 +548,7 @@ bool Client::Process() {
|
||||
SendPosUpdate(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send a position packet every 8 seconds - if not done, other clients
|
||||
// see this char disappear after 10-12 seconds of inactivity
|
||||
if (position_timer_counter >= 36) { // Approx. 4 ticks per second
|
||||
@@ -562,7 +562,7 @@ bool Client::Process() {
|
||||
position_timer_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(HasVirus()) {
|
||||
if(viral_timer.Check()) {
|
||||
viral_timer_counter++;
|
||||
@@ -577,7 +577,7 @@ bool Client::Process() {
|
||||
if(viral_timer_counter > 999)
|
||||
viral_timer_counter = 0;
|
||||
}
|
||||
|
||||
|
||||
if(spellbonuses.GravityEffect == 1) {
|
||||
if(gravity_timer.Check())
|
||||
DoGravityEffect();
|
||||
@@ -608,7 +608,7 @@ bool Client::Process() {
|
||||
shield_timer.Disable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
adverrorinfo = 3;
|
||||
SpellProcess();
|
||||
adverrorinfo = 4;
|
||||
@@ -627,15 +627,15 @@ bool Client::Process() {
|
||||
DoEnduranceRegen();
|
||||
BuffProcess();
|
||||
DoStaminaUpdate();
|
||||
|
||||
|
||||
if(tribute_timer.Check()) {
|
||||
ToggleTribute(true); //re-activate the tribute.
|
||||
}
|
||||
|
||||
|
||||
if (fishing_timer.Check()) {
|
||||
GoFish();
|
||||
}
|
||||
|
||||
|
||||
if (autosave_timer.Check()) {
|
||||
Save(0);
|
||||
}
|
||||
@@ -652,27 +652,27 @@ bool Client::Process() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (client_state == CLIENT_KICKED) {
|
||||
Save();
|
||||
OnDisconnect(true);
|
||||
cout << "Client disconnected (cs=k): " << GetName() << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (client_state == DISCONNECTED) {
|
||||
OnDisconnect(true);
|
||||
cout << "Client disconnected (cs=d): " << GetName() << endl;
|
||||
database.SetMQDetectionFlag(this->AccountName(), GetName(), "/MQInstantCamp: Possible instant camp disconnect.", zone->GetShortName());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (client_state == CLIENT_ERROR) {
|
||||
OnDisconnect(true);
|
||||
cout << "Client disconnected (cs=e): " << GetName() << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
|
||||
OnDisconnect(true);
|
||||
cout << "Client linkdead: " << name << endl;
|
||||
@@ -696,14 +696,14 @@ bool Client::Process() {
|
||||
|
||||
/************ Get all packets from packet manager out queue and process them ************/
|
||||
adverrorinfo = 5;
|
||||
|
||||
|
||||
EQApplicationPacket *app = 0;
|
||||
// if(eqs->GetState()==CLOSING && eqs->CheckActive())
|
||||
if(eqs->CheckState(CLOSING))
|
||||
{
|
||||
//eqs->Close();
|
||||
//return false;
|
||||
//handled below
|
||||
//handled below
|
||||
} else {
|
||||
while(ret && (app = (EQApplicationPacket *)eqs->PopPacket())) {
|
||||
if(app)
|
||||
@@ -711,7 +711,7 @@ bool Client::Process() {
|
||||
safe_delete(app);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef REVERSE_AGGRO
|
||||
//At this point, we are still connected, everything important has taken
|
||||
//place, now check to see if anybody wants to aggro us.
|
||||
@@ -719,8 +719,8 @@ bool Client::Process() {
|
||||
if(ret && !GetFeigned() && scanarea_timer.Check()) {
|
||||
entity_list.CheckClientAggro(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (client_state != CLIENT_LINKDEAD && (client_state == CLIENT_ERROR || client_state == DISCONNECTED || client_state == CLIENT_KICKED || !eqs->CheckState(ESTABLISHED))) {
|
||||
//client logged out or errored out
|
||||
//ResetTrade();
|
||||
@@ -747,7 +747,7 @@ bool Client::Process() {
|
||||
entity_list.MessageGroup(this,true,15,"%s left the zone.",GetName());
|
||||
mygroup->MemberZoned(this);
|
||||
}
|
||||
|
||||
|
||||
adverrorinfo = 813;
|
||||
}
|
||||
Raid *myraid = entity_list.GetRaidByClient(this);
|
||||
@@ -778,7 +778,7 @@ bool Client::Process() {
|
||||
entity_list.ClearZoneFeignAggro(this);
|
||||
Message(0,"Your enemies have forgotten you!");
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -819,10 +819,10 @@ void Client::OnDisconnect(bool hard_disconnect) {
|
||||
|
||||
//remove ourself from all proximities
|
||||
ClearAllProximities();
|
||||
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply);
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ void Client::BulkSendInventoryItems() {
|
||||
|
||||
// Where are cursor buffer items processed? They need to be validated as well... -U
|
||||
|
||||
bool deletenorent = database.NoRentExpired(GetName());
|
||||
bool deletenorent = database.NoRentExpired(GetName());
|
||||
if(deletenorent){ RemoveNoRent(false); } //client was offline for more than 30 minutes, delete no rent items
|
||||
|
||||
RemoveDuplicateLore(false);
|
||||
@@ -893,7 +893,7 @@ void Client::BulkSendInventoryItems() {
|
||||
}
|
||||
|
||||
// Power Source
|
||||
if(GetClientVersion() >= EQClientSoF) {
|
||||
if(GetClientVersion() >= EQClientSoF) {
|
||||
const ItemInst* inst = m_inv[9999];
|
||||
if(inst) {
|
||||
string packet = inst->Serialize(9999);
|
||||
@@ -957,7 +957,7 @@ void Client::BulkSendInventoryItems()
|
||||
SendItemPacket(slot_id, inst, ItemPacketCharInventory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Shared Bank items
|
||||
for (slot_id=2500; slot_id<=2501; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
@@ -965,7 +965,7 @@ void Client::BulkSendInventoryItems()
|
||||
SendItemPacket(slot_id, inst, ItemPacketCharInventory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
@@ -1008,9 +1008,9 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
|
||||
if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
handychance = MakeRandomInt(0, merlist.size() + tmp_merlist.size() - 1 );
|
||||
|
||||
|
||||
item = database.GetItem(ml.item);
|
||||
if(item) {
|
||||
if(handychance==0)
|
||||
@@ -1101,15 +1101,15 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
|
||||
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
|
||||
Message_StringID(10,GENERIC_STRINGID_SAY,merch->GetCleanName(),handy_id,this->GetName());
|
||||
|
||||
|
||||
merch->CastToNPC()->FaceTarget(this->CastToMob());
|
||||
}
|
||||
|
||||
|
||||
// safe_delete_array(cpi);
|
||||
}
|
||||
|
||||
@@ -1149,10 +1149,10 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
|
||||
|
||||
if (Action == 1)
|
||||
{
|
||||
// Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the
|
||||
// Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the
|
||||
// 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",
|
||||
_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);
|
||||
|
||||
@@ -1168,7 +1168,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
|
||||
SetMana(GetMaxMana());
|
||||
SetHP(GetMaxHP());
|
||||
}
|
||||
if(spells[SpellID].base[0] < 100 && spells[SpellID].base[0] > 0 && PendingRezzXP > 0)
|
||||
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);
|
||||
@@ -1177,7 +1177,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
|
||||
SetEXP((GetEXP() + PendingRezzXP), GetAAXP(), true);
|
||||
}
|
||||
|
||||
//Was sending the packet back to initiate client zone...
|
||||
//Was sending the packet back to initiate client zone...
|
||||
//but that could be abusable, so lets go through proper channels
|
||||
MovePC(ZoneID, InstanceID, x, y, z, GetHeading(), 0, ZoneSolicited);
|
||||
entity_list.RefreshClientXTargets(this);
|
||||
@@ -1206,9 +1206,9 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const MemorizeSpell_Struct* memspell = (const MemorizeSpell_Struct*) app->pBuffer;
|
||||
|
||||
|
||||
if(!IsValidSpell(memspell->spell_id))
|
||||
{
|
||||
Message(13, "Unexpected error: spell id out of range");
|
||||
@@ -1235,13 +1235,13 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
if(inst && inst->IsType(ItemClassCommon))
|
||||
{
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
|
||||
|
||||
if(item && item->Scroll.Effect == (int32)(memspell->spell_id))
|
||||
{
|
||||
ScribeSpell(memspell->spell_id, memspell->slot);
|
||||
DeleteItemInInventory(SLOT_CURSOR, 1, true);
|
||||
}
|
||||
else
|
||||
else
|
||||
Message(0,"Scribing spell: inst exists but item does not or spell ids do not match.");
|
||||
}
|
||||
else
|
||||
@@ -1333,7 +1333,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
{
|
||||
case -1: // destroy
|
||||
{
|
||||
// I don't think you can move coin from the void,
|
||||
// I don't think you can move coin from the void,
|
||||
// but need to check this
|
||||
break;
|
||||
}
|
||||
@@ -1374,7 +1374,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
if(!banker || distance > USE_NPC_RANGE2)
|
||||
{
|
||||
char *hacked_string = nullptr;
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(coin move) but %s is non-existant or too far away (%u units).",
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(coin move) but %s is non-existant or too far away (%u units).",
|
||||
banker ? banker->GetName() : "UNKNOWN NPC", distance);
|
||||
database.SetMQDetectionFlag(AccountName(), GetName(), hacked_string, zone->GetShortName());
|
||||
safe_delete_array(hacked_string);
|
||||
@@ -1406,7 +1406,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
if(!banker || distance > USE_NPC_RANGE2)
|
||||
{
|
||||
char *hacked_string = nullptr;
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(shared coin move) but %s is non-existant or too far away (%u units).",
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(shared coin move) but %s is non-existant or too far away (%u units).",
|
||||
banker ? banker->GetName() : "UNKNOWN NPC", distance);
|
||||
database.SetMQDetectionFlag(AccountName(), GetName(), hacked_string, zone->GetShortName());
|
||||
safe_delete_array(hacked_string);
|
||||
@@ -1462,7 +1462,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
if(!banker || distance > USE_NPC_RANGE2)
|
||||
{
|
||||
char *hacked_string = nullptr;
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(coin move) but %s is non-existant or too far away (%u units).",
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(coin move) but %s is non-existant or too far away (%u units).",
|
||||
banker ? banker->GetName() : "UNKNOWN NPC", distance);
|
||||
database.SetMQDetectionFlag(AccountName(), GetName(), hacked_string, zone->GetShortName());
|
||||
safe_delete_array(hacked_string);
|
||||
@@ -1506,7 +1506,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
if(!banker || distance > USE_NPC_RANGE2)
|
||||
{
|
||||
char *hacked_string = nullptr;
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(shared coin move) but %s is non-existant or too far away (%u units).",
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(shared coin move) but %s is non-existant or too far away (%u units).",
|
||||
banker ? banker->GetName() : "UNKNOWN NPC", distance);
|
||||
database.SetMQDetectionFlag(AccountName(), GetName(), hacked_string, zone->GetShortName());
|
||||
safe_delete_array(hacked_string);
|
||||
@@ -1555,7 +1555,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
{
|
||||
if (to_bucket == &m_pp.platinum_shared || from_bucket == &m_pp.platinum_shared)
|
||||
{
|
||||
if (from_bucket == &m_pp.platinum_shared)
|
||||
if (from_bucket == &m_pp.platinum_shared)
|
||||
amount_to_add = 0 - amount_to_take;
|
||||
|
||||
database.SetSharedPlatinum(AccountID(),amount_to_add);
|
||||
@@ -1572,7 +1572,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
Mob* with = trade->With();
|
||||
if (with)
|
||||
with->trade->state = Trading;
|
||||
|
||||
|
||||
Client* recipient = trader->CastToClient();
|
||||
recipient->Message(15, "%s adds some coins to the trade.", GetName());
|
||||
recipient->Message(15, "The total trade is: %i PP, %i GP, %i SP, %i CP",
|
||||
@@ -1604,12 +1604,12 @@ void Client::OPGMTraining(const EQApplicationPacket *app)
|
||||
|
||||
if(!pTrainer || !pTrainer->IsNPC() || pTrainer->GetClass() < WARRIORGM || pTrainer->GetClass() > BERSERKERGM)
|
||||
return;
|
||||
|
||||
|
||||
//you can only use your own trainer, client enforces this, but why trust it
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if(GetClass() != trains_class)
|
||||
return;
|
||||
|
||||
|
||||
//you have to be somewhat close to a trainer to be properly using them
|
||||
if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2)
|
||||
return;
|
||||
@@ -1619,12 +1619,12 @@ void Client::OPGMTraining(const EQApplicationPacket *app)
|
||||
if(sk == TINKERING && GetRace() != GNOME) {
|
||||
gmtrain->skills[sk] = 0; //Non gnomes can't tinker!
|
||||
} else {
|
||||
gmtrain->skills[sk] = GetMaxSkillAfterSpecializationRules(sk, MaxSkill(sk, GetClass(), RuleI(Character, MaxLevel)));
|
||||
gmtrain->skills[sk] = GetMaxSkillAfterSpecializationRules(sk, MaxSkill(sk, GetClass(), RuleI(Character, MaxLevel)));
|
||||
//this is the highest level that the trainer can train you to, this is enforced clientside so we can't just
|
||||
//Set it to 1 with CanHaveSkill or you wont be able to train past 1.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uchar ending[]={0x34,0x87,0x8a,0x3F,0x01
|
||||
,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9
|
||||
,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9
|
||||
@@ -1649,7 +1649,7 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app)
|
||||
Mob* pTrainer = entity_list.GetMob(p->npcid);
|
||||
if(!pTrainer || !pTrainer->IsNPC() || pTrainer->GetClass() < WARRIORGM || pTrainer->GetClass() > BERSERKERGM)
|
||||
return;
|
||||
|
||||
|
||||
//you can only use your own trainer, client enforces this, but why trust it
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if(GetClass() != trains_class)
|
||||
@@ -1658,7 +1658,7 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app)
|
||||
//you have to be somewhat close to a trainer to be properly using them
|
||||
if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2)
|
||||
return;
|
||||
|
||||
|
||||
// goodbye message
|
||||
if (pTrainer->IsNPC())
|
||||
{
|
||||
@@ -1759,7 +1759,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
int MaxSkillValue = MaxSkill(skill);
|
||||
if (skilllevel >= MaxSkillValue)
|
||||
{
|
||||
@@ -1767,7 +1767,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(gmskill->skill_id >= SPECIALIZE_ABJURE && gmskill->skill_id <= SPECIALIZE_EVOCATION)
|
||||
{
|
||||
int MaxSpecSkill = GetMaxSkillAfterSpecializationRules(skill, MaxSkillValue);
|
||||
@@ -1886,16 +1886,16 @@ void Client::DoHPRegen() {
|
||||
void Client::DoManaRegen() {
|
||||
if (GetMana() >= max_mana)
|
||||
return;
|
||||
|
||||
|
||||
SetMana(GetMana() + CalcManaRegen() + RestRegenMana);
|
||||
SendManaUpdatePacket();
|
||||
}
|
||||
|
||||
|
||||
void Client::DoStaminaUpdate() {
|
||||
void Client::DoStaminaUpdate() {
|
||||
if(!stamina_timer.Check())
|
||||
return;
|
||||
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
||||
Stamina_Struct* sta = (Stamina_Struct*)outapp->pBuffer;
|
||||
|
||||
@@ -1948,7 +1948,7 @@ void Client::DoEnduranceUpkeep() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(upkeep_sum != 0)
|
||||
SetEndurance(GetEndurance() - upkeep_sum);
|
||||
}
|
||||
@@ -1982,7 +1982,7 @@ void Client::CalcRestState() {
|
||||
RestRegenHP = (GetMaxHP() * RuleI(Character, RestRegenPercent) / 100);
|
||||
|
||||
RestRegenMana = (GetMaxMana() * RuleI(Character, RestRegenPercent) / 100);
|
||||
|
||||
|
||||
if(RuleB(Character, RestRegenEndurance))
|
||||
RestRegenEndurance = (GetMaxEndurance() * RuleI(Character, RestRegenPercent) / 100);
|
||||
}
|
||||
@@ -2066,7 +2066,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10);
|
||||
ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;
|
||||
|
||||
|
||||
gmg->bind_zone_id = zone->GetZoneID();
|
||||
gmg->bind_instance_id = zone->GetInstanceID();
|
||||
gmg->x = GetX();
|
||||
@@ -2101,7 +2101,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 14);
|
||||
ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;
|
||||
|
||||
|
||||
gmg->bind_zone_id = m_pp.binds[0].zoneId;
|
||||
gmg->x = m_pp.binds[0].x;
|
||||
gmg->y = m_pp.binds[0].y;
|
||||
@@ -2133,7 +2133,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
|
||||
if(g)
|
||||
g->MemberZoned(this);
|
||||
}
|
||||
|
||||
|
||||
Raid* r = entity_list.GetRaidByClient(this);
|
||||
|
||||
if(r)
|
||||
@@ -2142,9 +2142,9 @@ void Client::HandleRespawnFromHover(uint32 Option)
|
||||
m_pp.zone_id = m_pp.binds[0].zoneId;
|
||||
m_pp.zoneInstance = 0;
|
||||
database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id));
|
||||
|
||||
|
||||
Save();
|
||||
|
||||
|
||||
GoToDeath();
|
||||
}
|
||||
}
|
||||
@@ -2161,7 +2161,7 @@ void Client::ClearHover()
|
||||
|
||||
sze->player.spawn.NPC = 0;
|
||||
sze->player.spawn.z += 6; //arbitrary lift, seems to help spawning under zone.
|
||||
|
||||
|
||||
entity_list.QueueClients(this, outapp, false);
|
||||
safe_delete(outapp);
|
||||
|
||||
@@ -2302,7 +2302,7 @@ void Client::HandleLFGuildResponse(ServerPacket *pack)
|
||||
|
||||
LFGuild_GuildToggle_Struct *gts = (LFGuild_GuildToggle_Struct *)outapp->pBuffer;
|
||||
gts->Command = 1;
|
||||
strcpy(gts->Comment, Comments);
|
||||
strcpy(gts->Comment, Comments);
|
||||
gts->FromLevel = FromLevel;
|
||||
gts->ToLevel = ToLevel;
|
||||
gts->Classes = Classes;
|
||||
@@ -2348,7 +2348,7 @@ void Client::SendGuildLFGuildStatus()
|
||||
pack->WriteUInt32(QSG_LFGuild);
|
||||
pack->WriteUInt32(QSG_LFGuild_RequestGuildInfo);
|
||||
pack->WriteString(guild_mgr.GetGuildName(GuildID()));
|
||||
|
||||
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
+322
-322
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -36,7 +36,7 @@ typedef void (*CmdFuncPtr)(Client *,const Seperator *);
|
||||
char *desc; // description of command
|
||||
CmdFuncPtr function; // the function to call
|
||||
int access; // the required 'status' level
|
||||
|
||||
|
||||
struct cl_struct *next; // linked list
|
||||
};
|
||||
|
||||
|
||||
+7
-7
@@ -66,7 +66,7 @@ typedef enum { //focus types
|
||||
focusTwincast,
|
||||
focusSympatheticProc,
|
||||
focusSpellDamage,
|
||||
focusFF_Damage_Amount,
|
||||
focusFF_Damage_Amount,
|
||||
focusSpellDurByTic,
|
||||
focusSwarmPetDuration,
|
||||
focusReduceRecastTime,
|
||||
@@ -277,7 +277,7 @@ struct StatBonuses {
|
||||
int16 ExtraAttackChance;
|
||||
int16 DoTShielding;
|
||||
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
|
||||
uint16 DeathSave[4]; // Death Pact [0](value = 1 partial 2 = full) [1]=slot [2]=LvLimit [3]=HealAmt
|
||||
int16 FlurryChance;
|
||||
int16 Accuracy[HIGHEST_SKILL+2]; //Accuracy/15 == % increase [Spell Effect: Accuracy)
|
||||
int16 HundredHands; //extra haste, stacks with all other haste i
|
||||
@@ -315,7 +315,7 @@ struct StatBonuses {
|
||||
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.
|
||||
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
|
||||
@@ -326,7 +326,7 @@ struct StatBonuses {
|
||||
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
|
||||
|
||||
|
||||
// AAs
|
||||
int8 Packrat; //weight reduction for items, 1 point = 10%
|
||||
uint8 BuffSlotIncrease; // Increases number of available buff slots
|
||||
@@ -340,7 +340,7 @@ struct StatBonuses {
|
||||
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 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
|
||||
@@ -363,7 +363,7 @@ struct StatBonuses {
|
||||
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 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
|
||||
@@ -426,7 +426,7 @@ typedef enum {
|
||||
|
||||
struct MercType {
|
||||
uint32 Type;
|
||||
uint32 ClientVersion;
|
||||
uint32 ClientVersion;
|
||||
};
|
||||
|
||||
struct MercData {
|
||||
|
||||
+27
-27
@@ -224,7 +224,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// guild doors
|
||||
if(((keyneeded == 0) && (GetLockpick() == 0) && (guild_id == 0)) ||
|
||||
(IsDoorOpen() && (opentype == 58)) ||
|
||||
@@ -345,15 +345,15 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
||||
playerkey = keyneeded;
|
||||
sender->Message(4, "You got it open!"); // more debug spam
|
||||
if(!IsDoorOpen() || (opentype == 58))
|
||||
{
|
||||
{
|
||||
md->action = invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
md->action = invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
sender->Message_StringID(4, DOORS_LOCKED);
|
||||
safe_delete(outapp);
|
||||
@@ -361,7 +361,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
entity_list.QueueClients(sender, outapp, false);
|
||||
if(!IsDoorOpen() || (opentype == 58))
|
||||
{
|
||||
@@ -414,13 +414,13 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
||||
}
|
||||
|
||||
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))
|
||||
{ // Teleport door!
|
||||
if (( strncmp(dest_zone,zone_name,strlen(zone_name)) == 0) && (!keyneeded))
|
||||
{
|
||||
if(!keepoffkeyring)
|
||||
{
|
||||
sender->KeyRingAdd(playerkey);
|
||||
}
|
||||
}
|
||||
sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading);
|
||||
}
|
||||
else if (( !IsDoorOpen() || opentype == 58 ) && (keyneeded && ((keyneeded == playerkey) || sender->GetGM())))
|
||||
@@ -428,7 +428,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
||||
if(!keepoffkeyring)
|
||||
{
|
||||
sender->KeyRingAdd(playerkey);
|
||||
}
|
||||
}
|
||||
if(database.GetZoneID(dest_zone) == zone->GetZoneID())
|
||||
{
|
||||
sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading);
|
||||
@@ -438,7 +438,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
||||
sender->MovePC(database.GetZoneID(dest_zone), dest_instance_id, dest_x, dest_y, dest_z, dest_heading);
|
||||
}
|
||||
}
|
||||
if (( !IsDoorOpen() || opentype == 58 ) && (!keyneeded))
|
||||
if (( !IsDoorOpen() || opentype == 58 ) && (!keyneeded))
|
||||
{
|
||||
if(database.GetZoneID(dest_zone) == zone->GetZoneID())
|
||||
{
|
||||
@@ -736,45 +736,45 @@ void Doors::SetLocation(float x, float y, float z)
|
||||
|
||||
void Doors::SetX(float in) {
|
||||
entity_list.DespawnAllDoors();
|
||||
pos_x = in;
|
||||
pos_x = in;
|
||||
entity_list.RespawnAllDoors();
|
||||
}
|
||||
void Doors::SetY(float in) {
|
||||
void Doors::SetY(float in) {
|
||||
entity_list.DespawnAllDoors();
|
||||
pos_y = in;
|
||||
pos_y = in;
|
||||
entity_list.RespawnAllDoors();
|
||||
}
|
||||
void Doors::SetZ(float in) {
|
||||
void Doors::SetZ(float in) {
|
||||
entity_list.DespawnAllDoors();
|
||||
pos_z = in;
|
||||
pos_z = in;
|
||||
entity_list.RespawnAllDoors();
|
||||
}
|
||||
void Doors::SetHeading(float in) {
|
||||
void Doors::SetHeading(float in) {
|
||||
entity_list.DespawnAllDoors();
|
||||
heading = in;
|
||||
heading = in;
|
||||
entity_list.RespawnAllDoors();
|
||||
}
|
||||
|
||||
void Doors::SetIncline(int in) {
|
||||
void Doors::SetIncline(int in) {
|
||||
entity_list.DespawnAllDoors();
|
||||
incline = in;
|
||||
incline = in;
|
||||
entity_list.RespawnAllDoors();
|
||||
}
|
||||
|
||||
void Doors::SetOpenType(uint8 in) {
|
||||
void Doors::SetOpenType(uint8 in) {
|
||||
entity_list.DespawnAllDoors();
|
||||
opentype = in;
|
||||
opentype = in;
|
||||
entity_list.RespawnAllDoors();
|
||||
}
|
||||
|
||||
void Doors::SetDoorName(char* name) {
|
||||
void Doors::SetDoorName(char* name) {
|
||||
entity_list.DespawnAllDoors();
|
||||
memset(door_name, 0, sizeof(door_name));
|
||||
strncpy(door_name, name, sizeof(door_name));
|
||||
memset(door_name, 0, sizeof(door_name));
|
||||
strncpy(door_name, name, sizeof(door_name));
|
||||
entity_list.RespawnAllDoors();
|
||||
}
|
||||
|
||||
void Doors::SetSize(uint16 in) {
|
||||
void Doors::SetSize(uint16 in) {
|
||||
entity_list.DespawnAllDoors();
|
||||
size = in;
|
||||
entity_list.RespawnAllDoors();
|
||||
|
||||
+6
-6
@@ -36,19 +36,19 @@ public:
|
||||
|
||||
uint8 GetTriggerDoorID() { return trigger_door; }
|
||||
uint8 GetTriggerType() { return trigger_type; }
|
||||
|
||||
|
||||
uint32 GetKeyItem() { return keyitem; }
|
||||
void SetKeyItem(uint32 in) { keyitem = in; }
|
||||
uint8 GetNoKeyring() { return nokeyring; }
|
||||
void SetNoKeyring(uint8 in) { nokeyring = in; }
|
||||
uint16 GetLockpick() { return lockpick; }
|
||||
void SetLockpick(uint16 in) { lockpick = in; }
|
||||
uint16 GetLockpick() { return lockpick; }
|
||||
void SetLockpick(uint16 in) { lockpick = in; }
|
||||
uint16 GetSize() { return size; }
|
||||
void SetGuildID(uint32 guild_id) { this->guild_id = guild_id; }
|
||||
|
||||
uint32 GetEntityID() { return entity_id; }
|
||||
void SetEntityID(uint32 entity) { entity_id = entity; }
|
||||
|
||||
|
||||
void DumpDoor();
|
||||
float GetDestX() { return dest_x; }
|
||||
float GetDestY() { return dest_y; }
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
uint8 IsLDoNDoor() { return is_ldon_door; }
|
||||
uint32 GetClientVersionMask() { return client_version_mask; }
|
||||
|
||||
|
||||
void NPCOpen(NPC* sender, bool alt_mode=false);
|
||||
void ForceOpen(Mob *sender, bool alt_mode=false);
|
||||
void ForceClose(Mob *sender, bool alt_mode=false);
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
void CreateDatabaseEntry();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
uint32 db_id;
|
||||
uint8 door_id;
|
||||
char zone_name[32];
|
||||
|
||||
+92
-92
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -35,16 +35,16 @@ float Client::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
|
||||
float extrange = 100;
|
||||
|
||||
extrange += GetFocusEffect(focusRange, spell_id);
|
||||
|
||||
|
||||
return (range * extrange) / 100;
|
||||
}
|
||||
|
||||
|
||||
int32 Client::Additional_SpellDmg(uint16 spell_id, bool bufftick)
|
||||
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(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){
|
||||
@@ -61,7 +61,7 @@ int32 Client::Additional_SpellDmg(uint16 spell_id, bool bufftick)
|
||||
//Direct Damage is checked in Mob::SpellEffect [spell_effects.cpp]
|
||||
//DoT Damage is checked in Mob::DoBuffTic [spell_effects.cpp] (This was added for npcs in that routine)
|
||||
int32 NPC::GetActSpellDamage(uint16 spell_id, int32 value) {
|
||||
|
||||
|
||||
int32 modifier = 100;
|
||||
|
||||
modifier += SpellFocusDMG;
|
||||
@@ -75,7 +75,7 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
|
||||
// modifier: modifier to damage (from spells & focus effects?)
|
||||
// ratio: % of the modifier to apply (from AAs & natural bonus?)
|
||||
// chance: critital chance %
|
||||
|
||||
|
||||
int32 modifier = 100;
|
||||
int16 spell_dmg = 0;
|
||||
|
||||
@@ -83,8 +83,8 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
|
||||
//Dunno if this makes sense:
|
||||
if (spells[spell_id].resisttype > 0)
|
||||
modifier += GetFocusEffect((focusType)(0-spells[spell_id].resisttype), spell_id);
|
||||
|
||||
|
||||
|
||||
|
||||
int tt = spells[spell_id].targettype;
|
||||
if (tt == ST_UndeadAE || tt == ST_Undead || tt == ST_Summoned) {
|
||||
//undead/summoned spells
|
||||
@@ -95,18 +95,18 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
|
||||
modifier += GetFocusEffect(focusSpellEffectiveness, spell_id);
|
||||
modifier += GetFocusEffect(focusImprovedDamage2, spell_id);
|
||||
}
|
||||
|
||||
|
||||
// Need to scale HT damage differently after level 40! It no longer scales by the constant value in the spell file. It scales differently, instead of 10 more damage per level, it does 30 more damage per level. So we multiply the level minus 40 times 20 if they are over level 40.
|
||||
if ( spell_id == SPELL_HARM_TOUCH || spell_id == SPELL_HARM_TOUCH2 || spell_id == SPELL_IMP_HARM_TOUCH ) {
|
||||
if (this->GetLevel() > 40)
|
||||
value -= (this->GetLevel() - 40) * 20;
|
||||
value -= (this->GetLevel() - 40) * 20;
|
||||
}
|
||||
|
||||
//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
|
||||
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
|
||||
value -= GetAA(aaConsumptionoftheSoul) * 200; //Consumption of the Soul
|
||||
@@ -122,7 +122,7 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
|
||||
if(spell_dmg > -value)
|
||||
spell_dmg = -value;
|
||||
}
|
||||
|
||||
|
||||
// Spell-based SpellDmg adds directly but it restricted by focuses.
|
||||
spell_dmg += Additional_SpellDmg(spell_id);
|
||||
|
||||
@@ -140,12 +140,12 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
|
||||
if(aabonuses.SpellCritDmgIncrease > 0) // wizards get an additional bonus
|
||||
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.
|
||||
if (spell_id == SPELL_IMP_HARM_TOUCH) {
|
||||
if ( (GetAA(aaSpellCastingFury) > 0) && (GetAA(aaUnholyTouch) > 0) )
|
||||
chance = 100;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//Handled in aa_effects will focus spells from 'spellgroup=99'. (SK life tap from buff procs)
|
||||
@@ -172,19 +172,19 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value) {
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (chance > 0) {
|
||||
mlog(SPELLS__CRITS, "Attempting spell crit. Spell: %s (%d), Value: %d, Modifier: %d, Chance: %d, Ratio: %d", spells[spell_id].name, spell_id, value, modifier, chance, ratio);
|
||||
if(MakeRandomInt(0,100) <= chance) {
|
||||
modifier += modifier*ratio/100;
|
||||
spell_dmg *= 2;
|
||||
mlog(SPELLS__CRITS, "Spell crit successful. Final damage modifier: %d, Final Damage: %d", modifier, (value * modifier / 100) - spell_dmg);
|
||||
entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s delivers a critical blast! (%d)", GetName(), (-value * modifier / 100) + spell_dmg);
|
||||
} else
|
||||
entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s delivers a critical blast! (%d)", GetName(), (-value * modifier / 100) + spell_dmg);
|
||||
} else
|
||||
mlog(SPELLS__CRITS, "Spell crit failed. Final Damage Modifier: %d, Final Damage: %d", modifier, (value * modifier / 100) - spell_dmg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ((value * modifier / 100) - spell_dmg);
|
||||
}
|
||||
|
||||
@@ -199,19 +199,19 @@ int32 Client::GetActDoTDamage(uint16 spell_id, int32 value) {
|
||||
critChance += itembonuses.CriticalDoTChance + spellbonuses.CriticalDoTChance + aabonuses.CriticalDoTChance;
|
||||
ratio += itembonuses.DotCritDmgIncrease + spellbonuses.DotCritDmgIncrease + aabonuses.DotCritDmgIncrease;
|
||||
spell_dmg += Additional_SpellDmg(spell_id,true);
|
||||
|
||||
|
||||
// since DOTs are the Necromancer forte, give an innate bonus (Kayen: Is this a real bonus?)
|
||||
// however, no chance to crit unless they've trained atleast one level in the AA first
|
||||
if (GetClass() == NECROMANCER && critChance > 0)
|
||||
critChance += 5;
|
||||
|
||||
|
||||
if (critChance > 0){
|
||||
if (MakeRandomInt(0, 99) < critChance){
|
||||
modifier += modifier*ratio/100;
|
||||
return (((value*modifier/100)-spell_dmg)*2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ((value*modifier/100)-spell_dmg);
|
||||
|
||||
}
|
||||
@@ -221,17 +221,17 @@ int32 NPC::GetActSpellHealing(uint16 spell_id, int32 value) {
|
||||
|
||||
int32 modifier = 100;
|
||||
modifier += SpellFocusHeal;
|
||||
|
||||
|
||||
// Check for buffs that affect the healrate of the target
|
||||
if(this->GetTarget())
|
||||
{
|
||||
value += value * GetHealRate(spell_id) / 100;
|
||||
value += value * GetHealRate(spell_id) / 100;
|
||||
}
|
||||
|
||||
return (value * modifier / 100);
|
||||
}
|
||||
|
||||
int32 Client::Additional_Heal(uint16 spell_id)
|
||||
int32 Client::Additional_Heal(uint16 spell_id)
|
||||
{
|
||||
int32 heal_amt = 0;
|
||||
|
||||
@@ -243,7 +243,7 @@ int32 Client::Additional_Heal(uint16 spell_id)
|
||||
if (duration > 0)
|
||||
return heal_amt /= duration;
|
||||
}
|
||||
|
||||
|
||||
return heal_amt;
|
||||
}
|
||||
|
||||
@@ -255,9 +255,9 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value) {
|
||||
modifier += GetFocusEffect(focusSpellEffectiveness, spell_id);
|
||||
heal_amt += Additional_Heal(spell_id);
|
||||
int chance = 0;
|
||||
|
||||
// Instant Heals
|
||||
if(spells[spell_id].buffduration < 1)
|
||||
|
||||
// Instant Heals
|
||||
if(spells[spell_id].buffduration < 1)
|
||||
{
|
||||
// Formula = HealAmt * (casttime + recastime) / 7; Cant trigger off spell less than 5 levels below and cant heal more than the spell itself.
|
||||
if(this->itembonuses.HealAmt && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) {
|
||||
@@ -271,22 +271,22 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value) {
|
||||
value += value * GetHealRate(spell_id) / 100;
|
||||
chance += GetCriticalHealRate(spell_id);
|
||||
}
|
||||
|
||||
|
||||
//Live AA - Healing Gift, Theft of Life
|
||||
chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance;
|
||||
|
||||
|
||||
if(MakeRandomInt(0,99) < chance) {
|
||||
entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s performs an exceptional heal! (%d)", GetName(), ((value * modifier / 50) + heal_amt*2));
|
||||
entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s performs an exceptional heal! (%d)", GetName(), ((value * modifier / 50) + heal_amt*2));
|
||||
return ((value * modifier / 50) + heal_amt*2);
|
||||
}
|
||||
else{
|
||||
return ((value * modifier / 100) + heal_amt);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hots
|
||||
else {
|
||||
chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance;
|
||||
if(MakeRandomInt(0,99) < chance)
|
||||
if(MakeRandomInt(0,99) < chance)
|
||||
return ((value * modifier / 50) + heal_amt*2);
|
||||
}
|
||||
return ((value * modifier / 100) + heal_amt);
|
||||
@@ -301,10 +301,10 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
|
||||
// Doesnt generate mana, so best case is a free spell
|
||||
if(mana_back > cost)
|
||||
mana_back = cost;
|
||||
|
||||
|
||||
cost -= mana_back;
|
||||
}
|
||||
|
||||
|
||||
// This formula was derived from the following resource:
|
||||
// http://www.eqsummoners.com/eq1/specialization-library.html
|
||||
// WildcardX
|
||||
@@ -373,14 +373,14 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
|
||||
for (int buffSlot = 0; buffSlot < buff_max; buffSlot++) {
|
||||
if (buffs[buffSlot].spellid == 0 || buffs[buffSlot].spellid >= SPDAT_RECORDS)
|
||||
continue;
|
||||
|
||||
|
||||
if(IsEffectInSpell(buffs[buffSlot].spellid, SE_ReduceManaCost)) {
|
||||
if(CalcFocusEffect(focusManaCost, buffs[buffSlot].spellid, spell_id) == 100)
|
||||
cost = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(cost < 0)
|
||||
cost = 0;
|
||||
|
||||
@@ -393,7 +393,7 @@ int32 Client::GetActSpellDuration(uint16 spell_id, int32 duration)
|
||||
increase += GetFocusEffect(focusSpellDuration, spell_id);
|
||||
int tic_inc = 0;
|
||||
tic_inc = GetFocusEffect(focusSpellDurByTic, spell_id);
|
||||
|
||||
|
||||
if(IsBeneficialSpell(spell_id))
|
||||
{
|
||||
switch(GetAA(aaSpellCastingReinforcement)) {
|
||||
@@ -414,7 +414,7 @@ int32 Client::GetActSpellDuration(uint16 spell_id, int32 duration)
|
||||
if(IsMezSpell(spell_id)) {
|
||||
tic_inc += GetAA(aaMesmerizationMastery);
|
||||
}
|
||||
|
||||
|
||||
return (((duration * increase) / 100) + tic_inc);
|
||||
}
|
||||
|
||||
@@ -426,23 +426,23 @@ int32 Client::GetActSpellCasttime(uint16 spell_id, int32 casttime)
|
||||
//this function loops through the effects of spell_id many times
|
||||
//could easily be consolidated.
|
||||
|
||||
if (GetLevel() >= 51 && casttime >= 3000 && !BeneficialSpell(spell_id)
|
||||
&& (GetClass() == SHADOWKNIGHT || GetClass() == RANGER
|
||||
if (GetLevel() >= 51 && casttime >= 3000 && !BeneficialSpell(spell_id)
|
||||
&& (GetClass() == SHADOWKNIGHT || GetClass() == RANGER
|
||||
|| GetClass() == PALADIN || GetClass() == BEASTLORD ))
|
||||
cast_reducer += (GetLevel()-50)*3;
|
||||
|
||||
|
||||
//LIVE AA SpellCastingDeftness, QuickBuff, QuickSummoning, QuickEvacuation, QuickDamage
|
||||
|
||||
|
||||
if (cast_reducer > RuleI(Spells, MaxCastTimeReduction))
|
||||
cast_reducer = RuleI(Spells, MaxCastTimeReduction);
|
||||
|
||||
cast_reducer = RuleI(Spells, MaxCastTimeReduction);
|
||||
|
||||
casttime = (casttime*(100 - cast_reducer)/100);
|
||||
|
||||
|
||||
return casttime;
|
||||
}
|
||||
|
||||
bool Client::TrainDiscipline(uint32 itemid) {
|
||||
|
||||
|
||||
//get the item info
|
||||
const Item_Struct *item = database.GetItem(itemid);
|
||||
if(item == nullptr) {
|
||||
@@ -450,14 +450,14 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
if(item->ItemClass != ItemClassCommon || item->ItemType != ItemTypeSpell) {
|
||||
Message(13, "Invalid item type, you cannot learn from this item.");
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//Need a way to determine the difference between a spell and a tome
|
||||
//so they cant turn in a spell and get it as a discipline
|
||||
//this is kinda a hack:
|
||||
@@ -481,7 +481,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
int myclass = GetClass();
|
||||
if(myclass == WIZARD || myclass == ENCHANTER || myclass == MAGICIAN || myclass == NECROMANCER) {
|
||||
Message(13, "Your class cannot learn from this tome.");
|
||||
@@ -489,7 +489,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//make sure we can train this...
|
||||
//can we use the item?
|
||||
uint32 cbit = 1 << (myclass-1);
|
||||
@@ -499,13 +499,13 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
uint32 spell_id = item->Scroll.Effect;
|
||||
if(!IsValidSpell(spell_id)) {
|
||||
Message(13, "This tome contains invalid knowledge.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//can we use the spell?
|
||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||
uint8 level_to_use = spell.classes[myclass - 1];
|
||||
@@ -515,14 +515,14 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
if(level_to_use > GetLevel()) {
|
||||
Message(13, "You must be at least level %d to learn this discipline.", level_to_use);
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//add it to PP.
|
||||
int r;
|
||||
for(r = 0; r < MAX_PP_DISCIPLINES; r++) {
|
||||
@@ -544,7 +544,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
|
||||
void Client::SendDisciplineUpdate() {
|
||||
//this dosent seem to work right now
|
||||
|
||||
|
||||
EQApplicationPacket app(OP_DisciplineUpdate, sizeof(Disciplines_Struct));
|
||||
Disciplines_Struct *d = (Disciplines_Struct*)app.pBuffer;
|
||||
//dunno why I dont just send the one from m_pp
|
||||
@@ -559,7 +559,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//make sure we have the spell...
|
||||
int r;
|
||||
for(r = 0; r < MAX_PP_DISCIPLINES; r++) {
|
||||
@@ -579,13 +579,13 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
Message(0, "You can use this discipline in %d minutes %d seconds.", ((remain)/60), (remain%60));
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//make sure we can use it..
|
||||
if(!IsValidSpell(spell_id)) {
|
||||
Message(13, "This tome contains invalid knowledge.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//can we use the spell?
|
||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||
uint8 level_to_use = spell.classes[GetClass() - 1];
|
||||
@@ -594,27 +594,27 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
//should summon them a new one...
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
if(level_to_use > GetLevel()) {
|
||||
Message_StringID(13, DISC_LEVEL_USE_ERROR);
|
||||
//should summon them a new one...
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
if(GetEndurance() > spell.EndurCost) {
|
||||
SetEndurance(GetEndurance() - spell.EndurCost);
|
||||
} else {
|
||||
Message(11, "You are too fatigued to use this skill right now.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
if(spell.recast_time > 0)
|
||||
{
|
||||
uint32 reduced_recast = spell.recast_time / 1000;
|
||||
reduced_recast -= CastToClient()->GetFocusEffect(focusReduceRecastTime, spell_id);
|
||||
if(reduced_recast < 0)
|
||||
reduced_recast = 0;
|
||||
|
||||
|
||||
CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast);
|
||||
if(spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS)
|
||||
{
|
||||
@@ -624,7 +624,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
dts->Duration = reduced_recast;
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -635,13 +635,13 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
|
||||
void EntityList::AETaunt(Client* taunter, float range) {
|
||||
LinkedListIterator<NPC*> iterator(npc_list);
|
||||
|
||||
|
||||
if(range == 0) {
|
||||
range = 100; //arbitrary default...
|
||||
}
|
||||
|
||||
|
||||
range = range * range;
|
||||
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements())
|
||||
{
|
||||
@@ -652,7 +652,7 @@ void EntityList::AETaunt(Client* taunter, float range) {
|
||||
if (zdiff < 10
|
||||
&& taunter->IsAttackAllowed(them)
|
||||
&& taunter->DistNoRootNoZ(*them) <= range) {
|
||||
|
||||
|
||||
if (taunter->CheckLosFN(them)) {
|
||||
taunter->Taunt(them, true);
|
||||
}
|
||||
@@ -668,15 +668,15 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
|
||||
{
|
||||
LinkedListIterator<Mob*> iterator(mob_list);
|
||||
Mob *curmob;
|
||||
|
||||
|
||||
float dist = caster->GetAOERange(spell_id);
|
||||
float dist2 = dist * dist;
|
||||
|
||||
|
||||
bool bad = IsDetrimentalSpell(spell_id);
|
||||
bool isnpc = caster->IsNPC();
|
||||
const int MAX_TARGETS_ALLOWED = 4;
|
||||
int iCounter = 0;
|
||||
|
||||
|
||||
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
|
||||
{
|
||||
curmob = iterator.GetData();
|
||||
@@ -708,7 +708,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
|
||||
}
|
||||
|
||||
//if we get here... cast the spell.
|
||||
if(IsTargetableAESpell(spell_id) && bad)
|
||||
if(IsTargetableAESpell(spell_id) && bad)
|
||||
{
|
||||
if(iCounter < MAX_TARGETS_ALLOWED)
|
||||
{
|
||||
@@ -722,17 +722,17 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
|
||||
|
||||
if(!isnpc) //npcs are not target limited...
|
||||
iCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster)
|
||||
{
|
||||
LinkedListIterator<Mob*> iterator(mob_list);
|
||||
Mob *curmob;
|
||||
|
||||
|
||||
float dist = caster->GetAOERange(spell_id);
|
||||
float dist2 = dist * dist;
|
||||
|
||||
|
||||
bool bad = IsDetrimentalSpell(spell_id);
|
||||
|
||||
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
|
||||
@@ -762,13 +762,13 @@ void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool a
|
||||
}
|
||||
}
|
||||
|
||||
if(bad)
|
||||
if(bad)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
caster->SpellOnTarget(spell_id, curmob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// solar: causes caster to hit every mob within dist range of center with
|
||||
@@ -778,13 +778,13 @@ void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool aff
|
||||
{
|
||||
LinkedListIterator<Mob*> iterator(mob_list);
|
||||
Mob *curmob;
|
||||
|
||||
|
||||
float dist = caster->GetAOERange(spell_id);
|
||||
float dist2 = dist * dist;
|
||||
|
||||
|
||||
bool bad = IsDetrimentalSpell(spell_id);
|
||||
bool isnpc = caster->IsNPC();
|
||||
|
||||
|
||||
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
|
||||
{
|
||||
curmob = iterator.GetData();
|
||||
@@ -822,28 +822,28 @@ void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool aff
|
||||
//Dook- Rampage and stuff for clients.
|
||||
//NPCs handle it differently in Mob::Rampage
|
||||
void EntityList::AEAttack(Mob *attacker, float dist, int Hand, int count, bool IsFromSpell) {
|
||||
//Dook- Will need tweaking, currently no pets or players or horses
|
||||
LinkedListIterator<Mob*> iterator(mob_list);
|
||||
Mob *curmob;
|
||||
|
||||
//Dook- Will need tweaking, currently no pets or players or horses
|
||||
LinkedListIterator<Mob*> iterator(mob_list);
|
||||
Mob *curmob;
|
||||
|
||||
float dist2 = dist * dist;
|
||||
|
||||
|
||||
int hit = 0;
|
||||
|
||||
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {
|
||||
curmob = iterator.GetData();
|
||||
|
||||
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {
|
||||
curmob = iterator.GetData();
|
||||
if(curmob->IsNPC()
|
||||
&& curmob != attacker //this is not needed unless NPCs can use this
|
||||
&&(attacker->IsAttackAllowed(curmob))
|
||||
&& curmob->GetRace() != 216 && curmob->GetRace() != 472 /* dont attack horses */
|
||||
&& (curmob->DistNoRoot(*attacker) <= dist2)
|
||||
) {
|
||||
attacker->Attack(curmob, Hand, false, false, IsFromSpell);
|
||||
attacker->Attack(curmob, Hand, false, false, IsFromSpell);
|
||||
hit++;
|
||||
if(count != 0 && hit >= count)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+24
-24
@@ -248,8 +248,8 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
bool isGlobalNPC = false;
|
||||
bool isItemQuest = false;
|
||||
bool isSpellQuest = false;
|
||||
if(event == EVENT_SPELL_EFFECT_CLIENT ||
|
||||
event == EVENT_SPELL_EFFECT_NPC ||
|
||||
if(event == EVENT_SPELL_EFFECT_CLIENT ||
|
||||
event == EVENT_SPELL_EFFECT_NPC ||
|
||||
event == EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT ||
|
||||
event == EVENT_SPELL_EFFECT_BUFF_TIC_NPC ||
|
||||
event == EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE)
|
||||
@@ -266,7 +266,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
isPlayerQuest = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
isItemQuest = true;
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
}else{
|
||||
|
||||
packagename = GetPkgPrefix(objid);
|
||||
|
||||
|
||||
if(!isloaded(packagename.c_str()))
|
||||
{
|
||||
LoadScript(objid, zone->GetShortName());
|
||||
@@ -418,7 +418,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
{
|
||||
QGlobalCache::Combine(globalMap, zone_c->GetBucket(), npcmob->GetNPCTypeID(), charid, zone->GetZoneID());
|
||||
}
|
||||
|
||||
|
||||
std::list<QGlobal>::iterator iter = globalMap.begin();
|
||||
while(iter != globalMap.end())
|
||||
{
|
||||
@@ -681,7 +681,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
ExportVar(packagename.c_str(), "target_zone_id", data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case EVENT_CAST_ON:
|
||||
case EVENT_CAST:{
|
||||
ExportVar(packagename.c_str(), "spell_id", data);
|
||||
@@ -717,7 +717,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
}
|
||||
case EVENT_PLAYER_PICKUP:{
|
||||
ExportVar(packagename.c_str(), "picked_up_id", data);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_AGGRO_SAY: {
|
||||
@@ -788,12 +788,12 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
|
||||
case EVENT_FORAGE_SUCCESS: {
|
||||
ExportVar(packagename.c_str(), "foraged_item", extradata);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_FISH_SUCCESS: {
|
||||
ExportVar(packagename.c_str(), "fished_item", extradata);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_CLICK_OBJECT: {
|
||||
@@ -1075,7 +1075,7 @@ int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater)
|
||||
curmode = questTemplateByID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //QUEST_TEMPLATES_BYNAME
|
||||
|
||||
#endif //QUEST_SCRIPTS_BYNAME
|
||||
@@ -1086,7 +1086,7 @@ int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater)
|
||||
fclose(tmpf);
|
||||
filefound = true;
|
||||
}
|
||||
|
||||
|
||||
// If by ID, Name or Template wasn't found, load /quests/zone/default.pl
|
||||
if(!filefound)
|
||||
{
|
||||
@@ -1103,7 +1103,7 @@ int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater)
|
||||
fclose(tmpf);
|
||||
filefound = true;
|
||||
}
|
||||
|
||||
|
||||
// If zone template isn't found look for it globally /quests/template/default.pl
|
||||
if(!filefound)
|
||||
{
|
||||
@@ -1273,9 +1273,9 @@ int PerlembParser::LoadPlayerScript(const char *zone_name)
|
||||
}
|
||||
}
|
||||
|
||||
if(perl->SubExists(packagename.c_str(), "EVENT_CAST"))
|
||||
if(perl->SubExists(packagename.c_str(), "EVENT_CAST"))
|
||||
playerQuestLoaded[zone_name] = pQuestEventCast;
|
||||
else
|
||||
else
|
||||
playerQuestLoaded[zone_name] = pQuestLoaded;
|
||||
return 1;
|
||||
}
|
||||
@@ -1307,9 +1307,9 @@ int PerlembParser::LoadGlobalPlayerScript()
|
||||
LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
}
|
||||
|
||||
if(perl->SubExists(packagename.c_str(), "EVENT_CAST"))
|
||||
if(perl->SubExists(packagename.c_str(), "EVENT_CAST"))
|
||||
globalPlayerQuestLoaded = pQuestEventCast;
|
||||
else
|
||||
else
|
||||
globalPlayerQuestLoaded = pQuestLoaded;
|
||||
return 1;
|
||||
}
|
||||
@@ -1359,7 +1359,7 @@ int PerlembParser::LoadItemScript(ItemInst* iteminst, string packagename, itemQu
|
||||
return 1;
|
||||
}
|
||||
|
||||
int PerlembParser::LoadSpellScript(uint32 id)
|
||||
int PerlembParser::LoadSpellScript(uint32 id)
|
||||
{
|
||||
if(!perl)
|
||||
return 0;
|
||||
@@ -1463,10 +1463,10 @@ bool PerlembParser::PlayerHasQuestSub(const char *subname) {
|
||||
|
||||
if(playerQuestLoaded.count(zone->GetShortName()) == 0)
|
||||
LoadPlayerScript(zone->GetShortName());
|
||||
|
||||
|
||||
if(subname == "EVENT_CAST")
|
||||
return (playerQuestLoaded[zone->GetShortName()] == pQuestEventCast);
|
||||
|
||||
|
||||
return(perl->SubExists(packagename.c_str(), subname));
|
||||
}
|
||||
|
||||
@@ -1476,21 +1476,21 @@ bool PerlembParser::GlobalPlayerHasQuestSub(const char *subname) {
|
||||
|
||||
if(globalPlayerQuestLoaded == pQuestReadyToLoad)
|
||||
LoadGlobalPlayerScript();
|
||||
|
||||
|
||||
if(subname == "EVENT_CAST")
|
||||
return (globalPlayerQuestLoaded == pQuestEventCast);
|
||||
|
||||
|
||||
return(perl->SubExists(packagename.c_str(), subname));
|
||||
}
|
||||
|
||||
bool PerlembParser::SpellHasQuestSub(uint32 id, const char *subname)
|
||||
bool PerlembParser::SpellHasQuestSub(uint32 id, const char *subname)
|
||||
{
|
||||
string packagename = "spell_effect_";
|
||||
packagename += itoa(id);
|
||||
|
||||
if(spellQuestLoaded.count(id) == 0)
|
||||
LoadSpellScript(id);
|
||||
|
||||
|
||||
return(perl->SubExists(packagename.c_str(), subname));
|
||||
}
|
||||
|
||||
@@ -1577,7 +1577,7 @@ void PerlembParser::SendCommands(const char * pkgprefix, const char *event, uint
|
||||
sprintf(var,"$quest::cmd_queue[%d]{args}",c);
|
||||
std::string args = perl->getstr(var);
|
||||
size_t num_args = std::count(args.begin(), args.end(), ',') + 1;
|
||||
|
||||
|
||||
ExCommands(cmd, args, num_args, npcid, other, mob);
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -71,7 +71,7 @@ struct EventRecord {
|
||||
class PerlembParser : public Parser
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
//could prolly get rid of this map now, since I check for the
|
||||
//actual subroutine in the quest package as opposed to just seeing
|
||||
//if they do not have a quest or the default.
|
||||
@@ -84,7 +84,7 @@ protected:
|
||||
|
||||
queue<EventRecord> eventQueue; //for events that happen when perl is in use.
|
||||
bool eventQueueProcessing;
|
||||
|
||||
|
||||
void HandleQueue();
|
||||
|
||||
void EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, bool global = false);
|
||||
@@ -124,9 +124,9 @@ public:
|
||||
int LoadGlobalPlayerScript();
|
||||
int LoadItemScript(ItemInst* iteminst, string packagename, itemQuestMode Qtype);
|
||||
int LoadSpellScript(uint32 id);
|
||||
|
||||
|
||||
//expose a var to the script (probably parallels addvar))
|
||||
//i.e. exportvar("qst1234", "name", "somemob");
|
||||
//i.e. exportvar("qst1234", "name", "somemob");
|
||||
//would expose the variable $name='somemob' to the script that handles npc1234
|
||||
void ExportHash(const char *pkgprefix, const char *hashname, std::map<string,string> &vals);
|
||||
void ExportVar(const char * pkgprefix, const char * varname, const char * value) const;
|
||||
@@ -136,19 +136,19 @@ public:
|
||||
//I don't escape the strings, so use caution!!
|
||||
//Same as export var, except value is not quoted, and is evaluated as perl
|
||||
void ExportVarComplex(const char * pkgprefix, const char * varname, const char * value) const;
|
||||
|
||||
|
||||
//get an appropriate namespage/packagename from an npcid
|
||||
std::string GetPkgPrefix(uint32 npcid, bool defaultOK = true);
|
||||
//call the appropriate perl handler. afterwards, parse and dispatch the command queue
|
||||
//SendCommands("qst1234", "EVENT_SAY") would trigger sub EVENT_SAY() from the qst1234.pl file
|
||||
virtual void SendCommands(const char * pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst);
|
||||
|
||||
|
||||
int HasQuestFile(uint32 npcid);
|
||||
|
||||
#ifdef EMBPERL_COMMANDS
|
||||
void ExecCommand(Client *c, Seperator *sep);
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //EMBPERL
|
||||
|
||||
+15
-15
@@ -17,7 +17,7 @@ Eglin
|
||||
#include <string.h>
|
||||
|
||||
//headers from the Perl distribution
|
||||
#include <EXTERN.h>
|
||||
#include <EXTERN.h>
|
||||
#define WIN32IO_IS_STDIO
|
||||
|
||||
#ifndef WIN32
|
||||
@@ -69,30 +69,30 @@ private:
|
||||
eval(buffer);
|
||||
return get_sv("scratch::temp", false);
|
||||
}
|
||||
|
||||
|
||||
//install a perl func
|
||||
void init_eval_file(void);
|
||||
|
||||
|
||||
bool in_use; //true if perl is executing
|
||||
protected:
|
||||
//the embedded interpreter
|
||||
PerlInterpreter * my_perl;
|
||||
|
||||
|
||||
void DoInit();
|
||||
|
||||
|
||||
public:
|
||||
Embperl(void); //This can throw errors! Buyer beware
|
||||
~Embperl(void);
|
||||
|
||||
|
||||
void Reinit();
|
||||
|
||||
|
||||
//return the last error msg
|
||||
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
|
||||
void dosub(const char * subname, const std::vector<std::string> * args = nullptr, int mode = G_SCALAR|G_DISCARD|G_EVAL);
|
||||
|
||||
|
||||
//Access to perl variables
|
||||
//all varnames here should be of the form package::name
|
||||
//returns the contents of the perl variable named in varname as a c int
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
SV * temp = my_get_sv(varname);
|
||||
return std::string(SvPV_nolen(temp),SvLEN(temp));
|
||||
}
|
||||
|
||||
|
||||
//put an integer into a perl varable
|
||||
void seti(const char *varname, int val) const {
|
||||
SV *t = get_sv(varname, true);
|
||||
@@ -134,24 +134,24 @@ public:
|
||||
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());
|
||||
|
||||
|
||||
// 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)
|
||||
//idea borrowed from perlembed
|
||||
void eval_file(const char * packagename, const char * filename);
|
||||
|
||||
|
||||
inline bool InUse() const { return(in_use); }
|
||||
|
||||
|
||||
//check to see if a sub exists in package
|
||||
bool SubExists(const char *package, const char *sub);
|
||||
|
||||
|
||||
//check to see if a variable exists in package
|
||||
bool VarExists(const char *package, const char *var);
|
||||
};
|
||||
|
||||
+53
-53
@@ -4,93 +4,93 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifdef EMBPERL
|
||||
#ifdef EMBPERL
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "masterentity.h"
|
||||
#include "command.h"
|
||||
|
||||
#include "embperl.h"
|
||||
#include "embxs.h"
|
||||
#include "embxs.h"
|
||||
|
||||
|
||||
|
||||
const char *getItemName(unsigned itemid)
|
||||
{
|
||||
const Item_Struct* item = nullptr;
|
||||
item = database.GetItem(itemid);
|
||||
|
||||
if (item)
|
||||
return item->Name;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
const char *getItemName(unsigned itemid)
|
||||
{
|
||||
const Item_Struct* item = nullptr;
|
||||
item = database.GetItem(itemid);
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */
|
||||
EXTERN_C XS(boot_qc)
|
||||
{
|
||||
dXSARGS;
|
||||
EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */
|
||||
EXTERN_C XS(boot_qc)
|
||||
{
|
||||
dXSARGS;
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = '\0';
|
||||
|
||||
if(items != 1)
|
||||
LogFile->write(EQEMuLog::Error, "boot_qc does not take any arguments.");
|
||||
|
||||
|
||||
char buf[128]; //shouldent have any function names longer than this.
|
||||
|
||||
|
||||
//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
|
||||
|
||||
XS(XS_EQEmuIO_PRINT); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_EQEmuIO_PRINT)
|
||||
{
|
||||
dXSARGS;
|
||||
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)");
|
||||
// Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)");
|
||||
|
||||
int r;
|
||||
for(r = 1; r < items; r++) {
|
||||
char *str = SvPV_nolen(ST(r));
|
||||
char *cur = str;
|
||||
|
||||
|
||||
int i;
|
||||
int pos = 0;
|
||||
int len = 0;
|
||||
@@ -107,28 +107,28 @@ XS(XS_EQEmuIO_PRINT)
|
||||
LogFile->writebuf(EQEMuLog::Quest, str + pos, 1, len);
|
||||
}
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
#endif //EMBPERL_IO_CAPTURE
|
||||
|
||||
|
||||
#ifdef EMBPERL_COMMANDS
|
||||
|
||||
XS(XS_command_add); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_command_add)
|
||||
{
|
||||
dXSARGS;
|
||||
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)");
|
||||
Perl_croak(aTHX_ "Usage: commands::command_add(name, desc, access)");
|
||||
|
||||
char *name = SvPV_nolen(ST(0));
|
||||
char *desc = SvPV_nolen(ST(1));
|
||||
int access = (int)SvIV(ST(2));
|
||||
|
||||
|
||||
command_add_perl(name, desc, access);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
#endif //EMBPERL_COMMANDS
|
||||
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
#ifndef EMBXS_H
|
||||
#define EMBXS_H
|
||||
#ifndef EMBXS_H
|
||||
#define EMBXS_H
|
||||
|
||||
//headers from the Perl distribution
|
||||
#include <EXTERN.h>
|
||||
#include <EXTERN.h>
|
||||
#define WIN32IO_IS_STDIO
|
||||
|
||||
#ifndef WIN32
|
||||
@@ -14,7 +14,7 @@ extern "C" { //the perl headers dont do this for us...
|
||||
};
|
||||
#endif
|
||||
|
||||
const char *getItemName(unsigned itemid);
|
||||
XS(XS_qc_getItemName); /* prototype to pass -Wmissing-prototypes */
|
||||
EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */
|
||||
const char *getItemName(unsigned itemid);
|
||||
XS(XS_qc_getItemName); /* prototype to pass -Wmissing-prototypes */
|
||||
EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */
|
||||
#endif // EMBXS_H
|
||||
|
||||
+346
-346
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -94,7 +94,7 @@ public:
|
||||
Doors* CastToDoors();
|
||||
Trap* CastToTrap();
|
||||
Beacon* CastToBeacon();
|
||||
|
||||
|
||||
const Client* CastToClient() const;
|
||||
const NPC* CastToNPC() const;
|
||||
const Mob* CastToMob() const;
|
||||
@@ -129,7 +129,7 @@ class EntityList
|
||||
public:
|
||||
EntityList();
|
||||
~EntityList();
|
||||
|
||||
|
||||
Entity* GetID(uint16 id);
|
||||
Mob* GetMob(uint16 id);
|
||||
inline Mob* GetMobID(uint16 id) { return(GetMob(id)); } //for perl
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
NPC* GetNPCByID(uint16 id);
|
||||
NPC* GetNPCByNPCTypeID(uint32 npc_id);
|
||||
Merc* GetMercByID(uint16 id);
|
||||
Client* GetClientByName(const char *name);
|
||||
Client* GetClientByName(const char *name);
|
||||
Client* GetClientByAccID(uint32 accid);
|
||||
Client* GetClientByID(uint16 id);
|
||||
Client* GetClientByCharID(uint32 iCharID);
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
Object* FindNearbyObject(float x, float y, float z, float radius);
|
||||
bool MakeDoorSpawnPacket(EQApplicationPacket* app, Client *client);
|
||||
bool MakeTrackPacket(Client* client);
|
||||
void SendTraders(Client* client);
|
||||
void SendTraders(Client* client);
|
||||
void AddClient(Client*);
|
||||
void AddNPC(NPC*, bool SendSpawnPacket = true, bool dontqueue = false);
|
||||
void AddMerc(Merc*, bool SendSpawnPacket = true, bool dontqueue = false);
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
// Entity* GetEntityGroup(uint32 id);
|
||||
Entity* GetEntityTrap(uint16 id);
|
||||
Entity* GetEntityBeacon(uint16 id);
|
||||
|
||||
|
||||
void DescribeAggro(Client *towho, NPC *from_who, float dist, bool verbose);
|
||||
|
||||
void Message(uint32 to_guilddbid, uint32 type, const char* message, ...);
|
||||
@@ -298,14 +298,14 @@ public:
|
||||
void AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true, int16 resist_adjust = 0);
|
||||
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);
|
||||
|
||||
//trap stuff
|
||||
Mob* GetTrapTrigger(Trap* trap);
|
||||
void SendAlarm(Trap* trap, Mob* currenttarget, uint8 kos);
|
||||
Trap* FindNearbyTrap(Mob* searcher, float max_dist);
|
||||
|
||||
|
||||
void AddHealAggro(Mob* target, Mob* caster, uint16 thedam);
|
||||
Mob* FindDefenseNPC(uint32 npcid);
|
||||
void OpenDoorsNear(NPC* opener);
|
||||
@@ -338,14 +338,14 @@ public:
|
||||
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 RemoveDebuffs(Mob* caster);
|
||||
|
||||
|
||||
void MessageGroup(Mob* sender, bool skipclose, uint32 type, const char* message, ...);
|
||||
|
||||
|
||||
void LimitAddNPC(NPC *npc);
|
||||
void LimitRemoveNPC(NPC *npc);
|
||||
bool LimitCheckType(uint32 npc_type, int count);
|
||||
@@ -409,11 +409,11 @@ protected:
|
||||
private:
|
||||
void AddToSpawnQueue(uint16 entityid, NewSpawn_Struct** app);
|
||||
void CheckSpawnQueue();
|
||||
|
||||
|
||||
//used for limiting spawns
|
||||
class SpawnLimitRecord { public: uint32 spawngroup_id; uint32 npc_type; };
|
||||
map<uint16, SpawnLimitRecord> npc_limit_list; //entity id -> npc type
|
||||
|
||||
|
||||
uint32 tsFirstSpawnOnQueue; // timestamp that the top spawn on the spawnqueue was added, should be 0xFFFFFFFF if queue is empty
|
||||
uint32 NumSpawnsOnQueue;
|
||||
LinkedList<NewSpawn_Struct*> SpawnQueue;
|
||||
@@ -454,7 +454,7 @@ class BulkZoneSpawnPacket {
|
||||
public:
|
||||
BulkZoneSpawnPacket(Client* iSendTo, uint32 iMaxSpawnsPerPacket); // 0 = send zonewide
|
||||
virtual ~BulkZoneSpawnPacket();
|
||||
|
||||
|
||||
bool AddSpawn(NewSpawn_Struct* ns);
|
||||
void SendBuffer(); // Sends the buffer and cleans up everything - can safely re-use the object after this function call (no need to free and do another new)
|
||||
private:
|
||||
|
||||
+3
-3
@@ -1,15 +1,15 @@
|
||||
/* 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 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,
|
||||
|
||||
+68
-68
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -52,10 +52,10 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
|
||||
if(!resexp && (XPRate != 0))
|
||||
add_exp = static_cast<uint32>(in_add_exp * (static_cast<float>(XPRate) / 100.0f));
|
||||
|
||||
|
||||
if (m_epp.perAA<0 || m_epp.perAA>100)
|
||||
m_epp.perAA=0; // stop exploit with sanity check
|
||||
|
||||
|
||||
uint32 add_aaxp;
|
||||
if(resexp) {
|
||||
add_aaxp = 0;
|
||||
@@ -65,7 +65,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
add_aaxp = add_exp * m_epp.perAA / 100;
|
||||
//take that ammount away from regular exp
|
||||
add_exp -= add_aaxp;
|
||||
|
||||
|
||||
float totalmod = 1.0;
|
||||
float zemmod = 1.0;
|
||||
//get modifiers
|
||||
@@ -94,7 +94,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
}
|
||||
|
||||
add_exp = uint32(float(add_exp) * totalmod * zemmod);
|
||||
|
||||
|
||||
if(RuleB(Character,UseXPConScaling))
|
||||
{
|
||||
if (conlevel != 0xFF && !resexp) {
|
||||
@@ -163,7 +163,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
aatotalmod *= zone->newzone_data.zone_exp_multiplier;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(RuleB(Character,UseRaceClassExpBonuses))
|
||||
{
|
||||
@@ -190,7 +190,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
aaexp += had_aaexp;
|
||||
if(aaexp < had_aaexp)
|
||||
aaexp = had_aaexp; //watch for wrap
|
||||
|
||||
|
||||
SetEXP(exp, aaexp, resexp);
|
||||
}
|
||||
|
||||
@@ -202,8 +202,8 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
Message(13, "Error in Client::SetEXP. EXP not set.");
|
||||
return; // Must be invalid class/race
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ((set_exp + set_aaxp) > (m_pp.exp+m_pp.expAA)) {
|
||||
if (isrezzexp)
|
||||
this->Message_StringID(MT_Experience, REZ_REGAIN);
|
||||
@@ -219,7 +219,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
else if((set_exp + set_aaxp) < (m_pp.exp+m_pp.expAA)){ //only loss message if you lose exp, no message if you gained/lost nothing.
|
||||
Message(15, "You have lost experience.");
|
||||
}
|
||||
|
||||
|
||||
//check_level represents the level we should be when we have
|
||||
//this ammount of exp (once these loops complete)
|
||||
uint16 check_level = GetLevel()+1;
|
||||
@@ -245,37 +245,37 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
}
|
||||
check_level--;
|
||||
|
||||
|
||||
|
||||
//see if we gained any AAs
|
||||
if (set_aaxp >= max_AAXP) {
|
||||
/*
|
||||
Note: AA exp is stored differently than normal exp.
|
||||
Exp points are only stored in m_pp.expAA until you
|
||||
gain a full AA point, once you gain it, a point is
|
||||
Exp points are only stored in m_pp.expAA until you
|
||||
gain a full AA point, once you gain it, a point is
|
||||
added to m_pp.aapoints and the ammount needed to gain
|
||||
that point is subtracted from m_pp.expAA
|
||||
|
||||
|
||||
then, once they spend an AA point, it is subtracted from
|
||||
m_pp.aapoints. In theory it then goes into m_pp.aapoints_spent,
|
||||
but im not sure if we have that in the right spot.
|
||||
*/
|
||||
//record how many points we have
|
||||
uint32 last_unspentAA = m_pp.aapoints;
|
||||
|
||||
|
||||
//figure out how many AA points we get from the exp were setting
|
||||
m_pp.aapoints = set_aaxp / max_AAXP;
|
||||
_log(CLIENT__EXP, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP);
|
||||
|
||||
|
||||
//get remainder exp points, set in PP below
|
||||
set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints);
|
||||
|
||||
|
||||
//add in how many points we had
|
||||
m_pp.aapoints += last_unspentAA;
|
||||
//set_aaxp = m_pp.expAA % max_AAXP;
|
||||
|
||||
|
||||
//figure out how many points were actually gained
|
||||
/*uint32 gained = m_pp.aapoints - last_unspentAA;*/ //unused
|
||||
|
||||
|
||||
//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.
|
||||
@@ -286,7 +286,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
|
||||
if(maxlevel <= 1)
|
||||
maxlevel = RuleI(Character, MaxLevel) + 1;
|
||||
|
||||
|
||||
if(check_level > maxlevel) {
|
||||
check_level = maxlevel;
|
||||
|
||||
@@ -299,7 +299,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
set_exp = GetEXPForLevel(maxlevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(RuleB(Character, PerCharacterQglobalMaxLevel)){
|
||||
uint32 MaxLevel = GetCharMaxLevelFromQGlobal();
|
||||
if(MaxLevel){
|
||||
@@ -328,7 +328,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
Message(15, "Welcome to level %i!", check_level);
|
||||
SetLevel(check_level);
|
||||
}
|
||||
|
||||
|
||||
//If were at max level then stop gaining experience if we make it to the cap
|
||||
if(GetLevel() == maxlevel - 1){
|
||||
uint32 expneeded = GetEXPForLevel(maxlevel);
|
||||
@@ -336,12 +336,12 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
{
|
||||
set_exp = expneeded;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//set the client's EXP and AAEXP
|
||||
m_pp.exp = set_exp;
|
||||
m_pp.expAA = set_aaxp;
|
||||
|
||||
|
||||
if (GetLevel() < 51) {
|
||||
m_epp.perAA = 0; // turn off aa exp if they drop below 51
|
||||
} else
|
||||
@@ -358,7 +358,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
eu->exp = (uint32)(330.0f * tmpxp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
|
||||
if (admin>=100 && GetGM()) {
|
||||
char val1[20]={0};
|
||||
char val2[20]={0};
|
||||
@@ -433,7 +433,7 @@ void Client::SetLevel(uint8 set_level, bool command)
|
||||
{
|
||||
SetHP(CalcMaxHP()); // Why not, lets give them a free heal
|
||||
}
|
||||
|
||||
|
||||
DoTributeUpdate();
|
||||
SendHPUpdate();
|
||||
SetMana(CalcMaxMana());
|
||||
@@ -480,11 +480,11 @@ uint32 Client::GetEXPForLevel(uint16 check_level)
|
||||
mod = 3.0;
|
||||
else
|
||||
mod = 3.1;
|
||||
|
||||
|
||||
float base = (check_levelm1)*(check_levelm1)*(check_levelm1);
|
||||
|
||||
mod *= 1000;
|
||||
|
||||
|
||||
return(uint32(base * mod));
|
||||
}
|
||||
|
||||
@@ -511,21 +511,21 @@ void Group::SplitExp(uint32 exp, Mob* other) {
|
||||
|
||||
if(other->GetOwner() && other->GetOwner()->IsClient()) // Ensure owner isn't pc
|
||||
return;
|
||||
|
||||
unsigned int i;
|
||||
uint32 groupexp = exp;
|
||||
uint8 membercount = 0;
|
||||
|
||||
unsigned int i;
|
||||
uint32 groupexp = exp;
|
||||
uint8 membercount = 0;
|
||||
uint8 maxlevel = 1;
|
||||
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
if (members[i] != nullptr) {
|
||||
if(members[i]->GetLevel() > maxlevel)
|
||||
maxlevel = members[i]->GetLevel();
|
||||
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
if (members[i] != nullptr) {
|
||||
if(members[i]->GetLevel() > maxlevel)
|
||||
maxlevel = members[i]->GetLevel();
|
||||
|
||||
membercount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float groupmod;
|
||||
if (membercount == 2)
|
||||
groupmod = 1.2;
|
||||
@@ -545,25 +545,25 @@ void Group::SplitExp(uint32 exp, Mob* other) {
|
||||
int conlevel = Mob::GetLevelCon(maxlevel, other->GetLevel());
|
||||
if(conlevel == CON_GREEN)
|
||||
return; //no exp for greenies...
|
||||
|
||||
if (membercount == 0)
|
||||
return;
|
||||
|
||||
if (membercount == 0)
|
||||
return;
|
||||
|
||||
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();
|
||||
// add exp + exp cap
|
||||
// add exp + exp cap
|
||||
int16 diff = cmember->GetLevel() - maxlevel;
|
||||
int16 maxdiff = -(cmember->GetLevel()*15/10 - cmember->GetLevel());
|
||||
if(maxdiff > -5)
|
||||
maxdiff = -5;
|
||||
if (diff >= (maxdiff)) { /*Instead of person who killed the mob, the person who has the highest level in the group*/
|
||||
if (diff >= (maxdiff)) { /*Instead of person who killed the mob, the person who has the highest level in the group*/
|
||||
uint32 tmp = (cmember->GetLevel()+3) * (cmember->GetLevel()+3) * 75 * 35 / 10;
|
||||
uint32 tmp2 = groupexp / membercount;
|
||||
cmember->AddEXP( tmp < tmp2 ? tmp : tmp2, conlevel );
|
||||
}
|
||||
}
|
||||
cmember->AddEXP( tmp < tmp2 ? tmp : tmp2, conlevel );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,17 +574,17 @@ void Raid::SplitExp(uint32 exp, Mob* other) {
|
||||
if(other->GetOwner() && other->GetOwner()->IsClient()) // Ensure owner isn't pc
|
||||
return;
|
||||
|
||||
uint32 groupexp = exp;
|
||||
uint8 membercount = 0;
|
||||
uint32 groupexp = exp;
|
||||
uint8 membercount = 0;
|
||||
uint8 maxlevel = 1;
|
||||
|
||||
for (int i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||
if (members[i].member != nullptr) {
|
||||
if(members[i].member->GetLevel() > maxlevel)
|
||||
maxlevel = members[i].member->GetLevel();
|
||||
for (int i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||
if (members[i].member != nullptr) {
|
||||
if(members[i].member->GetLevel() > maxlevel)
|
||||
maxlevel = members[i].member->GetLevel();
|
||||
|
||||
membercount++;
|
||||
}
|
||||
membercount++;
|
||||
}
|
||||
}
|
||||
|
||||
groupexp = (uint32)((float)groupexp * (1.0f-(RuleR(Character, RaidExpMultiplier))));
|
||||
@@ -593,24 +593,24 @@ void Raid::SplitExp(uint32 exp, Mob* other) {
|
||||
if(conlevel == CON_GREEN)
|
||||
return; //no exp for greenies...
|
||||
|
||||
if (membercount == 0)
|
||||
return;
|
||||
if (membercount == 0)
|
||||
return;
|
||||
|
||||
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;
|
||||
// add exp + exp cap
|
||||
// add exp + exp cap
|
||||
int16 diff = cmember->GetLevel() - maxlevel;
|
||||
int16 maxdiff = -(cmember->GetLevel()*15/10 - cmember->GetLevel());
|
||||
if(maxdiff > -5)
|
||||
maxdiff = -5;
|
||||
if (diff >= (maxdiff)) { /*Instead of person who killed the mob, the person who has the highest level in the group*/
|
||||
if (diff >= (maxdiff)) { /*Instead of person who killed the mob, the person who has the highest level in the group*/
|
||||
uint32 tmp = (cmember->GetLevel()+3) * (cmember->GetLevel()+3) * 75 * 35 / 10;
|
||||
uint32 tmp2 = (groupexp / membercount) + 1;
|
||||
cmember->AddEXP( tmp < tmp2 ? tmp : tmp2, conlevel );
|
||||
}
|
||||
}
|
||||
cmember->AddEXP( tmp < tmp2 ? tmp : tmp2, conlevel );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,10 +625,10 @@ void Client::SetLeadershipEXP(uint32 group_exp, uint32 raid_exp) {
|
||||
m_pp.raid_leadership_points++;
|
||||
Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_POINT);
|
||||
}
|
||||
|
||||
|
||||
m_pp.group_leadership_exp = group_exp;
|
||||
m_pp.raid_leadership_exp = raid_exp;
|
||||
|
||||
|
||||
SendLeadershipEXPUpdate();
|
||||
}
|
||||
|
||||
@@ -639,12 +639,12 @@ void Client::AddLeadershipEXP(uint32 group_exp, uint32 raid_exp) {
|
||||
void Client::SendLeadershipEXPUpdate() {
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_LeadershipExpUpdate, sizeof(LeadershipExpUpdate_Struct));
|
||||
LeadershipExpUpdate_Struct* eu = (LeadershipExpUpdate_Struct *) outapp->pBuffer;
|
||||
|
||||
|
||||
eu->group_leadership_exp = m_pp.group_leadership_exp;
|
||||
eu->group_leadership_points = m_pp.group_leadership_points;
|
||||
eu->raid_leadership_exp = m_pp.raid_leadership_exp;
|
||||
eu->raid_leadership_points = m_pp.raid_leadership_points;
|
||||
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
|
||||
+82
-82
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -43,7 +43,7 @@ void Mob::CheckFlee() {
|
||||
//if were allready fleeing, dont need to check more...
|
||||
if(flee_mode && curfp)
|
||||
return;
|
||||
|
||||
|
||||
//dont bother if we are immune to fleeing
|
||||
if(SpecAttacks[IMMUNE_FLEEING] || spellbonuses.ImmuneToFlee)
|
||||
return;
|
||||
@@ -51,12 +51,12 @@ void Mob::CheckFlee() {
|
||||
if(!flee_timer.Check())
|
||||
return; //only do all this stuff every little while, since
|
||||
//its not essential that we start running RIGHT away
|
||||
|
||||
|
||||
//see if were possibly hurt enough
|
||||
float ratio = GetHPRatio();
|
||||
if(ratio >= RuleI(Combat, FleeHPRatio))
|
||||
return;
|
||||
|
||||
|
||||
//we might be hurt enough, check con now..
|
||||
Mob *hate_top = GetHateTop();
|
||||
if(!hate_top) {
|
||||
@@ -64,14 +64,14 @@ void Mob::CheckFlee() {
|
||||
StartFleeing();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float other_ratio = hate_top->GetHPRatio();
|
||||
if(other_ratio < 20) {
|
||||
//our hate top is almost dead too... stay and fight
|
||||
return;
|
||||
}
|
||||
|
||||
//base our flee ratio on our con. this is how the
|
||||
|
||||
//base our flee ratio on our con. this is how the
|
||||
//attacker sees the mob, since this is all we can observe
|
||||
uint32 con = GetLevelCon(hate_top->GetLevel(), GetLevel());
|
||||
float run_ratio;
|
||||
@@ -92,8 +92,8 @@ void Mob::CheckFlee() {
|
||||
}
|
||||
if(ratio < run_ratio)
|
||||
{
|
||||
if( RuleB(Combat, FleeIfNotAlone)
|
||||
|| ( !RuleB(Combat, FleeIfNotAlone)
|
||||
if( RuleB(Combat, FleeIfNotAlone)
|
||||
|| ( !RuleB(Combat, FleeIfNotAlone)
|
||||
&& (entity_list.GetHatedCount(hate_top, this) == 0)))
|
||||
StartFleeing();
|
||||
|
||||
@@ -103,8 +103,8 @@ void Mob::CheckFlee() {
|
||||
|
||||
void Mob::ProcessFlee() {
|
||||
|
||||
//Stop fleeing if effect is applied after they start to run.
|
||||
//When ImmuneToFlee effect fades it will turn fear back on and check if it can still flee.
|
||||
//Stop fleeing if effect is applied after they start to run.
|
||||
//When ImmuneToFlee effect fades it will turn fear back on and check if it can still flee.
|
||||
if(flee_mode && (SpecAttacks[IMMUNE_FLEEING] || spellbonuses.ImmuneToFlee) && !spellbonuses.IsFeared){
|
||||
curfp = false;
|
||||
return;
|
||||
@@ -113,11 +113,11 @@ void Mob::ProcessFlee() {
|
||||
//see if we are still dying, if so, do nothing
|
||||
if(GetHPRatio() < (float)RuleI(Combat, FleeHPRatio))
|
||||
return;
|
||||
|
||||
|
||||
//we are not dying anymore... see what we do next
|
||||
|
||||
|
||||
flee_mode = false;
|
||||
|
||||
|
||||
//see if we are legitimately feared now
|
||||
if(!spellbonuses.IsFeared) {
|
||||
//not feared... were done...
|
||||
@@ -141,7 +141,7 @@ float Mob::GetFearSpeed() {
|
||||
ratio = FLEE_HP_MINSPEED;
|
||||
|
||||
speed = speed * 0.5 * ratio / 100;
|
||||
|
||||
|
||||
return(speed);
|
||||
}
|
||||
return(GetRunspeed());
|
||||
@@ -152,7 +152,7 @@ void Mob::CalculateNewFearpoint()
|
||||
if(RuleB(Pathing, Fear) && zone->pathing)
|
||||
{
|
||||
int Node = zone->pathing->GetRandomPathNode();
|
||||
|
||||
|
||||
VERTEX Loc = zone->pathing->GetPathNodeCoordinates(Node);
|
||||
|
||||
++Loc.z;
|
||||
@@ -218,15 +218,15 @@ void Mob::CalculateNewFearpoint()
|
||||
safe_delete(fear_path_state);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
flee_mode = flee;
|
||||
|
||||
|
||||
//fear dosent work without at least maps
|
||||
if(zone->zonemap == nullptr) {
|
||||
fear_state = fearStateStuck;
|
||||
return; //just stand there
|
||||
}
|
||||
|
||||
|
||||
//if we are allready feared, and we are on a fear grid..
|
||||
//then just stay happy on the grid...
|
||||
if(fear_path_state != nullptr) {
|
||||
@@ -236,16 +236,16 @@ void Mob::CalculateNewFearpoint()
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//try to run straight away from the caster
|
||||
VERTEX hit, fear_vector;
|
||||
if(FearTryStraight(caster, duration, flee, hit, fear_vector)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//OK, so if we just run, we are going to hit something...
|
||||
//now we have to think a little more.
|
||||
|
||||
|
||||
//first, try to find a fear node that we can see.
|
||||
if(zone->pathing != nullptr) {
|
||||
fear_path_state = new MobFearState();
|
||||
@@ -261,16 +261,16 @@ void Mob::CalculateNewFearpoint()
|
||||
fear_state = fearStateGrid;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//we have failed to find a path, so we dont need this..
|
||||
safe_delete(fear_path_state);
|
||||
}
|
||||
|
||||
|
||||
//if we cannot just run, and we cannot see any paths, then
|
||||
//we will give one last ditch effort to find a legit path. We
|
||||
//will run as far as we can away from the player, and hope we
|
||||
//we will give one last ditch effort to find a legit path. We
|
||||
//will run as far as we can away from the player, and hope we
|
||||
//can see a path from there if not, we will start breaking rules
|
||||
|
||||
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
LogFile->write(EQEMuLog::Debug, "Fear Pathing Start: Hope run from (%.2f, %.2f, %.2f), hit at (%.2f, %.2f, %.2f)",
|
||||
GetX(), GetY(), GetZ(), hit.x, hit.y, hit.z);
|
||||
@@ -286,7 +286,7 @@ bool Mob::FearTryStraight(Mob *caster, uint32 duration, bool flee, VERTEX &hit,
|
||||
//gotta have somebody to run from
|
||||
if(caster == nullptr)
|
||||
return(false);
|
||||
|
||||
|
||||
//our goal is to run along this vector...
|
||||
fear_vector.x = GetX() - caster->GetX();
|
||||
fear_vector.y = GetY() - caster->GetY();
|
||||
@@ -294,22 +294,22 @@ bool Mob::FearTryStraight(Mob *caster, uint32 duration, bool flee, VERTEX &hit,
|
||||
float mag = sqrtf(fear_vector.x*fear_vector.x + fear_vector.y*fear_vector.y);
|
||||
fear_vector.x /= mag;
|
||||
fear_vector.y /= mag;
|
||||
|
||||
|
||||
//now see if we can just run without hitting anything...
|
||||
VERTEX start, end;
|
||||
start.x = GetX();
|
||||
start.y = GetY();
|
||||
start.z = GetZ() + 5.0; //raise up a little over small bumps
|
||||
|
||||
|
||||
//distance moved per movement tic.
|
||||
float distance = NPC_SPEED_MULTIPLIER * GetFearSpeed();
|
||||
//times number of movement tics in the spell.
|
||||
distance *= float(duration) / float(AImovement_duration);
|
||||
|
||||
|
||||
end.x = start.x + fear_vector.x * distance;
|
||||
end.y = start.y + fear_vector.y * distance;
|
||||
end.z = start.z;
|
||||
|
||||
|
||||
if(!zone->zonemap->LineIntersectsZone(start, end, 0.5, &hit, nullptr)) {
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
LogFile->write(EQEMuLog::Debug, "Fear Pathing Start: can run entire vector from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f)",
|
||||
@@ -322,7 +322,7 @@ bool Mob::FearTryStraight(Mob *caster, uint32 duration, bool flee, VERTEX &hit,
|
||||
fear_state = fearStateRunningForever;
|
||||
return(true); //were done, nothing difficult needed.
|
||||
}
|
||||
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -331,19 +331,19 @@ void Mob::CalculateFearPosition() {
|
||||
if(zone->zonemap == nullptr || fear_state == fearStateStuck) {
|
||||
return; //just stand there
|
||||
}
|
||||
|
||||
|
||||
//This is the entire movement section, right here:
|
||||
if (cur_wp_x != GetX() && cur_wp_y != GetY()) {
|
||||
// not at waypoint yet, so keep moving
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetFearSpeed(), true);
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetFearSpeed(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//we have reached our waypoint, now what?
|
||||
//figure out a new waypoint to run at...
|
||||
|
||||
|
||||
if(fear_state == fearStateRunningForever) {
|
||||
if(flee_mode) {
|
||||
//a fleeing mob may run away again
|
||||
@@ -362,7 +362,7 @@ void Mob::CalculateFearPosition() {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//first see if we are on a path. if so our life is easy
|
||||
if(fear_state == fearStateGrid && fear_path_state) {
|
||||
//assume that we have zone->pathing since we got to this state.
|
||||
@@ -380,11 +380,11 @@ void Mob::CalculateFearPosition() {
|
||||
cur_wp_x = fear_path_state->x;
|
||||
cur_wp_y = fear_path_state->y;
|
||||
cur_wp_z = fear_path_state->z;
|
||||
|
||||
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetFearSpeed(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//the only valid state left is fearStateRunning, where we try to
|
||||
//find a grid once we reach our waypoint, which we have..
|
||||
if(fear_state != fearStateRunning) {
|
||||
@@ -393,11 +393,11 @@ void Mob::CalculateFearPosition() {
|
||||
fear_state = fearStateStuck;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//we wanted to try to find a waypoint now, so lets try..
|
||||
if(zone->pathing != nullptr) {
|
||||
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: ran to find path, moving from (%.2f, %.2f, %.2f) to path node (%.2f, %.2f, %.2f)",
|
||||
@@ -411,10 +411,10 @@ void Mob::CalculateFearPosition() {
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetFearSpeed(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//if we get here... all valid methods have failed
|
||||
|
||||
#ifdef FORCE_FEAR_TO_RUN
|
||||
#ifdef FORCE_FEAR_TO_RUN
|
||||
//ok, now we start making shit up
|
||||
|
||||
//for now, we will limit our bullshitting to ignoring LOS
|
||||
@@ -434,11 +434,11 @@ void Mob::CalculateFearPosition() {
|
||||
return;
|
||||
}
|
||||
#endif //FORCE_FEAR_TO_RUN
|
||||
|
||||
|
||||
//we have failed to find a path once again, so we dont need this..
|
||||
safe_delete(fear_path_state);
|
||||
}
|
||||
|
||||
|
||||
//if we get HERE... then NOTHING worked... just stick
|
||||
fear_state = fearStateStuck;
|
||||
|
||||
@@ -447,20 +447,20 @@ void Mob::CalculateFearPosition() {
|
||||
|
||||
//I dont wanna get rid of this right now because it was a lot of hard
|
||||
//work to write... but it dosent work reliably, so oh well..
|
||||
#ifdef OLD_FEAR_PATHING
|
||||
#ifdef OLD_FEAR_PATHING
|
||||
/*
|
||||
The idea...
|
||||
|
||||
|
||||
try to run along fear vector.
|
||||
If we can see along it, run
|
||||
otherwise, try to walk up a hill along the same vector
|
||||
then try to move along a wall along largest component of FV
|
||||
if cant move, change stae to stuck.
|
||||
|
||||
|
||||
once we know a place to run, use the waypoint code to do it
|
||||
then if combat ends, we will reach the waypoint and
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
/*
|
||||
//first try our original fear vector again...
|
||||
@@ -468,11 +468,11 @@ void Mob::CalculateFearPosition() {
|
||||
start.x = GetX() - fear_vector.x * 0.4;
|
||||
start.y = GetY() - fear_vector.y * 0.4;
|
||||
start.z = GetZ() + 6.0; //raise up a little over small bumps
|
||||
|
||||
|
||||
end.x = start.x + fear_vector.x * 10;
|
||||
end.y = start.y + fear_vector.y * 10;
|
||||
end.z = start.z;
|
||||
|
||||
|
||||
if(!zone->zonemap->LineIntersectsZone(start, end, 0.5, &normalhit, nullptr)) {
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
LogFile->write(EQEMuLog::Debug, "Fear Pathing: From (%.2f, %.2f, %.2f) normal run to (%.2f, %.2f, %.2f)",
|
||||
@@ -482,23 +482,23 @@ void Mob::CalculateFearPosition() {
|
||||
cur_wp_x = end.x;
|
||||
cur_wp_y = end.y;
|
||||
cur_wp_z = end.z - 6.0;
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
return;
|
||||
}
|
||||
//see if we can make ANY useful progress along that vector
|
||||
|
||||
|
||||
//first, adjust normalhit to back up a little bit
|
||||
//so we dont run through the wall
|
||||
normalhit.x -= 0.4 * fear_vector.x;
|
||||
normalhit.y -= 0.4 * fear_vector.y;
|
||||
|
||||
|
||||
float xd = normalhit.x - start.x;
|
||||
if(xd < 0)
|
||||
xd = 0 - xd;
|
||||
float yd = normalhit.y - start.y;
|
||||
if(yd < 0)
|
||||
yd = 0 - yd;
|
||||
|
||||
|
||||
//this 2 is arbitrary
|
||||
if((xd+yd) > 2.0) {
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
@@ -508,38 +508,38 @@ void Mob::CalculateFearPosition() {
|
||||
cur_wp_x = normalhit.x;
|
||||
cur_wp_y = normalhit.y;
|
||||
cur_wp_z = GetZ();
|
||||
|
||||
|
||||
//try and fix up the Z coord if possible
|
||||
//not sure if this is worth it, since it prolly isnt up much
|
||||
|
||||
|
||||
NodeRef c = zone->zonemap->SeekNode(zone->zonemap->GetRoot(), end.x, end.y);
|
||||
if(c != NODE_NONE) {
|
||||
cur_wp_z = zone->zonemap->FindBestZ(c, end, &hit, nullptr);
|
||||
if(cur_wp_z < start.z)
|
||||
cur_wp_z = end.z; //revert on error
|
||||
}
|
||||
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
LogFile->write(EQEMuLog::Debug, "Fear Pathing: From (%.2f, %.2f, %.2f) normal hit at (%.2f, %.2f, %.2f)",
|
||||
GetX(), GetY(), GetZ(), normalhit.x, normalhit.y, normalhit.z);
|
||||
#endif
|
||||
|
||||
|
||||
//if we get here, we cannot run along our normal vector...
|
||||
//try up hill first
|
||||
|
||||
|
||||
/*
|
||||
while this uphill stuff works great in outdoor zones,
|
||||
it totally breaks dungeons...
|
||||
|
||||
|
||||
float speed = GetRunspeed();
|
||||
end.x = start.x + fear_vector.x * speed;
|
||||
end.y = start.y + fear_vector.y * speed;
|
||||
end.z = start.z + speed + speed;
|
||||
|
||||
|
||||
if(!zone->zonemap->LineIntersectsZone(start, end, 0.5, &hit, nullptr)) {
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
LogFile->write(EQEMuLog::Debug, "Fear Pathing: From (%.2f, %.2f, %.2f) up hill run to (%.2f, %.2f, %.2f)",
|
||||
@@ -549,19 +549,19 @@ void Mob::CalculateFearPosition() {
|
||||
cur_wp_x = end.x - 0.4 * fear_vector.x;
|
||||
cur_wp_y = end.y - 0.4 * fear_vector.y;
|
||||
cur_wp_z = end.z;
|
||||
|
||||
|
||||
//try and fix up the Z coord if possible
|
||||
//not sure if this is worth it, since it prolly isnt up much
|
||||
|
||||
|
||||
NodeRef c = zone->zonemap->SeekNode(zone->zonemap->GetRoot(), end.x, end.y);
|
||||
if(c != NODE_NONE) {
|
||||
cur_wp_z = zone->zonemap->FindBestZ(c, end, &hit, nullptr);
|
||||
if(cur_wp_z < start.z)
|
||||
cur_wp_z = end.z; //revert on error
|
||||
}
|
||||
|
||||
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
|
||||
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
@@ -578,7 +578,7 @@ void Mob::CalculateFearPosition() {
|
||||
end.y = start.y + fear_vector.y * 3;
|
||||
}
|
||||
end.z = start.z + 3; //a little lift as always
|
||||
|
||||
|
||||
if(!zone->zonemap->LineIntersectsZone(start, end, 0.5, &hit, nullptr)) {
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
LogFile->write(EQEMuLog::Debug, "Fear Pathing: From (%.2f, %.2f, %.2f) strafe 1 to (%.2f, %.2f, %.2f)",
|
||||
@@ -588,10 +588,10 @@ void Mob::CalculateFearPosition() {
|
||||
cur_wp_x = end.x - 0.4 * fear_vector.x;
|
||||
cur_wp_y = end.y - 0.4 * fear_vector.y;
|
||||
cur_wp_z = end.z - 3;
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//now the other...
|
||||
if(fear_vector.x < fear_vector.y) {
|
||||
end.x = start.x + fear_vector.x * 3;
|
||||
@@ -601,7 +601,7 @@ void Mob::CalculateFearPosition() {
|
||||
end.y = start.y + fear_vector.y * 3;
|
||||
}
|
||||
end.z = start.z + 3; //a little lift as always
|
||||
|
||||
|
||||
if(!zone->zonemap->LineIntersectsZone(start, end, 0.5, &hit, nullptr)) {
|
||||
#ifdef FEAR_PATHING_DEBUG
|
||||
LogFile->write(EQEMuLog::Debug, "Fear Pathing: From (%.2f, %.2f, %.2f) strafe 2 to (%.2f, %.2f, %.2f)",
|
||||
@@ -611,13 +611,13 @@ void Mob::CalculateFearPosition() {
|
||||
cur_wp_x = end.x - 0.4 * fear_vector.x;
|
||||
cur_wp_y = end.y - 0.4 * fear_vector.y;
|
||||
cur_wp_z = end.z - 3;
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, GetRunspeed(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//if we get here... we have wasted enough CPU cycles
|
||||
//just call it quits on fear pathing...
|
||||
|
||||
|
||||
//send them to normalhit and then stop
|
||||
cur_wp_x = normalhit.x;
|
||||
cur_wp_y = normalhit.y;
|
||||
|
||||
+54
-54
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -89,18 +89,18 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
|
||||
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++) {
|
||||
item[c] = 0;
|
||||
}
|
||||
|
||||
|
||||
uint32 chancepool = 0;
|
||||
|
||||
|
||||
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);
|
||||
@@ -111,7 +111,7 @@ LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[ind
|
||||
chancepool = chance[index];
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
@@ -119,14 +119,14 @@ LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[ind
|
||||
safe_delete_array(query);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(chancepool == 0 || index < 1)
|
||||
return(0);
|
||||
|
||||
|
||||
if(index == 1) {
|
||||
return(item[0]);
|
||||
}
|
||||
|
||||
|
||||
ret = 0;
|
||||
|
||||
uint32 rindex = MakeRandomInt(1, chancepool);
|
||||
@@ -137,7 +137,7 @@ LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[ind
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
||||
uint8 index = 0;
|
||||
uint32 item[50];
|
||||
uint32 chance[50];
|
||||
@@ -155,12 +155,12 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
|
||||
uint32 npc_chances[50];
|
||||
uint32 chancepool = 0;
|
||||
uint32 ret = 0;
|
||||
|
||||
|
||||
for (int c=0; c<50; c++) {
|
||||
item[c]=0;
|
||||
chance[c]=0;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@@ -168,12 +168,12 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
|
||||
item[index] = atoi(row[0]);
|
||||
chance[index] = atoi(row[1])+chancepool;
|
||||
chancepool = chance[index];
|
||||
|
||||
|
||||
npc_ids[index] = atoi(row[2]);
|
||||
npc_chances[index] = atoi(row[3]);
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
@@ -181,7 +181,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
|
||||
safe_delete_array(query);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
npc_id = 0;
|
||||
npc_chance = 0;
|
||||
if (index>0) {
|
||||
@@ -199,7 +199,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -234,10 +234,10 @@ bool Client::CanFish() {
|
||||
|
||||
HeadingDegrees = (int) ((GetHeading()*360)/256);
|
||||
HeadingDegrees = HeadingDegrees % 360;
|
||||
|
||||
|
||||
RodX = x_pos + RodLength * sin(HeadingDegrees * M_PI/180.0f);
|
||||
RodY = y_pos + RodLength * cos(HeadingDegrees * M_PI/180.0f);
|
||||
|
||||
|
||||
// Do BestZ to find where the line hanging from the rod intersects the water (if it is water).
|
||||
// and go 1 unit into the water.
|
||||
VERTEX dest;
|
||||
@@ -289,13 +289,13 @@ void Client::GoFish()
|
||||
7007, // Rusty Dagger
|
||||
7007, // Rusty Dagger
|
||||
7007 // Rusty Dagger
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//success formula is not researched at all
|
||||
|
||||
|
||||
int fishing_skill = GetSkill(FISHING); //will take into account skill bonuses on pole & bait
|
||||
|
||||
|
||||
//make sure we still have a fishing pole on:
|
||||
int32 bslot = m_inv.HasItemByUse(ItemTypeFishingBait, 1, invWhereWorn|invWherePersonal);
|
||||
const ItemInst* Bait = nullptr;
|
||||
@@ -306,21 +306,21 @@ void Client::GoFish()
|
||||
if(bslot >= IDX_INV && Bait->GetItem()->SkillModType == FISHING) {
|
||||
fishing_skill += Bait->GetItem()->SkillModValue;
|
||||
}
|
||||
|
||||
|
||||
if (fishing_skill > 100)
|
||||
{
|
||||
fishing_skill = 100+((fishing_skill-100)/2);
|
||||
}
|
||||
|
||||
|
||||
if (MakeRandomInt(0,175) < fishing_skill) {
|
||||
uint32 food_id = 0;
|
||||
|
||||
|
||||
//25% chance to fish an item.
|
||||
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);
|
||||
|
||||
|
||||
//check for add NPC
|
||||
if(npc_chance > 0 && npc_id) {
|
||||
if(npc_chance < MakeRandomInt(0, 99)) {
|
||||
@@ -328,31 +328,31 @@ void Client::GoFish()
|
||||
if(tmp != nullptr) {
|
||||
NPC* npc = new NPC(tmp, nullptr, GetX()+3, GetY(), GetZ(), GetHeading(), FlyMode3);
|
||||
npc->AddLootTable();
|
||||
|
||||
|
||||
npc->AddToHateList(this, 1, 0, false); //no help yelling
|
||||
|
||||
|
||||
entity_list.AddNPC(npc);
|
||||
|
||||
|
||||
Message(MT_Emote, "You fish up a little more than you bargained for...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//consume bait, should we always consume bait on success?
|
||||
DeleteItemInInventory(bslot, 1, true); //do we need client update?
|
||||
|
||||
|
||||
if(food_id == 0) {
|
||||
int index = MakeRandomInt(0, MAX_COMMON_FISH_IDS-1);
|
||||
food_id = common_fish_ids[index];
|
||||
}
|
||||
|
||||
|
||||
const Item_Struct* food_item = database.GetItem(food_id);
|
||||
|
||||
|
||||
Message_StringID(MT_Skills, FISHING_SUCCESS);
|
||||
const ItemInst* inst = database.CreateItem(food_item, 1);
|
||||
if(inst != nullptr) {
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
this->Message_StringID(0,DUP_LORE);
|
||||
}
|
||||
@@ -384,7 +384,7 @@ void Client::GoFish()
|
||||
|
||||
parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0);
|
||||
}
|
||||
|
||||
|
||||
//chance to break fishing pole...
|
||||
//this is potentially exploitable in that they can fish
|
||||
//and then swap out items in primary slot... too lazy to fix right now
|
||||
@@ -401,9 +401,9 @@ void Client::GoFish()
|
||||
}
|
||||
|
||||
void Client::ForageItem(bool guarantee) {
|
||||
|
||||
|
||||
int skill_level = GetSkill(FORAGE);
|
||||
|
||||
|
||||
//be wary of the string ids in switch below when changing this.
|
||||
uint32 common_food_ids[MAX_COMMON_FOOD_IDS] = {
|
||||
13046, // Fruit
|
||||
@@ -415,23 +415,23 @@ void Client::ForageItem(bool guarantee) {
|
||||
14905, // mushroom
|
||||
13106 // Fishing Grubs
|
||||
};
|
||||
|
||||
|
||||
// these may need to be fine tuned, I am just guessing here
|
||||
if (guarantee || MakeRandomInt(0,199) < skill_level) {
|
||||
uint32 foragedfood = 0;
|
||||
uint32 stringid = FORAGE_NOEAT;
|
||||
|
||||
|
||||
if (MakeRandomInt(0,99) <= 25) {
|
||||
foragedfood = database.GetZoneForage(m_pp.zone_id, skill_level);
|
||||
}
|
||||
|
||||
|
||||
//not an else in case theres no DB food
|
||||
if(foragedfood == 0) {
|
||||
uint8 index = 0;
|
||||
index = MakeRandomInt(0, MAX_COMMON_FOOD_IDS-1);
|
||||
foragedfood = common_food_ids[index];
|
||||
}
|
||||
|
||||
|
||||
const Item_Struct* food_item = database.GetItem(foragedfood);
|
||||
|
||||
if(!food_item) {
|
||||
@@ -439,17 +439,17 @@ void Client::ForageItem(bool guarantee) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(foragedfood == 13106)
|
||||
if(foragedfood == 13106)
|
||||
stringid = FORAGE_GRUBS;
|
||||
else
|
||||
switch(food_item->ItemType) {
|
||||
|
||||
case ItemTypeFood:
|
||||
case ItemTypeFood:
|
||||
stringid = FORAGE_FOOD;
|
||||
break;
|
||||
|
||||
case ItemTypeDrink:
|
||||
if(strstr(food_item->Name, "ater"))
|
||||
|
||||
case ItemTypeDrink:
|
||||
if(strstr(food_item->Name, "ater"))
|
||||
stringid = FORAGE_WATER;
|
||||
else
|
||||
stringid = FORAGE_DRINK;
|
||||
@@ -457,12 +457,12 @@ void Client::ForageItem(bool guarantee) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Message_StringID(MT_Skills, stringid);
|
||||
const ItemInst* inst = database.CreateItem(food_item, 1);
|
||||
if(inst != nullptr) {
|
||||
// check to make sure it isn't a foraged lore item
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
this->Message_StringID(0,DUP_LORE);
|
||||
}
|
||||
@@ -474,9 +474,9 @@ void Client::ForageItem(bool guarantee) {
|
||||
}
|
||||
safe_delete(inst);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@@ -487,7 +487,7 @@ void Client::ForageItem(bool guarantee) {
|
||||
Message_StringID(MT_Skills, FORAGE_FAILED);
|
||||
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
|
||||
}
|
||||
|
||||
|
||||
CheckIncreaseSkill(FORAGE, nullptr, 5);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+80
-80
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -33,16 +33,16 @@ extern WorldServer worldserver;
|
||||
/*
|
||||
|
||||
note about how groups work:
|
||||
A group contains 2 list, a list of pointers to members and a
|
||||
A group contains 2 list, a list of pointers to members and a
|
||||
list of member names. All members of a group should have their
|
||||
name in the membername array, wether they are in the zone or not.
|
||||
Only members in this zone will have non-null pointers in the
|
||||
members array.
|
||||
members array.
|
||||
|
||||
*/
|
||||
|
||||
//create a group which should allready exist in the database
|
||||
Group::Group(uint32 gid)
|
||||
Group::Group(uint32 gid)
|
||||
: GroupIDConsumer(gid)
|
||||
{
|
||||
leader = nullptr;
|
||||
@@ -55,7 +55,7 @@ Group::Group(uint32 gid)
|
||||
uint32 i;
|
||||
for(i=0;i<MAX_GROUP_MEMBERS;i++)
|
||||
{
|
||||
memset(membername[i],0,64);
|
||||
memset(membername[i],0,64);
|
||||
MemberRoles[i] = 0;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ Group::Group(Mob* leader)
|
||||
}
|
||||
|
||||
Group::~Group()
|
||||
{
|
||||
{
|
||||
for(int i = 0; i < MAX_MARKED_NPCS; ++i)
|
||||
if(MarkedNPCs[i])
|
||||
{
|
||||
@@ -115,19 +115,19 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
|
||||
//avoid unneeded work
|
||||
if(copper == 0 && silver == 0 && gold == 0 && platinum == 0)
|
||||
return;
|
||||
|
||||
|
||||
uint32 i;
|
||||
uint8 membercount = 0;
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
if (members[i] != nullptr) {
|
||||
|
||||
membercount++;
|
||||
}
|
||||
}
|
||||
membercount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (membercount == 0)
|
||||
if (membercount == 0)
|
||||
return;
|
||||
|
||||
|
||||
uint32 mod;
|
||||
//try to handle round off error a little better
|
||||
if(membercount > 1) {
|
||||
@@ -147,7 +147,7 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
|
||||
copper += 10 * mod;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//calculate the splits
|
||||
//We can still round off copper pieces, but I dont care
|
||||
uint32 sc;
|
||||
@@ -161,7 +161,7 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
|
||||
buf[63] = '\0';
|
||||
string msg = "You receive";
|
||||
bool one = false;
|
||||
|
||||
|
||||
if(ppsplit > 0) {
|
||||
snprintf(buf, 63, " %u platinum", ppsplit);
|
||||
msg += buf;
|
||||
@@ -191,13 +191,13 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
|
||||
one = true;
|
||||
}
|
||||
msg += " as your split";
|
||||
|
||||
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 *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());
|
||||
}
|
||||
}
|
||||
@@ -264,15 +264,15 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte
|
||||
MemberRoles[i] = 0;
|
||||
|
||||
int x=1;
|
||||
|
||||
//build the template join packet
|
||||
|
||||
//build the template join packet
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
|
||||
GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer;
|
||||
GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer;
|
||||
strcpy(gj->membername, NewMemberName);
|
||||
gj->action = groupActJoin;
|
||||
|
||||
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
|
||||
@@ -331,7 +331,7 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte
|
||||
#ifdef BOTS
|
||||
for (i = 0;i < MAX_GROUP_MEMBERS; i++) {
|
||||
if (members[i] != nullptr && members[i]->IsBot()) {
|
||||
members[i]->CastToBot()->CalcChanceToCast();
|
||||
members[i]->CastToBot()->CalcChanceToCast();
|
||||
}
|
||||
}
|
||||
#endif //BOTS
|
||||
@@ -442,7 +442,7 @@ void Group::SendHPPacketsFrom(Mob *member)
|
||||
bool Group::UpdatePlayer(Mob* update){
|
||||
|
||||
VerifyGroup();
|
||||
|
||||
|
||||
uint32 i=0;
|
||||
if(update->IsClient()) {
|
||||
//update their player profile
|
||||
@@ -459,7 +459,7 @@ bool Group::UpdatePlayer(Mob* update){
|
||||
SendLeadershipAAUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++)
|
||||
{
|
||||
if (!strcasecmp(membername[i],update->GetName()))
|
||||
@@ -490,7 +490,7 @@ void Group::MemberZoned(Mob* removemob) {
|
||||
}
|
||||
#ifdef BOTS
|
||||
if (members[i] != nullptr && members[i]->IsBot()) {
|
||||
members[i]->CastToBot()->CalcChanceToCast();
|
||||
members[i]->CastToBot()->CalcChanceToCast();
|
||||
}
|
||||
#endif //BOTS
|
||||
}
|
||||
@@ -592,7 +592,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender)
|
||||
}
|
||||
#ifdef BOTS
|
||||
if (members[i] != nullptr && members[i]->IsBot()) {
|
||||
members[i]->CastToBot()->CalcChanceToCast();
|
||||
members[i]->CastToBot()->CalcChanceToCast();
|
||||
}
|
||||
#endif //BOTS
|
||||
}
|
||||
@@ -608,7 +608,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender)
|
||||
|
||||
if(oldmember->IsClient())
|
||||
database.SetGroupID(oldmember->GetCleanName(), 0, oldmember->CastToClient()->CharacterID());
|
||||
|
||||
|
||||
oldmember->SetGrouped(false);
|
||||
disbandcheck = true;
|
||||
|
||||
@@ -619,19 +619,19 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender)
|
||||
SetGroupTankTarget(0);
|
||||
UnDelegateMainTank(oldmember->GetName());
|
||||
}
|
||||
|
||||
|
||||
if(HasRole(oldmember, RoleAssist))
|
||||
{
|
||||
SetGroupAssistTarget(0);
|
||||
UnDelegateMainAssist(oldmember->GetName());
|
||||
}
|
||||
|
||||
|
||||
if(HasRole(oldmember, RolePuller))
|
||||
{
|
||||
SetGroupPullerTarget(0);
|
||||
UnDelegatePuller(oldmember->GetName());
|
||||
}
|
||||
|
||||
|
||||
if(oldmember->IsClient())
|
||||
SendMarkedNPCsToMember(oldmember->CastToClient(), true);
|
||||
|
||||
@@ -644,7 +644,7 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender)
|
||||
ClearAllNPCMarks();
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// does the caster + group
|
||||
@@ -657,7 +657,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) {
|
||||
|
||||
castspell = true;
|
||||
range = caster->GetAOERange(spell_id);
|
||||
|
||||
|
||||
float range2 = range*range;
|
||||
|
||||
// caster->SpellOnTarget(spell_id, caster);
|
||||
@@ -699,7 +699,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) {
|
||||
|
||||
castspell = true;
|
||||
range = caster->GetAOERange(spell_id);
|
||||
|
||||
|
||||
float range2 = range*range;
|
||||
|
||||
for(z=0; z < MAX_GROUP_MEMBERS; z++) {
|
||||
@@ -767,7 +767,7 @@ void Group::GroupMessage(Mob* sender, uint8 language, uint8 lang_skill, const ch
|
||||
strcpy(gcm->from, sender->GetName());
|
||||
strcpy(gcm->message, message);
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
uint32 Group::GetTotalGroupDamage(Mob* other) {
|
||||
@@ -805,7 +805,7 @@ void Group::DisbandGroup() {
|
||||
database.SetGroupID(members[i]->GetName(), 0, members[i]->CastToClient()->CharacterID());
|
||||
members[i]->CastToClient()->QueuePacket(outapp);
|
||||
SendMarkedNPCsToMember(members[i]->CastToClient(), true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
members[i]->SetGrouped(false);
|
||||
@@ -814,14 +814,14 @@ void Group::DisbandGroup() {
|
||||
}
|
||||
|
||||
ClearAllNPCMarks();
|
||||
|
||||
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_DisbandGroup, sizeof(ServerDisbandGroup_Struct));
|
||||
ServerDisbandGroup_Struct* dg = (ServerDisbandGroup_Struct*)pack->pBuffer;
|
||||
dg->zoneid = zone->GetZoneID();
|
||||
dg->groupid = GetID();
|
||||
dg->instance_id = zone->GetInstanceID();
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
safe_delete(pack);
|
||||
|
||||
entity_list.RemoveGroup(GetID());
|
||||
if(GetID() != 0)
|
||||
@@ -846,12 +846,12 @@ void Group::SendUpdate(uint32 type, Mob* member)
|
||||
{
|
||||
if(!member->IsClient())
|
||||
return;
|
||||
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate2_Struct));
|
||||
GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer;
|
||||
GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer;
|
||||
gu->action = type;
|
||||
strcpy(gu->yourname,member->GetName());
|
||||
|
||||
|
||||
int x = 0;
|
||||
|
||||
gu->leader_aas = LeaderAbilities;
|
||||
@@ -883,16 +883,16 @@ void Group::SendLeadershipAAUpdate()
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
|
||||
|
||||
GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer;
|
||||
GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer;
|
||||
|
||||
gu->action = groupActAAUpdate;
|
||||
|
||||
|
||||
uint32 i = 0;
|
||||
|
||||
gu->leader_aas = LeaderAbilities;
|
||||
|
||||
gu->NPCMarkerID = GetNPCMarkerID();
|
||||
|
||||
|
||||
for (i = 0;i < MAX_GROUP_MEMBERS; ++i)
|
||||
if(members[i] && members[i]->IsClient())
|
||||
{
|
||||
@@ -953,7 +953,7 @@ void Group::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float
|
||||
{
|
||||
members[i]->CastToClient()->MovePC(zoneID, instance_id, x, y, z, heading, 0, ZoneSolicited);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Group::LearnMembers() {
|
||||
@@ -1000,7 +1000,7 @@ LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long
|
||||
members[i] = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//it should be safe to use GetClientByName, but Group is trying
|
||||
//to be generic, so we'll go for general Mob
|
||||
Mob *them = entity_list.GetMob(membername[i]);
|
||||
@@ -1012,7 +1012,7 @@ LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long
|
||||
members[i] = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good.
|
||||
#if EQDEBUG >= 5
|
||||
LogFile->write(EQEMuLog::Debug, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]);
|
||||
@@ -1032,10 +1032,10 @@ void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, co
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
if(members[i] == nullptr)
|
||||
continue;
|
||||
|
||||
|
||||
if(members[i] == sender)
|
||||
continue;
|
||||
|
||||
|
||||
members[i]->Message_StringID(type, string_id, message, message2, message3, message4, message5, message6, message7, message8, message9, 0);
|
||||
}
|
||||
}
|
||||
@@ -1044,7 +1044,7 @@ void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, co
|
||||
|
||||
void Client::LeaveGroup() {
|
||||
Group *g = GetGroup();
|
||||
|
||||
|
||||
if(g) {
|
||||
if(g->GroupCount() < 3)
|
||||
g->DisbandGroup();
|
||||
@@ -1054,7 +1054,7 @@ void Client::LeaveGroup() {
|
||||
//force things a little
|
||||
database.SetGroupID(GetName(), 0, CharacterID());
|
||||
}
|
||||
|
||||
|
||||
isgrouped = false;
|
||||
}
|
||||
|
||||
@@ -1130,7 +1130,7 @@ void Group::BalanceMana(int32 penalty)
|
||||
for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++)
|
||||
{
|
||||
if(members[gi]){
|
||||
if((members[gi]->GetMaxMana() - manataken) < 1){
|
||||
if((members[gi]->GetMaxMana() - manataken) < 1){
|
||||
members[gi]->SetMana(1);
|
||||
if (members[gi]->IsClient())
|
||||
members[gi]->CastToClient()->SendManaUpdate();
|
||||
@@ -1229,7 +1229,7 @@ void Group::MarkNPC(Mob* Target, int Number)
|
||||
|
||||
safe_delete(outapp);
|
||||
|
||||
UpdateXTargetMarkedNPC(Number, m);
|
||||
UpdateXTargetMarkedNPC(Number, m);
|
||||
}
|
||||
|
||||
void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
|
||||
@@ -1238,7 +1238,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
|
||||
// (or himself). All group members in the zone are notified of the new Main Tank and it is recorded
|
||||
// in the group_leaders table so as to persist across zones.
|
||||
//
|
||||
|
||||
|
||||
bool updateDB = false;
|
||||
|
||||
if(!NewMainTankName)
|
||||
@@ -1251,7 +1251,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
|
||||
|
||||
if(MainTankName != NewMainTankName || !toggle)
|
||||
updateDB = true;
|
||||
|
||||
|
||||
if(m->GetTarget())
|
||||
TankTargetID = m->GetTarget()->GetID();
|
||||
else
|
||||
@@ -1290,7 +1290,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
|
||||
// (or himself). All group members in the zone are notified of the new Main Assist and it is recorded
|
||||
// in the group_leaders table so as to persist across zones.
|
||||
//
|
||||
|
||||
|
||||
bool updateDB = false;
|
||||
|
||||
if(!NewMainAssistName)
|
||||
@@ -1300,7 +1300,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
|
||||
|
||||
if(!m)
|
||||
return;
|
||||
|
||||
|
||||
if(MainAssistName != NewMainAssistName || !toggle)
|
||||
updateDB = true;
|
||||
|
||||
@@ -1339,7 +1339,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
|
||||
// (or himself). All group members in the zone are notified of the new Puller and it is recorded
|
||||
// in the group_leaders table so as to persist across zones.
|
||||
//
|
||||
|
||||
|
||||
bool updateDB = false;
|
||||
|
||||
if(!NewPullerName)
|
||||
@@ -1349,7 +1349,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
|
||||
|
||||
if(!m)
|
||||
return;
|
||||
|
||||
|
||||
if(PullerName != NewPullerName || !toggle)
|
||||
updateDB = true;
|
||||
|
||||
@@ -1412,7 +1412,7 @@ void Group::NotifyMainTank(Client *c, uint8 toggle)
|
||||
|
||||
strn0cpy(grs->Name2, GetLeaderName(), sizeof(grs->Name2));
|
||||
|
||||
grs->RoleNumber = 1;
|
||||
grs->RoleNumber = 1;
|
||||
|
||||
grs->Toggle = toggle;
|
||||
|
||||
@@ -1420,7 +1420,7 @@ void Group::NotifyMainTank(Client *c, uint8 toggle)
|
||||
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Group::NotifyMainAssist(Client *c, uint8 toggle)
|
||||
@@ -1533,7 +1533,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle)
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main tank: %s\n", errbuff);
|
||||
|
||||
safe_delete_array(Query);
|
||||
|
||||
|
||||
if(!toggle) {
|
||||
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
|
||||
if(members[i] && members[i]->IsClient())
|
||||
@@ -1587,7 +1587,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle)
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main assist: %s\n", errbuff);
|
||||
|
||||
safe_delete_array(Query);
|
||||
|
||||
|
||||
if(!toggle)
|
||||
{
|
||||
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i)
|
||||
@@ -1619,7 +1619,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle)
|
||||
LogFile->write(EQEMuLog::Error, "Unable to clear group main puller: %s\n", errbuff);
|
||||
|
||||
safe_delete_array(Query);
|
||||
|
||||
|
||||
if(!toggle) {
|
||||
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
|
||||
if(members[i] && members[i]->IsClient())
|
||||
@@ -1712,7 +1712,7 @@ void Group::NotifyAssistTarget(Client *c)
|
||||
Mob *m = entity_list.GetMob(AssistTargetID);
|
||||
|
||||
c->UpdateXTargetType(GroupAssistTarget, m);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Group::NotifyTankTarget(Client *c)
|
||||
@@ -1816,7 +1816,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName)
|
||||
|
||||
if(!NPCMarkerName.size())
|
||||
return;
|
||||
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct));
|
||||
|
||||
DelegateAbility_Struct* das = (DelegateAbility_Struct*)outapp->pBuffer;
|
||||
@@ -1858,9 +1858,9 @@ void Group::SaveGroupLeaderAA()
|
||||
char *Query = new char[200 + sizeof(GroupLeadershipAA_Struct)*2];
|
||||
|
||||
char *End = Query;
|
||||
|
||||
|
||||
End += sprintf(End, "UPDATE group_leaders SET leadershipaa='");
|
||||
|
||||
|
||||
End += database.DoEscapeString(End, (char*)&LeaderAbilities, sizeof(GroupLeadershipAA_Struct));
|
||||
|
||||
End += sprintf(End,"' WHERE gid=%i LIMIT 1", GetID());
|
||||
@@ -1868,7 +1868,7 @@ void Group::SaveGroupLeaderAA()
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
if (!database.RunQuery(Query, End - Query, errbuff))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", errbuff);
|
||||
|
||||
|
||||
safe_delete_array(Query);
|
||||
}
|
||||
|
||||
@@ -1883,10 +1883,10 @@ void Group::UnMarkNPC(uint16 ID)
|
||||
if(AssistTargetID == ID)
|
||||
AssistTargetID = 0;
|
||||
|
||||
|
||||
|
||||
if(TankTargetID == ID)
|
||||
TankTargetID = 0;
|
||||
|
||||
|
||||
if(PullerTargetID == ID)
|
||||
PullerTargetID = 0;
|
||||
|
||||
@@ -1963,11 +1963,11 @@ void Group::ClearAllNPCMarks()
|
||||
|
||||
int8 Group::GetNumberNeedingHealedInGroup(int8 hpr, bool includePets) {
|
||||
int8 needHealed = 0;
|
||||
|
||||
|
||||
for( int i = 0; i<MAX_GROUP_MEMBERS; i++) {
|
||||
if(members[i] && !members[i]->qglobal) {
|
||||
|
||||
if(members[i]->GetHPRatio() <= hpr)
|
||||
if(members[i]->GetHPRatio() <= hpr)
|
||||
needHealed++;
|
||||
|
||||
if(includePets) {
|
||||
@@ -1976,7 +1976,7 @@ int8 Group::GetNumberNeedingHealedInGroup(int8 hpr, bool includePets) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return needHealed;
|
||||
@@ -2040,15 +2040,15 @@ void Group::ChangeLeader(Mob* newleader)
|
||||
// this changes the current group leader, notifies other members, and updates leadship AA
|
||||
|
||||
// if the new leader is invalid, do nothing
|
||||
if (!newleader)
|
||||
if (!newleader)
|
||||
return;
|
||||
|
||||
|
||||
Mob* oldleader = GetLeader();
|
||||
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
|
||||
GroupJoin_Struct* gu = (GroupJoin_Struct*) outapp->pBuffer;
|
||||
gu->action = groupActMakeLeader;
|
||||
|
||||
|
||||
strcpy(gu->membername, newleader->GetName());
|
||||
strcpy(gu->yourname, oldleader->GetName());
|
||||
SetLeader(newleader);
|
||||
@@ -2060,7 +2060,7 @@ void Group::ChangeLeader(Mob* newleader)
|
||||
{
|
||||
if(members[i]->CastToClient()->GetClientVersion() >= EQClientSoD)
|
||||
members[i]->CastToClient()->SendGroupLeaderChangePacket(newleader->GetName());
|
||||
|
||||
|
||||
members[i]->CastToClient()->QueuePacket(outapp);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@ public:
|
||||
GroupIDConsumer() { id = 0; }
|
||||
GroupIDConsumer(uint32 gid) { id = gid; }
|
||||
inline const uint32 GetID() const { return id; }
|
||||
|
||||
|
||||
protected:
|
||||
friend class EntityList;
|
||||
//use of this function is highly discouraged
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
Group(Mob* leader);
|
||||
Group(uint32 gid);
|
||||
~Group();
|
||||
|
||||
|
||||
bool AddMember(Mob* newmember, const char* NewMemberName = nullptr, uint32 CharacterID = 0);
|
||||
void AddMember(const char* NewMemberName);
|
||||
void SendUpdate(uint32 type,Mob* member);
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
void ChangeLeader(Mob* newleader);
|
||||
const char *GetClientNameByIndex(uint8 index);
|
||||
void UpdateXTargetMarkedNPC(uint32 Number, Mob *m);
|
||||
|
||||
|
||||
Mob* members[MAX_GROUP_MEMBERS];
|
||||
char membername[MAX_GROUP_MEMBERS][64];
|
||||
uint8 MemberRoles[MAX_GROUP_MEMBERS];
|
||||
|
||||
+29
-29
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -53,7 +53,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) {
|
||||
GuildMOTD_Struct *motd = (GuildMOTD_Struct *) outapp->pBuffer;
|
||||
motd->unknown0 = 0;
|
||||
strn0cpy(motd->name, m_pp.name, 64);
|
||||
|
||||
|
||||
if(IsInAGuild()) {
|
||||
if(!guild_mgr.GetGuildMOTD(GuildID(), motd->motd, motd->setby_name)) {
|
||||
motd->setby_name[0] = '\0';
|
||||
@@ -63,12 +63,12 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) {
|
||||
//we have to send them an empty MOTD anywyas.
|
||||
motd->motd[0] = '\0'; //just to be sure
|
||||
motd->setby_name[0] = '\0'; //just to be sure
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildMOTD of length %d", outapp->size);
|
||||
mpkt(GUILDS__OUT_PACKET_TRACE, outapp);
|
||||
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ void Client::SendGuildSpawnAppearance() {
|
||||
SendAppearancePacket(AT_GuildID, GuildID());
|
||||
SendAppearancePacket(AT_GuildRank, rank);
|
||||
}
|
||||
|
||||
|
||||
UpdateWho();
|
||||
}
|
||||
|
||||
@@ -134,17 +134,17 @@ void Client::SendGuildList() {
|
||||
EQApplicationPacket *outapp;
|
||||
// outapp = new EQApplicationPacket(OP_ZoneGuildList);
|
||||
outapp = new EQApplicationPacket(OP_GuildsList);
|
||||
|
||||
|
||||
//ask the guild manager to build us a nice guild list packet
|
||||
outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size);
|
||||
if(outapp->pBuffer == nullptr) {
|
||||
mlog(GUILDS__ERROR, "Unable to make guild list!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mlog(GUILDS__OUT_PACKETS, "Sending OP_ZoneGuildList of length %d", outapp->size);
|
||||
// mpkt(GUILDS__OUT_PACKET_TRACE, outapp);
|
||||
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
@@ -154,15 +154,15 @@ void Client::SendGuildMembers() {
|
||||
uint8 *data = guild_mgr.MakeGuildMembers(GuildID(), GetName(), len);
|
||||
if(data == nullptr)
|
||||
return; //invalid guild, shouldent happen.
|
||||
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GuildMemberList);
|
||||
outapp->size = len;
|
||||
outapp->pBuffer = data;
|
||||
data = nullptr;
|
||||
|
||||
|
||||
mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildMemberList of length %d", outapp->size);
|
||||
mpkt(GUILDS__OUT_PACKET_TRACE, outapp);
|
||||
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct));
|
||||
@@ -189,13 +189,13 @@ void Client::RefreshGuildInfo()
|
||||
guild_id = GUILD_NONE;
|
||||
|
||||
bool WasBanker = GuildBanker;
|
||||
|
||||
|
||||
CharGuildInfo info;
|
||||
if(!guild_mgr.GetCharInfo(CharacterID(), info)) {
|
||||
mlog(GUILDS__ERROR, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
guildrank = info.rank;
|
||||
guild_id = info.guild_id;
|
||||
GuildBanker = info.banker || guild_mgr.IsGuildLeader(GuildID(), CharacterID());
|
||||
@@ -223,7 +223,7 @@ void Client::RefreshGuildInfo()
|
||||
GuildBanks->SendGuildBank(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SendGuildSpawnAppearance();
|
||||
}
|
||||
|
||||
@@ -274,10 +274,10 @@ void EntityList::RefreshAllGuildInfo(uint32 guild_id) {
|
||||
void EntityList::SendGuildMembers(uint32 guild_id) {
|
||||
if(guild_id == GUILD_NONE)
|
||||
return;
|
||||
|
||||
|
||||
//this could be optimized a bit to only build the member's packet once
|
||||
//and then keep swapping out the name in the packet on each send.
|
||||
|
||||
|
||||
LinkedListIterator<Client*> iterator(client_list);
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
@@ -308,19 +308,19 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){
|
||||
strcpy(outgj->name, gj->name);
|
||||
outgj->rank = gj->rank;
|
||||
outgj->zoneid = gj->zoneid;
|
||||
|
||||
|
||||
mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildManageAdd for join of length %d", outapp->size);
|
||||
mpkt(GUILDS__OUT_PACKET_TRACE, outapp);
|
||||
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
|
||||
// SendGuildMembers(gj->guild_id, true);
|
||||
}
|
||||
|
||||
/*
|
||||
void EntityList::SendGuildJoin(GuildJoin_Struct* gj){
|
||||
LinkedListIterator<Client*> iterator(client_list);
|
||||
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements())
|
||||
{
|
||||
@@ -383,14 +383,14 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid,uint16 guild_id,const char* zone)
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
if (!RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT guild FROM doors where doorid=%i AND zone='%s'",
|
||||
if (!RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT guild FROM doors where doorid=%i AND zone='%s'",
|
||||
doorid-128, zone), errbuf, &result))
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in CheckGuildDoor query '%s': %s", query, errbuf);
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
} else {
|
||||
} else {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
if (atoi(row[0]) == guild_id)
|
||||
@@ -403,7 +403,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid,uint16 guild_id,const char* zone)
|
||||
mysql_free_result(result);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// code below will never be reached
|
||||
mysql_free_result(result);
|
||||
return false;
|
||||
@@ -418,7 +418,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone)
|
||||
uint32 affected_rows = 0;
|
||||
if (doorid > 127)
|
||||
doorid = doorid - 128;
|
||||
if (!RunQuery(query, MakeAnyLenString(&query,
|
||||
if (!RunQuery(query, MakeAnyLenString(&query,
|
||||
"UPDATE doors SET guild = %i WHERE (doorid=%i) AND (zone='%s')",
|
||||
guild_id, doorid, zone), errbuf, 0,&affected_rows))
|
||||
{
|
||||
@@ -426,9 +426,9 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone)
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
return(affected_rows > 0);
|
||||
}
|
||||
|
||||
|
||||
+68
-68
@@ -98,7 +98,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b
|
||||
void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) {
|
||||
if(guild_id == 0) {
|
||||
_log(GUILDS__REFRESH, "Guild lookup for char %d when sending char refresh.", charid);
|
||||
|
||||
|
||||
CharGuildInfo gci;
|
||||
if(!GetCharInfo(charid, gci)) {
|
||||
guild_id = GUILD_NONE;
|
||||
@@ -106,9 +106,9 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin
|
||||
guild_id = gci.guild_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_log(GUILDS__REFRESH, "Sending char refresh for %d from guild %d to world", charid, guild_id);
|
||||
|
||||
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
|
||||
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
|
||||
s->guild_id = guild_id;
|
||||
@@ -138,7 +138,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID)
|
||||
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
|
||||
void ZoneGuildManager::SendGuildDelete(uint32 guild_id) {
|
||||
_log(GUILDS__REFRESH, "Sending guild delete for guild %d to world", guild_id);
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
|
||||
@@ -151,7 +151,7 @@ void ZoneGuildManager::SendGuildDelete(uint32 guild_id) {
|
||||
//makes a guild member list packet (internal format), returns ownership of the buffer.
|
||||
uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_name, uint32 &length) {
|
||||
uint8 *retbuffer;
|
||||
|
||||
|
||||
//hack because we dont have the "remove from guild" packet right now.
|
||||
if(guild_id == GUILD_NONE) {
|
||||
length = sizeof(Internal_GuildMembers_Struct);
|
||||
@@ -163,11 +163,11 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
|
||||
gms->note_length = 0;
|
||||
return(retbuffer);
|
||||
}
|
||||
|
||||
|
||||
vector<CharGuildInfo *> members;
|
||||
if(!GetEntireGuild(guild_id, members))
|
||||
return(nullptr);
|
||||
|
||||
|
||||
//figure out the actual packet length.
|
||||
uint32 fixed_length = sizeof(Internal_GuildMembers_Struct) + members.size()*sizeof(Internal_GuildMemberEntry_Struct);
|
||||
vector<CharGuildInfo *>::iterator cur, end;
|
||||
@@ -181,32 +181,32 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
|
||||
name_len += ci->char_name.length();
|
||||
note_len += ci->public_note.length();
|
||||
}
|
||||
|
||||
|
||||
//calc total length.
|
||||
length = fixed_length + name_len + note_len + members.size()*2; //string data + null terminators
|
||||
|
||||
|
||||
//make our nice buffer
|
||||
retbuffer = new uint8[length];
|
||||
|
||||
|
||||
Internal_GuildMembers_Struct *gms = (Internal_GuildMembers_Struct *) retbuffer;
|
||||
|
||||
|
||||
//fill in the global header
|
||||
strcpy(gms->player_name, prefix_name);
|
||||
gms->count = members.size();
|
||||
gms->name_length = name_len;
|
||||
gms->note_length = note_len;
|
||||
|
||||
|
||||
char *name_buf = (char *) ( retbuffer + fixed_length );
|
||||
char *note_buf = (char *) ( name_buf + name_len + members.size() );
|
||||
|
||||
|
||||
//fill in each member's entry.
|
||||
Internal_GuildMemberEntry_Struct *e = gms->member;
|
||||
|
||||
|
||||
cur = members.begin();
|
||||
end = members.end();
|
||||
for(; cur != end; cur++) {
|
||||
ci = *cur;
|
||||
|
||||
|
||||
//the order we set things here must match the struct
|
||||
|
||||
//nice helper macro
|
||||
@@ -215,7 +215,7 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
|
||||
field += str.length() + 1
|
||||
#define PutField(field) \
|
||||
e->field = ci->field
|
||||
|
||||
|
||||
SlideStructString( name_buf, ci->char_name );
|
||||
PutField(level);
|
||||
e->banker = ci->banker + (ci->alt * 2); // low bit is banker flag, next bit is 'alt' flag.
|
||||
@@ -230,12 +230,12 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
|
||||
e->zone_id = 0; // Flag them as offline (zoneid 0) as world will update us with their online status afterwards.
|
||||
#undef SlideStructString
|
||||
#undef PutFieldN
|
||||
|
||||
|
||||
delete *cur;
|
||||
|
||||
|
||||
e++;
|
||||
}
|
||||
|
||||
|
||||
return(retbuffer);
|
||||
}
|
||||
|
||||
@@ -266,15 +266,15 @@ void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
|
||||
c->Message(0, "Guild %d not found.", guild_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const GuildInfo *info = res->second;
|
||||
|
||||
|
||||
c->Message(0, "Guild info DB# %i <%s>", guild_id, info->name.c_str());
|
||||
|
||||
|
||||
char leadername[64];
|
||||
database.GetCharName(info->leader_char_id, leadername);
|
||||
c->Message(0, "Guild Leader: %s", leadername);
|
||||
|
||||
|
||||
char permbuffer[256];
|
||||
uint8 i;
|
||||
for (i = 0; i <= GUILD_MAX_RANK; i++) {
|
||||
@@ -282,14 +282,14 @@ void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
|
||||
uint8 r;
|
||||
for(r = 0; r < _MaxGuildAction; r++)
|
||||
permptr += sprintf(permptr, " %s: %c", GuildActionNames[r], info->ranks[i].permissions[r]?'Y':'N');
|
||||
|
||||
|
||||
c->Message(0, "Rank %i: %s", i, info->ranks[i].name.c_str());
|
||||
c->Message(0, "Permissions: %s", permbuffer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//in theory, we could get a pile of unused entries in this array, but only if
|
||||
//in theory, we could get a pile of unused entries in this array, but only if
|
||||
//we had a malicious client sending controlled packets, plus its like 10 bytes per entry.
|
||||
void ZoneGuildManager::RecordInvite(uint32 char_id, uint32 guild_id, uint8 rank) {
|
||||
m_inviteQueue[char_id] = pair<uint32, uint8>(guild_id, rank);
|
||||
@@ -318,50 +318,50 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
return;
|
||||
}
|
||||
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
|
||||
|
||||
|
||||
_log(GUILDS__REFRESH, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
|
||||
|
||||
|
||||
//reload all the guild details from the database.
|
||||
RefreshGuild(s->guild_id);
|
||||
|
||||
|
||||
if(s->motd_change) {
|
||||
//resend guild MOTD to all guild members in this zone.
|
||||
entity_list.SendGuildMOTD(s->guild_id);
|
||||
}
|
||||
|
||||
|
||||
if(s->name_change) {
|
||||
//until we figure out the guild update packet, we resend the whole guild list.
|
||||
entity_list.SendGuildList();
|
||||
}
|
||||
|
||||
|
||||
if(s->rank_change) {
|
||||
//we need to send spawn appearance packets for all members of this guild in the zone, to everybody.
|
||||
entity_list.SendGuildSpawnAppearance(s->guild_id);
|
||||
}
|
||||
|
||||
|
||||
if(s->relation_change) {
|
||||
//unknown until we implement guild relations.
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case ServerOP_GuildCharRefresh: {
|
||||
if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) {
|
||||
_log(GUILDS__ERROR, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
|
||||
return;
|
||||
}
|
||||
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
|
||||
|
||||
|
||||
_log(GUILDS__REFRESH, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id);
|
||||
|
||||
|
||||
Client *c = entity_list.GetClientByCharID(s->char_id);
|
||||
|
||||
|
||||
if(c != nullptr) {
|
||||
//this reloads the char's guild info from the database and sends appearance updates
|
||||
c->RefreshGuildInfo();
|
||||
}
|
||||
|
||||
|
||||
//it would be nice if we had the packet to send just a one-person update
|
||||
if(s->guild_id == GUILD_NONE) {
|
||||
if(c != nullptr)
|
||||
@@ -369,18 +369,18 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
} else {
|
||||
entity_list.SendGuildMembers(s->guild_id); //even send GUILD_NONE (empty)
|
||||
}
|
||||
|
||||
|
||||
if(s->old_guild_id != 0 && s->old_guild_id != GUILD_NONE && s->old_guild_id != s->guild_id)
|
||||
entity_list.SendGuildMembers(s->old_guild_id);
|
||||
else if(c != nullptr && s->guild_id != GUILD_NONE) {
|
||||
//char is in zone, and has changed into a new guild, send MOTD.
|
||||
c->SendGuildMOTD();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case ServerOP_GuildRankUpdate:
|
||||
{
|
||||
if(ZoneLoaded)
|
||||
@@ -394,7 +394,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
}
|
||||
|
||||
ServerGuildRankUpdate_Struct *sgrus = (ServerGuildRankUpdate_Struct*)pack->pBuffer;
|
||||
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_SetGuildRank, sizeof(GuildSetRank_Struct));
|
||||
|
||||
GuildSetRank_Struct *gsrs = (GuildSetRank_Struct*)outapp->pBuffer;
|
||||
@@ -417,26 +417,26 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
return;
|
||||
}
|
||||
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
|
||||
|
||||
|
||||
_log(GUILDS__REFRESH, "Received guild delete from world for guild %d", s->guild_id);
|
||||
|
||||
|
||||
//clear all the guild tags.
|
||||
entity_list.RefreshAllGuildInfo(s->guild_id);
|
||||
|
||||
|
||||
//remove the guild data from the local guild manager
|
||||
guild_mgr.LocalDeleteGuild(s->guild_id);
|
||||
|
||||
|
||||
//if we stop forcing guild list to send on guild create, we need to do this:
|
||||
//in the case that we delete a guild and add a new one.
|
||||
//entity_list.SendGuildList();
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case ServerOP_GuildMemberUpdate:
|
||||
{
|
||||
ServerGuildMemberUpdate_Struct *sgmus = (ServerGuildMemberUpdate_Struct*)pack->pBuffer;
|
||||
|
||||
|
||||
if(ZoneLoaded)
|
||||
{
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct));
|
||||
@@ -463,7 +463,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
uint32 FromID = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
|
||||
uint32 Count = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
|
||||
Client *c = entity_list.GetClientByCharID(FromID);
|
||||
|
||||
|
||||
if (!c || !c->IsInAGuild())
|
||||
{
|
||||
_log(GUILDS__ERROR,"Invalid Client or not in guild. ID=%i", FromID);
|
||||
@@ -489,7 +489,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ServerOP_LFGuildUpdate:
|
||||
{
|
||||
if(ZoneLoaded)
|
||||
@@ -507,7 +507,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
TimeZone = pack->ReadUInt32();
|
||||
TimePosted = pack->ReadUInt32();
|
||||
Toggle = pack->ReadUInt32();
|
||||
|
||||
|
||||
uint32 GuildID = GetGuildIDByName(GuildName);
|
||||
|
||||
if(GuildID == GUILD_NONE)
|
||||
@@ -517,7 +517,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
|
||||
LFGuild_GuildToggle_Struct *gts = (LFGuild_GuildToggle_Struct *)outapp->pBuffer;
|
||||
gts->Command = 1;
|
||||
strcpy(gts->Comment, Comments);
|
||||
strcpy(gts->Comment, Comments);
|
||||
gts->FromLevel = FromLevel;
|
||||
gts->ToLevel = ToLevel;
|
||||
gts->Classes = Classes;
|
||||
@@ -552,7 +552,7 @@ void ZoneGuildManager::RequestOnlineGuildMembers(uint32 FromID, uint32 GuildID)
|
||||
{
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct));
|
||||
ServerRequestOnlineGuildMembers_Struct *srogm = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer;
|
||||
|
||||
|
||||
srogm->FromID = FromID;
|
||||
srogm->GuildID = GuildID;
|
||||
worldserver.SendPacket(pack);
|
||||
@@ -618,7 +618,7 @@ GuildApproval* ZoneGuildManager::FindGuildByIDApproval(uint32 refid)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
GuildApproval* ZoneGuildManager::FindGuildByOwnerApproval(Client* owner)
|
||||
{
|
||||
LinkedListIterator<GuildApproval*> iterator(list);
|
||||
@@ -779,7 +779,7 @@ void GuildBankManager::SendGuildBank(Client *c)
|
||||
continue;
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct));
|
||||
|
||||
|
||||
GuildBankItemUpdate_Struct *gbius = (GuildBankItemUpdate_Struct*)outapp->pBuffer;
|
||||
|
||||
if(!Item->Stackable)
|
||||
@@ -804,7 +804,7 @@ void GuildBankManager::SendGuildBank(Client *c)
|
||||
c->FastQueuePacket(&outapp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < GUILD_BANK_MAIN_AREA_SIZE; ++i)
|
||||
{
|
||||
if((*Iterator)->Items.MainArea[i].ItemID > 0)
|
||||
@@ -817,7 +817,7 @@ void GuildBankManager::SendGuildBank(Client *c)
|
||||
bool Useable = Item->IsEquipable(c->GetBaseRace(), c->GetBaseClass());
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct));
|
||||
|
||||
|
||||
GuildBankItemUpdate_Struct *gbius = (GuildBankItemUpdate_Struct*)outapp->pBuffer;
|
||||
|
||||
if(!Item->Stackable)
|
||||
@@ -838,7 +838,7 @@ void GuildBankManager::SendGuildBank(Client *c)
|
||||
strn0cpy(gbius->Donator, (*Iterator)->Items.MainArea[i].Donator, sizeof(gbius->Donator));
|
||||
|
||||
strn0cpy(gbius->WhoFor, (*Iterator)->Items.MainArea[i].WhoFor, sizeof(gbius->WhoFor));
|
||||
|
||||
|
||||
c->FastQueuePacket(&outapp);
|
||||
}
|
||||
}
|
||||
@@ -924,13 +924,13 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
|
||||
}
|
||||
}
|
||||
|
||||
if(Slot < 0)
|
||||
if(Slot < 0)
|
||||
{
|
||||
_log(GUILDS__BANK_ERROR, "No space to add item to the guild bank.");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const char *Query="INSERT INTO `guild_bank` (`guildid`, `area`, `slot`, `itemid`, `qty`, `donator`, `permissions`, `WhoFor`) "
|
||||
"VALUES (%i, %i, %i, %i, %i, '%s', %i, '%s')";
|
||||
|
||||
@@ -1441,7 +1441,7 @@ void GuildBankManager::UpdateItemQuantity(uint32 GuildID, uint16 Area, uint16 Sl
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
@@ -1490,7 +1490,7 @@ bool GuildApproval::ProcessApproval()
|
||||
owner->Message(0,"You took too long! Your guild request has been deleted.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1522,7 +1522,7 @@ bool GuildApproval::AddMemberApproval(Client* addition)
|
||||
if(members[i] && members[i] == addition)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<tmp;i++)
|
||||
{
|
||||
if(!members[i])
|
||||
@@ -1536,7 +1536,7 @@ bool GuildApproval::AddMemberApproval(Client* addition)
|
||||
}
|
||||
if(z==tmp)
|
||||
GuildApproved();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1596,8 +1596,8 @@ void GuildApproval::GuildApproved()
|
||||
pet->SetPetitionText(petitext);
|
||||
pet->SetZone(zone->GetZoneID());
|
||||
pet->SetUrgency(0);
|
||||
petition_list.AddPetition(pet);
|
||||
database.InsertPetitionToDB(pet);
|
||||
petition_list.AddPetition(pet);
|
||||
database.InsertPetitionToDB(pet);
|
||||
petition_list.UpdateGMQueue();
|
||||
petition_list.UpdateZoneListQueue();
|
||||
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s has made a petition. #%i", owner->CastToClient()->GetName(), pet->GetID());
|
||||
|
||||
+5
-5
@@ -80,15 +80,15 @@ public:
|
||||
uint32 GetFreeID() { return id+1; }
|
||||
//called by worldserver when it receives a message from world.
|
||||
void ProcessWorldPacket(ServerPacket *pack);
|
||||
|
||||
|
||||
void ListGuilds(Client *c) const;
|
||||
void DescribeGuild(Client *c, uint32 guild_id) const;
|
||||
|
||||
|
||||
|
||||
|
||||
// bool DonateTribute(uint32 charid, uint32 guild_id, uint32 tribute_amount);
|
||||
|
||||
|
||||
uint8 *MakeGuildMembers(uint32 guild_id, const char *prefix_name, uint32 &length); //make a guild member list packet, returns ownership of the buffer.
|
||||
|
||||
|
||||
void RecordInvite(uint32 char_id, uint32 guild_id, uint8 rank);
|
||||
bool VerifyAndClearInvite(uint32 char_id, uint32 guild_id, uint8 rank);
|
||||
void SendGuildMemberUpdateToWorld(const char *MemberName, uint32 GuildID, uint16 ZoneID, uint32 LastSeen);
|
||||
|
||||
+23
-23
@@ -59,10 +59,10 @@ void HateList::Wipe()
|
||||
LinkedListIterator<tHateEntry*> iterator(list);
|
||||
iterator.Reset();
|
||||
|
||||
while(iterator.MoreElements())
|
||||
while(iterator.MoreElements())
|
||||
{
|
||||
Mob* m = iterator.GetData()->ent;
|
||||
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0);
|
||||
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0);
|
||||
iterator.RemoveCurrent();
|
||||
|
||||
if(m->IsClient())
|
||||
@@ -70,12 +70,12 @@ void HateList::Wipe()
|
||||
}
|
||||
}
|
||||
|
||||
bool HateList::IsOnHateList(Mob *mob)
|
||||
{
|
||||
if (Find(mob))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool HateList::IsOnHateList(Mob *mob)
|
||||
{
|
||||
if (Find(mob))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
tHateEntry *HateList::Find(Mob *ent)
|
||||
{
|
||||
@@ -154,7 +154,7 @@ Mob* HateList::GetClosest(Mob *hater) {
|
||||
Mob* close = nullptr;
|
||||
float closedist = 99999.9f;
|
||||
float thisdist;
|
||||
|
||||
|
||||
LinkedListIterator<tHateEntry*> iterator(list);
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
@@ -165,10 +165,10 @@ Mob* HateList::GetClosest(Mob *hater) {
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
|
||||
if (close == 0 && hater->IsNPC())
|
||||
close = hater->CastToNPC()->GetHateTop();
|
||||
|
||||
|
||||
return close;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd
|
||||
p->hate = in_hate;
|
||||
p->bFrenzy = bFrenzy;
|
||||
list.Append(p);
|
||||
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0);
|
||||
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0);
|
||||
|
||||
if(ent->IsClient())
|
||||
ent->CastToClient()->IncrementAggroCount();
|
||||
@@ -216,7 +216,7 @@ 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;
|
||||
|
||||
@@ -256,7 +256,7 @@ Mob *HateList::GetTop(Mob *center)
|
||||
_ZP(HateList_GetTop);
|
||||
Mob* top = nullptr;
|
||||
int32 hate = -1;
|
||||
|
||||
|
||||
if (RuleB(Aggro,SmartAggroList)){
|
||||
Mob* topClientTypeInRange = nullptr;
|
||||
int32 hateClientTypeInRange = -1;
|
||||
@@ -272,7 +272,7 @@ Mob *HateList::GetTop(Mob *center)
|
||||
if(!cur){
|
||||
iterator.Advance();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!cur->ent){
|
||||
iterator.Advance();
|
||||
@@ -300,7 +300,7 @@ Mob *HateList::GetTop(Mob *center)
|
||||
int32 currentHate = cur->hate;
|
||||
|
||||
if(cur->ent->IsClient()){
|
||||
|
||||
|
||||
if(cur->ent->CastToClient()->IsSitting()){
|
||||
aggroMod += RuleI(Aggro, SittingAggroMod);
|
||||
}
|
||||
@@ -457,7 +457,7 @@ int32 HateList::GetEntHate(Mob *ent, bool damage)
|
||||
tHateEntry *p;
|
||||
|
||||
p = Find(ent);
|
||||
|
||||
|
||||
if ( p && damage)
|
||||
return p->damage;
|
||||
else if (p)
|
||||
@@ -469,7 +469,7 @@ int32 HateList::GetEntHate(Mob *ent, bool damage)
|
||||
//looking for any mob with hate > -1
|
||||
bool HateList::IsEmpty() {
|
||||
_ZP(HateList_IsEmpty);
|
||||
|
||||
|
||||
return(list.Count() == 0);
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ int HateList::AreaRampage(Mob *caster, Mob *target)
|
||||
while (iterator.MoreElements())
|
||||
{
|
||||
tHateEntry *h = iterator.GetData();
|
||||
iterator.Advance();
|
||||
iterator.Advance();
|
||||
if(h && h->ent && h->ent != caster)
|
||||
{
|
||||
if(caster->CombatRange(h->ent))
|
||||
@@ -533,7 +533,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
||||
return;
|
||||
}
|
||||
|
||||
//this is slower than just iterating through the list but avoids
|
||||
//this is slower than just iterating through the list but avoids
|
||||
//crashes when people kick the bucket in the middle of this call
|
||||
//that invalidates our iterator but there's no way to know sadly
|
||||
//So keep a list of entity ids and look up after
|
||||
@@ -555,7 +555,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
||||
{
|
||||
id_list.push_back(h->ent->GetID());
|
||||
}
|
||||
iterator.Advance();
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
std::list<uint32>::iterator iter = id_list.begin();
|
||||
@@ -574,9 +574,9 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
||||
void HateList::GetHateList(std::list<tHateEntry*> &h_list)
|
||||
{
|
||||
h_list.clear();
|
||||
LinkedListIterator<tHateEntry*> iterator(list);
|
||||
LinkedListIterator<tHateEntry*> iterator(list);
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements())
|
||||
while(iterator.MoreElements())
|
||||
{
|
||||
tHateEntry *ent = iterator.GetData();
|
||||
h_list.push_back(ent);
|
||||
|
||||
+23
-23
@@ -30,26 +30,26 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
map<uint16, const NPCType *> Horse::horse_types;
|
||||
LinkedList<NPCType *> horses_auto_delete;
|
||||
|
||||
Horse::Horse(Client *_owner, uint16 spell_id, float x, float y, float z, float heading)
|
||||
Horse::Horse(Client *_owner, uint16 spell_id, float x, float y, float z, float heading)
|
||||
: NPC(GetHorseType(spell_id), nullptr, x, y, z, heading, FlyMode3)
|
||||
{
|
||||
//give the horse its proper name.
|
||||
strn0cpy(name, _owner->GetCleanName(), 55);
|
||||
strcat(name,"`s_Mount00");
|
||||
|
||||
|
||||
owner = _owner;
|
||||
}
|
||||
|
||||
|
||||
void Horse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
||||
NPC::FillSpawnStruct(ns, ForWho);
|
||||
|
||||
|
||||
// ns->spawn.texture = NPCTypedata->mount_color;
|
||||
ns->spawn.petOwnerId = 0;
|
||||
|
||||
|
||||
//dunno why we do these, they should allready be set right.
|
||||
ns->spawn.runspeed = NPCTypedata->runspeed;
|
||||
}
|
||||
|
||||
|
||||
bool Horse::IsHorseSpell(uint16 spell_id) {
|
||||
//written in terms of a function which does a ton more work
|
||||
//than we need to to figure out if this is a horse spell.
|
||||
@@ -89,11 +89,11 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
|
||||
memset(npc_type, 0, sizeof(NPCType));
|
||||
strcpy(npc_type->name,"Unclaimed_Mount"); //this should never get used
|
||||
strcpy(npc_type->npc_attacks,"ABH");
|
||||
npc_type->cur_hp = 1;
|
||||
npc_type->max_hp = 1;
|
||||
npc_type->cur_hp = 1;
|
||||
npc_type->max_hp = 1;
|
||||
npc_type->race = atoi(row[0]);
|
||||
npc_type->gender = atoi(row[1]); // Drogmor's are female horses. Yuck.
|
||||
npc_type->class_ = 1;
|
||||
npc_type->class_ = 1;
|
||||
npc_type->deity= 1;
|
||||
npc_type->level = 1;
|
||||
npc_type->npc_id = 0;
|
||||
@@ -112,7 +112,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
|
||||
npc_type->INT = 75;
|
||||
npc_type->WIS = 75;
|
||||
npc_type->CHA = 75;
|
||||
|
||||
|
||||
horses_auto_delete.Insert(npc_type);
|
||||
|
||||
mysql_free_result(result);
|
||||
@@ -131,7 +131,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
|
||||
safe_delete_array(query);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -145,18 +145,18 @@ void Client::SummonHorse(uint16 spell_id) {
|
||||
LogFile->write(EQEMuLog::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// No Horse, lets get them one.
|
||||
|
||||
|
||||
Horse* horse = new Horse(this, spell_id, GetX(), GetY(), GetZ(), GetHeading());
|
||||
|
||||
|
||||
//we want to manage the spawn packet ourself.
|
||||
//another reason is we dont want quests executing on it.
|
||||
entity_list.AddNPC(horse, false);
|
||||
|
||||
|
||||
// Okay, lets say they have a horse now.
|
||||
|
||||
|
||||
|
||||
|
||||
EQApplicationPacket outapp;
|
||||
horse->CreateHorseSpawnPacket(&outapp, GetName(), GetID());
|
||||
/* // Doodman: Kludged in here instead of adding a field to PCType. FIXME!
|
||||
@@ -167,18 +167,18 @@ void Client::SummonHorse(uint16 spell_id) {
|
||||
ns->spawn.runspeed=npc_type->runspeed;
|
||||
*/
|
||||
entity_list.QueueClients(horse, &outapp);
|
||||
|
||||
|
||||
|
||||
|
||||
uint16 tmpID = horse->GetID();
|
||||
SetHorseId(tmpID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Client::SetHorseId(uint16 horseid_in) {
|
||||
//if its the same, do nothing
|
||||
if(horseId == horseid_in)
|
||||
return;
|
||||
|
||||
|
||||
//otherwise it changed.
|
||||
//if we have a horse, get rid of it no matter what.
|
||||
if(horseId) {
|
||||
@@ -186,7 +186,7 @@ void Client::SetHorseId(uint16 horseid_in) {
|
||||
if(horse != nullptr)
|
||||
horse->Depop();
|
||||
}
|
||||
|
||||
|
||||
//now we take whatever they gave us.
|
||||
horseId = horseid_in;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void Mob::CreateHorseSpawnPacket(EQApplicationPacket* app, const char* ownername
|
||||
memset(app->pBuffer, 0, sizeof(NewSpawn_Struct));
|
||||
NewSpawn_Struct* ns = (NewSpawn_Struct*)app->pBuffer;
|
||||
FillSpawnStruct(ns, ForWho);
|
||||
|
||||
|
||||
#if (EQDEBUG >= 11)
|
||||
printf("Horse Spawn Packet - Owner: %s\n", ownername);
|
||||
DumpPacket(app);
|
||||
|
||||
+3
-3
@@ -28,14 +28,14 @@ using namespace std;
|
||||
class Horse : public NPC {
|
||||
public:
|
||||
Horse(Client *owner, uint16 spell_id, float x, float y, float z, float heading);
|
||||
|
||||
|
||||
virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
|
||||
|
||||
|
||||
static bool IsHorseSpell(uint16 spell_id);
|
||||
protected:
|
||||
uint8 mount_color;
|
||||
Client *owner;
|
||||
|
||||
|
||||
//generate npc type records for horses
|
||||
static map<uint16, const NPCType *> horse_types;
|
||||
static const NPCType *GetHorseType(uint16 spell_id);
|
||||
|
||||
+131
-131
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -39,7 +39,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
return 0;
|
||||
uint32 x = 0;
|
||||
ItemInst *cur = nullptr;
|
||||
|
||||
|
||||
int i;
|
||||
if(where_to_check & invWhereWorn) {
|
||||
for (i=0; i<=21; i++) { // Equipped
|
||||
@@ -68,7 +68,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
DeleteItemInInventory(9999, 0, true);
|
||||
else
|
||||
DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(where_to_check & invWhereCursor) {
|
||||
@@ -138,7 +138,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
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);
|
||||
@@ -192,7 +192,7 @@ bool Client::CheckLoreConflict(const Item_Struct* item) {
|
||||
return false;
|
||||
|
||||
if (item->LoreGroup == -1) // Standard lore items; look everywhere except the shared bank, return the result
|
||||
return (m_inv.HasItem(item->ID, 0, ~invWhereSharedBank) != SLOT_INVALID);
|
||||
return (m_inv.HasItem(item->ID, 0, ~invWhereSharedBank) != SLOT_INVALID);
|
||||
|
||||
//If the item has a lore group, we check for other items with the same group and return the result
|
||||
return (m_inv.HasItemByLoreGroup(item->LoreGroup, ~invWhereSharedBank) != SLOT_INVALID);
|
||||
@@ -200,7 +200,7 @@ bool Client::CheckLoreConflict(const Item_Struct* item) {
|
||||
|
||||
void Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot) {
|
||||
const Item_Struct* item = database.GetItem(item_id);
|
||||
|
||||
|
||||
if (item == nullptr) {
|
||||
Message(0, "No such item: %i", item_id);
|
||||
return;
|
||||
@@ -214,13 +214,13 @@ void Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
}
|
||||
// Checking to see if the Item is lore or not.
|
||||
bool foundlore = CheckLoreConflict(item);
|
||||
|
||||
|
||||
//TODO: check for lore conflict on augments
|
||||
|
||||
|
||||
// Checking to see if it is a GM only Item or not.
|
||||
//bool foundgm = (item->gm && (this->Admin() < 100));
|
||||
bool foundgm = false;
|
||||
|
||||
|
||||
if (!foundlore && !foundgm) { // Okay, It isn't LORE, or if it is, it is not in player's inventory.
|
||||
ItemInst* inst = database.CreateItem(item, charges);
|
||||
if (inst) {
|
||||
@@ -328,13 +328,13 @@ void Client::DropItem(int16 slot_id)
|
||||
|
||||
// Take control of item in client inventory
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
|
||||
|
||||
if (!inst) {
|
||||
// Item doesn't exist in inventory!
|
||||
Message(13, "Error: Item not found in slot %i", slot_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Save client inventory change to database
|
||||
if (slot_id==SLOT_CURSOR) {
|
||||
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
@@ -346,7 +346,7 @@ void Client::DropItem(int16 slot_id)
|
||||
Object* object = new Object(this, inst);
|
||||
entity_list.AddObject(object, true);
|
||||
object->StartDecay();
|
||||
|
||||
|
||||
safe_delete(inst);
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ uint32 Client::GetItemIDAt(int16 slot_id) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if (inst)
|
||||
return inst->GetItem()->ID;
|
||||
|
||||
|
||||
// None found
|
||||
return INVALID_ID;
|
||||
}
|
||||
@@ -443,7 +443,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
|
||||
if(m_inv[slot_id]->IsType(ItemClassContainer)) {
|
||||
for(uint8 bag_idx = 0; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) {
|
||||
ItemInst* bagitem = m_inv[slot_id]->GetItem(bag_idx);
|
||||
|
||||
|
||||
if(bagitem) {
|
||||
int16 bagslot_id = Inventory::CalcSlotId(slot_id, bag_idx);
|
||||
|
||||
@@ -518,11 +518,11 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update)
|
||||
{
|
||||
mlog(INVENTORY__SLOTS, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID);
|
||||
m_inv.PushCursor(inst);
|
||||
|
||||
|
||||
if (client_update) {
|
||||
SendItemPacket(SLOT_CURSOR, &inst, ItemPacketSummonItem);
|
||||
}
|
||||
|
||||
|
||||
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
return database.SaveCursor(CharacterID(), s, e);
|
||||
}
|
||||
@@ -530,23 +530,23 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update)
|
||||
bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update)
|
||||
{
|
||||
mlog(INVENTORY__SLOTS, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
if (slot_id==SLOT_CURSOR)
|
||||
if (slot_id==SLOT_CURSOR)
|
||||
{
|
||||
return PushItemOnCursor(inst,client_update);
|
||||
}
|
||||
else
|
||||
m_inv.PutItem(slot_id, inst);
|
||||
|
||||
|
||||
if (client_update) {
|
||||
SendItemPacket(slot_id, &inst, (slot_id==SLOT_CURSOR)?ItemPacketSummonItem:ItemPacketTrade);
|
||||
}
|
||||
|
||||
|
||||
if (slot_id==SLOT_CURSOR) {
|
||||
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
return database.SaveCursor(this->CharacterID(), s, e);
|
||||
} else
|
||||
return database.SaveInventory(this->CharacterID(), &inst, slot_id);
|
||||
|
||||
|
||||
CalcBonuses();
|
||||
}
|
||||
|
||||
@@ -554,9 +554,9 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
|
||||
{
|
||||
mlog(INVENTORY__SLOTS, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
m_inv.PutItem(slot_id, inst);
|
||||
|
||||
|
||||
SendLootItemInPacket(&inst, slot_id);
|
||||
|
||||
|
||||
if (slot_id==SLOT_CURSOR) {
|
||||
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(this->CharacterID(), s, e);
|
||||
@@ -578,7 +578,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
|
||||
safe_delete(bagitem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CalcBonuses();
|
||||
}
|
||||
bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cursor){
|
||||
@@ -588,7 +588,7 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur
|
||||
uint32 item_id = item->GetItem()->ID;
|
||||
for (i = 22; i <= 29; i++)
|
||||
{
|
||||
ItemInst* tmp_inst = m_inv.GetItem(i);
|
||||
ItemInst* tmp_inst = m_inv.GetItem(i);
|
||||
if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize){
|
||||
MoveItemCharges(*item, i, type);
|
||||
CalcBonuses();
|
||||
@@ -629,7 +629,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
|
||||
if(this->GetClientVersion() >= EQClientSoF) { i = 9999; } // added power source check for SoF+ clients
|
||||
else { break; }
|
||||
}
|
||||
|
||||
|
||||
if (!m_inv[i])
|
||||
{
|
||||
if( i == SLOT_PRIMARY && inst.IsWeapon() ) // If item is primary slot weapon
|
||||
@@ -672,7 +672,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #2: Stackable item?
|
||||
if (inst.IsStackable())
|
||||
{
|
||||
@@ -688,7 +688,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
|
||||
PutLootInInventory(slot_id, inst, bag_item_data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -731,7 +731,7 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
|
||||
<a WndNotify="27,00960F000000000000000000000000000000000000000">Master's Book of Wood Elven Culture</a>
|
||||
http://eqitems.13th-floor.org/phpBB2/viewtopic.php?p=510#510
|
||||
*/
|
||||
|
||||
|
||||
if (!inst) //have to have an item to make the link
|
||||
return false;
|
||||
|
||||
@@ -749,17 +749,17 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
|
||||
//int hash = GetItemLinkHash(inst); //eventually this will work (currently crashes zone), but for now we'll skip the extra overhead
|
||||
if (GetClientVersion() >= EQClientRoF)
|
||||
{
|
||||
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
|
||||
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
|
||||
0,
|
||||
item->ID,
|
||||
inst->GetAugmentItemID(0),
|
||||
inst->GetAugmentItemID(1),
|
||||
inst->GetAugmentItemID(2),
|
||||
inst->GetAugmentItemID(3),
|
||||
inst->GetAugmentItemID(4),
|
||||
item->ID,
|
||||
inst->GetAugmentItemID(0),
|
||||
inst->GetAugmentItemID(1),
|
||||
inst->GetAugmentItemID(2),
|
||||
inst->GetAugmentItemID(3),
|
||||
inst->GetAugmentItemID(4),
|
||||
inst->GetAugmentItemID(5),
|
||||
evolving,
|
||||
loregroup,
|
||||
evolving,
|
||||
loregroup,
|
||||
evolvedlevel,
|
||||
0,
|
||||
hash
|
||||
@@ -767,16 +767,16 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
|
||||
}
|
||||
else if (GetClientVersion() >= EQClientSoF)
|
||||
{
|
||||
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
|
||||
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
|
||||
0,
|
||||
item->ID,
|
||||
inst->GetAugmentItemID(0),
|
||||
inst->GetAugmentItemID(1),
|
||||
inst->GetAugmentItemID(2),
|
||||
inst->GetAugmentItemID(3),
|
||||
inst->GetAugmentItemID(4),
|
||||
evolving,
|
||||
loregroup,
|
||||
item->ID,
|
||||
inst->GetAugmentItemID(0),
|
||||
inst->GetAugmentItemID(1),
|
||||
inst->GetAugmentItemID(2),
|
||||
inst->GetAugmentItemID(3),
|
||||
inst->GetAugmentItemID(4),
|
||||
evolving,
|
||||
loregroup,
|
||||
evolvedlevel,
|
||||
0,
|
||||
hash
|
||||
@@ -784,17 +784,17 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X",
|
||||
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X",
|
||||
0,
|
||||
item->ID,
|
||||
inst->GetAugmentItemID(0),
|
||||
inst->GetAugmentItemID(1),
|
||||
inst->GetAugmentItemID(2),
|
||||
inst->GetAugmentItemID(3),
|
||||
inst->GetAugmentItemID(4),
|
||||
evolving,
|
||||
loregroup,
|
||||
evolvedlevel,
|
||||
item->ID,
|
||||
inst->GetAugmentItemID(0),
|
||||
inst->GetAugmentItemID(1),
|
||||
inst->GetAugmentItemID(2),
|
||||
inst->GetAugmentItemID(3),
|
||||
inst->GetAugmentItemID(4),
|
||||
evolving,
|
||||
loregroup,
|
||||
evolvedlevel,
|
||||
hash
|
||||
);
|
||||
}
|
||||
@@ -807,7 +807,7 @@ int Client::GetItemLinkHash(const ItemInst* inst) {
|
||||
//Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=145
|
||||
if (!inst) //have to have an item to make the hash
|
||||
return 0;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
char* hash_str = 0;
|
||||
/*register */int hash = 0;
|
||||
@@ -881,7 +881,7 @@ int Client::GetItemLinkHash(const ItemInst* inst) {
|
||||
// This is what the inline asm is doing:
|
||||
// hash *= 0x1f;
|
||||
// hash += (int)c;
|
||||
|
||||
|
||||
hash_str++;
|
||||
}
|
||||
*/
|
||||
@@ -900,7 +900,7 @@ packet with the item number in it, but I cant seem to find it right now
|
||||
*/
|
||||
if (!inst)
|
||||
return;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
const char* name2 = &item->Name[0];
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemLinkText,strlen(name2)+68);
|
||||
@@ -999,7 +999,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (move_in->to_slot == (uint32)SLOT_INVALID) {
|
||||
if(move_in->from_slot == (uint32)SLOT_CURSOR) {
|
||||
mlog(INVENTORY__SLOTS, "Client destroyed item from cursor slot %d", move_in->from_slot);
|
||||
@@ -1022,8 +1022,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
int16 src_slot_id = (int16)move_in->from_slot;
|
||||
int16 dst_slot_id = (int16)move_in->to_slot;
|
||||
|
||||
if(IsBankSlot(src_slot_id) ||
|
||||
IsBankSlot(dst_slot_id) ||
|
||||
if(IsBankSlot(src_slot_id) ||
|
||||
IsBankSlot(dst_slot_id) ||
|
||||
IsBankSlot(src_slot_check) ||
|
||||
IsBankSlot(dst_slot_check))
|
||||
{
|
||||
@@ -1033,7 +1033,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if(!banker || distance > USE_NPC_RANGE2)
|
||||
{
|
||||
char *hacked_string = nullptr;
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(items) but %s is non-existant or too far away (%u units).",
|
||||
MakeAnyLenString(&hacked_string, "Player tried to make use of a banker(items) but %s is non-existant or too far away (%u units).",
|
||||
banker ? banker->GetName() : "UNKNOWN NPC", distance);
|
||||
database.SetMQDetectionFlag(AccountName(), GetName(), hacked_string, zone->GetShortName());
|
||||
safe_delete_array(hacked_string);
|
||||
@@ -1041,7 +1041,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Setup
|
||||
uint32 srcitemid = 0;
|
||||
uint32 dstitemid = 0;
|
||||
@@ -1081,12 +1081,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
this->Message(13,"You cannot move your Trader Satchels, or items inside them, while Trading.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Step 2: Validate item in from_slot
|
||||
// After this, we can assume src_inst is a valid ptr
|
||||
if (!src_inst && (src_slot_id<4000 || src_slot_id>4009)) {
|
||||
if (dst_inst) {
|
||||
// If there is no source item, but there is a destination item,
|
||||
// If there is no source item, but there is a destination item,
|
||||
// move the slots around before deleting the invalid source slot item,
|
||||
// which is now in the destination slot.
|
||||
move_in->from_slot = dst_slot_check;
|
||||
@@ -1094,7 +1094,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
move_in->number_in_stack = dst_inst->GetCharges();
|
||||
if(!SwapItem(move_in)) { mlog(INVENTORY__ERROR, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); }
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
//verify shared bank transactions in the database
|
||||
@@ -1140,7 +1140,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
WorldKick();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Step 3: Check for interaction with World Container (tradeskills)
|
||||
if(m_tradeskill_object != nullptr) {
|
||||
if (src_slot_id>=4000 && src_slot_id<=4009) {
|
||||
@@ -1159,7 +1159,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
// Putting item into world container, which may swap (or pile onto) with existing item
|
||||
uint8 world_idx = Inventory::CalcBagIdx(dst_slot_id);
|
||||
ItemInst* world_inst = m_tradeskill_object->PopItem(world_idx);
|
||||
|
||||
|
||||
// Case 1: No item in container, unidirectional "Put"
|
||||
if (world_inst == nullptr) {
|
||||
m_tradeskill_object->PutItem(world_idx, src_inst);
|
||||
@@ -1173,7 +1173,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if ((world_item->ID == src_item->ID) && src_inst->IsStackable()) {
|
||||
int16 world_charges = world_inst->GetCharges();
|
||||
int16 src_charges = src_inst->GetCharges();
|
||||
|
||||
|
||||
// Fill up destination stack as much as possible
|
||||
world_charges += src_charges;
|
||||
if (world_charges > world_inst->GetItem()->StackSize) {
|
||||
@@ -1183,10 +1183,10 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
else {
|
||||
src_charges = 0;
|
||||
}
|
||||
|
||||
|
||||
world_inst->SetCharges(world_charges);
|
||||
m_tradeskill_object->Save();
|
||||
|
||||
|
||||
if (src_charges == 0) {
|
||||
m_inv.DeleteItem(src_slot_id); // DB remove will occur below
|
||||
}
|
||||
@@ -1204,7 +1204,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
safe_delete(world_inst);
|
||||
if (src_slot_id==SLOT_CURSOR) {
|
||||
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
@@ -1217,7 +1217,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Step 4: Check for entity trade
|
||||
if (dst_slot_id>=3000 && dst_slot_id<=3007) {
|
||||
if (src_slot_id != SLOT_CURSOR) {
|
||||
@@ -1231,7 +1231,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
Message(13, "Error: Cursor item not located on server!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Add cursor item to trade bucket
|
||||
// Also sends trade information to other client of trade session
|
||||
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
|
||||
@@ -1248,7 +1248,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Step 5: Swap (or stack) items
|
||||
if (move_in->number_in_stack > 0) {
|
||||
// Determine if charged items can stack
|
||||
@@ -1269,10 +1269,10 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges();
|
||||
if (usedcharges > move_in->number_in_stack)
|
||||
usedcharges = move_in->number_in_stack;
|
||||
|
||||
|
||||
dst_inst->SetCharges(dst_inst->GetCharges() + usedcharges);
|
||||
src_inst->SetCharges(src_inst->GetCharges() - usedcharges);
|
||||
|
||||
|
||||
// Depleted all charges?
|
||||
if (src_inst->GetCharges() < 1)
|
||||
{
|
||||
@@ -1324,14 +1324,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; }
|
||||
mlog(INVENTORY__SLOTS, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
|
||||
}
|
||||
|
||||
|
||||
int matslot = SlotConvert2(dst_slot_id);
|
||||
if (dst_slot_id<22 && matslot != 0) {
|
||||
SendWearChange(matslot);
|
||||
}
|
||||
|
||||
|
||||
// Step 7: Save change to the database
|
||||
if (src_slot_id==SLOT_CURSOR){
|
||||
if (src_slot_id==SLOT_CURSOR){
|
||||
list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(character_id, s, e);
|
||||
} else
|
||||
@@ -1341,7 +1341,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
database.SaveCursor(character_id, s, e);
|
||||
} else
|
||||
database.SaveInventory(character_id, m_inv.GetItem(dst_slot_id), dst_slot_id);
|
||||
|
||||
|
||||
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in, true); } // QS Audit
|
||||
|
||||
// Step 8: Re-calc stats
|
||||
@@ -1363,7 +1363,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
ItemInst* token_inst = database.CreateItem(token_struct, 1);
|
||||
|
||||
SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
|
||||
|
||||
|
||||
if(m_inv[resync_slot]) { SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); }
|
||||
else {
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_DeleteItem, sizeof(DeleteItem_Struct));
|
||||
@@ -1371,7 +1371,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
delete_slot->from_slot = resync_slot;
|
||||
delete_slot->to_slot = 0xFFFFFFFF;
|
||||
delete_slot->number_in_stack = 0xFFFFFFFF;
|
||||
|
||||
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
@@ -1411,7 +1411,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
delete_slot->from_slot = resync_slot;
|
||||
delete_slot->to_slot = 0xFFFFFFFF;
|
||||
delete_slot->number_in_stack = 0xFFFFFFFF;
|
||||
|
||||
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
@@ -1549,9 +1549,9 @@ void Client::DyeArmor(DyeStruct* dye){
|
||||
if(inst){
|
||||
inst->SetColor((dye->dye[i].rgb.red*65536)+(dye->dye[i].rgb.green*256)+(dye->dye[i].rgb.blue));
|
||||
database.SaveInventory(CharacterID(),inst,slot2);
|
||||
if(dye->dye[i].rgb.use_tint)
|
||||
if(dye->dye[i].rgb.use_tint)
|
||||
m_pp.item_tint[i].rgb.use_tint = 0xFF;
|
||||
else
|
||||
else
|
||||
m_pp.item_tint[i].rgb.use_tint=0x00;
|
||||
}
|
||||
m_pp.item_tint[i].rgb.blue=dye->dye[i].rgb.blue;
|
||||
@@ -1674,7 +1674,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
void Client::RemoveNoRent(bool client_update) {
|
||||
|
||||
int16 slot_id;
|
||||
|
||||
|
||||
// personal
|
||||
for(slot_id = 0; slot_id <= 30; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
@@ -1690,7 +1690,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(9999, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent
|
||||
}
|
||||
|
||||
|
||||
// containers
|
||||
for(slot_id = 251; slot_id <= 340; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
@@ -1741,7 +1741,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
void Client::RemoveDuplicateLore(bool client_update) {
|
||||
// Split-charge stacking may be added at some point -U
|
||||
int16 slot_id;
|
||||
|
||||
|
||||
// personal
|
||||
for(slot_id = 0; slot_id <= 30; slot_id++) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
@@ -1749,7 +1749,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_inv.PutItem(slot_id, *inst);
|
||||
}
|
||||
@@ -1763,13 +1763,13 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, 9999);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_inv.PutItem(9999, *inst);
|
||||
}
|
||||
safe_delete(inst);
|
||||
}
|
||||
|
||||
|
||||
// containers
|
||||
for(slot_id = 251; slot_id <= 340; slot_id++) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
@@ -1777,7 +1777,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_inv.PutItem(slot_id, *inst);
|
||||
}
|
||||
@@ -1792,7 +1792,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_inv.PutItem(slot_id, *inst);
|
||||
}
|
||||
@@ -1807,7 +1807,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_inv.PutItem(slot_id, *inst);
|
||||
}
|
||||
@@ -1867,7 +1867,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
item = m_inv.GetItem(invslot);
|
||||
|
||||
if(item && item->GetItem())
|
||||
@@ -1882,7 +1882,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const
|
||||
int32 Client::GetEquipmentMaterial(uint8 material_slot)
|
||||
{
|
||||
const Item_Struct *item;
|
||||
|
||||
|
||||
item = database.GetItem(GetEquipment(material_slot));
|
||||
if(item != 0)
|
||||
{
|
||||
@@ -1962,21 +1962,21 @@ void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType
|
||||
{
|
||||
if (!inst)
|
||||
return;
|
||||
|
||||
|
||||
// Serialize item into |-delimited string
|
||||
string packet = inst->Serialize(slot_id);
|
||||
|
||||
|
||||
EmuOpcode opcode = OP_Unknown;
|
||||
EQApplicationPacket* outapp = nullptr;
|
||||
ItemPacket_Struct* itempacket = nullptr;
|
||||
|
||||
|
||||
// Construct packet
|
||||
opcode = (packet_type==ItemPacketViewLink) ? OP_ItemLinkResponse : OP_ItemPacket;
|
||||
outapp = new EQApplicationPacket(opcode, packet.length()+sizeof(ItemPacket_Struct));
|
||||
itempacket = (ItemPacket_Struct*)outapp->pBuffer;
|
||||
memcpy(itempacket->SerializedItem, packet.c_str(), packet.length());
|
||||
itempacket->PacketType = packet_type;
|
||||
|
||||
|
||||
#if EQDEBUG >= 9
|
||||
DumpPacket(outapp);
|
||||
#endif
|
||||
@@ -1987,14 +1987,14 @@ EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const ItemInst* ins
|
||||
{
|
||||
if (!inst)
|
||||
return 0;
|
||||
|
||||
|
||||
// Serialize item into |-delimited string
|
||||
string packet = inst->Serialize(slot_id);
|
||||
|
||||
|
||||
EmuOpcode opcode = OP_Unknown;
|
||||
EQApplicationPacket* outapp = nullptr;
|
||||
BulkItemPacket_Struct* itempacket = nullptr;
|
||||
|
||||
|
||||
// Construct packet
|
||||
opcode = OP_ItemPacket;
|
||||
outapp = new EQApplicationPacket(opcode, packet.length()+1);
|
||||
@@ -2090,10 +2090,10 @@ 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,
|
||||
slot = m_inv.HasItem(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id, 1,
|
||||
invWhereWorn|invWherePersonal);
|
||||
|
||||
// removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here
|
||||
// removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here
|
||||
if (slot == SLOT_INVALID) {
|
||||
if (m_inv.GetItem(SLOT_CURSOR)) {
|
||||
if (m_inv.GetItem(SLOT_CURSOR)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id &&
|
||||
@@ -2119,8 +2119,8 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
BandolierItems[BandolierSlot] = m_inv.PopItem(slot);
|
||||
// If ammo with charges, only take one charge out to put in the range slot, that is what
|
||||
// the client does.
|
||||
|
||||
if(((BandolierSlot == bandolierAmmo) || (BandolierSlot == bandolierRange)) &&
|
||||
|
||||
if(((BandolierSlot == bandolierAmmo) || (BandolierSlot == bandolierRange)) &&
|
||||
BandolierItems[BandolierSlot] && BandolierItems[BandolierSlot]->IsStackable()){
|
||||
int Charges = BandolierItems[BandolierSlot]->GetCharges();
|
||||
// If there is more than one charge
|
||||
@@ -2143,10 +2143,10 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
_log(INVENTORY__BANDOLIER, "Character does not have required bandolier item for slot %i", WeaponSlot);
|
||||
ItemInst *InvItem = m_inv.PopItem(WeaponSlot);
|
||||
if(InvItem) {
|
||||
// If there was an item in that weapon slot, put it in the inventory
|
||||
// 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);
|
||||
if(MoveItemToInventory(InvItem))
|
||||
if(MoveItemToInventory(InvItem))
|
||||
database.SaveInventory(character_id, 0, WeaponSlot);
|
||||
else
|
||||
_log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(),
|
||||
@@ -2165,7 +2165,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
|
||||
|
||||
// Find the inventory slot corresponding to this bandolier slot
|
||||
|
||||
|
||||
WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot);
|
||||
|
||||
// if there is an item in this Bandolier slot ?
|
||||
@@ -2183,7 +2183,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
|
||||
if(InvItem) {
|
||||
// If there was already an item in that weapon slot that we replaced, find a place to put it
|
||||
if(!MoveItemToInventory(InvItem))
|
||||
if(!MoveItemToInventory(InvItem))
|
||||
_log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(),
|
||||
InvItem->GetItem()->Name);
|
||||
safe_delete(InvItem);
|
||||
@@ -2197,8 +2197,8 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
if(InvItem) {
|
||||
_log(INVENTORY__BANDOLIER, "Bandolier has no item for slot %i, returning item %s to inventory",
|
||||
WeaponSlot, InvItem->GetItem()->Name);
|
||||
// If there was an item in that weapon slot, put it in the inventory
|
||||
if(MoveItemToInventory(InvItem))
|
||||
// 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(),
|
||||
@@ -2212,13 +2212,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
|
||||
|
||||
|
||||
// This is a support function for Client::SetBandolier, however it can be used anywhere it's functionality is required.
|
||||
//
|
||||
// When the client moves items around as Bandolier sets are activated, it does not send details to the
|
||||
// When the client moves items around as Bandolier sets are activated, it does not send details to the
|
||||
// server of what item it has moved to which slot. It assumes the server knows what it will do.
|
||||
//
|
||||
// The standard EQEmu auto inventory routines do not behave as the client does when manipulating bandoliers.
|
||||
// The standard EQEmu auto inventory routines do not behave as the client does when manipulating bandoliers.
|
||||
// The client will look in each main inventory slot. If it finds a bag in a slot, it will then look inside
|
||||
// the bag for a free slot.
|
||||
//
|
||||
@@ -2245,10 +2245,10 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
|
||||
ItemInst* InvItem = m_inv.GetItem(i);
|
||||
|
||||
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() :
|
||||
int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft ? ItemToReturn->GetCharges() :
|
||||
ChargeSlotsLeft;
|
||||
|
||||
InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove);
|
||||
@@ -2259,8 +2259,8 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
|
||||
database.SaveInventory(character_id, m_inv.GetItem(i), i);
|
||||
|
||||
ItemToReturn->SetCharges(ItemToReturn->GetCharges() - ChargesToMove);
|
||||
|
||||
if(!ItemToReturn->GetCharges())
|
||||
|
||||
if(!ItemToReturn->GetCharges())
|
||||
return true;
|
||||
}
|
||||
// If there is a bag in this slot, look inside it.
|
||||
@@ -2274,28 +2274,28 @@ 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) &&
|
||||
if(InvItem && (InvItem->GetItem()->ID == ItemID) &&
|
||||
(InvItem->GetCharges() < InvItem->GetItem()->StackSize)) {
|
||||
|
||||
int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges();
|
||||
|
||||
int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft
|
||||
int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft
|
||||
? ItemToReturn->GetCharges() : ChargeSlotsLeft;
|
||||
|
||||
InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove);
|
||||
|
||||
if(UpdateClient)
|
||||
SendItemPacket(BaseSlotID + BagSlot, m_inv.GetItem(BaseSlotID + BagSlot),
|
||||
SendItemPacket(BaseSlotID + BagSlot, m_inv.GetItem(BaseSlotID + BagSlot),
|
||||
ItemPacketTrade);
|
||||
|
||||
database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot),
|
||||
database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot),
|
||||
BaseSlotID + BagSlot);
|
||||
|
||||
ItemToReturn->SetCharges(ItemToReturn->GetCharges() - ChargesToMove);
|
||||
|
||||
if(!ItemToReturn->GetCharges())
|
||||
if(!ItemToReturn->GetCharges())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2346,9 +2346,9 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Store on the cursor
|
||||
//
|
||||
//
|
||||
_log(INVENTORY__SLOTS, "Char: %s No space, putting on the cursor", GetName());
|
||||
|
||||
PushItemOnCursor(*ItemToReturn, UpdateClient);
|
||||
|
||||
+27
-27
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -117,13 +117,13 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml
|
||||
|
||||
// Too long a list needs to be limited.
|
||||
if(lds->NumEntries > 99 && droplimit < 1)
|
||||
droplimit = lds->NumEntries/100;
|
||||
droplimit = lds->NumEntries/100;
|
||||
|
||||
uint8 limit = 0;
|
||||
// Start at a random point in itemlist.
|
||||
uint32 item = MakeRandomInt(0, lds->NumEntries-1);
|
||||
// Main loop.
|
||||
for (uint32 i=0; i<lds->NumEntries;)
|
||||
for (uint32 i=0; i<lds->NumEntries;)
|
||||
{
|
||||
//Force the itemlist back to beginning.
|
||||
if (item > (lds->NumEntries-1))
|
||||
@@ -132,7 +132,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml
|
||||
uint8 charges = lds->Entries[item].multiplier;
|
||||
uint8 pickedcharges = 0;
|
||||
// Loop to check multipliers.
|
||||
for (uint32 x=1; x<=charges; x++)
|
||||
for (uint32 x=1; x<=charges; x++)
|
||||
{
|
||||
// Actual roll.
|
||||
float thischance = 0.0;
|
||||
@@ -145,10 +145,10 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml
|
||||
#if EQDEBUG>=11
|
||||
LogFile->write(EQEMuLog::Debug, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance);
|
||||
#endif
|
||||
if (thischance == 100.0 || drop_chance < thischance)
|
||||
if (thischance == 100.0 || drop_chance < thischance)
|
||||
{
|
||||
uint32 itemid = lds->Entries[item].item_id;
|
||||
|
||||
|
||||
const Item_Struct* dbitem = GetItem(itemid);
|
||||
npc->AddLootDrop(dbitem, itemlist, lds->Entries[item].item_charges, lds->Entries[item].minlevel, lds->Entries[item].maxlevel, lds->Entries[item].equip_item, false);
|
||||
pickedcharges++;
|
||||
@@ -156,11 +156,11 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml
|
||||
}
|
||||
// Items with multipliers only count as 1 towards the limit.
|
||||
if(pickedcharges > 0)
|
||||
limit++;
|
||||
limit++;
|
||||
|
||||
// If true, limit reached.
|
||||
if(limit >= droplimit && droplimit > 0)
|
||||
break;
|
||||
break;
|
||||
|
||||
item++;
|
||||
i++;
|
||||
@@ -178,16 +178,16 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml
|
||||
void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) {
|
||||
if(item2 == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
//make sure we are doing something...
|
||||
if(!itemlist && !wearchange)
|
||||
return;
|
||||
|
||||
|
||||
ServerLootItem_Struct* item = new ServerLootItem_Struct;
|
||||
#if EQDEBUG>=11
|
||||
LogFile->write(EQEMuLog::Debug, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID);
|
||||
#endif
|
||||
|
||||
|
||||
EQApplicationPacket* outapp = nullptr;
|
||||
WearChange_Struct* wc = nullptr;
|
||||
if(wearchange) {
|
||||
@@ -196,7 +196,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
wc->spawn_id = GetID();
|
||||
wc->material=0;
|
||||
}
|
||||
|
||||
|
||||
item->item_id = item2->ID;
|
||||
item->charges = charges;
|
||||
item->aug1 = 0;
|
||||
@@ -212,7 +212,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
const Item_Struct* compitem = nullptr;
|
||||
bool found = false; // track if we found an empty slot we fit into
|
||||
int32 foundslot = -1; // for multi-slot items
|
||||
|
||||
|
||||
// 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
|
||||
@@ -229,7 +229,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
if(equipment[i])
|
||||
{
|
||||
compitem = database.GetItem(equipment[i]);
|
||||
if (item2->AC > compitem->AC ||
|
||||
if (item2->AC > compitem->AC ||
|
||||
(item2->AC == compitem->AC && item2->HP > compitem->HP))
|
||||
{
|
||||
// item would be an upgrade
|
||||
@@ -244,7 +244,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
found = true;
|
||||
}
|
||||
} // end if ac
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
equipment[i] = item2->ID;
|
||||
@@ -281,17 +281,17 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
if (foundslot == SLOT_PRIMARY) {
|
||||
if (item2->Proc.Effect != 0)
|
||||
CastToMob()->AddProcToWeapon(item2->Proc.Effect, true);
|
||||
|
||||
|
||||
eslot = MATERIAL_PRIMARY;
|
||||
}
|
||||
else if (foundslot == SLOT_SECONDARY
|
||||
else if (foundslot == SLOT_SECONDARY
|
||||
&& (GetOwner() != nullptr || (GetLevel() >= 13 && MakeRandomInt(0,99) < NPC_DW_CHANCE) || (item2->Damage==0)) &&
|
||||
(item2->ItemType == ItemType1HS || item2->ItemType == ItemType1HB || item2->ItemType == ItemTypeShield ||
|
||||
item2->ItemType == ItemTypePierce))
|
||||
{
|
||||
if (item2->Proc.Effect!=0)
|
||||
CastToMob()->AddProcToWeapon(item2->Proc.Effect, true);
|
||||
|
||||
|
||||
eslot = MATERIAL_SECONDARY;
|
||||
}
|
||||
else if (foundslot == SLOT_HEAD) {
|
||||
@@ -315,10 +315,10 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
else if (foundslot == SLOT_FEET) {
|
||||
eslot = MATERIAL_FEET;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
what was this about???
|
||||
|
||||
|
||||
if (((npc->GetRace()==127) && (npc->CastToMob()->GetOwnerID()!=0)) && (item2->Slots==24576) || (item2->Slots==8192) || (item2->Slots==16384)){
|
||||
npc->d_meele_texture2=atoi(newid);
|
||||
wc->wear_slot_id=8;
|
||||
@@ -331,32 +331,32 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
npc->INT+=item2->INT;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//if we found an open slot it goes in...
|
||||
if(eslot != 0xFF) {
|
||||
if(wearchange) {
|
||||
wc->wear_slot_id = eslot;
|
||||
wc->material = emat;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (found) {
|
||||
CalcBonuses(); // This is less than ideal for bulk adding of items
|
||||
}
|
||||
item->equipSlot = item2->Slots;
|
||||
}
|
||||
|
||||
|
||||
if(itemlist != nullptr)
|
||||
itemlist->push_back(item);
|
||||
else
|
||||
safe_delete(item);
|
||||
|
||||
|
||||
if(wearchange && outapp) {
|
||||
entity_list.QueueClients(this, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NPC::AddItem(const Item_Struct* item, uint16 charges, bool equipitem) {
|
||||
//slot isnt needed, its determined from the item.
|
||||
AddLootDrop(item, &itemlist, charges, 1, 127, equipitem, equipitem);
|
||||
@@ -369,7 +369,7 @@ void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem) {
|
||||
return;
|
||||
AddLootDrop(i, &itemlist, charges, 1, 127, equipitem, 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);
|
||||
|
||||
+15
-15
@@ -71,7 +71,7 @@ typedef struct _mapHeader {
|
||||
unsigned shorts are adequate because, worst case
|
||||
even in a zone that is 6000x6000 with a small node
|
||||
size of 30x30, there are only 40000 nodes.
|
||||
|
||||
|
||||
quadrent definitions:
|
||||
quad 1 (nodes[0]):
|
||||
x>=0, y>=0
|
||||
@@ -81,7 +81,7 @@ typedef struct _mapHeader {
|
||||
x<0, y<0
|
||||
quad 4 (nodes[3]):
|
||||
x>=0, y<0
|
||||
|
||||
|
||||
*/
|
||||
enum { //node flags
|
||||
nodeFinal = 0x01
|
||||
@@ -97,7 +97,7 @@ typedef struct _nodeHeader {
|
||||
float miny;
|
||||
float maxx;
|
||||
float maxy;
|
||||
|
||||
|
||||
uint8 flags;
|
||||
union {
|
||||
uint16 nodes[4]; //index 0 means nullptr, not root
|
||||
@@ -126,27 +126,27 @@ typedef uint16 NodeRef;
|
||||
class Map {
|
||||
public:
|
||||
static Map* LoadMapfile(const char* in_zonename, const char *directory = nullptr);
|
||||
|
||||
|
||||
Map();
|
||||
~Map();
|
||||
|
||||
|
||||
bool loadMap(FILE *fp);
|
||||
|
||||
|
||||
//the result is always final, except special NODE_NONE
|
||||
NodeRef SeekNode( NodeRef _node, float x, float y ) const;
|
||||
|
||||
|
||||
//these are untested since rewrite:
|
||||
int *SeekFace( NodeRef _node, float x, float y );
|
||||
float GetFaceHeight( int _idx, float x, float y ) const;
|
||||
|
||||
|
||||
bool LocWithinNode( NodeRef _node, float x, float y ) const;
|
||||
|
||||
|
||||
//nodes to these functions must be final
|
||||
bool LineIntersectsNode( NodeRef _node, VERTEX start, VERTEX end, VERTEX *result, FACE **on = nullptr) const;
|
||||
bool LineIntersectsFace( PFACE cface, VERTEX start, VERTEX end, VERTEX *result) const;
|
||||
float FindBestZ( NodeRef _node, VERTEX start, VERTEX *result, FACE **on = nullptr) const;
|
||||
bool LineIntersectsZone(VERTEX start, VERTEX end, float step, VERTEX *result, FACE **on = nullptr) const;
|
||||
|
||||
|
||||
// inline unsigned int GetVertexNumber( ) {return m_Vertex; }
|
||||
inline uint32 GetFacesNumber( ) const { return m_Faces; }
|
||||
// inline PVERTEX GetVertex( int _idx ) {return mFinalVertex + _idx; }
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
inline PFACE GetFaceFromlist( int _idx) {return &mFinalFaces[ mFaceLists[_idx] ]; }
|
||||
inline NodeRef GetRoot( ) const { return MAP_ROOT_NODE; }
|
||||
inline PNODE GetNode( NodeRef r ) { return( mNodes + r ); }
|
||||
|
||||
|
||||
inline float GetMinX() const { return(_minx); }
|
||||
inline float GetMaxX() const { return(_maxx); }
|
||||
inline float GetMinY() const { return(_miny); }
|
||||
@@ -173,13 +173,13 @@ private:
|
||||
PFACE mFinalFaces;
|
||||
PNODE mNodes;
|
||||
uint32 *mFaceLists;
|
||||
|
||||
|
||||
|
||||
|
||||
int mCandFaces[100];
|
||||
|
||||
|
||||
float _minz, _maxz;
|
||||
float _minx, _miny, _maxx, _maxy;
|
||||
|
||||
|
||||
static void Normalize(VERTEX *p);
|
||||
|
||||
// void RecLoadNode( PNODE _node, FILE *l_f );
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//Trumpcard: EntityLists are composed of multiple list types. This is the
|
||||
//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"
|
||||
|
||||
+35
-35
@@ -1272,7 +1272,7 @@ uint16 Mob::MaxSkill_defensive(uint16 skillid, uint16 class_, uint16 level) cons
|
||||
case BARD: case BARDGM:
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case DISARM:{
|
||||
switch (class_) {
|
||||
@@ -1500,7 +1500,7 @@ uint16 Mob::MaxSkill_arcane(uint16 skillid, uint16 class_, uint16 level) const{
|
||||
r_value = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Int caster
|
||||
case ENCHANTER: case ENCHANTERGM:
|
||||
case MAGICIAN: case MAGICIANGM:
|
||||
@@ -1510,7 +1510,7 @@ uint16 Mob::MaxSkill_arcane(uint16 skillid, uint16 class_, uint16 level) const{
|
||||
r_value = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//make sure only 1 skill can be over 50
|
||||
uint16 hskill = 0;
|
||||
uint16 high = 0;
|
||||
@@ -1544,7 +1544,7 @@ uint16 Mob::MaxSkill_arcane(uint16 skillid, uint16 class_, uint16 level) const{
|
||||
r_value = 50;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (r_value > 200)
|
||||
r_value = 200;
|
||||
break;
|
||||
@@ -1802,7 +1802,7 @@ uint16 Mob::MaxSkill_class(uint16 skillid, uint16 class_, uint16 level) const{
|
||||
}// Class Switch
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Berzerkers
|
||||
case BERSERKING: {
|
||||
switch(class_){
|
||||
@@ -1817,7 +1817,7 @@ uint16 Mob::MaxSkill_class(uint16 skillid, uint16 class_, uint16 level) const{
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Shaman
|
||||
case ALCHEMY:{
|
||||
switch(class_){
|
||||
@@ -1875,7 +1875,7 @@ uint16 Mob::MaxSkill_class(uint16 skillid, uint16 class_, uint16 level) const{
|
||||
}// Class Switch
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case SNEAK:{
|
||||
switch(class_){
|
||||
// True class
|
||||
@@ -1924,7 +1924,7 @@ uint16 Mob::MaxSkill_class(uint16 skillid, uint16 class_, uint16 level) const{
|
||||
}// Class Switch
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case SENSE_TRAPS:
|
||||
case PICK_LOCK:
|
||||
case DISARM_TRAPS:{
|
||||
@@ -2204,25 +2204,25 @@ uint16 Mob::MaxSkill(uint16 skillid, uint16 class_, uint16 level) const {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CLERIC: case CLERICGM:{
|
||||
r_value = ((level*5)+5);
|
||||
case CLERIC: case CLERICGM:{
|
||||
r_value = ((level*5)+5);
|
||||
if(level >= 50) {
|
||||
if(r_value > 201)
|
||||
r_value = 201;
|
||||
r_value = 201;
|
||||
} else {
|
||||
if(r_value > 200)
|
||||
r_value = 200;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case DRUID: case DRUIDGM:
|
||||
case SHAMAN: case SHAMANGM:{
|
||||
r_value = ((level*5) + 5);
|
||||
if(r_value > 200)
|
||||
r_value = 200;
|
||||
r_value = 200;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case MAGICIAN: case MAGICIANGM:
|
||||
case ENCHANTER: case ENCHANTERGM:
|
||||
case NECROMANCER: case NECROMANCERGM:
|
||||
@@ -2234,23 +2234,23 @@ uint16 Mob::MaxSkill(uint16 skillid, uint16 class_, uint16 level) const {
|
||||
}
|
||||
case BEASTLORD: case BEASTLORDGM:
|
||||
case BERSERKER: case BERSERKERGM:
|
||||
case MONK: case MONKGM: {
|
||||
r_value = ((level*5)+5);
|
||||
case MONK: case MONKGM: {
|
||||
r_value = ((level*5)+5);
|
||||
if(level >= 50) {
|
||||
if(r_value > 210)
|
||||
r_value = 210;
|
||||
r_value = 210;
|
||||
} else {
|
||||
if(r_value > 200)
|
||||
r_value = 200;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PALADIN: case PALADINGM: {
|
||||
case PALADIN: case PALADINGM: {
|
||||
if (level > 10) {
|
||||
r_value = (((level-10)*5)+5);
|
||||
r_value = (((level-10)*5)+5);
|
||||
if(level >= 50) {
|
||||
if(r_value > 210)
|
||||
r_value = 210;
|
||||
r_value = 210;
|
||||
} else {
|
||||
if(r_value > 200)
|
||||
r_value = 200;
|
||||
@@ -2258,12 +2258,12 @@ uint16 Mob::MaxSkill(uint16 skillid, uint16 class_, uint16 level) const {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RANGER: case RANGERGM: {
|
||||
case RANGER: case RANGERGM: {
|
||||
if (level > 15) {
|
||||
r_value = (((level-15)*5)+5);
|
||||
r_value = (((level-15)*5)+5);
|
||||
if(level >= 50) {
|
||||
if(r_value > 200)
|
||||
r_value = 200;
|
||||
r_value = 200;
|
||||
} else {
|
||||
if(r_value > 150)
|
||||
r_value = 150;
|
||||
@@ -2271,35 +2271,35 @@ uint16 Mob::MaxSkill(uint16 skillid, uint16 class_, uint16 level) const {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ROGUE: case ROGUEGM: {
|
||||
r_value = ((level*5)+5);
|
||||
|
||||
case ROGUE: case ROGUEGM: {
|
||||
r_value = ((level*5)+5);
|
||||
if(level >= 50) {
|
||||
if(r_value > 210)
|
||||
r_value = 210;
|
||||
r_value = 210;
|
||||
} else {
|
||||
if(r_value > 176)
|
||||
r_value = 176;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SHADOWKNIGHT: case SHADOWKNIGHTGM: {
|
||||
r_value = ((level*5)+5);
|
||||
if(level >= 50) {
|
||||
case SHADOWKNIGHT: case SHADOWKNIGHTGM: {
|
||||
r_value = ((level*5)+5);
|
||||
if(level >= 50) {
|
||||
if(r_value > 200)
|
||||
r_value = 200;
|
||||
r_value = 200;
|
||||
} else {
|
||||
if(r_value > 150)
|
||||
r_value = 150;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WARRIOR: case WARRIORGM: {
|
||||
case WARRIOR: case WARRIORGM: {
|
||||
if (level > 5) {
|
||||
r_value = (((level-5)*5)+5);
|
||||
r_value = (((level-5)*5)+5);
|
||||
if(level >= 50) {
|
||||
if(r_value > 210)
|
||||
r_value = 210;
|
||||
r_value = 210;
|
||||
} else {
|
||||
if(r_value > 175)
|
||||
r_value = 175;
|
||||
@@ -2307,7 +2307,7 @@ uint16 Mob::MaxSkill(uint16 skillid, uint16 class_, uint16 level) const {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default: r_value = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
+10
-10
@@ -1786,7 +1786,7 @@ void Merc::AI_Process() {
|
||||
SetHatedCount(0);
|
||||
confidence_timer.Disable();
|
||||
_check_confidence = false;
|
||||
|
||||
|
||||
if(!check_target_timer.Enabled())
|
||||
check_target_timer.Start(2000, false);
|
||||
|
||||
@@ -2596,7 +2596,7 @@ void Merc::CheckHateList() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
hateEntryIter++;
|
||||
}*/
|
||||
}
|
||||
@@ -3923,12 +3923,12 @@ MercSpell Merc::GetBestMercSpellForAENuke(Merc* caster, Mob* tar) {
|
||||
|
||||
//check if we have a spell & allow for other AE nuke types
|
||||
if(result.spellid == 0 && MakeRandomInt(1, 100) <= castChanceFalloff) {
|
||||
|
||||
|
||||
result = GetBestMercSpellForPBAENuke(caster, tar);
|
||||
|
||||
//check if we have a spell & allow for other AE nuke types
|
||||
if(result.spellid == 0 && MakeRandomInt(1, 100) <= castChanceFalloff) {
|
||||
|
||||
|
||||
result = GetBestMercSpellForTargetedAENuke(caster, tar);
|
||||
}
|
||||
}
|
||||
@@ -4106,7 +4106,7 @@ MercSpell Merc::GetBestMercSpellForNuke(Merc* caster) {
|
||||
|
||||
for(std::list<MercSpell>::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid)
|
||||
if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid)
|
||||
&& MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) {
|
||||
result.spellid = mercSpellListItr->spellid;
|
||||
result.stance = mercSpellListItr->stance;
|
||||
@@ -5250,7 +5250,7 @@ void Client::UpdateMercTimer()
|
||||
|
||||
GetMercInfo().MercTimerRemaining = RuleI(Mercs, UpkeepIntervalMS);
|
||||
SendMercTimerPacket(GetMercID(), 5, 0, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
|
||||
GetMercTimer()->Start(RuleI(Mercs, UpkeepIntervalMS));
|
||||
GetMercTimer()->Start(RuleI(Mercs, UpkeepIntervalMS));
|
||||
GetMercTimer()->SetTimer(GetMercInfo().MercTimerRemaining);
|
||||
|
||||
// Send upkeep charge message and reset the upkeep timer
|
||||
@@ -5436,7 +5436,7 @@ bool Client::CheckCanUnsuspendMerc() {
|
||||
{
|
||||
SendMercMerchantResponsePacket(16);
|
||||
Message(0, "You must wait %i seconds before unsuspending your mercenary.", GetPTimers().GetRemainingTime(pTimerMercSuspend)); //todo: find this packet response and tell them properly.
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -5608,7 +5608,7 @@ bool Merc::Unsuspend(bool setMaxStats) {
|
||||
mercOwner->SendMercenaryUnsuspendPacket(0);
|
||||
mercOwner->SendMercenaryUnknownPacket(1);
|
||||
mercOwner->GetMercInfo().SuspendedTime = 0;
|
||||
mercOwner->GetMercTimer()->Start(RuleI(Mercs, UpkeepIntervalMS));
|
||||
mercOwner->GetMercTimer()->Start(RuleI(Mercs, UpkeepIntervalMS));
|
||||
mercOwner->GetMercTimer()->SetTimer(mercOwner->GetMercInfo().MercTimerRemaining);
|
||||
mercOwner->SendMercTimerPacket(GetID(), mercState, suspendedTime, mercOwner->GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
|
||||
if(!mercOwner->GetPTimers().Expired(&database, pTimerMercSuspend, false))
|
||||
@@ -5770,7 +5770,7 @@ bool Merc::AddMercToGroup(Merc* merc, Group* group) {
|
||||
Merc::RemoveMercFromGroup(merc, merc->GetGroup());
|
||||
}
|
||||
//Try and add the member, followed by checking if the merc owner exists.
|
||||
if(group->AddMember(merc) && merc->GetMercOwner() != nullptr) {
|
||||
if(group->AddMember(merc) && merc->GetMercOwner() != nullptr) {
|
||||
merc->SetFollowID(merc->GetMercOwner()->GetID());
|
||||
Result = true;
|
||||
}
|
||||
@@ -5863,7 +5863,7 @@ void Client::SetMerc(Merc* newmerc) {
|
||||
GetMercInfo().IsSuspended = newmerc->IsSuspended();
|
||||
GetMercInfo().SuspendedTime = 0;
|
||||
GetMercInfo().Gender = newmerc->GetGender();
|
||||
//GetMercInfo().State = newmerc->GetStance();
|
||||
//GetMercInfo().State = newmerc->GetStance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+247
-247
File diff suppressed because it is too large
Load Diff
+51
-51
@@ -103,7 +103,7 @@ public:
|
||||
virtual void ThrowingAttack(Mob* other) { }
|
||||
uint16 GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg);
|
||||
// 13 = Primary (default), 14 = secondary
|
||||
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false,
|
||||
virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false,
|
||||
bool IsFromSpell = false) = 0;
|
||||
int MonkSpecialAttack(Mob* other, uint8 skill_used);
|
||||
virtual void TryBackstab(Mob *other,int ReuseTime = 10);
|
||||
@@ -121,20 +121,20 @@ public:
|
||||
|
||||
//Appearance
|
||||
void SendLevelAppearance();
|
||||
void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5,
|
||||
void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5,
|
||||
Client *specific_target=nullptr);
|
||||
void SendTargetable(bool on, Client *specific_target = nullptr);
|
||||
virtual void SendWearChange(uint8 material_slot);
|
||||
virtual void SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model = 0, uint32 elite_material = 0,
|
||||
virtual void SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model = 0, uint32 elite_material = 0,
|
||||
uint32 unknown06 = 0, uint32 unknown18 = 0);
|
||||
virtual void SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint);
|
||||
virtual void WearChange(uint8 material_slot, uint16 texture, uint32 color);
|
||||
void DoAnim(const int animnum, int type=0, bool ackreq = true, eqFilterType filter = FilterNone);
|
||||
void ProjectileAnimation(Mob* to, uint16 item_id, bool IsArrow = false, float speed = 0,
|
||||
void ProjectileAnimation(Mob* to, uint16 item_id, bool IsArrow = false, float speed = 0,
|
||||
float angle = 0, float tilt = 0, float arc = 0);
|
||||
void ChangeSize(float in_size, bool bNoRestriction = false);
|
||||
inline uint8 SeeInvisible() const { return see_invis; }
|
||||
inline bool SeeInvisibleUndead() const { return see_invis_undead; }
|
||||
inline uint8 SeeInvisible() const { return see_invis; }
|
||||
inline bool SeeInvisibleUndead() const { return see_invis_undead; }
|
||||
inline bool SeeHide() const { return see_hide; }
|
||||
inline bool SeeImprovedHide() const { return see_improved_hide; }
|
||||
bool IsInvisible(Mob* other = 0) const;
|
||||
@@ -147,11 +147,11 @@ public:
|
||||
void BardPulse(uint16 spell_id, Mob *caster);
|
||||
|
||||
//Spell
|
||||
void SendSpellEffect(uint32 effectid, uint32 duration, uint32 finish_delay, bool zone_wide,
|
||||
void SendSpellEffect(uint32 effectid, uint32 duration, uint32 finish_delay, bool zone_wide,
|
||||
uint32 unk020, bool perm_effect = false, Client *c = nullptr);
|
||||
bool IsBeneficialAllowed(Mob *target);
|
||||
virtual int GetCasterLevel(uint16 spell_id);
|
||||
void ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* newbon, uint16 casterID = 0,
|
||||
void ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* newbon, uint16 casterID = 0,
|
||||
bool item_bonus = false, uint32 ticsremaining = 0, int buffslot = -1);
|
||||
void NegateSpellsBonuses(uint16 spell_id);
|
||||
virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false) { return range;}
|
||||
@@ -160,27 +160,27 @@ public:
|
||||
virtual int32 GetActSpellCost(uint16 spell_id, int32 cost){ return cost;}
|
||||
virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration){ return duration;}
|
||||
virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime);
|
||||
float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false,
|
||||
float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false,
|
||||
int resist_override = 0, bool CharismaCheck = false);
|
||||
uint16 GetSpecializeSkillValue(uint16 spell_id) const;
|
||||
void SendSpellBarDisable();
|
||||
void SendSpellBarEnable(uint16 spellid);
|
||||
void ZeroCastingVars();
|
||||
virtual void SpellProcess();
|
||||
virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1,
|
||||
int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF,
|
||||
virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1,
|
||||
int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF,
|
||||
uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 *resist_adjust = nullptr);
|
||||
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1,
|
||||
int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF,
|
||||
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1,
|
||||
int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF,
|
||||
uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 resist_adjust = 0);
|
||||
void CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, uint16 mana_used,
|
||||
void CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, uint16 mana_used,
|
||||
uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0);
|
||||
bool SpellFinished(uint16 spell_id, Mob *target, uint16 slot = 10, uint16 mana_used = 0,
|
||||
bool SpellFinished(uint16 spell_id, Mob *target, uint16 slot = 10, uint16 mana_used = 0,
|
||||
uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false);
|
||||
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false,
|
||||
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false,
|
||||
bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false);
|
||||
virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100);
|
||||
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center,
|
||||
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center,
|
||||
CastAction_type &CastAction);
|
||||
virtual bool CheckFizzle(uint16 spell_id);
|
||||
virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster);
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
uint16 GetSpellIDFromSlot(uint8 slot);
|
||||
int CountDispellableBuffs();
|
||||
bool HasBuffIcon(Mob* caster, Mob* target, uint16 spell_id);
|
||||
bool CheckHitsRemaining(uint32 buff_slot, bool when_spell_done=false, bool negate=false,uint16 type=0,
|
||||
bool CheckHitsRemaining(uint32 buff_slot, bool when_spell_done=false, bool negate=false,uint16 type=0,
|
||||
uint16 spell_id=0, bool use_skill=false,uint16 skill=0);
|
||||
void SpreadVirus(uint16 spell_id, uint16 casterID);
|
||||
bool IsNimbusEffectActive(uint32 nimbus_effect);
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
virtual uint32 IsEliteMaterialItem(uint8 material_slot) const;
|
||||
bool AffectedBySpellExcludingSlot(int slot, int effect);
|
||||
virtual void Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillType attack_skill) = 0;
|
||||
virtual void Damage(Mob* from, 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) = 0;
|
||||
inline virtual void SetHP(int32 hp) { if (hp >= max_hp) cur_hp = max_hp; else cur_hp = hp;}
|
||||
bool ChangeHP(Mob* other, int32 amount, uint16 spell_id = 0, int8 buffslot = -1, bool iBuffTic = false);
|
||||
@@ -288,7 +288,7 @@ public:
|
||||
inline const char* GetOrigName() const { return orig_name; }
|
||||
inline const char* GetLastName() const { return lastname; }
|
||||
const char *GetCleanName();
|
||||
virtual void SetName(const char *new_name = nullptr) { new_name ? strn0cpy(name, new_name, 64) :
|
||||
virtual void SetName(const char *new_name = nullptr) { new_name ? strn0cpy(name, new_name, 64) :
|
||||
strn0cpy(name, GetName(), 64); return; };
|
||||
inline Mob* GetTarget() const { return target; }
|
||||
virtual void SetTarget(Mob* mob);
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
int32 GetItemHPBonuses();
|
||||
int32 GetSpellHPBonuses();
|
||||
virtual const int32& SetMana(int32 amount);
|
||||
inline float GetManaRatio() const { return max_mana == 0 ? 100 :
|
||||
inline float GetManaRatio() const { return max_mana == 0 ? 100 :
|
||||
((static_cast<float>(cur_mana) / max_mana) * 100); }
|
||||
virtual int32 CalcMaxMana();
|
||||
uint32 GetNPCTypeID() const { return npctype_id; }
|
||||
@@ -358,7 +358,7 @@ public:
|
||||
virtual bool HasGroup() = 0;
|
||||
virtual Raid* GetRaid() = 0;
|
||||
virtual Group* GetGroup() = 0;
|
||||
|
||||
|
||||
//Faction
|
||||
virtual inline int32 GetPrimaryFaction() const { return 0; }
|
||||
|
||||
@@ -382,14 +382,14 @@ public:
|
||||
void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu);
|
||||
void SendPosition();
|
||||
void SetFlyMode(uint8 flymode);
|
||||
inline void Teleport(VERTEX NewPosition) { x_pos = NewPosition.x; y_pos = NewPosition.y;
|
||||
inline void Teleport(VERTEX NewPosition) { x_pos = NewPosition.x; y_pos = NewPosition.y;
|
||||
z_pos = NewPosition.z; };
|
||||
|
||||
|
||||
//AI
|
||||
static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel);
|
||||
inline uint32 GetLevelCon(uint8 iOtherLevel) const {
|
||||
inline uint32 GetLevelCon(uint8 iOtherLevel) const {
|
||||
return this ? GetLevelCon(GetLevel(), iOtherLevel) : CON_GREEN; }
|
||||
virtual void AddToHateList(Mob* other, int32 hate = 0, int32 damage = 0, bool iYellForHelp = true,
|
||||
virtual void AddToHateList(Mob* other, int32 hate = 0, int32 damage = 0, bool iYellForHelp = true,
|
||||
bool bFrenzy = false, bool iBuffTic = false);
|
||||
bool RemoveFromHateList(Mob* mob);
|
||||
void SetHate(Mob* other, int32 hate = 0, int32 damage = 0) { hate_list.Set(other,hate,damage);}
|
||||
@@ -402,7 +402,7 @@ public:
|
||||
bool IsEngaged() { return(!hate_list.IsEmpty()); }
|
||||
bool HateSummon();
|
||||
void FaceTarget(Mob* MobToFace = 0);
|
||||
void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime();
|
||||
void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime();
|
||||
heading = iHeading; } }
|
||||
void WipeHateList();
|
||||
void AddFeignMemory(Client* attacker);
|
||||
@@ -419,7 +419,7 @@ public:
|
||||
//Quest
|
||||
void QuestReward(Client *c = nullptr, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0);
|
||||
void CameraEffect(uint32 duration, uint32 intensity, Client *c = nullptr, bool global = false);
|
||||
inline bool GetQglobal() const { return qglobal; }
|
||||
inline bool GetQglobal() const { return qglobal; }
|
||||
|
||||
//Other Packet
|
||||
void CreateDespawnPacket(EQApplicationPacket* app, bool Decay);
|
||||
@@ -450,7 +450,7 @@ public:
|
||||
float DistNoRootNoZ(float x, float y) const;
|
||||
float DistNoRootNoZ(const Mob &) const;
|
||||
static float GetReciprocalHeading(Mob* target);
|
||||
bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest,
|
||||
bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest,
|
||||
bool lookForAftArc = true);
|
||||
|
||||
//Procs
|
||||
@@ -472,9 +472,9 @@ public:
|
||||
void EnableLogging() { logging_enabled = true; }
|
||||
void DisableLogging() { logging_enabled = false; }
|
||||
|
||||
|
||||
|
||||
//More stuff to sort:
|
||||
virtual bool IsAttackAllowed(Mob *target, bool isSpellAttack = false);
|
||||
virtual bool IsAttackAllowed(Mob *target, bool isSpellAttack = false);
|
||||
bool IsTargeted() const { return (targeted > 0); }
|
||||
inline void IsTargeted(int in_tar) { targeted += in_tar; if(targeted < 0) targeted = 0;}
|
||||
void SetFollowID(uint32 id) { follow = id; }
|
||||
@@ -488,18 +488,18 @@ public:
|
||||
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, uint32 distance = 0) { }
|
||||
void Say(const char *format, ...);
|
||||
void Say_StringID(uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
void Say_StringID(uint32 string_id, 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 Say_StringID(uint32 type, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
void Say_StringID(uint32 type, uint32 string_id, 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 Shout(const char *format, ...);
|
||||
void Emote(const char *format, ...);
|
||||
void QuestJournalledSay(Client *QuestInitiator, const char *str);
|
||||
uint32 GetItemStat(uint32 itemid, const char *identifier);
|
||||
|
||||
|
||||
|
||||
int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false);
|
||||
uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0);
|
||||
uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0);
|
||||
void SendIllusionPacket(uint16 in_race, uint8 in_gender = 0xFF, uint8 in_texture = 0xFF, uint8 in_helmtexture = 0xFF, uint8 in_haircolor = 0xFF, uint8 in_beardcolor = 0xFF, uint8 in_eyecolor1 = 0xFF, uint8 in_eyecolor2 = 0xFF, uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = 0xFFFFFFFF);
|
||||
virtual void Stun(int duration);
|
||||
virtual void UnStun();
|
||||
@@ -512,7 +512,7 @@ public:
|
||||
void Kill();
|
||||
bool PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id);
|
||||
bool TryDeathSave();
|
||||
bool TryDivineSave();
|
||||
bool TryDivineSave();
|
||||
void DoBuffWearOffEffect(uint32 index);
|
||||
void TryTriggerOnCast(uint32 spell_id, bool aa_trigger);
|
||||
void TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger);
|
||||
@@ -535,7 +535,7 @@ public:
|
||||
void CastOnCurer(uint32 spell_id);
|
||||
void CastOnCure(uint32 spell_id);
|
||||
void CastOnNumHitFade(uint32 spell_id);
|
||||
int SlowMitigation(bool slow_msg=false, Mob *caster = nullptr,int slow_value = 0);
|
||||
int SlowMitigation(bool slow_msg=false, Mob *caster = nullptr,int slow_value = 0);
|
||||
int16 GetCritDmgMob(uint16 skill);
|
||||
int16 GetMeleeDamageMod_SE(uint16 skill);
|
||||
int16 GetMeleeMinDamageMod_SE(uint16 skill);
|
||||
@@ -548,22 +548,22 @@ public:
|
||||
bool DoHPToManaCovert(uint16 mana_cost = 0);
|
||||
int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false);
|
||||
|
||||
void ModSkillDmgTaken(SkillType skill_num, int value);
|
||||
void ModSkillDmgTaken(SkillType skill_num, int value);
|
||||
int16 GetModSkillDmgTaken(const SkillType skill_num);
|
||||
void ModVulnerability(uint8 resist, int16 value);
|
||||
int16 GetModVulnerability(const uint8 resist);
|
||||
void ModVulnerability(uint8 resist, int16 value);
|
||||
int16 GetModVulnerability(const uint8 resist);
|
||||
|
||||
void SetAllowBeneficial(bool value) { m_AllowBeneficial = value; }
|
||||
bool GetAllowBeneficial() { return m_AllowBeneficial; }
|
||||
void SetDisableMelee(bool value) { m_DisableMelee = value; }
|
||||
bool IsMeleeDisabled() { return m_DisableMelee; }
|
||||
|
||||
|
||||
bool IsOffHandAtk() const { return offhand; }
|
||||
inline void OffHandAtk(bool val) { offhand = val; }
|
||||
|
||||
inline void SetFlurryChance(uint8 value) { NPC_FlurryChance = value;}
|
||||
uint8 GetFlurryChance() { return NPC_FlurryChance; }
|
||||
|
||||
|
||||
static uint32 GetAppearanceValue(EmuAppearance iAppearance);
|
||||
void SendAppearancePacket(uint32 type, uint32 value, bool WholeZone = true, bool iIgnoreSelf = false, Client *specific_target=nullptr);
|
||||
void SetAppearance(EmuAppearance app, bool iIgnoreSelf = true);
|
||||
@@ -581,7 +581,7 @@ public:
|
||||
void SetPetID(uint16 NewPetID);
|
||||
inline uint16 GetPetID() const { return petid; }
|
||||
inline PetType GetPetType() const { return typeofpet; }
|
||||
void SetPetType(PetType p) { typeofpet = p; }
|
||||
void SetPetType(PetType p) { typeofpet = p; }
|
||||
inline int16 GetPetPower() const { return (petpower < 0) ? 0 : petpower; }
|
||||
void SetPetPower(int16 p) { if (p < 0) petpower = 0; else petpower = p; }
|
||||
bool IsFamiliar() const { return(typeofpet == petFamiliar); }
|
||||
@@ -602,8 +602,8 @@ public:
|
||||
|
||||
uint8 invisible, see_invis;
|
||||
bool invulnerable, invisible_undead, invisible_animals, sneaking, hidden, improved_hidden;
|
||||
bool see_invis_undead, see_hide, see_improved_hide;
|
||||
bool qglobal;
|
||||
bool see_invis_undead, see_hide, see_improved_hide;
|
||||
bool qglobal;
|
||||
|
||||
virtual void SetAttackTimer();
|
||||
inline void SetInvul(bool invul) { invulnerable=invul; }
|
||||
@@ -769,7 +769,7 @@ public:
|
||||
inline int GetCWP() const { return(cur_wp); }
|
||||
void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; }
|
||||
virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther) { return FACTION_INDIFFERENT; }
|
||||
|
||||
|
||||
inline bool IsTrackable() const { return(trackable); }
|
||||
Timer* GetAIThinkTimer() { return AIthink_timer; }
|
||||
Timer* GetAIMovementTimer() { return AImovement_timer; }
|
||||
@@ -822,7 +822,7 @@ protected:
|
||||
virtual bool AI_EngagedCastCheck() { return(false); }
|
||||
virtual bool AI_PursueCastCheck() { return(false); }
|
||||
virtual bool AI_IdleCastCheck() { return(false); }
|
||||
|
||||
|
||||
|
||||
bool IsFullHP;
|
||||
bool moved;
|
||||
@@ -831,7 +831,7 @@ protected:
|
||||
std::map<std::string, std::string> m_EntityVariables;
|
||||
|
||||
int16 SkillDmgTaken_Mod[HIGHEST_SKILL+2];
|
||||
int16 Vulnerability_Mod[HIGHEST_RESIST+2];
|
||||
int16 Vulnerability_Mod[HIGHEST_RESIST+2];
|
||||
bool m_AllowBeneficial;
|
||||
bool m_DisableMelee;
|
||||
uint8 NPC_FlurryChance;
|
||||
@@ -960,7 +960,7 @@ protected:
|
||||
uint8 pRunAnimSpeed;
|
||||
bool m_is_running;
|
||||
|
||||
|
||||
|
||||
Timer attack_timer;
|
||||
Timer attack_dw_timer;
|
||||
Timer ranged_timer;
|
||||
@@ -972,7 +972,7 @@ protected:
|
||||
float rewind_x;
|
||||
float rewind_y;
|
||||
float rewind_z;
|
||||
Timer rewind_timer;
|
||||
Timer rewind_timer;
|
||||
|
||||
//spell casting vars
|
||||
Timer spellend_timer;
|
||||
@@ -1002,7 +1002,7 @@ protected:
|
||||
uint8 eyecolor1; // the eyecolors always seem to be the same, maybe left and right eye?
|
||||
uint8 eyecolor2;
|
||||
uint8 hairstyle;
|
||||
uint8 luclinface; //
|
||||
uint8 luclinface; //
|
||||
uint8 beard;
|
||||
uint32 drakkin_heritage;
|
||||
uint32 drakkin_tattoo;
|
||||
|
||||
+32
-32
@@ -5,13 +5,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -100,7 +100,7 @@ DBAsync *dbasync = nullptr;
|
||||
TaskManager *taskmanager = 0;
|
||||
QuestParserCollection *parse = 0;
|
||||
|
||||
const SPDat_Spell_Struct* spells;
|
||||
const SPDat_Spell_Struct* spells;
|
||||
void LoadSpells(EQEmu::MemoryMappedFile **mmf);
|
||||
int32 SPDAT_RECORDS = -1;
|
||||
|
||||
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
|
||||
set_exception_handler();
|
||||
|
||||
const char *zone_name;
|
||||
|
||||
|
||||
if(argc == 3) {
|
||||
worldserver.SetLauncherName(argv[2]);
|
||||
worldserver.SetLaunchedName(argv[1]);
|
||||
@@ -157,7 +157,7 @@ int main(int argc, char** argv) {
|
||||
_log(ZONE__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
|
||||
else
|
||||
_log(ZONE__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
|
||||
|
||||
|
||||
worldserver.SetPassword(Config->SharedKey.c_str());
|
||||
|
||||
_log(ZONE__INIT, "Connecting to MySQL...");
|
||||
@@ -179,9 +179,9 @@ int main(int argc, char** argv) {
|
||||
#ifdef _EQDEBUG
|
||||
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
#endif
|
||||
|
||||
|
||||
_log(ZONE__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION);
|
||||
|
||||
|
||||
/*
|
||||
* Setup nice signal handlers
|
||||
*/
|
||||
@@ -205,7 +205,7 @@ int main(int argc, char** argv) {
|
||||
_log(ZONE__INIT, "Warning: Unable to read %s", log_ini_file);
|
||||
else
|
||||
_log(ZONE__INIT, "Log settings loaded from %s", log_ini_file);
|
||||
|
||||
|
||||
_log(ZONE__INIT, "Mapping Incoming Opcodes");
|
||||
MapOpcodes();
|
||||
_log(ZONE__INIT, "Loading Variables");
|
||||
@@ -236,7 +236,7 @@ int main(int argc, char** argv) {
|
||||
CheckEQEMuErrorAndPause();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
_log(ZONE__INIT, "Loading spells");
|
||||
EQEmu::MemoryMappedFile *mmf = nullptr;
|
||||
LoadSpells(&mmf);
|
||||
@@ -295,7 +295,7 @@ int main(int argc, char** argv) {
|
||||
//now we have our parser, load the quests
|
||||
_log(ZONE__INIT, "Loading quests");
|
||||
parse->ReloadQuests();
|
||||
|
||||
|
||||
|
||||
#ifdef CLIENT_LOGS
|
||||
LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_buf);
|
||||
@@ -305,7 +305,7 @@ int main(int argc, char** argv) {
|
||||
if (!worldserver.Connect()) {
|
||||
_log(ZONE__INIT_ERR, "worldserver.Connect() FAILED!");
|
||||
}
|
||||
|
||||
|
||||
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
|
||||
#ifdef EQPROFILE
|
||||
#ifdef PROFILE_DUMP_TIME
|
||||
@@ -319,15 +319,15 @@ int main(int argc, char** argv) {
|
||||
_log(ZONE__INIT_ERR, "Zone bootup FAILED!");
|
||||
zone = 0;
|
||||
}
|
||||
|
||||
|
||||
//register all the patches we have avaliable with the stream identifier.
|
||||
EQStreamIdentifier stream_identifier;
|
||||
RegisterAllPatches(stream_identifier);
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Main thread running with thread id %d", pthread_self());
|
||||
#endif
|
||||
|
||||
|
||||
Timer quest_timers(100);
|
||||
UpdateWindowTitle();
|
||||
bool worldwasconnected = worldserver.Connected();
|
||||
@@ -338,10 +338,10 @@ int main(int argc, char** argv) {
|
||||
while(RunLoops) {
|
||||
{ //profiler block to omit the sleep from times
|
||||
_ZP(net_main);
|
||||
|
||||
|
||||
//Advance the timer to our current point in time
|
||||
Timer::SetCurrentTime();
|
||||
|
||||
|
||||
//process stuff from world
|
||||
worldserver.Process();
|
||||
|
||||
@@ -354,7 +354,7 @@ int main(int argc, char** argv) {
|
||||
worldwasconnected = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//check the factory for any new incoming streams.
|
||||
while ((eqss = eqsf.Pop())) {
|
||||
//pull the stream out of the factory and give it to the stream identifier
|
||||
@@ -365,10 +365,10 @@ int main(int argc, char** argv) {
|
||||
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort()));
|
||||
stream_identifier.AddStream(eqss); //takes the stream
|
||||
}
|
||||
|
||||
|
||||
//give the stream identifier a chance to do its work....
|
||||
stream_identifier.Process();
|
||||
|
||||
|
||||
//check the stream identifier for any now-identified streams
|
||||
while((eqsi = stream_identifier.PopIdentified())) {
|
||||
//now that we know what patch they are running, start up their client object
|
||||
@@ -378,11 +378,11 @@ int main(int argc, char** argv) {
|
||||
Client* client = new Client(eqsi);
|
||||
entity_list.AddClient(client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//check for timeouts in other threads
|
||||
timeout_manager.CheckTimeouts();
|
||||
|
||||
|
||||
if (worldserver.Connected()) {
|
||||
worldwasconnected = true;
|
||||
}
|
||||
@@ -480,7 +480,7 @@ int main(int argc, char** argv) {
|
||||
#endif
|
||||
safe_delete(ps);
|
||||
safe_delete(mmf);
|
||||
|
||||
|
||||
if (zone != 0)
|
||||
Zone::Shutdown(true);
|
||||
//Fix for Linux world server problem.
|
||||
@@ -490,7 +490,7 @@ int main(int argc, char** argv) {
|
||||
dbasync->StopThread();
|
||||
safe_delete(taskmanager);
|
||||
command_deinit();
|
||||
|
||||
|
||||
CheckEQEMuErrorAndPause();
|
||||
_log(ZONE__INIT, "Proper zone shutdown complete.");
|
||||
return 0;
|
||||
@@ -517,33 +517,33 @@ uint32 NetConnection::GetIP()
|
||||
char name[255+1];
|
||||
size_t len = 0;
|
||||
hostent* host = 0;
|
||||
|
||||
|
||||
if (gethostname(name, len) < 0 || len <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
host = (hostent*)gethostbyname(name);
|
||||
if (host == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return inet_addr(host->h_addr);
|
||||
}
|
||||
|
||||
uint32 NetConnection::GetIP(char* name)
|
||||
{
|
||||
hostent* host = 0;
|
||||
|
||||
|
||||
host = (hostent*)gethostbyname(name);
|
||||
if (host == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return inet_addr(host->h_addr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void NetConnection::SaveInfo(char* address, uint32 port, char* waddress, char* filename) {
|
||||
@@ -556,8 +556,8 @@ void NetConnection::SaveInfo(char* address, uint32 port, char* waddress, char* f
|
||||
strn0cpy(ZoneFileName, filename, sizeof(ZoneFileName));
|
||||
}
|
||||
|
||||
NetConnection::NetConnection()
|
||||
:
|
||||
NetConnection::NetConnection()
|
||||
:
|
||||
object_timer(5000),
|
||||
door_timer(5000),
|
||||
corpse_timer(2000),
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class NetConnection
|
||||
public:
|
||||
~NetConnection();
|
||||
NetConnection();
|
||||
|
||||
|
||||
uint32 GetIP();
|
||||
uint32 GetIP(char* name);
|
||||
void SaveInfo(char* address, uint32 port, char* waddress,char* filename);
|
||||
|
||||
+115
-115
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -121,12 +121,12 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
entity_list.RemoveEntity(mob->GetID());
|
||||
|
||||
int moblevel=GetLevel();
|
||||
|
||||
|
||||
NPCTypedata = d;
|
||||
NPCTypedata_ours = nullptr;
|
||||
respawn2 = in_respawn;
|
||||
swarm_timer.Disable();
|
||||
|
||||
|
||||
taunting = false;
|
||||
proximity = nullptr;
|
||||
copper = 0;
|
||||
@@ -146,7 +146,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
healscale = d->healscale;
|
||||
|
||||
logging_enabled = NPC_DEFAULT_LOGGING_ENABLED;
|
||||
|
||||
|
||||
pAggroRange = d->aggroradius;
|
||||
pAssistRange = GetAggroRange();
|
||||
findable = d->findable;
|
||||
@@ -186,12 +186,12 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
|
||||
// Set Mana and HP Regen Rates if they are 0 in the DB
|
||||
CalcNPCRegen();
|
||||
|
||||
|
||||
// Set Min and Max Damage if they are 0 in the DB
|
||||
if(max_dmg == 0){
|
||||
CalcNPCDamage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
accuracy_rating = d->accuracy_rating;
|
||||
ATK = d->ATK;
|
||||
|
||||
@@ -217,9 +217,9 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
roambox_movingto_x = -2;
|
||||
roambox_movingto_y = -2;
|
||||
roambox_delay = 1000;
|
||||
org_heading = heading;
|
||||
org_heading = heading;
|
||||
p_depop = false;
|
||||
loottable_id = d->loottable_id;
|
||||
loottable_id = d->loottable_id;
|
||||
|
||||
primary_faction = 0;
|
||||
SetNPCFactionID(d->npc_faction_id);
|
||||
@@ -234,10 +234,10 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
}
|
||||
|
||||
SpellFocusDMG = 0;
|
||||
SpellFocusHeal = 0;
|
||||
|
||||
SpellFocusHeal = 0;
|
||||
|
||||
pet_spell_id = 0;
|
||||
|
||||
|
||||
delaytimer = false;
|
||||
combat_event = false;
|
||||
attack_speed = d->attack_speed;
|
||||
@@ -262,7 +262,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
prim_melee_type = 28;
|
||||
if(!d_meele_texture2)
|
||||
sec_melee_type = 28;
|
||||
|
||||
|
||||
//give NPCs skill values...
|
||||
int r;
|
||||
for(r = 0; r <= HIGHEST_SKILL; r++) {
|
||||
@@ -271,7 +271,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
|
||||
if(d->trap_template > 0)
|
||||
{
|
||||
std::map<uint32,std::list<LDoNTrapTemplate*> >::iterator trap_ent_iter;
|
||||
std::map<uint32,std::list<LDoNTrapTemplate*> >::iterator trap_ent_iter;
|
||||
std::list<LDoNTrapTemplate*> trap_list;
|
||||
|
||||
trap_ent_iter = zone->ldon_trap_entry_list.find(d->trap_template);
|
||||
@@ -354,7 +354,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
|
||||
InitializeBuffSlots();
|
||||
CalcBonuses();
|
||||
}
|
||||
|
||||
|
||||
NPC::~NPC()
|
||||
{
|
||||
ClearQuestLists();
|
||||
@@ -368,9 +368,9 @@ NPC::~NPC()
|
||||
|
||||
//clear our spawn limit record if we had one.
|
||||
entity_list.LimitRemoveNPC(this);
|
||||
|
||||
|
||||
safe_delete(NPCTypedata_ours);
|
||||
|
||||
|
||||
{
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
@@ -381,7 +381,7 @@ NPC::~NPC()
|
||||
}
|
||||
itemlist.clear();
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
list<struct NPCFaction*>::iterator cur,end;
|
||||
cur = faction_list.begin();
|
||||
@@ -402,7 +402,7 @@ NPC::~NPC()
|
||||
void NPC::SetTarget(Mob* mob) {
|
||||
if(mob == GetTarget()) //dont bother if they are allready our target
|
||||
return;
|
||||
|
||||
|
||||
//our target is already set, do not turn from the course, unless our current target is dead.
|
||||
if(GetSwarmInfo() && GetTarget() && (GetTarget()->GetHP() > 0)) {
|
||||
Mob *targ = entity_list.GetMob(GetSwarmInfo()->target);
|
||||
@@ -433,7 +433,7 @@ ServerLootItem_Struct* NPC::GetItem(int slot_id) {
|
||||
}
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
|
||||
void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) {
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
@@ -480,7 +480,7 @@ void NPC::CheckMinMaxLevel(Mob *them)
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void NPC::ClearItemList() {
|
||||
@@ -493,7 +493,7 @@ void NPC::ClearItemList() {
|
||||
}
|
||||
itemlist.clear();
|
||||
}
|
||||
|
||||
|
||||
void NPC::QueryLoot(Client* to) {
|
||||
int x = 0;
|
||||
to->Message(0, "Coin: %ip %ig %is %ic", platinum, gold, silver, copper);
|
||||
@@ -544,14 +544,14 @@ void NPC::AddCash(uint16 in_copper, uint16 in_silver, uint16 in_gold, uint16 in_
|
||||
else
|
||||
platinum = 0;
|
||||
}
|
||||
|
||||
|
||||
void NPC::AddCash() {
|
||||
copper = MakeRandomInt(1, 100);
|
||||
silver = MakeRandomInt(1, 50);
|
||||
gold = MakeRandomInt(1, 10);
|
||||
platinum = MakeRandomInt(1, 5);
|
||||
}
|
||||
|
||||
|
||||
void NPC::RemoveCash() {
|
||||
copper = 0;
|
||||
silver = 0;
|
||||
@@ -562,7 +562,7 @@ void NPC::RemoveCash() {
|
||||
bool NPC::Process()
|
||||
{
|
||||
_ZP(NPC_Process);
|
||||
|
||||
|
||||
adverrorinfo = 1;
|
||||
if (IsStunned() && stunned_timer.Check())
|
||||
{
|
||||
@@ -585,21 +585,21 @@ bool NPC::Process()
|
||||
}
|
||||
|
||||
adverrorinfo = 2;
|
||||
|
||||
|
||||
SpellProcess();
|
||||
|
||||
if(tic_timer.Check())
|
||||
{
|
||||
|
||||
if(tic_timer.Check())
|
||||
{
|
||||
BuffProcess();
|
||||
|
||||
|
||||
if(curfp)
|
||||
ProcessFlee();
|
||||
|
||||
|
||||
uint32 bonus = 0;
|
||||
|
||||
|
||||
if(GetAppearance() == eaSitting)
|
||||
bonus+=3;
|
||||
|
||||
|
||||
int32 OOCRegen = 0;
|
||||
if(oocregen > 0){ //should pull from Mob class
|
||||
OOCRegen += GetMaxHP() * oocregen / 100;
|
||||
@@ -618,7 +618,7 @@ bool NPC::Process()
|
||||
SetHP(GetHP()+hp_regen+bonus+(GetLevel()/5));
|
||||
else
|
||||
SetHP(GetHP()+hp_regen+bonus);
|
||||
} else
|
||||
} else
|
||||
SetHP(GetHP()+hp_regen);
|
||||
|
||||
if(GetMana() < GetMaxMana()) {
|
||||
@@ -655,7 +655,7 @@ bool NPC::Process()
|
||||
SendHPUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(HasVirus()) {
|
||||
if(viral_timer.Check()) {
|
||||
viral_timer_counter++;
|
||||
@@ -670,7 +670,7 @@ bool NPC::Process()
|
||||
if(viral_timer_counter > 999)
|
||||
viral_timer_counter = 0;
|
||||
}
|
||||
|
||||
|
||||
if(spellbonuses.GravityEffect == 1) {
|
||||
if(gravity_timer.Check())
|
||||
DoGravityEffect();
|
||||
@@ -681,20 +681,20 @@ bool NPC::Process()
|
||||
SendPosition();
|
||||
reface_timer->Disable();
|
||||
}
|
||||
|
||||
|
||||
if (IsMezzed())
|
||||
return true;
|
||||
|
||||
|
||||
if(IsStunned()) {
|
||||
if(spun_timer.Check())
|
||||
if(spun_timer.Check())
|
||||
Spin();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (enraged_timer.Check()){
|
||||
ProcessEnrage();
|
||||
}
|
||||
|
||||
|
||||
//Handle assists...
|
||||
if(assist_timer.Check() && IsEngaged() && !Charmed()) {
|
||||
entity_list.AIYellForHelp(this, GetTarget());
|
||||
@@ -709,7 +709,7 @@ bool NPC::Process()
|
||||
}
|
||||
|
||||
AI_Process();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -764,7 +764,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case SE_HealOverTime: {
|
||||
if(this->GetHPRatio() < 100)
|
||||
return true;
|
||||
@@ -805,19 +805,19 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
}
|
||||
else {
|
||||
Seperator sep(spawncommand);
|
||||
//Lets see if someone didn't fill out the whole #spawn function properly
|
||||
//Lets see if someone didn't fill out the whole #spawn function properly
|
||||
if (!sep.IsNumber(1))
|
||||
sprintf(sep.arg[1],"1");
|
||||
sprintf(sep.arg[1],"1");
|
||||
if (!sep.IsNumber(2))
|
||||
sprintf(sep.arg[2],"1");
|
||||
sprintf(sep.arg[2],"1");
|
||||
if (!sep.IsNumber(3))
|
||||
sprintf(sep.arg[3],"0");
|
||||
if (atoi(sep.arg[4]) > 2100000000 || atoi(sep.arg[4]) <= 0)
|
||||
sprintf(sep.arg[4]," ");
|
||||
if (!strcmp(sep.arg[5],"-"))
|
||||
sprintf(sep.arg[5]," ");
|
||||
sprintf(sep.arg[5]," ");
|
||||
if (!sep.IsNumber(5))
|
||||
sprintf(sep.arg[5]," ");
|
||||
sprintf(sep.arg[5]," ");
|
||||
if (!sep.IsNumber(6))
|
||||
sprintf(sep.arg[6],"1");
|
||||
if (!sep.IsNumber(8))
|
||||
@@ -827,7 +827,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
if (!sep.IsNumber(7))
|
||||
sprintf(sep.arg[7],"0");
|
||||
if (!strcmp(sep.arg[4],"-"))
|
||||
sprintf(sep.arg[4]," ");
|
||||
sprintf(sep.arg[4]," ");
|
||||
if (!sep.IsNumber(10)) // bodytype
|
||||
sprintf(sep.arg[10], "0");
|
||||
//Calc MaxHP if client neglected to enter it...
|
||||
@@ -848,16 +848,16 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
multiplier = 27;
|
||||
else if (tmplevel < 57)
|
||||
multiplier = 28;
|
||||
else
|
||||
else
|
||||
multiplier = 30;
|
||||
break;
|
||||
|
||||
|
||||
case DRUID:
|
||||
case CLERIC:
|
||||
case SHAMAN:
|
||||
multiplier = 15;
|
||||
break;
|
||||
|
||||
|
||||
case PALADIN:
|
||||
case SHADOWKNIGHT:
|
||||
if (tmplevel < 35)
|
||||
@@ -873,7 +873,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
else
|
||||
multiplier = 26;
|
||||
break;
|
||||
|
||||
|
||||
case MONK:
|
||||
case BARD:
|
||||
case ROGUE:
|
||||
@@ -883,23 +883,23 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
else if (tmplevel < 58)
|
||||
multiplier = 19;
|
||||
else
|
||||
multiplier = 20;
|
||||
multiplier = 20;
|
||||
break;
|
||||
|
||||
|
||||
case RANGER:
|
||||
if (tmplevel < 58)
|
||||
multiplier = 20;
|
||||
else
|
||||
multiplier = 21;
|
||||
multiplier = 21;
|
||||
break;
|
||||
|
||||
|
||||
case MAGICIAN:
|
||||
case WIZARD:
|
||||
case NECROMANCER:
|
||||
case ENCHANTER:
|
||||
multiplier = 12;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (tmplevel < 35)
|
||||
multiplier = 21;
|
||||
@@ -917,22 +917,22 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
}
|
||||
sprintf(sep.arg[4],"%i",5+multiplier*atoi(sep.arg[2])+multiplier*atoi(sep.arg[2])*75/300);
|
||||
}
|
||||
|
||||
|
||||
// Autoselect NPC Gender
|
||||
if (sep.arg[5][0] == 0) {
|
||||
sprintf(sep.arg[5], "%i", (int) Mob::GetDefaultGender(atoi(sep.arg[1])));
|
||||
}
|
||||
|
||||
//Time to create the NPC!!
|
||||
|
||||
//Time to create the NPC!!
|
||||
NPCType* npc_type = new NPCType;
|
||||
memset(npc_type, 0, sizeof(NPCType));
|
||||
|
||||
|
||||
strncpy(npc_type->name, sep.arg[0], 60);
|
||||
npc_type->cur_hp = atoi(sep.arg[4]);
|
||||
npc_type->max_hp = atoi(sep.arg[4]);
|
||||
npc_type->cur_hp = atoi(sep.arg[4]);
|
||||
npc_type->max_hp = atoi(sep.arg[4]);
|
||||
npc_type->race = atoi(sep.arg[1]);
|
||||
npc_type->gender = atoi(sep.arg[5]);
|
||||
npc_type->class_ = atoi(sep.arg[6]);
|
||||
npc_type->gender = atoi(sep.arg[5]);
|
||||
npc_type->class_ = atoi(sep.arg[6]);
|
||||
npc_type->deity = 1;
|
||||
npc_type->level = atoi(sep.arg[2]);
|
||||
npc_type->npc_id = 0;
|
||||
@@ -942,9 +942,9 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
npc_type->runspeed = 1.25;
|
||||
npc_type->d_meele_texture1 = atoi(sep.arg[7]);
|
||||
npc_type->d_meele_texture2 = atoi(sep.arg[8]);
|
||||
npc_type->merchanttype = atoi(sep.arg[9]);
|
||||
npc_type->merchanttype = atoi(sep.arg[9]);
|
||||
npc_type->bodytype = atoi(sep.arg[10]);
|
||||
|
||||
|
||||
npc_type->STR = 150;
|
||||
npc_type->STA = 150;
|
||||
npc_type->DEX = 150;
|
||||
@@ -955,14 +955,14 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z,
|
||||
|
||||
npc_type->prim_melee_type = 28;
|
||||
npc_type->sec_melee_type = 28;
|
||||
|
||||
|
||||
NPC* npc = new NPC(npc_type, 0, in_x, in_y, in_z, in_heading/8, FlyMode3);
|
||||
npc->GiveNPCTypeData(npc_type);
|
||||
|
||||
|
||||
entity_list.AddNPC(npc);
|
||||
|
||||
if (client) {
|
||||
// Notify client of spawn data
|
||||
// Notify client of spawn data
|
||||
client->Message(0, "New spawn:");
|
||||
client->Message(0, "Name: %s", npc->name);
|
||||
client->Message(0, "Race: %u", npc->race);
|
||||
@@ -995,7 +995,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
if (extra && c && c->GetZoneID())
|
||||
{
|
||||
// Set an npc_type ID within the standard range for the current zone if possible (zone_id * 1000)
|
||||
int starting_npc_id = c->GetZoneID() * 1000;
|
||||
int starting_npc_id = c->GetZoneID() * 1000;
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT MAX(id) FROM npc_types WHERE id >= %i AND id < %i", starting_npc_id, (starting_npc_id + 1000)), errbuf, &result)) {
|
||||
row = mysql_fetch_row(result);
|
||||
if(row)
|
||||
@@ -1015,7 +1015,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver
|
||||
npc_type_id = starting_npc_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
mysql_free_result(result);
|
||||
}
|
||||
@@ -1242,7 +1242,7 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//they have some loot item in this slot, pass it up to the default handler
|
||||
return(Mob::GetEquipmentMaterial(material_slot));
|
||||
}
|
||||
@@ -1262,9 +1262,9 @@ uint32 NPC::GetMaxDamage(uint8 tlevel)
|
||||
}
|
||||
|
||||
void NPC::PickPocket(Client* thief) {
|
||||
|
||||
|
||||
thief->CheckIncreaseSkill(PICK_POCKETS, nullptr, 5);
|
||||
|
||||
|
||||
//make sure were allowed to targte them:
|
||||
int olevel = GetLevel();
|
||||
if(olevel > (thief->GetLevel() + THIEF_PICKPOCKET_OVER)) {
|
||||
@@ -1273,7 +1273,7 @@ void NPC::PickPocket(Client* thief) {
|
||||
//should we check aggro
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(MakeRandomInt(0, 100) > 95){
|
||||
AddToHateList(thief, 50);
|
||||
Say("Stop thief!");
|
||||
@@ -1281,7 +1281,7 @@ void NPC::PickPocket(Client* thief) {
|
||||
thief->SendPickPocketResponse(this, 0, PickPocketFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int steal_skill = thief->GetSkill(PICK_POCKETS);
|
||||
int stealchance = steal_skill*100/(5*olevel+5);
|
||||
ItemInst* inst = 0;
|
||||
@@ -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;
|
||||
@@ -2024,7 +2024,7 @@ void NPC::LevelScale() {
|
||||
uint8 random_level = (MakeRandomInt(level, maxlevel));
|
||||
|
||||
float scaling = (((random_level / (float)level) - 1) * (scalerate / 100.0f));
|
||||
|
||||
|
||||
// Compensate for scale rates at low levels so they don't add too much
|
||||
uint8 scale_adjust = 1;
|
||||
if(level > 0 && level <= 5)
|
||||
@@ -2047,7 +2047,7 @@ void NPC::LevelScale() {
|
||||
WIS += (int)(WIS * scaling / scale_adjust);
|
||||
CHA += (int)(CHA * scaling / scale_adjust);
|
||||
if (MR)
|
||||
MR += (int)(MR * scaling / scale_adjust);
|
||||
MR += (int)(MR * scaling / scale_adjust);
|
||||
if (CR)
|
||||
CR += (int)(CR * scaling / scale_adjust);
|
||||
if (DR)
|
||||
@@ -2094,29 +2094,29 @@ void NPC::CalcNPCRegen() {
|
||||
mana_regen = 0;
|
||||
else
|
||||
mana_regen = mana_regen;
|
||||
|
||||
|
||||
// Gives low end monsters no regen if set to 0 in database. Should make low end monsters killable
|
||||
// Might want to lower this to /5 rather than 10.
|
||||
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;
|
||||
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;
|
||||
} else if(hp_regen < 0) {
|
||||
@@ -2167,10 +2167,10 @@ void NPC::CalcNPCDamage() {
|
||||
if (max_dmg==0)
|
||||
max_dmg = (GetLevel()*2)*AC_adjust/10;
|
||||
}
|
||||
|
||||
|
||||
int clfact = GetClassLevelFactor();
|
||||
min_dmg = (min_dmg * clfact) / 220;
|
||||
max_dmg = (max_dmg * clfact) / 220;
|
||||
max_dmg = (max_dmg * clfact) / 220;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2243,7 +2243,7 @@ int32 NPC::CalcMaxMana() {
|
||||
if (max_mana < 0) {
|
||||
max_mana = 0;
|
||||
}
|
||||
|
||||
|
||||
return max_mana;
|
||||
} else {
|
||||
switch (GetCasterClass()) {
|
||||
@@ -2261,7 +2261,7 @@ int32 NPC::CalcMaxMana() {
|
||||
if (max_mana < 0) {
|
||||
max_mana = 0;
|
||||
}
|
||||
|
||||
|
||||
return max_mana;
|
||||
}
|
||||
}
|
||||
@@ -2284,7 +2284,7 @@ NPC_Emote_Struct* NPC::GetNPCEmote(uint16 emoteid, uint8 event_) {
|
||||
}
|
||||
return (nullptr);
|
||||
}
|
||||
|
||||
|
||||
void NPC::DoNPCEmote(uint8 event_, uint16 emoteid)
|
||||
{
|
||||
if(this == nullptr || emoteid == 0)
|
||||
@@ -2338,7 +2338,7 @@ bool NPC::CanTalk()
|
||||
|
||||
if (TalkRace[GetRace() - 1] > 0)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2360,39 +2360,39 @@ void NPC::PrintOutQuestItems(Client* c){
|
||||
//this is called with 'this' as the mob being looked at, and
|
||||
//iOther the mob who is doing the looking. It should figure out
|
||||
//what iOther thinks about 'this'
|
||||
FACTION_VALUE NPC::GetReverseFactionCon(Mob* iOther) {
|
||||
FACTION_VALUE NPC::GetReverseFactionCon(Mob* iOther) {
|
||||
_ZP(NPC_GetReverseFactionCon);
|
||||
|
||||
iOther = iOther->GetOwnerOrSelf();
|
||||
int primaryFaction= iOther->GetPrimaryFaction();
|
||||
|
||||
|
||||
//I am pretty sure that this special faction call is backwards
|
||||
//and should be iOther->GetSpecialFactionCon(this)
|
||||
if (primaryFaction < 0)
|
||||
return GetSpecialFactionCon(iOther);
|
||||
|
||||
|
||||
if (primaryFaction == 0)
|
||||
return FACTION_INDIFFERENT;
|
||||
|
||||
|
||||
//if we are a pet, use our owner's faction stuff
|
||||
Mob *own = GetOwner();
|
||||
if (own != nullptr)
|
||||
return own->GetReverseFactionCon(iOther);
|
||||
|
||||
|
||||
//make sure iOther is an npc
|
||||
//also, if we dont have a faction, then they arnt gunna think anything of us either
|
||||
if(!iOther->IsNPC() || GetPrimaryFaction() == 0)
|
||||
return(FACTION_INDIFFERENT);
|
||||
|
||||
|
||||
//if we get here, iOther is an NPC too
|
||||
|
||||
|
||||
//otherwise, employ the npc faction stuff
|
||||
//so we need to look at iOther's faction table to see
|
||||
//what iOther thinks about our primary faction
|
||||
return(iOther->CastToNPC()->CheckNPCFactionAlly(GetPrimaryFaction()));
|
||||
}
|
||||
|
||||
//Look through our faction list and return a faction con based
|
||||
//Look through our faction list and return a faction con based
|
||||
//on the npc_value for the other person's primary faction in our list.
|
||||
FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) {
|
||||
list<struct NPCFaction*>::iterator cur,end;
|
||||
|
||||
+31
-31
@@ -74,9 +74,9 @@ class NPC : public Mob
|
||||
public:
|
||||
static NPC* SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z, float in_heading = 0, Client* client = 0);
|
||||
static int8 GetAILevel(bool iForceReRead = false);
|
||||
|
||||
|
||||
NPC(const NPCType* data, Spawn2* respawn, float x, float y, float z, float heading, int iflymode, bool IsCorpse = false);
|
||||
|
||||
|
||||
virtual ~NPC();
|
||||
|
||||
//abstract virtual function implementations requird by base abstract class
|
||||
@@ -109,12 +109,12 @@ public:
|
||||
void CalcNPCDamage();
|
||||
|
||||
|
||||
int32 GetActSpellDamage(uint16 spell_id, int32 value);
|
||||
int32 GetActSpellHealing(uint16 spell_id, int32 value);
|
||||
inline void SetSpellFocusDMG(int32 NewSpellFocusDMG) {SpellFocusDMG = NewSpellFocusDMG;}
|
||||
inline void SetSpellFocusHeal(int32 NewSpellFocusHeal) {SpellFocusHeal = NewSpellFocusHeal;}
|
||||
int32 SpellFocusDMG;
|
||||
int32 SpellFocusHeal;
|
||||
int32 GetActSpellDamage(uint16 spell_id, int32 value);
|
||||
int32 GetActSpellHealing(uint16 spell_id, int32 value);
|
||||
inline void SetSpellFocusDMG(int32 NewSpellFocusDMG) {SpellFocusDMG = NewSpellFocusDMG;}
|
||||
inline void SetSpellFocusHeal(int32 NewSpellFocusHeal) {SpellFocusHeal = NewSpellFocusHeal;}
|
||||
int32 SpellFocusDMG;
|
||||
int32 SpellFocusHeal;
|
||||
|
||||
virtual void SetTarget(Mob* mob);
|
||||
virtual uint16 GetSkill(SkillType skill_num) const { if (skill_num <= HIGHEST_SKILL) { return skills[skill_num]; } return 0; }
|
||||
@@ -216,9 +216,9 @@ public:
|
||||
uint32 GetSwarmOwner();
|
||||
uint32 GetSwarmTarget();
|
||||
void SetSwarmTarget(int target_id = 0);
|
||||
|
||||
|
||||
void SignalNPC(int _signal_id);
|
||||
|
||||
|
||||
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);}
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
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;
|
||||
|
||||
|
||||
uint32 GetMaxDMG() const {return max_dmg;}
|
||||
uint32 GetMinDMG() const {return min_dmg;}
|
||||
float GetSlowMitigation() const {return slow_mitigation;}
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false);
|
||||
virtual void DoClassAttacks(Mob *target);
|
||||
void CheckSignal();
|
||||
|
||||
|
||||
//waypoint crap
|
||||
int GetMaxWp() const { return max_wp; }
|
||||
void DisplayWaypointInfo(Client *to);
|
||||
@@ -257,10 +257,10 @@ public:
|
||||
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);
|
||||
|
||||
|
||||
uint32 GetEquipment(uint8 material_slot) const; // returns item id
|
||||
int32 GetEquipmentMaterial(uint8 material_slot) const;
|
||||
|
||||
|
||||
void NextGuardPosition();
|
||||
void SaveGuardSpot(bool iClearGuardSpot = false);
|
||||
inline bool IsGuarding() const { return(guard_heading != 0); }
|
||||
@@ -268,7 +268,7 @@ public:
|
||||
void RestoreGuardSpotCharm();
|
||||
void AI_SetRoambox(float iDist, float iRoamDist, uint32 iDelay = 2500);
|
||||
void AI_SetRoambox(float iDist, float iMaxX, float iMinX, float iMaxY, float iMinY, uint32 iDelay = 2500);
|
||||
|
||||
|
||||
//mercenary stuff
|
||||
void LoadMercTypes();
|
||||
void LoadMercs();
|
||||
@@ -280,12 +280,12 @@ public:
|
||||
int GetNumMercTypes( uint32 expansion );
|
||||
int GetNumMercs() { return static_cast<int>(mercDataList.size()); };
|
||||
int GetNumMercs( uint32 expansion );
|
||||
|
||||
|
||||
inline bool WillAggroNPCs() const { return(npc_aggro); }
|
||||
|
||||
|
||||
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
|
||||
|
||||
NPCProximity* proximity;
|
||||
@@ -361,8 +361,8 @@ public:
|
||||
{
|
||||
ClearQuestDeleteItems(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ClearQuestItems(bool delete_=false)
|
||||
{
|
||||
LinkedListIterator<ItemInst*> iterator(questItems);
|
||||
@@ -386,7 +386,7 @@ public:
|
||||
|
||||
questDeletionItems.Clear();
|
||||
}
|
||||
|
||||
|
||||
ItemInst* FindQuestItemByID(uint32 itmID, int charges, bool flagItemForDeletion=false)
|
||||
{
|
||||
LinkedListIterator<ItemInst*> iterator(questItems);
|
||||
@@ -413,7 +413,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool DoesQuestItemExist(uint32 itmID, int charges, bool flagItemForDeletion=false) {
|
||||
bool DoesQuestItemExist(uint32 itmID, int charges, bool flagItemForDeletion=false) {
|
||||
ItemInst* inst = FindQuestItemByID(itmID,charges,flagItemForDeletion);
|
||||
if ( inst != nullptr )
|
||||
{
|
||||
@@ -462,7 +462,7 @@ public:
|
||||
void mod_npc_killed(Mob* oos);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
const NPCType* NPCTypedata;
|
||||
NPCType* NPCTypedata_ours; //special case for npcs with uniquely created data.
|
||||
|
||||
@@ -478,7 +478,7 @@ protected:
|
||||
|
||||
int32 npc_faction_id;
|
||||
int32 primary_faction;
|
||||
|
||||
|
||||
Timer attacked_timer; //running while we are being attacked (damaged)
|
||||
Timer swarm_timer;
|
||||
Timer classattack_timer;
|
||||
@@ -499,8 +499,8 @@ protected:
|
||||
bool HasAISpell;
|
||||
virtual bool AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes);
|
||||
virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0);
|
||||
|
||||
|
||||
|
||||
|
||||
uint32 max_dmg;
|
||||
uint32 min_dmg;
|
||||
int32 accuracy_rating;
|
||||
@@ -513,11 +513,11 @@ protected:
|
||||
uint16 pet_spell_id;
|
||||
bool taunting;
|
||||
Timer taunt_timer; //for pet taunting
|
||||
|
||||
|
||||
bool npc_aggro;
|
||||
|
||||
|
||||
deque<int> signal_q;
|
||||
|
||||
|
||||
//waypoint crap:
|
||||
vector<wplist> Waypoints;
|
||||
void _ClearWaypints();
|
||||
@@ -534,7 +534,7 @@ protected:
|
||||
float roambox_movingto_x;
|
||||
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 d_meele_texture1; //this is an item Material value
|
||||
@@ -542,7 +542,7 @@ protected:
|
||||
uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation
|
||||
uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation
|
||||
AA_SwarmPetInfo *swarmInfoPtr;
|
||||
|
||||
|
||||
bool ldon_trapped;
|
||||
uint8 ldon_trap_type;
|
||||
uint16 ldon_spell_id;
|
||||
|
||||
+11
-11
@@ -94,7 +94,7 @@ IT10725_ACTORDEF=Shuriken
|
||||
#define OT_VALEFORGE 0x31 //halfling
|
||||
// gnome forge 0x23 (ak'anon forge)
|
||||
// barbarian forge 0x24 (northman forge)
|
||||
//
|
||||
//
|
||||
// iksar forge 0x26 (cabilis forge)
|
||||
// human forge 0x27 (qeynos or freeport?) (royal qeynos forge or freeport forge)
|
||||
// human forge 0x28 (qeynos or freeport?)
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
Object(Client* client, const ItemInst* inst);
|
||||
Object(const ItemInst *inst, float x, float y, float z, float heading, uint32 decay_time = 300000);
|
||||
Object(const char *model, float x, float y, float z, float heading, uint8 type, uint32 decay_time = 0);
|
||||
|
||||
|
||||
// Destructor
|
||||
~Object();
|
||||
bool Process();
|
||||
@@ -148,29 +148,29 @@ public:
|
||||
static void HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo);
|
||||
static void HandleAugmentation(Client* user, const AugmentItem_Struct* in_augment, Object *worldo);
|
||||
static void HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac);
|
||||
|
||||
|
||||
static SkillType TypeToSkill(uint32 type);
|
||||
|
||||
|
||||
// Packet functions
|
||||
void CreateSpawnPacket(EQApplicationPacket* app);
|
||||
void CreateDeSpawnPacket(EQApplicationPacket* app);
|
||||
void Depop();
|
||||
void Repop();
|
||||
|
||||
|
||||
//Decay functions
|
||||
void StartDecay() {decay_timer.Start();}
|
||||
|
||||
|
||||
// Container functions
|
||||
void PutItem(uint8 index, const ItemInst* inst);
|
||||
void DeleteItem(uint8 index); // Item inside container
|
||||
ItemInst* PopItem(uint8 index); // Pop item out of container
|
||||
|
||||
|
||||
// Override base class implementations
|
||||
virtual bool IsObject() const { return true; }
|
||||
virtual bool Save();
|
||||
virtual uint16 VarSave();
|
||||
virtual void SetID(uint16 set_id);
|
||||
|
||||
|
||||
void ClearUser() { user = nullptr; }
|
||||
|
||||
uint32 GetDBID();
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
protected:
|
||||
void ResetState(); // Set state back to original
|
||||
void RandomSpawn(bool send_packet = false); //spawn this ground spawn at a random place
|
||||
|
||||
|
||||
Object_Struct m_data; // Packet data
|
||||
ItemInst* m_inst; // Item representing object
|
||||
bool m_inuse; // Currently in use by a client?
|
||||
@@ -220,10 +220,10 @@ protected:
|
||||
bool m_ground_spawn;
|
||||
|
||||
std::map<std::string, std::string> o_EntityVariables;
|
||||
|
||||
|
||||
Client *user;
|
||||
Client *last_user;
|
||||
|
||||
|
||||
Timer respawn_timer;
|
||||
Timer decay_timer;
|
||||
};
|
||||
|
||||
+86
-86
@@ -57,7 +57,7 @@ extern volatile bool ZoneLoaded;
|
||||
ushort *array;
|
||||
struct seminfo *__buf;
|
||||
void *__pad;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -106,7 +106,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
#error ifstreams seem to break BSD...
|
||||
#endif
|
||||
ifstream in;in.open(SPELLS_FILE);
|
||||
|
||||
|
||||
if(!in.is_open()){
|
||||
LogFile->write(EQEMuLog::Error, "File '%s' not found in same directory as zone.exe, spell loading FAILED!", SPELLS_FILE);
|
||||
return;
|
||||
@@ -122,7 +122,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
// cout << "BLEH";
|
||||
// getch();
|
||||
//}
|
||||
|
||||
|
||||
//in.getline(&temp, 624);
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp, &sep))
|
||||
@@ -138,7 +138,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -163,7 +163,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -177,7 +177,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -190,7 +190,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -202,7 +202,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
//cout << spells[tempid].other_casts << '^';
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
token[u]=(char)0;
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -215,7 +215,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -228,7 +228,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -241,7 +241,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -252,7 +252,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
//cout << spells[tempid].range << '^';
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -265,7 +265,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -279,7 +279,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -292,8 +292,8 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
in.get(temp);
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
strncat(token,&temp,1);
|
||||
@@ -301,12 +301,12 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
in.get(temp);
|
||||
}
|
||||
spells[tempid].cast_time=atoi(token);
|
||||
|
||||
|
||||
//cout << spells[tempid].cast_time << '^';
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -319,7 +319,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -332,7 +332,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -345,7 +345,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -359,7 +359,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -372,7 +372,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -385,7 +385,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
int y;
|
||||
for(y=0; y< 12;y++)
|
||||
{
|
||||
@@ -401,8 +401,8 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
for(y=0; y< 12;y++)
|
||||
{
|
||||
@@ -418,7 +418,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
}
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
@@ -427,12 +427,12 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a++;
|
||||
in.get(temp);
|
||||
}
|
||||
spells[tempid].icon=atoi(token);
|
||||
spells[tempid].icon=atoi(token);
|
||||
//cout << spells[tempid].icon << '^';
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -440,13 +440,13 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a++;
|
||||
in.get(temp);
|
||||
}
|
||||
spells[tempid].memicon=atoi(token);
|
||||
spells[tempid].memicon=atoi(token);
|
||||
//cout << spells[tempid].memicon << '^';
|
||||
|
||||
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
for(y=0; y< 4;y++)
|
||||
{
|
||||
in.get(temp);
|
||||
@@ -461,7 +461,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
}
|
||||
for(y=0; y< 4;y++)
|
||||
{
|
||||
@@ -477,7 +477,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
}
|
||||
}
|
||||
for(y=0; y< 4;y++)
|
||||
{
|
||||
in.get(temp);
|
||||
@@ -492,7 +492,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
}
|
||||
for(y=0; y< 12;y++)
|
||||
{
|
||||
@@ -508,7 +508,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
}
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
@@ -522,7 +522,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
//cout << spells[tempid].LightType << '^';
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -535,7 +535,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -548,7 +548,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
|
||||
while(chrcmpI(&temp,&sep))
|
||||
@@ -562,7 +562,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
for(y=0; y< 12;y++)
|
||||
{
|
||||
in.get(temp);
|
||||
@@ -577,7 +577,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
}
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
@@ -591,7 +591,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -617,7 +617,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -630,7 +630,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -643,7 +643,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -657,7 +657,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
for(y=0; y< 15;y++)
|
||||
{
|
||||
in.get(temp);
|
||||
@@ -672,7 +672,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
} //cout << "end class";
|
||||
/*for(y=0; y< 3;y++)
|
||||
{
|
||||
@@ -688,7 +688,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
}
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
@@ -748,11 +748,11 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
}
|
||||
spells[tempid].SpellAffectIndex=atoi(token);
|
||||
//cout << spells[tempid].SpellAffectIndex << '^';
|
||||
|
||||
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
for(y=0; y< 23;y++)
|
||||
{
|
||||
in.get(temp);
|
||||
@@ -768,7 +768,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
}
|
||||
|
||||
|
||||
in.get(temp);
|
||||
while(chrcmpI(&temp,&sep))
|
||||
{
|
||||
@@ -781,7 +781,7 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
a=0;
|
||||
for(u=0;u<64;u++)
|
||||
token[u]=(char)0;
|
||||
|
||||
|
||||
in.get(temp);
|
||||
for(y=0; y< 2;y++)
|
||||
{
|
||||
@@ -814,17 +814,17 @@ void LoadSPDat(SPDat_Spell_Struct** SpellsPointer) {
|
||||
|
||||
while(temp!='\n')
|
||||
in.get(temp);
|
||||
|
||||
|
||||
//cout << endl;
|
||||
if(tempid==SPDAT_RECORDS-1) break;
|
||||
}
|
||||
}
|
||||
//for(u=0;u< SPDAT_RECORDS;u++)
|
||||
// cout << u << ' ' << spells[u].name << '^';
|
||||
|
||||
|
||||
spells_loaded = true;
|
||||
cout << "Spells loaded.\n";
|
||||
in.close();
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -842,7 +842,7 @@ void ZoneDatabase::UpdateAndDeleteAATimers(uint32 charid){
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
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)) {
|
||||
LogFile->write(EQEMuLog::Error, "UpdateAATimers query '%s' %s", query, errbuf);
|
||||
}
|
||||
@@ -867,7 +867,7 @@ void ZoneDatabase::GetAATimers(uint32 charid){
|
||||
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)) {
|
||||
while( ( row = mysql_fetch_row(result) ) ){
|
||||
UseAA_Struct* uaa=new UseAA_Struct();
|
||||
@@ -881,7 +881,7 @@ void ZoneDatabase::GetAATimers(uint32 charid){
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Database::GetAATimers query '%s' %s", query, errbuf);
|
||||
}
|
||||
}
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
@@ -899,7 +899,7 @@ uint32 ZoneDatabase::GetTimerRemaining(uint32 charid,uint32 ability){
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Database::GetTimerRemaining query '%s' %s", query, errbuf);
|
||||
}
|
||||
}
|
||||
safe_delete_array(query);
|
||||
return remain;
|
||||
}
|
||||
@@ -955,7 +955,7 @@ uint16 Client::GetCombinedAC_TEST() {
|
||||
const ItemInst* inst = m_inv[i];
|
||||
if (!inst || !inst->IsType(ItemTypeCommon))
|
||||
continue;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
if (item->FocusId && (item->FocusId != 0xFFFF)) {
|
||||
if (IsIncreaseDurationSpell(item->FocusId)) {
|
||||
@@ -975,7 +975,7 @@ bool Client::GetReduceManaCostItem(uint16 &spell_id, char *itemname)
|
||||
const ItemInst* inst = m_inv[i];
|
||||
if (!inst || !inst->IsType(ItemTypeCommon))
|
||||
continue;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
if (item->FocusId && (item->FocusId != 0xFFFF)) {
|
||||
if (IsReduceManaSpell(item->FocusId)) {
|
||||
@@ -995,7 +995,7 @@ bool Client::GetReduceCastTimeItem(uint16 &spell_id, char *itemname)
|
||||
const ItemInst* inst = m_inv[i];
|
||||
if (!inst || !inst->IsType(ItemTypeCommon))
|
||||
continue;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
if (item->FocusId && (item->FocusId != 0xFFFF)) {
|
||||
if (IsReduceCastTimeSpell(item->FocusId)) {
|
||||
@@ -1015,7 +1015,7 @@ bool Client::GetExtendedRangeItem(uint16 &spell_id, char *itemname)
|
||||
const ItemInst* inst = m_inv[i];
|
||||
if (!inst || !inst->IsType(ItemTypeCommon))
|
||||
continue;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
if (item->FocusId && (item->FocusId != 0xFFFF)) {
|
||||
if (IsExtRangeSpell(item->FocusId)) {
|
||||
@@ -1035,7 +1035,7 @@ bool Client::GetImprovedHealingItem(uint16 &spell_id, char *itemname)
|
||||
const ItemInst* inst = m_inv[i];
|
||||
if (!inst || !inst->IsType(ItemTypeCommon))
|
||||
continue;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
if (item->FocusId && (item->FocusId != 0xFFFF)) {
|
||||
if (IsImprovedHealingSpell(item->FocusId)) {
|
||||
@@ -1055,7 +1055,7 @@ bool Client::GetImprovedDamageItem(uint16 &spell_id, char *itemname)
|
||||
const ItemInst* inst = m_inv[i];
|
||||
if (!inst || !inst->IsType(ItemTypeCommon))
|
||||
continue;
|
||||
|
||||
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
if (item->FocusId && (item->FocusId != 0xFFFF)) {
|
||||
if (IsImprovedDamageSpell(item->FocusId)) {
|
||||
@@ -1074,7 +1074,7 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid)
|
||||
int modifier = 100, i;
|
||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||
const SPDat_Spell_Struct &modspell = spells[modspellid];
|
||||
|
||||
|
||||
for (i = 0; i < EFFECT_COUNT; i++)
|
||||
{
|
||||
if(IsBlankSpellEffect(modspellid, i))
|
||||
@@ -1202,22 +1202,22 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
|
||||
//Message(0,"You can use a new discipline in %i minutes %i seconds.", (disc_timer.GetRemainingTime()/1000)/60, disc_timer.GetRemainingTime()/1000%60);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//reuse times are a little messes up, they should scale down somehow
|
||||
//as you gain in levels, but im not sure how, so its just a lvl 60 bonus right now
|
||||
|
||||
|
||||
//should change this to check classes better.
|
||||
|
||||
|
||||
//both in seconds, converted at the end.
|
||||
uint32 duration = 0;
|
||||
uint32 reuse = 0;
|
||||
|
||||
|
||||
switch(disc_in->disc_id){
|
||||
// Shared?
|
||||
case discResistant: { // Resistant
|
||||
// 1 minute duration
|
||||
// 1 hour reuse
|
||||
// +3 to +10 to resists
|
||||
// +3 to +10 to resists
|
||||
if (GetLevel()<=29)
|
||||
return;
|
||||
duration = 60;
|
||||
@@ -1517,11 +1517,11 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
|
||||
case 0:{ // Timer request
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default:
|
||||
LogFile->write(EQEMuLog::Error, "Unknown Discipline requested by client: %s class: %i Disciline:%i", GetName(), class_,disc_in->disc_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(reuse != 0) {
|
||||
p_timers.Start(pTimerDisciplineReuse, reuse);
|
||||
//nonpersistent timer for the 'discipline ready' message
|
||||
@@ -1529,7 +1529,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
|
||||
}
|
||||
if(duration != 0)
|
||||
disc_elapse.Start(1000*duration);
|
||||
|
||||
|
||||
disc_inuse = disc_in->disc_id;
|
||||
}*/
|
||||
|
||||
@@ -1654,7 +1654,7 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0]
|
||||
}
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
#endif // solar: old code
|
||||
|
||||
@@ -1669,7 +1669,7 @@ void ZoneDatabase::AddLootTableToNPC(uint32 loottable_id, ItemList* itemlist, ui
|
||||
*silver = 0;
|
||||
*gold = 0;
|
||||
*plat = 0;
|
||||
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, mincash, maxcash, avgcoin FROM loottable WHERE id=%i", loottable_id), errbuf, &result)) {
|
||||
safe_delete_array(query);
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
@@ -1721,7 +1721,7 @@ void ZoneDatabase::AddLootTableToNPC(uint32 loottable_id, ItemList* itemlist, ui
|
||||
safe_delete_array(query);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT loottable_id, lootdrop_id, multiplier, probability FROM loottable_entries WHERE loottable_id=%i", loottable_id), errbuf, &result)) {
|
||||
safe_delete_array(query);
|
||||
while ((row = mysql_fetch_row(result))) {
|
||||
@@ -1739,7 +1739,7 @@ void ZoneDatabase::AddLootTableToNPC(uint32 loottable_id, ItemList* itemlist, ui
|
||||
safe_delete_array(query);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1750,7 +1750,7 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
|
||||
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
|
||||
// in another table.
|
||||
@@ -1760,14 +1760,14 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
|
||||
uint32 itemchance[50];
|
||||
uint16 itemcharges[50];
|
||||
uint8 i = 0;
|
||||
|
||||
|
||||
for (int m=0;m < 50;m++)
|
||||
{
|
||||
items[m]=0;
|
||||
itemchance[m]=0;
|
||||
itemcharges[m]=0;
|
||||
}
|
||||
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT lootdrop_id, item_id, item_charges, equip_item, chance FROM lootdrop_entries WHERE lootdrop_id=%i order by chance desc", lootdrop_id), errbuf, &result))
|
||||
{
|
||||
safe_delete_array(query);
|
||||
@@ -1781,7 +1781,7 @@ 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;
|
||||
@@ -1790,7 +1790,7 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
|
||||
{
|
||||
res = 0;
|
||||
}
|
||||
|
||||
|
||||
while (items[i] != 0)
|
||||
{
|
||||
if (res <= itemchance[i])
|
||||
@@ -1839,7 +1839,7 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
|
||||
item->equipSlot = 0;
|
||||
(*itemlist).Append(item);
|
||||
}
|
||||
|
||||
|
||||
//mysql_free_result(result);
|
||||
//return;
|
||||
}
|
||||
@@ -1853,7 +1853,7 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) {
|
||||
safe_delete_array(query);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
#endif*/
|
||||
|
||||
+46
-46
@@ -91,10 +91,10 @@ int calc(string calc)
|
||||
string integer1;
|
||||
char op = 0;
|
||||
int returnvalue = 0;
|
||||
|
||||
|
||||
while (*iterator) {
|
||||
char ch = *iterator;
|
||||
|
||||
|
||||
if(ch >= '0' && ch <= '9') { //If this character is numeric add it to the buffer
|
||||
buffer += ch;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ int calc(string calc)
|
||||
printf("Parser::calc() Error in syntax: '%s'.\n", calc.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//what was the previous op
|
||||
switch(op)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ int calc(string calc)
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
op = ch; //save current operator and continue parsing
|
||||
}
|
||||
buffer=""; //clear buffer now that we're starting on a new number
|
||||
@@ -293,7 +293,7 @@ int Parser::HasQuestFile(uint32 npcid)
|
||||
int success=1;
|
||||
if (qstID==-1)
|
||||
success = LoadScript(npcid, zone->GetShortName());
|
||||
if (!success)
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -308,7 +308,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
int success=1;
|
||||
if (qstID==-1)
|
||||
success = LoadScript(npcid, zone->GetShortName(),mob);
|
||||
if (!success)
|
||||
if (!success)
|
||||
return;
|
||||
else
|
||||
qstID = GetNPCqstID(npcid);
|
||||
@@ -323,7 +323,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
MYSQL_ROW row;
|
||||
char tmpname[65];
|
||||
int charid=0;
|
||||
|
||||
|
||||
if (mob && mob->IsClient()) // some events like waypoint and spawn don't have a player involved
|
||||
{
|
||||
charid=mob->CastToClient()->CharacterID();
|
||||
@@ -336,8 +336,8 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
|
||||
AddVar("charid.g",itoa(charid));
|
||||
|
||||
database.RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT name,value FROM quest_globals WHERE (npcid=%i || npcid=0) && (charid=%i || charid=0) && (zoneid=%i || zoneid=0) && expdate >= unix_timestamp(now())",
|
||||
database.RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT name,value FROM quest_globals WHERE (npcid=%i || npcid=0) && (charid=%i || charid=0) && (zoneid=%i || zoneid=0) && expdate >= unix_timestamp(now())",
|
||||
npcmob->GetNPCTypeID(),charid,zone->GetZoneID()), errbuf, &result);
|
||||
printf("%s\n",query);
|
||||
printf("%s\n",errbuf);
|
||||
@@ -349,7 +349,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
sprintf(tmpname,"%s.g",row[0]);
|
||||
AddVar(tmpname, row[1]);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
mysql_free_result(result);
|
||||
}
|
||||
if (query)
|
||||
{
|
||||
@@ -367,7 +367,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
AddVar("signal.g",data);
|
||||
}
|
||||
uint8 fac = 0;
|
||||
if (mob && mob->IsClient()) {
|
||||
if (mob && mob->IsClient()) {
|
||||
AddVar("uguild_id.g", itoa(mob->CastToClient()->GuildID()));
|
||||
AddVar("uguildrank.g", itoa(mob->CastToClient()->GuildRank()));
|
||||
}
|
||||
@@ -375,7 +375,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
if (mob && npcmob && mob->IsClient() && npcmob->IsNPC()) {
|
||||
Client* client = mob->CastToClient();
|
||||
NPC* npc = npcmob->CastToNPC();
|
||||
|
||||
|
||||
// Need to figure out why one of these casts would fail..
|
||||
if (client && npc) {
|
||||
fac = client->GetFactionLevel(client->GetID(), npcmob->GetID(), client->GetRace(), client->GetClass(), DEITY_AGNOSTIC, npc->GetPrimaryFaction(), npcmob);
|
||||
@@ -495,7 +495,7 @@ void Parser::Event(QuestEventID event, uint32 npcid, const char * data, NPC* npc
|
||||
DelChatAndItemVars(npcid);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Parser::Parser() : DEFAULT_QUEST_PREFIX("default") {
|
||||
MainList.clear();
|
||||
pNPCqstID = new int32[1];
|
||||
@@ -756,7 +756,7 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
#if Parser_DEBUG>10
|
||||
printf("After: %s\n", arglist[0]);
|
||||
#endif
|
||||
|
||||
|
||||
char command[256];
|
||||
strncpy(command, o_command.c_str(), 255);
|
||||
command[255] = 0;
|
||||
@@ -766,8 +766,8 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
*cptr = *cptr + ('a' - 'A');
|
||||
*cptr++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (!strcmp(command,"write")) {
|
||||
quest_manager.write(arglist[0], arglist[1]);
|
||||
}
|
||||
@@ -776,11 +776,11 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
quest_manager.me(parms.c_str());
|
||||
//end Myra
|
||||
}
|
||||
else if (!strcmp(command,"spawn") || !strcmp(command,"spawn2"))
|
||||
else if (!strcmp(command,"spawn") || !strcmp(command,"spawn2"))
|
||||
{
|
||||
|
||||
|
||||
float hdng;
|
||||
if (!strcmp(command,"spawn"))
|
||||
if (!strcmp(command,"spawn"))
|
||||
{
|
||||
hdng=mob->CastToClient()->GetHeading();
|
||||
}
|
||||
@@ -791,9 +791,9 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
quest_manager.spawn2(atoi(arglist[0]), atoi(arglist[1]), 0,
|
||||
atof(arglist[3]), atof(arglist[4]), atof(arglist[5]), hdng);
|
||||
}
|
||||
else if (!strcmp(command,"unique_spawn"))
|
||||
else if (!strcmp(command,"unique_spawn"))
|
||||
{
|
||||
|
||||
|
||||
float hdng;
|
||||
hdng=mob->CastToClient()->GetHeading();
|
||||
quest_manager.unique_spawn(atoi(arglist[0]), atoi(arglist[1]), 0,
|
||||
@@ -877,18 +877,18 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
else if (!strcmp(command,"snow")) {
|
||||
quest_manager.snow(atoi(arglist[0]));
|
||||
}
|
||||
else if (!strcmp(command,"surname")) {
|
||||
else if (!strcmp(command,"surname")) {
|
||||
quest_manager.surname(arglist[0]);
|
||||
}
|
||||
else if (!strcmp(command,"permaclass")) {
|
||||
}
|
||||
else if (!strcmp(command,"permaclass")) {
|
||||
quest_manager.permaclass(atoi(arglist[0]));
|
||||
}
|
||||
}
|
||||
else if (!strcmp(command,"permarace")) {
|
||||
quest_manager.permarace(atoi(arglist[0]));
|
||||
}
|
||||
}
|
||||
else if (!strcmp(command,"permagender")) {
|
||||
quest_manager.permagender(atoi(arglist[0]));
|
||||
}
|
||||
}
|
||||
else if (!strcmp(command,"scribespells")) {
|
||||
quest_manager.scribespells(atoi(arglist[0]));
|
||||
}
|
||||
@@ -904,8 +904,8 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
else if (!strcmp(command,"movepc")) {
|
||||
quest_manager.movepc((atoi(arglist[0])),(atof(arglist[1])),(atof(arglist[2])),(atof(arglist[3])),(atof(arglist[4])));
|
||||
}
|
||||
else if (!strcmp(command,"gmmove")) {
|
||||
quest_manager.gmmove(atof(arglist[0]), atof(arglist[1]), atof(arglist[2]));
|
||||
else if (!strcmp(command,"gmmove")) {
|
||||
quest_manager.gmmove(atof(arglist[0]), atof(arglist[1]), atof(arglist[2]));
|
||||
}
|
||||
else if (!strcmp(command,"movegrp")) {
|
||||
quest_manager.movegrp((atoi(arglist[0])),(atof(arglist[1])),(atof(arglist[2])),(atof(arglist[3])));
|
||||
@@ -946,7 +946,7 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
else if (!strcmp(command,"settime")) {
|
||||
quest_manager.settime(atoi(arglist[0]), atoi(arglist[1]));
|
||||
}
|
||||
else if (!strcmp(command,"itemlink")) {
|
||||
else if (!strcmp(command,"itemlink")) {
|
||||
quest_manager.itemlink(atoi(arglist[0]));
|
||||
}
|
||||
else if (!strcmp(command,"signal")) {
|
||||
@@ -1023,7 +1023,7 @@ void Parser::ExCommands(string o_command, string parms, int argnums, uint32 npci
|
||||
else if (!strcmp(command,"clear_proximity")) {
|
||||
quest_manager.clear_proximity();
|
||||
}
|
||||
else if (!strcmp(command,"respawn"))
|
||||
else if (!strcmp(command,"respawn"))
|
||||
{
|
||||
quest_manager.respawn(atoi(arglist[0]), atoi(arglist[1]));
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ int Parser::LoadScript(int npcid, const char * zone, Mob* activater)
|
||||
NewEventList->Event.push_back(event1);
|
||||
}
|
||||
if (bracket==-1)
|
||||
{
|
||||
{
|
||||
if(activater && activater->IsClient())
|
||||
activater->CastToClient()->Message(10,"Line: %d,File: %s | error C0006: syntax error : too many ')'s",line_num,filename.c_str());
|
||||
return 0;
|
||||
@@ -1328,13 +1328,13 @@ void Parser::HandleVars(string varname, string varparms, string& origstring, str
|
||||
temp[0] = atoi(varparms.c_str());
|
||||
Replace(origstring,format,temp);
|
||||
}
|
||||
//used_pawn - random implementation.
|
||||
else if (!strcmp(strlwr((const char*)varname.c_str()),"random")) {
|
||||
Replace(origstring,format,itoa(MakeRandomInt(0, varparms[0]-1)));
|
||||
}
|
||||
else if (!strcmp(strlwr((const char*)varname.c_str()),"asc")) {
|
||||
Replace(origstring,format,itoa(varparms[0]));
|
||||
}
|
||||
//used_pawn - random implementation.
|
||||
else if (!strcmp(strlwr((const char*)varname.c_str()),"random")) {
|
||||
Replace(origstring,format,itoa(MakeRandomInt(0, varparms[0]-1)));
|
||||
}
|
||||
else if (!strcmp(strlwr((const char*)varname.c_str()),"asc")) {
|
||||
Replace(origstring,format,itoa(varparms[0]));
|
||||
}
|
||||
else if (!strcmp(strlwr((const char*)varname.c_str()),"gettok")) {
|
||||
Replace(origstring,format,gettok(arglist[0],arglist[1][0],atoi(arglist[2])));
|
||||
}
|
||||
@@ -1385,7 +1385,7 @@ void Parser::ParseVars(string& text, uint32 npcid, Mob* mob)
|
||||
if (*iterator != '(' && *iterator != ')')
|
||||
buffer+=*iterator;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
buffer.replace(0,1,"",0);
|
||||
HandleVars(buffer,"",text,buffer2,npcid,mob);
|
||||
@@ -1423,7 +1423,7 @@ void Parser::ParseVars(string& text, uint32 npcid, Mob* mob)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
char * fixstring(char * string)
|
||||
{
|
||||
@@ -1567,14 +1567,14 @@ int Parser::ParseCommands(string text, int line, int justcheck, uint32 npcid, Mo
|
||||
if (*iterator == '"' && !escape && !ignore)
|
||||
if (quote)quote--;
|
||||
else quote++;
|
||||
|
||||
|
||||
if (*iterator == ',' && !ignore && !quote && !escape && paren)
|
||||
argit++;
|
||||
|
||||
if (*iterator == '(' && !ignore && !quote && !escape)
|
||||
{
|
||||
paren++;
|
||||
if (paren == 1)
|
||||
if (paren == 1)
|
||||
{
|
||||
if (last_finished)
|
||||
{
|
||||
@@ -1598,7 +1598,7 @@ int Parser::ParseCommands(string text, int line, int justcheck, uint32 npcid, Mo
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (*iterator == ')' && !ignore && !quote && !escape)
|
||||
{
|
||||
paren--;
|
||||
@@ -1618,7 +1618,7 @@ int Parser::ParseCommands(string text, int line, int justcheck, uint32 npcid, Mo
|
||||
mob->CastToClient()->Message(10,"Line: %d,File: %s | error C0006: syntax error : too many ')'s",line,filename.c_str() );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (*iterator == '{' && !escape)
|
||||
{
|
||||
bracket++;
|
||||
@@ -1655,7 +1655,7 @@ int Parser::ParseCommands(string text, int line, int justcheck, uint32 npcid, Mo
|
||||
else lastif=0;
|
||||
lastif=0,last_finished=0,quote=0,escape=0,ignore=0,argnums=0,argit=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (*iterator == ';' && !escape && !ignore && !quote)
|
||||
{
|
||||
if (last_finished)
|
||||
|
||||
+4
-4
@@ -9,13 +9,13 @@
|
||||
#include "QuestInterface.h"
|
||||
|
||||
|
||||
struct EventList {
|
||||
struct EventList {
|
||||
std::string event;
|
||||
std::string command;
|
||||
};
|
||||
|
||||
struct Events {
|
||||
uint32 npcid;
|
||||
uint32 npcid;
|
||||
std::list<EventList*> Event;
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
virtual ~Parser();
|
||||
int mindex;
|
||||
const std::string DEFAULT_QUEST_PREFIX;
|
||||
|
||||
|
||||
typedef list<Events*>::iterator iter_events;
|
||||
typedef list<EventList*>::iterator iter_eventlist;
|
||||
std::list<Events*> MainList;
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
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) {}
|
||||
|
||||
+65
-65
@@ -54,7 +54,7 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName)
|
||||
PathManager* Ret = nullptr;
|
||||
|
||||
strn0cpy(LowerCaseZoneName, ZoneName, 64);
|
||||
|
||||
|
||||
strlwr(LowerCaseZoneName);
|
||||
|
||||
snprintf(ZonePathFileName, 250, MAP_DIR "/%s.path", LowerCaseZoneName);
|
||||
@@ -123,7 +123,7 @@ bool PathManager::loadPaths(FILE *PathFile)
|
||||
}
|
||||
|
||||
PathNodes = new PathNode[Head.PathNodeCount];
|
||||
|
||||
|
||||
fread(PathNodes, sizeof(PathNode), Head.PathNodeCount, PathFile);
|
||||
|
||||
ClosedListFlag = new int[Head.PathNodeCount];
|
||||
@@ -164,7 +164,7 @@ void PathManager::PrintPathing()
|
||||
{
|
||||
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);
|
||||
|
||||
|
||||
|
||||
if(PathNodes[i].Neighbours[0].id == -1)
|
||||
{
|
||||
@@ -206,7 +206,7 @@ VERTEX PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ)
|
||||
}
|
||||
|
||||
return Result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
list<int> PathManager::FindRoute(int startID, int endID)
|
||||
@@ -238,7 +238,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
|
||||
CurrentNode = (*OpenList.begin());
|
||||
|
||||
ClosedList.push_back(CurrentNode);
|
||||
|
||||
|
||||
ClosedListFlag[CurrentNode.PathNodeID] = true;
|
||||
|
||||
OpenList.pop_front();
|
||||
@@ -256,7 +256,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
|
||||
Route.push_back(CurrentNode.PathNodeID);
|
||||
|
||||
Route.push_back(endID);
|
||||
|
||||
|
||||
list<AStarNode>::iterator RouteIterator;
|
||||
|
||||
while(CurrentNode.PathNodeID != startID)
|
||||
@@ -269,7 +269,7 @@ list<int> PathManager::FindRoute(int startID, int endID)
|
||||
Route.insert(Route.begin(), -1);
|
||||
|
||||
CurrentNode = (*RouteIterator);
|
||||
|
||||
|
||||
Route.insert(Route.begin(), CurrentNode.PathNodeID);
|
||||
|
||||
break;
|
||||
@@ -295,9 +295,9 @@ list<int> PathManager::FindRoute(int startID, int endID)
|
||||
AStarEntry.GCost = CurrentNode.GCost + PathNodes[CurrentNode.PathNodeID].Neighbours[i].distance;
|
||||
|
||||
float FCost = AStarEntry.HCost + AStarEntry.GCost;
|
||||
#ifdef PATHDEBUG
|
||||
#ifdef PATHDEBUG
|
||||
printf("Node: %i, Open Neighbour %i has HCost %8.3f, GCost %8.3f (Total Cost: %8.3f)\n",
|
||||
CurrentNode.PathNodeID,
|
||||
CurrentNode.PathNodeID,
|
||||
PathNodes[CurrentNode.PathNodeID].Neighbours[i].id,
|
||||
AStarEntry.HCost,
|
||||
AStarEntry.GCost,
|
||||
@@ -390,7 +390,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SortedByDistance.sort(SortPathNodesByDistance);
|
||||
|
||||
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
|
||||
@@ -428,7 +428,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
|
||||
SortedByDistance.push_back(TempNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SortedByDistance.sort(SortPathNodesByDistance);
|
||||
|
||||
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
|
||||
@@ -444,7 +444,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ClosestPathNodeToEnd < 0) {
|
||||
_log(PATHING__DEBUG, "No LOS to any end Path Node within range.");
|
||||
return noderoute;
|
||||
@@ -464,7 +464,7 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
|
||||
if(NodesToAttemptToCull > 0)
|
||||
{
|
||||
int CulledNodes = 0;
|
||||
|
||||
|
||||
list<int>::iterator First, Second;
|
||||
|
||||
while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull))
|
||||
@@ -489,13 +489,13 @@ list<int> PathManager::FindRoute(VERTEX Start, VERTEX End)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NodesToAttemptToCull = RuleI(Pathing, CullNodesFromEnd);
|
||||
|
||||
if(NodesToAttemptToCull > 0)
|
||||
{
|
||||
int CulledNodes = 0;
|
||||
|
||||
|
||||
list<int>::iterator First, Second;
|
||||
|
||||
while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull))
|
||||
@@ -566,7 +566,7 @@ void PathManager::SpawnPathNodes()
|
||||
else if(PathNodes[i].id < 100)
|
||||
sprintf(npc_type->name, "%s_%s", DigitToWord(PathNodes[i].id/10), DigitToWord(PathNodes[i].id % 10));
|
||||
else
|
||||
sprintf(npc_type->name, "%s_%s_%s", DigitToWord(PathNodes[i].id/100), DigitToWord((PathNodes[i].id % 100)/10),
|
||||
sprintf(npc_type->name, "%s_%s_%s", DigitToWord(PathNodes[i].id/100), DigitToWord((PathNodes[i].id % 100)/10),
|
||||
DigitToWord(((PathNodes[i].id % 100) %10)));
|
||||
|
||||
sprintf(npc_type->lastname, "%i", PathNodes[i].id);
|
||||
@@ -586,7 +586,7 @@ void PathManager::SpawnPathNodes()
|
||||
npc_type->d_meele_texture2 = 1;
|
||||
npc_type->merchanttype = 1;
|
||||
npc_type->bodytype = 1;
|
||||
|
||||
|
||||
npc_type->STR = 150;
|
||||
npc_type->STA = 150;
|
||||
npc_type->DEX = 150;
|
||||
@@ -596,10 +596,10 @@ void PathManager::SpawnPathNodes()
|
||||
npc_type->CHA = 150;
|
||||
|
||||
npc_type->findable = 1;
|
||||
|
||||
|
||||
NPC* npc = new NPC(npc_type, 0, PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, 0, FlyMode1);
|
||||
npc->GiveNPCTypeData(npc_type);
|
||||
|
||||
|
||||
entity_list.AddNPC(npc, true, true);
|
||||
}
|
||||
}
|
||||
@@ -619,7 +619,7 @@ void PathManager::MeshTest()
|
||||
{
|
||||
if(j == i)
|
||||
continue;
|
||||
|
||||
|
||||
list<int> Route = FindRoute(PathNodes[i].id, PathNodes[j].id);
|
||||
|
||||
if(Route.size() == 0)
|
||||
@@ -627,7 +627,7 @@ void PathManager::MeshTest()
|
||||
++NoConnections;
|
||||
printf("FindRoute(%i, %i) **** NO ROUTE FOUND ****\n", PathNodes[i].id, PathNodes[j].id);
|
||||
}
|
||||
++TotalTests;
|
||||
++TotalTests;
|
||||
}
|
||||
}
|
||||
printf("Executed %i route searches.\n", TotalTests);
|
||||
@@ -642,7 +642,7 @@ void PathManager::SimpleMeshTest()
|
||||
int TotalTests = 0;
|
||||
int NoConnections = 0;
|
||||
|
||||
printf("Beginning Pathmanager connectivity tests.\n");
|
||||
printf("Beginning Pathmanager connectivity tests.\n");
|
||||
fflush(stdout);
|
||||
|
||||
for(uint32 j = 1; j < Head.PathNodeCount; ++j)
|
||||
@@ -654,7 +654,7 @@ void PathManager::SimpleMeshTest()
|
||||
++NoConnections;
|
||||
printf("FindRoute(%i, %i) **** NO ROUTE FOUND ****\n", PathNodes[0].id, PathNodes[j].id);
|
||||
}
|
||||
++TotalTests;
|
||||
++TotalTests;
|
||||
}
|
||||
printf("Executed %i route searches.\n", TotalTests);
|
||||
printf("Failed to find %i routes.\n", NoConnections);
|
||||
@@ -725,7 +725,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
|
||||
PathingLastPosition = From;
|
||||
}
|
||||
|
||||
|
||||
if(Route.size() > 0)
|
||||
{
|
||||
|
||||
@@ -743,7 +743,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
// We have reached the path node.
|
||||
if(NodeLoc == From)
|
||||
{
|
||||
mlog(PATHING__DEBUG, " Arrived at node %i", NextNode);
|
||||
mlog(PATHING__DEBUG, " Arrived at node %i", NextNode);
|
||||
|
||||
NodeReached = true;
|
||||
|
||||
@@ -776,7 +776,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
PathingLOSState = HaveLOS;
|
||||
else
|
||||
PathingLOSState = NoLOS;
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
|
||||
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
|
||||
{
|
||||
@@ -787,7 +787,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
}
|
||||
else
|
||||
{
|
||||
mlog(PATHING__DEBUG, " Continuing on node path.");
|
||||
mlog(PATHING__DEBUG, " Continuing on node path.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -839,7 +839,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
return zone->pathing->GetPathNodeCoordinates(NextNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// we have run all the nodes, all that is left is the direct path from the last node
|
||||
// to the destination
|
||||
mlog(PATHING__DEBUG, " Reached end of node path, running direct to target.");
|
||||
@@ -869,7 +869,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
PathingLOSState = HaveLOS;
|
||||
else
|
||||
PathingLOSState = NoLOS;
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
|
||||
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
|
||||
{
|
||||
@@ -880,7 +880,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
}
|
||||
else
|
||||
{
|
||||
mlog(PATHING__DEBUG, " Continuing on node path.");
|
||||
mlog(PATHING__DEBUG, " Continuing on node path.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -895,7 +895,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
mlog(PATHING__DEBUG, " Target has changed position.");
|
||||
// Update our record of where we are going to.
|
||||
PathingDestination = To;
|
||||
// Check if we now have LOS etc to the new destination.
|
||||
// Check if we now have LOS etc to the new destination.
|
||||
if(PathingLOSCheckTimer->Check())
|
||||
{
|
||||
float Distance = VertexDistanceNoRoot(From, To);
|
||||
@@ -908,9 +908,9 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
PathingLOSState = HaveLOS;
|
||||
else
|
||||
PathingLOSState = NoLOS;
|
||||
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
|
||||
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
|
||||
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
|
||||
{
|
||||
mlog(PATHING__DEBUG, " No hazards. Running directly to target.");
|
||||
@@ -919,7 +919,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
}
|
||||
else
|
||||
{
|
||||
mlog(PATHING__DEBUG, " Continuing on node path.");
|
||||
mlog(PATHING__DEBUG, " Continuing on node path.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -966,13 +966,13 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
// May need to refine this as rounding errors may mean we never have equality
|
||||
// Check if we have reached a path node.
|
||||
if(NodeLoc == From)
|
||||
{
|
||||
{
|
||||
mlog(PATHING__DEBUG, " Arrived at node %i, moving to next one.\n", Route.front());
|
||||
|
||||
NodeReached = true;
|
||||
|
||||
PathingLastNodeVisited = Route.front();
|
||||
|
||||
|
||||
Route.pop_front();
|
||||
|
||||
++PathingTraversedNodes;
|
||||
@@ -993,7 +993,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
mlog(PATHING__DEBUG, "Missing node after teleport.");
|
||||
return To;
|
||||
}
|
||||
|
||||
|
||||
NextNode = Route.front();
|
||||
|
||||
NodeLoc = zone->pathing->GetPathNodeCoordinates(NextNode);
|
||||
@@ -1024,7 +1024,7 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
}
|
||||
return NodeLoc;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
mlog(PATHING__DEBUG, " Target moved. End node is different. Clearing route.");
|
||||
|
||||
@@ -1054,16 +1054,16 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Waypo
|
||||
|
||||
if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong))
|
||||
&& (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold)))
|
||||
{
|
||||
{
|
||||
mlog(PATHING__DEBUG, " Checking for long LOS at distance %8.3f.", Distance);
|
||||
|
||||
|
||||
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr, nullptr))
|
||||
PathingLOSState = HaveLOS;
|
||||
else
|
||||
PathingLOSState = NoLOS;
|
||||
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
|
||||
mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS");
|
||||
|
||||
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
|
||||
{
|
||||
mlog(PATHING__DEBUG, "Target is reachable. Running directly there.");
|
||||
@@ -1130,7 +1130,7 @@ int PathManager::FindNearestPathNode(VERTEX Position)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SortedByDistance.sort(SortPathNodesByDistance);
|
||||
|
||||
for(list<PathNodeSortStruct>::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
|
||||
@@ -1188,7 +1188,7 @@ bool PathManager::NoHazardsAccurate(VERTEX From, VERTEX To)
|
||||
cury = From.y;
|
||||
curz = From.z;
|
||||
|
||||
do
|
||||
do
|
||||
{
|
||||
stepx = (float)To.x - curx;
|
||||
stepy = (float)To.y - cury;
|
||||
@@ -1197,7 +1197,7 @@ bool PathManager::NoHazardsAccurate(VERTEX From, VERTEX To)
|
||||
stepx = (stepx/factor)*step_size;
|
||||
stepy = (stepy/factor)*step_size;
|
||||
stepz = (stepz/factor)*step_size;
|
||||
|
||||
|
||||
VERTEX TestPoint(curx, cury, curz);
|
||||
float NewZ = zone->zonemap->FindBestZ(MAP_ROOT_NODE, TestPoint, nullptr, nullptr);
|
||||
if(ABS(NewZ - last_z) > 5.0)
|
||||
@@ -1211,7 +1211,7 @@ bool PathManager::NoHazardsAccurate(VERTEX From, VERTEX To)
|
||||
if(zone->watermap)
|
||||
{
|
||||
NodeRef n = zone->zonemap->SeekNode( zone->zonemap->GetRoot(), TestPoint.x, TestPoint.y);
|
||||
if(n != NODE_NONE)
|
||||
if(n != NODE_NONE)
|
||||
{
|
||||
if(zone->watermap->InLiquid(From.x, From.y, From.z) || zone->watermap->InLiquid(To.x, To.y, To.z))
|
||||
{
|
||||
@@ -1225,7 +1225,7 @@ bool PathManager::NoHazardsAccurate(VERTEX From, VERTEX To)
|
||||
VERTEX hit;
|
||||
TestPointWaterDest.z -= 500;
|
||||
float best_z2 = -999990;
|
||||
if(zone->zonemap->LineIntersectsNode(n, TestPointWater, TestPointWaterDest, &hit, nullptr))
|
||||
if(zone->zonemap->LineIntersectsNode(n, TestPointWater, TestPointWaterDest, &hit, nullptr))
|
||||
{
|
||||
best_z2 = hit.z;
|
||||
}
|
||||
@@ -1270,7 +1270,7 @@ bool PathManager::NoHazardsAccurate(VERTEX From, VERTEX To)
|
||||
if(ABS(cury - To.y) < step_size) cur.y = To.y;
|
||||
if(ABS(curz - To.z) < step_size) cur.z = To.z;
|
||||
|
||||
}
|
||||
}
|
||||
while(cur.x != To.x || cur.y != To.y || cur.z != To.z);
|
||||
return true;
|
||||
}
|
||||
@@ -1279,7 +1279,7 @@ void Mob::PrintRoute()
|
||||
{
|
||||
|
||||
printf("Route is : ");
|
||||
|
||||
|
||||
list<int>::iterator Iterator;
|
||||
|
||||
for(Iterator = Route.begin(); Iterator !=Route.end(); ++Iterator)
|
||||
@@ -1331,11 +1331,11 @@ void Client::SendPathPacket(vector<FindPerson_Point> &points) {
|
||||
QueuePacket(&outapp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int len = sizeof(FindPersonResult_Struct) + (points.size()+1) * sizeof(FindPerson_Point);
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_FindPersonReply, len);
|
||||
FindPersonResult_Struct* fpr=(FindPersonResult_Struct*)outapp->pBuffer;
|
||||
|
||||
|
||||
vector<FindPerson_Point>::iterator cur, end;
|
||||
cur = points.begin();
|
||||
end = points.end();
|
||||
@@ -1350,8 +1350,8 @@ void Client::SendPathPacket(vector<FindPerson_Point> &points) {
|
||||
fpr->dest = *cur;
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
PathNode* PathManager::FindPathNodeByCoordinates(float x, float y, float z)
|
||||
@@ -1393,7 +1393,7 @@ void PathManager::ShowPathNodeNeighbours(Client *c)
|
||||
else if(PathNodes[i].id < 100)
|
||||
sprintf(Name, "%s_%s000", DigitToWord(PathNodes[i].id / 10), DigitToWord(PathNodes[i].id % 10));
|
||||
else
|
||||
sprintf(Name, "%s_%s_%s000", DigitToWord(PathNodes[i].id/100), DigitToWord((PathNodes[i].id % 100)/10),
|
||||
sprintf(Name, "%s_%s_%s000", DigitToWord(PathNodes[i].id/100), DigitToWord((PathNodes[i].id % 100)/10),
|
||||
DigitToWord(((PathNodes[i].id % 100) %10)));
|
||||
|
||||
Mob *m = entity_list.GetMob(Name);
|
||||
@@ -1408,7 +1408,7 @@ void PathManager::ShowPathNodeNeighbours(Client *c)
|
||||
{
|
||||
if(Node->Neighbours[i].id == -1)
|
||||
break;
|
||||
Neighbours << Node->Neighbours[i].id << ", ";
|
||||
Neighbours << Node->Neighbours[i].id << ", ";
|
||||
|
||||
char Name[64];
|
||||
|
||||
@@ -1417,7 +1417,7 @@ void PathManager::ShowPathNodeNeighbours(Client *c)
|
||||
else if(Node->Neighbours[i].id < 100)
|
||||
sprintf(Name, "%s_%s000", DigitToWord(Node->Neighbours[i].id / 10), DigitToWord(Node->Neighbours[i].id % 10));
|
||||
else
|
||||
sprintf(Name, "%s_%s_%s000", DigitToWord(Node->Neighbours[i].id/100), DigitToWord((Node->Neighbours[i].id % 100)/10),
|
||||
sprintf(Name, "%s_%s_%s000", DigitToWord(Node->Neighbours[i].id/100), DigitToWord((Node->Neighbours[i].id % 100)/10),
|
||||
DigitToWord(((Node->Neighbours[i].id % 100) %10)));
|
||||
|
||||
Mob *m = entity_list.GetMob(Name);
|
||||
@@ -1447,7 +1447,7 @@ void PathManager::NodeInfo(Client *c)
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(0, "Pathing node: %i at (%.2f, %.2f, %.2f) with bestz %.2f",
|
||||
c->Message(0, "Pathing node: %i at (%.2f, %.2f, %.2f) with bestz %.2f",
|
||||
Node->id, Node->v.x, Node->v.y, Node->v.z, Node->bestz);
|
||||
|
||||
bool neighbour = false;
|
||||
@@ -1460,7 +1460,7 @@ void PathManager::NodeInfo(Client *c)
|
||||
c->Message(0, "Neighbours found:");
|
||||
neighbour = true;
|
||||
}
|
||||
c->Message(0, "id: %i, distance: %.2f, door id: %i, is teleport: %i",
|
||||
c->Message(0, "id: %i, distance: %.2f, door id: %i, is teleport: %i",
|
||||
Node->Neighbours[x].id, Node->Neighbours[x].distance,
|
||||
Node->Neighbours[x].DoorID, Node->Neighbours[x].Teleport);
|
||||
}
|
||||
@@ -1498,9 +1498,9 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(new_id == -1)
|
||||
{
|
||||
{
|
||||
for(uint32 i = 0; i < Head.PathNodeCount; ++i)
|
||||
{
|
||||
if(PathNodes[i].id > new_id)
|
||||
@@ -1508,7 +1508,7 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques
|
||||
}
|
||||
new_id++;
|
||||
}
|
||||
|
||||
|
||||
PathNode new_node;
|
||||
new_node.v.x = x;
|
||||
new_node.v.y = y;
|
||||
@@ -1568,7 +1568,7 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques
|
||||
else if(new_id < 100)
|
||||
sprintf(npc_type->name, "%s_%s", DigitToWord(new_id/10), DigitToWord(new_id % 10));
|
||||
else
|
||||
sprintf(npc_type->name, "%s_%s_%s", DigitToWord(new_id/100), DigitToWord((new_id % 100)/10),
|
||||
sprintf(npc_type->name, "%s_%s_%s", DigitToWord(new_id/100), DigitToWord((new_id % 100)/10),
|
||||
DigitToWord(((new_id % 100) %10)));
|
||||
|
||||
sprintf(npc_type->lastname, "%i", new_id);
|
||||
@@ -1628,7 +1628,7 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques
|
||||
else if(new_id < 100)
|
||||
sprintf(npc_type->name, "%s_%s", DigitToWord(new_id/10), DigitToWord(new_id % 10));
|
||||
else
|
||||
sprintf(npc_type->name, "%s_%s_%s", DigitToWord(new_id/100), DigitToWord((new_id % 100)/10),
|
||||
sprintf(npc_type->name, "%s_%s_%s", DigitToWord(new_id/100), DigitToWord((new_id % 100)/10),
|
||||
DigitToWord(((new_id % 100) %10)));
|
||||
|
||||
sprintf(npc_type->lastname, "%i", new_id);
|
||||
@@ -2094,7 +2094,7 @@ bool PathManager::CheckLosFN(VERTEX a, VERTEX b)
|
||||
{
|
||||
VERTEX hit;
|
||||
|
||||
VERTEX myloc;
|
||||
VERTEX myloc;
|
||||
VERTEX oloc;
|
||||
|
||||
myloc.x = a.x;
|
||||
|
||||
+1
-1
@@ -107,6 +107,6 @@ private:
|
||||
int *ClosedListFlag;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "PlayerCorpse.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -797,7 +797,7 @@ XS(boot_Corpse)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
+14
-14
@@ -2887,7 +2887,7 @@ XS(XS_Client_NukeItem)
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
|
||||
if(items < 3){
|
||||
where_to_check = 0xFF;
|
||||
}
|
||||
@@ -4883,7 +4883,7 @@ XS(XS_Client_AddLevelBasedExp)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_IncrementAA);
|
||||
XS(XS_Client_IncrementAA);
|
||||
XS(XS_Client_IncrementAA)
|
||||
{
|
||||
dXSARGS;
|
||||
@@ -4901,17 +4901,17 @@ XS(XS_Client_IncrementAA)
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
|
||||
SendAA_Struct* aa2 = zone->FindAA(aaskillid);
|
||||
|
||||
|
||||
if(aa2 == nullptr)
|
||||
Perl_croak(aTHX_ "Invalid AA.");
|
||||
|
||||
if(THIS->GetAA(aaskillid) == aa2->max_level)
|
||||
Perl_croak(aTHX_ "AA at Max already.");
|
||||
|
||||
Perl_croak(aTHX_ "Invalid AA.");
|
||||
|
||||
if(THIS->GetAA(aaskillid) == aa2->max_level)
|
||||
Perl_croak(aTHX_ "AA at Max already.");
|
||||
|
||||
THIS->SetAA(aaskillid, THIS->GetAA(aaskillid)+1);
|
||||
|
||||
|
||||
THIS->Save();
|
||||
|
||||
THIS->SendAA(aaskillid);
|
||||
@@ -4942,7 +4942,7 @@ XS(XS_Client_GetAALevel)
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
|
||||
RETVAL = THIS->GetAA(aaskillid);
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
}
|
||||
@@ -5559,7 +5559,7 @@ XS(XS_Client_SignalClient)
|
||||
{
|
||||
Client * THIS;
|
||||
uint32 data = (uint32)SvUV(ST(1));
|
||||
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
@@ -5584,7 +5584,7 @@ XS(XS_Client_AddAlternateCurrencyValue)
|
||||
Client * THIS;
|
||||
uint32 currency_id = (uint32)SvUV(ST(1));
|
||||
int32 amount = (int32)SvUV(ST(2));
|
||||
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
@@ -5790,7 +5790,7 @@ XS(boot_Client)
|
||||
newXSproto(strcpy(buf, "GetWeight"), XS_Client_GetWeight, file, "$");
|
||||
newXSproto(strcpy(buf, "GetEXP"), XS_Client_GetEXP, file, "$");
|
||||
newXSproto(strcpy(buf, "GetAAExp"), XS_Client_GetAAExp, file, "$");
|
||||
newXSproto(strcpy(buf, "GetTotalSecondsPlayed"), XS_Client_GetTotalSecondsPlayed, file, "$");
|
||||
newXSproto(strcpy(buf, "GetTotalSecondsPlayed"), XS_Client_GetTotalSecondsPlayed, file, "$");
|
||||
newXSproto(strcpy(buf, "UpdateLDoNPoints"), XS_Client_UpdateLDoNPoints, file, "$$$");
|
||||
newXSproto(strcpy(buf, "SetDeity"), XS_Client_SetDeity, file, "$$");
|
||||
newXSproto(strcpy(buf, "AddEXP"), XS_Client_AddEXP, file, "$$;$$");
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@
|
||||
#include "doors.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */
|
||||
@@ -730,7 +730,7 @@ XS(boot_Doors)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
@@ -751,7 +751,7 @@ XS(boot_Doors)
|
||||
newXSproto(strcpy(buf, "SetY"),XS_Doors_SetY, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetZ"),XS_Doors_SetZ, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetHeading"),XS_Doors_SetHeading, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetLocation"),XS_Doors_SetLocation, file, "$$$$");
|
||||
newXSproto(strcpy(buf, "SetLocation"),XS_Doors_SetLocation, file, "$$$$");
|
||||
newXSproto(strcpy(buf, "GetDoorDBID"),XS_Doors_GetDoorDBID, file, "$");
|
||||
newXSproto(strcpy(buf, "GetDoorID"),XS_Doors_GetDoorID, file, "$");
|
||||
newXSproto(strcpy(buf, "SetSize"),XS_Doors_SetSize, file, "$$");
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "entity.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2112,7 +2112,7 @@ XS(boot_EntityList)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "groups.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -580,7 +580,7 @@ XS(XS_Group_GetID)
|
||||
}
|
||||
|
||||
XS(XS_Group_GetMember);
|
||||
XS(XS_Group_GetMember)
|
||||
XS(XS_Group_GetMember)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
@@ -601,7 +601,7 @@ XS(XS_Group_GetMember)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
int index = (int)SvUV(ST(1));
|
||||
if (index < 0 || index > 5)
|
||||
if (index < 0 || index > 5)
|
||||
RETVAL = nullptr;
|
||||
else {
|
||||
member = THIS->members[index];
|
||||
@@ -625,7 +625,7 @@ XS(boot_Group)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
@@ -116,7 +116,7 @@ extern "C"
|
||||
#endif
|
||||
|
||||
XS(boot_HateEntry);
|
||||
XS(boot_HateEntry)
|
||||
XS(boot_HateEntry)
|
||||
{
|
||||
dXSARGS;
|
||||
char file[256];
|
||||
|
||||
+7
-7
@@ -41,7 +41,7 @@ typedef const char Const_char;
|
||||
#include "../common/spdat.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6571,7 +6571,7 @@ XS(XS_Mob_SignalClient)
|
||||
Mob * THIS;
|
||||
Client* client = nullptr;
|
||||
uint32 data = (uint32)SvUV(ST(2));
|
||||
|
||||
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Mob *,tmp);
|
||||
@@ -6926,7 +6926,7 @@ XS(XS_Mob_QuestReward)
|
||||
Client* client = nullptr;
|
||||
int32 silver = 0;
|
||||
int32 gold = 0;
|
||||
int32 platinum = 0;
|
||||
int32 platinum = 0;
|
||||
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
@@ -7162,7 +7162,7 @@ XS(XS_Mob_SpellEffect)
|
||||
uint32 unk20 = 3000;
|
||||
bool perm_effect = false;
|
||||
Client* client = nullptr;
|
||||
|
||||
|
||||
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
@@ -7188,7 +7188,7 @@ XS(XS_Mob_SpellEffect)
|
||||
if(client == nullptr)
|
||||
Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
THIS->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20, perm_effect, client);
|
||||
}
|
||||
@@ -8079,7 +8079,7 @@ XS(boot_Mob)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
@@ -8368,7 +8368,7 @@ XS(boot_Mob)
|
||||
newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetFlurryChance"), XS_Mob_SetFlurryChance, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetFlurryChance"), XS_Mob_GetFlurryChance, file, "$");
|
||||
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ typedef const char Const_char;
|
||||
#include "npc.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2147,7 +2147,7 @@ XS(boot_NPC)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "object.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
XS(XS_Object_IsGroundSpawn); /* prototype to pass -Wmissing-prototypes */
|
||||
@@ -920,7 +920,7 @@ XS(boot_Object)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "perlpacket.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
XS(XS_PerlPacket_new); /* prototype to pass -Wmissing-prototypes */
|
||||
@@ -561,7 +561,7 @@ XS(boot_PerlPacket)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
@@ -58,7 +58,7 @@ XS(XS_QuestItem_GetName) {
|
||||
}
|
||||
|
||||
XS(XS_QuestItem_SetScale);
|
||||
XS(XS_QuestItem_SetScale)
|
||||
XS(XS_QuestItem_SetScale)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
@@ -66,7 +66,7 @@ XS(XS_QuestItem_SetScale)
|
||||
{
|
||||
ItemInst * THIS;
|
||||
float Mult;
|
||||
|
||||
|
||||
if (sv_derived_from(ST(0), "QuestItem")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(ItemInst *,tmp);
|
||||
@@ -86,7 +86,7 @@ XS(XS_QuestItem_SetScale)
|
||||
}
|
||||
|
||||
XS(XS_QuestItem_ItemSay);
|
||||
XS(XS_QuestItem_ItemSay)
|
||||
XS(XS_QuestItem_ItemSay)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2 && items != 3)
|
||||
@@ -251,7 +251,7 @@ extern "C"
|
||||
#endif
|
||||
|
||||
XS(boot_QuestItem);
|
||||
XS(boot_QuestItem)
|
||||
XS(boot_QuestItem)
|
||||
{
|
||||
dXSARGS;
|
||||
char file[256];
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@
|
||||
* 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!
|
||||
* ANY CHANGES MADE HERE WILL BE LOST!
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "client.h"
|
||||
|
||||
#ifdef THIS /* this macro seems to leak out on some systems */
|
||||
#undef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ XS(XS_Raid_GetID)
|
||||
}
|
||||
|
||||
XS(XS_Raid_GetMember);
|
||||
XS(XS_Raid_GetMember)
|
||||
XS(XS_Raid_GetMember)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
@@ -563,7 +563,7 @@ XS(XS_Raid_GetMember)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
int index = (int)SvUV(ST(1));
|
||||
if (index < 0 || index > 71)
|
||||
if (index < 0 || index > 71)
|
||||
RETVAL = nullptr;
|
||||
else {
|
||||
if(THIS->members[index].member != nullptr)
|
||||
@@ -586,7 +586,7 @@ XS(boot_Raid)
|
||||
char file[256];
|
||||
strncpy(file, __FILE__, 256);
|
||||
file[255] = 0;
|
||||
|
||||
|
||||
if(items != 1)
|
||||
fprintf(stderr, "boot_quest does not take any arguments.");
|
||||
char buf[128];
|
||||
|
||||
+5
-5
@@ -61,21 +61,21 @@ void PerlPacket::Resize(uint32 length) {
|
||||
void PerlPacket::SendTo(Client *who) {
|
||||
if(!who || op == OP_Unknown || (len > 0 && packet == nullptr))
|
||||
return;
|
||||
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(op, len);
|
||||
if(len > 0)
|
||||
memcpy(outapp->pBuffer, packet, len);
|
||||
|
||||
|
||||
// printf("Created this packet with PerlPacket: OP: %s\n", ZoneOpcodeManager->EmuToName(op));
|
||||
DumpPacket(outapp);
|
||||
|
||||
|
||||
who->FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
void PerlPacket::SendToAll() {
|
||||
if(op == OP_Unknown || (len > 0 && packet == nullptr))
|
||||
return;
|
||||
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(op, len);
|
||||
if(len > 0)
|
||||
memcpy(outapp->pBuffer, packet, len);
|
||||
@@ -161,7 +161,7 @@ void PerlPacket::SetEQ1913(uint32 pos, float part19, float part13) {
|
||||
p->part19 = FloatToEQ19(part19);
|
||||
p->part13 = FloatToEQ13(part13);
|
||||
}
|
||||
|
||||
|
||||
//reading
|
||||
uint8 PerlPacket::GetByte(uint32 pos) {
|
||||
if(pos + sizeof(uint8) > len || packet == nullptr)
|
||||
|
||||
+6
-6
@@ -30,14 +30,14 @@ class PerlPacket {
|
||||
public:
|
||||
PerlPacket(const char *opcode = "OP_Unknown", uint32 len = 0);
|
||||
~PerlPacket();
|
||||
|
||||
|
||||
bool SetOpcode(const char *opcode);
|
||||
void Resize(uint32 len);
|
||||
|
||||
|
||||
//sending functions
|
||||
void SendTo(Client *who);
|
||||
void SendToAll();
|
||||
|
||||
|
||||
//editing
|
||||
void Zero();
|
||||
void FromArray(int numbers[], uint32 length);
|
||||
@@ -46,16 +46,16 @@ public:
|
||||
void SetLong(uint32 pos, uint32 val);
|
||||
void SetFloat(uint32 pos, float val);
|
||||
void SetString(uint32 pos, char *str);
|
||||
|
||||
|
||||
void SetEQ1319(uint32 pos, float part13, float part19);
|
||||
void SetEQ1913(uint32 pos, float part19, float part13);
|
||||
|
||||
|
||||
//reading
|
||||
uint8 GetByte(uint32 pos);
|
||||
uint16 GetShort(uint32 pos);
|
||||
uint32 GetLong(uint32 pos);
|
||||
float GetFloat(uint32 pos);
|
||||
|
||||
|
||||
protected:
|
||||
EmuOpcode op;
|
||||
uint32 len;
|
||||
|
||||
+11
-11
@@ -1302,7 +1302,7 @@ XS(XS__createguild)
|
||||
Perl_croak(aTHX_ "Usage: createguild(guild_name, leader)");
|
||||
|
||||
char * guild_name = (char *)SvPV_nolen(ST(0));
|
||||
char * leader = (char *)SvPV_nolen(ST(1));
|
||||
char * leader = (char *)SvPV_nolen(ST(1));
|
||||
|
||||
quest_manager.CreateGuild(guild_name, leader);
|
||||
|
||||
@@ -3357,7 +3357,7 @@ XS(XS__GetZoneID)
|
||||
|
||||
char *zone = (char *)SvPV_nolen(ST(0));
|
||||
int32 id = quest_manager.GetZoneID(zone);
|
||||
|
||||
|
||||
XSRETURN_IV(id);
|
||||
}
|
||||
|
||||
@@ -3370,7 +3370,7 @@ XS(XS__GetZoneLongName)
|
||||
dXSTARG;
|
||||
char *zone = (char *)SvPV_nolen(ST(0));
|
||||
Const_char* RETVAL = quest_manager.GetZoneLongName(zone);
|
||||
|
||||
|
||||
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
|
||||
XSRETURN(1);
|
||||
}
|
||||
@@ -3392,14 +3392,14 @@ XS(XS__GetTimeSeconds)
|
||||
XS(XS__handleturnin); // prototype to pass -Wmissing-prototypes
|
||||
XS(XS__handleturnin) {
|
||||
dXSARGS;
|
||||
|
||||
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: handleturnin(itemid, itemcharges)");
|
||||
int itemid = (int)SvIV(ST(0));
|
||||
int charges = (int)SvIV(ST(1));
|
||||
|
||||
bool returnVal = quest_manager.TurnInItem(itemid,charges);
|
||||
|
||||
|
||||
ST(0) = boolSV(returnVal);
|
||||
sv_2mortal(ST(0));
|
||||
XSRETURN(1);
|
||||
@@ -3408,36 +3408,36 @@ XS(XS__handleturnin) {
|
||||
XS(XS__completehandin); // prototype to pass -Wmissing-prototypes
|
||||
XS(XS__completehandin) {
|
||||
dXSARGS;
|
||||
|
||||
|
||||
if (items != 0)
|
||||
Perl_croak(aTHX_ "Usage: completehandin()");
|
||||
|
||||
quest_manager.CompleteHandIn();
|
||||
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__resethandin); // prototype to pass -Wmissing-prototypes
|
||||
XS(XS__resethandin) {
|
||||
dXSARGS;
|
||||
|
||||
|
||||
if (items != 0)
|
||||
Perl_croak(aTHX_ "Usage: resethandin()");
|
||||
|
||||
quest_manager.ResetHandIn();
|
||||
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__clearhandin); // prototype to pass -Wmissing-prototypes
|
||||
XS(XS__clearhandin) {
|
||||
dXSARGS;
|
||||
|
||||
|
||||
if (items != 0)
|
||||
Perl_croak(aTHX_ "Usage: clearhandin()");
|
||||
|
||||
quest_manager.ClearHandIn();
|
||||
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
|
||||
+36
-36
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -77,7 +77,7 @@ void Petition::SendPetitionToPlayer(Client* clientto) {
|
||||
return;
|
||||
}
|
||||
|
||||
Petition::Petition(uint32 id)
|
||||
Petition::Petition(uint32 id)
|
||||
{
|
||||
petid = id;
|
||||
charclass = 0;
|
||||
@@ -93,56 +93,56 @@ Petition::Petition(uint32 id)
|
||||
memset(lastgm, 0, sizeof(lastgm));
|
||||
memset(petitiontext, 0, sizeof(petitiontext));
|
||||
memset(gmtext, 0, sizeof(gmtext));
|
||||
|
||||
|
||||
//memset(this->zone, 0, sizeof(this->zone));
|
||||
zone = 1;
|
||||
}
|
||||
Petition* PetitionList::GetPetitionByID(uint32 id_in) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (iterator.GetData()->GetID() == id_in)
|
||||
Petition* PetitionList::GetPetitionByID(uint32 id_in) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (iterator.GetData()->GetID() == id_in)
|
||||
return iterator.GetData();
|
||||
iterator.Advance();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint32 PetitionList::GetTotalPetitions(){
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
iterator.Reset();
|
||||
uint32 total=0;
|
||||
while(iterator.MoreElements()) {
|
||||
while(iterator.MoreElements()) {
|
||||
total++;
|
||||
iterator.Advance();
|
||||
iterator.Advance();
|
||||
}
|
||||
return total;
|
||||
return total;
|
||||
}
|
||||
bool PetitionList::FindPetitionByAccountName(const char* acctname) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (!strcmp(acctname,iterator.GetData()->GetAccountName()))
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (!strcmp(acctname,iterator.GetData()->GetAccountName()))
|
||||
return true;
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool PetitionList::DeletePetitionByCharName(const char* charname) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
LinkedListIterator<Petition*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
if (!strcmp(charname,iterator.GetData()->GetCharName())) {
|
||||
if(DeletePetition(iterator.GetData()->GetID())==0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
iterator.Advance();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void PetitionList::UpdateZoneListQueue() {
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_Petition, sizeof(ServerPetitionUpdate_Struct));
|
||||
@@ -228,7 +228,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in DeletePetitionFromDB query '%s': %s", query, errbuf);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
checkedout = 1;
|
||||
else
|
||||
checkedout = 0;
|
||||
|
||||
|
||||
uint32 len = strlen(wpet->GetPetitionText());
|
||||
char* petitiontext = new char[2*len+1];
|
||||
memset(petitiontext, 0, 2*len+1);
|
||||
@@ -266,7 +266,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO petitions (petid, charname, accountname, lastgm, petitiontext, zone, urgency, charclass, charrace, charlevel, checkouts, unavailables, ischeckedout, senttime, gmtext) values (%i,'%s','%s','%s','%s',%i,%i,%i,%i,%i,%i,%i,%i,%i, '%s')", wpet->GetID(), wpet->GetCharName(), wpet->GetAccountName(), wpet->GetLastGM(), petitiontext, wpet->GetZone(), wpet->GetUrgency(), wpet->GetCharClass(), wpet->GetCharRace(), wpet->GetCharLevel(), wpet->GetCheckouts(), wpet->GetUnavails(), checkedout, wpet->GetSentTime(), wpet->GetGMText()), errbuf, 0, &affected_rows)) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in InsertPetitionToDB query '%s': %s", query, errbuf);
|
||||
}
|
||||
|
||||
|
||||
safe_delete_array(petitiontext);
|
||||
safe_delete_array(query);
|
||||
#if EQDEBUG >= 5
|
||||
@@ -312,6 +312,6 @@ void ZoneDatabase::RefreshPetitionsFromDB()
|
||||
safe_delete_array(query);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public:
|
||||
void SetUnavails(uint32 unavails_in) { unavailables = unavails_in; }
|
||||
void SetSentTime() { time(&senttime); }
|
||||
void SetSentTime2(time_t senttime_in) { senttime = senttime_in; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
uint32 petid;
|
||||
|
||||
+42
-42
@@ -221,7 +221,7 @@ void Mob::MakePet(uint16 spell_id, const char* pettype, const char *petname) {
|
||||
MakePoweredPet(spell_id, pettype, -1, petname);
|
||||
}
|
||||
|
||||
// Split from the basic MakePet to allow backward compatiblity with existing code while also
|
||||
// Split from the basic MakePet to allow backward compatiblity with existing code while also
|
||||
// making it possible for petpower to be retained without the focus item having to
|
||||
// stay equipped when the character zones. petpower of -1 means that the currently equipped petfocus
|
||||
// of a client is searched for and used instead.
|
||||
@@ -288,9 +288,9 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
npc_type->max_hp += (npc_type->max_hp*MaxHP)/100;
|
||||
npc_type->cur_hp = npc_type->max_hp;
|
||||
}
|
||||
|
||||
|
||||
//TODO: think about regen (engaged vs. not engaged)
|
||||
|
||||
|
||||
// Pet naming:
|
||||
// 0 - `s pet
|
||||
// 1 - `s familiar
|
||||
@@ -323,38 +323,38 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
npc_type->name[25] = '\0';
|
||||
strcat(npc_type->name, "`s_pet");
|
||||
}
|
||||
|
||||
|
||||
//handle beastlord pet appearance
|
||||
if(record.petnaming == 2)
|
||||
if(record.petnaming == 2)
|
||||
{
|
||||
switch(GetBaseRace())
|
||||
switch(GetBaseRace())
|
||||
{
|
||||
case VAHSHIR:
|
||||
npc_type->race = TIGER;
|
||||
npc_type->size *= 0.8f;
|
||||
case VAHSHIR:
|
||||
npc_type->race = TIGER;
|
||||
npc_type->size *= 0.8f;
|
||||
break;
|
||||
case TROLL:
|
||||
npc_type->race = ALLIGATOR;
|
||||
npc_type->size *= 2.5f;
|
||||
case TROLL:
|
||||
npc_type->race = ALLIGATOR;
|
||||
npc_type->size *= 2.5f;
|
||||
break;
|
||||
case OGRE:
|
||||
npc_type->race = BEAR;
|
||||
npc_type->texture = 3;
|
||||
npc_type->gender = 2;
|
||||
case OGRE:
|
||||
npc_type->race = BEAR;
|
||||
npc_type->texture = 3;
|
||||
npc_type->gender = 2;
|
||||
break;
|
||||
case BARBARIAN:
|
||||
npc_type->race = WOLF;
|
||||
case BARBARIAN:
|
||||
npc_type->race = WOLF;
|
||||
npc_type->texture = 2;
|
||||
break;
|
||||
case IKSAR:
|
||||
npc_type->race = WOLF;
|
||||
npc_type->texture = 0;
|
||||
npc_type->gender = 1;
|
||||
case IKSAR:
|
||||
npc_type->race = WOLF;
|
||||
npc_type->texture = 0;
|
||||
npc_type->gender = 1;
|
||||
npc_type->size *= 2.0f;
|
||||
npc_type->luclinface = 0;
|
||||
break;
|
||||
default:
|
||||
npc_type->race = WOLF;
|
||||
default:
|
||||
npc_type->race = WOLF;
|
||||
npc_type->texture = 0;
|
||||
}
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
MYSQL_RES *result = nullptr;
|
||||
MYSQL_ROW row = nullptr;
|
||||
uint32 monsterid;
|
||||
|
||||
|
||||
// get a random npc id from the spawngroups assigned to this zone
|
||||
if (database.RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT npcID FROM (spawnentry INNER JOIN spawn2 ON spawn2.spawngroupID = spawnentry.spawngroupID) "
|
||||
@@ -376,16 +376,16 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
"ORDER BY RAND() LIMIT 1", zone->GetShortName()), errbuf, &result))
|
||||
{
|
||||
row = mysql_fetch_row(result);
|
||||
if (row)
|
||||
if (row)
|
||||
monsterid = atoi(row[0]);
|
||||
else
|
||||
else
|
||||
monsterid = 567; // since we don't have any monsters, just make it look like an earth pet for now
|
||||
}
|
||||
else { // if the database query failed
|
||||
LogFile->write(EQEMuLog::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), errbuf);
|
||||
monsterid = 567;
|
||||
}
|
||||
|
||||
|
||||
// give the summoned pet the attributes of the monster we found
|
||||
const NPCType* monster = database.GetNPCType(monsterid);
|
||||
if(monster) {
|
||||
@@ -426,7 +426,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, c
|
||||
// We need to handle PetType 5 (petHatelist), add the current target to the hatelist of the pet
|
||||
}
|
||||
/* This is why the pets ghost - pets were being spawned too far away from its npc owner and some
|
||||
into walls or objects (+10), this sometimes creates the "ghost" effect. I changed to +2 (as close as I
|
||||
into walls or objects (+10), this sometimes creates the "ghost" effect. I changed to +2 (as close as I
|
||||
could get while it still looked good). I also noticed this can happen if an NPC is spawned on the same spot of another or in a related bad spot.*/
|
||||
Pet::Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power)
|
||||
: NPC(type_data, 0, owner->GetX()+2, owner->GetY()+2, owner->GetZ(), owner->GetHeading(), FlyMode3)
|
||||
@@ -465,7 +465,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
|
||||
safe_delete_array(query);
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
|
||||
|
||||
into->npc_type = atoi(row[0]);
|
||||
into->temporary = atoi(row[1]);
|
||||
into->petpower = atoi(row[2]);
|
||||
@@ -473,7 +473,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
|
||||
into->petnaming = atoi(row[4]);
|
||||
into->monsterflag = atoi(row[5]);
|
||||
into->equipmentset = atoi(row[6]);
|
||||
|
||||
|
||||
mysql_free_result(result);
|
||||
return(true);
|
||||
}
|
||||
@@ -489,18 +489,18 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
|
||||
Mob* Mob::GetPet() {
|
||||
if(GetPetID() == 0)
|
||||
return(nullptr);
|
||||
|
||||
|
||||
Mob* tmp = entity_list.GetMob(GetPetID());
|
||||
if(tmp == nullptr) {
|
||||
SetPetID(0);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
|
||||
if(tmp->GetOwnerID() != GetID()) {
|
||||
SetPetID(0);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
|
||||
return(tmp);
|
||||
}
|
||||
|
||||
@@ -535,10 +535,10 @@ void Mob::SetPetID(uint16 NewPetID) {
|
||||
void NPC::GetPetState(SpellBuff_Struct *pet_buffs, uint32 *items, char *name) {
|
||||
//save the pet name
|
||||
strn0cpy(name, GetName(), 64);
|
||||
|
||||
|
||||
//save their items, we only care about what they are actually wearing
|
||||
memcpy(items, equipment, sizeof(uint32)*MAX_WORN_INVENTORY);
|
||||
|
||||
|
||||
//save their buffs.
|
||||
for (int i=0; i < GetPetMaxTotalSlots(); i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
@@ -561,7 +561,7 @@ void NPC::GetPetState(SpellBuff_Struct *pet_buffs, uint32 *items, char *name) {
|
||||
|
||||
void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) {
|
||||
//restore their buffs...
|
||||
|
||||
|
||||
int i;
|
||||
for (i = 0; i < GetPetMaxTotalSlots(); i++) {
|
||||
for(int z = 0; z < GetPetMaxTotalSlots(); z++) {
|
||||
@@ -571,7 +571,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) {
|
||||
pet_buffs[i].spellid = 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (pet_buffs[i].spellid <= (uint32)SPDAT_RECORDS && pet_buffs[i].spellid != 0 && pet_buffs[i].duration > 0) {
|
||||
if(pet_buffs[i].level == 0 || pet_buffs[i].level > 100)
|
||||
pet_buffs[i].level = 1;
|
||||
@@ -627,7 +627,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) {
|
||||
for(i = 0; i < MAX_WORN_INVENTORY; i++) {
|
||||
if(items[i] == 0)
|
||||
continue;
|
||||
|
||||
|
||||
const Item_Struct* item2 = database.GetItem(items[i]);
|
||||
if (item2 && item2->NoDrop != 0) {
|
||||
//dont bother saving item charges for now, NPCs never use them
|
||||
@@ -670,7 +670,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
// already. If no, add the item id to the equipment array.
|
||||
|
||||
while (curset >= 0 && depth < 5) {
|
||||
if (RunQuery(query,
|
||||
if (RunQuery(query,
|
||||
MakeAnyLenString(&query, "SELECT nested_set FROM pets_equipmentset WHERE set_id='%s'", curset),
|
||||
errbuf, &result))
|
||||
{
|
||||
@@ -679,8 +679,8 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
row = mysql_fetch_row(result);
|
||||
nextset = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
|
||||
if (RunQuery(query,
|
||||
|
||||
if (RunQuery(query,
|
||||
MakeAnyLenString(&query, "SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset),
|
||||
errbuf, &result))
|
||||
{
|
||||
|
||||
+10
-10
@@ -14,26 +14,26 @@
|
||||
#define PET_HOLD 12
|
||||
#define PET_NOTAUNT 14
|
||||
#define PET_LEADER 16
|
||||
#define PET_SLUMBER 17
|
||||
#define PET_NOCAST 18
|
||||
#define PET_FOCUS 19
|
||||
#define PET_FOCUS_ON 25
|
||||
#define PET_FOCUS_OFF 26
|
||||
|
||||
#define PET_SLUMBER 17
|
||||
#define PET_NOCAST 18
|
||||
#define PET_FOCUS 19
|
||||
#define PET_FOCUS_ON 25
|
||||
#define PET_FOCUS_OFF 26
|
||||
|
||||
class Pet : public NPC {
|
||||
public:
|
||||
Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power);
|
||||
|
||||
|
||||
};
|
||||
/*
|
||||
* I dont have the patience to take on this project today....
|
||||
class Pet : public NPC {
|
||||
public:
|
||||
enum eStandingPetOrder { SPO_Follow, SPO_Sit, SPO_Guard };
|
||||
|
||||
|
||||
|
||||
const uint16 pet_spell_id;
|
||||
|
||||
|
||||
inline void SetPetOrder(eStandingPetOrder i) { pStandingPetOrder = i; }
|
||||
inline eStandingPetOrder GetPetOrder() const { return pStandingPetOrder; }
|
||||
// void SetPetType(uint16 in_type) { typeofpet = in_type; } // put this here because only NPCs can be anything but charmed pets
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
void SetPetState(SpellBuff_Struct *buffs, uint32 *items);
|
||||
protected:
|
||||
// uint16 typeofpet; // 0xFF = charmed
|
||||
|
||||
|
||||
eStandingPetOrder pStandingPetOrder;
|
||||
bool taunting;
|
||||
Timer taunt_timer; //for pet taunting
|
||||
|
||||
+13
-13
@@ -667,7 +667,7 @@ void QuestManager::sfollow() {
|
||||
void QuestManager::changedeity(int diety_id) {
|
||||
//Changes the deity.
|
||||
if(initiator)
|
||||
{
|
||||
{
|
||||
if(initiator->IsClient())
|
||||
{
|
||||
initiator->SetDeity(diety_id);
|
||||
@@ -820,7 +820,7 @@ void QuestManager::permagender(int gender_id) {
|
||||
uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
|
||||
uint16 book_slot, count;
|
||||
uint16 curspell;
|
||||
|
||||
|
||||
uint16 Char_ID = initiator->CharacterID();
|
||||
bool SpellGlobalRule = RuleB(Spells, EnableSpellGlobals);
|
||||
bool SpellGlobalCheckResult = 0;
|
||||
@@ -861,11 +861,11 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
|
||||
uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) {
|
||||
uint16 count;
|
||||
uint16 curspell;
|
||||
|
||||
|
||||
uint16 Char_ID = initiator->CharacterID();
|
||||
bool SpellGlobalRule = RuleB(Spells, EnableSpellGlobals);
|
||||
bool SpellGlobalCheckResult = 0;
|
||||
|
||||
|
||||
for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++)
|
||||
{
|
||||
if
|
||||
@@ -937,7 +937,7 @@ void QuestManager::givecash(int copper, int silver, int gold, int platinum) {
|
||||
tmp = "You receive ";
|
||||
else
|
||||
tmp += ",";
|
||||
|
||||
|
||||
tmp += itoa(gold);
|
||||
tmp += " gold";
|
||||
}
|
||||
@@ -957,7 +957,7 @@ void QuestManager::givecash(int copper, int silver, int gold, int platinum) {
|
||||
tmp = "You receive ";
|
||||
else
|
||||
tmp += ",";
|
||||
|
||||
|
||||
tmp += itoa(copper);
|
||||
tmp += " copper";
|
||||
}
|
||||
@@ -1122,7 +1122,7 @@ void QuestManager::setguild(uint32 new_guild_id, uint8 new_rank) {
|
||||
}
|
||||
|
||||
void QuestManager::CreateGuild(const char *guild_name, const char *leader) {
|
||||
uint32 cid = database.GetCharacterID(leader);
|
||||
uint32 cid = database.GetCharacterID(leader);
|
||||
char hString[250];
|
||||
if (cid == 0) {
|
||||
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Guild Creation: Guild leader not found.");
|
||||
@@ -1134,7 +1134,7 @@ void QuestManager::CreateGuild(const char *guild_name, const char *leader) {
|
||||
sprintf(hString, "Guild Creation: Error: %s already is the leader of DB# %i '%s'.", leader, tmp, guild_mgr.GetGuildName(tmp));
|
||||
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", hString);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
uint32 gid = guild_mgr.CreateGuild(guild_name, cid);
|
||||
if (gid == GUILD_NONE)
|
||||
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Guild Creation: Guild creation failed");
|
||||
@@ -1142,9 +1142,9 @@ void QuestManager::CreateGuild(const char *guild_name, const char *leader) {
|
||||
sprintf(hString, "Guild Creation: Guild created: Leader: %i, number %i: %s", cid, gid, leader);
|
||||
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", hString);
|
||||
if(!guild_mgr.SetGuild(cid, gid, GUILD_LEADER))
|
||||
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Unable to set guild leader's guild in the database. Your going to have to run #guild set");
|
||||
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Unable to set guild leader's guild in the database. Your going to have to run #guild set");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1671,11 +1671,11 @@ uint32 QuestManager::getplayerburriedcorpsecount(uint32 char_id) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
bool QuestManager::buryplayercorpse(uint32 char_id)
|
||||
bool QuestManager::buryplayercorpse(uint32 char_id)
|
||||
{
|
||||
bool Result = false;
|
||||
|
||||
if(char_id > 0)
|
||||
if(char_id > 0)
|
||||
{
|
||||
uint32 PlayerCorpse = database.GetFirstCorpseID(char_id);
|
||||
if(PlayerCorpse > 0)
|
||||
@@ -2016,7 +2016,7 @@ int QuestManager::gettaskactivitydonecount(int task, int activity) {
|
||||
return initiator->GetTaskActivityDoneCountFromTaskID(task, activity);
|
||||
|
||||
return 0; //improper args
|
||||
|
||||
|
||||
}
|
||||
void QuestManager::updatetaskactivity(int task, int activity, int count) {
|
||||
|
||||
|
||||
+3
-3
@@ -1,15 +1,15 @@
|
||||
/* 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 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,
|
||||
|
||||
+28
-28
@@ -416,7 +416,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid)
|
||||
return;
|
||||
|
||||
range = caster->GetAOERange(spellid);
|
||||
|
||||
|
||||
float range2 = range*range;
|
||||
|
||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
||||
@@ -549,14 +549,14 @@ void Raid::BalanceMana(int32 penalty, uint32 gid)
|
||||
if(members[gi].member){
|
||||
if(members[gi].GroupNumber == gid)
|
||||
{
|
||||
if((members[gi].member->GetMaxMana() - manataken) < 1){
|
||||
members[gi].member->SetMana(1);
|
||||
if (members[gi].member->IsClient())
|
||||
members[gi].member->CastToClient()->SendManaUpdate();
|
||||
if((members[gi].member->GetMaxMana() - manataken) < 1){
|
||||
members[gi].member->SetMana(1);
|
||||
if (members[gi].member->IsClient())
|
||||
members[gi].member->CastToClient()->SendManaUpdate();
|
||||
}
|
||||
else{
|
||||
members[gi].member->SetMana(members[gi].member->GetMaxMana() - manataken);
|
||||
if (members[gi].member->IsClient())
|
||||
if (members[gi].member->IsClient())
|
||||
members[gi].member->CastToClient()->SendManaUpdate();
|
||||
}
|
||||
}
|
||||
@@ -569,19 +569,19 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum
|
||||
//avoid unneeded work
|
||||
if(copper == 0 && silver == 0 && gold == 0 && platinum == 0)
|
||||
return;
|
||||
|
||||
|
||||
uint32 i;
|
||||
uint8 membercount = 0;
|
||||
for (i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||
for (i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||
if (members[i].member != nullptr) {
|
||||
|
||||
membercount++;
|
||||
}
|
||||
}
|
||||
membercount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (membercount == 0)
|
||||
if (membercount == 0)
|
||||
return;
|
||||
|
||||
|
||||
uint32 mod;
|
||||
//try to handle round off error a little better
|
||||
if(membercount > 1) {
|
||||
@@ -601,7 +601,7 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum
|
||||
copper += 10 * mod;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//calculate the splits
|
||||
//We can still round off copper pieces, but I dont care
|
||||
uint32 sc;
|
||||
@@ -615,7 +615,7 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum
|
||||
buf[63] = '\0';
|
||||
string msg = "You receive";
|
||||
bool one = false;
|
||||
|
||||
|
||||
if(ppsplit > 0) {
|
||||
snprintf(buf, 63, " %u platinum", ppsplit);
|
||||
msg += buf;
|
||||
@@ -645,12 +645,12 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum
|
||||
one = true;
|
||||
}
|
||||
msg += " as your split";
|
||||
|
||||
for (i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||
|
||||
for (i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||
if (members[i].member != nullptr) { // If Group Member is Client
|
||||
//I could not get MoneyOnCorpse to work, so we use this
|
||||
members[i].member->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true);
|
||||
|
||||
|
||||
members[i].member->Message(2, msg.c_str());
|
||||
}
|
||||
}
|
||||
@@ -664,7 +664,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){
|
||||
return;
|
||||
|
||||
range = caster->GetAOERange(spellid);
|
||||
|
||||
|
||||
float range2 = range*range;
|
||||
|
||||
for(z=0; z < MAX_RAID_MEMBERS; z++) {
|
||||
@@ -694,7 +694,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){
|
||||
|
||||
void Raid::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float x, float y, float z, float heading, uint32 gid)
|
||||
{
|
||||
for(int i = 0; i < MAX_RAID_MEMBERS; i++)
|
||||
for(int i = 0; i < MAX_RAID_MEMBERS; i++)
|
||||
{
|
||||
if(members[i].member)
|
||||
{
|
||||
@@ -703,13 +703,13 @@ void Raid::TeleportGroup(Mob* sender, uint32 zoneID, uint16 instance_id, float x
|
||||
members[i].member->MovePC(zoneID, instance_id, x, y, z, heading, 0, ZoneSolicited);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Raid::TeleportRaid(Mob* sender, uint32 zoneID, uint16 instance_id, float x, float y, float z, float heading)
|
||||
{
|
||||
for(int i = 0; i < MAX_RAID_MEMBERS; i++)
|
||||
for(int i = 0; i < MAX_RAID_MEMBERS; i++)
|
||||
{
|
||||
if(members[i].member)
|
||||
{
|
||||
@@ -741,7 +741,7 @@ void Raid::AddRaidLooter(const char* looter)
|
||||
}
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
||||
{
|
||||
if(strcmp(looter, members[x].membername) == 0)
|
||||
@@ -778,7 +778,7 @@ void Raid::RemoveRaidLooter(const char* looter)
|
||||
}
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
||||
{
|
||||
if(strcmp(looter, members[x].membername) == 0)
|
||||
@@ -987,8 +987,8 @@ void Raid::SendRaidMove(const char* who, Client *to)
|
||||
SendRaidAdd(who, to);
|
||||
if(c && c == to){
|
||||
SendBulkRaid(c);
|
||||
if(IsLocked()) {
|
||||
SendRaidLockTo(c);
|
||||
if(IsLocked()) {
|
||||
SendRaidLockTo(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1080,7 +1080,7 @@ void Raid::SendGroupUpdate(Client *to)
|
||||
return;
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate2_Struct));
|
||||
GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer;
|
||||
GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer;
|
||||
gu->action = groupActUpdate;
|
||||
int index = 0;
|
||||
uint32 grp = GetGroup(to->GetName());
|
||||
@@ -1365,7 +1365,7 @@ void Raid::SendHPPacketsTo(Client *c)
|
||||
{
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
|
||||
uint32 gid = this->GetGroup(c);
|
||||
EQApplicationPacket hpapp;
|
||||
EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct));
|
||||
|
||||
+2
-2
@@ -45,7 +45,7 @@ enum { //raid packet types:
|
||||
raidChangeLootType = 11,
|
||||
raidStringID = 12,
|
||||
raidChangeGroupLeader = 13, //136 raid leader, new group leader, group_id?
|
||||
raidBecomeGroupLeader = 14, //472
|
||||
raidBecomeGroupLeader = 14, //472
|
||||
raidUnknown2 = 15,
|
||||
raidChangeGroup = 16, //?? len 136 old leader, new leader, 0 (preceeded with a remove2)
|
||||
raidLock = 17, //len 136 leader?, leader, 0
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
void RemoveRaidLooter(const char* looter);
|
||||
|
||||
//util func
|
||||
//keeps me from having to keep iterating through the list
|
||||
//keeps me from having to keep iterating through the list
|
||||
//when I want lots of data from the same entry
|
||||
uint32 GetPlayerIndex(const char *name);
|
||||
//for perl interface
|
||||
|
||||
+136
-136
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -47,7 +47,7 @@ CREATE TABLE spawn_events (
|
||||
zone VARCHAR(16) NOT nullptr,
|
||||
cond_id MEDIUMINT UNSIGNED NOT nullptr,
|
||||
name VARCHAR(255) NOT nullptr DEFAULT '',
|
||||
|
||||
|
||||
#timing information
|
||||
period INT UNSIGNED NOT nullptr,
|
||||
next_minute TINYINT UNSIGNED NOT nullptr,
|
||||
@@ -56,7 +56,7 @@ CREATE TABLE spawn_events (
|
||||
next_month TINYINT UNSIGNED NOT nullptr,
|
||||
next_year INT UNSIGNED NOT nullptr,
|
||||
enabled TINYINT NOT nullptr DEFAULT '1',
|
||||
|
||||
|
||||
#action:
|
||||
action TINYINT UNSIGNED NOT nullptr DEFAULT '0',
|
||||
argument MEDIUMINT NOT nullptr DEFAULT '0'
|
||||
@@ -64,8 +64,8 @@ CREATE TABLE spawn_events (
|
||||
|
||||
*/
|
||||
|
||||
Spawn2::Spawn2(uint32 in_spawn2_id, uint32 spawngroup_id,
|
||||
float in_x, float in_y, float in_z, float in_heading,
|
||||
Spawn2::Spawn2(uint32 in_spawn2_id, uint32 spawngroup_id,
|
||||
float in_x, float in_y, float in_z, float in_heading,
|
||||
uint32 respawn, uint32 variance, uint32 timeleft, uint32 grid,
|
||||
uint16 in_cond_id, int16 in_min_value, bool in_enabled, EmuAppearance anim)
|
||||
: timer(100000), killcount(0)
|
||||
@@ -92,7 +92,7 @@ Spawn2::Spawn2(uint32 in_spawn2_id, uint32 spawngroup_id,
|
||||
//we have a timeleft from the DB or something
|
||||
timer.Start(timeleft);
|
||||
} else {
|
||||
//no timeleft at all, reset to
|
||||
//no timeleft at all, reset to
|
||||
timer.Start(resetTimer());
|
||||
timer.Trigger();
|
||||
}
|
||||
@@ -105,35 +105,35 @@ Spawn2::~Spawn2()
|
||||
uint32 Spawn2::resetTimer()
|
||||
{
|
||||
uint32 rspawn = respawn_ * 1000;
|
||||
|
||||
|
||||
if (variance_ != 0) {
|
||||
int var_over_2 = (variance_ * 1000) / 2;
|
||||
rspawn = MakeRandomInt(rspawn - var_over_2, rspawn + var_over_2);
|
||||
|
||||
|
||||
//put a lower bound on it, not a lot of difference below 100, so set that as the bound.
|
||||
if(rspawn < 100)
|
||||
rspawn = 100;
|
||||
}
|
||||
|
||||
|
||||
return (rspawn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
uint32 Spawn2::despawnTimer(uint32 despawn_timer)
|
||||
{
|
||||
uint32 dspawn = despawn_timer * 1000;
|
||||
|
||||
|
||||
if (variance_ != 0) {
|
||||
int var_over_2 = (variance_ * 1000) / 2;
|
||||
dspawn = MakeRandomInt(dspawn - var_over_2, dspawn + var_over_2);
|
||||
|
||||
|
||||
//put a lower bound on it, not a lot of difference below 100, so set that as the bound.
|
||||
if(dspawn < 100)
|
||||
dspawn = 100;
|
||||
}
|
||||
|
||||
|
||||
return (dspawn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool Spawn2::Process() {
|
||||
@@ -152,18 +152,18 @@ bool Spawn2::Process() {
|
||||
|
||||
if (timer.Check()) {
|
||||
timer.Disable();
|
||||
|
||||
|
||||
_log(SPAWNS__MAIN, "Spawn2 %d: Timer has triggered", spawn2_id);
|
||||
|
||||
|
||||
//first check our spawn condition, if this isnt active
|
||||
//then we reset the timer and try again next time.
|
||||
if(condition_id != SC_AlwaysEnabled
|
||||
if(condition_id != SC_AlwaysEnabled
|
||||
&& !zone->spawn_conditions.Check(condition_id, condition_min_value)) {
|
||||
_log(SPAWNS__CONDITIONS, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id);
|
||||
Reset();
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
if (sg == nullptr) {
|
||||
database.LoadSpawnGroupsByID(spawngroup_id_,&zone->spawn_group_list);
|
||||
sg = zone->spawn_group_list.GetSpawnGroup(spawngroup_id_);
|
||||
@@ -173,7 +173,7 @@ bool Spawn2::Process() {
|
||||
_log(SPAWNS__MAIN, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//have the spawn group pick an NPC for us
|
||||
uint32 npcid = sg->GetNPCType();
|
||||
if (npcid == 0) {
|
||||
@@ -181,7 +181,7 @@ bool Spawn2::Process() {
|
||||
Reset(); //try again later (why?)
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
//try to find our NPC type.
|
||||
const NPCType* tmp = database.GetNPCType(npcid);
|
||||
if (tmp == nullptr) {
|
||||
@@ -192,7 +192,7 @@ bool Spawn2::Process() {
|
||||
|
||||
if(tmp->unique_spawn_by_name)
|
||||
{
|
||||
if(!entity_list.LimitCheckName(tmp->name))
|
||||
if(!entity_list.LimitCheckName(tmp->name))
|
||||
{
|
||||
_log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid);
|
||||
timer.Start(5000); //try again in five seconds.
|
||||
@@ -216,7 +216,7 @@ bool Spawn2::Process() {
|
||||
|
||||
if(spawn2_id)
|
||||
database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), 0);
|
||||
|
||||
|
||||
currentnpcid = npcid;
|
||||
NPC* npc = new NPC(tmp, this, x, y, z, heading, FlyMode3);
|
||||
|
||||
@@ -244,10 +244,10 @@ bool Spawn2::Process() {
|
||||
|
||||
void Spawn2::Disable()
|
||||
{
|
||||
if(npcthis)
|
||||
if(npcthis)
|
||||
{
|
||||
npcthis->Depop();
|
||||
}
|
||||
}
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
@@ -357,20 +357,20 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
|
||||
char* query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
||||
const char *zone_name = database.GetZoneName(zoneid);
|
||||
|
||||
MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, _condition, cond_value, enabled, animation FROM spawn2 WHERE zone='%s' AND version=%u", zone_name, version);
|
||||
MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, _condition, cond_value, enabled, animation FROM spawn2 WHERE zone='%s' AND version=%u", zone_name, version);
|
||||
if (RunQuery(query, strlen(query), errbuf, &result))
|
||||
{
|
||||
safe_delete_array(query);
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
Spawn2* newSpawn = 0;
|
||||
|
||||
|
||||
bool perl_enabled = atoi(row[11]) == 1 ? true : false;
|
||||
uint32 spawnLeft = (GetSpawnTimeLeft(atoi(row[0]), zone->GetInstanceID()) * 1000);
|
||||
newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), spawnLeft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12]));
|
||||
newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), spawnLeft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12]));
|
||||
spawn2_list.Insert( newSpawn );
|
||||
}
|
||||
mysql_free_result(result);
|
||||
@@ -381,7 +381,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -417,14 +417,14 @@ bool ZoneDatabase::CreateSpawn2(Client *c, uint32 spawngroup, const char* zone,
|
||||
|
||||
char *query = 0;
|
||||
uint32 affected_rows = 0;
|
||||
|
||||
|
||||
// if(GetInverseXY()==1) {
|
||||
// float temp=x;
|
||||
// x=y;
|
||||
// y=temp;
|
||||
// }
|
||||
if (RunQuery(query, MakeAnyLenString(&query,
|
||||
"INSERT INTO spawn2 (spawngroupID,zone,x,y,z,heading,respawntime,variance,_condition,cond_value) Values (%i, '%s', %f, %f, %f, %f, %i, %i, %u, %i)",
|
||||
if (RunQuery(query, MakeAnyLenString(&query,
|
||||
"INSERT INTO spawn2 (spawngroupID,zone,x,y,z,heading,respawntime,variance,_condition,cond_value) Values (%i, '%s', %f, %f, %f, %f, %i, %i, %u, %i)",
|
||||
spawngroup, zone, x, y, z, heading, respawn, variance, condition, cond_value
|
||||
), errbuf, 0, &affected_rows)) {
|
||||
safe_delete_array(query);
|
||||
@@ -441,7 +441,7 @@ bool ZoneDatabase::CreateSpawn2(Client *c, uint32 spawngroup, const char* zone,
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -508,16 +508,16 @@ void Zone::Despawn(uint32 spawn2ID) {
|
||||
void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
|
||||
if(GetSpawnCondition() != c.condition_id)
|
||||
return;
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value);
|
||||
|
||||
|
||||
bool old_state = (old_value >= condition_min_value);
|
||||
bool new_state = (c.value >= condition_min_value);
|
||||
if(old_state == new_state) {
|
||||
_log(SPAWNS__CONDITIONS, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id);
|
||||
return; //no change
|
||||
}
|
||||
|
||||
|
||||
switch(c.on_change) {
|
||||
case SpawnCondition::DoNothing:
|
||||
//that was easy.
|
||||
@@ -549,7 +549,7 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
|
||||
|
||||
void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
|
||||
_log(SPAWNS__CONDITIONS, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value);
|
||||
|
||||
|
||||
LinkedListIterator<Spawn2*> iterator(spawn2_list);
|
||||
|
||||
iterator.Reset();
|
||||
@@ -586,28 +586,28 @@ SpawnConditionManager::SpawnConditionManager()
|
||||
void SpawnConditionManager::Process() {
|
||||
if(spawn_events.empty())
|
||||
return;
|
||||
|
||||
|
||||
if(minute_timer.Check()) {
|
||||
//check each spawn event.
|
||||
|
||||
|
||||
//get our current time
|
||||
TimeOfDay_Struct tod;
|
||||
zone->zone_time.getEQTimeOfDay(&tod);
|
||||
|
||||
|
||||
//see if time is past our nearest event.
|
||||
if(EQTime::IsTimeBefore(&next_event, &tod))
|
||||
return;
|
||||
|
||||
//at least one event should get triggered,
|
||||
|
||||
//at least one event should get triggered,
|
||||
vector<SpawnEvent>::iterator cur,end;
|
||||
cur = spawn_events.begin();
|
||||
end = spawn_events.end();
|
||||
for(; cur != end; cur++) {
|
||||
SpawnEvent &cevent = *cur;
|
||||
|
||||
|
||||
if(!cevent.enabled)
|
||||
continue;
|
||||
|
||||
|
||||
if(EQTime::IsTimeBefore(&tod, &cevent.next)) {
|
||||
//this event has been triggered.
|
||||
//execute the event
|
||||
@@ -637,11 +637,11 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
|
||||
_log(SPAWNS__CONDITIONS, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id);
|
||||
return; //unable to find the spawn condition to operate on
|
||||
}
|
||||
|
||||
|
||||
SpawnCondition &cond = condi->second;
|
||||
|
||||
|
||||
int16 new_value = cond.value;
|
||||
|
||||
|
||||
//we have our event and our condition, do our stuff.
|
||||
switch(event.action) {
|
||||
case SpawnEvent::ActionSet:
|
||||
@@ -668,7 +668,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
|
||||
_log(SPAWNS__CONDITIONS, "Event %d: Invalid event action type %d", event.id, event.action);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//now set the condition to the new value
|
||||
if(send_update) //full blown update
|
||||
SetCondition(zone->GetShortName(), zone->GetInstanceID(), cond.condition_id, new_value);
|
||||
@@ -680,14 +680,14 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
int len;
|
||||
|
||||
|
||||
SpawnCondition cond;
|
||||
len = MakeAnyLenString(&query,
|
||||
len = MakeAnyLenString(&query,
|
||||
"UPDATE spawn_events SET "
|
||||
"next_minute=%d, next_hour=%d, next_day=%d, next_month=%d, "
|
||||
"next_year=%d, enabled=%d "
|
||||
"WHERE id=%d",
|
||||
event.next.minute, event.next.hour, event.next.day, event.next.month,
|
||||
event.next.minute, event.next.hour, event.next.day, event.next.month,
|
||||
event.next.year, event.enabled?1:0, event.id
|
||||
);
|
||||
if(!database.RunQuery(query, len, errbuf)) {
|
||||
@@ -700,9 +700,9 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
int len;
|
||||
|
||||
|
||||
SpawnCondition cond;
|
||||
len = MakeAnyLenString(&query,
|
||||
len = MakeAnyLenString(&query,
|
||||
"REPLACE INTO spawn_condition_values (id, value, zone, instance_id) VALUES(%u, %u, '%s', %u)",
|
||||
cond_id, value, zone_name, instance_id
|
||||
);
|
||||
@@ -718,10 +718,10 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, stri
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int len;
|
||||
|
||||
|
||||
bool ret = false;
|
||||
|
||||
len = MakeAnyLenString(&query,
|
||||
|
||||
len = MakeAnyLenString(&query,
|
||||
"SELECT id,cond_id,period,next_minute,next_hour,next_day,next_month,next_year,enabled,action,argument,zone "
|
||||
"FROM spawn_events WHERE id=%d", event_id);
|
||||
if (database.RunQuery(query, len, errbuf, &result)) {
|
||||
@@ -730,23 +730,23 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, stri
|
||||
event.id = atoi(row[0]);
|
||||
event.condition_id = atoi(row[1]);
|
||||
event.period = atoi(row[2]);
|
||||
|
||||
|
||||
event.next.minute = atoi(row[3]);
|
||||
event.next.hour = atoi(row[4]);
|
||||
event.next.day = atoi(row[5]);
|
||||
event.next.month = atoi(row[6]);
|
||||
event.next.year = atoi(row[7]);
|
||||
|
||||
|
||||
event.enabled = atoi(row[8])==0?false:true;
|
||||
event.action = (SpawnEvent::Action) atoi(row[9]);
|
||||
event.argument = atoi(row[10]);
|
||||
zone_name = row[11];
|
||||
|
||||
string t;
|
||||
EQTime::ToString(&event.next, t);
|
||||
EQTime::ToString(&event.next, t);
|
||||
_log(SPAWNS__CONDITIONS, "Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d. Will trigger at %s",
|
||||
event.enabled?"enabled":"disabled", event.id, event.condition_id, event.period, event.action, event.argument, t.c_str());
|
||||
|
||||
|
||||
ret = true;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
@@ -757,18 +757,18 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, stri
|
||||
return(ret);
|
||||
}
|
||||
|
||||
bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 instance_id)
|
||||
bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 instance_id)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int len;
|
||||
|
||||
|
||||
//clear out old stuff..
|
||||
spawn_conditions.clear();
|
||||
|
||||
//load spawn conditions
|
||||
|
||||
//load spawn conditions
|
||||
SpawnCondition cond;
|
||||
len = MakeAnyLenString(&query, "SELECT id, onchange, value FROM spawn_conditions WHERE zone='%s'", zone_name);
|
||||
if (database.RunQuery(query, len, errbuf, &result)) {
|
||||
@@ -778,7 +778,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
cond.value = atoi(row[2]);
|
||||
cond.on_change = (SpawnCondition::OnChange) atoi(row[1]);
|
||||
spawn_conditions[cond.condition_id] = cond;
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
@@ -792,8 +792,8 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
len = MakeAnyLenString(&query, "SELECT id, value FROM spawn_condition_values WHERE zone='%s' and instance_id=%u", zone_name, instance_id);
|
||||
if (database.RunQuery(query, len, errbuf, &result)) {
|
||||
safe_delete_array(query);
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
std::map<uint16, SpawnCondition>::iterator iter = spawn_conditions.find(atoi(row[0]));
|
||||
if(iter != spawn_conditions.end())
|
||||
{
|
||||
@@ -801,18 +801,18 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
}
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query, errbuf);
|
||||
safe_delete_array(query);
|
||||
spawn_conditions.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//load spawn events
|
||||
SpawnEvent event;
|
||||
len = MakeAnyLenString(&query,
|
||||
len = MakeAnyLenString(&query,
|
||||
"SELECT id,cond_id,period,next_minute,next_hour,next_day,next_month,next_year,enabled,action,argument "
|
||||
"FROM spawn_events WHERE zone='%s'", zone_name);
|
||||
if (database.RunQuery(query, len, errbuf, &result)) {
|
||||
@@ -825,18 +825,18 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
LogFile->write(EQEMuLog::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
event.next.minute = atoi(row[3]);
|
||||
event.next.hour = atoi(row[4]);
|
||||
event.next.day = atoi(row[5]);
|
||||
event.next.month = atoi(row[6]);
|
||||
event.next.year = atoi(row[7]);
|
||||
|
||||
|
||||
event.enabled = atoi(row[8])==0?false:true;
|
||||
event.action = (SpawnEvent::Action) atoi(row[9]);
|
||||
event.argument = atoi(row[10]);
|
||||
spawn_events.push_back(event);
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d",
|
||||
event.enabled?"enabled":"disabled", event.id, event.condition_id, event.period, event.action, event.argument);
|
||||
}
|
||||
@@ -846,10 +846,10 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//now we need to catch up on events that happened while we were away
|
||||
//and use them to alter just the condition variables.
|
||||
|
||||
|
||||
//each spawn2 will then use its correct condition value when
|
||||
//it decides what to do. This essentially forces a 'depop' action
|
||||
//on spawn points which are turned off, and a 'repop' action on
|
||||
@@ -858,17 +858,17 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
//get our current time
|
||||
TimeOfDay_Struct tod;
|
||||
zone->zone_time.getEQTimeOfDay(&tod);
|
||||
|
||||
|
||||
vector<SpawnEvent>::iterator cur,end;
|
||||
cur = spawn_events.begin();
|
||||
end = spawn_events.end();
|
||||
bool ran;
|
||||
for(; cur != end; cur++) {
|
||||
SpawnEvent &cevent = *cur;
|
||||
|
||||
|
||||
if(!cevent.enabled)
|
||||
continue;
|
||||
|
||||
|
||||
//watch for special case of all 0s, which means to reset next to now
|
||||
if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) {
|
||||
_log(SPAWNS__CONDITIONS, "Initial next trigger time set for spawn event %d", cevent.id);
|
||||
@@ -879,7 +879,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
UpdateDBEvent(cevent);
|
||||
continue; //were done with this event.
|
||||
}
|
||||
|
||||
|
||||
ran = false;
|
||||
while(EQTime::IsTimeBefore(&tod, &cevent.next)) {
|
||||
_log(SPAWNS__CONDITIONS, "Catch up triggering on event %d", cevent.id);
|
||||
@@ -896,27 +896,27 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
UpdateDBEvent(cevent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//now our event timers are all up to date, find our closest event.
|
||||
FindNearestEvent();
|
||||
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
void SpawnConditionManager::FindNearestEvent() {
|
||||
//set a huge year which should never get reached normally
|
||||
next_event.year = 0xFFFFFF;
|
||||
|
||||
|
||||
vector<SpawnEvent>::iterator cur,end;
|
||||
cur = spawn_events.begin();
|
||||
end = spawn_events.end();
|
||||
int next_id = -1;
|
||||
for(; cur != end; cur++) {
|
||||
SpawnEvent &cevent = *cur;
|
||||
|
||||
|
||||
if(!cevent.enabled)
|
||||
continue;
|
||||
|
||||
|
||||
//see if this event is before our last nearest
|
||||
if(EQTime::IsTimeBefore(&next_event, &cevent.next)) {
|
||||
memcpy(&next_event, &cevent.next, sizeof(next_event));
|
||||
@@ -929,7 +929,7 @@ void SpawnConditionManager::FindNearestEvent() {
|
||||
_log(SPAWNS__CONDITIONS, "Next event determined to be event %d", next_id);
|
||||
}
|
||||
|
||||
void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update)
|
||||
void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update)
|
||||
{
|
||||
if(world_update) {
|
||||
//this is an update coming from another zone, they
|
||||
@@ -941,24 +941,24 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
_log(SPAWNS__CONDITIONS, "Condition update received from world for %d, but we do not have that conditon.", condition_id);
|
||||
return; //unable to find the spawn condition
|
||||
}
|
||||
|
||||
|
||||
SpawnCondition &cond = condi->second;
|
||||
|
||||
|
||||
if(cond.value == new_value) {
|
||||
_log(SPAWNS__CONDITIONS, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int16 old_value = cond.value;
|
||||
|
||||
|
||||
//set our local value
|
||||
cond.value = new_value;
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Condition update received from world for %d with value %d", condition_id, new_value);
|
||||
|
||||
|
||||
//now we have to test each spawn point to see if it changed.
|
||||
zone->SpawnConditionChanged(cond, old_value);
|
||||
} else if(!strcasecmp(zone_short, zone->GetShortName()) && instance_id == zone->GetInstanceID())
|
||||
} else if(!strcasecmp(zone_short, zone->GetShortName()) && instance_id == zone->GetInstanceID())
|
||||
{
|
||||
//this is a local spawn condition, we need to update the DB,
|
||||
//our memory, then notify spawn points of the change.
|
||||
@@ -968,43 +968,43 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
_log(SPAWNS__CONDITIONS, "Local Condition update requested for %d, but we do not have that conditon.", condition_id);
|
||||
return; //unable to find the spawn condition
|
||||
}
|
||||
|
||||
|
||||
SpawnCondition &cond = condi->second;
|
||||
|
||||
|
||||
if(cond.value == new_value) {
|
||||
_log(SPAWNS__CONDITIONS, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int16 old_value = cond.value;
|
||||
|
||||
|
||||
//set our local value
|
||||
cond.value = new_value;
|
||||
//save it in the DB too
|
||||
UpdateDBCondition(zone_short, instance_id, condition_id, new_value);
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Local Condition update requested for %d with value %d", condition_id, new_value);
|
||||
|
||||
|
||||
//now we have to test each spawn point to see if it changed.
|
||||
zone->SpawnConditionChanged(cond, old_value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//this is a remote spawn condition, update the DB and send
|
||||
//an update packet to the zone if its up
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value);
|
||||
|
||||
|
||||
UpdateDBCondition(zone_short, instance_id, condition_id, new_value);
|
||||
|
||||
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_SpawnCondition, sizeof(ServerSpawnCondition_Struct));
|
||||
ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer;
|
||||
|
||||
|
||||
ssc->zoneID = database.GetZoneID(zone_short);
|
||||
ssc->instanceID = instance_id;
|
||||
ssc->condition_id = condition_id;
|
||||
ssc->value = new_value;
|
||||
|
||||
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
@@ -1012,16 +1012,16 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
|
||||
void SpawnConditionManager::ReloadEvent(uint32 event_id) {
|
||||
string zone_short_name;
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Requested to reload event %d from the database.", event_id);
|
||||
|
||||
|
||||
//first look for the event in our local event list
|
||||
vector<SpawnEvent>::iterator cur,end;
|
||||
cur = spawn_events.begin();
|
||||
end = spawn_events.end();
|
||||
for(; cur != end; cur++) {
|
||||
SpawnEvent &cevent = *cur;
|
||||
|
||||
|
||||
if(cevent.id == event_id) {
|
||||
//load the event into the old event slot
|
||||
if(!LoadDBEvent(event_id, cevent, zone_short_name)) {
|
||||
@@ -1034,7 +1034,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if we get here, it is a new event...
|
||||
SpawnEvent e;
|
||||
if(!LoadDBEvent(event_id, e, zone_short_name)) {
|
||||
@@ -1042,29 +1042,29 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
|
||||
_log(SPAWNS__CONDITIONS, "Failed to reload event %d from the database.", event_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//we might want to check the next timer like we do on
|
||||
//regular load events, but we are assuming this is a new event
|
||||
//and anyways, this will get handled (albeit not optimally)
|
||||
//naturally by the event handling code.
|
||||
|
||||
|
||||
spawn_events.push_back(e);
|
||||
|
||||
|
||||
//sync up our nearest event
|
||||
FindNearestEvent();
|
||||
}
|
||||
|
||||
void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool reset_base) {
|
||||
|
||||
|
||||
_log(SPAWNS__CONDITIONS, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
|
||||
|
||||
|
||||
//first look for the event in our local event list
|
||||
vector<SpawnEvent>::iterator cur,end;
|
||||
cur = spawn_events.begin();
|
||||
end = spawn_events.end();
|
||||
for(; cur != end; cur++) {
|
||||
SpawnEvent &cevent = *cur;
|
||||
|
||||
|
||||
if(cevent.id == event_id) {
|
||||
//make sure were actually changing something
|
||||
if(cevent.enabled != enabled || reset_base) {
|
||||
@@ -1078,10 +1078,10 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
|
||||
} else {
|
||||
_log(SPAWNS__CONDITIONS, "Spawn event %d located in this zone. State changed.", event_id);
|
||||
}
|
||||
|
||||
|
||||
//save the event in the DB
|
||||
UpdateDBEvent(cevent);
|
||||
|
||||
|
||||
//sync up our nearest event
|
||||
FindNearestEvent();
|
||||
} else {
|
||||
@@ -1091,13 +1091,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if we get here, the condition must be in another zone.
|
||||
//first figure out what zone it applies to.
|
||||
//update the DB and send and send an update packet to
|
||||
//update the DB and send and send an update packet to
|
||||
//the zone if its up
|
||||
|
||||
//we need to load the event from the DB and then update
|
||||
|
||||
//we need to load the event from the DB and then update
|
||||
//the values in the DB, because we do not know if the zone
|
||||
//is up or not. The message to the zone will just tell it to
|
||||
//update its in-memory event list
|
||||
@@ -1112,7 +1112,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
|
||||
_log(SPAWNS__CONDITIONS, "Spawn event %d is not located in this zone but no change was needed.", event_id);
|
||||
return; //no changes.
|
||||
}
|
||||
|
||||
|
||||
e.enabled = enabled;
|
||||
if(reset_base) {
|
||||
_log(SPAWNS__CONDITIONS, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period);
|
||||
@@ -1125,31 +1125,31 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese
|
||||
}
|
||||
//save the event in the DB
|
||||
UpdateDBEvent(e);
|
||||
|
||||
|
||||
|
||||
|
||||
//now notify the zone
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_SpawnEvent, sizeof(ServerSpawnEvent_Struct));
|
||||
ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer;
|
||||
|
||||
|
||||
sse->zoneID = database.GetZoneID(zone_short_name.c_str());
|
||||
sse->event_id = event_id;
|
||||
|
||||
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id) {
|
||||
if(!strcasecmp(zone_short, zone->GetShortName()) && instance_id == zone->GetInstanceID())
|
||||
if(!strcasecmp(zone_short, zone->GetShortName()) && instance_id == zone->GetInstanceID())
|
||||
{
|
||||
//this is a local spawn condition
|
||||
map<uint16, SpawnCondition>::iterator condi;
|
||||
condi = spawn_conditions.find(condition_id);
|
||||
if(condi == spawn_conditions.end())
|
||||
if(condi == spawn_conditions.end())
|
||||
{
|
||||
_log(SPAWNS__CONDITIONS, "Unable to find local condition %d in Get request.", condition_id);
|
||||
return(0); //unable to find the spawn condition
|
||||
}
|
||||
|
||||
|
||||
SpawnCondition &cond = condi->second;
|
||||
return(cond.value);
|
||||
} else {
|
||||
@@ -1159,12 +1159,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int len;
|
||||
|
||||
|
||||
int16 value;
|
||||
|
||||
//load spawn conditions
|
||||
|
||||
//load spawn conditions
|
||||
SpawnCondition cond;
|
||||
len = MakeAnyLenString(&query, "SELECT value FROM spawn_condition_values WHERE zone='%s' AND instance_id=%u AND id=%d",
|
||||
len = MakeAnyLenString(&query, "SELECT value FROM spawn_condition_values WHERE zone='%s' AND instance_id=%u AND id=%d",
|
||||
zone_short, instance_id, condition_id);
|
||||
if (database.RunQuery(query, len, errbuf, &result)) {
|
||||
safe_delete_array(query);
|
||||
@@ -1189,9 +1189,9 @@ bool SpawnConditionManager::Check(uint16 condition, int16 min_value) {
|
||||
condi = spawn_conditions.find(condition);
|
||||
if(condi == spawn_conditions.end())
|
||||
return(false); //unable to find the spawn condition
|
||||
|
||||
|
||||
SpawnCondition &cond = condi->second;
|
||||
|
||||
|
||||
return(cond.value >= min_value);
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -32,9 +32,9 @@ class NPC;
|
||||
class Spawn2
|
||||
{
|
||||
public:
|
||||
Spawn2(uint32 spawn2_id, uint32 spawngroup_id,
|
||||
float x, float y, float z, float heading,
|
||||
uint32 respawn, uint32 variance,
|
||||
Spawn2(uint32 spawn2_id, uint32 spawngroup_id,
|
||||
float x, float y, float z, float heading,
|
||||
uint32 respawn, uint32 variance,
|
||||
uint32 timeleft = 0, uint32 grid = 0,
|
||||
uint16 cond_id = SC_AlwaysEnabled, int16 min_value = 0, bool in_enabled = true, EmuAppearance anim = eaStanding);
|
||||
~Spawn2();
|
||||
@@ -107,9 +107,9 @@ public:
|
||||
//a base for the signal ID sent. e.g.
|
||||
// value 12 sends signal id 2
|
||||
} OnChange;
|
||||
|
||||
|
||||
SpawnCondition();
|
||||
|
||||
|
||||
uint16 condition_id;
|
||||
int16 value;
|
||||
OnChange on_change;
|
||||
@@ -124,17 +124,17 @@ public:
|
||||
ActionMultiply = 3,
|
||||
ActionDivide = 4
|
||||
} Action;
|
||||
|
||||
|
||||
SpawnEvent();
|
||||
|
||||
|
||||
uint32 id;
|
||||
uint16 condition_id;
|
||||
string zone_name;
|
||||
|
||||
|
||||
bool enabled;
|
||||
Action action;
|
||||
int16 argument;
|
||||
|
||||
|
||||
uint32 period; //eq minutes (3 seconds) between events
|
||||
TimeOfDay_Struct next; //next time this event triggers
|
||||
};
|
||||
@@ -142,26 +142,26 @@ public:
|
||||
class SpawnConditionManager {
|
||||
public:
|
||||
SpawnConditionManager();
|
||||
|
||||
|
||||
void Process();
|
||||
bool LoadSpawnConditions(const char* zone_name, uint32 instance_id);
|
||||
|
||||
|
||||
int16 GetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id);
|
||||
void SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update = false);
|
||||
void ToggleEvent(uint32 event_id, bool enabled, bool reset_base);
|
||||
bool Check(uint16 condition, int16 min_value);
|
||||
void ReloadEvent(uint32 event_id);
|
||||
|
||||
|
||||
protected:
|
||||
map<uint16, SpawnCondition> spawn_conditions;
|
||||
vector<SpawnEvent> spawn_events;
|
||||
|
||||
|
||||
void ExecEvent(SpawnEvent &e, bool send_update);
|
||||
void UpdateDBEvent(SpawnEvent &e);
|
||||
bool LoadDBEvent(uint32 event_id, SpawnEvent &e, string &zone_name);
|
||||
void UpdateDBCondition(const char* zone_name, uint32 instance_id, uint16 cond_id, int16 value);
|
||||
void FindNearestEvent();
|
||||
|
||||
|
||||
Timer minute_timer;
|
||||
TimeOfDay_Struct next_event;
|
||||
};
|
||||
|
||||
+15
-15
@@ -4,13 +4,13 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -28,7 +28,7 @@ using namespace std;
|
||||
|
||||
extern EntityList entity_list;
|
||||
|
||||
SpawnEntry::SpawnEntry( uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit )
|
||||
SpawnEntry::SpawnEntry( uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit )
|
||||
{
|
||||
NPCType = in_NPCType;
|
||||
chance = in_chance;
|
||||
@@ -55,32 +55,32 @@ uint32 SpawnGroup::GetNPCType() {
|
||||
#endif
|
||||
int npcType = 0;
|
||||
int totalchance = 0;
|
||||
|
||||
|
||||
//check limits on this spawn group and npc type
|
||||
if(!entity_list.LimitCheckGroup(id, group_spawn_limit))
|
||||
return(0);
|
||||
|
||||
|
||||
list<SpawnEntry*>::iterator cur,end;
|
||||
list<SpawnEntry*> possible;
|
||||
cur = list_.begin();
|
||||
end = list_.end();
|
||||
for(; cur != end; cur++) {
|
||||
SpawnEntry *se = *cur;
|
||||
|
||||
|
||||
//check limits on this spawn group and npc type
|
||||
if(!entity_list.LimitCheckType(se->NPCType, se->npc_spawn_limit))
|
||||
continue;
|
||||
|
||||
|
||||
totalchance += se->chance;
|
||||
possible.push_back(se);
|
||||
}
|
||||
if(totalchance == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
|
||||
int32 roll = 0;
|
||||
roll = MakeRandomInt(0, totalchance-1);
|
||||
|
||||
|
||||
cur = possible.begin();
|
||||
end = possible.end();
|
||||
for(; cur != end; cur++) {
|
||||
@@ -137,7 +137,7 @@ SpawnGroup* SpawnGroupList::GetSpawnGroup(uint32 in_id) {
|
||||
bool SpawnGroupList::RemoveSpawnGroup(uint32 in_id) {
|
||||
if(groups.count(in_id) != 1)
|
||||
return(false);
|
||||
|
||||
|
||||
groups.erase(in_id);
|
||||
return(true);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
||||
// CODER new spawn code
|
||||
query = 0;
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT DISTINCT(spawngroupID), spawngroup.name, spawngroup.spawn_limit, spawngroup.dist, spawngroup.max_x, spawngroup.min_x, spawngroup.max_y, spawngroup.min_y, spawngroup.delay, spawngroup.despawn, spawngroup.despawn_timer FROM spawn2,spawngroup WHERE spawn2.spawngroupID=spawngroup.ID and spawn2.version=%u and zone='%s'", version, zone_name), errbuf, &result))
|
||||
@@ -167,7 +167,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
|
||||
}
|
||||
|
||||
query = 0;
|
||||
if (RunQuery(query, MakeAnyLenString(&query,
|
||||
if (RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT DISTINCT spawnentry.spawngroupID, npcid, chance, "
|
||||
"npc_types.spawn_limit AS sl "
|
||||
"FROM spawnentry, spawn2, npc_types "
|
||||
@@ -201,7 +201,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
||||
|
||||
// CODER new spawn code
|
||||
query = 0;
|
||||
@@ -222,7 +222,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
|
||||
}
|
||||
|
||||
query = 0;
|
||||
if (RunQuery(query, MakeAnyLenString(&query,
|
||||
if (RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT DISTINCT spawnentry.spawngroupID, spawnentry.npcid, spawnentry.chance, spawngroup.spawn_limit FROM spawnentry,spawngroup WHERE spawnentry.spawngroupID='%i' AND spawngroup.spawn_limit='0' ORDER by chance", spawngroupid), errbuf, &result)) {
|
||||
safe_delete_array(query);
|
||||
while((row = mysql_fetch_row(result)))
|
||||
|
||||
+165
-165
File diff suppressed because it is too large
Load Diff
+268
-268
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user