-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5644 from LandSandBoat/packet/s2c-0x011a
[packet] Implement C->S 0x119, S->C 0x11A - Emote List
- Loading branch information
Showing
5 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
=========================================================================== | ||
Copyright (c) 2024 LandSandBoat Dev Teams | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see http://www.gnu.org/licenses/ | ||
=========================================================================== | ||
*/ | ||
|
||
#include "char_emote_list.h" | ||
#include "common/socket.h" | ||
#include "entities/baseentity.h" | ||
#include "lua/luautils.h" | ||
#include "utils/charutils.h" | ||
|
||
CCharEmoteListPacket::CCharEmoteListPacket(CCharEntity* PChar) | ||
{ | ||
this->setType(0x11A); | ||
this->setSize(0x0C); | ||
|
||
// RUN and GEO are not sequential with the rest of the list, so grab those two separate offsets first. | ||
// Geomancer begins with bit 20, so create the offset based on an ID with that value subtracted. | ||
auto warriorKeyItem = lua["xi"]["keyItem"]["JOB_GESTURE_WARRIOR"].get<uint16>(); | ||
auto geomancerKeyItem = lua["xi"]["keyItem"]["JOB_GESTURE_GEOMANCER"].get<uint16>(); | ||
|
||
uint32 jobEmotes = 0; | ||
for (const auto& keyItemName : jobGestureKeyItems) | ||
{ | ||
auto keyItemId = lua["xi"]["keyItem"][keyItemName].get<uint16>(); | ||
if (charutils::hasKeyItem(PChar, keyItemId)) | ||
{ | ||
uint16 bitOffset = keyItemId < geomancerKeyItem ? warriorKeyItem : geomancerKeyItem - 20; | ||
jobEmotes |= 1 << (keyItemId - bitOffset); | ||
} | ||
} | ||
|
||
auto imperialChairKeyItem = lua["xi"]["keyItem"]["IMPERIAL_CHAIR"].get<uint16>(); | ||
|
||
uint16 chairEmotes = 0; | ||
for (const auto& keyItemName : chairKeyItems) | ||
{ | ||
auto keyItemId = lua["xi"]["keyItem"][keyItemName].get<uint16>(); | ||
if (charutils::hasKeyItem(PChar, keyItemId)) | ||
{ | ||
chairEmotes |= 1 << (keyItemId - imperialChairKeyItem); | ||
} | ||
} | ||
|
||
ref<uint32>(0x04) = jobEmotes; | ||
ref<uint16>(0x08) = chairEmotes; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
=========================================================================== | ||
Copyright (c) 2024 LandSandBoat Dev Teams | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see http://www.gnu.org/licenses/ | ||
=========================================================================== | ||
*/ | ||
|
||
#ifndef _CCHAREMOTELIST_H | ||
#define _CCHAREMOTELIST_H | ||
|
||
#include "common/cbasetypes.h" | ||
|
||
#include "basic.h" | ||
|
||
std::vector<std::string> const jobGestureKeyItems = { | ||
"JOB_GESTURE_WARRIOR", | ||
"JOB_GESTURE_MONK", | ||
"JOB_GESTURE_WHITE_MAGE", | ||
"JOB_GESTURE_BLACK_MAGE", | ||
"JOB_GESTURE_RED_MAGE", | ||
"JOB_GESTURE_THIEF", | ||
"JOB_GESTURE_PALADIN", | ||
"JOB_GESTURE_DARK_KNIGHT", | ||
"JOB_GESTURE_BEASTMASTER", | ||
"JOB_GESTURE_BARD", | ||
"JOB_GESTURE_RANGER", | ||
"JOB_GESTURE_SAMURAI", | ||
"JOB_GESTURE_NINJA", | ||
"JOB_GESTURE_DRAGOON", | ||
"JOB_GESTURE_SUMMONER", | ||
"JOB_GESTURE_BLUE_MAGE", | ||
"JOB_GESTURE_CORSAIR", | ||
"JOB_GESTURE_PUPPETMASTER", | ||
"JOB_GESTURE_DANCER", | ||
"JOB_GESTURE_SCHOLAR", | ||
"JOB_GESTURE_GEOMANCER", | ||
"JOB_GESTURE_RUNE_FENCER", | ||
}; | ||
|
||
std::vector<std::string> const chairKeyItems = { | ||
"IMPERIAL_CHAIR", | ||
"DECORATIVE_CHAIR", | ||
"ORNATE_STOOL", | ||
"REFINED_CHAIR", | ||
"PORTABLE_CONTAINER", | ||
"CHOCOBO_CHAIR", | ||
"EPHRAMADIAN_THRONE", | ||
"SHADOW_THRONE", | ||
"LEAF_BENCH", | ||
"ASTRAL_CUBE", | ||
"CHOCOBO_CHAIR_II", | ||
}; | ||
|
||
class CCharEntity; | ||
|
||
class CCharEmoteListPacket : public CBasicPacket | ||
{ | ||
public: | ||
CCharEmoteListPacket(CCharEntity* PChar); | ||
}; | ||
|
||
#endif |