From 01f670871d572a19c6942f9a1149cd9170e6fffb Mon Sep 17 00:00:00 2001 From: Lutz Date: Tue, 15 Aug 2017 18:13:42 -0500 Subject: [PATCH 1/5] + Added function 'closeIdentifyGUI()' --- src/interface/identify_and_appraise.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/interface/identify_and_appraise.cpp b/src/interface/identify_and_appraise.cpp index b7c8f6160..91bcb8465 100644 --- a/src/interface/identify_and_appraise.cpp +++ b/src/interface/identify_and_appraise.cpp @@ -407,6 +407,13 @@ int getAppraisalTime(Item* item) return appraisal_time; } +void closeIdentifyGUI() +{ + identifygui_active = false; + + selectedIdentifySlot = -1; +} + inline Item* getItemInfoFromIdentifyGUI(int slot) { if ( slot >= 4 ) From 9b706263328edb87b6574c57109ba88ea7cbf030 Mon Sep 17 00:00:00 2001 From: Lutz Date: Tue, 15 Aug 2017 18:18:42 -0500 Subject: [PATCH 2/5] + Added the header declaration for 'closeIdentifyGUI()' --- src/interface/interface.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/interface/interface.hpp b/src/interface/interface.hpp index de2366536..f15727979 100644 --- a/src/interface/interface.hpp +++ b/src/interface/interface.hpp @@ -217,6 +217,7 @@ extern int selectedIdentifySlot; void selectIdentifySlot(int slot); void warpMouseToSelectedIdentifySlot(); +void closeIdentifyGUI(); void updateIdentifyGUI(); //Updates the identify item GUI. void identifyGUIIdentify(Item* item); //Identify the given item. int getAppraisalTime(Item* item); // Return time in ticks needed to appraise an item From 201ffb800c34c392dff428c4cecc06b84d0cc9cf Mon Sep 17 00:00:00 2001 From: Lutz Date: Tue, 15 Aug 2017 18:29:07 -0500 Subject: [PATCH 3/5] + Added a check to 'closeIdentifyGUI()' --- src/magic/castSpell.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/magic/castSpell.cpp b/src/magic/castSpell.cpp index 301aa48e2..32c2d20f2 100644 --- a/src/magic/castSpell.cpp +++ b/src/magic/castSpell.cpp @@ -569,6 +569,10 @@ Entity* castSpell(Uint32 caster_uid, spell_t* spell, bool using_magicstaff, bool gui_mode = GUI_MODE_INVENTORY; //Reset the GUI to the inventory. removecursegui_active = true; identifygui_active = false; + if ( identifygui_active ) + { + closeIdentifyGUI(); + } if ( openedChest[i] ) { openedChest[i]->closeChest(); From ab7e07ce31fbb99d90dff96d2f06cc50529c655a Mon Sep 17 00:00:00 2001 From: Lutz Date: Tue, 15 Aug 2017 18:57:03 -0500 Subject: [PATCH 4/5] + Added a new packet type to be handled 'CRCU' handles Client Remove Curse GUI --- src/net.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/net.cpp b/src/net.cpp index 9ff24af91..06658b685 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2409,6 +2409,28 @@ void clientHandlePacket() return; } + //Open up the Remove Curse GUI + else if ( !strncmp((char*)net_packet->data, "CRCU", 4) ) + { + removecursegui_active = true; + shootmode = false; + gui_mode = GUI_MODE_INVENTORY; //Reset the GUI to the inventory. + if ( identifygui_active ) + { + closeIdentifyGUI(); + } + if ( openedChest[clientnum] ) + { + openedChest[clientnum]->closeChest(); + } + + //Initialize Remove Curse GUI game controller code here. + initRemoveCurseGUIControllerCode(); + + return; + } + + //Add a spell to the channeled spells list. else if (!strncmp((char*)net_packet->data, "CHAN", 4)) { From 6870aa271a8cc9f13367538df20fd12576b7a926 Mon Sep 17 00:00:00 2001 From: Lutz Date: Tue, 15 Aug 2017 18:57:36 -0500 Subject: [PATCH 5/5] * Changed the packet type from 'RCUR' to 'CRCU' --- src/magic/castSpell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magic/castSpell.cpp b/src/magic/castSpell.cpp index 32c2d20f2..ef764bc98 100644 --- a/src/magic/castSpell.cpp +++ b/src/magic/castSpell.cpp @@ -556,7 +556,7 @@ Entity* castSpell(Uint32 caster_uid, spell_t* spell, bool using_magicstaff, bool if (i != 0) { //Tell the client to uncurse an item. - strcpy((char*)net_packet->data, "RCUR"); //TODO: Send a different packet, to pop open the remove curse GUI. + strcpy((char*)net_packet->data, "CRCU"); net_packet->address.host = net_clients[i - 1].host; net_packet->address.port = net_clients[i - 1].port; net_packet->len = 4;