Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions HeavenClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,8 @@ add_executable(HeavenClient
IO/UITypes/UIKarmaScissors.h
IO/UITypes/UIVegaSpell.cpp
IO/UITypes/UIVegaSpell.h
IO/UITypes/UIEnchantSkill.cpp
IO/UITypes/UIEnchantSkill.h
IO/UITypes/UIInviteCard.cpp
IO/UITypes/UIInviteCard.h
IO/UITypes/UIGuildBBS.cpp
Expand Down
19 changes: 19 additions & 0 deletions HeavenClient/Character/Inventory/ScrollRules.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,30 @@ namespace ms
constexpr const char *SEALED_TARGET = "Due to the potency of the scroll,\\nthe sealed item might be destroyed."
"\\nAre you sure you still want to use the scroll?";

// Legendary Spirit's window (FUN_007f63fa, FUN_007f651c): StringPool
// 0x1063 for a cash equip dropped in, and the literal at 0xb388cc for
// the server's -1.
constexpr const char *CASH_REFUSED = "You may not use scrolls on this item.";
constexpr const char *ENCHANT_REFUSED = "You cannot use a Scroll with this item.";

inline bool is_scroll(int32_t item_id)
{
return item_id / 10000 == 204;
}

// Legendary Spirit: the Beginner's, the Noblesse's and the Legend's.
inline bool is_legendary_spirit(int32_t skill_id)
{
return skill_id == 1003 || skill_id == 10001003 || skill_id == 20001003;
}

// Whether Legendary Spirit's window takes the equip (FUN_007f63fa):
// no cash equip but pet equipment.
inline bool may_enchant(int32_t equip_id, bool cash)
{
return !cash || equip_id / 10000 == 180;
}

// FUN_004f5497. Clean Slate (20490xx) and Chaos (20491xx) fit any
// equipment but pet equipment; 20492xx fits rings, pendants and belts;
// any other scroll fits the category its id names (2043001: 130xxxx).
Expand Down
14 changes: 14 additions & 0 deletions HeavenClient/Gameplay/Combat/Combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#include "../../IO/Messages.h"
#include "../../IO/UI.h"
#include "../../IO/UITypes/UIMaker.h"
#include "../../IO/UITypes/UIEnchantSkill.h"
#include "../../Character/Inventory/ScrollRules.h"
#include "../../Util/Misc.h"
#include "../../Util/Randomizer.h"

Expand Down Expand Up @@ -251,6 +253,18 @@ namespace ms
return false;
}

// So does Legendary Spirit (FUN_0096d085).
if (scroll_rules::is_legendary_spirit(move_id))
{
auto window = UI::get().get_element<UIEnchantSkill>();
bool open = window && window->is_active();

if (!open && player.get_skills().get_level(move_id) > 0 && player.can_request(200))
UI::get().emplace<UIEnchantSkill>();

return false;
}

if (player.is_barrel_busy())
{
InChatMessage(Messages::Type::MORPHED).drop();
Expand Down
1 change: 1 addition & 0 deletions HeavenClient/IO/Components/EquipTooltip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ namespace ms
case Tooltip::Parent::ITEMPROTECTOR:
case Tooltip::Parent::KARMASCISSORS:
case Tooltip::Parent::VEGARESULT:
case Tooltip::Parent::ENCHANTSKILL:
case Tooltip::Parent::DUEY:
invtype = InventoryType::Id::EQUIP;
break;
Expand Down
1 change: 1 addition & 0 deletions HeavenClient/IO/Components/Tooltip.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace ms
ITEMPROTECTOR,
KARMASCISSORS,
VEGARESULT,
ENCHANTSKILL,
STATUSBAR,
// The status bar's quick slots, whose tooltips go above the cursor.
QUICKSLOT,
Expand Down
5 changes: 4 additions & 1 deletion HeavenClient/IO/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "UITypes/UISystemOption.h"
#include "UITypes/UITradingRoom.h"
#include "UITypes/UIVegaSpell.h"
#include "UITypes/UIEnchantSkill.h"
#include "UITypes/UIViciousHammer.h"
#include "UITypes/UIWorldMap.h"

Expand Down Expand Up @@ -136,7 +137,8 @@ namespace ms
|| open(get_element<UIShop>()) || open(get_element<UIStorage>()) || open(get_element<UIDuey>())
|| open(get_element<UIItemMegaphone>()) || open(get_element<UIItemProtector>())
|| open(get_element<UIKarmaScissors>()) || open(get_element<UIViciousHammer>())
|| open(get_element<UIVegaSpell>()) || open(get_element<UIKiteWrite>());
|| open(get_element<UIVegaSpell>()) || open(get_element<UIKiteWrite>())
|| open(get_element<UIEnchantSkill>());
}

void UI::send_cursor(Point<int16_t> cursorpos, Cursor::State cursorstate)
Expand Down Expand Up @@ -429,6 +431,7 @@ namespace ms
types.emplace_back(UIElement::Type::ITEMPROTECTOR);
types.emplace_back(UIElement::Type::KARMASCISSORS);
types.emplace_back(UIElement::Type::VEGARESULT);
types.emplace_back(UIElement::Type::ENCHANTSKILL);
types.emplace_back(UIElement::Type::PETCHOOSER);
types.emplace_back(UIElement::Type::APRESET);
types.emplace_back(UIElement::Type::SPRESET);
Expand Down
1 change: 1 addition & 0 deletions HeavenClient/IO/UIElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ namespace ms
SCRIPTMESSAGE,
FAMILY,
FAMILYTREE,
ENCHANTSKILL,
NUM_TYPES
};

Expand Down
2 changes: 2 additions & 0 deletions HeavenClient/IO/UIStateGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ namespace ms
return Tooltip::Parent::KARMASCISSORS;
case UIElement::Type::VEGARESULT:
return Tooltip::Parent::VEGARESULT;
case UIElement::Type::ENCHANTSKILL:
return Tooltip::Parent::ENCHANTSKILL;
case UIElement::Type::EVENT:
return Tooltip::Parent::EVENT;
case UIElement::Type::KEYCONFIG:
Expand Down
Loading
Loading