mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Refactor message functions
This commit is contained in:
+43
-31
@@ -471,7 +471,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
if(zone->random.Roll(RuleI(Spells, SuccorFailChance))) { //2% Fail chance by default
|
||||
|
||||
if(IsClient()) {
|
||||
CastToClient()->Message_StringID(Chat::SpellFailure,SUCCOR_FAIL);
|
||||
CastToClient()->MessageString(Chat::SpellFailure,SUCCOR_FAIL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
(caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity))))))
|
||||
{
|
||||
if (caster)
|
||||
caster->Message_StringID(Chat::SpellFailure, IMMUNE_STUN);
|
||||
caster->MessageString(Chat::SpellFailure, IMMUNE_STUN);
|
||||
} else {
|
||||
int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;
|
||||
if (IsClient())
|
||||
@@ -718,7 +718,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
Stun(effect_value);
|
||||
} else {
|
||||
if (IsClient())
|
||||
Message_StringID(Chat::Stun, SHAKE_OFF_STUN);
|
||||
MessageString(Chat::Stun, SHAKE_OFF_STUN);
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist);
|
||||
}
|
||||
@@ -847,14 +847,14 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
|
||||
if(ClosestMob)
|
||||
{
|
||||
Message_StringID(Chat::Spells, MessageID);
|
||||
MessageString(Chat::Spells, MessageID);
|
||||
SetHeading(CalculateHeadingToTarget(ClosestMob->GetX(), ClosestMob->GetY()));
|
||||
SetTarget(ClosestMob);
|
||||
CastToClient()->SendTargetCommand(ClosestMob->GetID());
|
||||
SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0, true);
|
||||
}
|
||||
else
|
||||
Message_StringID(Chat::Red, SENSE_NOTHING);
|
||||
MessageString(Chat::Red, SENSE_NOTHING);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -939,14 +939,14 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
{
|
||||
if(!zone->CanBind())
|
||||
{
|
||||
Message_StringID(Chat::SpellFailure, CANNOT_BIND);
|
||||
MessageString(Chat::SpellFailure, CANNOT_BIND);
|
||||
break;
|
||||
}
|
||||
if(!zone->IsCity())
|
||||
{
|
||||
if(caster != this)
|
||||
{
|
||||
Message_StringID(Chat::SpellFailure, CANNOT_BIND);
|
||||
MessageString(Chat::SpellFailure, CANNOT_BIND);
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -1039,7 +1039,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
if(zone->random.Roll(effect_value))
|
||||
Gate(spells[spell_id].base2[i] - 1);
|
||||
else if (caster)
|
||||
caster->Message_StringID(Chat::SpellFailure,GATE_FAIL);
|
||||
caster->MessageString(Chat::SpellFailure,GATE_FAIL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1051,7 +1051,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#endif
|
||||
if(GetSpecialAbility(UNDISPELLABLE)){
|
||||
if (caster)
|
||||
caster->Message_StringID(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name);
|
||||
caster->MessageString(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1077,7 +1077,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#endif
|
||||
if(GetSpecialAbility(UNDISPELLABLE)){
|
||||
if (caster)
|
||||
caster->Message_StringID(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name);
|
||||
caster->MessageString(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1103,7 +1103,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#endif
|
||||
if(GetSpecialAbility(UNDISPELLABLE)){
|
||||
if (caster)
|
||||
caster->Message_StringID(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name);
|
||||
caster->MessageString(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1235,7 +1235,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#endif
|
||||
if(GetPet())
|
||||
{
|
||||
Message_StringID(Chat::Shout, ONLY_ONE_PET);
|
||||
MessageString(Chat::Shout, ONLY_ONE_PET);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1537,7 +1537,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
&& caster && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))))
|
||||
{
|
||||
if (caster)
|
||||
caster->Message_StringID(Chat::Shout, IMMUNE_STUN);
|
||||
caster->MessageString(Chat::Shout, IMMUNE_STUN);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1627,7 +1627,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
|
||||
if (zone->random.Int(0, 99) > spells[spell_id].base[i]) {
|
||||
CastToClient()->SetFeigned(false);
|
||||
entity_list.MessageClose_StringID(this, false, 200, 10, STRING_FEIGNFAILED, GetName());
|
||||
entity_list.MessageCloseString(this, false, 200, 10, STRING_FEIGNFAILED, GetName());
|
||||
} else {
|
||||
CastToClient()->SetFeigned(true);
|
||||
}
|
||||
@@ -1644,12 +1644,12 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
{
|
||||
if(caster == this)
|
||||
{
|
||||
Message_StringID(Chat::Spells,
|
||||
MessageString(Chat::Spells,
|
||||
SENTINEL_TRIG_YOU);
|
||||
}
|
||||
else
|
||||
{
|
||||
caster->Message_StringID(Chat::Spells,
|
||||
caster->MessageString(Chat::Spells,
|
||||
SENTINEL_TRIG_OTHER, GetCleanName());
|
||||
}
|
||||
}
|
||||
@@ -1790,26 +1790,26 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
Corpse *corpse = entity_list.GetCorpseByOwner(TargetClient);
|
||||
if(corpse) {
|
||||
if(TargetClient == this->CastToClient())
|
||||
Message_StringID(Chat::LightBlue, SUMMONING_CORPSE, TargetClient->CastToMob()->GetCleanName());
|
||||
MessageString(Chat::LightBlue, SUMMONING_CORPSE, TargetClient->CastToMob()->GetCleanName());
|
||||
else
|
||||
Message_StringID(Chat::LightBlue, SUMMONING_CORPSE_OTHER, TargetClient->CastToMob()->GetCleanName());
|
||||
MessageString(Chat::LightBlue, SUMMONING_CORPSE_OTHER, TargetClient->CastToMob()->GetCleanName());
|
||||
|
||||
corpse->Summon(CastToClient(), true, true);
|
||||
}
|
||||
else {
|
||||
// No corpse found in the zone
|
||||
Message_StringID(Chat::LightBlue, CORPSE_CANT_SENSE);
|
||||
MessageString(Chat::LightBlue, CORPSE_CANT_SENSE);
|
||||
}
|
||||
}
|
||||
else if (caster) {
|
||||
char level[4];
|
||||
ConvertArray(effect_value, level);
|
||||
caster->Message_StringID(Chat::SpellFailure,
|
||||
caster->MessageString(Chat::SpellFailure,
|
||||
SPELL_LEVEL_REQ, level);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Message_StringID(Chat::LightBlue, TARGET_NOT_FOUND);
|
||||
MessageString(Chat::LightBlue, TARGET_NOT_FOUND);
|
||||
Log(Logs::General, Logs::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id);
|
||||
}
|
||||
}
|
||||
@@ -2725,7 +2725,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
case SE_MassGroupBuff:{
|
||||
|
||||
SetMGB(true);
|
||||
Message_StringID(Chat::Disciplines, MGB_STRING);
|
||||
MessageString(Chat::Disciplines, MGB_STRING);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3643,7 +3643,7 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster)
|
||||
case SE_Invisibility2:
|
||||
case SE_InvisVsUndead2: {
|
||||
if (buff.ticsremaining <= 3 && buff.ticsremaining > 1) {
|
||||
Message_StringID(Chat::Spells, INVIS_BEGIN_BREAK);
|
||||
MessageString(Chat::Spells, INVIS_BEGIN_BREAK);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -4047,7 +4047,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
if(p->IsPet())
|
||||
notify = p->GetOwner();
|
||||
if(p) {
|
||||
notify->Message_StringID(Chat::SpellWornOff, SPELL_WORN_OFF_OF,
|
||||
notify->MessageString(Chat::SpellWornOff, SPELL_WORN_OFF_OF,
|
||||
spells[buffs[slot].spellid].name, GetCleanName());
|
||||
}
|
||||
}
|
||||
@@ -5406,7 +5406,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Message_StringID(Chat::Spells, string_id, UsedItem->Name);
|
||||
MessageString(Chat::Spells, string_id, UsedItem->Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5814,9 +5814,15 @@ bool Mob::TryDeathSave() {
|
||||
Message(263, "The gods have healed you for %i points of damage.", HealAmt);
|
||||
|
||||
if(spellbonuses.DeathSave[0] == 2)
|
||||
entity_list.MessageClose_StringID(this, false, 200, Chat::MeleeCrit, DIVINE_INTERVENTION, GetCleanName());
|
||||
entity_list.MessageCloseString(
|
||||
this,
|
||||
false,
|
||||
200,
|
||||
Chat::MeleeCrit,
|
||||
DIVINE_INTERVENTION,
|
||||
GetCleanName());
|
||||
else
|
||||
entity_list.MessageClose_StringID(this, false, 200, Chat::MeleeCrit, DEATH_PACT, GetCleanName());
|
||||
entity_list.MessageCloseString(this, false, 200, Chat::MeleeCrit, DEATH_PACT, GetCleanName());
|
||||
|
||||
SendHPUpdate();
|
||||
BuffFadeBySlot(buffSlot);
|
||||
@@ -5847,9 +5853,15 @@ bool Mob::TryDeathSave() {
|
||||
Message(263, "The gods have healed you for %i points of damage.", HealAmt);
|
||||
|
||||
if(spellbonuses.DeathSave[0] == 2)
|
||||
entity_list.MessageClose_StringID(this, false, 200, Chat::MeleeCrit, DIVINE_INTERVENTION, GetCleanName());
|
||||
entity_list.MessageCloseString(
|
||||
this,
|
||||
false,
|
||||
200,
|
||||
Chat::MeleeCrit,
|
||||
DIVINE_INTERVENTION,
|
||||
GetCleanName());
|
||||
else
|
||||
entity_list.MessageClose_StringID(this, false, 200, Chat::MeleeCrit, DEATH_PACT, GetCleanName());
|
||||
entity_list.MessageCloseString(this, false, 200, Chat::MeleeCrit, DEATH_PACT, GetCleanName());
|
||||
|
||||
SendHPUpdate();
|
||||
BuffFadeBySlot(buffSlot);
|
||||
@@ -6802,11 +6814,11 @@ void Client::BreakFeignDeathWhenCastOn(bool IsResisted)
|
||||
chance *= 2;
|
||||
|
||||
if(chance && (zone->random.Roll(chance))){
|
||||
Message_StringID(Chat::SpellFailure,FD_CAST_ON_NO_BREAK);
|
||||
MessageString(Chat::SpellFailure,FD_CAST_ON_NO_BREAK);
|
||||
return;
|
||||
}
|
||||
|
||||
SetFeigned(false);
|
||||
Message_StringID(Chat::SpellFailure,FD_CAST_ON);
|
||||
MessageString(Chat::SpellFailure,FD_CAST_ON);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user