mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Code Cleanup] Resharper Warnings (#2235)
* Remove unused local variable * Remove another unused variable * Correct typos and remove unused initialization * Cleanup some code in OPCharCreate * Remove unused function in client.cpp and undefined declaration. Also the function potentially had a null pointer dereference according to Visual Studio.
This commit is contained in:
parent
d1404a2d95
commit
de830e5535
@ -1490,14 +1490,6 @@ void Client::TellClientZoneUnavailable() {
|
|||||||
autobootup_timeout.Disable();
|
autobootup_timeout.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::GenPassKey(char* key) {
|
|
||||||
char* passKey=nullptr;
|
|
||||||
*passKey += ((char)('A'+((int)emu_random.Int(0, 25))));
|
|
||||||
*passKey += ((char)('A'+((int)emu_random.Int(0, 25))));
|
|
||||||
memcpy(key, passKey, strlen(passKey));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) {
|
void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) {
|
||||||
LogNetcode("Sending EQApplicationPacket OpCode {:#04x}", app->GetOpcode());
|
LogNetcode("Sending EQApplicationPacket OpCode {:#04x}", app->GetOpcode());
|
||||||
|
|
||||||
@ -1571,7 +1563,6 @@ void Client::SendApproveWorld()
|
|||||||
bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||||
{
|
{
|
||||||
PlayerProfile_Struct pp;
|
PlayerProfile_Struct pp;
|
||||||
ExtendedProfile_Struct ext;
|
|
||||||
EQ::InventoryProfile inv;
|
EQ::InventoryProfile inv;
|
||||||
|
|
||||||
pp.SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(EQ::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit)));
|
pp.SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(EQ::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit)));
|
||||||
@ -1579,9 +1570,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
|||||||
inv.SetGMInventory(false); // character cannot have gm flag at this point
|
inv.SetGMInventory(false); // character cannot have gm flag at this point
|
||||||
|
|
||||||
time_t bday = time(nullptr);
|
time_t bday = time(nullptr);
|
||||||
char startzone[50]={0};
|
in_addr in;
|
||||||
uint32 i;
|
|
||||||
struct in_addr in;
|
|
||||||
|
|
||||||
int stats_sum = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA;
|
int stats_sum = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA;
|
||||||
|
|
||||||
@ -1660,8 +1649,8 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
|||||||
memset(pp.spell_book, 0xFF, (sizeof(uint32) * EQ::spells::SPELLBOOK_SIZE));
|
memset(pp.spell_book, 0xFF, (sizeof(uint32) * EQ::spells::SPELLBOOK_SIZE));
|
||||||
memset(pp.mem_spells, 0xFF, (sizeof(uint32) * EQ::spells::SPELL_GEM_COUNT));
|
memset(pp.mem_spells, 0xFF, (sizeof(uint32) * EQ::spells::SPELL_GEM_COUNT));
|
||||||
|
|
||||||
for(i = 0; i < BUFF_COUNT; i++)
|
for (auto& buff : pp.buffs)
|
||||||
pp.buffs[i].spellid = 0xFFFF;
|
buff.spellid = 0xFFFF;
|
||||||
|
|
||||||
/* If server is PVP by default, make all character set to it. */
|
/* If server is PVP by default, make all character set to it. */
|
||||||
pp.pvp = database.GetServerType() == 1 ? 1 : 0;
|
pp.pvp = database.GetServerType() == 1 ? 1 : 0;
|
||||||
@ -1782,7 +1771,6 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 max_stats = 0;
|
|
||||||
uint32 allocs = character_create_allocations.size();
|
uint32 allocs = character_create_allocations.size();
|
||||||
RaceClassAllocation allocation = {0};
|
RaceClassAllocation allocation = {0};
|
||||||
found = false;
|
found = false;
|
||||||
@ -1799,7 +1787,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_stats = allocation.DefaultPointAllocation[0] +
|
uint32 max_stats = allocation.DefaultPointAllocation[0] +
|
||||||
allocation.DefaultPointAllocation[1] +
|
allocation.DefaultPointAllocation[1] +
|
||||||
allocation.DefaultPointAllocation[2] +
|
allocation.DefaultPointAllocation[2] +
|
||||||
allocation.DefaultPointAllocation[3] +
|
allocation.DefaultPointAllocation[3] +
|
||||||
|
|||||||
@ -39,7 +39,6 @@ public:
|
|||||||
~Client();
|
~Client();
|
||||||
|
|
||||||
bool Process();
|
bool Process();
|
||||||
void ReceiveData(uchar* buf, int len);
|
|
||||||
void SendCharInfo();
|
void SendCharInfo();
|
||||||
void SendMaxCharCreate();
|
void SendMaxCharCreate();
|
||||||
void SendMembership();
|
void SendMembership();
|
||||||
@ -54,7 +53,6 @@ public:
|
|||||||
void SendLogServer();
|
void SendLogServer();
|
||||||
void SendApproveWorld();
|
void SendApproveWorld();
|
||||||
void SendPostEnterWorld();
|
void SendPostEnterWorld();
|
||||||
bool GenPassKey(char* key);
|
|
||||||
|
|
||||||
inline uint32 GetIP() { return ip; }
|
inline uint32 GetIP() { return ip; }
|
||||||
inline uint16 GetPort() { return port; }
|
inline uint16 GetPort() { return port; }
|
||||||
|
|||||||
@ -5531,7 +5531,6 @@ bool Client::TryReward(uint32 claim_id)
|
|||||||
if (free_slot == 0xFFFFFFFF)
|
if (free_slot == 0xFFFFFFFF)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
std::string query = StringFormat("SELECT amount FROM account_rewards "
|
std::string query = StringFormat("SELECT amount FROM account_rewards "
|
||||||
"WHERE account_id = %i AND reward_id = %i",
|
"WHERE account_id = %i AND reward_id = %i",
|
||||||
AccountID(), claim_id);
|
AccountID(), claim_id);
|
||||||
@ -7997,7 +7996,6 @@ void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, ui
|
|||||||
|
|
||||||
for (int i = 0; i < MAX_NPC_FACTIONS; i++) {
|
for (int i = 0; i < MAX_NPC_FACTIONS; i++) {
|
||||||
int32 faction_before_hit;
|
int32 faction_before_hit;
|
||||||
int32 faction_to_use_for_messaging;
|
|
||||||
FactionMods fm;
|
FactionMods fm;
|
||||||
int32 this_faction_max;
|
int32 this_faction_max;
|
||||||
int32 this_faction_min;
|
int32 this_faction_min;
|
||||||
|
|||||||
14
zone/mob.cpp
14
zone/mob.cpp
@ -4549,9 +4549,9 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
|
|||||||
/*The effects SE_SpellTrigger (SPA 340) and SE_Chance_Best_in_Spell_Grp (SPA 469) work as follows, you typically will have 2-3 different spells each with their own
|
/*The effects SE_SpellTrigger (SPA 340) and SE_Chance_Best_in_Spell_Grp (SPA 469) work as follows, you typically will have 2-3 different spells each with their own
|
||||||
chance to be triggered with all chances equaling up to 100 pct, with only 1 spell out of the group being ultimately cast.
|
chance to be triggered with all chances equaling up to 100 pct, with only 1 spell out of the group being ultimately cast.
|
||||||
(ie Effect1 trigger spellA with 30% chance, Effect2 triggers spellB with 20% chance, Effect3 triggers spellC with 50% chance).
|
(ie Effect1 trigger spellA with 30% chance, Effect2 triggers spellB with 20% chance, Effect3 triggers spellC with 50% chance).
|
||||||
The following function ensures a stastically accurate chance for each spell to be cast based on their chance values. These effects are also used in spells where there
|
The following function ensures a statistically accurate chance for each spell to be cast based on their chance values. These effects are also used in spells where there
|
||||||
is only 1 effect using the trigger effect. In those situations we simply roll a chance for that spell to be cast once.
|
is only 1 effect using the trigger effect. In those situations we simply roll a chance for that spell to be cast once.
|
||||||
Note: Both SPA 340 and 469 can be in same spell and both cummulative add up to 100 pct chances. SPA469 only difference being the spell cast will
|
Note: Both SPA 340 and 469 can be in same spell and both cumulative add up to 100 pct chances. SPA469 only difference being the spell cast will
|
||||||
be "best in spell group", instead of a defined spell_id.*/
|
be "best in spell group", instead of a defined spell_id.*/
|
||||||
|
|
||||||
int chance_array[EFFECT_COUNT] = {};
|
int chance_array[EFFECT_COUNT] = {};
|
||||||
@ -4568,15 +4568,13 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
|
|||||||
if (total_chance == 100)
|
if (total_chance == 100)
|
||||||
{
|
{
|
||||||
int current_chance = 0;
|
int current_chance = 0;
|
||||||
int cummulative_chance = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < EFFECT_COUNT; i++){
|
for (int i = 0; i < EFFECT_COUNT; i++){
|
||||||
//Find spells with SPA 340 and add the cummulative percent chances to the roll array
|
//Find spells with SPA 340 and add the cumulative percent chances to the roll array
|
||||||
if ((spells[spell_id].effect_id[i] == SE_SpellTrigger) || (spells[spell_id].effect_id[i] == SE_Chance_Best_in_Spell_Grp)){
|
if ((spells[spell_id].effect_id[i] == SE_SpellTrigger) || (spells[spell_id].effect_id[i] == SE_Chance_Best_in_Spell_Grp)){
|
||||||
|
const int cumulative_chance = current_chance + spells[spell_id].base_value[i];
|
||||||
cummulative_chance = current_chance + spells[spell_id].base_value[i];
|
chance_array[i] = cumulative_chance;
|
||||||
chance_array[i] = cummulative_chance;
|
current_chance = cumulative_chance;
|
||||||
current_chance = cummulative_chance;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int random_roll = zone->random.Int(1, 100);
|
int random_roll = zone->random.Int(1, 100);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user