diff --git a/world/client.cpp b/world/client.cpp index 555b0f24c..39a1789c8 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1490,14 +1490,6 @@ void Client::TellClientZoneUnavailable() { 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) { LogNetcode("Sending EQApplicationPacket OpCode {:#04x}", app->GetOpcode()); @@ -1571,7 +1563,6 @@ void Client::SendApproveWorld() bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { PlayerProfile_Struct pp; - ExtendedProfile_Struct ext; EQ::InventoryProfile inv; 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 time_t bday = time(nullptr); - char startzone[50]={0}; - uint32 i; - struct in_addr in; + in_addr in; 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.mem_spells, 0xFF, (sizeof(uint32) * EQ::spells::SPELL_GEM_COUNT)); - for(i = 0; i < BUFF_COUNT; i++) - pp.buffs[i].spellid = 0xFFFF; + for (auto& buff : pp.buffs) + buff.spellid = 0xFFFF; /* If server is PVP by default, make all character set to it. */ pp.pvp = database.GetServerType() == 1 ? 1 : 0; @@ -1782,7 +1771,6 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) return false; } - uint32 max_stats = 0; uint32 allocs = character_create_allocations.size(); RaceClassAllocation allocation = {0}; found = false; @@ -1799,7 +1787,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) return false; } - max_stats = allocation.DefaultPointAllocation[0] + + uint32 max_stats = allocation.DefaultPointAllocation[0] + allocation.DefaultPointAllocation[1] + allocation.DefaultPointAllocation[2] + allocation.DefaultPointAllocation[3] + diff --git a/world/client.h b/world/client.h index d94f5a598..76f14e6c1 100644 --- a/world/client.h +++ b/world/client.h @@ -39,7 +39,6 @@ public: ~Client(); bool Process(); - void ReceiveData(uchar* buf, int len); void SendCharInfo(); void SendMaxCharCreate(); void SendMembership(); @@ -54,7 +53,6 @@ public: void SendLogServer(); void SendApproveWorld(); void SendPostEnterWorld(); - bool GenPassKey(char* key); inline uint32 GetIP() { return ip; } inline uint16 GetPort() { return port; } diff --git a/zone/client.cpp b/zone/client.cpp index b15cc5c2d..3896fd058 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5531,7 +5531,6 @@ bool Client::TryReward(uint32 claim_id) if (free_slot == 0xFFFFFFFF) return false; - char errbuf[MYSQL_ERRMSG_SIZE]; std::string query = StringFormat("SELECT amount FROM account_rewards " "WHERE account_id = %i AND reward_id = %i", 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++) { int32 faction_before_hit; - int32 faction_to_use_for_messaging; FactionMods fm; int32 this_faction_max; int32 this_faction_min; diff --git a/zone/mob.cpp b/zone/mob.cpp index 189ae6c8e..d171cbc78 100644 --- a/zone/mob.cpp +++ b/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 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). - 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. - 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.*/ int chance_array[EFFECT_COUNT] = {}; @@ -4568,15 +4568,13 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) if (total_chance == 100) { int current_chance = 0; - int cummulative_chance = 0; 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)){ - - cummulative_chance = current_chance + spells[spell_id].base_value[i]; - chance_array[i] = cummulative_chance; - current_chance = cummulative_chance; + const int cumulative_chance = current_chance + spells[spell_id].base_value[i]; + chance_array[i] = cumulative_chance; + current_chance = cumulative_chance; } } int random_roll = zone->random.Int(1, 100);