Sziasztok mivel nem találtam a fórumon seholsem a costum mount-ról leírást így megosztom veletek.
Erdeti téma: https://metin2dev.org/board/index.php?/topic/10245-cfull-costume-mount-system/
Indító forrás:
GameLib/ItemData.h:
Keress rá erre:
enum ECostumeSubTypes
Modosíts így:
enum ECostumeSubTypes
{
COSTUME_BODY,
COSTUME_HAIR,
COSTUME_MOUNT,
COSTUME_NUM_TYPES,
};
UserInterface/GameType.h:
Keress rá erre:
#ifdef ENABLE_COSTUME_SYSTEM
Modosíts így:
#ifdef ENABLE_COSTUME_SYSTEM
const DWORD c_Costume_Slot_Start = c_Equipment_Start + 19;
const DWORD c_Costume_Slot_Body = c_Costume_Slot_Start + 0;
const DWORD c_Costume_Slot_Hair = c_Costume_Slot_Start + 1;
const DWORD c_Costume_Slot_Mount = c_Costume_Slot_Start + 2;
const DWORD c_Costume_Slot_Count = 3;
const DWORD c_Costume_Slot_End = c_Costume_Slot_Start + c_Costume_Slot_Count;
#endif
UserInterface/GameType.h:
Keress rá erre:
#ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
Modosítsd így:
#ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
const DWORD c_New_Equipment_Start = c_Equipment_Start + 22;
const DWORD c_New_Equipment_Count = 3;
const DWORD c_Equipment_Ring1 = c_New_Equipment_Start + 1;
const DWORD c_Equipment_Ring2 = c_New_Equipment_Start + 2;
const DWORD c_Equipment_Belt = c_New_Equipment_Start + 0;
#endif
UserInterface/PythonItemModule.cpp:
Keress rá erre:
#ifdef ENABLE_COSTUME_SYSTEM
Modosítsd így:
PyModule_AddIntConstant(poModule, "ITEM_TYPE_COSTUME", CItemData::ITEM_TYPE_COSTUME);
PyModule_AddIntConstant(poModule, "COSTUME_TYPE_BODY", CItemData::COSTUME_BODY);
PyModule_AddIntConstant(poModule, "COSTUME_TYPE_HAIR", CItemData::COSTUME_HAIR);
PyModule_AddIntConstant(poModule, "COSTUME_TYPE_MOUNT", CItemData::COSTUME_MOUNT);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_START", c_Costume_Slot_Start);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_COUNT", c_Costume_Slot_Count);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_BODY", c_Costume_Slot_Body);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_HAIR", c_Costume_Slot_Hair);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_MOUNT", c_Costume_Slot_Mount);
PyModule_AddIntConstant(poModule, "COSTUME_SLOT_END", c_Costume_Slot_End);
Ezzel végeztünk is az indító résszel.
Szerver forrás:
common/item_length.h:
Keress rá erre:
enum ECostumeSubTypes
Modosítsd így:
enum ECostumeSubTypes
{
COSTUME_BODY = ARMOR_BODY,
COSTUME_HAIR = ARMOR_HEAD,
COSTUME_MOUNT,
COSTUME_NUM_TYPES,
};
common/length.h:
Keress rá erre:
enum EWearPositions
Modosítsd így:
enum EWearPositions
{
WEAR_BODY, // 0
WEAR_HEAD, // 1
WEAR_FOOTS, // 2
WEAR_WRIST, // 3
WEAR_WEAPON, // 4
WEAR_NECK, // 5
WEAR_EAR, // 6
WEAR_UNIQUE1, // 7
WEAR_UNIQUE2, // 8
WEAR_ARROW, // 9
WEAR_SHIELD, // 10
WEAR_ABILITY1, // 11
WEAR_ABILITY2, // 12
WEAR_ABILITY3, // 13
WEAR_ABILITY4, // 14
WEAR_ABILITY5, // 15
WEAR_ABILITY6, // 16
WEAR_ABILITY7, // 17
WEAR_ABILITY8, // 18
WEAR_COSTUME_BODY, // 19
WEAR_COSTUME_HAIR, // 20
WEAR_COSTUME_MOUNT, // 21
WEAR_BELT, // 22
WEAR_RING1, // 23
WEAR_RING2, // 24
WEAR_MAX = 32
};
db/ProtoReader.cpp:
Keress rá erre:
static string arSub28[]
Modosítsd így:
static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT" };
Keress rá erre:
string arWearrFlag[]
Modosítsd így:
string arWearrFlag[] = {"WEAR_BODY", "WEAR_HEAD", "WEAR_FOOTS", "WEAR_WRIST", "WEAR_WEAPON", "WEAR_NECK", "WEAR_EAR", "WEAR_SHIELD", "WEAR_UNIQUE", "WEAR_ARROW", "WEAR_HAIR", "WEAR_ABILITY", "WEAR_COSTUME_BODY", "WEAR_COSTUME_HAIR", "WEAR_COSTUME_MOUNT"};
game/char_battle.cpp:
Keress rá erre:
if (IsHorseRiding())
Modosítsd így:
{
if (IsHorseRiding())
{
StopRiding();
}
else if (GetMountVnum())
{
RemoveAffect(AFFECT_MOUNT_BONUS);
LPITEM item = GetWear(WEAR_UNIQUE1);
LPITEM item2 = GetWear(WEAR_UNIQUE2);
LPITEM item3 = GetWear(WEAR_COSTUME_MOUNT);
if (item && item->IsRideItem())
UnequipItem(item);
if (item2 && item2->IsRideItem())
UnequipItem(item2);
if (item3 && item3->IsRideItem())
UnequipItem(item3);
m_dwMountVnum = 0;
UnEquipSpecialRideUniqueItem();
UpdatePacket();
}
}
Keress rá erre:
if (bDropAntiDropUniqueItem)
Modosítsd így:
if (bDropAntiDropUniqueItem)
{
LPITEM pkItem;
pkItem = GetWear(WEAR_UNIQUE1);
if (pkItem && pkItem->GetVnum() == UNIQUE_ITEM_SKIP_ITEM_DROP_PENALTY)
{
SyncQuickslot(QUICKSLOT_TYPE_ITEM, WEAR_UNIQUE1, 255);
vec_item.push_back(std::make_pair(pkItem->RemoveFromCharacter(), EQUIPMENT));
}
pkItem = GetWear(WEAR_UNIQUE2);
if (pkItem && pkItem->GetVnum() == UNIQUE_ITEM_SKIP_ITEM_DROP_PENALTY)
{
SyncQuickslot(QUICKSLOT_TYPE_ITEM, WEAR_UNIQUE2, 255);
vec_item.push_back(std::make_pair(pkItem->RemoveFromCharacter(), EQUIPMENT));
}
pkItem = GetWear(WEAR_COSTUME_MOUNT);
if (pkItem && pkItem->GetVnum() == UNIQUE_ITEM_SKIP_ITEM_DROP_PENALTY)
{
SyncQuickslot(QUICKSLOT_TYPE_ITEM, WEAR_COSTUME_MOUNT, 255);
vec_item.push_back(std::make_pair(pkItem->RemoveFromCharacter(), EQUIPMENT));
}
}
game/char_item.cpp
Keress rá erre:
if (UNIQUE_SPECIAL_RIDE == item->GetSubType() && IS_SET(item->GetFlag(), ITEM_FLAG_QUEST_USE))
Add alá ezt:
if (COSTUME_MOUNT == item->GetSubType())
{
quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false);
}
Keress rá erre:
case POINT_COSTUME_ATTR_BONUS:
Modosítsd így:
case POINT_COSTUME_ATTR_BONUS:
{
static BYTE abSlot[] = { WEAR_COSTUME_BODY, WEAR_COSTUME_HAIR, WEAR_COSTUME_MOUNT };
static std::vector <BYTE> vec_slots(abSlot, abSlot + _countof(abSlot));
pBuff = M2_NEW CBuffOnAttributes(this, bType, &vec_slots);
}
Keress rá erre:
bool CHARACTER::IsEquipUniqueItem(DWORD dwItemVnum) const
Modosítsd így:
bool CHARACTER::IsEquipUniqueItem(DWORD dwItemVnum) const
{
{
LPITEM u = GetWear(WEAR_UNIQUE1);
if (u && u->GetVnum() == dwItemVnum)
return true;
}
{
LPITEM u = GetWear(WEAR_UNIQUE2);
if (u && u->GetVnum() == dwItemVnum)
return true;
}
{
LPITEM u = GetWear(WEAR_COSTUME_MOUNT);
if (u && u->GetVnum() == dwItemVnum)
return true;
}
if (dwItemVnum == UNIQUE_ITEM_RING_OF_LANGUAGE)
return IsEquipUniqueItem(UNIQUE_ITEM_RING_OF_LANGUAGE_SAMPLE);
return false;
}
Keress rá erre:
bool CHARACTER::IsEquipUniqueGroup(DWORD dwGroupVnum) const
Modosítsd így:
bool CHARACTER::IsEquipUniqueGroup(DWORD dwGroupVnum) const
{
{
LPITEM u = GetWear(WEAR_UNIQUE1);
if (u && u->GetSpecialGroup() == (int)dwGroupVnum)
return true;
}
{
LPITEM u = GetWear(WEAR_UNIQUE2);
if (u && u->GetSpecialGroup() == (int)dwGroupVnum)
return true;
}
{
LPITEM u = GetWear(WEAR_COSTUME_MOUNT);
if (u && u->GetSpecialGroup() == (int)dwGroupVnum)
return true;
}
return false;
}
Keress rá erre:
bool CHARACTER::UnEquipSpecialRideUniqueItem()
Modosítsd így:
bool CHARACTER::UnEquipSpecialRideUniqueItem()
{
LPITEM Unique1 = GetWear(WEAR_UNIQUE1);
LPITEM Unique2 = GetWear(WEAR_UNIQUE2);
LPITEM Unique3 = GetWear(WEAR_COSTUME_MOUNT);
if (NULL != Unique1)
{
if (UNIQUE_GROUP_SPECIAL_RIDE == Unique1->GetSpecialGroup())
{
return UnequipItem(Unique1);
}
}
if (NULL != Unique2)
{
if (UNIQUE_GROUP_SPECIAL_RIDE == Unique2->GetSpecialGroup())
{
return UnequipItem(Unique2);
}
}
if (NULL != Unique3)
{
if (UNIQUE_GROUP_SPECIAL_RIDE == Unique3->GetSpecialGroup())
{
return UnequipItem(Unique3);
}
}
return true;
}
Keress rá erre:
if (item->GetWearFlag() & WEARABLE_UNIQUE)
Modosítsd így:
if (item->GetWearFlag() & WEARABLE_UNIQUE)
{
if ((GetWear(WEAR_UNIQUE1) && GetWear(WEAR_UNIQUE1)->IsSameSpecialGroup(item)) ||
(GetWear(WEAR_UNIQUE2) && GetWear(WEAR_UNIQUE2)->IsSameSpecialGroup(item)) ||
(GetWear(WEAR_COSTUME_MOUNT) && GetWear(WEAR_COSTUME_MOUNT)->IsSameSpecialGroup(item)))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°°Ŕş Áľ·ůŔÇ ŔŻ´ĎĹ© ľĆŔĚĹŰ µÎ °ł¸¦ µż˝Ăżˇ ŔĺÂřÇŇ Ľö ľř˝Ŕ´Ď´Ů."));
return false;
}
if (marriage::CManager::instance().IsMarriageUniqueItem(item->GetVnum()) &&
!marriage::CManager::instance().IsMarried(GetPlayerID()))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°áČĄÇĎÁö ľĘŔş »óĹÂżˇĽ żąą°Ŕ» ÂřżëÇŇ Ľö ľř˝Ŕ´Ď´Ů."));
return false;
}
}
Lentebb folytatom
Üzenet összefésülés: 2016-04-08, 22:43:10
game/cmd_general.cpp
Keress rá erre:
ACMD(do_unmount)
Modosítsd így:
ACMD(do_unmount)
{
LPITEM item = ch->GetWear(WEAR_UNIQUE1);
LPITEM item2 = ch->GetWear(WEAR_UNIQUE2);
LPITEM item3 = ch->GetWear(WEAR_COSTUME_MOUNT);
if (item && item->IsRideItem())
ch->UnequipItem(item);
if (item2 && item2->IsRideItem())
ch->UnequipItem(item2);
if (item3 && item3->IsRideItem())
ch->UnequipItem(item3);
if (true == ch->UnEquipSpecialRideUniqueItem())
{
ch->RemoveAffect(AFFECT_MOUNT);
ch->RemoveAffect(AFFECT_MOUNT_BONUS);
if (ch->IsHorseRiding())
{
ch->StopRiding();
}
}
else
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ŔÎşĄĹ丮°ˇ ˛Ë Â÷Ľ ł»¸± Ľö ľř˝Ŕ´Ď´Ů."));
}
}
Keress rá erre:
ACMD(do_ride)
Modosítsd így:
ACMD(do_ride)
{
dev_log(LOG_DEB0, "[DO_RIDE] start");
if (ch->IsDead() || ch->IsStun())
return;
{
if (ch->IsHorseRiding())
{
dev_log(LOG_DEB0, "[DO_RIDE] stop riding");
ch->StopRiding();
return;
}
if (ch->GetMountVnum())
{
dev_log(LOG_DEB0, "[DO_RIDE] unmount");
do_unmount(ch, NULL, 0, 0);
return;
}
}
{
if (ch->GetHorse() != NULL)
{
dev_log(LOG_DEB0, "[DO_RIDE] start riding");
ch->StartRiding();
return;
}
for (BYTE i=0; i<INVENTORY_MAX_NUM; ++i)
{
LPITEM item = ch->GetInventoryItem(i);
if (NULL == item)
continue;
if (item->IsRideItem())
{
if (NULL==ch->GetWear(WEAR_UNIQUE1) || NULL==ch->GetWear(WEAR_UNIQUE2) || NULL==ch->GetWear(WEAR_COSTUME_MOUNT))
{
dev_log(LOG_DEB0, "[DO_RIDE] USE UNIQUE ITEM");
ch->UseItem(TItemPos (INVENTORY, i));
return;
}
}
switch (item->GetVnum())
{
case 71114:
case 71116:
case 71118:
case 71120:
dev_log(LOG_DEB0, "[DO_RIDE] USE QUEST ITEM");
ch->UseItem(TItemPos (INVENTORY, i));
return;
}
if( (item->GetVnum() > 52000) && (item->GetVnum() < 52091) ) {
dev_log(LOG_DEB0, "[DO_RIDE] USE QUEST ITEM");
ch->UseItem(TItemPos (INVENTORY, i));
return;
}
}
}
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»Ŕ» ¸ŐŔú ĽŇČŻÇŘÁÖĽĽżä."));
}
game/item.cpp
Keress rá erre:
bool CItem::IsRideItem()
Modosítsd így:
bool CItem::IsRideItem()
{
if (ITEM_UNIQUE == GetType() && UNIQUE_SPECIAL_RIDE == GetSubType())
return true;
if (ITEM_UNIQUE == GetType() && UNIQUE_SPECIAL_MOUNT_RIDE == GetSubType())
return true;
if (ITEM_COSTUME == GetType() && COSTUME_MOUNT == GetSubType())
return true;
return false;
}
Keress rá erre:
else if (GetType() == ITEM_COSTUME)
Modosítsd így:
else if (GetType() == ITEM_COSTUME)
{
if (GetSubType() == COSTUME_BODY)
return WEAR_COSTUME_BODY;
else if (GetSubType() == COSTUME_HAIR)
return WEAR_COSTUME_HAIR;
else if (GetSubType() == COSTUME_MOUNT)
return WEAR_COSTUME_MOUNT;
}
game/item_manager.cpp:
Keress rá erre:
else if (item->GetType() == ITEM_UNIQUE)
Modosítsd így:
else if (item->GetType() == ITEM_UNIQUE || item->GetSubType() == COSTUME_MOUNT)
{
for (itertype(m_map_pkSpecialItemGroup) it = m_map_pkSpecialItemGroup.begin(); it != m_map_pkSpecialItemGroup.end(); it++)
{
if (it->second->m_bType == CSpecialItemGroup::SPECIAL && it->second->Contains(vnum))
{
item->SetSIGVnum(it->first);
}
}
}
game/questlua_pc.cpp:
Keress rá erre:
int pc_get_special_ride_vnum(lua_State* L)
Töröld vagy kommentezd ki (Kijelölöd és ctrl+q vagy kijelölöd jobb klikk és megjegyzés blokk készítése (Notepad++ ban természetesen)) másold be ezt a helyére:
int pc_get_special_ride_vnum(lua_State* L)
{
LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
if (NULL != pChar)
{
LPITEM Unique1 = pChar->GetWear(WEAR_UNIQUE1);
LPITEM Unique2 = pChar->GetWear(WEAR_UNIQUE2);
LPITEM Unique3 = pChar->GetWear(WEAR_COSTUME_MOUNT);
if (NULL != Unique1)
{
if (UNIQUE_GROUP_SPECIAL_RIDE == Unique1->GetSpecialGroup())
{
lua_pushnumber(L, Unique1->GetVnum());
lua_pushnumber(L, Unique1->GetSocket(2));
return 2;
}
}
if (NULL != Unique2)
{
if (UNIQUE_GROUP_SPECIAL_RIDE == Unique2->GetSpecialGroup())
{
lua_pushnumber(L, Unique2->GetVnum());
lua_pushnumber(L, Unique2->GetSocket(2));
return 2;
}
}
if (NULL != Unique3)
{
if (UNIQUE_GROUP_SPECIAL_RIDE == Unique3->GetSpecialGroup())
{
lua_pushnumber(L, Unique3->GetVnum());
lua_pushnumber(L, Unique3->GetSocket(2));
return 2;
}
}
}
lua_pushnumber(L, 0);
lua_pushnumber(L, 0);
return 2;
}
Ezzel a szerver forrás is készen van!!
Most készítenünk kell egy új dump_protót is... ezt a mainline/tool/DumpProto mappában találod Visual Studio 2013 al is le tudod fordítani (Én azzal fordítottam de azért mellékelek egy müködő dump_proto-t)
DumpProto/ItemCSVReader.cpp:
Keress rá erre:
static string arSub28[]
Modosítsd így:
static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT" };
Ez is megvolna! Ezzel a forrás modosítások meg is vannak.
Lentebb folytatom ismét...
Üzenet összefésülés: 2016-04-08, 23:00:07
Üzenet összefésülés: 2016-04-08, 23:00:26
Jöjjön a kliens rész!
root/uitooltip:
Keress rá erre:
isCostumeBody = 0
Add alá:
isCostumeMount = 0
Keress rá erre:
isCostumeBody = item.COSTUME_TYPE_BODY == itemSubType
Add alá:
isCostumeMount = item.COSTUME_TYPE_MOUNT == itemSubType
uiscript/costumewindow.py:
Cserél le az egészet erre:
import uiScriptLocale
import item
import player
COSTUME_START_INDEX = item.COSTUME_SLOT_START
window = {
"name" : "CostumeWindow",
"x" : SCREEN_WIDTH - 175 - 140,
"y" : SCREEN_HEIGHT - 37 - 565,
"style" : ("movable", "float",),
"width" : 140,
"height" : 180 + 47,
"children" :
(
{
"name" : "board",
"type" : "board",
"style" : ("attach",),
"x" : 0,
"y" : 0,
"width" : 140,
"height" : 180 + 47,
"children" :
(
{
"name" : "TitleBar",
"type" : "titlebar",
"style" : ("attach",),
"x" : 6,
"y" : 6,
"width" : 130,
"color" : "yellow",
"children" :
(
{ "name":"TitleName", "type":"text", "x":60, "y":3, "text":uiScriptLocale.COSTUME_WINDOW_TITLE, "text_horizontal_align":"center", "r":0.0, "g":0.0, "b":0.0, "a":1.0},
),
},
{
"name" : "Costume_Base",
"type" : "image",
"x" : 13,
"y" : 38,
"image" : "d:/ymir work/ui/costume_bg.dds",
"children" :
(
{
"name" : "CostumeSlot",
"type" : "slot",
"x" : 3,
"y" : 3,
"width" : 127,
"height" : 145,
"slot" : (
{"index":COSTUME_START_INDEX+0, "x":61, "y":45, "width":32, "height":64},
{"index":COSTUME_START_INDEX+1, "x":61, "y": 8, "width":32, "height":32},
{"index":COSTUME_START_INDEX+2, "x":13, "y":125, "width":32, "height":32},
{"index":COSTUME_START_INDEX+3, "x":13, "y":15, "width":32, "height":96},
{"index":player.EQUIPMENT_SLOT_START+26, "x":61, "y":125, "width":32, "height":32},
),
},
),
},
),
},
),
}
Ha nem lenne benne a kliensetekben a costume windowsnak a kiegészített háttere amibe benne van a mount helye és a vállpánté csatolom a .dds file-t külön és eix/epk-ban is. eix/epknál nefelejtsd el beleírni az Index-be!!
Ez is meg van...
Jön a szerver oldal:
item_proto:
Ha txt-s item_proto használsz akkor egy mount pecsétjének így kell kinéznie:
71139 ȲŔÇŔü°©żřĽŇČŻ±Ç ITEM_COSTUME COSTUME_MOUNT 1 ANTI_SELL | ANTI_STACK QUEST_USE_MULTIPLE | LOG WEAR_SHIELD NONE 0 0 0 0 0 LIMIT_NONE 0 LIMIT_NONE 0 APPLY_NONE 0 APPLY_NONE 0 APPLY_NONE 0 28800 0 0 0 0 0 0 0 0
Ha mysql item_protot használ akkor ilyesmi lesz a dolog:
INSERT INTO `item_proto` VALUES (71139, 0, 'ȲŔÇŔü°©żřĽŇČŻ±Ç', 'Mount', 28, 2, 0, 1, 33024, 9216, 128, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28800, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0, 0, 0);
Igény szerint modosítod azokat a pecséteket amelyeket szeretnél így használni.
Lenntebb folytatom...
Üzenet összefésülés: 2016-04-08, 23:04:17
Jön a Quest:
/usr/game/share/locale/xy/quest:
ride.quest:
Csatolom mert túl lépné a 20000 karaktert.
/usr/game/share/locale/xy/quest/
questfunction.lua
Add hozzá a végéhez ezt:
ride.Ride
Ezzel meg is volnánk. Ha mindent jól csináltál akkor müködni fog tökéletesen a costume mount "rendszer".
Bármi probléma lenne keressetek fel PÜ-ben! Megpróbálok segíteni.
Üzenet összefésülés: 2016-04-08, 23:10:41
Majd el feljtettem!!
/usr/game/share/locale/xy:
locale_string.txt:
Végére adjátok hozzá ezeket:
"ŔÎşĄĹ丮°ˇ ˛Ë Â÷Ľ ł»¸± Ľö ľř˝Ŕ´Ď´Ů.";
"A leltárad tele van!";
"¸»Ŕ» ¸ŐŔú ĽŇČŻÇŘÁÖĽĽżä.";
"Előbb hívnod kell a lovadat!";
Üzenet összefésülés: 2016-04-08, 23:11:14