M2 Download Center
Download Here ( Internal )
Heya, as title says it's party dice system self written (without CHAT_TYPE_DICE_INFO, it's up to you)
[Hidden Content] (sry for laggs - "wooden pc" ^^)
You can test possibility of same score there: [Hidden Content]
char_battle.cpp
//find
if (ch->GetParty())
ch = ch->GetParty()->GetNextOwnership(ch, GetX(), GetY());
//replace with
if (ch->GetParty())
{
ch = ch->GetParty()->GetNextOwnership(ch, GetX(), GetY());
#ifdef __ENABLE_DICE_SYSTEM__
ch = ch->GetParty()->Dice(ch, GetX(), GetY(), item->GetName());
#endif
}
party.cpp
//at the end of file add
#ifdef __ENABLE_DICE_SYSTEM__
LPCHARACTER CParty::Dice(LPCHARACTER ch, long x, long y, const char * szName) //item name
{
for (TMemberMap::iterator it = m_memberMap.begin(); it != m_memberMap.end(); ++it)
{
if (it->second.pCharacter->GetDesc() && DISTANCE_APPROX(it->second.pCharacter->GetX() - x, it->second.pCharacter->GetY() - y) < PARTY_DEFAULT_RANGE)
{
ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffffe6ba*** Rolling for the following item: %s ***", szName);
while (1)
{
LPCHARACTER pkWinner;
int iDice = 0;
int iDraw = 0;
for (TMemberMap::iterator it = m_memberMap.begin(); it != m_memberMap.end(); ++it)
if (it->second.pCharacter->GetDesc() && DISTANCE_APPROX(it->second.pCharacter->GetX() - x, it->second.pCharacter->GetY() - y) < PARTY_DEFAULT_RANGE)
{
int iScore = number(1, 10000);
if (iScore == iDice)
iDraw == iScore;
else if (iDice == 0 || iScore > iDice)
{
pkWinner = it->second.pCharacter;
iDice = iScore;
}
ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffffe6ba*** ->\t\t\t\t\t%s - Dice score: %d ***", it->second.pCharacter->GetName(), iScore);
}
if (iDice != iDraw)
{
ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffbb00ff*** Winner of the item %s is: %s ***", szName, pkWinner->GetName());
return pkWinner;
}
else
{
ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "");
ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, "|cffffe6ba*** Rolling again for the following item: %s ***", szName);
}
}
}
}
return ch;
}
#endif
party.h
//find
void P2PSetMemberLevel(DWORD pid, BYTE level);
//or
bool IsPartyInDungeon(int mapIndex);
//add bellow
#ifdef __ENABLE_DICE_SYSTEM__
LPCHARACTER Dice(LPCHARACTER ch, long x, long y, const char * szName);
#endif
length.h
enum EChatType
{
CHAT_TYPE_TALKING, /* 그냥 채팅 */
CHAT_TYPE_INFO, /* 정보 (아이템을 집었다, 경험치를 얻었다. 등) */
CHAT_TYPE_NOTICE, /* 공지사항 */
CHAT_TYPE_PARTY, /* 파티말 */
CHAT_TYPE_GUILD, /* 길드말 */
CHAT_TYPE_COMMAND, /* 일반 명령 */
CHAT_TYPE_SHOUT, /* 외치기 */
CHAT_TYPE_WHISPER,
CHAT_TYPE_BIG_NOTICE,
CHAT_TYPE_MONARCH_NOTICE,
#ifdef __ENABLE_DICE_SYSTEM__
CHAT_TYPE_DICE_INFO,
#endif
CHAT_TYPE_MAX_NUM
};