EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Show helmet option (https://www.eqemulator.org/forums/showthread.php?t=27954)

realityincarnate 04-19-2009 11:28 PM

Show helmet option
 
These are a couple of small changes to the structure and encoding files that fix the option to show or not show helmet graphics. With these changes, the client's selection will persist through zoning and camping, rather than reseting like it currently does.

Code:

Index: common/eq_constants.h
===================================================================
--- common/eq_constants.h        (revision 437)
+++ common/eq_constants.h        (working copy)
@@ -148,6 +148,7 @@
 #define AT_Split                        28        // 0 = normal, 1 = autosplit on
 #define AT_Size                                29        // spawn's size
 #define AT_NPCName                31        // change PC's name's color to NPC color 0 = normal, 1 = npc name
+#define AT_ShowHelmet        43        // 0 = do not show helmet graphic, 1 = show graphic
 //#define AT_Trader                        300  // Bazzar Trader Mode
 
 // solar: animations for AT_Anim
Index: common/eq_packet_structs.h
===================================================================
--- common/eq_packet_structs.h        (revision 437)
+++ common/eq_packet_structs.h        (working copy)
@@ -880,7 +880,7 @@
 /*7204*/        uint32                                career_tribute_points;
 /*7208*/        uint32                                unknown6056;
 /*7212*/        uint32                                tribute_points;
-/*7216*/        uint32                                unknown6064;
+/*7216*/        uint32                                showhelm;                        //0=don't show helmet graphics, 1=
 /*7220*/        uint32                                tribute_active;                //1=active
 /*7224*/        Tribute_Struct                tributes[MAX_PLAYER_TRIBUTES];
 /*7264*/        Disciplines_Struct        disciplines;                        //fathernitwit: 10-06-04
 Index: common/patches/SoF.cpp
===================================================================
--- common/patches/SoF.cpp        (revision 437)
+++ common/patches/SoF.cpp        (working copy)
@@ -586,8 +586,7 @@
        OUT(raidAutoconsent);
        OUT(guildAutoconsent);
 //        OUT(unknown19575[5]);
-//        OUT(showhelm);
-        eq->showhelm = 1;
+        eq->showhelm = emu->showhelm;
        OUT(RestTimer);
 //        OUT(unknown19584[4]);
 //        OUT(unknown19588);
Index: common/patches/Titanium.cpp
===================================================================
--- common/patches/Titanium.cpp        (revision 437)
+++ common/patches/Titanium.cpp        (working copy)
@@ -382,8 +382,7 @@
        OUT(raidAutoconsent);
        OUT(guildAutoconsent);
 //        OUT(unknown19575[5]);
-//        OUT(showhelm);
-        eq->showhelm = 1;
+        eq->showhelm = emu->showhelm;
 //        OUT(unknown19584[4]);
 //        OUT(unknown19588);
 
@@ -470,7 +469,7 @@
 //                eq->padding0070 = emu->padding0070;
                eq->eyecolor1 = emu->eyecolor1;
 //                eq->unknown0115[24] = emu->unknown0115[24];
-                eq->showhelm = true;
+                eq->showhelm = emu->showhelm;
 //                eq->unknown0140[4] = emu->unknown0140[4];
                eq->is_npc = emu->is_npc;
                eq->hairstyle = emu->hairstyle;
Index: zone/client_packet.cpp
===================================================================
--- zone/client_packet.cpp        (revision 437)
+++ zone/client_packet.cpp        (working copy)
@@ -2083,6 +2083,9 @@
                // don't do anything with this, we tell the client when it's
                // levitating, not the other way around
        }
+        else if (sa->type == AT_ShowHelmet) {        // a client has changed the "Show My Helm" option
+                m_pp.showhelm = (sa->parameter == 1);
+        }
        else {
                cout << "Unknown SpawnAppearance type: 0x" << hex << setw(4) << setfill('0') << sa->type << dec
                        << " value: 0x" << hex << setw(8) << setfill('0') << sa->parameter << dec << endl;
@@ -7155,7 +7158,7 @@
        if(!p_timers.Load(&database)) {
                LogFile->write(EQEMuLog::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID());
        }
-
+       
 #ifdef _EQDEBUG
        printf("Dumping inventory on load:\n");
        m_inv.dumpInventory();


cavedude 04-21-2009 02:09 PM

This appears to have the opposite effect it did previously. Now, helms default to off until you turn then back on in options. Once you zone/camp the helm disappears, and you have to recheck Show My Helm.

As a side note, this has also brought back the twisted head bug. To see what I mean, check out Qeynos guards on PEQ.

I have not tested this on Windows, but I got the same results on my internal server and on PEQ both running Gentoo.

realityincarnate 04-21-2009 03:14 PM

Hmmm, the actual helmet option seems to work fine on my end (although it does default to off until turned on the first time). I don't have any idea why that would be.

But I did just notice the twisted heads last night. I guess there weren't any affected npcs in the places I tested. I'll take a look and see if I can clean it up.

realityincarnate 04-21-2009 07:34 PM

for real this time...
 
Ok, I think I've got the problems nailed down. The reason it only worked on my end is that I somehow missed a file in the diff the first time around. But I tinkered some more and it seems to be retaining the correct settings, and there's no sign of any twisted faces. Sorry about the sloppiness, I hope it didn't cause any real inconvenience.

Here's a fresh diff
Code:

Index: common/eq_constants.h
===================================================================
--- common/eq_constants.h        (revision 438)
+++ common/eq_constants.h        (working copy)
@@ -148,6 +148,7 @@
 #define AT_Split                        28        // 0 = normal, 1 = autosplit on
 #define AT_Size                                29        // spawn's size
 #define AT_NPCName                31        // change PC's name's color to NPC color 0 = normal, 1 = npc name
+#define AT_ShowHelm        43        // 0 = do not show helmet graphic, 1 = show graphic
 //#define AT_Trader                        300  // Bazzar Trader Mode
 
 // solar: animations for AT_Anim
Index: common/eq_packet_structs.h
===================================================================
--- common/eq_packet_structs.h        (revision 438)
+++ common/eq_packet_structs.h        (working copy)
@@ -876,7 +876,7 @@
 /*7080*/        sint32                                ldon_points_available;
 /*7084*/        uint8                                unknown5940[112];
 /*7196*/        uint32                                tribute_time_remaining;        //in miliseconds
-/*7200*/        uint32                                unknown6048;
+/*7200*/        uint32                                showhelm;
 /*7204*/        uint32                                career_tribute_points;
 /*7208*/        uint32                                unknown6056;
 /*7212*/        uint32                                tribute_points;
Index: common/patches/SoF.cpp
===================================================================
--- common/patches/SoF.cpp        (revision 438)
+++ common/patches/SoF.cpp        (working copy)
@@ -586,8 +586,7 @@
        OUT(raidAutoconsent);
        OUT(guildAutoconsent);
 //        OUT(unknown19575[5]);
-//        OUT(showhelm);
-        eq->showhelm = 1;
+        eq->showhelm = emu->showhelm;
        OUT(RestTimer);
 //        OUT(unknown19584[4]);
 //        OUT(unknown19588);
Index: common/patches/Titanium.cpp
===================================================================
--- common/patches/Titanium.cpp        (revision 438)
+++ common/patches/Titanium.cpp        (working copy)
@@ -382,8 +382,7 @@
        OUT(raidAutoconsent);
        OUT(guildAutoconsent);
 //        OUT(unknown19575[5]);
-//        OUT(showhelm);
-        eq->showhelm = 1;
+        eq->showhelm = emu->showhelm;
 //        OUT(unknown19584[4]);
 //        OUT(unknown19588);
 
@@ -470,7 +469,7 @@
 //                eq->padding0070 = emu->padding0070;
                eq->eyecolor1 = emu->eyecolor1;
 //                eq->unknown0115[24] = emu->unknown0115[24];
-                eq->showhelm = true;
+                eq->showhelm = emu->showhelm;
 //                eq->unknown0140[4] = emu->unknown0140[4];
                eq->is_npc = emu->is_npc;
                eq->hairstyle = emu->hairstyle;
Index: zone/client.cpp
===================================================================
--- zone/client.cpp        (revision 438)
+++ zone/client.cpp        (working copy)
@@ -1579,6 +1579,7 @@
        }
        ns->spawn.size                        = 0; // Changing size works, but then movement stops! (wth?)
        ns->spawn.runspeed                = (gmspeed == 0) ? runspeed : 3.125f;
+        if (!m_pp.showhelm) ns->spawn.showhelm = 0;
 
        // @merth: pp also hold this info; should we pull from there or inventory?
        // (update: i think pp should do it, as this holds LoY dye - plus, this is ugly code with Inventory!)
Index: zone/client_packet.cpp
===================================================================
--- zone/client_packet.cpp        (revision 438)
+++ zone/client_packet.cpp        (working copy)
@@ -2083,6 +2083,10 @@
                // don't do anything with this, we tell the client when it's
                // levitating, not the other way around
        }
+        else if (sa->type == AT_ShowHelm)
+        {
+                m_pp.showhelm = (sa->parameter == 1);
+        }
        else {
                cout << "Unknown SpawnAppearance type: 0x" << hex << setw(4) << setfill('0') << sa->type << dec
                        << " value: 0x" << hex << setw(8) << setfill('0') << sa->parameter << dec << endl;
Index: zone/mob.cpp
===================================================================
--- zone/mob.cpp        (revision 438)
+++ zone/mob.cpp        (working copy)
@@ -713,8 +713,8 @@
        ns->spawn.findable        = findable?1:0;
 // vesuvias - appearence fix
        ns->spawn.light                = light;
+        ns->spawn.showhelm = 1;       
 
-
        ns->spawn.invis                = (invisible || hidden) ? 1 : 0;        // TODO: load this before spawning players
        ns->spawn.NPC                = IsClient() ? 0 : 1;
        ns->spawn.petOwnerId        = ownerid;


cavedude 04-23-2009 10:24 AM

This is working perfectly now, thank you!

warhawk 04-23-2009 06:46 PM

I've been wanting this to work for ages !

Thanks so much realityincarnate :D

So_1337 04-24-2009 09:25 AM

Seriously, thanks a ton. This has always been a nuisance. I usually try not to clutter up code submission threads with thanks and praise, but it looks like this one's implemented and working smoothly, so I don't feel so bad =)

You and BWStripes have both been diving into the code recently and submitting some good fixes, thank you very much for doing so.

cavedude 05-03-2009 04:17 PM

This has been committed in Revision 454.


All times are GMT -4. The time now is 01:26 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.