Skip to content

Instantly share code, notes, and snippets.

@Natureknight
Created December 24, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Natureknight/fd37e14cc5942ef6f6fc to your computer and use it in GitHub Desktop.
Save Natureknight/fd37e14cc5942ef6f6fc to your computer and use it in GitHub Desktop.
diff --git a/src/server/scripts/Custom/copyGearCommands.cpp b/src/server/scripts/Custom/copyGearCommands.cpp
index 8ec7bd5..f05e3e3 100644
--- a/src/server/scripts/Custom/copyGearCommands.cpp
+++ b/src/server/scripts/Custom/copyGearCommands.cpp
@@ -330,34 +330,20 @@ private:
QueryResult result = CharacterDatabase.PQuery("SELECT glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 "
"FROM character_glyphs WHERE guid = '%u' AND spec = '%u';", target->GetGUID(), target->GetActiveSpec());
- for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
- {
- if (!result)
- continue;
+ if (!result)
+ return;
- Field* fields = result->Fetch();
- uint32 glyph1 = fields[0].GetUInt32();
- uint32 glyph2 = fields[1].GetUInt32();
- uint32 glyph3 = fields[2].GetUInt32();
- uint32 glyph4 = fields[3].GetUInt32();
- uint32 glyph5 = fields[4].GetUInt32();
- uint32 glyph6 = fields[5].GetUInt32();
+ Field* fields = result->Fetch();
- uint32 tempGlyph; // Temp
+ for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
+ {
+ uint32 glyph = fields[slot].GetUInt32();
- switch (slot)
- {
- case 0: tempGlyph = glyph1; break;
- case 1: tempGlyph = glyph2; break;
- case 2: tempGlyph = glyph3; break;
- case 3: tempGlyph = glyph4; break;
- case 4: tempGlyph = glyph5; break;
- case 5: tempGlyph = glyph6; break;
- default:
- break;
- }
+ // Skip empty slots
+ if (glyph == 0)
+ continue;
- if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(tempGlyph))
+ if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph))
{
if (uint32 oldGlyph = player->GetGlyph(slot))
{
@@ -365,7 +351,7 @@ private:
player->SetGlyph(slot, 0);
}
player->CastSpell(player, gp->SpellId, true);
- player->SetGlyph(slot, tempGlyph);
+ player->SetGlyph(slot, glyph);
}
}
}
warning: LF will be replaced by CRLF in src/server/scripts/Custom/copyGearCommands.cpp.
The file will have its original line endings in your working directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment