*Update to Mangos 6848. Source: Mangos.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-25 16:36:50 -06:00
parent 52f2e35d65
commit f6ea784eda
22 changed files with 402 additions and 244 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
{
sLog.outCommand("GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount());
}
+2 -2
View File
@@ -191,7 +191,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
++j;
continue;
}
if (plr->isAlive() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
if (plr->isAllowUseBattleGroundObject() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
{
//player joined point!
//show progress bar
@@ -234,7 +234,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
++j;
continue;
}
if (!plr->isAlive() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
if (!plr->isAllowUseBattleGroundObject() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
//move player out of point (add him to players that are out of points
{
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
+1 -1
View File
@@ -786,7 +786,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, st
{
Player* p = m_session->GetPlayer();
uint64 sel_guid = p->GetSelection();
sLog.outCommand("Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s (GUID: %u)]",
sLog.outCommand(m_session->GetAccountId(),"Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s (GUID: %u)]",
fullcmd.c_str(),p->GetName(),m_session->GetAccountId(),p->GetPositionX(),p->GetPositionY(),p->GetPositionZ(),p->GetMapId(),
GetLogNameForGuid(sel_guid),GUID_LOPART(sel_guid));
}
+63 -9
View File
@@ -117,6 +117,28 @@ uint32 CreatureInfo::GetFirstValidModelId() const
return 0;
}
bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Unit* victim = Unit::GetUnit(m_owner, m_victim);
if (victim)
{
while (!m_assistants.empty())
{
Creature* assistant = (Creature*)Unit::GetUnit(m_owner, *m_assistants.begin());
m_assistants.pop_front();
if (assistant && assistant->CanAssistTo(&m_owner, victim))
{
//assistant->SetNoCallAssistence(true);
assistant->CombatStart(victim);
if(assistant->AI())
assistant->AI()->AttackStart(victim);
}
}
}
return true;
}
Creature::Creature() :
Unit(), i_AI(NULL), i_AI_possessed(NULL),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0),
@@ -124,7 +146,7 @@ m_lootMoney(0), m_lootRecipient(0),
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), m_isAggressive(true),
m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0),
m_AlreadyCallAssistence(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
m_AlreadyCallAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0)
{
m_valuesCount = UNIT_END;
@@ -1865,11 +1887,11 @@ Unit* Creature::SelectNearestTarget(float dist) const
void Creature::CallAssistence()
{
if( !m_AlreadyCallAssistence && getVictim() && !isPet() && !isCharmed())
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
{
SetNoCallAssistence(true);
SetNoCallAssistance(true);
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTEMCE_RADIUS);
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
if(radius > 0)
{
std::list<Creature*> assistList;
@@ -1889,17 +1911,49 @@ void Creature::CallAssistence()
cell_lock->Visit(cell_lock, grid_creature_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
}
for(std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
if (!assistList.empty())
{
//(*iter)->SetNoCallAssistence(true);
(*iter)->CombatStart(getVictim());
if((*iter)->AI())
(*iter)->AI()->AttackStart(getVictim());
AssistDelayEvent *e = new AssistDelayEvent(getVictim()->GetGUID(), *this);
while (!assistList.empty())
{
// Pushing guids because in delay can happen some creature gets despawned => invalid pointer
e->AddAssistant((*assistList.begin())->GetGUID());
assistList.pop_front();
}
m_Events.AddEvent(e, m_Events.CalculateTime(sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY)));
}
}
}
}
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy) const
{
if(!isAggressive())
return false;
// we don't need help from zombies :)
if( !isAlive() )
return false;
// skip fighting creature
if( isInCombat() )
return false;
// only from same creature faction
if(getFaction() != u->getFaction() )
return false;
// only free creature
if( GetCharmerOrOwnerGUID() )
return false;
// skip non hostile to caster enemy creatures
if( !IsHostileTo(enemy) )
return false;
return true;
}
void Creature::SaveRespawnTime()
{
if(isPet() || !m_DBTableGuid)
+22 -3
View File
@@ -29,6 +29,8 @@
#include "Database/DatabaseEnv.h"
#include "Cell.h"
#include <list>
struct SpellEntry;
class CreatureAI;
@@ -561,8 +563,9 @@ class TRINITY_DLL_SPEC Creature : public Unit
float GetAttackDistance(Unit const* pl) const;
Unit* SelectNearestTarget(float dist = 0) const;
void CallAssistence();
void SetNoCallAssistence(bool val) { m_AlreadyCallAssistence = val; }
void CallAssistance();
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
bool CanAssistTo(const Unit* u, const Unit* enemy) const;
void DoFleeToGetAssistance(float radius = 50);
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
@@ -648,7 +651,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
uint32 m_equipmentId;
bool m_AlreadyCallAssistence;
bool m_AlreadyCallAssistance;
bool m_regenHealth;
bool m_AI_locked;
bool m_isDeadByDefault;
@@ -664,4 +667,20 @@ class TRINITY_DLL_SPEC Creature : public Unit
GridReference<Creature> m_gridRef;
CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry())
};
class AssistDelayEvent : public BasicEvent
{
public:
AssistDelayEvent(const uint64& victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
bool Execute(uint64 e_time, uint32 p_time);
void AddAssistant(const uint64& guid) { m_assistants.push_back(guid); }
private:
AssistDelayEvent();
uint64 m_victim;
std::list<uint64> m_assistants;
Unit& m_owner;
};
#endif
+5 -25
View File
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRINITY_GRIDNOTIFIERS_H
@@ -476,7 +476,7 @@ namespace Trinity
return false;
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED* u) { return false; }
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
Unit* const i_funit;
float i_range;
@@ -771,35 +771,15 @@ namespace Trinity
if(u == i_funit)
return false;
// we don't need help from zombies :)
if( !u->isAlive() )
return false;
// skip fighting creature
if( u->isInCombat() )
return false;
// only from same creature faction
if(u->getFaction() != i_funit->getFaction() )
return false;
if(!u->isAggressive())
return false;
// only free creature
if( u->GetCharmerOrOwnerGUID() )
if ( !u->CanAssistTo(i_funit, i_enemy) )
return false;
// too far
if( !i_funit->IsWithinDistInMap(u, i_range) )
return false;
// skip non hostile to caster enemy creatures
if( !u->IsHostileTo(i_enemy) )
return false;
// only if see assisted creature
if(!u->IsWithinLOSInMap(i_funit) )
if( !i_funit->IsWithinLOSInMap(u) )
return false;
return true;
+5 -5
View File
@@ -984,7 +984,7 @@ void WorldSession::HandleGuildBankDeposit( WorldPacket & recv_data )
// logging money
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand("GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
_player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId);
}
@@ -1379,7 +1379,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
_player->GetName(),_player->GetSession()->GetAccountId(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
GuildId);
@@ -1448,7 +1448,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank (before items merge
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
_player->GetName(),_player->GetSession()->GetAccountId(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),SplitedAmount,GuildId);
}
@@ -1474,7 +1474,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
_player->GetName(),_player->GetSession()->GetAccountId(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
GuildId);
@@ -1524,7 +1524,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
_player->GetName(),_player->GetSession()->GetAccountId(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
GuildId);
+60 -52
View File
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __TRINITY_LANGUAGE_H
@@ -80,11 +80,11 @@ enum TrinityStrings
LANG_COMMAND_INVALID_ITEM_COUNT = 52,
LANG_COMMAND_MAIL_ITEMS_LIMIT = 53,
LANG_NEW_PASSWORDS_NOT_MATCH = 54,
LANG_PASSWORD_TOO_LONG = 55,
LANG_MOTD_CURRENT = 56,
LANG_USING_WORLD_DB = 57,
LANG_USING_SCRIPT_LIB = 58,
// Room for more level 0 59-99 not used
LANG_PASSWORD_TOO_LONG = 55,
LANG_MOTD_CURRENT = 56,
LANG_USING_WORLD_DB = 57,
LANG_USING_SCRIPT_LIB = 58,
// Room for more level 0 59-99 not used
// level 1 chat
LANG_GLOBAL_NOTIFY = 100,
@@ -170,7 +170,7 @@ enum TrinityStrings
LANG_SOUND_NOT_EXIST = 170,
LANG_TELEPORTED_TO_BY_CONSOLE = 171,
LANG_CONSOLE_COMMAND = 172,
// Room for more level 1 173-199 not used
// Room for more level 1 173-199 not used
// level 2 chat
LANG_NO_SELECTION = 200,
@@ -326,7 +326,9 @@ enum TrinityStrings
LANG_CREATURE_FOLLOW_YOU_NOW = 340,
LANG_CREATURE_NOT_FOLLOW_YOU = 341,
LANG_CREATURE_NOT_FOLLOW_YOU_NOW = 342,
// Room for more level 2 343-399 not used
LANG_CREATURE_NON_TAMEABLE = 343,
LANG_YOU_ALREADY_HAVE_PET = 344,
// Room for more level 2 345-399 not used
// level 3 chat
LANG_SCRIPTS_RELOADED = 400,
@@ -553,14 +555,14 @@ enum TrinityStrings
LANG_MOVEGENS_DISTRACT = 591,
LANG_COMMAND_LEARN_ALL_RECIPES = 592,
LANG_BANLIST_ACCOUNTS = 593,
LANG_BANLIST_ACCOUNTS_HEADER = 594,
LANG_BANLIST_IPS = 595,
LANG_BANLIST_IPS_HEADER = 596,
LANG_GMLIST = 597,
LANG_GMLIST_HEADER = 598,
LANG_GMLIST_EMPTY = 599,
// End Level 3 list, continued at 1100
LANG_BANLIST_ACCOUNTS = 593,
LANG_BANLIST_ACCOUNTS_HEADER = 594,
LANG_BANLIST_IPS = 595,
LANG_BANLIST_IPS_HEADER = 596,
LANG_GMLIST = 597,
LANG_GMLIST_HEADER = 598,
LANG_GMLIST_EMPTY = 599,
// End Level 3 list, continued at 1100
// Battleground
LANG_BG_A_WINS = 600,
@@ -720,43 +722,46 @@ enum TrinityStrings
// Room for in-game strings 810-999 not used
// Level 4 (CLI only commands)
LANG_COMMAND_EXIT = 1000,
LANG_ACCOUNT_DELETED = 1001,
LANG_ACCOUNT_NOT_DELETED_SQL_ERROR = 1002,
LANG_ACCOUNT_NOT_DELETED = 1003,
LANG_ACCOUNT_CREATED = 1004,
LANG_ACCOUNT_TOO_LONG = 1005,
LANG_ACCOUNT_ALREADY_EXIST = 1006,
LANG_ACCOUNT_NOT_CREATED_SQL_ERROR = 1007,
LANG_ACCOUNT_NOT_CREATED = 1008,
LANG_CHARACTER_DELETED = 1009,
LANG_ACCOUNT_LIST_HEADER = 1010,
LANG_ACCOUNT_LIST_ERROR = 1011,
// Room for more level 4 1012-1099 not used
LANG_COMMAND_EXIT = 1000,
LANG_ACCOUNT_DELETED = 1001,
LANG_ACCOUNT_NOT_DELETED_SQL_ERROR = 1002,
LANG_ACCOUNT_NOT_DELETED = 1003,
LANG_ACCOUNT_CREATED = 1004,
LANG_ACCOUNT_TOO_LONG = 1005,
LANG_ACCOUNT_ALREADY_EXIST = 1006,
LANG_ACCOUNT_NOT_CREATED_SQL_ERROR = 1007,
LANG_ACCOUNT_NOT_CREATED = 1008,
LANG_CHARACTER_DELETED = 1009,
LANG_ACCOUNT_LIST_HEADER = 1010,
LANG_ACCOUNT_LIST_ERROR = 1011,
// Room for more level 4 1012-1099 not used
// Level 3 (continue)
// Level 3 (continue)
LANG_ACCOUNT_SETADDON = 1100,
LANG_MOTD_NEW = 1101,
LANG_SENDMESSAGE = 1102,
LANG_EVENT_ENTRY_LIST_CONSOLE = 1103,
LANG_CREATURE_ENTRY_LIST_CONSOLE = 1104,
LANG_ITEM_LIST_CONSOLE = 1105,
LANG_ITEMSET_LIST_CONSOLE = 1106,
LANG_GO_ENTRY_LIST_CONSOLE = 1107,
LANG_QUEST_LIST_CONSOLE = 1108,
LANG_SKILL_LIST_CONSOLE = 1109,
LANG_CREATURE_LIST_CONSOLE = 1110,
LANG_GO_LIST_CONSOLE = 1111,
LANG_FILE_OPEN_FAIL = 1112,
LANG_ACCOUNT_CHARACTER_LIST_FULL = 1113,
LANG_DUMP_BROKEN = 1114,
LANG_INVALID_CHARACTER_NAME = 1115,
LANG_INVALID_CHARACTER_GUID = 1116,
LANG_CHARACTER_GUID_IN_USE = 1117,
LANG_ITEMLIST_GUILD = 1118,
// Room for more level 3 1119-1199 not used
// Trinity strings 5000-9999
LANG_CREATURE_ENTRY_LIST_CONSOLE = 1104,
LANG_ITEM_LIST_CONSOLE = 1105,
LANG_ITEMSET_LIST_CONSOLE = 1106,
LANG_GO_ENTRY_LIST_CONSOLE = 1107,
LANG_QUEST_LIST_CONSOLE = 1108,
LANG_SKILL_LIST_CONSOLE = 1109,
LANG_CREATURE_LIST_CONSOLE = 1110,
LANG_GO_LIST_CONSOLE = 1111,
LANG_FILE_OPEN_FAIL = 1112,
LANG_ACCOUNT_CHARACTER_LIST_FULL = 1113,
LANG_DUMP_BROKEN = 1114,
LANG_INVALID_CHARACTER_NAME = 1115,
LANG_INVALID_CHARACTER_GUID = 1116,
LANG_CHARACTER_GUID_IN_USE = 1117,
LANG_ITEMLIST_GUILD = 1118,
LANG_MUST_MALE_OR_FEMALE = 1119,
LANG_YOU_CHANGE_GENDER = 1120,
LANG_YOUR_GENDER_CHANGED = 1121,
// Room for more level 3 1122-1199 not used
// Trinity strings 5000-9999
LANG_COMMAND_FREEZE = 5000,
LANG_COMMAND_FREEZE_ERROR = 5001,
LANG_COMMAND_FREEZE_WRONG = 5002,
@@ -767,9 +772,10 @@ enum TrinityStrings
LANG_INSTANCE_MUST_RAID_GRP = 5007,
LANG_INSTANCE_NOT_AS_GHOST = 5008,
LANG_COMMAND_PLAYED_TO_ALL = 5009,
// Room for more Trinity strings 5009-9999
// Room for more Trinity strings 5009-9999
// Use for not-in-svn patches 10000-10999
// Use for not-in-offcial-sources patches
// 10000-10999
// opvp hp
LANG_OPVP_HP_CAPTURE_OVERLOOK_H = 10001,
LANG_OPVP_HP_CAPTURE_OVERLOOK_A = 10002,
@@ -835,6 +841,8 @@ enum TrinityStrings
// Use for custom patches 11000-11999
// NOT RESERVED IDS 12000-
// NOT RESERVED IDS 12000-1999999999
// `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
// For other tables maybe 2000010000-2147483647 (max index)
};
#endif
+80 -65
View File
@@ -5673,9 +5673,23 @@ bool ChatHandler::HandleWritePDumpCommand(const char *args)
if(!file || !p2)
return false;
uint32 guid = objmgr.GetPlayerGUIDByName(p2);
if(!guid)
uint32 guid;
// character name can't start from number
if (isNumeric(p2[0]))
guid = atoi(p2);
else
{
std::string name = p2;
if (!normalizePlayerName (name))
{
SendSysMessage (LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage (true);
return false;
}
guid = objmgr.GetPlayerGUIDByName(name);
}
if(!objmgr.GetPlayerAccountIdByGUID(guid))
{
@@ -6548,6 +6562,70 @@ bool ChatHandler::HandleSendMessageCommand(const char* args)
return true;
}
bool ChatHandler::HandleModifyGenderCommand(const char *args)
{
if(!*args)
return false;
Player *player = getSelectedPlayer();
if(!player)
{
PSendSysMessage(LANG_NO_PLAYER);
SetSentErrorMessage(true);
return false;
}
char const* gender_str = (char*)args;
int gender_len = strlen(gender_str);
uint32 displayId = player->GetNativeDisplayId();
char const* gender_full = NULL;
uint32 new_displayId = displayId;
Gender gender;
if(!strncmp(gender_str,"male",gender_len)) // MALE
{
if(player->getGender() == GENDER_MALE)
return true;
gender_full = "male";
new_displayId = player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1;
gender = GENDER_MALE;
}
else if (!strncmp(gender_str,"female",gender_len)) // FEMALE
{
if(player->getGender() == GENDER_FEMALE)
return true;
gender_full = "female";
new_displayId = player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1;
gender = GENDER_FEMALE;
}
else
{
SendSysMessage(LANG_MUST_MALE_OR_FEMALE);
SetSentErrorMessage(true);
return false;
}
// Set gender
player->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender);
// Change display ID
player->SetDisplayId(new_displayId);
player->SetNativeDisplayId(new_displayId);
PSendSysMessage(LANG_YOU_CHANGE_GENDER, player->GetName(),gender_full);
if (needReportToTarget(player))
ChatHandler(player).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full,GetName());
return true;
}
/*------------------------------------------
*-------------TRINITY----------------------
*-------------------------------------*/
bool ChatHandler::HandlePlayAllCommand(const char* args)
{
if(!*args)
@@ -6570,69 +6648,6 @@ bool ChatHandler::HandlePlayAllCommand(const char* args)
return true;
}
bool ChatHandler::HandleModifyGenderCommand(const char *args)
{
if(!*args) return false;
Player *player = getSelectedPlayer();
if(!player)
{
PSendSysMessage(LANG_NO_PLAYER);
SetSentErrorMessage(true);
return false;
}
std::string gender = (char*)args;
uint32 displayId = player->GetNativeDisplayId();
if(gender == "male") // MALE
{
if(player->getGender() == GENDER_MALE)
{
PSendSysMessage("%s is already male", player->GetName());
SetSentErrorMessage(true);
return false;
}
// Set gender
player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_MALE);
// Change display ID
player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1);
player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1);
ChatHandler(player).PSendSysMessage("Gender changed. You are now a man!");
PSendSysMessage("Gender changed for %s", player->GetName());
return true;
}
else if(gender == "female") // FEMALE
{
if(player->getGender() == GENDER_FEMALE)
{
PSendSysMessage("%s is already female", player->GetName());
SetSentErrorMessage(true);
return false;
}
// Set gender
player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_FEMALE);
// Change display ID
player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1);
player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1);
ChatHandler(player).PSendSysMessage("Gender changed. You are now a woman!");
PSendSysMessage("Gender changed for %s", player->GetName());
return true;
}
else
{
PSendSysMessage("You must use male or female as gender.");
SetSentErrorMessage(true);
return false;
}
return true;
}
bool ChatHandler::HandleFreezeCommand(const char *args)
{
std::string name;
+3 -3
View File
@@ -232,7 +232,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
{
sLog.outCommand("GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
sLog.outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
GetPlayerName(), GetAccountId(), mailItem.item->GetProto()->Name1, mailItem.item->GetEntry(), mailItem.item->GetCount(), receiver.c_str(), rc_account);
}
@@ -251,7 +251,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
if(money > 0 && GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand("GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account);
}
}
@@ -460,7 +460,7 @@ void WorldSession::HandleTakeItem(WorldPacket & recv_data )
if(!objmgr.GetPlayerNameByGUID(sender_guid,sender_name))
sender_name = objmgr.GetTrinityStringForDBCLocale(LANG_UNKNOWN);
}
sLog.outCommand("GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount(),m->COD,sender_name.c_str(),sender_accId);
}
else if(!receive)
+1 -3
View File
@@ -1275,14 +1275,12 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
return;
}
if(charname.empty())
if(charname.empty() || !normalizePlayerName (charname))
{
SendNotification(LANG_NEED_CHARACTER_NAME);
return;
}
normalizePlayerName (charname);
Player *plr = objmgr.GetPlayer(charname.c_str());
if(!plr)
+1 -1
View File
@@ -401,7 +401,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction )
uint32 owner_accid = GetPlayerAccountIdByGUID(auction->owner);
sLog.outCommand("GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
bidder_name.c_str(),bidder_accId,pItem->GetProto()->Name1,pItem->GetEntry(),pItem->GetCount(),auction->bid,owner_name.c_str(),owner_accid);
}
}
+13 -3
View File
@@ -11936,7 +11936,7 @@ void Player::SendPreparedQuest( uint64 guid )
else if( status == DIALOG_STATUS_INCOMPLETE )
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, false, true );
// Send completable on repeatable quest if player don't have quest
else if( pQuest->IsRepeatable() )
else if( pQuest->IsRepeatable() && !pQuest->IsDaily() )
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanCompleteRepeatableQuest(pQuest), true );
else
PlayerTalkClass->SendQuestGiverQuestDetails( pQuest, guid, true );
@@ -12178,7 +12178,7 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
if(!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE)
return false;
// daily quest can't be rewarded (10 daily quest already completed)
// daily quest can't be rewarded (25 daily quest already completed)
if(!SatisfyQuestDay(pQuest,true))
return false;
@@ -12779,6 +12779,15 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
if(exclude_Id == qInfo->GetQuestId())
continue;
// not allow have daily quest if daily quest from exclusive group already recently completed
Quest const* Nquest = objmgr.GetQuestTemplate(exclude_Id);
if( !SatisfyQuestDay(Nquest, false) )
{
if( msg )
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id );
// alternative quest already started or completed
@@ -14658,7 +14667,8 @@ void Player::_LoadQuestStatus(QueryResult *result)
// add to quest log
if( slot < MAX_QUEST_LOG_SIZE &&
( questStatusData.m_status==QUEST_STATUS_INCOMPLETE ||
questStatusData.m_status==QUEST_STATUS_COMPLETE && !questStatusData.m_rewarded ) )
questStatusData.m_status==QUEST_STATUS_COMPLETE &&
(!questStatusData.m_rewarded || pQuest->IsDaily()) ) )
{
SetQuestSlot(slot,quest_id,quest_time);
+6 -2
View File
@@ -3824,10 +3824,12 @@ void Spell::EffectEnchantItemPerm(uint32 i)
return;
if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
sLog.outCommand("GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
{
sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
p_caster->GetName(),p_caster->GetSession()->GetAccountId(),
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
item_owner->ApplyEnchantment(itemTarget,PERM_ENCHANTMENT_SLOT,false);
@@ -3953,10 +3955,12 @@ void Spell::EffectEnchantItemTmp(uint32 i)
return;
if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
sLog.outCommand("GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
{
sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
p_caster->GetName(),p_caster->GetSession()->GetAccountId(),
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,false);
+12 -4
View File
@@ -195,10 +195,12 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
// logging
sLog.outDebug("partner storing: %u",myItems[i]->GetGUIDLow());
if( _player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
sLog.outCommand("GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
{
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
_player->GetName(),_player->GetSession()->GetAccountId(),
myItems[i]->GetProto()->Name1,myItems[i]->GetEntry(),myItems[i]->GetCount(),
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
}
// store
_player->pTrader->MoveItemToInventory( traderDst, myItems[i], true, true);
@@ -208,10 +210,12 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
// logging
sLog.outDebug("player storing: %u",hisItems[i]->GetGUIDLow());
if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
sLog.outCommand("GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
{
sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
hisItems[i]->GetProto()->Name1,hisItems[i]->GetEntry(),hisItems[i]->GetCount(),
_player->GetName(),_player->GetSession()->GetAccountId());
}
// store
_player->MoveItemToInventory( playerDst, hisItems[i], true, true);
@@ -378,15 +382,19 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
if(sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
if( _player->GetSession()->GetSecurity() > SEC_PLAYER && _player->tradeGold > 0)
sLog.outCommand("GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
{
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
_player->GetName(),_player->GetSession()->GetAccountId(),
_player->tradeGold,
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
}
if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && _player->pTrader->tradeGold > 0)
sLog.outCommand("GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
{
sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
_player->pTrader->tradeGold,
_player->GetName(),_player->GetSession()->GetAccountId());
}
}
// update money
+2 -2
View File
@@ -6932,7 +6932,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
data << uint32(AI_REACTION_AGGRO); // Aggro sound
((WorldObject*)this)->SendMessageToSet(&data, true);
((Creature*)this)->CallAssistence();
((Creature*)this)->CallAssistance();
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
}
@@ -6966,7 +6966,7 @@ bool Unit::AttackStop()
if( GetTypeId()==TYPEID_UNIT )
{
// reset call assistance
((Creature*)this)->SetNoCallAssistence(false);
((Creature*)this)->SetNoCallAssistance(false);
}
SendAttackStop(victim);
+2 -1
View File
@@ -738,7 +738,8 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_EVENT_ANNOUNCE] = sConfig.GetIntDefault("Event.Announce",0);
m_configs[CONFIG_CREATURE_FAMILY_ASSISTEMCE_RADIUS] = sConfig.GetIntDefault("CreatureFamilyAssistenceRadius",10);
m_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS] = sConfig.GetIntDefault("CreatureFamilyAssistanceRadius",10);
m_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY] = sConfig.GetIntDefault("CreatureFamilyAssistanceDelay",1500);
m_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfig.GetIntDefault("WorldBossLevelDiff",3);
+2 -1
View File
@@ -147,7 +147,8 @@ enum WorldConfigs
CONFIG_CHATFLOOD_MESSAGE_DELAY,
CONFIG_CHATFLOOD_MUTE_TIME,
CONFIG_EVENT_ANNOUNCE,
CONFIG_CREATURE_FAMILY_ASSISTEMCE_RADIUS,
CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS,
CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY,
CONFIG_WORLD_BOSS_LEVEL_DIFF,
CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF,
CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF,