aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorwowpsp <a@wowpsp.com>2013-05-19 04:31:56 -0700
committerwowpsp <a@wowpsp.com>2013-05-19 04:31:56 -0700
commit897d5dadff6206eaa37ec01e70e6ad5249b9a65e (patch)
tree54d4c930291bd18e0cc03ac255d671d07cd71f05 /src/server/scripts/Commands
parent529e8fba8242e4eb1cf1d90049a0f71068c72b30 (diff)
parent695c8cd7b4e221b20a273c34001d737c2bc5765f (diff)
Merge pull request #1 from TrinityCore/master
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp22
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp12
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp24
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp2
4 files changed, 14 insertions, 46 deletions
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
index 2130e61cb47..b014eb895be 100644
--- a/src/server/scripts/Commands/cs_lookup.cpp
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -962,12 +962,7 @@ public:
uint32 id = atoi((char*)args);
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = 1;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
- if (spellInfo)
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id))
{
int locale = handler->GetSessionDbcLocale();
std::string name = spellInfo->SpellName[locale];
@@ -977,14 +972,6 @@ public:
return true;
}
- if (locale < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
bool known = target && target->HasSpell(id);
bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
@@ -1028,13 +1015,8 @@ public:
ss << handler->GetTrinityString(LANG_ACTIVE);
handler->SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
}
-
- if (!found)
+ else
handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
return true;
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index cadaeff5262..5e4acbb2ba5 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1071,9 +1071,7 @@ public:
Player* player = handler->GetSession()->GetPlayer();
uint32 zone_id = player->GetZoneId();
- WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
- player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
-
+ WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
if (graveyard)
{
uint32 graveyardId = graveyard->ID;
@@ -1103,14 +1101,12 @@ public:
{
std::string team_name;
- if (team == 0)
- team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if (team == HORDE)
+ if (team == HORDE)
team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
else if (team == ALLIANCE)
team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
- if (team == ~uint32(0))
+ if (!team)
handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
else
handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
@@ -2144,7 +2140,7 @@ public:
return true;
}
- uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
+ uint32 school = atoi((char*)schoolStr);
if (school >= MAX_SPELL_SCHOOL)
return false;
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 8ef88d459e2..ff4ef587fad 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -309,24 +309,14 @@ public:
if (!pfactionid)
{
- if (target)
- {
- uint32 factionid = target->getFaction();
- uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
- uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
- uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
- handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
- }
+ uint32 factionid = target->getFaction();
+ uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
+ uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
+ uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
+ handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
return true;
}
- if (!target)
- {
- handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
uint32 factionid = atoi(pfactionid);
uint32 flag;
@@ -340,7 +330,7 @@ public:
uint32 npcflag;
if (!pnpcflag)
- npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
+ npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
else
npcflag = atoi(pnpcflag);
@@ -348,7 +338,7 @@ public:
uint32 dyflag;
if (!pdyflag)
- dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
+ dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
else
dyflag = atoi(pdyflag);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index ea387ef17be..43c9b294419 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -252,7 +252,7 @@ public:
return false;
}
- uint32 vendor_entry = vendor ? vendor->GetEntry() : 0;
+ uint32 vendor_entry = vendor->GetEntry();
if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer()))
{