mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 06:57:28 +00:00
simplify shirt code in character creation
This commit is contained in:
parent
57e28d4619
commit
b6fc49f057
@ -566,114 +566,34 @@ void UserManager::LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getShirtColorId(uint32_t color) {
|
||||||
|
|
||||||
|
// get the index of the color in shirtColorVector
|
||||||
|
auto colorId = std::find (shirtColorVector.begin(), shirtColorVector.end(), color);
|
||||||
|
return color = std::distance(shirtColorVector.begin(), colorId);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t FindCharShirtID(uint32_t shirtColor, uint32_t shirtStyle) {
|
uint32_t FindCharShirtID(uint32_t shirtColor, uint32_t shirtStyle) {
|
||||||
uint32_t shirtID = 0;
|
|
||||||
|
shirtStyle--; // to start at 0 instead of 1
|
||||||
// s p e c i a l code follows
|
uint32_t stylesCount = 34;
|
||||||
switch (shirtColor) {
|
uint32_t colorId = getShirtColorId(shirtColor);
|
||||||
case 0: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5730 : SHIRT_BRIGHT_RED;
|
uint32_t startID = 4049; // item ID of the shirt with color 0 (red) and style 0 (plain)
|
||||||
break;
|
|
||||||
}
|
// For some reason, if the shirt style is 34 - 39,
|
||||||
|
|
||||||
case 1: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5736 : SHIRT_BRIGHT_BLUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 3: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5748 : SHIRT_DARK_GREEN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 5: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5754 : SHIRT_BRIGHT_ORANGE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 6: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5760 : SHIRT_BLACK;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 7: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5766 : SHIRT_DARK_STONE_GRAY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 8: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5772 : SHIRT_MEDIUM_STONE_GRAY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 9: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5778 : SHIRT_REDDISH_BROWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 10: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5784 : SHIRT_WHITE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 11: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5790 : SHIRT_MEDIUM_BLUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 13: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5796 : SHIRT_DARK_RED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 14: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5802 : SHIRT_EARTH_BLUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 15: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5808 : SHIRT_EARTH_GREEN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 16: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5814 : SHIRT_BRICK_YELLOW;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 84: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5820 : SHIRT_SAND_BLUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 96: {
|
|
||||||
shirtID = shirtStyle >= 35 ? 5826 : SHIRT_SAND_GREEN;
|
|
||||||
shirtColor = 16;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize another variable for the shirt color
|
|
||||||
uint32_t editedShirtColor = shirtID;
|
|
||||||
|
|
||||||
// This will be the final shirt ID
|
|
||||||
uint32_t shirtIDFinal;
|
|
||||||
|
|
||||||
// For some reason, if the shirt color is 35 - 40,
|
|
||||||
// The ID is different than the original... Was this because
|
// The ID is different than the original... Was this because
|
||||||
// these shirts were added later?
|
// these shirts were added later?
|
||||||
if (shirtStyle >= 35) {
|
if (shirtStyle >= 34) {
|
||||||
shirtIDFinal = editedShirtColor += (shirtStyle - 35);
|
startID = 5730; // item ID of the shirt with color 0 (red) and style 34 (butterflies)
|
||||||
}
|
shirtStyle -= stylesCount; //change style from range 35-40 to range 0-5
|
||||||
else {
|
stylesCount = 6;
|
||||||
// Get the final ID of the shirt by adding the shirt
|
|
||||||
// style to the editedShirtColor
|
|
||||||
shirtIDFinal = editedShirtColor += (shirtStyle - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the final ID of the shirt
|
||||||
|
uint32_t shirtID = startID + (colorId * stylesCount) + shirtStyle;
|
||||||
|
|
||||||
//cout << "Shirt ID is: " << shirtIDFinal << endl;
|
return shirtID;
|
||||||
|
|
||||||
return shirtIDFinal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FindCharPantsID(uint32_t pantsColor) {
|
uint32_t FindCharPantsID(uint32_t pantsColor) {
|
||||||
|
@ -33,10 +33,10 @@ public:
|
|||||||
bool IsNamePreapproved(const std::string& requestedName);
|
bool IsNamePreapproved(const std::string& requestedName);
|
||||||
|
|
||||||
void RequestCharacterList(const SystemAddress& sysAddr);
|
void RequestCharacterList(const SystemAddress& sysAddr);
|
||||||
void CreateCharacter(const SystemAddress& sysAddr, Packet* packet);
|
void CreateCharacter(const SystemAddress& sysAddr, Packet* packet);
|
||||||
void DeleteCharacter(const SystemAddress& sysAddr, Packet* packet);
|
void DeleteCharacter(const SystemAddress& sysAddr, Packet* packet);
|
||||||
void RenameCharacter(const SystemAddress& sysAddr, Packet* packet);
|
void RenameCharacter(const SystemAddress& sysAddr, Packet* packet);
|
||||||
void LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID);
|
void LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID);
|
||||||
|
|
||||||
void SaveAllActiveCharacters();
|
void SaveAllActiveCharacters();
|
||||||
|
|
||||||
@ -48,9 +48,9 @@ private:
|
|||||||
std::map<SystemAddress, User*> m_Users;
|
std::map<SystemAddress, User*> m_Users;
|
||||||
std::vector<User*> m_UsersToDelete;
|
std::vector<User*> m_UsersToDelete;
|
||||||
|
|
||||||
std::vector<std::string> m_FirstNames;
|
std::vector<std::string> m_FirstNames;
|
||||||
std::vector<std::string> m_MiddleNames;
|
std::vector<std::string> m_MiddleNames;
|
||||||
std::vector<std::string> m_LastNames;
|
std::vector<std::string> m_LastNames;
|
||||||
std::vector<std::string> m_PreapprovedNames;
|
std::vector<std::string> m_PreapprovedNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -73,24 +73,24 @@ enum CharCreatePantsColor : uint32_t {
|
|||||||
PANTS_DARK_RED = 2527
|
PANTS_DARK_RED = 2527
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CharCreateShirtColor : uint32_t {
|
const std::vector<uint32_t> shirtColorVector {
|
||||||
SHIRT_BRIGHT_RED = 4049,
|
0, // BRIGHT_RED
|
||||||
SHIRT_BRIGHT_BLUE = 4083,
|
1, // BRIGHT_BLUE
|
||||||
SHIRT_BRIGHT_YELLOW = 4117,
|
2, // BRIGHT_YELLOW
|
||||||
SHIRT_DARK_GREEN = 4151,
|
3, // DARK_GREEN
|
||||||
SHIRT_BRIGHT_ORANGE = 4185,
|
5, // BRIGHT_ORANGE
|
||||||
SHIRT_BLACK = 4219,
|
6, // BLACK
|
||||||
SHIRT_DARK_STONE_GRAY = 4253,
|
7, // DARK_STONE_GRAY
|
||||||
SHIRT_MEDIUM_STONE_GRAY = 4287,
|
8, // MEDIUM_STONE_GRAY
|
||||||
SHIRT_REDDISH_BROWN = 4321,
|
9, // REDDISH_BROWN
|
||||||
SHIRT_WHITE = 4355,
|
10, // WHITE
|
||||||
SHIRT_MEDIUM_BLUE = 4389,
|
11, // MEDIUM_BLUE
|
||||||
SHIRT_DARK_RED = 4423,
|
13, // DARK_RED
|
||||||
SHIRT_EARTH_BLUE = 4457,
|
14, // EARTH_BLUE
|
||||||
SHIRT_EARTH_GREEN = 4491,
|
15, // EARTH_GREEN
|
||||||
SHIRT_BRICK_YELLOW = 4525,
|
16, // BRICK_YELLOW
|
||||||
SHIRT_SAND_BLUE = 4559,
|
84, // SAND_BLUE
|
||||||
SHIRT_SAND_GREEN = 4593
|
96 // SAND_GREEN
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // USERMANAGER_H
|
#endif // USERMANAGER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user