mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-05 04:13:52 +00:00
Implement extra spell gems!
New limits:
Tit: 9
SoF: 9
SoD: 10
UF: 12
RoF: 12
RoF2: 12
The SoF client doesn't actually support 10 like SoF should
RoF/RoF2 actually have 4 extra broken spell gems in the UI. They don't work and
will likely crash your client
Quest stuff assumes you are passing in valid slots.
(note the old default of 10 should be 22)
There are still somethings to do like clean up the memmed spells if one switches
to an older client that doesn't support as many as their previous client.
This commit is contained in:
parent
4c4b0aba0c
commit
ef2c17748e
@ -1,5 +1,15 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 07/31/2016 ==
|
||||
mackal: Implement more spell gems!
|
||||
- There are a few things still left to due like make dealing with losing gems nice (reset AAs, going to an older client etc)
|
||||
- Sadly SoF disc release doesn't support gem 10 like one might expect :(
|
||||
- So changed clients:
|
||||
- SoD = 10
|
||||
- UF = 12
|
||||
- RoF/RoF2 = 12. I know the UI supports 16, but the client does not and can cause client crashes
|
||||
- The quest APIs assume you pass a valid spell gem ...
|
||||
|
||||
== 07/28/2016 ==
|
||||
Uleat: Implemented zone memory-mapped file usage
|
||||
- Zone map files are converted to pre-loaded binary files, bypassing the (sometimes) time-consuming raw data transform process
|
||||
|
||||
@ -44,6 +44,26 @@ namespace EQEmu
|
||||
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
|
||||
|
||||
} /*constants*/
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Gem10 = 9,
|
||||
Gem11 = 10,
|
||||
Gem12 = 11,
|
||||
MaxGems = 12,
|
||||
Ability = 20, // HT/LoH for Tit
|
||||
PotionBelt = 21, // Tit uses a different slot for PB
|
||||
Item = 22,
|
||||
Discipline = 23,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
|
||||
@ -386,7 +386,7 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
uint32 unknown12;
|
||||
uint32 reduction; // lower reuse
|
||||
};
|
||||
|
||||
/*
|
||||
@ -834,7 +834,7 @@ struct SuspendedMinion_Struct
|
||||
*/
|
||||
static const uint32 MAX_PP_LANGUAGE = 28;
|
||||
static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions
|
||||
static const uint32 MAX_PP_MEMSPELL = 9; // Set to latest client so functions can work right
|
||||
static const uint32 MAX_PP_MEMSPELL = static_cast<uint32>(EQEmu::CastingSlot::MaxGems); // Set to latest client so functions can work right -- 12
|
||||
static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain
|
||||
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain
|
||||
|
||||
@ -915,7 +915,7 @@ struct PlayerProfile_Struct
|
||||
/*0245*/ uint8 guildbanker;
|
||||
/*0246*/ uint8 unknown0246[6]; //
|
||||
/*0252*/ uint32 intoxication;
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms
|
||||
/*0292*/ uint32 abilitySlotRefresh;
|
||||
/*0296*/ uint8 haircolor; // Player hair color
|
||||
/*0297*/ uint8 beardcolor; // Player beard color
|
||||
@ -956,7 +956,7 @@ struct PlayerProfile_Struct
|
||||
/*2580*/ uint8 unknown2616[4];
|
||||
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
|
||||
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL];
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL];
|
||||
/*4668*/ uint8 unknown4704[32]; //
|
||||
/*4700*/ float y; // Player y position
|
||||
/*4704*/ float x; // Player x position
|
||||
|
||||
@ -63,6 +63,9 @@ namespace RoF
|
||||
// client to server text link converter
|
||||
static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink);
|
||||
|
||||
static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot);
|
||||
|
||||
void Register(EQStreamIdentifier &into)
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
@ -507,10 +510,7 @@ namespace RoF
|
||||
ENCODE_LENGTH_EXACT(CastSpell_Struct);
|
||||
SETUP_DIRECT_ENCODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
if (emu->slot == 10)
|
||||
eq->slot = 13;
|
||||
else
|
||||
OUT(slot);
|
||||
eq->slot = static_cast<uint32>(ServerToRoFCastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
|
||||
|
||||
OUT(spell_id);
|
||||
eq->inventory_slot = ServerToRoFSlot(emu->inventoryslot);
|
||||
@ -2259,11 +2259,11 @@ namespace RoF
|
||||
|
||||
outapp->WriteUInt32(structs::MAX_PP_MEMSPELL); // Memorised spell slots
|
||||
|
||||
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++)
|
||||
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) // first 12
|
||||
{
|
||||
outapp->WriteUInt32(emu->mem_spells[r]);
|
||||
}
|
||||
// zeroes for the rest of the slots
|
||||
// zeroes for the rest of the slots -- the other 4 which don't work at all!
|
||||
for (uint32 r = 0; r < structs::MAX_PP_MEMSPELL - MAX_PP_MEMSPELL; r++)
|
||||
{
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
@ -4334,10 +4334,7 @@ namespace RoF
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
if (eq->slot == 13)
|
||||
emu->slot = 10;
|
||||
else
|
||||
IN(slot);
|
||||
emu->slot = static_cast<uint32>(RoFToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
|
||||
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = RoFToServerSlot(eq->inventory_slot);
|
||||
@ -6009,4 +6006,80 @@ namespace RoF
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Gem10:
|
||||
return CastingSlot::Gem10;
|
||||
case EQEmu::CastingSlot::Gem11:
|
||||
return CastingSlot::Gem11;
|
||||
case EQEmu::CastingSlot::Gem12:
|
||||
return CastingSlot::Gem12;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Gem10:
|
||||
return EQEmu::CastingSlot::Gem10;
|
||||
case CastingSlot::Gem11:
|
||||
return EQEmu::CastingSlot::Gem11;
|
||||
case CastingSlot::Gem12:
|
||||
return EQEmu::CastingSlot::Gem12;
|
||||
case CastingSlot::Discipline:
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
case CastingSlot::Item:
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
} /*RoF*/
|
||||
|
||||
@ -50,6 +50,24 @@ namespace RoF
|
||||
#include "rof_ops.h"
|
||||
};
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Gem10 = 9,
|
||||
Gem11 = 10,
|
||||
Gem12 = 11,
|
||||
Item = 12,
|
||||
Discipline = 13,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
}; /*RoF*/
|
||||
|
||||
#endif /*COMMON_ROF_H*/
|
||||
|
||||
@ -63,6 +63,9 @@ namespace RoF2
|
||||
// client to server text link converter
|
||||
static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink);
|
||||
|
||||
static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot);
|
||||
|
||||
void Register(EQStreamIdentifier &into)
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
@ -584,10 +587,7 @@ namespace RoF2
|
||||
ENCODE_LENGTH_EXACT(CastSpell_Struct);
|
||||
SETUP_DIRECT_ENCODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
if (emu->slot == 10)
|
||||
eq->slot = 13;
|
||||
else
|
||||
OUT(slot);
|
||||
eq->slot = static_cast<uint32>(ServerToRoF2CastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
|
||||
|
||||
OUT(spell_id);
|
||||
eq->inventory_slot = ServerToRoF2Slot(emu->inventoryslot);
|
||||
@ -2346,11 +2346,11 @@ namespace RoF2
|
||||
|
||||
outapp->WriteUInt32(structs::MAX_PP_MEMSPELL); // Memorised spell slots
|
||||
|
||||
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++)
|
||||
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) // write first 12
|
||||
{
|
||||
outapp->WriteUInt32(emu->mem_spells[r]);
|
||||
}
|
||||
// zeroes for the rest of the slots
|
||||
// zeroes for the rest of the slots the other 4, which actually don't work on the client at all :D
|
||||
for (uint32 r = 0; r < structs::MAX_PP_MEMSPELL - MAX_PP_MEMSPELL; r++)
|
||||
{
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
@ -4574,10 +4574,7 @@ namespace RoF2
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
if (eq->slot == 13)
|
||||
emu->slot = 10;
|
||||
else
|
||||
IN(slot);
|
||||
emu->slot = static_cast<uint32>(RoF2ToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
|
||||
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = RoF2ToServerSlot(eq->inventory_slot);
|
||||
@ -6314,4 +6311,80 @@ namespace RoF2
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Gem10:
|
||||
return CastingSlot::Gem10;
|
||||
case EQEmu::CastingSlot::Gem11:
|
||||
return CastingSlot::Gem11;
|
||||
case EQEmu::CastingSlot::Gem12:
|
||||
return CastingSlot::Gem12;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Gem10:
|
||||
return EQEmu::CastingSlot::Gem10;
|
||||
case CastingSlot::Gem11:
|
||||
return EQEmu::CastingSlot::Gem11;
|
||||
case CastingSlot::Gem12:
|
||||
return EQEmu::CastingSlot::Gem12;
|
||||
case CastingSlot::Discipline:
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
case CastingSlot::Item:
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
} /*RoF2*/
|
||||
|
||||
@ -50,6 +50,24 @@ namespace RoF2
|
||||
#include "rof2_ops.h"
|
||||
};
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Gem10 = 9,
|
||||
Gem11 = 10,
|
||||
Gem12 = 11,
|
||||
Item = 12,
|
||||
Discipline = 13,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
}; /*RoF2*/
|
||||
|
||||
#endif /*COMMON_ROF2_H*/
|
||||
|
||||
@ -635,7 +635,7 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
uint32 unknown12;
|
||||
uint32 reduction; // lowers reuse
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -624,7 +624,7 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
uint32 unknown12;
|
||||
uint32 reduction; // lowers reuse
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -59,6 +59,9 @@ namespace SoD
|
||||
// client to server text link converter
|
||||
static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink);
|
||||
|
||||
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot);
|
||||
|
||||
void Register(EQStreamIdentifier &into)
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
@ -2948,6 +2951,7 @@ namespace SoD
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
emu->slot = static_cast<uint32>(SoDToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
|
||||
IN(slot);
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = SoDToServerSlot(eq->inventoryslot);
|
||||
@ -4013,4 +4017,72 @@ namespace SoD
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Gem10:
|
||||
return CastingSlot::Gem10;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Gem10:
|
||||
return EQEmu::CastingSlot::Gem10;
|
||||
case CastingSlot::Discipline:
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
case CastingSlot::Item:
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
} /*SoD*/
|
||||
|
||||
@ -50,6 +50,22 @@ namespace SoD
|
||||
#include "sod_ops.h"
|
||||
};
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Gem10 = 9,
|
||||
Item = 10,
|
||||
Discipline = 11,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
}; /*SoD*/
|
||||
|
||||
#endif /*COMMON_SOD_H*/
|
||||
|
||||
@ -479,7 +479,7 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
//uint32 unknown12;
|
||||
uint32 reduction; // lowers reuse
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -59,6 +59,9 @@ namespace SoF
|
||||
// client to server text link converter
|
||||
static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink);
|
||||
|
||||
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
|
||||
|
||||
void Register(EQStreamIdentifier &into)
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
@ -938,6 +941,22 @@ namespace SoF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_MemorizeSpell)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
|
||||
SETUP_DIRECT_ENCODE(MemorizeSpell_Struct, structs::MemorizeSpell_Struct);
|
||||
|
||||
// Since HT/LoH are translated up, we need to translate down only for memSpellSpellbar case
|
||||
if (emu->scribing == 3)
|
||||
eq->slot = static_cast<uint32>(ServerToSoFCastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
|
||||
else
|
||||
OUT(slot);
|
||||
OUT(spell_id);
|
||||
OUT(scribing);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_MoveItem)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
@ -2366,7 +2385,7 @@ namespace SoF
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
IN(slot);
|
||||
emu->slot = static_cast<uint32>(SoFToServerCastingSlot(static_cast<CastingSlot>(eq->slot), eq->inventoryslot));
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = SoFToServerSlot(eq->inventoryslot);
|
||||
IN(target_id);
|
||||
@ -3355,4 +3374,75 @@ namespace SoF
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::PotionBelt;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation)
|
||||
{
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Ability:
|
||||
return EQEmu::CastingSlot::Ability;
|
||||
// Tit uses 10 for item and discipline casting, but items have a valid location
|
||||
case CastingSlot::Item:
|
||||
if (itemlocation == INVALID_INDEX)
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
else
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::PotionBelt:
|
||||
return EQEmu::CastingSlot::PotionBelt;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
} /*SoF*/
|
||||
|
||||
@ -50,6 +50,23 @@ namespace SoF
|
||||
#include "sof_ops.h"
|
||||
};
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Ability = 9,
|
||||
Item = 10,
|
||||
Discipline = 10,
|
||||
PotionBelt = 11,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
}; /*SoF*/
|
||||
|
||||
#endif /*COMMON_SOF_H*/
|
||||
|
||||
@ -57,6 +57,7 @@ E(OP_LeadershipExpUpdate)
|
||||
E(OP_LogServer)
|
||||
E(OP_LootItem)
|
||||
E(OP_ManaChange)
|
||||
E(OP_MemorizeSpell)
|
||||
E(OP_MoveItem)
|
||||
E(OP_NewSpawn)
|
||||
E(OP_NewZone)
|
||||
|
||||
@ -458,7 +458,7 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
//uint32 unknown12;
|
||||
uint32 reduction; // lowers reuse
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -58,6 +58,9 @@ namespace Titanium
|
||||
// client to server text link converter
|
||||
static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink);
|
||||
|
||||
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
|
||||
|
||||
void Register(EQStreamIdentifier &into)
|
||||
{
|
||||
auto Config = EQEmuConfig::get();
|
||||
@ -833,6 +836,22 @@ namespace Titanium
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_MemorizeSpell)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
|
||||
SETUP_DIRECT_ENCODE(MemorizeSpell_Struct, structs::MemorizeSpell_Struct);
|
||||
|
||||
// Since HT/LoH are translated up, we need to translate down only for memSpellSpellbar case
|
||||
if (emu->scribing == 3)
|
||||
eq->slot = static_cast<uint32>(ServerToTitaniumCastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
|
||||
else
|
||||
OUT(slot);
|
||||
OUT(spell_id);
|
||||
OUT(scribing);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_MoveItem)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
@ -1731,7 +1750,7 @@ namespace Titanium
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
IN(slot);
|
||||
emu->slot = static_cast<uint32>(TitaniumToServerCastingSlot(static_cast<CastingSlot>(eq->slot), eq->inventoryslot));
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = TitaniumToServerSlot(eq->inventoryslot);
|
||||
IN(target_id);
|
||||
@ -2487,4 +2506,75 @@ namespace Titanium
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::PotionBelt;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation)
|
||||
{
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Ability:
|
||||
return EQEmu::CastingSlot::Ability;
|
||||
// Tit uses 10 for item and discipline casting, but items have a valid location
|
||||
case CastingSlot::Item:
|
||||
if (itemlocation == INVALID_INDEX)
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
else
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::PotionBelt:
|
||||
return EQEmu::CastingSlot::PotionBelt;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
} /*Titanium*/
|
||||
|
||||
@ -50,6 +50,23 @@ namespace Titanium
|
||||
#include "titanium_ops.h"
|
||||
};
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Ability = 9,
|
||||
Item = 10,
|
||||
Discipline = 10,
|
||||
PotionBelt = 11,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
}; /*Titanium*/
|
||||
|
||||
#endif /*COMMON_TITANIUM_H*/
|
||||
|
||||
@ -50,6 +50,7 @@ E(OP_ItemPacket)
|
||||
E(OP_LeadershipExpUpdate)
|
||||
E(OP_LFGuild)
|
||||
E(OP_LootItem)
|
||||
E(OP_MemorizeSpell)
|
||||
E(OP_MoveItem)
|
||||
E(OP_OnLevelMessage)
|
||||
E(OP_PetBuffWindow)
|
||||
|
||||
@ -390,7 +390,7 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
uint32 unknown12;
|
||||
uint32 reduction; // lowers reuse
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -59,6 +59,9 @@ namespace UF
|
||||
// client to server text link converter
|
||||
static inline void UFToServerTextLink(std::string& serverTextLink, const std::string& ufTextLink);
|
||||
|
||||
static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot);
|
||||
|
||||
void Register(EQStreamIdentifier &into)
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
@ -3259,10 +3262,7 @@ namespace UF
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
|
||||
|
||||
if (eq->slot == 13)
|
||||
emu->slot = 10;
|
||||
else
|
||||
IN(slot);
|
||||
emu->slot = static_cast<uint32>(UFToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
|
||||
|
||||
IN(spell_id);
|
||||
emu->inventoryslot = UFToServerSlot(eq->inventoryslot);
|
||||
@ -4378,4 +4378,80 @@ namespace UF
|
||||
}
|
||||
}
|
||||
|
||||
static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case EQEmu::CastingSlot::Gem1:
|
||||
return CastingSlot::Gem1;
|
||||
case EQEmu::CastingSlot::Gem2:
|
||||
return CastingSlot::Gem2;
|
||||
case EQEmu::CastingSlot::Gem3:
|
||||
return CastingSlot::Gem3;
|
||||
case EQEmu::CastingSlot::Gem4:
|
||||
return CastingSlot::Gem4;
|
||||
case EQEmu::CastingSlot::Gem5:
|
||||
return CastingSlot::Gem5;
|
||||
case EQEmu::CastingSlot::Gem6:
|
||||
return CastingSlot::Gem6;
|
||||
case EQEmu::CastingSlot::Gem7:
|
||||
return CastingSlot::Gem7;
|
||||
case EQEmu::CastingSlot::Gem8:
|
||||
return CastingSlot::Gem8;
|
||||
case EQEmu::CastingSlot::Gem9:
|
||||
return CastingSlot::Gem9;
|
||||
case EQEmu::CastingSlot::Gem10:
|
||||
return CastingSlot::Gem10;
|
||||
case EQEmu::CastingSlot::Gem11:
|
||||
return CastingSlot::Gem11;
|
||||
case EQEmu::CastingSlot::Gem12:
|
||||
return CastingSlot::Gem12;
|
||||
case EQEmu::CastingSlot::Item:
|
||||
case EQEmu::CastingSlot::PotionBelt:
|
||||
return CastingSlot::Item;
|
||||
case EQEmu::CastingSlot::Discipline:
|
||||
return CastingSlot::Discipline;
|
||||
case EQEmu::CastingSlot::AltAbility:
|
||||
return CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
|
||||
static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot)
|
||||
{
|
||||
switch (slot) {
|
||||
case CastingSlot::Gem1:
|
||||
return EQEmu::CastingSlot::Gem1;
|
||||
case CastingSlot::Gem2:
|
||||
return EQEmu::CastingSlot::Gem2;
|
||||
case CastingSlot::Gem3:
|
||||
return EQEmu::CastingSlot::Gem3;
|
||||
case CastingSlot::Gem4:
|
||||
return EQEmu::CastingSlot::Gem4;
|
||||
case CastingSlot::Gem5:
|
||||
return EQEmu::CastingSlot::Gem5;
|
||||
case CastingSlot::Gem6:
|
||||
return EQEmu::CastingSlot::Gem6;
|
||||
case CastingSlot::Gem7:
|
||||
return EQEmu::CastingSlot::Gem7;
|
||||
case CastingSlot::Gem8:
|
||||
return EQEmu::CastingSlot::Gem8;
|
||||
case CastingSlot::Gem9:
|
||||
return EQEmu::CastingSlot::Gem9;
|
||||
case CastingSlot::Gem10:
|
||||
return EQEmu::CastingSlot::Gem10;
|
||||
case CastingSlot::Gem11:
|
||||
return EQEmu::CastingSlot::Gem11;
|
||||
case CastingSlot::Gem12:
|
||||
return EQEmu::CastingSlot::Gem12;
|
||||
case CastingSlot::Discipline:
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
case CastingSlot::Item:
|
||||
return EQEmu::CastingSlot::Item;
|
||||
case CastingSlot::AltAbility:
|
||||
return EQEmu::CastingSlot::AltAbility;
|
||||
default: // we shouldn't have any issues with other slots ... just return something
|
||||
return EQEmu::CastingSlot::Discipline;
|
||||
}
|
||||
}
|
||||
} /*UF*/
|
||||
|
||||
@ -50,6 +50,24 @@ namespace UF
|
||||
#include "uf_ops.h"
|
||||
};
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Gem10 = 9,
|
||||
Gem11 = 10,
|
||||
Gem12 = 11,
|
||||
Item = 12,
|
||||
Discipline = 13,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
}; /*UF*/
|
||||
|
||||
#endif /*COMMON_UF_H*/
|
||||
|
||||
@ -479,7 +479,7 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
//uint32 unknown12;
|
||||
uint32 reduction; // lowers reuse
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -1483,7 +1483,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++)
|
||||
pp.spell_book[i] = 0xFFFFFFFF;
|
||||
|
||||
for(i = 0; i < MAX_PP_REF_MEMSPELL; i++)
|
||||
for(i = 0; i < MAX_PP_MEMSPELL; i++)
|
||||
pp.mem_spells[i] = 0xFFFFFFFF;
|
||||
|
||||
for(i = 0; i < BUFF_COUNT; i++)
|
||||
|
||||
@ -1183,12 +1183,12 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) {
|
||||
CommonBreakInvisible();
|
||||
// Bards can cast instant cast AAs while they are casting another song
|
||||
if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) {
|
||||
if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), ALTERNATE_ABILITY_SPELL_SLOT, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) {
|
||||
if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), EQEmu::CastingSlot::AltAbility, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) {
|
||||
return;
|
||||
}
|
||||
ExpendAlternateAdvancementCharge(ability->id);
|
||||
} else {
|
||||
if(!CastSpell(rank->spell, target_id, ALTERNATE_ABILITY_SPELL_SLOT, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, nullptr, rank->id)) {
|
||||
if(!CastSpell(rank->spell, target_id, EQEmu::CastingSlot::AltAbility, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, nullptr, rank->id)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1205,7 +1205,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|
||||
IsValidSpell(aabonuses.SkillAttackProc[2])) {
|
||||
float chance = aabonuses.SkillAttackProc[0] / 1000.0f;
|
||||
if (zone->random.Roll(chance))
|
||||
SpellFinished(aabonuses.SkillAttackProc[2], other, 10, 0, -1,
|
||||
SpellFinished(aabonuses.SkillAttackProc[2], other, EQEmu::CastingSlot::Item, 0, -1,
|
||||
spells[aabonuses.SkillAttackProc[2]].ResistDiff);
|
||||
}
|
||||
other->Damage(this, damage, SPELL_UNKNOWN, skillinuse, true, -1, false, special);
|
||||
@ -1821,7 +1821,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
|
||||
if(IsLDoNTrapped())
|
||||
{
|
||||
Message_StringID(13, LDON_ACCIDENT_SETOFF2);
|
||||
SpellFinished(GetLDoNTrapSpellID(), other, 10, 0, -1, spells[GetLDoNTrapSpellID()].ResistDiff, false);
|
||||
SpellFinished(GetLDoNTrapSpellID(), other, EQEmu::CastingSlot::Item, 0, -1, spells[GetLDoNTrapSpellID()].ResistDiff, false);
|
||||
SetLDoNTrapSpellID(0);
|
||||
SetLDoNTrapped(false);
|
||||
SetLDoNTrapDetected(false);
|
||||
|
||||
26
zone/bot.cpp
26
zone/bot.cpp
@ -2085,7 +2085,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills:
|
||||
CheckNumHitsRemaining(NumHit::OutgoingHitSuccess);
|
||||
|
||||
if ((skillinuse == EQEmu::skills::SkillDragonPunch) && GetAA(aaDragonPunch) && zone->random.Int(0, 99) < 25){
|
||||
SpellFinished(904, other, 10, 0, -1, spells[904].ResistDiff);
|
||||
SpellFinished(904, other, EQEmu::CastingSlot::Item, 0, -1, spells[904].ResistDiff);
|
||||
other->Stun(100);
|
||||
}
|
||||
|
||||
@ -5900,7 +5900,7 @@ void Bot::DoBuffTic(const Buffs_Struct &buff, int slot, Mob* caster) {
|
||||
Mob::DoBuffTic(buff, slot, caster);
|
||||
}
|
||||
|
||||
bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost,
|
||||
bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot, int32 cast_time, int32 mana_cost,
|
||||
uint32* oSpellWillFinish, uint32 item_slot, int16 *resist_adjust, uint32 aa_id) {
|
||||
bool Result = false;
|
||||
if(zone && !zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))) {
|
||||
@ -5920,7 +5920,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
|
||||
Message_StringID(13, MELEE_SILENCE);
|
||||
|
||||
if(casting_spell_id)
|
||||
AI_Event_SpellCastFinished(false, casting_spell_slot);
|
||||
AI_Event_SpellCastFinished(false, static_cast<uint16>(casting_spell_slot));
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -5929,7 +5929,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
|
||||
if(IsDetrimentalSpell(spell_id) && !zone->CanDoCombat()){
|
||||
Message_StringID(13, SPELL_WOULDNT_HOLD);
|
||||
if(casting_spell_id)
|
||||
AI_Event_SpellCastFinished(false, casting_spell_slot);
|
||||
AI_Event_SpellCastFinished(false, static_cast<uint16>(casting_spell_slot));
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -5940,7 +5940,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
|
||||
return false;
|
||||
}
|
||||
|
||||
if(slot < MAX_PP_MEMSPELL && !CheckFizzle(spell_id)) {
|
||||
if(slot < EQEmu::CastingSlot::MaxGems && !CheckFizzle(spell_id)) {
|
||||
int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE;
|
||||
InterruptSpell(fizzle_msg, 0x121, spell_id);
|
||||
|
||||
@ -5954,7 +5954,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong);
|
||||
bardsong = 0;
|
||||
bardsong_target_id = 0;
|
||||
bardsong_slot = 0;
|
||||
bardsong_slot = EQEmu::CastingSlot::Gem1;
|
||||
bardsong_timer.Disable();
|
||||
}
|
||||
|
||||
@ -6084,7 +6084,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, uint16 slot) {
|
||||
bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQEmu::CastingSlot slot) {
|
||||
bool Result = false;
|
||||
SpellTargetType targetType = spells[spell_id].targettype;
|
||||
if(targetType == ST_GroupClientAndPet) {
|
||||
@ -6097,7 +6097,7 @@ bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
|
||||
return Result;
|
||||
}
|
||||
|
||||
bool Bot::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 aa_id) {
|
||||
bool Bot::DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 aa_id) {
|
||||
bool Result = false;
|
||||
if(GetClass() == BARD)
|
||||
cast_time = 0;
|
||||
@ -6201,7 +6201,7 @@ void Bot::GenerateSpecialAttacks() {
|
||||
SetSpecialAbility(SPECATK_TRIPLE, 1);
|
||||
}
|
||||
|
||||
bool Bot::DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, uint16 slot, bool& stopLogic) {
|
||||
bool Bot::DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool& stopLogic) {
|
||||
if(GetClass() == BARD) {
|
||||
if(!ApplyNextBardPulse(bardsong, this, bardsong_slot))
|
||||
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
|
||||
@ -6211,7 +6211,7 @@ bool Bot::DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, uint16 slot
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, uint16 slot, bool& stopLogic) {
|
||||
bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool& stopLogic) {
|
||||
if(spellTarget) {
|
||||
if(IsGrouped() && (spellTarget->IsBot() || spellTarget->IsClient()) && RuleB(Bots, GroupBuffing)) {
|
||||
bool noGroupSpell = false;
|
||||
@ -6223,7 +6223,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, uint16
|
||||
bool spelltypeequal = ((spelltype == 2) || (spelltype == 16) || (spelltype == 32));
|
||||
bool spelltypetargetequal = ((spelltype == 8) && (spells[thespell].targettype == ST_Self));
|
||||
bool spelltypeclassequal = ((spelltype == 1024) && (GetClass() == SHAMAN));
|
||||
bool slotequal = (slot == USE_ITEM_SPELL_SLOT);
|
||||
bool slotequal = (slot == EQEmu::CastingSlot::Item);
|
||||
if(spellequal || slotequal) {
|
||||
if((spelltypeequal || spelltypetargetequal) || spelltypeclassequal || slotequal) {
|
||||
if(((spells[thespell].effectid[0] == 0) && (spells[thespell].base[0] < 0)) &&
|
||||
@ -6262,7 +6262,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, uint16
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bot::DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, uint16 slot, bool& stopLogic) {
|
||||
bool Bot::DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool& stopLogic) {
|
||||
bool isMainGroupMGB = false;
|
||||
if(isMainGroupMGB && (GetClass() != BARD)) {
|
||||
BotGroupSay(this, "MGB %s", spells[spell_id].name);
|
||||
@ -8251,7 +8251,7 @@ bool Bot::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
if(IsCasting())
|
||||
InterruptSpell();
|
||||
|
||||
CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT);
|
||||
CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
12
zone/bot.h
12
zone/bot.h
@ -274,9 +274,9 @@ public:
|
||||
virtual void SetAttackTimer();
|
||||
uint32 GetClassHPFactor();
|
||||
virtual int32 CalcMaxHP();
|
||||
bool DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, uint16 slot, bool &stopLogic);
|
||||
bool DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, uint16 slot, bool &stopLogic);
|
||||
bool DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, uint16 slot, bool &stopLogic);
|
||||
bool DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool &stopLogic);
|
||||
bool DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool &stopLogic);
|
||||
bool DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQEmu::CastingSlot slot, bool &stopLogic);
|
||||
void SendBotArcheryWearChange(uint8 material_slot, uint32 material, uint32 color);
|
||||
void Camp(bool databaseSave = true);
|
||||
virtual void AddToHateList(Mob* other, uint32 hate = 0, int32 damage = 0, bool iYellForHelp = true, bool bFrenzy = false, bool iBuffTic = false);
|
||||
@ -374,12 +374,12 @@ public:
|
||||
virtual float GetAOERange(uint16 spell_id);
|
||||
virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100);
|
||||
virtual void DoBuffTic(const Buffs_Struct &buff, int slot, Mob* caster = nullptr);
|
||||
virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = USE_ITEM_SPELL_SLOT, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0,
|
||||
virtual bool CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0,
|
||||
uint32 item_slot = 0xFFFFFFFF, int16 *resist_adjust = nullptr, uint32 aa_id = 0);
|
||||
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar);
|
||||
virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster);
|
||||
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, uint16 slot);
|
||||
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = USE_ITEM_SPELL_SLOT, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 aa_id = 0);
|
||||
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQEmu::CastingSlot slot);
|
||||
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 aa_id = 0);
|
||||
|
||||
// Bot Equipment & Inventory Class Methods
|
||||
void BotTradeSwapItem(Client* client, int16 lootSlot, const ItemInst* inst, const ItemInst* inst_swap, uint32 equipableSlots, std::string* errorMessage, bool swap = true);
|
||||
|
||||
@ -7613,7 +7613,7 @@ bool helper_cast_standard_spell(Bot* casting_bot, Mob* target_mob, int spell_id,
|
||||
if (annouce_cast)
|
||||
Bot::BotGroupSay(casting_bot, "Attempting to cast '%s' on %s", spells[spell_id].name, target_mob->GetCleanName());
|
||||
|
||||
return casting_bot->CastSpell(spell_id, target_mob->GetID(), 1, -1, -1, dont_root_before);
|
||||
return casting_bot->CastSpell(spell_id, target_mob->GetID(), EQEmu::CastingSlot::Gem2, -1, -1, dont_root_before);
|
||||
}
|
||||
|
||||
bool helper_command_alias_fail(Client *bot_owner, const char* command_handler, const char *alias, const char *command)
|
||||
|
||||
@ -4604,7 +4604,7 @@ void Client::HandleLDoNOpen(NPC *target)
|
||||
if(target->GetLDoNTrapSpellID() != 0)
|
||||
{
|
||||
Message_StringID(13, LDON_ACCIDENT_SETOFF2);
|
||||
target->SpellFinished(target->GetLDoNTrapSpellID(), this, 10, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff);
|
||||
target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff);
|
||||
target->SetLDoNTrapSpellID(0);
|
||||
target->SetLDoNTrapped(false);
|
||||
target->SetLDoNTrapDetected(false);
|
||||
@ -4726,7 +4726,7 @@ void Client::HandleLDoNDisarm(NPC *target, uint16 skill, uint8 type)
|
||||
break;
|
||||
case -1:
|
||||
Message_StringID(13, LDON_ACCIDENT_SETOFF2);
|
||||
target->SpellFinished(target->GetLDoNTrapSpellID(), this, 10, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff);
|
||||
target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff);
|
||||
target->SetLDoNTrapSpellID(0);
|
||||
target->SetLDoNTrapped(false);
|
||||
target->SetLDoNTrapDetected(false);
|
||||
@ -4745,7 +4745,7 @@ void Client::HandleLDoNPickLock(NPC *target, uint16 skill, uint8 type)
|
||||
if(target->IsLDoNTrapped())
|
||||
{
|
||||
Message_StringID(13, LDON_ACCIDENT_SETOFF2);
|
||||
target->SpellFinished(target->GetLDoNTrapSpellID(), this, 10, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff);
|
||||
target->SpellFinished(target->GetLDoNTrapSpellID(), this, EQEmu::CastingSlot::Item, 0, -1, spells[target->GetLDoNTrapSpellID()].ResistDiff);
|
||||
target->SetLDoNTrapSpellID(0);
|
||||
target->SetLDoNTrapped(false);
|
||||
target->SetLDoNTrapDetected(false);
|
||||
|
||||
@ -105,6 +105,7 @@ enum { //Type arguments to the Message* routines.
|
||||
|
||||
#define SPELLBAR_UNLOCK 0x2bc
|
||||
enum { //scribing argument to MemorizeSpell
|
||||
memSpellUnknown = -1, // this modifies some state data
|
||||
memSpellScribing = 0,
|
||||
memSpellMemorize = 1,
|
||||
memSpellForget = 2,
|
||||
|
||||
@ -3966,6 +3966,7 @@ void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app)
|
||||
|
||||
void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
{
|
||||
using EQEmu::CastingSlot;
|
||||
if (app->size != sizeof(CastSpell_Struct)) {
|
||||
std::cout << "Wrong size: OP_CastSpell, size=" << app->size << ", expected " << sizeof(CastSpell_Struct) << std::endl;
|
||||
return;
|
||||
@ -3978,13 +3979,13 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
|
||||
CastSpell_Struct* castspell = (CastSpell_Struct*)app->pBuffer;
|
||||
|
||||
m_TargetRing = glm::vec3(castspell->x_pos, castspell->y_pos, castspell->z_pos);
|
||||
m_TargetRing = glm::vec3(castspell->x_pos, castspell->y_pos, castspell->z_pos);
|
||||
|
||||
Log.Out(Logs::General, Logs::Spells, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot);
|
||||
CastingSlot slot = static_cast<CastingSlot>(castspell->slot);
|
||||
|
||||
/* Memorized Spell */
|
||||
if (m_pp.mem_spells[castspell->slot] && m_pp.mem_spells[castspell->slot] == castspell->spell_id){
|
||||
|
||||
if (m_pp.mem_spells[castspell->slot] && m_pp.mem_spells[castspell->slot] == castspell->spell_id) {
|
||||
uint16 spell_to_cast = 0;
|
||||
if (castspell->slot < MAX_PP_MEMSPELL) {
|
||||
spell_to_cast = m_pp.mem_spells[castspell->slot];
|
||||
@ -3998,20 +3999,12 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
CastSpell(spell_to_cast, castspell->target_id, castspell->slot);
|
||||
CastSpell(spell_to_cast, castspell->target_id, slot);
|
||||
}
|
||||
/* Spell Slot or Potion Belt Slot */
|
||||
else if ((castspell->slot == USE_ITEM_SPELL_SLOT) || (castspell->slot == POTION_BELT_SPELL_SLOT)|| (castspell->slot == TARGET_RING_SPELL_SLOT)) // ITEM or POTION cast
|
||||
else if (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt) // ITEM or POTION cast
|
||||
{
|
||||
//discipline, using the item spell slot
|
||||
if (castspell->inventoryslot == INVALID_INDEX) {
|
||||
if (!UseDiscipline(castspell->spell_id, castspell->target_id)) {
|
||||
Log.Out(Logs::General, Logs::Spells, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id);
|
||||
InterruptSpell(castspell->spell_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (m_inv.SupportsClickCasting(castspell->inventoryslot) || (castspell->slot == POTION_BELT_SPELL_SLOT) || (castspell->slot == TARGET_RING_SPELL_SLOT)) // sanity check
|
||||
if (m_inv.SupportsClickCasting(castspell->inventoryslot) || slot == CastingSlot::PotionBelt) // sanity check
|
||||
{
|
||||
// packet field types will be reviewed as packet transistions occur
|
||||
const ItemInst* inst = m_inv[castspell->inventoryslot]; //slot values are int16, need to check packet on this field
|
||||
@ -4036,7 +4029,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot);
|
||||
|
||||
if (i == 0) {
|
||||
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
||||
CastSpell(item->Click.Effect, castspell->target_id, slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
||||
}
|
||||
else {
|
||||
InterruptSpell(castspell->spell_id);
|
||||
@ -4056,7 +4049,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot);
|
||||
|
||||
if (i == 0) {
|
||||
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
||||
CastSpell(item->Click.Effect, castspell->target_id, slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
||||
}
|
||||
else {
|
||||
InterruptSpell(castspell->spell_id);
|
||||
@ -4081,8 +4074,8 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
InterruptSpell(castspell->spell_id);
|
||||
}
|
||||
}
|
||||
/* Discipline */
|
||||
else if (castspell->slot == DISCIPLINE_SPELL_SLOT) {
|
||||
/* Discipline -- older clients use the same slot as items, but we translate to it's own */
|
||||
else if (slot == CastingSlot::Discipline) {
|
||||
if (!UseDiscipline(castspell->spell_id, castspell->target_id)) {
|
||||
Log.Out(Logs::General, Logs::Spells, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id);
|
||||
InterruptSpell(castspell->spell_id);
|
||||
@ -4090,7 +4083,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
}
|
||||
}
|
||||
/* ABILITY cast (LoH and Harm Touch) */
|
||||
else if (castspell->slot == ABILITY_SPELL_SLOT) {
|
||||
else if (slot == CastingSlot::Ability) {
|
||||
uint16 spell_to_cast = 0;
|
||||
|
||||
if (castspell->spell_id == SPELL_LAY_ON_HANDS && GetClass() == PALADIN) {
|
||||
@ -4120,7 +4113,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
if (spell_to_cast > 0) // if we've matched LoH or HT, cast now
|
||||
CastSpell(spell_to_cast, castspell->target_id, castspell->slot);
|
||||
CastSpell(spell_to_cast, castspell->target_id, slot);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -8410,6 +8403,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app)
|
||||
|
||||
void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
||||
{
|
||||
using EQEmu::CastingSlot;
|
||||
if (app->size != sizeof(ItemVerifyRequest_Struct))
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size);
|
||||
@ -8554,7 +8548,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
||||
if (i == 0) {
|
||||
if (!IsCastWhileInvis(item->Click.Effect))
|
||||
CommonBreakInvisible(); // client can't do this for us :(
|
||||
CastSpell(item->Click.Effect, target_id, USE_ITEM_SPELL_SLOT, item->CastTime, 0, 0, slot_id);
|
||||
CastSpell(item->Click.Effect, target_id, CastingSlot::Item, item->CastTime, 0, 0, slot_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -8583,7 +8577,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
||||
if (i == 0) {
|
||||
if (!IsCastWhileInvis(augitem->Click.Effect))
|
||||
CommonBreakInvisible(); // client can't do this for us :(
|
||||
CastSpell(augitem->Click.Effect, target_id, USE_ITEM_SPELL_SLOT, augitem->CastTime, 0, 0, slot_id);
|
||||
CastSpell(augitem->Click.Effect, target_id, CastingSlot::Item, augitem->CastTime, 0, 0, slot_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -2199,14 +2199,14 @@ void command_castspell(Client *c, const Seperator *sep)
|
||||
else
|
||||
if (c->GetTarget() == 0)
|
||||
if(c->Admin() >= commandInstacast)
|
||||
c->SpellFinished(spellid, 0, USE_ITEM_SPELL_SLOT, 0, -1, spells[spellid].ResistDiff);
|
||||
c->SpellFinished(spellid, 0, EQEmu::CastingSlot::Item, 0, -1, spells[spellid].ResistDiff);
|
||||
else
|
||||
c->CastSpell(spellid, 0, USE_ITEM_SPELL_SLOT, 0);
|
||||
c->CastSpell(spellid, 0, EQEmu::CastingSlot::Item, 0);
|
||||
else
|
||||
if(c->Admin() >= commandInstacast)
|
||||
c->SpellFinished(spellid, c->GetTarget(), 10, 0, -1, spells[spellid].ResistDiff);
|
||||
c->SpellFinished(spellid, c->GetTarget(), EQEmu::CastingSlot::Item, 0, -1, spells[spellid].ResistDiff);
|
||||
else
|
||||
c->CastSpell(spellid, c->GetTarget()->GetID(), USE_ITEM_SPELL_SLOT, 0);
|
||||
c->CastSpell(spellid, c->GetTarget()->GetID(), EQEmu::CastingSlot::Item, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,13 +17,6 @@
|
||||
#define _NPCPET(x) (x && x->IsNPC() && x->CastToMob()->GetOwner() && x->CastToMob()->GetOwner()->IsNPC())
|
||||
#define _BECOMENPCPET(x) (x && x->CastToMob()->GetOwner() && x->CastToMob()->GetOwner()->IsClient() && x->CastToMob()->GetOwner()->CastToClient()->IsBecomeNPC())
|
||||
|
||||
#define USE_ITEM_SPELL_SLOT 10
|
||||
#define POTION_BELT_SPELL_SLOT 11
|
||||
#define TARGET_RING_SPELL_SLOT 12
|
||||
#define DISCIPLINE_SPELL_SLOT 10
|
||||
#define ABILITY_SPELL_SLOT 9
|
||||
#define ALTERNATE_ABILITY_SPELL_SLOT 0xFF
|
||||
|
||||
//LOS Parameters:
|
||||
#define HEAD_POSITION 0.9f //ratio of GetSize() where NPCs see from
|
||||
#define SEE_POSITION 0.5f //ratio of GetSize() where NPCs try to see for LOS
|
||||
|
||||
@ -684,9 +684,9 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
}
|
||||
|
||||
if (reduced_recast > 0)
|
||||
CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast);
|
||||
CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast);
|
||||
else{
|
||||
CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT);
|
||||
CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -694,7 +694,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
}
|
||||
else
|
||||
{
|
||||
CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT);
|
||||
CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
@ -759,28 +759,28 @@ bool Lua_Mob::CastSpell(int spell_id, int target_id) {
|
||||
|
||||
bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->CastSpell(spell_id, target_id, slot);
|
||||
return self->CastSpell(spell_id, target_id, static_cast<EQEmu::CastingSlot>(slot));
|
||||
}
|
||||
|
||||
bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->CastSpell(spell_id, target_id, slot, cast_time);
|
||||
return self->CastSpell(spell_id, target_id, static_cast<EQEmu::CastingSlot>(slot), cast_time);
|
||||
}
|
||||
|
||||
bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost);
|
||||
return self->CastSpell(spell_id, target_id, static_cast<EQEmu::CastingSlot>(slot), cast_time, mana_cost);
|
||||
}
|
||||
|
||||
bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast<uint32>(item_slot));
|
||||
return self->CastSpell(spell_id, target_id, static_cast<EQEmu::CastingSlot>(slot), cast_time, mana_cost, nullptr, static_cast<uint32>(item_slot));
|
||||
}
|
||||
|
||||
bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer,
|
||||
int timer_duration) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast<uint32>(item_slot),
|
||||
return self->CastSpell(spell_id, target_id, static_cast<EQEmu::CastingSlot>(slot), cast_time, mana_cost, nullptr, static_cast<uint32>(item_slot),
|
||||
static_cast<uint32>(timer), static_cast<uint32>(timer_duration));
|
||||
}
|
||||
|
||||
@ -789,7 +789,7 @@ bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, in
|
||||
Lua_Safe_Call_Bool();
|
||||
int16 res = resist_adjust;
|
||||
|
||||
return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast<uint32>(item_slot),
|
||||
return self->CastSpell(spell_id, target_id, static_cast<EQEmu::CastingSlot>(slot), cast_time, mana_cost, nullptr, static_cast<uint32>(item_slot),
|
||||
static_cast<uint32>(timer), static_cast<uint32>(timer_duration), &res);
|
||||
}
|
||||
|
||||
@ -800,27 +800,27 @@ bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target) {
|
||||
|
||||
bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->SpellFinished(spell_id, target, slot);
|
||||
return self->SpellFinished(spell_id, target, static_cast<EQEmu::CastingSlot>(slot));
|
||||
}
|
||||
|
||||
bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->SpellFinished(spell_id, target, slot, mana_used);
|
||||
return self->SpellFinished(spell_id, target, static_cast<EQEmu::CastingSlot>(slot), mana_used);
|
||||
}
|
||||
|
||||
bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->SpellFinished(spell_id, target, slot, mana_used, inventory_slot);
|
||||
return self->SpellFinished(spell_id, target, static_cast<EQEmu::CastingSlot>(slot), mana_used, inventory_slot);
|
||||
}
|
||||
|
||||
bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->SpellFinished(spell_id, target, slot, mana_used, inventory_slot, resist_adjust);
|
||||
return self->SpellFinished(spell_id, target, static_cast<EQEmu::CastingSlot>(slot), mana_used, inventory_slot, resist_adjust);
|
||||
}
|
||||
|
||||
bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust, bool proc) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->SpellFinished(spell_id, target, slot, mana_used, inventory_slot, resist_adjust, proc);
|
||||
return self->SpellFinished(spell_id, target, static_cast<EQEmu::CastingSlot>(slot), mana_used, inventory_slot, resist_adjust, proc);
|
||||
}
|
||||
|
||||
void Lua_Mob::SpellEffect(Lua_Mob caster, int spell_id, double partial) {
|
||||
|
||||
@ -1963,7 +1963,7 @@ bool Merc::AIDoSpellCast(uint16 spellid, Mob* tar, int32 mana_cost, uint32* oDon
|
||||
SendPosition();
|
||||
SetMoving(false);
|
||||
|
||||
result = CastSpell(spellid, tar->GetID(), 1, -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, 0);
|
||||
result = CastSpell(spellid, tar->GetID(), EQEmu::CastingSlot::Gem2, -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, 0);
|
||||
|
||||
if(IsCasting() && IsSitting())
|
||||
Stand();
|
||||
@ -4015,7 +4015,7 @@ bool Merc::UseDiscipline(int32 spell_id, int32 target) {
|
||||
if(IsCasting())
|
||||
InterruptSpell();
|
||||
|
||||
CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT);
|
||||
CastSpell(spell_id, target, EQEmu::CastingSlot::Discipline);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
51
zone/mob.cpp
51
zone/mob.cpp
@ -3225,12 +3225,12 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on, int lev
|
||||
twinproc = true;
|
||||
|
||||
if (IsBeneficialSpell(spell_id)) {
|
||||
SpellFinished(spell_id, this, 10, 0, -1, spells[spell_id].ResistDiff, true, level_override);
|
||||
SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff, true, level_override);
|
||||
if(twinproc)
|
||||
SpellOnTarget(spell_id, this, false, false, 0, true, level_override);
|
||||
}
|
||||
else if(!(on->IsClient() && on->CastToClient()->dead)) { //dont proc on dead clients
|
||||
SpellFinished(spell_id, on, 10, 0, -1, spells[spell_id].ResistDiff, true, level_override);
|
||||
SpellFinished(spell_id, on, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff, true, level_override);
|
||||
if(twinproc)
|
||||
SpellOnTarget(spell_id, on, false, false, 0, true, level_override);
|
||||
}
|
||||
@ -3518,10 +3518,9 @@ void Mob::TryTriggerOnCast(uint32 spell_id, bool aa_trigger)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger)
|
||||
{
|
||||
if(!IsValidSpell(focus_spell) || !IsValidSpell(spell_id))
|
||||
if (!IsValidSpell(focus_spell) || !IsValidSpell(spell_id))
|
||||
return;
|
||||
|
||||
uint32 trigger_spell_id = 0;
|
||||
@ -3532,15 +3531,17 @@ void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger)
|
||||
if (rank)
|
||||
trigger_spell_id = CastToClient()->CalcAAFocus(focusTriggerOnCast, *rank, spell_id);
|
||||
|
||||
if(IsValidSpell(trigger_spell_id) && GetTarget())
|
||||
SpellFinished(trigger_spell_id, GetTarget(), 10, 0, -1, spells[trigger_spell_id].ResistDiff);
|
||||
if (IsValidSpell(trigger_spell_id) && GetTarget())
|
||||
SpellFinished(trigger_spell_id, GetTarget(), EQEmu::CastingSlot::Item, 0, -1,
|
||||
spells[trigger_spell_id].ResistDiff);
|
||||
}
|
||||
|
||||
else{
|
||||
else {
|
||||
trigger_spell_id = CalcFocusEffect(focusTriggerOnCast, focus_spell, spell_id);
|
||||
|
||||
if(IsValidSpell(trigger_spell_id) && GetTarget()){
|
||||
SpellFinished(trigger_spell_id, GetTarget(),10, 0, -1, spells[trigger_spell_id].ResistDiff);
|
||||
if (IsValidSpell(trigger_spell_id) && GetTarget()) {
|
||||
SpellFinished(trigger_spell_id, GetTarget(), EQEmu::CastingSlot::Item, 0, -1,
|
||||
spells[trigger_spell_id].ResistDiff);
|
||||
CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell);
|
||||
}
|
||||
}
|
||||
@ -3570,7 +3571,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
|
||||
{
|
||||
// If we trigger an effect then its over.
|
||||
if (IsValidSpell(spells[spell_id].base2[i])){
|
||||
SpellFinished(spells[spell_id].base2[i], target, 10, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff);
|
||||
SpellFinished(spells[spell_id].base2[i], target, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3589,7 +3590,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
|
||||
if(zone->random.Int(0, 100) <= spells[spell_id].base[effect])
|
||||
{
|
||||
if (IsValidSpell(spells[spell_id].base2[effect])){
|
||||
SpellFinished(spells[spell_id].base2[effect], target, 10, 0, -1, spells[spells[spell_id].base2[effect]].ResistDiff);
|
||||
SpellFinished(spells[spell_id].base2[effect], target, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[effect]].ResistDiff);
|
||||
return true; //Only trigger once of these per spell effect.
|
||||
}
|
||||
}
|
||||
@ -3666,7 +3667,7 @@ void Mob::TryTriggerOnValueAmount(bool IsHP, bool IsMana, bool IsEndur, bool IsP
|
||||
}
|
||||
|
||||
if (use_spell){
|
||||
SpellFinished(spells[spell_id].base[i], this, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
SpellFinished(spells[spell_id].base[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
|
||||
if(!TryFadeEffect(e))
|
||||
BuffFadeBySlot(e);
|
||||
@ -3694,7 +3695,7 @@ void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
|
||||
if(zone->random.Roll(focus))
|
||||
{
|
||||
Message(MT_Spells,"You twincast %s!",spells[spell_id].name);
|
||||
SpellFinished(spell_id, target, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
SpellFinished(spell_id, target, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3712,7 +3713,7 @@ void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
|
||||
{
|
||||
if(zone->random.Roll(focus))
|
||||
{
|
||||
SpellFinished(spell_id, target, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
SpellFinished(spell_id, target, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3831,10 +3832,10 @@ bool Mob::TryFadeEffect(int slot)
|
||||
if(IsValidSpell(spell_id))
|
||||
{
|
||||
if (IsBeneficialSpell(spell_id)) {
|
||||
SpellFinished(spell_id, this, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
else if(!(IsClient() && CastToClient()->dead)) {
|
||||
SpellFinished(spell_id, this, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -3868,7 +3869,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
|
||||
SpellFinished(focus_trigger, target);
|
||||
|
||||
else
|
||||
SpellFinished(focus_trigger, this, 10, 0, -1, spells[focus_trigger].ResistDiff);
|
||||
SpellFinished(focus_trigger, this, EQEmu::CastingSlot::Item, 0, -1, spells[focus_trigger].ResistDiff);
|
||||
}
|
||||
// For detrimental spells, if the triggered spell is beneficial, then it will land on the caster
|
||||
// if the triggered spell is also detrimental, then it will land on the target
|
||||
@ -3878,7 +3879,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
|
||||
SpellFinished(focus_trigger, this);
|
||||
|
||||
else
|
||||
SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff);
|
||||
SpellFinished(focus_trigger, target, EQEmu::CastingSlot::Item, 0, -1, spells[focus_trigger].ResistDiff);
|
||||
}
|
||||
|
||||
CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell);
|
||||
@ -4529,7 +4530,7 @@ void Mob::TrySpellOnKill(uint8 level, uint16 spell_id)
|
||||
if (IsValidSpell(spells[spell_id].base2[i]) && spells[spell_id].max[i] <= level)
|
||||
{
|
||||
if(zone->random.Roll(spells[spell_id].base[i]))
|
||||
SpellFinished(spells[spell_id].base2[i], this, 10, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff);
|
||||
SpellFinished(spells[spell_id].base2[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4544,17 +4545,17 @@ void Mob::TrySpellOnKill(uint8 level, uint16 spell_id)
|
||||
|
||||
if(aabonuses.SpellOnKill[i] && IsValidSpell(aabonuses.SpellOnKill[i]) && (level >= aabonuses.SpellOnKill[i + 2])) {
|
||||
if(zone->random.Roll(static_cast<int>(aabonuses.SpellOnKill[i + 1])))
|
||||
SpellFinished(aabonuses.SpellOnKill[i], this, 10, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff);
|
||||
SpellFinished(aabonuses.SpellOnKill[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff);
|
||||
}
|
||||
|
||||
if(itembonuses.SpellOnKill[i] && IsValidSpell(itembonuses.SpellOnKill[i]) && (level >= itembonuses.SpellOnKill[i + 2])){
|
||||
if(zone->random.Roll(static_cast<int>(itembonuses.SpellOnKill[i + 1])))
|
||||
SpellFinished(itembonuses.SpellOnKill[i], this, 10, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff);
|
||||
SpellFinished(itembonuses.SpellOnKill[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff);
|
||||
}
|
||||
|
||||
if(spellbonuses.SpellOnKill[i] && IsValidSpell(spellbonuses.SpellOnKill[i]) && (level >= spellbonuses.SpellOnKill[i + 2])) {
|
||||
if(zone->random.Roll(static_cast<int>(spellbonuses.SpellOnKill[i + 1])))
|
||||
SpellFinished(spellbonuses.SpellOnKill[i], this, 10, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff);
|
||||
SpellFinished(spellbonuses.SpellOnKill[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff);
|
||||
}
|
||||
|
||||
}
|
||||
@ -4571,19 +4572,19 @@ bool Mob::TrySpellOnDeath()
|
||||
for(int i = 0; i < MAX_SPELL_TRIGGER*2; i+=2) {
|
||||
if(IsClient() && aabonuses.SpellOnDeath[i] && IsValidSpell(aabonuses.SpellOnDeath[i])) {
|
||||
if(zone->random.Roll(static_cast<int>(aabonuses.SpellOnDeath[i + 1]))) {
|
||||
SpellFinished(aabonuses.SpellOnDeath[i], this, 10, 0, -1, spells[aabonuses.SpellOnDeath[i]].ResistDiff);
|
||||
SpellFinished(aabonuses.SpellOnDeath[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[aabonuses.SpellOnDeath[i]].ResistDiff);
|
||||
}
|
||||
}
|
||||
|
||||
if(itembonuses.SpellOnDeath[i] && IsValidSpell(itembonuses.SpellOnDeath[i])) {
|
||||
if(zone->random.Roll(static_cast<int>(itembonuses.SpellOnDeath[i + 1]))) {
|
||||
SpellFinished(itembonuses.SpellOnDeath[i], this, 10, 0, -1, spells[itembonuses.SpellOnDeath[i]].ResistDiff);
|
||||
SpellFinished(itembonuses.SpellOnDeath[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[itembonuses.SpellOnDeath[i]].ResistDiff);
|
||||
}
|
||||
}
|
||||
|
||||
if(spellbonuses.SpellOnDeath[i] && IsValidSpell(spellbonuses.SpellOnDeath[i])) {
|
||||
if(zone->random.Roll(static_cast<int>(spellbonuses.SpellOnDeath[i + 1]))) {
|
||||
SpellFinished(spellbonuses.SpellOnDeath[i], this, 10, 0, -1, spells[spellbonuses.SpellOnDeath[i]].ResistDiff);
|
||||
SpellFinished(spellbonuses.SpellOnDeath[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spellbonuses.SpellOnDeath[i]].ResistDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
zone/mob.h
17
zone/mob.h
@ -26,6 +26,7 @@
|
||||
#include "aa_ability.h"
|
||||
#include "aa.h"
|
||||
#include "../common/light_source.h"
|
||||
#include "../common/emu_constants.h"
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@ -218,7 +219,7 @@ public:
|
||||
|
||||
//Song
|
||||
bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1);
|
||||
bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot);
|
||||
bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, EQEmu::CastingSlot slot);
|
||||
void BardPulse(uint16 spell_id, Mob *caster);
|
||||
|
||||
//Spell
|
||||
@ -248,23 +249,23 @@ public:
|
||||
void SendSpellBarEnable(uint16 spellid);
|
||||
void ZeroCastingVars();
|
||||
virtual void SpellProcess();
|
||||
virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = USE_ITEM_SPELL_SLOT, int32 casttime = -1,
|
||||
virtual bool CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1,
|
||||
int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF,
|
||||
uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, int16 *resist_adjust = nullptr,
|
||||
uint32 aa_id = 0);
|
||||
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1,
|
||||
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1,
|
||||
int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF,
|
||||
uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, int16 resist_adjust = 0,
|
||||
uint32 aa_id = 0);
|
||||
void CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, uint16 mana_used,
|
||||
void CastedSpellFinished(uint16 spell_id, uint32 target_id, EQEmu::CastingSlot 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, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, uint16 mana_used = 0,
|
||||
uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false, int level_override = -1);
|
||||
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false,
|
||||
bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false, int level_override = -1);
|
||||
virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100, int level_override = -1);
|
||||
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center,
|
||||
CastAction_type &CastAction, uint16 slot);
|
||||
CastAction_type &CastAction, EQEmu::CastingSlot slot);
|
||||
virtual bool CheckFizzle(uint16 spell_id);
|
||||
virtual bool CheckSpellLevelRestriction(uint16 spell_id);
|
||||
virtual bool IsImmuneToSpell(uint16 spell_id, Mob *caster);
|
||||
@ -1215,7 +1216,7 @@ protected:
|
||||
int attacked_count;
|
||||
bool delaytimer;
|
||||
uint16 casting_spell_targetid;
|
||||
uint16 casting_spell_slot;
|
||||
EQEmu::CastingSlot casting_spell_slot;
|
||||
uint16 casting_spell_mana;
|
||||
uint32 casting_spell_inventory_slot;
|
||||
uint32 casting_spell_timer;
|
||||
@ -1225,7 +1226,7 @@ protected:
|
||||
uint32 casting_spell_aa_id;
|
||||
bool casting_spell_checks;
|
||||
uint16 bardsong;
|
||||
uint8 bardsong_slot;
|
||||
EQEmu::CastingSlot bardsong_slot;
|
||||
uint32 bardsong_target_id;
|
||||
|
||||
bool ActiveProjectileATK;
|
||||
|
||||
@ -341,7 +341,7 @@ bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
||||
SetCurrentSpeed(0);
|
||||
}
|
||||
|
||||
return CastSpell(AIspells[i].spellid, tar->GetID(), 1, AIspells[i].manacost == -2 ? 0 : -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, &(AIspells[i].resist_adjust));
|
||||
return CastSpell(AIspells[i].spellid, tar->GetID(), EQEmu::CastingSlot::Gem2, AIspells[i].manacost == -2 ? 0 : -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, &(AIspells[i].resist_adjust));
|
||||
}
|
||||
|
||||
bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float iRange, uint16 iSpellTypes) {
|
||||
@ -673,11 +673,11 @@ void Client::AI_SpellCast()
|
||||
}
|
||||
|
||||
uint32 spell_to_cast = 0xFFFFFFFF;
|
||||
uint32 slot_to_use = 10;
|
||||
EQEmu::CastingSlot slot_to_use = EQEmu::CastingSlot::Item;
|
||||
if(valid_spells.size() == 1)
|
||||
{
|
||||
spell_to_cast = valid_spells[0];
|
||||
slot_to_use = slots[0];
|
||||
slot_to_use = static_cast<EQEmu::CastingSlot>(slots[0]);
|
||||
}
|
||||
else if(valid_spells.empty())
|
||||
{
|
||||
@ -687,7 +687,7 @@ void Client::AI_SpellCast()
|
||||
{
|
||||
uint32 idx = zone->random.Int(0, (valid_spells.size()-1));
|
||||
spell_to_cast = valid_spells[idx];
|
||||
slot_to_use = slots[idx];
|
||||
slot_to_use = static_cast<EQEmu::CastingSlot>(slots[idx]);
|
||||
}
|
||||
|
||||
if(IsMezSpell(spell_to_cast) || IsFearSpell(spell_to_cast))
|
||||
|
||||
@ -3982,12 +3982,12 @@ XS(XS_Mob_CastSpell)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 7)
|
||||
Perl_croak(aTHX_ "Usage: Mob::CastSpell(THIS, spell_id, target_id, slot= 10, casttime= -1, mana_cost= -1, resist_adjust = 0)");
|
||||
Perl_croak(aTHX_ "Usage: Mob::CastSpell(THIS, spell_id, target_id, slot= 22, casttime= -1, mana_cost= -1, resist_adjust = 0)");
|
||||
{
|
||||
Mob * THIS;
|
||||
uint16 spell_id = (uint16)SvUV(ST(1));
|
||||
uint16 target_id = (uint16)SvUV(ST(2));
|
||||
uint16 slot;
|
||||
EQEmu::CastingSlot slot;
|
||||
int32 casttime;
|
||||
int32 mana_cost;
|
||||
int16 resist_adjust;
|
||||
@ -4002,9 +4002,9 @@ XS(XS_Mob_CastSpell)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (items < 4)
|
||||
slot = 10;
|
||||
slot = EQEmu::CastingSlot::Item;
|
||||
else {
|
||||
slot = (uint16)SvUV(ST(3));
|
||||
slot = static_cast<EQEmu::CastingSlot>(SvUV(ST(3)));
|
||||
}
|
||||
|
||||
if (items < 5)
|
||||
@ -4085,7 +4085,7 @@ XS(XS_Mob_SpellFinished)
|
||||
resist_diff = spells[spell_id].ResistDiff;
|
||||
}
|
||||
|
||||
THIS->SpellFinished(spell_id, spell_target, 10, mana_cost, -1, resist_diff);
|
||||
THIS->SpellFinished(spell_id, spell_target, EQEmu::CastingSlot::Item, mana_cost, -1, resist_diff);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
@ -365,14 +365,14 @@ void QuestManager::castspell(int spell_id, int target_id) {
|
||||
if (owner) {
|
||||
Mob *tgt = entity_list.GetMob(target_id);
|
||||
if(tgt != nullptr)
|
||||
owner->SpellFinished(spell_id, tgt, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
owner->SpellFinished(spell_id, tgt, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::selfcast(int spell_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator)
|
||||
initiator->SpellFinished(spell_id, initiator, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
initiator->SpellFinished(spell_id, initiator, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
|
||||
void QuestManager::addloot(int item_id, int charges, bool equipitem) {
|
||||
|
||||
@ -149,7 +149,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32
|
||||
IsValidSpell(aabonuses.SkillAttackProc[2])) {
|
||||
float chance = aabonuses.SkillAttackProc[0] / 1000.0f;
|
||||
if (zone->random.Roll(chance))
|
||||
SpellFinished(aabonuses.SkillAttackProc[2], who, 10, 0, -1,
|
||||
SpellFinished(aabonuses.SkillAttackProc[2], who, EQEmu::CastingSlot::Item, 0, -1,
|
||||
spells[aabonuses.SkillAttackProc[2]].ResistDiff);
|
||||
}
|
||||
who->Damage(this, max_damage, SPELL_UNKNOWN, skill, false);
|
||||
@ -2429,7 +2429,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills:
|
||||
IsValidSpell(aabonuses.SkillAttackProc[2])) {
|
||||
float chance = aabonuses.SkillAttackProc[0] / 1000.0f;
|
||||
if (zone->random.Roll(chance))
|
||||
SpellFinished(aabonuses.SkillAttackProc[2], other, 10, 0, -1,
|
||||
SpellFinished(aabonuses.SkillAttackProc[2], other, EQEmu::CastingSlot::Item, 0, -1,
|
||||
spells[aabonuses.SkillAttackProc[2]].ResistDiff);
|
||||
}
|
||||
other->Damage(this, damage, SPELL_UNKNOWN, skillinuse);
|
||||
|
||||
@ -2745,7 +2745,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
|
||||
if (caster && IsValidSpell(spells[spell_id].base2[i])){
|
||||
if(zone->random.Roll(spells[spell_id].base[i]))
|
||||
caster->SpellFinished(spells[spell_id].base2[i], this, 10, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff);
|
||||
caster->SpellFinished(spells[spell_id].base2[i], this, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -5135,7 +5135,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
|
||||
|
||||
if (Caston_spell_id) {
|
||||
if (IsValidSpell(Caston_spell_id) && (Caston_spell_id != spell_id))
|
||||
SpellFinished(Caston_spell_id, this, 10, 0, -1, spells[Caston_spell_id].ResistDiff);
|
||||
SpellFinished(Caston_spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[Caston_spell_id].ResistDiff);
|
||||
}
|
||||
|
||||
return (value * lvlModifier / 100);
|
||||
@ -6683,10 +6683,10 @@ void Mob::TryTriggerThreshHold(int32 damage, int effect_id, Mob* attacker){
|
||||
if (IsValidSpell(spell_id)) {
|
||||
|
||||
if (IsBeneficialSpell(spell_id))
|
||||
SpellFinished(spell_id, this, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
SpellFinished(spell_id, this, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
|
||||
else if(attacker)
|
||||
SpellFinished(spell_id, attacker, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||
SpellFinished(spell_id, attacker, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,6 +104,8 @@ extern Zone* zone;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
|
||||
using EQEmu::CastingSlot;
|
||||
|
||||
// this is run constantly for every mob
|
||||
void Mob::SpellProcess()
|
||||
{
|
||||
@ -145,13 +147,13 @@ void NPC::SpellProcess()
|
||||
// the rule is you can cast one triggered (usually timed) spell at a time
|
||||
// but things like SpellFinished() can run concurrent with a triggered cast
|
||||
// to allow procs to work
|
||||
bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
||||
int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot,
|
||||
uint32 timer, uint32 timer_duration, int16 *resist_adjust,
|
||||
uint32 aa_id)
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d",
|
||||
(IsValidSpell(spell_id))?spells[spell_id].name:"UNKNOWN SPELL", spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot);
|
||||
(IsValidSpell(spell_id))?spells[spell_id].name:"UNKNOWN SPELL", spell_id, target_id, static_cast<int>(slot), cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot);
|
||||
|
||||
if(casting_spell_id == spell_id)
|
||||
ZeroCastingVars();
|
||||
@ -178,7 +180,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
if(IsClient())
|
||||
CastToClient()->SendSpellBarEnable(spell_id);
|
||||
if(casting_spell_id && IsNPC())
|
||||
CastToNPC()->AI_Event_SpellCastFinished(false, casting_spell_slot);
|
||||
CastToNPC()->AI_Event_SpellCastFinished(false, static_cast<uint16>(casting_spell_slot));
|
||||
return(false);
|
||||
}
|
||||
//It appears that the Sanctuary effect is removed by a check on the client side (keep this however for redundancy)
|
||||
@ -201,7 +203,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
if(IsClient())
|
||||
CastToClient()->SendSpellBarEnable(spell_id);
|
||||
if(casting_spell_id && IsNPC())
|
||||
CastToNPC()->AI_Event_SpellCastFinished(false, casting_spell_slot);
|
||||
CastToNPC()->AI_Event_SpellCastFinished(false, static_cast<uint16>(casting_spell_slot));
|
||||
return(false);
|
||||
}
|
||||
|
||||
@ -231,7 +233,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
// check for fizzle
|
||||
// note that CheckFizzle itself doesn't let NPCs fizzle,
|
||||
// but this code allows for it.
|
||||
if(slot < MAX_PP_MEMSPELL && !CheckFizzle(spell_id))
|
||||
if(slot < CastingSlot::MaxGems && !CheckFizzle(spell_id))
|
||||
{
|
||||
int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE;
|
||||
InterruptSpell(fizzle_msg, 0x121, spell_id);
|
||||
@ -252,7 +254,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
}
|
||||
|
||||
//Added to prevent MQ2 exploitation of equipping normally-unequippable/clickable items with effects and clicking them for benefits.
|
||||
if(item_slot && IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT)))
|
||||
if(item_slot && IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt))
|
||||
{
|
||||
ItemInst *itm = CastToClient()->GetInv().GetItem(item_slot);
|
||||
int bitmask = 1;
|
||||
@ -336,7 +338,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
// this is the 2nd phase of CastSpell, broken up like this to make it easier
|
||||
// to repeat a spell for bard songs
|
||||
//
|
||||
bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
||||
int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish,
|
||||
uint32 item_slot, uint32 timer, uint32 timer_duration,
|
||||
int16 resist_adjust, uint32 aa_id)
|
||||
@ -353,7 +355,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||
|
||||
Log.Out(Logs::Detail, Logs::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d",
|
||||
spell.name, spell_id, target_id, slot, cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot);
|
||||
spell.name, spell_id, target_id, static_cast<int>(slot), cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot);
|
||||
|
||||
casting_spell_id = spell_id;
|
||||
casting_spell_slot = slot;
|
||||
@ -418,7 +420,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
// If you're at full mana, let it cast even if you dont have enough mana
|
||||
|
||||
// we calculated this above, now enforce it
|
||||
if(mana_cost > 0 && slot != USE_ITEM_SPELL_SLOT)
|
||||
if(mana_cost > 0 && slot != CastingSlot::Item)
|
||||
{
|
||||
int my_curmana = GetMana();
|
||||
int my_maxmana = GetMaxMana();
|
||||
@ -487,7 +489,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
safe_delete(outapp);
|
||||
outapp = nullptr;
|
||||
|
||||
if (IsClient() && slot == USE_ITEM_SPELL_SLOT &&item_slot != 0xFFFFFFFF) {
|
||||
if (IsClient() && slot == CastingSlot::Item && item_slot != 0xFFFFFFFF) {
|
||||
auto item = CastToClient()->GetInv().GetItem(item_slot);
|
||||
if (item && item->GetItem())
|
||||
Message_StringID(MT_Spells, BEGINS_TO_GLOW, item->GetItem()->Name);
|
||||
@ -767,7 +769,7 @@ void Mob::ZeroCastingVars()
|
||||
spellend_timer.Disable();
|
||||
casting_spell_id = 0;
|
||||
casting_spell_targetid = 0;
|
||||
casting_spell_slot = 0;
|
||||
casting_spell_slot = CastingSlot::Gem1;
|
||||
casting_spell_mana = 0;
|
||||
casting_spell_inventory_slot = 0;
|
||||
casting_spell_timer = 0;
|
||||
@ -802,7 +804,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
|
||||
}
|
||||
|
||||
if(casting_spell_id && IsNPC()) {
|
||||
CastToNPC()->AI_Event_SpellCastFinished(false, casting_spell_slot);
|
||||
CastToNPC()->AI_Event_SpellCastFinished(false, static_cast<uint16>(casting_spell_slot));
|
||||
}
|
||||
|
||||
if(casting_spell_aa_id && IsClient()) { //Rest AA Timer on failed cast
|
||||
@ -880,12 +882,12 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
|
||||
// NOTE: do not put range checking, etc into this function. this should
|
||||
// just check timed spell specific things before passing off to SpellFinished
|
||||
// which figures out proper targets etc
|
||||
void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
|
||||
void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slot,
|
||||
uint16 mana_used, uint32 inventory_slot, int16 resist_adjust)
|
||||
{
|
||||
bool IsFromItem = false;
|
||||
|
||||
if(IsClient() && slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && spells[spell_id].recast_time > 1000) { // 10 is item
|
||||
if(IsClient() && slot != CastingSlot::Item && slot != CastingSlot::Item && spells[spell_id].recast_time > 1000) { // 10 is item
|
||||
if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) {
|
||||
//should we issue a message or send them a spell gem packet?
|
||||
Message_StringID(13, SPELL_RECAST);
|
||||
@ -895,7 +897,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
|
||||
}
|
||||
}
|
||||
|
||||
if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT)))
|
||||
if(IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt))
|
||||
{
|
||||
IsFromItem = true;
|
||||
ItemInst *itm = CastToClient()->GetInv().GetItem(inventory_slot);
|
||||
@ -1193,7 +1195,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
|
||||
|
||||
int16 DeleteChargeFromSlot = -1;
|
||||
|
||||
if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT))
|
||||
if(IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt)
|
||||
&& inventory_slot != 0xFFFFFFFF) // 10 is an item
|
||||
{
|
||||
bool fromaug = false;
|
||||
@ -1307,7 +1309,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
|
||||
if(IsClient())
|
||||
{
|
||||
this->CastToClient()->CheckSongSkillIncrease(spell_id);
|
||||
this->CastToClient()->MemorizeSpell(slot, spell_id, memSpellSpellbar);
|
||||
this->CastToClient()->MemorizeSpell(static_cast<uint32>(slot), spell_id, memSpellSpellbar);
|
||||
}
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Bard song %d should be started", spell_id);
|
||||
}
|
||||
@ -1319,21 +1321,18 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
|
||||
SendSpellBarEnable(spell_id);
|
||||
|
||||
// this causes the delayed refresh of the spell bar gems
|
||||
c->MemorizeSpell(slot, spell_id, memSpellSpellbar);
|
||||
c->MemorizeSpell(static_cast<uint32>(slot), spell_id, memSpellSpellbar);
|
||||
|
||||
// this tells the client that casting may happen again
|
||||
SetMana(GetMana());
|
||||
|
||||
// skills
|
||||
if(slot < MAX_PP_MEMSPELL)
|
||||
{
|
||||
c->CheckIncreaseSkill(spells[spell_id].skill, nullptr);
|
||||
c->CheckIncreaseSkill(spells[spell_id].skill, nullptr);
|
||||
|
||||
// increased chance of gaining channel skill if you regained concentration
|
||||
c->CheckIncreaseSkill(EQEmu::skills::SkillChanneling, nullptr, regain_conc ? 5 : 0);
|
||||
// increased chance of gaining channel skill if you regained concentration
|
||||
c->CheckIncreaseSkill(EQEmu::skills::SkillChanneling, nullptr, regain_conc ? 5 : 0);
|
||||
|
||||
c->CheckSpecializeIncrease(spell_id);
|
||||
}
|
||||
c->CheckSpecializeIncrease(spell_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1348,8 +1347,8 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
|
||||
|
||||
}
|
||||
|
||||
bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, uint16 slot) {
|
||||
|
||||
bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, CastingSlot slot)
|
||||
{
|
||||
/*
|
||||
The basic types of spells:
|
||||
|
||||
@ -1682,7 +1681,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
|
||||
case ST_Group:
|
||||
case ST_GroupNoPets:
|
||||
{
|
||||
if(IsClient() && CastToClient()->TGB() && IsTGBCompatibleSpell(spell_id) && slot != USE_ITEM_SPELL_SLOT) {
|
||||
if(IsClient() && CastToClient()->TGB() && IsTGBCompatibleSpell(spell_id) && slot != CastingSlot::Item) {
|
||||
if( (!target) ||
|
||||
(target->IsNPC() && !(target->GetOwner() && target->GetOwner()->IsClient())) ||
|
||||
(target->IsCorpse()) )
|
||||
@ -1904,7 +1903,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
|
||||
// only used from CastedSpellFinished, and procs
|
||||
// we can't interrupt in this, or anything called from this!
|
||||
// if you need to abort the casting, return false
|
||||
bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 mana_used,
|
||||
bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, uint16 mana_used,
|
||||
uint32 inventory_slot, int16 resist_adjust, bool isproc, int level_override)
|
||||
{
|
||||
//EQApplicationPacket *outapp = nullptr;
|
||||
@ -2263,7 +2262,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
||||
|
||||
bool mgb = HasMGB() && spells[spell_id].can_mgb;
|
||||
// if this was a spell slot or an ability use up the mana for it
|
||||
if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0)
|
||||
if(slot != CastingSlot::Item && slot != CastingSlot::PotionBelt && mana_used > 0)
|
||||
{
|
||||
mana_used = GetActSpellCost(spell_id, mana_used);
|
||||
if (mgb) {
|
||||
@ -2326,7 +2325,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
||||
}
|
||||
}
|
||||
|
||||
if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT)))
|
||||
if(IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt))
|
||||
{
|
||||
ItemInst *itm = CastToClient()->GetInv().GetItem(inventory_slot);
|
||||
if(itm && itm->GetItem()->RecastDelay > 0){
|
||||
@ -2345,7 +2344,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
||||
}
|
||||
|
||||
if(IsNPC())
|
||||
CastToNPC()->AI_Event_SpellCastFinished(true, slot);
|
||||
CastToNPC()->AI_Event_SpellCastFinished(true, static_cast<uint16>(slot));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2360,8 +2359,8 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
||||
*
|
||||
* return false to stop the song
|
||||
*/
|
||||
bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) {
|
||||
if(slot == USE_ITEM_SPELL_SLOT) {
|
||||
bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slot) {
|
||||
if(slot == CastingSlot::Item) {
|
||||
//bard songs should never come from items...
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id);
|
||||
return(false);
|
||||
@ -3769,7 +3768,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
|
||||
}
|
||||
|
||||
if (IsValidSpell(spells[spell_id].RecourseLink) && spells[spell_id].RecourseLink != spell_id)
|
||||
SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff);
|
||||
SpellFinished(spells[spell_id].RecourseLink, this, EQEmu::CastingSlot::Item, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff);
|
||||
|
||||
if (IsDetrimentalSpell(spell_id)) {
|
||||
|
||||
@ -5245,7 +5244,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot)
|
||||
spell_id = casting_spell_id;
|
||||
|
||||
if(slot == -1)
|
||||
slot = casting_spell_slot;
|
||||
slot = static_cast<int>(casting_spell_slot);
|
||||
|
||||
// should we treat this as a bard singing?
|
||||
return
|
||||
@ -5273,7 +5272,7 @@ void Mob::_StopSong()
|
||||
{
|
||||
bardsong = 0;
|
||||
bardsong_target_id = 0;
|
||||
bardsong_slot = 0;
|
||||
bardsong_slot = CastingSlot::Gem1;
|
||||
bardsong_timer.Disable();
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ void Trap::Trigger(Mob* trigger)
|
||||
entity_list.MessageClose(trigger,false,100,13,"%s",message.c_str());
|
||||
}
|
||||
if(hiddenTrigger){
|
||||
hiddenTrigger->SpellFinished(effectvalue, trigger, 10, 0, -1, spells[effectvalue].ResistDiff);
|
||||
hiddenTrigger->SpellFinished(effectvalue, trigger, EQEmu::CastingSlot::Item, 0, -1, spells[effectvalue].ResistDiff);
|
||||
}
|
||||
break;
|
||||
case trapTypeAlarm:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user