diff --git a/Underlight/Underlight.rc b/Underlight/Underlight.rc index cb499e3..5871031 100644 --- a/Underlight/Underlight.rc +++ b/Underlight/Underlight.rc @@ -2774,6 +2774,7 @@ END STRINGTABLE BEGIN IDS_RALLY_NO_SS "Rally cannot work on a soulsphere!\n" + IDS_QUERY_PEACE_AURA "You are being offered %s by %s. Do you accept?" IDS_NO_ACCESS_REGISTRY "Cannot access registry" IDS_0 "0" IDS_1 "1" diff --git a/Underlight/cArts.cpp b/Underlight/cArts.cpp index 3a13efc..e5b211a 100644 --- a/Underlight/cArts.cpp +++ b/Underlight/cArts.cpp @@ -7014,23 +7014,35 @@ void cArts::EndBreakCovenant(void) // Peace Aura void cArts::StartPeaceAura(void) { + //wait for selection of target this->WaitForSelection(&cArts::EndPeaceAura, Arts::PEACE_AURA); + //adds our player to list this->AddDummyNeighbor(); + // captures neighbor tab for selection this->CaptureCP(NEIGHBORS_TAB, Arts::PEACE_AURA); return; } +//applying the art void cArts::ApplyPeaceAura(int skill, lyra_id_t caster_id) { + // finds neighbor cNeighbor *n = this->LookUpNeighbor(caster_id); + //if neighbor is none, and caster id is not player ID if ((n == NO_ACTOR) && (caster_id != player->ID())) + { + this->DisplayNeighborBailed(Arts::PEACE_AURA); + //bail. return; - + } + //if player is monster if (player->IsMonster()) { + //bail return; } - + //removed this part so can evoke on non members + /* if(player->GuildRank(Guild::ECLIPSE) == Guild::NO_RANK) { LoadString (hInstance, IDS_MUST_BE_MEMBER_APPLY, disp_message, sizeof(disp_message)); @@ -7038,27 +7050,91 @@ void cArts::ApplyPeaceAura(int skill, lyra_id_t caster_id) display->DisplayMessage(message, false); return; } + */ + //load up PAhelper variables + PA_skill = skill; + PA_castid = caster_id; + // check if player has rank + if (player->GuildRank(Guild::ECLIPSE) >= Guild::INITIATE) + { + //good, just use it. + PeaceAuraHelper(skill, caster_id); + // puts cast cone on player + player->EvokedFX().Activate(Arts::PEACE_AURA, false); + } + // if caster isnt player + else if (!acceptrejectdlg) + { + //load string for asking if can cast + LoadString(hInstance, IDS_QUERY_PEACE_AURA, disp_message, sizeof(disp_message)); + + //loads it into message from disp_message with variables filled in + _stprintf(message, disp_message, this->Descrip(Arts::PEACE_AURA), n->Name()); + + //call to gdi for popup dialog with message + HWND hDlg = CreateLyraDialog(hInstance, (IDD_ACCEPTREJECT), + cDD->Hwnd_Main(), (DLGPROC)AcceptRejectDlgProc); + + //calls gotpeaceaura if evoke success + acceptreject_callback = (&cArts::GotPeaceAura); + SendMessage(hDlg, WM_SET_ART_CALLBACK, 0, 0); + SendMessage(hDlg, WM_SET_AR_NEIGHBOR, 0, (LPARAM)n); + } - - player->EvokedFX().Activate(Arts::PEACE_AURA, false); + // displays art was cast upon the one using(if pertenant) this->DisplayUsedByOther(n, Arts::PEACE_AURA); + return; +} +void cArts::PeaceAuraHelper(int skill, lyra_id_t caster_id) +{ + //set duration int duration = this->Duration(Arts::PEACE_AURA, skill); - player->SetTimedEffect(LyraEffect::PLAYER_PEACE_AURA, duration, caster_id, EffectOrigin::ART_EVOKE); + + //set effect on player + player->SetTimedEffect(LyraEffect::PLAYER_PEACE_AURA, duration, player->ID(), EffectOrigin::ART_EVOKE); + +} +//art got casted on player by someone else. +void cArts::GotPeaceAura(void* value) +{ + //loads value of accept or rej + int success = *((int*)value); + // check for soulsphere + if (player->flags & ACTOR_SOULSPHERE) { + //loads IDS_SOULSPHERE_NO_ARTS string into disp_message + LoadString(hInstance, IDS_SOULSPHERE_NO_ARTS, disp_message, sizeof(disp_message)); + //puts it on screen + display->DisplayMessage(disp_message); + + } + // checks if successfully accepted and casts on target + else if (success) { + //use the art + PeaceAuraHelper(PA_skill, PA_castid); + player->EvokedFX().Activate(Arts::PEACE_AURA, false); + + } + return; } + +//final clear n clean of art.. void cArts::EndPeaceAura(void) { + // checks neighbor list cNeighbor* n = cp->SelectedNeighbor(); + //if actor isnt present, or if it's an invalid target if ((n == NO_ACTOR) || !(actors->ValidNeighbor(n))) { this->DisplayNeighborBailed(Arts::PEACE_AURA); + //does not allow art to imp this->ArtFinished(false); return; } - + // only works for AOE if (!(player->GuildRank(Guild::ECLIPSE) >= Guild::INITIATE)) { @@ -7068,38 +7144,64 @@ void cArts::EndPeaceAura(void) this->ArtFinished(false); return; } - + + //makes a temp token or points to one for comparison cItem* power_tokens[Lyra::INVENTORY_MAX]; + //counts number of them in casters inventory int num_tokens = CountPowerTokens((cItem**)power_tokens, Guild::ECLIPSE); + // if number of tokens is less than requirement if (num_tokens < HOUSE_ART_PTS) { + //load string IDS_MUST_HAVE_POWER_TOKENS string into message LoadString (hInstance, IDS_MUST_HAVE_POWER_TOKENS, message, sizeof(message)); + //fills in %t variables for string. and places it in disp_message _stprintf(disp_message, message, HOUSE_ART_PTS, GuildName(Guild::ECLIPSE), arts->Descrip(Arts::PEACE_AURA)); - display->DisplayMessage(disp_message); + // displays msg + display->DisplayMessage(disp_message); + //doesnt allow imp this->ArtFinished(false); return; } + //if neighbor is a monster (target) if (n->IsMonster()) { + //load string IDS_PEACE_AURA_MARES, and stuff it in disp_message LoadString (hInstance, IDS_PEACE_AURA_MARES, disp_message, sizeof(disp_message)); - display->DisplayMessage(disp_message); + //display disp_message + display->DisplayMessage(disp_message); + //no imp this->ArtFinished(false); return; } + //if casting on self. if (n->ID() == player->ID()) + { + //apply peace aura this->ApplyPeaceAura(player->Skill(Arts::PEACE_AURA), player->ID()); - else gs->SendPlayerMessage(n->ID(), RMsg_PlayerMsg::PEACE_AURA, + //display casted on self + DisplayUsedByOther(n, Arts::PEACE_AURA); + } + else + { + //send gameserver to send player to cast art on target at casters skill + gs->SendPlayerMessage(n->ID(), RMsg_PlayerMsg::PEACE_AURA, player->Skill(Arts::PEACE_AURA), 0); - + + //display on screen used on other + DisplayUsedOnOther(n, Arts::PEACE_AURA); + } + //use the power token. this->UsePowerTokens(power_tokens, HOUSE_ART_PTS); - + //allow imp this->ArtFinished(true); return; } + + ////////////////////////////////////////////////////////////////// // Sable Shield void cArts::StartSableShield(void) diff --git a/Underlight/cArts.h b/Underlight/cArts.h index 85925c2..38b7365 100644 --- a/Underlight/cArts.h +++ b/Underlight/cArts.h @@ -63,7 +63,7 @@ class cArts bool fDoingNewlies; bool fDoingMares; bool fDoingSense; - + int PA_castid, PA_skill; //pa helper vars // random state variables used by arts TCHAR knight_name[Lyra::PLAYERNAME_MAX]; @@ -321,6 +321,8 @@ class cArts void EndExpel(void); void StartPeaceAura(void); void ApplyPeaceAura(int skill, lyra_id_t caster_id); + void PeaceAuraHelper(int skill, lyra_id_t caster_id); + void GotPeaceAura(void* value); //added for new function void EndPeaceAura(void); void StartSableShield(void); void ApplySableShield(int skill, lyra_id_t caster_id); diff --git a/Underlight/debug.out b/Underlight/debug.out deleted file mode 100644 index ab40380..0000000 --- a/Underlight/debug.out +++ /dev/null @@ -1,4 +0,0 @@ - -Mon May 14 12:36:33 2018: Start Log -Mon May 14 12:36:33 2018: === Bye! Lucid Dreams === -Mon May 14 12:36:36 2018: \ No newline at end of file diff --git a/Underlight/resource.h b/Underlight/resource.h index b1ac41c..f7d861e 100644 --- a/Underlight/resource.h +++ b/Underlight/resource.h @@ -3047,6 +3047,7 @@ #define IDS_DISTRESS_CALL_UNS 4499 #define IDS_STRING19 4500 #define IDS_ITEM_GIVEN_TO 4500 +#define IDS_QUERY_PEACE_AURA 4501 #define IDC_NUKE_PARTICLES 4802 #define IDC_PARTICLE_RELOAD 4803 #define IDC_AVATAR_COMBO 16666