User Tools

Site Tools


client:gtk:gtk1:missing_callbacks_patch

Missing Callbacks Patch

The older GTK-1 clients were not so bad, but they were disbanded and excluded in the source code since v1.50 .
It is still possible to login and create a character using the older GTK-1 clients at servers v1.50 and beyond. But many messages send by the newer servers are not drawn by these older clients, because they have not included many newer message type definitions.

This patch aims to fix this issue. I have started with client v1.10, but messed up the files therein, while trying to take out code into headers, to make it easier to maintain, so it became v1.11;
SVN revision 8309

diff -NBwrup crossfire-client-1.11.0-orig/common/svnversion.h crossfire-client-1.11.0/common/svnversion.h
--- crossfire-client-1.11.0-orig/common/svnversion.h	2008-01-29 06:30:37.000000000 -0100
+++ crossfire-client-1.11.0/common/svnversion.h	1969-12-31 23:00:00.000000000 -0100
@@ -1,2 +0,0 @@
-/* Auto-generated at build time. */
-#define SVN_REV "8309"

My guess is, that this patch would apply also to v1.12 and v1.10 .
I have just taken the MSG_TYPES from v1.70 and copied them, and added the already existing callback admin_callback to these.
Files to patch : client/common/newclient.h and client/gtk/text.c . 230 lines.

diff -NBwrup crossfire-client-1.11.0-orig/common/newclient.h crossfire-client-1.11.0/common/newclient.h
--- crossfire-client-1.11.0-orig/common/newclient.h	2008-01-29 06:29:05.000000000 -0100
+++ crossfire-client-1.11.0/common/newclient.h	2018-03-08 15:20:39.958094197 -0100
@@ -315,14 +315,34 @@ enum {a_none, a_readied, a_wielded, a_wo
 #define MSG_TYPE_BOOK		    1
 #define MSG_TYPE_CARD		    2
 #define MSG_TYPE_PAPER		    3
+
 #define MSG_TYPE_SIGN		    4
 #define MSG_TYPE_MONUMENT	    5
+
 #define MSG_TYPE_SCRIPTED_DIALOG    6
+
 #define MSG_TYPE_MOTD		    7
 #define MSG_TYPE_ADMIN		    8
+
 #define MSG_TYPE_SHOP		    9
 #define MSG_TYPE_COMMAND	    10	/* Responses to commands, eg, who */
-#define MSG_TYPE_LAST		    11
+/* */
+#define MSG_TYPE_ATTRIBUTE            11 /**< Changes to attributes (stats,
+                                          *   resistances, etc) */
+#define MSG_TYPE_SKILL                12 /**< Messages related to skill use. */
+#define MSG_TYPE_APPLY                13 /**< Applying objects */
+#define MSG_TYPE_ATTACK               14 /**< Attack related messages */
+#define MSG_TYPE_COMMUNICATION        15 /**< Communication between players */
+#define MSG_TYPE_SPELL                16 /**< Spell related info */
+#define MSG_TYPE_ITEM                 17 /**< Item related information */
+#define MSG_TYPE_MISC                 18 /**< Messages that don't go
+                                           * elsewhere */
+#define MSG_TYPE_VICTIM               19 /**< Something bad is happening to
+                                           *  the player. */
+#define MSG_TYPE_CLIENT               20 /**< Client originated Messages */
+/* */
+//#define MSG_TYPE_LAST               11
+#define MSG_TYPE_LAST               21
 
 #define MSG_SUBTYPE_NONE         0
 
@@ -429,6 +449,152 @@ enum {a_none, a_readied, a_wielded, a_wo
 #define MSG_TYPE_COMMAND_INFO	    8	/* Generic info - reistances, etc */
 #define MSG_TYPE_COMMAND_QUESTS	    9	/* Quest info */
+/* */
+#define MSG_TYPE_COMMAND_DEBUG        10 /**< Various debug type commands */
+#define MSG_TYPE_COMMAND_ERROR        11 /**< Bad syntax/can't use command */
+#define MSG_TYPE_COMMAND_SUCCESS      12 /**< Successful result from command */
+#define MSG_TYPE_COMMAND_FAILURE      13 /**< Failed result from command */
+#define MSG_TYPE_COMMAND_EXAMINE      14 /**< Player examining something */
+#define MSG_TYPE_COMMAND_INVENTORY    15 /**< Inventory listing */
+#define MSG_TYPE_COMMAND_HELP         16 /**< Help related information */
+#define MSG_TYPE_COMMAND_DM           17 /**< DM related commands */
+#define MSG_TYPE_COMMAND_NEWPLAYER    18 /**< Create a new character - not
+                                          *    really a command, but is
+                                          *    responding to player input
+                                          */
+
+
+/* This is somewhat verbose.  If the client ends up being able to
+ * choose various attributes based on message type, I think it is important
+ * for the client to know if this is a benefit or detriment to the player.
+ * In the case of losing a bonus, this typically indicates a spell has
+ * ended, which is probably more important (and should be displayed more
+ * prominently) than when you cast the spell
+ */
+
+#define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN    1 /**< Atacktypes here refer to */
+#define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS    2 /**< the player gaining or
+                                                 *   losing these attacktypes
+                                                 *   not being a victim of an
+                                                 *   attacktype.
+                                                 */
+#define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN    3 /**< Protections in this */
+#define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS    4 /**< context  are pretty
+                                                 *   generic - things like
+                                                 *   reflection or lifesave
+                                                 *   are also under the
+                                                 *   protection category.
+                                                 */
+#define MSG_TYPE_ATTRIBUTE_MOVE               5 /**< A change in the movement
+                                                 *   type of the player. */
+#define MSG_TYPE_ATTRIBUTE_RACE               6 /**< Race-related changes. */
+#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START   7 /**< Start of a bad effect
+                                                 *   to the player. */
+#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END     8 /**< End of a bad effect. */
+#define MSG_TYPE_ATTRIBUTE_STAT_GAIN          9
+#define MSG_TYPE_ATTRIBUTE_STAT_LOSS         10
+#define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN        11
+#define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS        12
+#define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START 13 /**< Start of a good effect to
+                                                 *   the player. */
+#define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END   14 /**< End of a good effect. */
+#define MSG_TYPE_ATTRIBUTE_GOD               15 /**< changing god info */
+
+/* I think one type/skill is overkill, so instead, use broader categories
+ * for these messages.
+ * The difference in ERROR vs FAILURE is basically this:  ERROR indicates
+ * something wasn't right to even attempt to use the skill (don't have
+ * needed object, or haven't marked objects, etc).
+ * FAILURE indicates that player attempted to use the skill, but it
+ * didn't work.
+ * PRAY is listed out because praying over altars can generate some
+ * messages not really related to the skill itself.
+ */
+#define MSG_TYPE_SKILL_MISSING        1 /**< Don't have the skill */
+#define MSG_TYPE_SKILL_ERROR          2 /**< Doing something wrong */
+#define MSG_TYPE_SKILL_SUCCESS        3 /**< Successfully used skill */
+#define MSG_TYPE_SKILL_FAILURE        4 /**< Failure in using skill */
+#define MSG_TYPE_SKILL_PRAY           5 /**< Praying related messages */
+#define MSG_TYPE_SKILL_LIST           6 /**< List of skills */
+
+/* Messages related to applying objects.  Note that applying many objects may
+ * generate MSG_TYPE_ATTRIBUTE messages - the APPLY here more directly related
+ * to the direct messages related to applying them (you put on your armor, you
+ * apply scroll, etc).  The ERROR is like that for SKILLS - something prevent
+ * even trying to apply the object.  FAILURE indicates result wasn't
+ * successful.
+ */
+#define MSG_TYPE_APPLY_ERROR          1
+#define MSG_TYPE_APPLY_UNAPPLY        2 /**< Unapply an object */
+#define MSG_TYPE_APPLY_SUCCESS        3 /**< Was able to apply object */
+#define MSG_TYPE_APPLY_FAILURE        4 /**< Apply OK, but no/bad result */
+#define MSG_TYPE_APPLY_CURSED         5 /**< Applied a cursed object (BAD) */
+#define MSG_TYPE_APPLY_TRAP           6 /**< Have activated a trap */
+#define MSG_TYPE_APPLY_BADBODY        7 /**< Don't have body to use object */
+#define MSG_TYPE_APPLY_PROHIBITION    8 /**< Class/god prohibiiton on obj */
+#define MSG_TYPE_APPLY_BUILD          9 /**< Build related actions */
+
+/* attack related messages */
+#define MSG_TYPE_ATTACK_DID_HIT       1 /**< Player hit something else */
+#define MSG_TYPE_ATTACK_PET_HIT       2 /**< Players pet hit something else */
+#define MSG_TYPE_ATTACK_FUMBLE        3 /**< Player fumbled attack */
+#define MSG_TYPE_ATTACK_DID_KILL      4 /**< Player killed something */
+#define MSG_TYPE_ATTACK_PET_DIED      5 /**< Pet was killed */
+#define MSG_TYPE_ATTACK_NOKEY         6 /**< Keys are like attacks, so... */
+#define MSG_TYPE_ATTACK_NOATTACK      7 /**< You avoid attacking */
+#define MSG_TYPE_ATTACK_PUSHED        8 /**< Pushed a friendly player */
+#define MSG_TYPE_ATTACK_MISS          9 /**< attack didn't hit */
+
+#define MSG_TYPE_COMMUNICATION_RANDOM 1 /**< Random event (coin toss) */
+#define MSG_TYPE_COMMUNICATION_SAY    2 /**< Player says something */
+#define MSG_TYPE_COMMUNICATION_ME     3 /**< Player me's a message */
+#define MSG_TYPE_COMMUNICATION_TELL   4 /**< Player tells something */
+#define MSG_TYPE_COMMUNICATION_EMOTE  5 /**< Player emotes */
+#define MSG_TYPE_COMMUNICATION_PARTY  6 /**< Party message */
+#define MSG_TYPE_COMMUNICATION_SHOUT  7 /**< Party message */
+#define MSG_TYPE_COMMUNICATION_CHAT   8 /**< Party message */
+
+#define MSG_TYPE_SPELL_HEAL           1 /**< Healing related spells */
+#define MSG_TYPE_SPELL_PET            2 /**< Pet related messages */
+#define MSG_TYPE_SPELL_FAILURE        3 /**< Spell failure messages */
+#define MSG_TYPE_SPELL_END            4 /**< A spell ends */
+#define MSG_TYPE_SPELL_SUCCESS        5 /**< Spell succeeded messages */
+#define MSG_TYPE_SPELL_ERROR          6 /**< Spell failure messages */
+#define MSG_TYPE_SPELL_PERCEIVE_SELF  7 /**< Perceive self messages */
+#define MSG_TYPE_SPELL_TARGET         8 /**< Target of non attack spell */
+#define MSG_TYPE_SPELL_INFO           9 /**< random info about spell, not
+                                         *   related to failure/success */
+
+#define MSG_TYPE_ITEM_REMOVE          1 /**< Item removed from inv */
+#define MSG_TYPE_ITEM_ADD             2 /**< Item added to inventory */
+#define MSG_TYPE_ITEM_CHANGE          3 /**< Item has changed in some way */
+#define MSG_TYPE_ITEM_INFO            4 /**< Information related to items */
+/*
+ * MSG_TYPE_MISC, by its very nature, doesn't really have subtypes.  It is
+ * used for messages that really don't belong anyplace else
+ */
+#define MSG_TYPE_VICTIM_SWAMP         1 /**< Player is sinking in a swamp */
+#define MSG_TYPE_VICTIM_WAS_HIT       2 /**< Player was hit by something */
+#define MSG_TYPE_VICTIM_STEAL         3 /**< Someone tried to steal from
+                                         *   the player */
+#define MSG_TYPE_VICTIM_SPELL         4 /**< Someone cast a bad spell on
+                                         *   the player */
+#define MSG_TYPE_VICTIM_DIED          5 /**< Player died! */
+#define MSG_TYPE_VICTIM_WAS_PUSHED    6 /**< Player was pushed or attempted
+                                         * pushed */
+
+#define MSG_TYPE_CLIENT_CONFIG        1 /**< Local configuration issues */
+#define MSG_TYPE_CLIENT_SERVER        2 /**< Server configuration issues */
+#define MSG_TYPE_CLIENT_COMMAND       3 /**< DrawInfoCmd() */
+#define MSG_TYPE_CLIENT_QUERY         4 /**< handle_query() and prompts */
+#define MSG_TYPE_CLIENT_DEBUG         5 /**< General debug messages */
+#define MSG_TYPE_CLIENT_NOTICE        6 /**< Non-critical note to player */
+#define MSG_TYPE_CLIENT_METASERVER    7 /**< Metaserver messages */
+#define MSG_TYPE_CLIENT_SCRIPT        8 /**< Script related messages */
+#define MSG_TYPE_CLIENT_ERROR         9 /**< Bad things happening */
+/*@}*/
+
+
 /* Contains the base information we use to make up a packet we want to send. */
 typedef struct SockList {
     int len;
diff -NBwrup crossfire-client-1.11.0-orig/gtk/text.c crossfire-client-1.11.0/gtk/text.c
--- crossfire-client-1.11.0-orig/gtk/text.c	2008-01-29 06:29:04.000000000 -0100
+++ crossfire-client-1.11.0/gtk/text.c	2018-03-08 15:33:23.374049445 -0100
@@ -512,13 +539,35 @@ static void admin_callback(int flag, int
     }
     draw_info(message, flag);
 }
+
 void init_text_callbacks(void) {
     setTextManager(MSG_TYPE_BOOK,book_callback);
-    setTextManager(MSG_TYPE_MOTD,motd_callback);
-/*    setTextManager(MSG_TYPE_MONUMENT,void_callback);*/
+    setTextManager(MSG_TYPE_CARD,        book_callback);
+    setTextManager(MSG_TYPE_PAPER,       book_callback);
+
     setTextManager(MSG_TYPE_SIGN,sign_callback);
+    setTextManager(MSG_TYPE_MONUMENT,    admin_callback);
+
+    setTextManager(MSG_TYPE_SCRIPTED_DIALOG, admin_callback);
+
+    setTextManager(MSG_TYPE_MOTD,        motd_callback);
     setTextManager(MSG_TYPE_ADMIN,admin_callback);
+
+    setTextManager(MSG_TYPE_SHOP,       admin_callback);
+    setTextManager(MSG_TYPE_COMMAND,    admin_callback);
+
+    setTextManager(MSG_TYPE_ATTRIBUTE,    admin_callback);
+    setTextManager(MSG_TYPE_SKILL,        admin_callback);
+    setTextManager(MSG_TYPE_APPLY,        admin_callback);
+    setTextManager(MSG_TYPE_ATTACK,       admin_callback);
+    setTextManager(MSG_TYPE_COMMUNICATION,admin_callback);
+    setTextManager(MSG_TYPE_SPELL,        admin_callback);
+    setTextManager(MSG_TYPE_ITEM,         admin_callback);
+    setTextManager(MSG_TYPE_MISC,         admin_callback);
+    setTextManager(MSG_TYPE_VICTIM,       admin_callback);
+    setTextManager(MSG_TYPE_CLIENT,       admin_callback);
 }
+
 void cleanup_textmanagers(void) {
     news_entry* last_entry;
     free(last_motd);
client/gtk/gtk1/missing_callbacks_patch.txt · Last modified: 2018/03/08 11:21 by karl