mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[8571] Avoid use ^ bitmask operation for bool values compare in general.
Also drop HandleSet32Bit logn unused and wrong coded chat command code.
This commit is contained in:
parent
b2e32f4ff9
commit
47bf1dbce6
10 changed files with 10 additions and 37 deletions
|
|
@ -3016,8 +3016,6 @@ INSERT INTO `mangos_string` VALUES
|
||||||
(570,'The uint32 value of %u in %u is: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(570,'The uint32 value of %u in %u is: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(571,'Get %u float Value:[OPCODE]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(571,'Get %u float Value:[OPCODE]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(572,'The float of %u value in %u is: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(572,'The float of %u value in %u is: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(573,'.Set32Bit:[OPCODE]:%u [VALUE]:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
|
||||||
(574,'You set Bit of Field:%u to Value: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
|
||||||
(575,'.Mod32Value:[OPCODE]:%u [VALUE]:%i',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(575,'.Mod32Value:[OPCODE]:%u [VALUE]:%i',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(576,'You modified the value of Field:%u to Value: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(576,'You modified the value of Field:%u to Value: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(577,'You are now invisible.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(577,'You are now invisible.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
|
|
||||||
1
sql/updates/9999_01_mangos_mangos_string.sql
Normal file
1
sql/updates/9999_01_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
DELETE FROM mangos_string WHERE entry IN(573,574);
|
||||||
|
|
@ -491,7 +491,6 @@ class ChatHandler
|
||||||
bool HandleWaterwalkCommand(const char* args);
|
bool HandleWaterwalkCommand(const char* args);
|
||||||
|
|
||||||
//! Development Commands
|
//! Development Commands
|
||||||
bool HandleSet32Bit(const char* args);
|
|
||||||
bool HandleSaveAllCommand(const char* args);
|
bool HandleSaveAllCommand(const char* args);
|
||||||
|
|
||||||
Player* getSelectedPlayer();
|
Player* getSelectedPlayer();
|
||||||
|
|
|
||||||
|
|
@ -1299,7 +1299,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
||||||
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true);
|
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true);
|
||||||
|
|
||||||
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
|
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
|
||||||
if(SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
|
if(SocketBonusActivated != SocketBonusToBeActivated) //if there was a change...
|
||||||
{
|
{
|
||||||
_player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,false);
|
_player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,false);
|
||||||
itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0);
|
itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -533,8 +533,8 @@ enum MangosStrings
|
||||||
LANG_GET_UINT_FIELD = 570,
|
LANG_GET_UINT_FIELD = 570,
|
||||||
LANG_GET_FLOAT = 571, //log
|
LANG_GET_FLOAT = 571, //log
|
||||||
LANG_GET_FLOAT_FIELD = 572,
|
LANG_GET_FLOAT_FIELD = 572,
|
||||||
LANG_SET_32BIT = 573, //log
|
// 573, //not used
|
||||||
LANG_SET_32BIT_FIELD = 574,
|
// 574, //not used
|
||||||
LANG_CHANGE_32BIT = 575, //log
|
LANG_CHANGE_32BIT = 575, //log
|
||||||
LANG_CHANGE_32BIT_FIELD = 576,
|
LANG_CHANGE_32BIT_FIELD = 576,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ bool ChatHandler::HandleReloadAllCommand(const char*)
|
||||||
HandleReloadReservedNameCommand("");
|
HandleReloadReservedNameCommand("");
|
||||||
HandleReloadMangosStringCommand("");
|
HandleReloadMangosStringCommand("");
|
||||||
HandleReloadGameTeleCommand("");
|
HandleReloadGameTeleCommand("");
|
||||||
HandleReloadBattleEventCommand("");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4144,30 +4143,6 @@ bool ChatHandler::HandleChangeWeather(const char* args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleSet32Bit(const char* args)
|
|
||||||
{
|
|
||||||
if(!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char* px = strtok((char*)args, " ");
|
|
||||||
char* py = strtok(NULL, " ");
|
|
||||||
|
|
||||||
if (!px || !py)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 Opcode = (uint32)atoi(px);
|
|
||||||
uint32 Value = (uint32)atoi(py);
|
|
||||||
if (Value > 32) //uint32 = 32 bits
|
|
||||||
return false;
|
|
||||||
|
|
||||||
sLog.outDebug(GetMangosString(LANG_SET_32BIT), Opcode, Value);
|
|
||||||
|
|
||||||
m_session->GetPlayer( )->SetUInt32Value( Opcode , 2^Value );
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_SET_32BIT_FIELD, Opcode,1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatHandler::HandleTeleAddCommand(const char * args)
|
bool ChatHandler::HandleTeleAddCommand(const char * args)
|
||||||
{
|
{
|
||||||
if(!*args)
|
if(!*args)
|
||||||
|
|
|
||||||
|
|
@ -17734,7 +17734,7 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply)
|
||||||
//was enchant active with/without item?
|
//was enchant active with/without item?
|
||||||
bool wasactive = EnchantmentFitsRequirements(condition, apply ? exceptslot : -1);
|
bool wasactive = EnchantmentFitsRequirements(condition, apply ? exceptslot : -1);
|
||||||
//should it now be?
|
//should it now be?
|
||||||
if(wasactive ^ EnchantmentFitsRequirements(condition, apply ? -1 : exceptslot))
|
if(wasactive != EnchantmentFitsRequirements(condition, apply ? -1 : exceptslot))
|
||||||
{
|
{
|
||||||
// ignore item gem conditions
|
// ignore item gem conditions
|
||||||
//if state changed, (dis)apply enchant
|
//if state changed, (dis)apply enchant
|
||||||
|
|
|
||||||
|
|
@ -6259,7 +6259,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real)
|
||||||
|
|
||||||
void Aura::PeriodicTick()
|
void Aura::PeriodicTick()
|
||||||
{
|
{
|
||||||
if (!m_target->isAlive() ^ IsDeathOnlySpell(GetSpellProto()))
|
if (!m_target->isAlive() != IsDeathOnlySpell(GetSpellProto()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(m_modifier.m_auraname)
|
switch(m_modifier.m_auraname)
|
||||||
|
|
|
||||||
|
|
@ -4067,9 +4067,9 @@ void Unit::RemoveArenaAuras(bool onleave)
|
||||||
for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
|
for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
|
||||||
{
|
{
|
||||||
if ( !(iter->second->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras
|
if ( !(iter->second->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras
|
||||||
&& !iter->second->IsPassive() // don't remove passive auras
|
&& !iter->second->IsPassive() // don't remove passive auras
|
||||||
&& (!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) || !(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNK8)) // not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable)
|
&& (!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) || !(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNK8)) // not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable)
|
||||||
&& (iter->second->IsPositive() ^ onleave)) // remove positive buffs on enter, negative buffs on leave
|
&& (iter->second->IsPositive() != onleave)) // remove positive buffs on enter, negative buffs on leave
|
||||||
RemoveAura(iter);
|
RemoveAura(iter);
|
||||||
else
|
else
|
||||||
++iter;
|
++iter;
|
||||||
|
|
@ -9398,7 +9398,7 @@ bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/) const
|
||||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
|
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(isAlive() ^ inverseAlive))
|
if (!(isAlive() != inverseAlive))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return IsInWorld() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/;
|
return IsInWorld() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8570"
|
#define REVISION_NR "8571"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue