From 2ab6d76d6b9e77c65f1ab3f53cf9b8cdf41a3043 Mon Sep 17 00:00:00 2001 From: Arantis Date: Wed, 4 Nov 2026 21:16:22 +0100 Subject: [PATCH 1/4] Fix vault dupe, trade cheat, description length and DM player id - UserDeposit: the item list may not name the same item twice. Each entry became its own stack in the vault, but the player lost the items only once, so stacks could be doubled. - UserCounterOffer: cancel the offer when an item is not held. The offer items were already cleared and the other player could still accept the old offer and get nothing. CleanupCancelOffer also resets PFLAG2_OFFER_OTHER_ACPT. - BP_CHANGE_DESCRIPTION: same MAX_CHAR_DESCRIPTION_LEN check as at character creation. A longer description overflowed the message buffer of the classic client when looking at the player. - GameDMCommand: go/get player only accept the decimal id of an existing object. The text was put into an admin command as is, so a modified client could add any message to it. --- blakserv/game.c | 33 +++++++++++++++++-- .../holder/nomoveon/battler/player/user.kod | 31 +++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/blakserv/game.c b/blakserv/game.c index b1499c8c93..75f9dc085a 100644 --- a/blakserv/game.c +++ b/blakserv/game.c @@ -698,10 +698,33 @@ void GameSendSystemEnter(session_node *s) SendTopLevelBlakodMessage(GetSystemObjectID(),SYSTEM_ENTER_GAME_MSG,1,&p); } +/* The client sends the player's object id as decimal text. Returns the id + * if it names an existing object, otherwise INVALID_OBJECT, so the text + * can't add anything else to the admin command it is put into. + */ +static int GameDMParseObjectID(const char *str) +{ + char *end; + long object_id; + + if (str == NULL) + return INVALID_OBJECT; + + object_id = strtol(str, &end, 10); + if (end == str || *end != '\0' || object_id <= 0 || object_id > INT_MAX) + return INVALID_OBJECT; + + if (GetObjectByIDQuietly((int) object_id) == NULL) + return INVALID_OBJECT; + + return (int) object_id; +} + void GameDMCommand(session_node *s, int type, char *str) { char buf[LEN_MAX_CLIENT_MSG + 200]; int acctype; + int object_id; acctype = ACCOUNT_NORMAL; if (!s || !s->account) @@ -750,7 +773,10 @@ void GameDMCommand(session_node *s, int type, char *str) break; if (ConfigInt(RIGHTS_GOPLAYER) == ACCOUNT_ADMIN && acctype == ACCOUNT_DM) break; - sprintf(buf, "send object %i admingotoobject what object %s", s->game->object_id, str); + object_id = GameDMParseObjectID(str); + if (object_id == INVALID_OBJECT) + break; + sprintf(buf, "send object %i admingotoobject what object %i", s->game->object_id, object_id); SendSessionAdminText(s->session_id, "~B> %s\n", buf); /* echo it to 'em */ TryAdminCommand(s->session_id, buf); break; @@ -760,7 +786,10 @@ void GameDMCommand(session_node *s, int type, char *str) break; if (ConfigInt(RIGHTS_GETPLAYER) == ACCOUNT_ADMIN && acctype == ACCOUNT_DM) break; - sprintf(buf, "send object %s admingotoobject what object %i", str, s->game->object_id); + object_id = GameDMParseObjectID(str); + if (object_id == INVALID_OBJECT) + break; + sprintf(buf, "send object %i admingotoobject what object %i", object_id, s->game->object_id); SendSessionAdminText(s->session_id, "~B> %s\n", buf); /* echo it to 'em */ TryAdminCommand(s->session_id, buf); break; diff --git a/kod/object/active/holder/nomoveon/battler/player/user.kod b/kod/object/active/holder/nomoveon/battler/player/user.kod index e9e78c6769..78d1af303a 100644 --- a/kod/object/active/holder/nomoveon/battler/player/user.kod +++ b/kod/object/active/holder/nomoveon/battler/player/user.kod @@ -2573,6 +2573,14 @@ messages: if oWhat = self OR (IsClass(oWhat,&Player) AND IsClass(self,&Admin)) { + if StringLength(sBody) > MAX_CHAR_DESCRIPTION_LEN + { + Debug("ALERT! ",Send(self,@GetTrueName),self," tried to " + "set an overly large description."); + + return; + } + sBody = Send(SYS,@CleanseString,#string=sBody); Send(oWhat,@UserChangeDescription,#string=sBody); @@ -8231,7 +8239,7 @@ messages: UserDeposit(what = $,item_list = $,number_list = $) { - local i, lNumbers, oOffer_num, iNumber; + local i, lNumbers, lObjects, oOffer_num, iNumber; // Only deposit to NPCs. if NOT IsClass(what,&Monster) @@ -8250,13 +8258,25 @@ messages: } } - // must be holding things you're offering + // must be holding things you're offering, each item only once foreach i in item_list { + if lObjects <> $ + AND FindListElem(lObjects,i) <> 0 + { + Debug("ALERT! ",Send(self,@GetTrueName),self,"tried to " + "deposit a duplicate item to", + Send(what,@GetTrueName),what,"."); + + return FALSE; + } + if Send(i,@GetOwner) <> self { return; } + + lObjects = Cons(i,lObjects); } if poOffer_who <> $ @@ -8467,6 +8487,7 @@ messages: local i; poOffer_who = $; + piFlags2 &= ~PFLAG2_OFFER_OTHER_ACPT; foreach i in plOffer_items { if Send(i,@IsStackable) @@ -8553,8 +8574,14 @@ messages: return FALSE; } + // plOffer_items is already cleared, so the offer must not stay open. if Send(i,@GetOwner) <> self { + Debug("ALERT! ",Send(self,@GetTrueName),self,"tried to " + "counter-offer an item it doesn't hold to", + Send(poOffer_who,@GetTrueName),poOffer_who,"."); + Send(self,@CancelIfOffer); + return FALSE; } From c93555724749ac984b1e46e931370344bd213761 Mon Sep 17 00:00:00 2001 From: Arantis Date: Wed, 4 Nov 2026 21:16:41 +0100 Subject: [PATCH 2/4] Fix crashes: loot chest growth, who list, message buffer, timers - LootChest: leftovers stay in the chest and every reset adds 30 to 50 new items, so the chest grew until the client crashed when opening it. It now keeps at most viMaxNumEntries (100) entries, the oldest go first. - Classic client who dialog: the list box pointed into the user list, which is freed when a new list arrives (e.g. after a garbage collection) or the game closes. The dialog now gets the new list first. - Classic client CheckServerMessage: never write past MAXMESSAGE. Long %q strings from the server overflowed the caller's buffer. - Delete() now also deletes these timers, so they can't fire on another object after the ids are renumbered by a garbage collection: Battler ptMinionControlCheck, Follower ptChat, RiijaMonk ptWorthyTimer, Player ptCanPhaseTimer, ptDeathRiftTimer, ptFactionTimer, ptLeaveBuilderGroupTimer, ptPhaseTimer, ptPhaseVisualEffectTimer, Admin ptTour, GuildHall ptEntrance (moved from GuildHall5, which now deletes its ptSecret), ChaosNight ptChaosNightEnd, LoginEvent ptEventEnd. --- clientd3d/msgfiltr.c | 62 +++++++++---- clientd3d/msgfiltr.h | 1 + clientd3d/say.c | 4 +- clientd3d/srvrstr.c | 93 ++++++++++++++----- kod/object/active/holder/nomoveon/battler.kod | 6 ++ .../battler/monster/human/follower.kod | 6 ++ .../battler/monster/npc/temples/kcrjmonk.kod | 6 ++ .../active/holder/nomoveon/battler/player.kod | 36 +++++++ .../nomoveon/battler/player/user/dm/admin.kod | 7 ++ kod/object/active/holder/room/ghall.kod | 6 ++ .../active/holder/room/ghall/guildh5.kod | 6 +- .../active/holder/storebox/lootchest.kod | 21 +++++ kod/util/gameevent/chaosnight.kod | 6 ++ kod/util/gameevent/loginevent.kod | 6 ++ 14 files changed, 221 insertions(+), 45 deletions(-) diff --git a/clientd3d/msgfiltr.c b/clientd3d/msgfiltr.c index 54630ab671..7285085e66 100644 --- a/clientd3d/msgfiltr.c +++ b/clientd3d/msgfiltr.c @@ -19,6 +19,7 @@ static HWND hWhoDialog = NULL; /* Non-null if Who dialog is up */ extern player_info player; #define WHOM_UPDATE (WM_APP+5) +#define WHOM_RESET (WM_APP+6) Bool AddUserToIgnoreList(ID name) { @@ -70,11 +71,47 @@ void UpdateWho(object_node* pUser, BOOL bAdded) SendMessage(hWhoDialog, WHOM_UPDATE, (WPARAM)bAdded, (LPARAM)pUser); } +/* + * ResetWho: The list of current users is replaced; the who dialog must + * show the new list before the old one is freed. + */ +void ResetWho(list_type users) +{ + if (hWhoDialog) + SendMessage(hWhoDialog, WHOM_RESET, 0, (LPARAM)users); +} + +/* + * WhoSetUsers: Fill the who dialog's list box with the given users and + * highlight the ones we're not ignoring. + */ +static void WhoSetUsers(HWND hDlg, IDList users) +{ + HWND hList = GetDlgItem(hDlg, IDC_USERLIST); + int num, i; + + ItemListSetContents(hList, users, False); + + num = ListBox_GetCount(hList); + for (i = 0; i < num; i++) + { + object_node *obj = (object_node *) ListBox_GetItemData(hList, i); + if (obj == NULL) + { + debug(("WhoDialogProc got NULL user entry\n")); + continue; + } + if (!IsUserInIgnoreList(obj->name_res)) + ListBox_SetSel(hList, TRUE, i); + } + + SetDlgItemInt(hDlg, IDC_NUMPLAYERS, num, FALSE); +} + /*****************************************************************************/ BOOL CALLBACK WhoDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { HWND hList; - IDList users; int num, i; Bool selected, ignored; @@ -82,30 +119,13 @@ BOOL CALLBACK WhoDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { case WM_INITDIALOG: CenterWindow(hDlg, GetParent(hDlg)); - users = (IDList) lParam; hList = GetDlgItem(hDlg, IDC_USERLIST); // Don't draw objects; too slow to load user bitmaps SetWindowLong(hList, GWL_USERDATA, OD_DRAWICON | OD_ONLYSEL | OD_COLORTEXT | OD_MAKEICONINDEX(0)); /* Set contents of user list */ - ItemListSetContents(hList, users, False); - - // Highlight people we're not ignoring - num = ListBox_GetCount(hList); - for (i = 0; i < num; i++) - { - object_node *obj = (object_node *) ListBox_GetItemData(hList, i); - if (obj == NULL) - { - debug(("WhoDialogProc got NULL user entry\n")); - continue; - } - if (!IsUserInIgnoreList(obj->name_res)) - ListBox_SetSel(hList, TRUE, i); - } - - SetDlgItemInt(hDlg, IDC_NUMPLAYERS, num, FALSE); + WhoSetUsers(hDlg, (IDList) lParam); CheckDlgButton(hDlg, IDC_BROADCAST, config.no_broadcast); CheckDlgButton(hDlg, IDC_IGNOREALL, config.ignore_all); @@ -116,6 +136,10 @@ BOOL CALLBACK WhoDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) hWhoDialog = hDlg; return TRUE; + case WHOM_RESET: + WhoSetUsers(hDlg, (IDList) lParam); + return TRUE; + case WHOM_UPDATE: { BOOL bAdded = (BOOL)wParam; diff --git a/clientd3d/msgfiltr.h b/clientd3d/msgfiltr.h index d9a10ca6f0..4d33d5921a 100644 --- a/clientd3d/msgfiltr.h +++ b/clientd3d/msgfiltr.h @@ -13,6 +13,7 @@ #define _MSGFILTR_H void UpdateWho(object_node* pUser, BOOL bAdded); +void ResetWho(list_type users); BOOL CALLBACK WhoDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam); void AbortWhoDialog(void); diff --git a/clientd3d/say.c b/clientd3d/say.c index 240c2aefcf..04f0bb3a69 100644 --- a/clientd3d/say.c +++ b/clientd3d/say.c @@ -28,7 +28,8 @@ list_type current_users = NULL; */ void SetCurrentUsers(list_type users) { - /* Destroy old list, and if dialog is up, reset user list box */ + /* If dialog is up, reset user list box, then destroy old list */ + ResetWho(users); ObjectListDestroy(current_users); current_users = users; } @@ -72,6 +73,7 @@ void RemoveCurrentUser(ID user_id) */ void FreeCurrentUsers(void) { + ResetWho(NULL); ObjectListDestroy(current_users); current_users = NULL; } diff --git a/clientd3d/srvrstr.c b/clientd3d/srvrstr.c index 5e1a05dec9..612a4b49ec 100644 --- a/clientd3d/srvrstr.c +++ b/clientd3d/srvrstr.c @@ -11,6 +11,57 @@ #include "client.h" +/************************************************************************/ +/* + * FormatBounded: sprintf into dest, but never past end (one past the last + * byte of the buffer). Returns the number of characters written. + */ +static DWORD FormatBounded(char *dest, const char *end, const char *format, ...) +{ + va_list args; + size_t room; + int written; + + if (dest >= end) + return 0; + + room = end - dest; + va_start(args, format); + written = vsnprintf(dest, room, format, args); + va_end(args); + + if (written < 0) + { + *dest = '\0'; + return 0; + } + + if ((size_t) written >= room) + return (DWORD) (room - 1); + + return (DWORD) written; +} +/************************************************************************/ +/* + * AppendBounded: Copy up to len characters of src to *dest and null terminate, + * but never past end (one past the last byte of the buffer). Moves *dest + * past the copied characters. + */ +static void AppendBounded(char **dest, const char *end, const char *src, size_t len) +{ + size_t room; + + if (*dest >= end) + return; + + room = end - *dest - 1; + if (len > room) + len = room; + + strncpy(*dest, src, len); + *dest += len; + **dest = '\0'; +} /************************************************************************/ /* * CheckServerMessage: Assemble a set of printf-style strings into a resultant @@ -35,7 +86,7 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) char* message; char message2[MAXMESSAGE]; char* msg2 = message2; /* Pointer to message2 */ - char *rsc, type_char, *orig_message; + char *rsc, type_char, *orig_message, *message_end; DWORD field, num_chars; WORD string_len; Bool done = False; @@ -87,6 +138,7 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) /* Prepare to format into the caller's message buffer. */ orig_message = message; + message_end = orig_message + MAXMESSAGE; /* Keep looping through string until there's nothing left to replace */ while (!done) @@ -149,7 +201,7 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) { case '%': /* %% ==> % */ // Add what we have so far to the message (including one of the %s). - num_chars = sprintf(message, tempfmt); + num_chars = FormatBounded(message, message_end, tempfmt); message += num_chars; break; case 'r': @@ -180,14 +232,15 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) // but we have to remove the 'r' and add %s as %r isn't a valid // sprintf formatter, while %s is. // Copy the part before the %r modifier into message. - num_chars = sprintf(message, tempfmt); + num_chars = FormatBounded(message, message_end, tempfmt); if (!skip) { // Increment message, but remove the 'r' character. - message += (num_chars - 1); + if (num_chars > 0) + message += (num_chars - 1); // Copy the msg2 string into message. - num_chars = sprintf(message, "%s", msg2); + num_chars = FormatBounded(message, message_end, "%s", msg2); } else { @@ -229,17 +282,17 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) if ((rsc = LookupRsc(field)) == NULL) return False; - num_chars = sprintf(message, tempfmt, rsc); + num_chars = FormatBounded(message, message_end, tempfmt, rsc); } else { - num_chars = sprintf(message, tempfmt, field); + num_chars = FormatBounded(message, message_end, tempfmt, field); } } else { skip = False; - num_chars = sprintf(message, tempfmt); + num_chars = FormatBounded(message, message_end, tempfmt); } message += num_chars; /* Overwrite null char next time */ @@ -277,18 +330,17 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) num_qparams++; } - /* Copy this section of format string */ - strncpy(message, tempfmt, (next_ptr - fmt)); + /* Copy this section of format string; without the %q if skipped. + * Also adds a null terminator, so we can check length of string + * if there is an %r formatter next. + */ if (!skip) - message += (next_ptr - fmt); + AppendBounded(&message, message_end, tempfmt, next_ptr - fmt); else { skip = False; - message += (next_ptr - fmt - 2); + AppendBounded(&message, message_end, tempfmt, next_ptr - fmt - 2); } - // Add a null terminator here so we can check length of string - // if there is an %r formatter next. - *message = '\0'; /* Skip string */ param_ptr += string_len; @@ -312,7 +364,7 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) } /* Copy over last part of string */ - strcpy(message, fmt); + AppendBounded(&message, message_end, fmt, strlen(fmt)); /* Prepare for next pass */ message = orig_message; @@ -358,18 +410,15 @@ Bool CheckServerMessage(char** msg, char **params, long *len, ID fmt_id) tempfmt[(next_ptr - fmt) - 2] = '\0'; /* Add tempfmt and then literal string to end of message */ - strcpy(message, tempfmt); - message += strlen(tempfmt); - - strncpy(message, param_ptr, string_len); - message += string_len; + AppendBounded(&message, message_end, tempfmt, strlen(tempfmt)); + AppendBounded(&message, message_end, param_ptr, string_len); fmt = next_ptr; next_ptr = strchr(fmt, '%'); } /* Copy over last part of string */ - strcpy(message, fmt); + AppendBounded(&message, message_end, fmt, strlen(fmt)); return True; } diff --git a/kod/object/active/holder/nomoveon/battler.kod b/kod/object/active/holder/nomoveon/battler.kod index 2092211826..8a098f4945 100644 --- a/kod/object/active/holder/nomoveon/battler.kod +++ b/kod/object/active/holder/nomoveon/battler.kod @@ -418,6 +418,12 @@ messages: ptVigor = $; } + if ptMinionControlCheck <> $ + { + DeleteTimer(ptMinionControlCheck); + ptMinionControlCheck = $; + } + propagate; } diff --git a/kod/object/active/holder/nomoveon/battler/monster/human/follower.kod b/kod/object/active/holder/nomoveon/battler/monster/human/follower.kod index 1457ae1e5c..756ffc6d24 100644 --- a/kod/object/active/holder/nomoveon/battler/monster/human/follower.kod +++ b/kod/object/active/holder/nomoveon/battler/monster/human/follower.kod @@ -628,6 +628,12 @@ messages: ptAbsence = $; } + if ptChat <> $ + { + DeleteTimer(ptChat); + ptChat = $; + } + // If the follower had any minions, remove them. Send(self,@RemoveAllMinions); diff --git a/kod/object/active/holder/nomoveon/battler/monster/npc/temples/kcrjmonk.kod b/kod/object/active/holder/nomoveon/battler/monster/npc/temples/kcrjmonk.kod index 4710fa399e..6a41937241 100644 --- a/kod/object/active/holder/nomoveon/battler/monster/npc/temples/kcrjmonk.kod +++ b/kod/object/active/holder/nomoveon/battler/monster/npc/temples/kcrjmonk.kod @@ -95,6 +95,12 @@ messages: ptGoIllusioned = $; } + if ptWorthyTimer <> $ + { + DeleteTimer(ptWorthyTimer); + ptWorthyTimer = $; + } + propagate; } diff --git a/kod/object/active/holder/nomoveon/battler/player.kod b/kod/object/active/holder/nomoveon/battler/player.kod index 3e0eae0254..0ba48d1b6b 100644 --- a/kod/object/active/holder/nomoveon/battler/player.kod +++ b/kod/object/active/holder/nomoveon/battler/player.kod @@ -1269,6 +1269,42 @@ messages: plControlledMinions = $; } + if ptCanPhaseTimer <> $ + { + DeleteTimer(ptCanPhaseTimer); + ptCanPhaseTimer = $; + } + + if ptDeathRiftTimer <> $ + { + DeleteTimer(ptDeathRiftTimer); + ptDeathRiftTimer = $; + } + + if ptFactionTimer <> $ + { + DeleteTimer(ptFactionTimer); + ptFactionTimer = $; + } + + if ptLeaveBuilderGroupTimer <> $ + { + DeleteTimer(ptLeaveBuilderGroupTimer); + ptLeaveBuilderGroupTimer = $; + } + + if ptPhaseTimer <> $ + { + DeleteTimer(ptPhaseTimer); + ptPhaseTimer = $; + } + + if ptPhaseVisualEffectTimer <> $ + { + DeleteTimer(ptPhaseVisualEffectTimer); + ptPhaseVisualEffectTimer = $; + } + Send(self,@PeriodicSounds,#bSuspend=TRUE); propagate; diff --git a/kod/object/active/holder/nomoveon/battler/player/user/dm/admin.kod b/kod/object/active/holder/nomoveon/battler/player/user/dm/admin.kod index 1e5bc932f9..ba4f86ac8f 100644 --- a/kod/object/active/holder/nomoveon/battler/player/user/dm/admin.kod +++ b/kod/object/active/holder/nomoveon/battler/player/user/dm/admin.kod @@ -336,6 +336,13 @@ messages: return; } + Delete() + { + Send(self,@EndTour); + + propagate; + } + ToCliPlayers() "Sends client a list of all users logged on, including object id, " "resource id, and actual string of the resource (since it's a dynarsc)." diff --git a/kod/object/active/holder/room/ghall.kod b/kod/object/active/holder/room/ghall.kod index 0b29a6c92f..c02c3f69f2 100644 --- a/kod/object/active/holder/room/ghall.kod +++ b/kod/object/active/holder/room/ghall.kod @@ -1230,6 +1230,12 @@ messages: ptConquer = $; } + if ptEntrance <> $ + { + DeleteTimer(ptEntrance); + ptEntrance = $; + } + propagate; } diff --git a/kod/object/active/holder/room/ghall/guildh5.kod b/kod/object/active/holder/room/ghall/guildh5.kod index 716ac1d5b8..25b4421c93 100644 --- a/kod/object/active/holder/room/ghall/guildh5.kod +++ b/kod/object/active/holder/room/ghall/guildh5.kod @@ -504,10 +504,10 @@ messages: ptWestDoor = $; } - if ptEntrance <> $ + if ptSecret <> $ { - DeleteTimer(ptEntrance); - ptEntrance = $; + DeleteTimer(ptSecret); + ptSecret = $; } propagate; diff --git a/kod/object/active/holder/storebox/lootchest.kod b/kod/object/active/holder/storebox/lootchest.kod index 4cd69f60d8..40e8e40fd6 100644 --- a/kod/object/active/holder/storebox/lootchest.kod +++ b/kod/object/active/holder/storebox/lootchest.kod @@ -44,6 +44,10 @@ classvars: viMinNumTreasure = 30 viMaxNumTreasure = 50 + // Most entries the chest keeps, a stack counts as one entry. Leftovers + // stay in the chest, so without a limit it grows with every reset. + viMaxNumEntries = 100 + // Reset after 1 hour viReset_time = 6000000 @@ -342,11 +346,28 @@ messages: ptReset_timer = $; Send(self,@GenerateLootTreasure); + Send(self,@TrimLootTreasure); Send(self,@LockChest,#bLocked=TRUE); return; } + TrimLootTreasure() + "Deletes the oldest entries beyond viMaxNumEntries." + { + local iExtra; + + iExtra = Length(plPassive) - viMaxNumEntries; + while iExtra > 0 + { + // New items are added to the front, so the oldest one is last. + Send(Send(self,@HolderExtractObject,#data=Last(plPassive)),@Delete); + iExtra--; + } + + return; + } + TryActivate(who=$) { local oKey; diff --git a/kod/util/gameevent/chaosnight.kod b/kod/util/gameevent/chaosnight.kod index 5896a6028a..106189960c 100644 --- a/kod/util/gameevent/chaosnight.kod +++ b/kod/util/gameevent/chaosnight.kod @@ -111,6 +111,12 @@ messages: ptChaosNightLootTimer = $; } + if ptChaosNightEnd <> $ + { + DeleteTimer(ptChaosNightEnd); + ptChaosNightEnd = $; + } + // Tell the rooms to change their flags back to normal, and to // redraw the correct background. foreach i in Send(SYS, @GetRooms) diff --git a/kod/util/gameevent/loginevent.kod b/kod/util/gameevent/loginevent.kod index 57a83a3015..d4e2bc14d1 100644 --- a/kod/util/gameevent/loginevent.kod +++ b/kod/util/gameevent/loginevent.kod @@ -42,6 +42,12 @@ messages: Delete() { + if ptEventEnd <> $ + { + DeleteTimer(ptEventEnd); + ptEventEnd = $; + } + plNotifiedUsers = $; plItemsToGive = $; plMessagesToGive = $; From c1a3526410c566eef8f1b7c4efb6d5402bb731b2 Mon Sep 17 00:00:00 2001 From: Arantis Date: Wed, 4 Nov 2026 21:16:48 +0100 Subject: [PATCH 3/4] Fix cheap death flag, darkness bonus, apparition fizzle and more - NewOwner: PFLAG2_CHEAP_DEATH was checked in piFlags instead of piFlags2, so the flag from the lich queen's death was never cleared and the player had no death penalty from then on. - Spell: the darkness spellpower for Qor spells was rebuilt as -(state - 25), but the state is -(spellpower + 25). - SummonApparition CanPayCosts: return FALSE after the fizzle message for an empty target list. - HeartStone NewOwner: check for a nil owner before IsClass. --- kod/object/active/holder/nomoveon/battler/player/user.kod | 2 +- kod/object/item/passitem/hstone.kod | 3 ++- kod/object/passive/spell.kod | 2 +- kod/object/passive/spell/apparitn.kod | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/kod/object/active/holder/nomoveon/battler/player/user.kod b/kod/object/active/holder/nomoveon/battler/player/user.kod index 78d1af303a..950bbbfddb 100644 --- a/kod/object/active/holder/nomoveon/battler/player/user.kod +++ b/kod/object/active/holder/nomoveon/battler/player/user.kod @@ -9608,7 +9608,7 @@ messages: piLastSafeRoom = Send(self,@GetHomeRoom); } } - else if (piflags & PFLAG2_CHEAP_DEATH) + else if (piFlags2 & PFLAG2_CHEAP_DEATH) { piFlags2 &= ~PFLAG2_CHEAP_DEATH; if (NOT Send(poOwner,@CheckRoomFlag,#flag=ROOM_SAFELOGOFF)) diff --git a/kod/object/item/passitem/hstone.kod b/kod/object/item/passitem/hstone.kod index a63bdd1ca5..42d6604bb8 100644 --- a/kod/object/item/passitem/hstone.kod +++ b/kod/object/item/passitem/hstone.kod @@ -74,7 +74,8 @@ messages: NewOwner(what = $) { - if (IsClass(what,&Room)) + if what <> $ + AND IsClass(what,&Room) AND (NOT Send(what,@CheckRoomFlag,#flag=ROOM_NO_COMBAT)) { if Send(Send(SYS,@GetNodeAttack),@GetRespawn) diff --git a/kod/object/passive/spell.kod b/kod/object/passive/spell.kod index 82dcc2250f..b502d69bba 100644 --- a/kod/object/passive/spell.kod +++ b/kod/object/passive/spell.kod @@ -2987,7 +2987,7 @@ messages: // This reconstructs the darkness spellpower. iAbilityGain = First(Send(oRoom,@GetEnchantmentState, #what=oModifierSpell)); - iAbilityGain = -(iAbilityGain - 25); + iAbilityGain = -(iAbilityGain + 25); iAbilityGain /= 10; iSecondaryBonus += iAbilityGain; } diff --git a/kod/object/passive/spell/apparitn.kod b/kod/object/passive/spell/apparitn.kod index 0e191faed7..7930be1fe0 100644 --- a/kod/object/passive/spell/apparitn.kod +++ b/kod/object/passive/spell/apparitn.kod @@ -83,6 +83,8 @@ messages: // For some reason, the client is Sending a null list if you // target a number item with a spell. for now, assume it's bad. Send(who,@MsgSendUser,#message_rsc=apparition_fizzle); + + return FALSE; } oRoom = Send(who,@GetOwner); From d10b53296e02662efa8aacc39b59528204ab6605 Mon Sep 17 00:00:00 2001 From: Arantis Date: Wed, 4 Nov 2026 21:16:56 +0100 Subject: [PATCH 4/4] Fix spell texts and German spelling of Gewandtheit - Bless intro: missing space before "combat abilities". - Shatterlock safety: "you will marked" -> "you will be marked". - "Gewandheit" -> "Gewandtheit" in the German stat name, the agility boon texts and the character creation and stats dialogs. --- kod/object/active/holder/nomoveon/battler/player/user.lkod | 2 +- kod/object/passive/spell/boon/agilboon.lkod | 6 +++--- kod/object/passive/spell/multicst/shttrlck.kod | 2 +- kod/object/passive/spell/persench/bless.kod | 2 +- module/char/char.rc | 4 ++-- module/stats/stats.rc | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kod/object/active/holder/nomoveon/battler/player/user.lkod b/kod/object/active/holder/nomoveon/battler/player/user.lkod index 46712a567c..1fca30a0aa 100644 --- a/kod/object/active/holder/nomoveon/battler/player/user.lkod +++ b/kod/object/active/holder/nomoveon/battler/player/user.lkod @@ -73,7 +73,7 @@ user_is_standing = de "Du stehst." user_stat_might = de "Stärke" user_stat_intellect = de "Klugheit" user_stat_stamina = de "Konstitution" -user_stat_agility = de "Gewandheit" +user_stat_agility = de "Gewandtheit" user_stat_mysticism = de "Magie" user_stat_aim = de "Genauigkeit" user_stat_karma = de "Karma" diff --git a/kod/object/passive/spell/boon/agilboon.lkod b/kod/object/passive/spell/boon/agilboon.lkod index 2e462d628f..f59eda0b75 100644 --- a/kod/object/passive/spell/boon/agilboon.lkod +++ b/kod/object/passive/spell/boon/agilboon.lkod @@ -1,6 +1,6 @@ -agilboon_name_rsc = de "Gewandheits-Effekt" -agilboon_desc_rsc = de "Deine physische Gewandheit ist nicht natürlich." +agilboon_name_rsc = de "Gewandtheits-Effekt" +agilboon_desc_rsc = de "Deine physische Gewandtheit ist nicht natürlich." agilboon_intro_rsc = de \ - "Die physischer Gewandheit von deinem Ziel steigt temporär." + "Die physische Gewandtheit von deinem Ziel steigt temporär." agilboon_inc = de "Du fühlst Dich plötzlich schneller!" agilboon_dec = de "Du fühlst Dich plötzlich langsamer" diff --git a/kod/object/passive/spell/multicst/shttrlck.kod b/kod/object/passive/spell/multicst/shttrlck.kod index da73da73ec..65abf99c4f 100644 --- a/kod/object/passive/spell/multicst/shttrlck.kod +++ b/kod/object/passive/spell/multicst/shttrlck.kod @@ -30,7 +30,7 @@ resources: Shatterlock_safety = \ "You must not have a guardian angel and must turn your safety OFF " - "before you cast this spell. Note that you will marked as an outlaw " + "before you cast this spell. Note that you will be marked as an outlaw " "as the result of casting this spell." Shatterlock_outlaw = \ diff --git a/kod/object/passive/spell/persench/bless.kod b/kod/object/passive/spell/persench/bless.kod index 90ef0cc234..d3ff62f721 100644 --- a/kod/object/passive/spell/persench/bless.kod +++ b/kod/object/passive/spell/persench/bless.kod @@ -30,7 +30,7 @@ resources: bless_off_rsc = "The spirit of battle has left you." bless_success_rsc = "Kraanan fills %s%s with the spirit of battle." bless_spell_intro = \ - "Kraanan Lv. 2: Bestows the Warrior God's blessing, improving your" + "Kraanan Lv. 2: Bestows the Warrior God's blessing, improving your " "combat abilities." classvars: diff --git a/module/char/char.rc b/module/char/char.rc index 80900ed355..6f0e6742b7 100644 --- a/module/char/char.rc +++ b/module/char/char.rc @@ -38,7 +38,7 @@ BEGIN CONTROL "",1022,"BlakGraph",WS_TABSTOP | 0xb,65,43,102,14 LTEXT "Konstitution",-1,22,65,39,8 CONTROL "",1023,"BlakGraph",WS_TABSTOP | 0xb,65,62,102,14 - LTEXT "Gewandheit",-1,20,84,40,8 + LTEXT "Gewandtheit",-1,20,84,40,8 CONTROL "",1024,"BlakGraph",WS_TABSTOP | 0xb,65,81,102,14 LTEXT "Magie",-1,38,103,21,8 CONTROL "",1025,"BlakGraph",WS_TABSTOP | 0xb,65,100,102,14 @@ -60,7 +60,7 @@ BEGIN LTEXT "Deine Stärke bestimmt den Schaden, den Du anrichtest und Deine Tragkraft.",-1,175,23,132,18 LTEXT "Kluge Charaktere können schneller ihre Fähigkeiten ausbauen und neue erlernen.",-1,175,42,134,17 LTEXT "Eine hohe Konstitution wirkt sich positiv auf die Lebenskraft und Ausdauer aus.",-1,175,61,136,17 - LTEXT "Krieger benötigen eine hohe Gewandheit um ihre Waffen wirkungsvoll einzusetzen.",-1,175,80,134,17 + LTEXT "Krieger benötigen eine hohe Gewandtheit um ihre Waffen wirkungsvoll einzusetzen.",-1,175,80,134,17 LTEXT "Eine hohe Magie wirkt sich positiv auf die Zauberkraft und die Zaubersprüche aus.",-1,175,99,132,17 LTEXT "Beeinflußt die Trefferwarscheinlichkeit von Zaubersprüchen und Waffen.",-1,175,119,134,18 END diff --git a/module/stats/stats.rc b/module/stats/stats.rc index 78d18978a4..4d926bee5b 100644 --- a/module/stats/stats.rc +++ b/module/stats/stats.rc @@ -38,7 +38,7 @@ BEGIN CONTROL "",1022,"BlakGraph",WS_TABSTOP | 0xb,42,43,102,14 LTEXT "Konstitution",-1,2,64,40,8 CONTROL "",1023,"BlakGraph",WS_TABSTOP | 0xb,42,62,102,14 - LTEXT "Gewandheit",-1,2,83,40,8 + LTEXT "Gewandtheit",-1,2,83,40,8 CONTROL "",1024,"BlakGraph",WS_TABSTOP | 0xb,42,81,102,14 LTEXT "Magie",-1,20,101,20,8 CONTROL "",1025,"BlakGraph",WS_TABSTOP | 0xb,42,100,102,14 @@ -51,7 +51,7 @@ BEGIN LTEXT "ausbauen und neue erlernen.",-1,149,50,162,8 LTEXT "Eine hohe Konstitution wirkt sich positiv auf",-1,149,61,155,8 LTEXT "anrichtest und Deine Tragkraft.",-1,149,31,131,8 - LTEXT "Krieger benötigen eine hohe Gewandheit um ihre",-1,149,80,160,8 + LTEXT "Krieger benötigen eine hohe Gewandtheit um ihre",-1,149,80,160,8 LTEXT "Eine hohe Magie wirkt sich positiv auf die",-1,149,99,161,8 LTEXT "Beeinflußt die Trefferwarscheinlichkeit",-1,149,119,151,8 LTEXT "die Lebenskraft und Ausdauer aus.",-1,149,69,150,8