[Client] Remove unimplemented Client Insight Method. (#2663)

* [Cleanup] Remove unused Insight Method, and cleanup Magic Numbers

* change emu->NPC back to 0, not Doug
This commit is contained in:
Aeadoin 2022-12-21 18:41:56 -05:00 committed by GitHub
parent d5aecb228a
commit 2f9a6daab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 64 additions and 397 deletions

View File

@ -96,12 +96,12 @@ bool IsOfEqualRace(int r1, int r2)
// TODO: add more values
switch (r1) {
case DARK_ELF:
if (r2 == 77) {
if (r2 == RACE_NERIAK_CITIZEN_77) {
return true;
}
break;
case BARBARIAN:
if (r2 == 90) {
if (r2 == RACE_HALAS_CITIZEN_90) {
return true;
}
}

View File

@ -33,6 +33,7 @@
#include "rof_structs.h"
#include "../rulesys.h"
#include "../path_manager.h"
#include "../races.h"
#include <iostream>
#include <sstream>
@ -3830,7 +3831,9 @@ namespace RoF
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
PacketSize += 60;
@ -3962,7 +3965,9 @@ namespace RoF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
{

View File

@ -33,6 +33,8 @@
#include "rof2_structs.h"
#include "../rulesys.h"
#include "../path_manager.h"
#include "../classes.h"
#include "../races.h"
#include <iostream>
#include <sstream>
@ -3944,7 +3946,7 @@ namespace RoF2
if (strlen(emu->suffix))
PacketSize += strlen(emu->suffix) + 1;
if (emu->DestructibleObject || emu->class_ == 62)
if (emu->DestructibleObject || emu->class_ == LDON_TREASURE)
{
if (emu->DestructibleObject)
PacketSize = PacketSize - 4; // No bodytype
@ -3965,7 +3967,9 @@ namespace RoF2
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
PacketSize += 60;
@ -4032,17 +4036,19 @@ namespace RoF2
// actually part of bitfields
uint8 OtherData = 0;
if (emu->class_ == 62) //LDoN Chest
if (emu->class_ == LDON_TREASURE) //LDoN Chest
{
OtherData = OtherData | 0x04;
if (strlen(emu->title))
}
if (strlen(emu->title)) {
OtherData = OtherData | 16;
if (strlen(emu->suffix))
}
if (strlen(emu->suffix)) {
OtherData = OtherData | 32;
if (emu->DestructibleObject)
}
if (emu->DestructibleObject) {
OtherData = OtherData | 0xe1; // Live has 0xe1 for OtherData
}
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, OtherData);
// float EmitterScalingRadius
@ -4058,7 +4064,7 @@ namespace RoF2
// int DefaultEmitterID
VARSTRUCT_ENCODE_TYPE(float, Buffer, 0); // unknown4
if (emu->DestructibleObject || emu->class_ == 62)
if (emu->DestructibleObject || emu->class_ == LDON_TREASURE)
{
VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleModel);
VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleName2);
@ -4166,7 +4172,9 @@ namespace RoF2
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // These do something with OP_WeaponEquip1
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // ^
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
{

View File

@ -33,6 +33,7 @@
#include "sod_structs.h"
#include "../rulesys.h"
#include "../path_manager.h"
#include "../races.h"
#include <iostream>
#include <sstream>
@ -2466,7 +2467,9 @@ namespace SoD
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount);
@ -2663,7 +2666,9 @@ namespace SoD
Buffer += sizeof(structs::Spawn_Struct_Position);
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
{
@ -2688,7 +2693,9 @@ namespace SoD
}
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;

View File

@ -33,6 +33,8 @@
#include "uf_structs.h"
#include "../rulesys.h"
#include "../path_manager.h"
#include "../classes.h"
#include "../races.h"
#include <iostream>
#include <sstream>
@ -2716,7 +2718,7 @@ namespace UF
if (strlen(emu->suffix))
PacketSize += strlen(emu->suffix) + 1;
if (emu->DestructibleObject || emu->class_ == 62)
if (emu->DestructibleObject || emu->class_ == LDON_TREASURE)
{
if (emu->DestructibleObject)
PacketSize = PacketSize - 4; // No bodytype
@ -2737,7 +2739,9 @@ namespace UF
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount);
@ -2803,18 +2807,20 @@ namespace UF
uint8 OtherData = 0;
if (emu->class_ == 62) //Ldon chest
if (emu->class_ == LDON_TREASURE) //Ldon chest
{
OtherData = OtherData | 0x01;
}
if (strlen(emu->title))
if (strlen(emu->title)) {
OtherData = OtherData | 0x04;
if (strlen(emu->suffix))
}
if (strlen(emu->suffix)) {
OtherData = OtherData | 0x08;
if (emu->DestructibleObject)
}
if (emu->DestructibleObject) {
OtherData = OtherData | 0xd1; // Live has 0xe1 for OtherData
}
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, OtherData);
if (emu->DestructibleObject)
@ -2827,7 +2833,7 @@ namespace UF
}
VARSTRUCT_ENCODE_TYPE(float, Buffer, 0); // unknown4
if (emu->DestructibleObject || emu->class_ == 62)
if (emu->DestructibleObject || emu->class_ == LDON_TREASURE)
{
VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleModel);
VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleName2);
@ -2936,7 +2942,9 @@ namespace UF
Buffer += sizeof(structs::Spawn_Struct_Position);
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
{
@ -2970,7 +2978,9 @@ namespace UF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
}
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;

View File

@ -3595,336 +3595,6 @@ float Client::CalcPriceMod(Mob* other, bool reverse)
return chaformula; //Returns 1.10, expensive stuff!
}
//neat idea from winter's roar, not implemented
void Client::Insight(uint32 t_id)
{
Mob* who = entity_list.GetMob(t_id);
if (!who)
return;
if (!who->IsNPC())
{
Message(0,"This ability can only be used on NPCs.");
return;
}
if (Distance(static_cast<glm::vec3>(m_Position), static_cast<glm::vec3>(who->GetPosition())) > 200)
{
Message(0,"You must get closer to your target!");
return;
}
if (!CheckLosFN(who))
{
Message(0,"You must be able to see your target!");
return;
}
char hitpoints[64];
char resists[320];
char dmg[64];
memset(hitpoints,0,sizeof(hitpoints));
memset(resists,0,sizeof(resists));
memset(dmg,0,sizeof(dmg));
//Start with HP blah
int avg_hp = GetLevelHP(who->GetLevel());
int cur_hp = who->GetHP();
if (cur_hp == avg_hp)
{
strn0cpy(hitpoints,"averagely tough",32);
}
else if (cur_hp >= avg_hp*5)
{
strn0cpy(hitpoints,"extremely tough",32);
}
else if (cur_hp >= avg_hp*4)
{
strn0cpy(hitpoints,"exceptionally tough",32);
}
else if (cur_hp >= avg_hp*3)
{
strn0cpy(hitpoints,"very tough",32);
}
else if (cur_hp >= avg_hp*2)
{
strn0cpy(hitpoints,"quite tough",32);
}
else if (cur_hp >= avg_hp*1.25)
{
strn0cpy(hitpoints,"rather tough",32);
}
else if (cur_hp > avg_hp)
{
strn0cpy(hitpoints,"slightly tough",32);
}
else if (cur_hp <= avg_hp*0.20)
{
strn0cpy(hitpoints,"extremely frail",32);
}
else if (cur_hp <= avg_hp*0.25)
{
strn0cpy(hitpoints,"exceptionally frail",32);
}
else if (cur_hp <= avg_hp*0.33)
{
strn0cpy(hitpoints,"very frail",32);
}
else if (cur_hp <= avg_hp*0.50)
{
strn0cpy(hitpoints,"quite frail",32);
}
else if (cur_hp <= avg_hp*0.75)
{
strn0cpy(hitpoints,"rather frail",32);
}
else if (cur_hp < avg_hp)
{
strn0cpy(hitpoints,"slightly frail",32);
}
int avg_dmg = who->CastToNPC()->GetMaxDamage(who->GetLevel());
int cur_dmg = who->CastToNPC()->GetMaxDMG();
if (cur_dmg == avg_dmg)
{
strn0cpy(dmg,"averagely strong",32);
}
else if (cur_dmg >= avg_dmg*4)
{
strn0cpy(dmg,"extremely strong",32);
}
else if (cur_dmg >= avg_dmg*3)
{
strn0cpy(dmg,"exceptionally strong",32);
}
else if (cur_dmg >= avg_dmg*2)
{
strn0cpy(dmg,"very strong",32);
}
else if (cur_dmg >= avg_dmg*1.25)
{
strn0cpy(dmg,"quite strong",32);
}
else if (cur_dmg >= avg_dmg*1.10)
{
strn0cpy(dmg,"rather strong",32);
}
else if (cur_dmg > avg_dmg)
{
strn0cpy(dmg,"slightly strong",32);
}
else if (cur_dmg <= avg_dmg*0.20)
{
strn0cpy(dmg,"extremely weak",32);
}
else if (cur_dmg <= avg_dmg*0.25)
{
strn0cpy(dmg,"exceptionally weak",32);
}
else if (cur_dmg <= avg_dmg*0.33)
{
strn0cpy(dmg,"very weak",32);
}
else if (cur_dmg <= avg_dmg*0.50)
{
strn0cpy(dmg,"quite weak",32);
}
else if (cur_dmg <= avg_dmg*0.75)
{
strn0cpy(dmg,"rather weak",32);
}
else if (cur_dmg < avg_dmg)
{
strn0cpy(dmg,"slightly weak",32);
}
//Resists
int res;
int i = 1;
//MR
res = who->GetResist(i);
i++;
if (res >= 1000)
{
strcat(resists,"immune");
}
else if (res >= 500)
{
strcat(resists,"practically immune");
}
else if (res >= 250)
{
strcat(resists,"exceptionally resistant");
}
else if (res >= 150)
{
strcat(resists,"very resistant");
}
else if (res >= 100)
{
strcat(resists,"fairly resistant");
}
else if (res >= 50)
{
strcat(resists,"averagely resistant");
}
else if (res >= 25)
{
strcat(resists,"weakly resistant");
}
else
{
strcat(resists,"barely resistant");
}
strcat(resists," to magic, ");
//FR
res = who->GetResist(i);
i++;
if (res >= 1000)
{
strcat(resists,"immune");
}
else if (res >= 500)
{
strcat(resists,"practically immune");
}
else if (res >= 250)
{
strcat(resists,"exceptionally resistant");
}
else if (res >= 150)
{
strcat(resists,"very resistant");
}
else if (res >= 100)
{
strcat(resists,"fairly resistant");
}
else if (res >= 50)
{
strcat(resists,"averagely resistant");
}
else if (res >= 25)
{
strcat(resists,"weakly resistant");
}
else
{
strcat(resists,"barely resistant");
}
strcat(resists," to fire, ");
//CR
res = who->GetResist(i);
i++;
if (res >= 1000)
{
strcat(resists,"immune");
}
else if (res >= 500)
{
strcat(resists,"practically immune");
}
else if (res >= 250)
{
strcat(resists,"exceptionally resistant");
}
else if (res >= 150)
{
strcat(resists,"very resistant");
}
else if (res >= 100)
{
strcat(resists,"fairly resistant");
}
else if (res >= 50)
{
strcat(resists,"averagely resistant");
}
else if (res >= 25)
{
strcat(resists,"weakly resistant");
}
else
{
strcat(resists,"barely resistant");
}
strcat(resists," to cold, ");
//PR
res = who->GetResist(i);
i++;
if (res >= 1000)
{
strcat(resists,"immune");
}
else if (res >= 500)
{
strcat(resists,"practically immune");
}
else if (res >= 250)
{
strcat(resists,"exceptionally resistant");
}
else if (res >= 150)
{
strcat(resists,"very resistant");
}
else if (res >= 100)
{
strcat(resists,"fairly resistant");
}
else if (res >= 50)
{
strcat(resists,"averagely resistant");
}
else if (res >= 25)
{
strcat(resists,"weakly resistant");
}
else
{
strcat(resists,"barely resistant");
}
strcat(resists," to poison, and ");
//MR
res = who->GetResist(i);
i++;
if (res >= 1000)
{
strcat(resists,"immune");
}
else if (res >= 500)
{
strcat(resists,"practically immune");
}
else if (res >= 250)
{
strcat(resists,"exceptionally resistant");
}
else if (res >= 150)
{
strcat(resists,"very resistant");
}
else if (res >= 100)
{
strcat(resists,"fairly resistant");
}
else if (res >= 50)
{
strcat(resists,"averagely resistant");
}
else if (res >= 25)
{
strcat(resists,"weakly resistant");
}
else
{
strcat(resists,"barely resistant");
}
strcat(resists," to disease.");
Message(0,"Your target is a level %i %s. It appears %s and %s for its level. It seems %s",who->GetLevel(),GetClassIDName(who->GetClass(),1),dmg,hitpoints,resists);
}
void Client::GetGroupAAs(GroupLeadershipAA_Struct *into) const {
memcpy(into, &m_pp.leader_abilities.group, sizeof(GroupLeadershipAA_Struct));
}

View File

@ -1010,7 +1010,6 @@ public:
bool CheckTradeLoreConflict(Client* other);
bool CheckTradeNonDroppable();
void LinkDead();
void Insight(uint32 t_id);
bool CheckDoubleAttack();
bool CheckTripleAttack();
bool CheckDoubleRangedAttack();

View File

@ -4057,37 +4057,6 @@ void Mob::SetNextIncHPEvent( int inchpevent )
nextinchpevent = inchpevent;
}
int16 Mob::GetResist(uint8 type) const
{
if (IsNPC())
{
if (type == 1)
return MR + spellbonuses.MR + itembonuses.MR;
else if (type == 2)
return FR + spellbonuses.FR + itembonuses.FR;
else if (type == 3)
return CR + spellbonuses.CR + itembonuses.CR;
else if (type == 4)
return PR + spellbonuses.PR + itembonuses.PR;
else if (type == 5)
return DR + spellbonuses.DR + itembonuses.DR;
}
else if (IsClient())
{
if (type == 1)
return CastToClient()->GetMR();
else if (type == 2)
return CastToClient()->GetFR();
else if (type == 3)
return CastToClient()->GetCR();
else if (type == 4)
return CastToClient()->GetPR();
else if (type == 5)
return CastToClient()->GetDR();
}
return 25;
}
uint32 Mob::GetLevelHP(uint8 tlevel)
{
int multiplier = 0;

View File

@ -1229,7 +1229,6 @@ public:
bool CheckWillAggro(Mob *mob);
void InstillDoubt(Mob *who);
int16 GetResist(uint8 type) const;
bool Charmed() const { return typeofpet == petCharmed; }
static uint32 GetLevelHP(uint8 tlevel);
uint32 GetZoneID() const; //for perl

View File

@ -2955,13 +2955,13 @@ uint32 NPC::GetSpawnPointID() const
void NPC::NPCSlotTexture(uint8 slot, uint16 texture)
{
if (slot == 7) {
if (slot == EQ::invslot::slotNeck) {
d_melee_texture1 = texture;
}
else if (slot == 8) {
else if (slot == EQ::invslot::slotBack) {
d_melee_texture2 = texture;
}
else if (slot < 6) {
else if (slot < EQ::invslot::slotShoulders) {
// Reserved for texturing individual armor slots
}
}

View File

@ -2953,7 +2953,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2,
LogSpells("Spells the same but newer is higher or equal level, overwriting");
return 1;
}
} else if (spellid1 == 2751) {
} else if (spellid1 == SPELL_MANA_BURN) {
LogSpells("Blocking spell because manaburn does not stack with itself");
return -1;
}