From a63aa581b2b75bd8826a40a752539a7ff176bb53 Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Mon, 16 Dec 2019 00:34:11 -0800 Subject: [PATCH 01/11] fix for globals missing --- Underlight/Options.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Underlight/Options.cpp b/Underlight/Options.cpp index b260829..07de4f4 100644 --- a/Underlight/Options.cpp +++ b/Underlight/Options.cpp @@ -449,6 +449,13 @@ cJSON** LoadJSONFiles() } numJsonFiles = fcount; + if (hFind != FindFirstFile("globals.json", &data)) + { + cJSON* globals = WriteGlobalJSONOptionValues(); + WriteJSONFile(globals, "globals.json"); + cJSON_Delete(globals); + } + if (numJsonFiles > MAX_STORED_ACCOUNTS) { GAME_ERROR("Too many JSON files - delete some!"); From fd16d3144070f9810bab9a2b16d4b77cf271f9fe Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Tue, 17 Dec 2019 23:32:16 -0800 Subject: [PATCH 02/11] raws and graws --- Underlight/cChat.cpp | 24 ++++++++++++++++++++++-- Underlight/cChat.h | 4 ++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Underlight/cChat.cpp b/Underlight/cChat.cpp index 48dfc59..263d3ee 100644 --- a/Underlight/cChat.cpp +++ b/Underlight/cChat.cpp @@ -631,6 +631,15 @@ _stprintf(emoteCF.szFaceName, FONT_NAME); nameCF.crTextColor = (RGB(chat_colors[color].red, chat_colors[color].green, chat_colors[color].blue)); _stprintf(nameCF.szFaceName, FONT_NAME); SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&nameCF); + + // lets try this for gm raw and graw ~christy + memset(&raw_grawCF, 0, sizeof(raw_grawCF)); + raw_grawCF.cbSize = sizeof(raw_grawCF); + raw_grawCF.dwMask = CFM_FACE | CFM_ITALIC | CFM_BOLD | CFM_COLOR; + raw_grawCF.dwEffects = CFM_ITALIC | CFM_BOLD; + raw_grawCF.crTextColor = (RGB(chat_colors[color].red, chat_colors[color].green, chat_colors[color].blue)); + _stprintf(raw_grawCF.szFaceName, FONT_NAME); + SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&raw_grawCF); } void cChat::SetWhisperFormat(int color) @@ -703,6 +712,11 @@ void cChat::SwitchMode(int mode) SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&whisperCF); currMode = WHISPER; break; + + case RAW_GRAW: //added by christy for raw_graw + SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&raw_grawCF); + currMode = RAW_GRAW; + break; } currMode = mode; @@ -822,8 +836,9 @@ void cChat::DisplaySpeech(const TCHAR *text, TCHAR *name, int speechType, bool i this->PreDisplay(); // set line counts, offset correctly _tcsnccpy(speech, text, sizeof(speech)); - - if (isEmote) + if (speechType == RMsg_Speech::RAW_EMOTE) //added by christy + this->SwitchMode(RAW_GRAW); + else if (isEmote) this->SwitchMode(EMOTE); else if (speechType == RMsg_Speech::WHISPER) this->SwitchMode(WHISPER); @@ -851,6 +866,11 @@ void cChat::DisplaySpeech(const TCHAR *text, TCHAR *name, int speechType, bool i _stprintf(message, _T(">%s "), name); break; case RMsg_Speech::RAW_EMOTE: + if (speech[0] == '\'') + _stprintf(message, _T(">%s"), name); + else + _stprintf(message, _T(">%s "), name); + break; case RMsg_Speech::DISTRESS_CALL: _stprintf(message, _T("")); break; diff --git a/Underlight/cChat.h b/Underlight/cChat.h index 1a15b1f..bd93399 100644 --- a/Underlight/cChat.h +++ b/Underlight/cChat.h @@ -22,7 +22,7 @@ const int NUM_CHAT_BUTTONS = 4; enum // current paragraph format { - PLAYER_SPEECH, PLAYER_NAME, SYSTEM_MESSAGE, EMOTE, WHISPER + PLAYER_SPEECH, PLAYER_NAME, SYSTEM_MESSAGE, EMOTE, WHISPER, RAW_GRAW }; @@ -49,7 +49,7 @@ class cChat WNDPROC lpfn_richedit, lpfn_entry; // pointer to window procedure HBITMAP chat_buttons_bitmaps[NUM_CHAT_BUTTONS][2]; PARAFORMAT chatPF; // paragraph format - CHARFORMAT speechCF, nameCF, systemCF, emoteCF, whisperCF; // character formats for other player's speech, names, and system messages + CHARFORMAT speechCF, nameCF, systemCF, emoteCF, raw_grawCF, whisperCF; // character formats for other player's speech, names, and system messages, edited by christy to include raw_grawCF cOutput *chatlog; // for logging chat int currMode; // current mode - player speech, system, etc. bool first_message; // has a message been displayed yet? From 0fbc2055bbfe1abf8a4df2877cb98abe0f921600 Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Tue, 17 Dec 2019 23:41:33 -0800 Subject: [PATCH 03/11] added abjure fix --- Underlight/cArts.cpp | 22 ++++++++++++++++++++-- Underlight/cNeighbor.cpp | 8 ++++++++ Underlight/cNeighbor.h | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index 3a13efc..ee4191e 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -5574,9 +5574,27 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) } else { - _stprintf(message, disp_message, timed_effects->name[i], player->Name()); + if (n->IsPMare() == false) + _stprintf(message, disp_message, timed_effects->name[i], player->Name()); gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); - if (n != NO_ACTOR) + } + if (n->IsPMare()) + { + if (player->IsMale()) + { + _stprintf(message, disp_message, timed_effects->name[i], "A male dreamer"); + } + else if (player->IsFemale()) + { + _stprintf(message, disp_message, timed_effects->name[i], "A female dreamer"); + } + else + { + _stprintf(message, disp_message, timed_effects->name[i], player->Name()); + } + gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); + } + if (n != NO_ACTOR) { LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); _stprintf(message, disp_message, n->Name(), timed_effects->name[i]); diff --git a/Underlight/cNeighbor.cpp b/Underlight/cNeighbor.cpp index 9edf918..8800340 100644 --- a/Underlight/cNeighbor.cpp +++ b/Underlight/cNeighbor.cpp @@ -701,6 +701,14 @@ bool cNeighbor::IsMale(void) return false; } +// returns true if we're a pmare; based on account type +bool cNeighbor::IsPMare(void) +{ + if (avatar.AvatarType() == LmAvatar::ACCT_PMARE) + return true; + return false; +} + // returns avatar type unsigned int cNeighbor::GetAvatarType(void) { diff --git a/Underlight/cNeighbor.h b/Underlight/cNeighbor.h index c98170c..af16794 100644 --- a/Underlight/cNeighbor.h +++ b/Underlight/cNeighbor.h @@ -148,6 +148,7 @@ class cNeighbor : public cActor bool IsFemale (void); bool IsMale (void); + bool IsPMare(void); bool IsMonster (void); bool IsVulnerable (void); bool CanWhisper(void); From d0fec5d60f117fdd3bb3ae6ab44e5213dbbca1a3 Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Tue, 17 Dec 2019 23:52:02 -0800 Subject: [PATCH 04/11] added abjure fix --- Underlight/cArts.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index ee4191e..429c2da 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -5595,22 +5595,22 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); } if (n != NO_ACTOR) - { + { LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); _stprintf(message, disp_message, n->Name(), timed_effects->name[i]); - } - else { + } + else { _stprintf(message, "%s has been abjured from you!\n", timed_effects->name[i]); - } + } display->DisplayMessage (message); - } + } player->RemoveTimedEffect(i); break; - } + } else j++; - } + num_effects_active--; num_effects_to_abjure--; num_effects_abjured++; From a8e91ae3976b5808ba342a2284f7df2c1d3b609c Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Wed, 18 Dec 2019 00:23:30 -0800 Subject: [PATCH 05/11] abjure_ref__raw_fix__globals_fix --- Underlight/cChat.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Underlight/cChat.cpp b/Underlight/cChat.cpp index 263d3ee..d368c52 100644 --- a/Underlight/cChat.cpp +++ b/Underlight/cChat.cpp @@ -64,6 +64,8 @@ const struct window_pos_t chatPos[MAX_RESOLUTIONS] = const struct window_pos_t entryPos[MAX_RESOLUTIONS] = { { 0, 455, 480, 25 }, { 0, 570, 600, 35 }, { 0, 733, 768, 40 } }; #else +const struct window_pos_t classicChatPos[MAX_RESOLUTIONS] = +{ { 0, 300, 480, 180 },{ 0, 375, 600, 225 },{ 0, 480, 768, 288 } }; //added to fix undeclared ident on pmare const struct window_pos_t chatPos[MAX_RESOLUTIONS] = { { 0, 300, 480, 180 },{ 0, 375, 600, 225 },{ 0, 480, 768, 288 } }; #endif @@ -867,9 +869,9 @@ void cChat::DisplaySpeech(const TCHAR *text, TCHAR *name, int speechType, bool i break; case RMsg_Speech::RAW_EMOTE: if (speech[0] == '\'') - _stprintf(message, _T(">%s"), name); + _stprintf(message, _T(">%s")); else - _stprintf(message, _T(">%s "), name); + _stprintf(message, _T(">%s ")); break; case RMsg_Speech::DISTRESS_CALL: _stprintf(message, _T("")); From ec704abd62297f27c852a68769fded26ec39622e Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Wed, 18 Dec 2019 03:05:01 -0800 Subject: [PATCH 06/11] abjure/raw/globals_fix --- Underlight/cArts.cpp | 60 +++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index 429c2da..08eae82 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -5526,7 +5526,7 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) { cNeighbor *n = this->LookUpNeighbor(caster_id); - if (caster_id != player->ID () && n == NO_ACTOR) + if (caster_id != player->ID() && n == NO_ACTOR) return; // MDA 3/18/2004 - bail if the neighbor became NULL between evoke and Apply this->DisplayUsedByOther(n, Arts::ABJURE); @@ -5558,59 +5558,61 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) while (num_effects_active && num_effects_to_abjure) { - random = rand()%num_effects_active; - j=0; // j = count of active effects skipped by loop - for (i=0; iflags & timed_effects->actor_flag[i]) && timed_effects->abjurable[i]) { if (j == random) // abjure this effect { - LoadString (hInstance, IDS_ABJURED_EFFECT, disp_message, sizeof(disp_message)); + LoadString(hInstance, IDS_ABJURED_EFFECT, disp_message, sizeof(disp_message)); if (caster_id == player->ID()) { LoadString(hInstance, IDS_YOURSELF, temp_message, sizeof(temp_message)); _stprintf(message, disp_message, timed_effects->name[i], temp_message); - display->DisplayMessage (message); + display->DisplayMessage(message); } else { if (n->IsPMare() == false) - _stprintf(message, disp_message, timed_effects->name[i], player->Name()); - gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); - } - if (n->IsPMare()) - { - if (player->IsMale()) { - _stprintf(message, disp_message, timed_effects->name[i], "A male dreamer"); - } - else if (player->IsFemale()) - { - _stprintf(message, disp_message, timed_effects->name[i], "A female dreamer"); + _stprintf(message, disp_message, timed_effects->name[i], player->Name()); + gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); } - else + + if (n->IsPMare()) { - _stprintf(message, disp_message, timed_effects->name[i], player->Name()); + if (player->IsMale()) + { + _stprintf(message, disp_message, timed_effects->name[i], "A male dreamer"); + } + else if (player->IsFemale()) + { + _stprintf(message, disp_message, timed_effects->name[i], "A female dreamer"); + } + else + { + _stprintf(message, disp_message, timed_effects->name[i], player->Name()); + } + gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); } - gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); - } if (n != NO_ACTOR) { - LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); - _stprintf(message, disp_message, n->Name(), timed_effects->name[i]); + LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); + _stprintf(message, disp_message, n->Name(), timed_effects->name[i]); } else { - _stprintf(message, "%s has been abjured from you!\n", timed_effects->name[i]); + _stprintf(message, "%s has been abjured from you!\n", timed_effects->name[i]); } - display->DisplayMessage (message); + display->DisplayMessage(message); + } + player->RemoveTimedEffect(i); + break; } - player->RemoveTimedEffect(i); - break; - } else j++; - + } num_effects_active--; num_effects_to_abjure--; num_effects_abjured++; From 01c5199fe84c52e315aaee0c41686652fd232189 Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Sun, 22 Dec 2019 00:16:52 -0800 Subject: [PATCH 07/11] abjure fix for reflect, updated, with rawr, globals.json missing but player there --- Underlight/cArts.cpp | 77 ++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 46 deletions(-) diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index 08eae82..dc75343 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -5534,13 +5534,13 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) int num_effects_active = 0; int num_effects_abjured = 0; int curr_skill = skill; - int random,i,j; - + int random = 0; + int i, j; player->EvokedFX().Activate(Arts::ABJURE, false); for (i=0; iflags & timed_effects->actor_flag[i] && timed_effects->abjurable[i]) - num_effects_active++; + num_effects_active++; // pmares can only have 1 effect abjured at a time #ifndef PMARE @@ -5555,72 +5555,57 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) } #endif - + while (num_effects_active && num_effects_to_abjure) { random = rand() % num_effects_active; j = 0; // j = count of active effects skipped by loop for (i = 0; i < NUM_TIMED_EFFECTS; i++) + if ((player->flags & timed_effects->actor_flag[i]) && timed_effects->abjurable[i]) { if (j == random) // abjure this effect { - LoadString(hInstance, IDS_ABJURED_EFFECT, disp_message, sizeof(disp_message)); - if (caster_id == player->ID()) + const TCHAR* playerName = NULL; + LoadString(hInstance, IDS_ABJURED_EFFECT, disp_message, sizeof(disp_message)); // "You have abjured %s from %s!\n" + if (caster_id == player->ID()) //casting on self { - LoadString(hInstance, IDS_YOURSELF, temp_message, sizeof(temp_message)); - _stprintf(message, disp_message, timed_effects->name[i], temp_message); + _stprintf(message, disp_message, timed_effects->name[i], "yourself"); display->DisplayMessage(message); } - else + else // not casting on self or im being casted on { - if (n->IsPMare() == false) - { - _stprintf(message, disp_message, timed_effects->name[i], player->Name()); - gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); + playerName = player->IsPMare() ? player->Name() : ( n->IsPMare() ? player->Name() : (player->IsMale() ? "A male dreamer" : "A female dreamer")); + _stprintf(message, disp_message, timed_effects->name[i], playerName); + gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); //send msg to person it's landing on + if (n->ID() == caster_id && n != NO_ACTOR)// being casted on! by a real not us dreamer! + { + playerName = n->IsPMare() ? (player->IsMale() ? "A male dreamer" : "A female dreamer") : n->Name(); + LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); //"%s has abjured %s from you!\n" + _stprintf(message, disp_message, playerName, timed_effects->name[i]); } - - if (n->IsPMare()) + else { - if (player->IsMale()) - { - _stprintf(message, disp_message, timed_effects->name[i], "A male dreamer"); - } - else if (player->IsFemale()) - { - _stprintf(message, disp_message, timed_effects->name[i], "A female dreamer"); - } - else - { - _stprintf(message, disp_message, timed_effects->name[i], player->Name()); - } - gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); + _stprintf(message, "%s has been abjured from you!\n", timed_effects->name[i]); } - if (n != NO_ACTOR) - { - LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); - _stprintf(message, disp_message, n->Name(), timed_effects->name[i]); - } - else { - _stprintf(message, "%s has been abjured from you!\n", timed_effects->name[i]); + display->DisplayMessage(message); } - - display->DisplayMessage(message); - } player->RemoveTimedEffect(i); break; } else j++; } - num_effects_active--; - num_effects_to_abjure--; - num_effects_abjured++; - if (i == NUM_TIMED_EFFECTS) - { - GAME_ERROR(IDS_ABJURE_FAIL); - return; - } + num_effects_active--; + num_effects_to_abjure--; + num_effects_abjured++; + if (i == NUM_TIMED_EFFECTS) + { + GAME_ERROR(IDS_ABJURE_FAIL); + return; + } + + } if (!num_effects_abjured && (caster_id == player->ID())) From 71581d197a048ee473d347e37a98c1367252fc7b Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Sun, 22 Dec 2019 06:33:42 -0800 Subject: [PATCH 08/11] I give abjure failed --- Underlight/cArts.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index dc75343..69dd361 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -5570,17 +5570,22 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) LoadString(hInstance, IDS_ABJURED_EFFECT, disp_message, sizeof(disp_message)); // "You have abjured %s from %s!\n" if (caster_id == player->ID()) //casting on self { - _stprintf(message, disp_message, timed_effects->name[i], "yourself"); + LoadString(hInstance, IDS_YOURSELF, temp_message, sizeof(temp_message)); // "yourself" + _stprintf(message, disp_message, timed_effects->name[i], temp_message); display->DisplayMessage(message); } else // not casting on self or im being casted on { - playerName = player->IsPMare() ? player->Name() : ( n->IsPMare() ? player->Name() : (player->IsMale() ? "A male dreamer" : "A female dreamer")); - _stprintf(message, disp_message, timed_effects->name[i], playerName); + LoadString(hInstance, IDS_MALE_DREAMER, temp_message, sizeof(temp_message)); // "A male dreamer" + LoadString(hInstance, IDS_FEMALE_DREAMER, temp_message2, sizeof(temp_message2)); //"A female dreamer" + //playerName = n->IsPMare() ? (player->IsMale() ? temp_message : temp_message2) : player->Name(); + playerName = player->IsDreamerAccount() ? n->IsPMare() ? ((n->IsMale() ? temp_message : temp_message2)) : player->Name() : player->Name(); + _stprintf(message, disp_message, timed_effects->name[i], playerName); gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); //send msg to person it's landing on + if (n->ID() == caster_id && n != NO_ACTOR)// being casted on! by a real not us dreamer! { - playerName = n->IsPMare() ? (player->IsMale() ? "A male dreamer" : "A female dreamer") : n->Name(); + playerName = n->IsPMare() ? (player->IsMale() ? temp_message : temp_message2) : n->Name(); LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); //"%s has abjured %s from you!\n" _stprintf(message, disp_message, playerName, timed_effects->name[i]); } From 4adfbcf3bbdb21921970595ba60654823fc96e1b Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Sun, 22 Dec 2019 07:51:49 -0800 Subject: [PATCH 09/11] abjure opposit day fix! --- Underlight/Central.h | 1 + Underlight/Realm.cpp | 1 + Underlight/cArts.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Underlight/Central.h b/Underlight/Central.h index d742e62..1bc7136 100644 --- a/Underlight/Central.h +++ b/Underlight/Central.h @@ -36,6 +36,7 @@ const int DEAD_Z = _I16_MAX -1; extern TCHAR message[DEFAULT_MESSAGE_SIZE]; extern TCHAR disp_message[DEFAULT_MESSAGE_SIZE]; extern TCHAR temp_message[DEFAULT_MESSAGE_SIZE]; +extern TCHAR temp_message2[DEFAULT_MESSAGE_SIZE]; extern TCHAR duration_message[DEFAULT_MESSAGE_SIZE]; extern TCHAR modifier_message[DEFAULT_MESSAGE_SIZE]; extern TCHAR guild_name_message[DEFAULT_MESSAGE_SIZE]; diff --git a/Underlight/Realm.cpp b/Underlight/Realm.cpp index 05d0347..807e443 100644 --- a/Underlight/Realm.cpp +++ b/Underlight/Realm.cpp @@ -143,6 +143,7 @@ TCHAR message[DEFAULT_MESSAGE_SIZE]; // generic string for output messages TCHAR values_select[100][DEFAULT_MESSAGE_SIZE]; TCHAR disp_message[DEFAULT_MESSAGE_SIZE]; // generic string for output messages TCHAR temp_message[DEFAULT_MESSAGE_SIZE]; // generic string for output messages +TCHAR temp_message2[DEFAULT_MESSAGE_SIZE]; // generic string for output messages TCHAR errbuf[DEFAULT_MESSAGE_SIZE];// generic string for error messages TCHAR duration_message[DEFAULT_MESSAGE_SIZE]; TCHAR modifier_message[DEFAULT_MESSAGE_SIZE]; diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index 69dd361..a04a9d6 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -5576,10 +5576,10 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) } else // not casting on self or im being casted on { - LoadString(hInstance, IDS_MALE_DREAMER, temp_message, sizeof(temp_message)); // "A male dreamer" - LoadString(hInstance, IDS_FEMALE_DREAMER, temp_message2, sizeof(temp_message2)); //"A female dreamer" - //playerName = n->IsPMare() ? (player->IsMale() ? temp_message : temp_message2) : player->Name(); - playerName = player->IsDreamerAccount() ? n->IsPMare() ? ((n->IsMale() ? temp_message : temp_message2)) : player->Name() : player->Name(); + + LoadString(hInstance, IDS_FEMALE_DREAMER, temp_message2, sizeof(temp_message2)); // female + LoadString(hInstance, IDS_MALE_DREAMER, temp_message, sizeof(temp_message)); // male + playerName = player->IsDreamerAccount() ? (player->IsPMare() ? player->Name() : (player->IsMale()? temp_message : temp_message2)) : player->Name(); _stprintf(message, disp_message, timed_effects->name[i], playerName); gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); //send msg to person it's landing on From bc008ab3042ff9b74d47cdda47ce2318311a51db Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Mon, 27 Jan 2020 12:35:50 -0800 Subject: [PATCH 10/11] modified: AgentSvc/AgentSvc.h modified: Underlight/Central.h modified: Underlight/Options.cpp modified: Underlight/Realm.cpp modified: Underlight/cArts.cpp modified: Underlight/cChat.cpp modified: Underlight/cChat.h modified: Underlight/cNeighbor.cpp modified: Underlight/cNeighbor.h --- AgentSvc/AgentSvc.h | 0 Underlight/Central.h | 1 - Underlight/Options.cpp | 7 ---- Underlight/Realm.cpp | 1 - Underlight/cArts.cpp | 74 +++++++++++++++++----------------------- Underlight/cChat.cpp | 26 ++------------ Underlight/cChat.h | 4 +-- Underlight/cNeighbor.cpp | 8 ----- Underlight/cNeighbor.h | 1 - 9 files changed, 36 insertions(+), 86 deletions(-) mode change 100755 => 100644 AgentSvc/AgentSvc.h diff --git a/AgentSvc/AgentSvc.h b/AgentSvc/AgentSvc.h old mode 100755 new mode 100644 diff --git a/Underlight/Central.h b/Underlight/Central.h index 1bc7136..d742e62 100644 --- a/Underlight/Central.h +++ b/Underlight/Central.h @@ -36,7 +36,6 @@ const int DEAD_Z = _I16_MAX -1; extern TCHAR message[DEFAULT_MESSAGE_SIZE]; extern TCHAR disp_message[DEFAULT_MESSAGE_SIZE]; extern TCHAR temp_message[DEFAULT_MESSAGE_SIZE]; -extern TCHAR temp_message2[DEFAULT_MESSAGE_SIZE]; extern TCHAR duration_message[DEFAULT_MESSAGE_SIZE]; extern TCHAR modifier_message[DEFAULT_MESSAGE_SIZE]; extern TCHAR guild_name_message[DEFAULT_MESSAGE_SIZE]; diff --git a/Underlight/Options.cpp b/Underlight/Options.cpp index 07de4f4..b260829 100644 --- a/Underlight/Options.cpp +++ b/Underlight/Options.cpp @@ -449,13 +449,6 @@ cJSON** LoadJSONFiles() } numJsonFiles = fcount; - if (hFind != FindFirstFile("globals.json", &data)) - { - cJSON* globals = WriteGlobalJSONOptionValues(); - WriteJSONFile(globals, "globals.json"); - cJSON_Delete(globals); - } - if (numJsonFiles > MAX_STORED_ACCOUNTS) { GAME_ERROR("Too many JSON files - delete some!"); diff --git a/Underlight/Realm.cpp b/Underlight/Realm.cpp index 807e443..05d0347 100644 --- a/Underlight/Realm.cpp +++ b/Underlight/Realm.cpp @@ -143,7 +143,6 @@ TCHAR message[DEFAULT_MESSAGE_SIZE]; // generic string for output messages TCHAR values_select[100][DEFAULT_MESSAGE_SIZE]; TCHAR disp_message[DEFAULT_MESSAGE_SIZE]; // generic string for output messages TCHAR temp_message[DEFAULT_MESSAGE_SIZE]; // generic string for output messages -TCHAR temp_message2[DEFAULT_MESSAGE_SIZE]; // generic string for output messages TCHAR errbuf[DEFAULT_MESSAGE_SIZE];// generic string for error messages TCHAR duration_message[DEFAULT_MESSAGE_SIZE]; TCHAR modifier_message[DEFAULT_MESSAGE_SIZE]; diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index a04a9d6..3a13efc 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -5526,7 +5526,7 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) { cNeighbor *n = this->LookUpNeighbor(caster_id); - if (caster_id != player->ID() && n == NO_ACTOR) + if (caster_id != player->ID () && n == NO_ACTOR) return; // MDA 3/18/2004 - bail if the neighbor became NULL between evoke and Apply this->DisplayUsedByOther(n, Arts::ABJURE); @@ -5534,13 +5534,13 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) int num_effects_active = 0; int num_effects_abjured = 0; int curr_skill = skill; - int random = 0; - int i, j; + int random,i,j; + player->EvokedFX().Activate(Arts::ABJURE, false); for (i=0; iflags & timed_effects->actor_flag[i] && timed_effects->abjurable[i]) - num_effects_active++; + num_effects_active++; // pmares can only have 1 effect abjured at a time #ifndef PMARE @@ -5555,62 +5555,52 @@ void cArts::ApplyAbjure(int skill, lyra_id_t caster_id) } #endif - + while (num_effects_active && num_effects_to_abjure) { - random = rand() % num_effects_active; - j = 0; // j = count of active effects skipped by loop - for (i = 0; i < NUM_TIMED_EFFECTS; i++) - + random = rand()%num_effects_active; + j=0; // j = count of active effects skipped by loop + for (i=0; iflags & timed_effects->actor_flag[i]) && timed_effects->abjurable[i]) { if (j == random) // abjure this effect { - const TCHAR* playerName = NULL; - LoadString(hInstance, IDS_ABJURED_EFFECT, disp_message, sizeof(disp_message)); // "You have abjured %s from %s!\n" - if (caster_id == player->ID()) //casting on self + LoadString (hInstance, IDS_ABJURED_EFFECT, disp_message, sizeof(disp_message)); + if (caster_id == player->ID()) { - LoadString(hInstance, IDS_YOURSELF, temp_message, sizeof(temp_message)); // "yourself" + LoadString(hInstance, IDS_YOURSELF, temp_message, sizeof(temp_message)); _stprintf(message, disp_message, timed_effects->name[i], temp_message); - display->DisplayMessage(message); + display->DisplayMessage (message); } - else // not casting on self or im being casted on + else { - - LoadString(hInstance, IDS_FEMALE_DREAMER, temp_message2, sizeof(temp_message2)); // female - LoadString(hInstance, IDS_MALE_DREAMER, temp_message, sizeof(temp_message)); // male - playerName = player->IsDreamerAccount() ? (player->IsPMare() ? player->Name() : (player->IsMale()? temp_message : temp_message2)) : player->Name(); - _stprintf(message, disp_message, timed_effects->name[i], playerName); - gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); //send msg to person it's landing on - - if (n->ID() == caster_id && n != NO_ACTOR)// being casted on! by a real not us dreamer! - { - playerName = n->IsPMare() ? (player->IsMale() ? temp_message : temp_message2) : n->Name(); - LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); //"%s has abjured %s from you!\n" - _stprintf(message, disp_message, playerName, timed_effects->name[i]); - } - else + _stprintf(message, disp_message, timed_effects->name[i], player->Name()); + gs->Talk(message, RMsg_Speech::SYSTEM_WHISPER, caster_id); + if (n != NO_ACTOR) { + LoadString(hInstance, IDS_ABJURED_EFFECT_OTHER, disp_message, sizeof(disp_message)); + _stprintf(message, disp_message, n->Name(), timed_effects->name[i]); + } + else { _stprintf(message, "%s has been abjured from you!\n", timed_effects->name[i]); } - display->DisplayMessage(message); + + display->DisplayMessage (message); } - player->RemoveTimedEffect(i); - break; + player->RemoveTimedEffect(i); + break; } else j++; } - num_effects_active--; - num_effects_to_abjure--; - num_effects_abjured++; - if (i == NUM_TIMED_EFFECTS) - { - GAME_ERROR(IDS_ABJURE_FAIL); - return; - } - - + num_effects_active--; + num_effects_to_abjure--; + num_effects_abjured++; + if (i == NUM_TIMED_EFFECTS) + { + GAME_ERROR(IDS_ABJURE_FAIL); + return; + } } if (!num_effects_abjured && (caster_id == player->ID())) diff --git a/Underlight/cChat.cpp b/Underlight/cChat.cpp index d368c52..48dfc59 100644 --- a/Underlight/cChat.cpp +++ b/Underlight/cChat.cpp @@ -64,8 +64,6 @@ const struct window_pos_t chatPos[MAX_RESOLUTIONS] = const struct window_pos_t entryPos[MAX_RESOLUTIONS] = { { 0, 455, 480, 25 }, { 0, 570, 600, 35 }, { 0, 733, 768, 40 } }; #else -const struct window_pos_t classicChatPos[MAX_RESOLUTIONS] = -{ { 0, 300, 480, 180 },{ 0, 375, 600, 225 },{ 0, 480, 768, 288 } }; //added to fix undeclared ident on pmare const struct window_pos_t chatPos[MAX_RESOLUTIONS] = { { 0, 300, 480, 180 },{ 0, 375, 600, 225 },{ 0, 480, 768, 288 } }; #endif @@ -633,15 +631,6 @@ _stprintf(emoteCF.szFaceName, FONT_NAME); nameCF.crTextColor = (RGB(chat_colors[color].red, chat_colors[color].green, chat_colors[color].blue)); _stprintf(nameCF.szFaceName, FONT_NAME); SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&nameCF); - - // lets try this for gm raw and graw ~christy - memset(&raw_grawCF, 0, sizeof(raw_grawCF)); - raw_grawCF.cbSize = sizeof(raw_grawCF); - raw_grawCF.dwMask = CFM_FACE | CFM_ITALIC | CFM_BOLD | CFM_COLOR; - raw_grawCF.dwEffects = CFM_ITALIC | CFM_BOLD; - raw_grawCF.crTextColor = (RGB(chat_colors[color].red, chat_colors[color].green, chat_colors[color].blue)); - _stprintf(raw_grawCF.szFaceName, FONT_NAME); - SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&raw_grawCF); } void cChat::SetWhisperFormat(int color) @@ -714,11 +703,6 @@ void cChat::SwitchMode(int mode) SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&whisperCF); currMode = WHISPER; break; - - case RAW_GRAW: //added by christy for raw_graw - SendMessage(hwnd_richedit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&raw_grawCF); - currMode = RAW_GRAW; - break; } currMode = mode; @@ -838,9 +822,8 @@ void cChat::DisplaySpeech(const TCHAR *text, TCHAR *name, int speechType, bool i this->PreDisplay(); // set line counts, offset correctly _tcsnccpy(speech, text, sizeof(speech)); - if (speechType == RMsg_Speech::RAW_EMOTE) //added by christy - this->SwitchMode(RAW_GRAW); - else if (isEmote) + + if (isEmote) this->SwitchMode(EMOTE); else if (speechType == RMsg_Speech::WHISPER) this->SwitchMode(WHISPER); @@ -868,11 +851,6 @@ void cChat::DisplaySpeech(const TCHAR *text, TCHAR *name, int speechType, bool i _stprintf(message, _T(">%s "), name); break; case RMsg_Speech::RAW_EMOTE: - if (speech[0] == '\'') - _stprintf(message, _T(">%s")); - else - _stprintf(message, _T(">%s ")); - break; case RMsg_Speech::DISTRESS_CALL: _stprintf(message, _T("")); break; diff --git a/Underlight/cChat.h b/Underlight/cChat.h index bd93399..1a15b1f 100644 --- a/Underlight/cChat.h +++ b/Underlight/cChat.h @@ -22,7 +22,7 @@ const int NUM_CHAT_BUTTONS = 4; enum // current paragraph format { - PLAYER_SPEECH, PLAYER_NAME, SYSTEM_MESSAGE, EMOTE, WHISPER, RAW_GRAW + PLAYER_SPEECH, PLAYER_NAME, SYSTEM_MESSAGE, EMOTE, WHISPER }; @@ -49,7 +49,7 @@ class cChat WNDPROC lpfn_richedit, lpfn_entry; // pointer to window procedure HBITMAP chat_buttons_bitmaps[NUM_CHAT_BUTTONS][2]; PARAFORMAT chatPF; // paragraph format - CHARFORMAT speechCF, nameCF, systemCF, emoteCF, raw_grawCF, whisperCF; // character formats for other player's speech, names, and system messages, edited by christy to include raw_grawCF + CHARFORMAT speechCF, nameCF, systemCF, emoteCF, whisperCF; // character formats for other player's speech, names, and system messages cOutput *chatlog; // for logging chat int currMode; // current mode - player speech, system, etc. bool first_message; // has a message been displayed yet? diff --git a/Underlight/cNeighbor.cpp b/Underlight/cNeighbor.cpp index 8800340..9edf918 100644 --- a/Underlight/cNeighbor.cpp +++ b/Underlight/cNeighbor.cpp @@ -701,14 +701,6 @@ bool cNeighbor::IsMale(void) return false; } -// returns true if we're a pmare; based on account type -bool cNeighbor::IsPMare(void) -{ - if (avatar.AvatarType() == LmAvatar::ACCT_PMARE) - return true; - return false; -} - // returns avatar type unsigned int cNeighbor::GetAvatarType(void) { diff --git a/Underlight/cNeighbor.h b/Underlight/cNeighbor.h index af16794..c98170c 100644 --- a/Underlight/cNeighbor.h +++ b/Underlight/cNeighbor.h @@ -148,7 +148,6 @@ class cNeighbor : public cActor bool IsFemale (void); bool IsMale (void); - bool IsPMare(void); bool IsMonster (void); bool IsVulnerable (void); bool CanWhisper(void); From abd317c68b389ebf1d64b68f56f66a18a7b86c26 Mon Sep 17 00:00:00 2001 From: Christy Ganger Date: Mon, 27 Jan 2020 12:48:58 -0800 Subject: [PATCH 11/11] first attempt moving logs to user appdata underlight --- Underlight/cOutput.cpp | 40 +++++++++++++++++++++++++++++----------- Underlight/cOutput.h | 15 +++++++++------ 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/Underlight/cOutput.cpp b/Underlight/cOutput.cpp index 9b2fe8f..8e7c097 100644 --- a/Underlight/cOutput.cpp +++ b/Underlight/cOutput.cpp @@ -6,6 +6,10 @@ #include "Utils.h" #include "resource.h" #include +#include +#pragma comment(lib,"shlwapi.lib") +#include "shlobj.h" +#include "tchar.h" // define the following to enable buffering on debug output #define BUFFER_DEBUG_OUT @@ -23,15 +27,21 @@ extern HINSTANCE hInstance; cOutput::cOutput(TCHAR *fn, bool append_to_file, bool fForceFlush /*= false */) { + append = append_to_file; m_fForceFlush = fForceFlush; _tcscpy(filename, fn); _tcscat(filename, _T(".out")); - + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath))) + { + PathAppend(szPath, _T("\\Underlight\\")); + CreateDirectory(szPath, NULL); + PathAppend(szPath, filename); + } // check file size; rename if necessary HANDLE hFile; BY_HANDLE_FILE_INFORMATION info; - hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(szPath, GENERIC_READ , FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE == hFile) { @@ -48,12 +58,20 @@ cOutput::cOutput(TCHAR *fn, bool append_to_file, bool fForceFlush /*= false */) SYSTEMTIME dsttime; GetDSTTime(&dsttime); TCHAR backup_filename[_MAX_DIR]; + + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath_backup))) + { + PathAppend(szPath, _T("\\Underlight\\")); + CreateDirectory(szPath, NULL); + PathAppend(szPath, backup_filename); + } LoadString(hInstance, IDS_BACKUP_LOG, message, sizeof(message)); - _stprintf(backup_filename, message, fn, dsttime.wMonth, dsttime.wDay, dsttime.wYear); - int result = rename(filename, backup_filename); + _stprintf(szPath_backup, message, fn, dsttime.wMonth, dsttime.wDay, dsttime.wYear); + int result = rename(szPath, szPath_backup); int qqq=0; } - + + // insure a directory component exists. if not, create it // mket 11/02/01 TCHAR dir[_MAX_DIR]; @@ -74,14 +92,14 @@ cOutput::cOutput(TCHAR *fn, bool append_to_file, bool fForceFlush /*= false */) if (append) if (fForceFlush) - fh =_tfopen(filename,_T("a+c")); + fh =_tfopen(szPath,_T("a+c")); else - fh =_tfopen(filename,_T("a+")); + fh =_tfopen(szPath,_T("a+")); else if (fForceFlush) - fh =_tfopen(filename,_T("wc")); + fh =_tfopen(szPath,_T("wc")); else - fh =_tfopen(filename,_T("w")); + fh =_tfopen(szPath,_T("w")); if (fh == NULL ) { @@ -139,9 +157,9 @@ void cOutput::ReInit(void) fclose(fh); if (append) - fh =_tfopen(filename,_T("a+")); + fh =_tfopen(szPath,_T("a+")); else - fh =_tfopen(filename,_T("w")); + fh =_tfopen(szPath,_T("w")); if (fh == NULL ) { diff --git a/Underlight/cOutput.h b/Underlight/cOutput.h index ef82259..598dd00 100644 --- a/Underlight/cOutput.h +++ b/Underlight/cOutput.h @@ -19,20 +19,23 @@ class cOutput { -public: +public: private: - FILE *fh; + FILE* fh; TCHAR filename[DEFAULT_MESSAGE_SIZE]; + TCHAR szPath[MAX_PATH]; + TCHAR szPath_backup[MAX_PATH];; bool append; bool m_fForceFlush; // true = flush after each write. Use with care. - + public: - cOutput(TCHAR *fn, bool append_to_file, bool fForceFlush = false); + cOutput(TCHAR* fn, bool append_to_file, bool fForceFlush = false); void ReInit(void); // close & reopen - void Write(TCHAR *data, bool long_date = false); + void Write(TCHAR* data, bool long_date = false); void WriteStamp(bool long_date = false); - ~cOutput(void); + ~cOutput(void); + inline FILE *FileHandle(void) { return fh; };