Voici un petit patch de ma création qui permet d'implanté le système dont je me souviens sous Ascent vers Mangos :
Afin de faciliter le delete de GameObjects, un .gob target sauvegardera votre séléction, et un .gob delete sans argument supprimera le dernier objet séléctionné.
Exemple : je .gob tar une chaise, je tape ensuite .gob del, cette chaise sera delete sans que j'aie du entrer son ID.
[code=diff]
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index bde2e71..06ab3dd 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -595,6 +595,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_lastFallTime = 0;
m_lastFallZ = 0;
+
+ m_LastTargetGO = 0;
}
Player::~Player ()
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index d75a4df..bdc709f 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -805,6 +805,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()->SetLastTargetGO(lowguid);
if (target)
{
@@ -827,12 +828,21 @@ 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;
-
- uint32 lowguid = atoi(cId);
- if (!lowguid)
- return false;
+ uint32 lowguid = 0;
+ if (cId)
+ {
+ lowguid = atoi(cId);
+ if (!lowguid)
+ return false;
+ }
+ else if(m_session->GetPlayer()->GetLastTargetGO())
+ {
+ lowguid = m_session->GetPlayer()->GetLastTargetGO();
+ }
+ else
+ {
+ return false;
+ }
GameObject* obj = NULL;
diff --git a/src/game/Player.h b/src/game/Player.h
index d4ba36e..fcd7dc7 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -2383,6 +2383,10 @@ class MANGOS_DLL_SPEC Player : public Unit
void SetTitle(CharTitlesEntry const* title, bool lost = false);
bool canSeeSpellClickOn(Creature const* creature) const;
+
+ void SetLastTargetGO(uint32 guid) {m_LastTargetGO = guid;}
+ uint32 GetLastTargetGO() {return m_LastTargetGO;}
+
protected:
uint32 m_contestedPvPTimer;
@@ -2686,6 +2690,8 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 m_timeSyncTimer;
uint32 m_timeSyncClient;
uint32 m_timeSyncServer;
+
+ uint32 m_LastTargetGO;
};
void AddItemsSetItem(Player*player,Item *item);
[/code]
ATTENTION : Ce code n'as pas été testé Ingame, mais normalement ca devrait fonctionner :)
Edit : Edition du patch suite à la remarque de Mash6