Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyeriah committed Dec 18, 2024
1 parent d843b8f commit 9d6875a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/mod_zone_difficulty_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,15 +664,19 @@ class mod_zone_difficulty_rewardnpc : public CreatureScript
return true;
}
npcText = NPC_TEXT_CONFIRM;
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(sZoneDifficulty->TierRewards[category].Entry);
std::string name = proto->Name1;

if (ItemLocale const* leftIl = sObjectMgr->GetItemLocale(sZoneDifficulty->TierRewards[category].Entry))
ObjectMgr::GetLocaleString(leftIl->Name, player->GetSession()->GetSessionDbcLocale(), name);
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(sZoneDifficulty->TierRewards[category].Entry))
{
std::string name = proto->Name1;

if (ItemLocale const* leftIl = sObjectMgr->GetItemLocale(sZoneDifficulty->TierRewards[category].Entry))
ObjectMgr::GetLocaleString(leftIl->Name, player->GetSession()->GetSessionDbcLocale(), name);

AddGossipItemFor(player, GOSSIP_ICON_CHAT, "No!", GOSSIP_SENDER_MAIN, 999998);
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, Acore::StringFormat("Yes, {} is the item I want.", name), GOSSIP_SENDER_MAIN, 99001000 + category);
SendGossipMenuFor(player, npcText, creature);
}

AddGossipItemFor(player, GOSSIP_ICON_CHAT, "No!", GOSSIP_SENDER_MAIN, 999998);
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, Acore::StringFormat("Yes, {} is the item I want.", name), GOSSIP_SENDER_MAIN, 99001000 + category);
SendGossipMenuFor(player, npcText, creature);
return true;
}
return true;
Expand Down

0 comments on commit 9d6875a

Please sign in to comment.