Skip to content

Commit

Permalink
fix: compilation and equip items
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Apr 16, 2024
1 parent 0fd8be9 commit 2233a9d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/canary_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ void CanaryServer::loadModules() {
#else
modulesLoadHelper((g_game().loadAppearanceProtobuf(coreFolder + "/items/appearances.dat") == ERROR_NONE), "appearances.dat");
#endif
modulesLoadHelper(Item::items.loadFromXml(), "items.xml");

// Load XML folder dependencies (order matters)
modulesLoadHelper(g_vocations().loadFromXml(), "XML/vocations.xml");
Expand Down
2 changes: 2 additions & 0 deletions src/creatures/players/achievement/player_achievement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ void PlayerAchievement::sendUnlockedSecretAchievements() {
m_achievementsUnlocked.push_back({ achievement, achievCreatedTime });
}

#if CLIENT_VERSION > 1100
m_player.sendCyclopediaCharacterAchievements(unlockedSecret, m_achievementsUnlocked);
#endif
}

const std::shared_ptr<KV> &PlayerAchievement::getUnlockedKV() {
Expand Down
4 changes: 4 additions & 0 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2682,10 +2682,12 @@ BlockType_t Player::blockHit(std::shared_ptr<Creature> attacker, CombatType_t co
}

void Player::death(std::shared_ptr<Creature> lastHitCreature) {
#if CLIENT_VERSION >= 870
if (!g_configManager().getBoolean(TOGGLE_MOUNT_IN_PZ, __FUNCTION__) && isMounted()) {
dismount();
g_game().internalCreatureChangeOutfit(getPlayer(), defaultOutfit);
}
#endif

loginPosition = town->getTemplePosition();

Expand Down Expand Up @@ -6147,11 +6149,13 @@ void Player::sendClosePrivate(uint16_t channelId) {
}
}

#if CLIENT_VERSION > 1100
void Player::sendCyclopediaCharacterAchievements(uint16_t secretsUnlocked, std::vector<std::pair<Achievement, uint32_t>> achievementsUnlocked) {
if (client) {
client->sendCyclopediaCharacterAchievements(secretsUnlocked, achievementsUnlocked);
}
}
#endif

uint64_t Player::getMoney() const {
std::vector<std::shared_ptr<Container>> containers;
Expand Down
15 changes: 13 additions & 2 deletions src/items/functions/item/item_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,38 +1029,49 @@ void ItemParse::createAndRegisterScript(ItemType &itemType, pugi::xml_node attri
if (moveevent && (moveevent->getEventType() == MOVE_EVENT_EQUIP || moveevent->getEventType() == MOVE_EVENT_DEEQUIP)) {
if (slotName == "head") {
moveevent->setSlot(SLOTP_HEAD);
itemType.slotPosition |= SLOTP_HEAD;
} else if (slotName == "necklace") {
moveevent->setSlot(SLOTP_NECKLACE);
itemType.slotPosition |= SLOTP_NECKLACE;
} else if (slotName == "backpack") {
moveevent->setSlot(SLOTP_BACKPACK);
itemType.slotPosition |= SLOTP_BACKPACK;
} else if (slotName == "armor" || slotName == "body") {
moveevent->setSlot(SLOTP_ARMOR);
itemType.slotPosition |= SLOTP_ARMOR;
} else if (slotName == "right-hand") {
moveevent->setSlot(SLOTP_RIGHT);
itemType.slotPosition &= ~SLOTP_LEFT;
} else if (slotName == "left-hand") {
moveevent->setSlot(SLOTP_LEFT);
itemType.slotPosition &= ~SLOTP_RIGHT;
} else if (slotName == "hand" || slotName == "shield") {
moveevent->setSlot(SLOTP_RIGHT | SLOTP_LEFT);
} else if (slotName == "legs") {
moveevent->setSlot(SLOTP_LEGS);
itemType.slotPosition |= SLOTP_LEGS;
} else if (slotName == "feet") {
moveevent->setSlot(SLOTP_FEET);
itemType.slotPosition |= SLOTP_FEET;
} else if (slotName == "ring") {
moveevent->setSlot(SLOTP_RING);
itemType.slotPosition |= SLOTP_RING;
} else if (slotName == "ammo") {
moveevent->setSlot(SLOTP_AMMO);
itemType.slotPosition |= SLOTP_AMMO;
} else if (slotName == "two-handed") {
moveevent->setSlot(SLOTP_TWO_HAND);
itemType.slotPosition |= SLOTP_TWO_HAND;
} else {
g_logger().warn("[{}] unknown slot type '{}'", __FUNCTION__, slotName);
}
} else if (weapon) {
uint16_t id = weapon->getID();
ItemType &it = Item::items.getItemType(id);
if (slotName == "two-handed") {
it.slotPosition = SLOTP_TWO_HAND;
itemType.slotPosition |= SLOTP_TWO_HAND;
} else {
it.slotPosition = SLOTP_HAND;
itemType.slotPosition |= SLOTP_HAND;
}
}
} else if (stringKey == "level") {
Expand Down
2 changes: 1 addition & 1 deletion src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7355,7 +7355,7 @@ void ProtocolGame::sendAddCreature(std::shared_ptr<Creature> creature, const Pos
msg.add<uint16_t>(0x32); // beat duration (50)

#if CLIENT_VERSION < 1310
if (player->getAccountType() >= account::ACCOUNT_TYPE_NORMAL) {
if (player->getAccountType() >= ACCOUNT_TYPE_NORMAL) {
msg.addByte(0x01);
} else {
msg.addByte(0x00);
Expand Down

0 comments on commit 2233a9d

Please sign in to comment.