Jump to content

et65

Members
  • Posts

    7
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

About et65

  • Birthday 01/01/1

et65's Achievements

Newbie

Newbie (1/3)

0

Reputation

  1. Yes I know, you've to replace all. I did the error in all of the commands.
  2. I found the error. It's because of this lines : if(!cId && m_session->GetPlayer()->GetSelectedObject() != 0) guid = m_session->GetPlayer()->GetSelectedObject(); if(cId) guid = atoi(cId); or if(!cId && m_session->GetPlayer()->GetSelectedObject() != 0) lowguid = m_session->GetPlayer()->GetSelectedObject(); if(cId) lowguid = atoi(cId); Replace it by : if(cId) guid = atoi(cId); else guid = m_session->GetPlayer()->GetSelectedObject(); and if(cId) lowguid = atoi(cId); else lowguid = m_session->GetPlayer()->GetSelectedObject();
  3. Yes, I forgot it. You can modify the table "commands" to change the command's description, too. And the patch doesn't work ? Did you really put ".gobject target" and after ".gobject del" ?
  4. Hello. I created this patch yesterday. It is really simple but very effective. It allows you to delete, move, rotate, or go on a gameobject without typing its GUID. You first enter ".gobject target" and then you just type ".gobject del" or ".gobject turn" or ".gobject move" or ".go object" to use these commands. Of course you can still use the old method of typing the GUID. diff --git a/src/game/Language.h b/src/game/Language.h index 986f288..4f45929 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -829,6 +829,7 @@ enum MangosStrings // 10000-10999 // Use for custom patches 11000-11999 + LANG_NOGOSELECTED = 11500, // NOT RESERVED IDS 12000-1999999999 // `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 3e28e8c..c657411 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -342,19 +342,21 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args) //teleport to gameobject bool ChatHandler::HandleGoObjectCommand(const char* args) { - if(!*args) - return false; - Player* _player = m_session->GetPlayer(); // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; + if(!cId && m_session->GetPlayer()->GetSelectedObject() == 0) + { + PSendSysMessage(LANG_NOGOSELECTED); + return true; + } - int32 guid = atoi(cId); - if(!guid) - return false; + int32 guid = 0; + if(!cId && m_session->GetPlayer()->GetSelectedObject() != 0) + guid = m_session->GetPlayer()->GetSelectedObject(); + if(cId) + guid = atoi(cId); float x, y, z, ort; int mapid; @@ -393,6 +395,7 @@ bool ChatHandler::HandleGoObjectCommand(const char* args) _player->SaveRecallPosition(); _player->TeleportTo(mapid, x, y, z, ort); + m_session->GetPlayer()->SetSelectedObject(0); return true; } @@ -496,6 +499,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) GameObject* target = m_session->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid,id,HIGHGUID_GAMEOBJECT)); PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name, lowguid, id, x, y, z, mapid, o); + m_session->GetPlayer()->SetSelectedObject(lowguid); if(target) { @@ -516,12 +520,17 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args) { // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; + if(!cId && m_session->GetPlayer()->GetSelectedObject() == 0) + { + PSendSysMessage(LANG_NOGOSELECTED); + return true; + } - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; + uint32 lowguid = 0; + if(!cId && m_session->GetPlayer()->GetSelectedObject() != 0) + lowguid = m_session->GetPlayer()->GetSelectedObject(); + if(cId) + lowguid = atoi(cId); GameObject* obj = NULL; @@ -555,6 +564,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args) obj->DeleteFromDB(); PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow()); + m_session->GetPlayer()->SetSelectedObject(0); return true; } @@ -564,12 +574,17 @@ bool ChatHandler::HandleGameObjectTurnCommand(const char* args) { // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; + if(!cId && m_session->GetPlayer()->GetSelectedObject() == 0) + { + PSendSysMessage(LANG_NOGOSELECTED); + return true; + } - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; + uint32 lowguid = 0; + if(!cId && m_session->GetPlayer()->GetSelectedObject() != 0) + lowguid = m_session->GetPlayer()->GetSelectedObject(); + if(cId) + lowguid = atoi(cId); GameObject* obj = NULL; @@ -618,12 +633,17 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args) { // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; + if(!cId && m_session->GetPlayer()->GetSelectedObject() == 0) + { + PSendSysMessage(LANG_NOGOSELECTED); + return true; + } - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; + uint32 lowguid = 0; + if(!cId && m_session->GetPlayer()->GetSelectedObject() != 0) + lowguid = m_session->GetPlayer()->GetSelectedObject(); + if(cId) + lowguid = atoi(cId); GameObject* obj = NULL; @@ -681,6 +701,7 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args) obj->Refresh(); PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow()); + m_session->GetPlayer()->SetSelectedObject(0); return true; } @@ -769,12 +790,17 @@ bool ChatHandler::HandleGameObjectPhaseCommand(const char* args) { // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; + if(!cId && m_session->GetPlayer()->GetSelectedObject() == 0) + { + PSendSysMessage(LANG_NOGOSELECTED); + return true; + } - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; + uint32 lowguid = 0; + if(!cId && m_session->GetPlayer()->GetSelectedObject() != 0) + lowguid = m_session->GetPlayer()->GetSelectedObject(); + if(cId) + lowguid = atoi(cId); GameObject* obj = NULL; @@ -4504,4 +4530,4 @@ bool ChatHandler::HandleTitlesCurrentCommand(const char* args) PSendSysMessage(LANG_TITLE_CURRENT_RES, id, titleInfo->name[GetSessionDbcLocale()], tNameLink.c_str()); return true; -} +} \\ No newline at end of file diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8f5b70a..c1e2029 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -328,6 +328,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa // players always accept if(GetSession()->GetSecurity() == SEC_PLAYER) SetAcceptWhispers(true); + + m_Selected_object = 0; m_curSelection = 0; m_lootGuid = 0; diff --git a/src/game/Player.h b/src/game/Player.h index 9b3669a..e300fca 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1111,6 +1111,8 @@ class MANGOS_DLL_SPEC Player : public Unit void SetTaxiCheater(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; } bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); } void SetGMVisible(bool on); + void SetSelectedObject(uint32 value){ m_Selected_object = value; }; + uint32 GetSelectedObject() { return m_Selected_object; }; uint32 m_Selected_object; void SetPvPDeath(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } void GiveXP(uint32 xp, Unit* victim); Here, Best regards, et65. _____________________________________ In French/En français : Bonjour. J'ai créé ce patch hier. Il est vraiment simple mais très efficace. Il vous permet de pouvoir supprimer, bouger, tourner, ou aller sur un gameobject sans taper son GUID. Vous tapez d'abord ".gobject target" et après vous n'avez qu'à taper ".gobject del" ou ".gobject turn" ou ".gobject move" ou ".go object" pour utiliser ces commandes. Bien-sûr vous pouvez toujours utiliser l'ancienne méthode qui consiste à taper le GUID. Voilà, Cordialement, et65.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use