Guida [GUIDA][C ++ / Lua / Py] evento Nuovo Gameforge - Carte

Stato
Discussione chiusa ad ulteriori risposte.

Duccio&Uccia

Utente Electrum
17 Febbraio 2015
311
41
59
177
L'obiettivo è quello di rendere le combinazioni di serie e numeri. Un set è composto da 3 carte con lo stesso numero (ad esempio 7,7,7). Come il più piccolo numero di libri, il punteggio sarà più basso.
I numeri composti da tre carte consecutive (ad esempio 6.7
cool.png
. Come i numeri sulle carte sono più piccoli, i punti meno si riceve. In se le carte avranno lo stesso colore, si ottiene più punti se hanno colori diversi. le istruzioni per:
1. fare clic a sinistra sul ponte, vi darà 5 carte.
2. Guadagna punti selezionando 3 carte (NOTA: fare clic sinistra = sceglie il libro, click destro = permanentemente cancellare il libro)
3. come si guadagnano più punti entro la fine del gioco, la ricompensa sarà maggiore.
4. è possibile mettere in pausa il gioco premendo ESC. la modifica della mappa o si teleportandu finire!
5. Dopo aver rimosso un libro, non può essere recuperato, quindi, pensare bene prima della rimozione stessa!
6. off giochi non saranno premiati / riattivato! Scegli dove si inizierà il gioco con cura . per iniziare il gioco, fare clic sull'icona con il minigioco, che apparirà accanto al Mica mappa.



announcement_metin2_de_f1c4e73880f98387e777a9f080bc165b.png

announcement_ikariam_de_67f389ddfae272f1e47aa45d4e496310.png

Si aprirà il gioco. 'Play Safe "è abilitata. Quando" Play Safe "è attiva, è necessario confermare ogni volta che si desidera rimuovere una carta dal mazzo. Ho aggiunto questo per garantire che non rimuoveremo libri per errore. Tuttavia, si libera scelta, se si utilizza questa opzione oppure no. se non si desidera, è possibile deselezionare prima di iniziare il gioco.
announcement_metin2_de_643845382d28886abb57e7a96581dfe5.png

iniziare il gioco, assicurarsi di aver 30.000 Yang preparata e una serie di libri in inventario.
announcement_metin2_de_5628e2baea83c1d980e52a806ec3ac57.png

Dopo Avanti, fare clic su "Yes" scatola mini-gioco si aprirà. cliccare sul set di libri (click sinistro) per ricevere le prime 5 carte apparirà. le prime 5 carte e si può iniziare a fare un set di 3 carte o . per rimuovere dai libri che è stato indicato, per fare spazio a quelli nuovi da carte rimanenti nel mazzo quando si eliminerà, e di aver controllato il "gioco sicuro", viene visualizzata una finestra di conferma: "sei sicuro per rimuovere questo libro? '.
announcement_metin2_de_91cea5366007c4e6fdce3078199a53fe.png

announcement_metin2_de_91cea5366007c4e6fdce3078199a53fe.png

announcement_metin2_de_643845382d28886abb57e7a96581dfe5.png

Mettere 3 carte nel gioco (qui, 3 carte con il numero "8" = successo!) per ottenere punti.
announcement_metin2_de_6b6df9e9edff35f8c13fb647c98825d6.png

Tutti i punti saranno calcolati in totale e si riceverà un premio. "Greatest"? Sì, è una classifica totale durante l'evento, in cui ogni giocatore ha la possibilità di vincere casse.
Classifica generale possono essere visti presso NPC "Okey Table" .Recompensele per il punteggio più alto saranno raccolti quando finisce l'Evento.
I giocatori possono richiedere premi dopo la fine della manifestazione, "Okey Table" rimane attivo per altri 7 giorni dopo la fine.
Tenete a mente che i premi saranno lì solo in questo periodo. Una volta che l'evento si conclude premi non reclamati o scatole chiuse spariranno!

Client Binary: andate in: 1. EterPythonLib/PythonSlotWindow.cpp
void CSlotWindow::SetSlot(DWORD dwIndex, DWORD dwVirtualNumber, BYTE byWidth, BYTE byHeight, CGraphicImage * pImage, D3DXCOLOR& diffuseColor)
{
TSlot * pSlot;
if (!GetSlotPointer(dwIndex, &pSlot))
return;

if (pSlot->isItem)
if (pSlot->dwItemIndex == dwVirtualNumber)
{
pSlot->dwState = 0;
pSlot->isItem = TRUE;
if (pImage && pSlot->pInstance)
{
pSlot->pInstance->SetImagePointer(pImage);
}
return;
}

ClearSlot(pSlot);
pSlot->dwState = 0;
pSlot->isItem = TRUE;
pSlot->dwItemIndex = dwVirtualNumber;

if (pImage)
{
assert(NULL == pSlot->pInstance);
pSlot->pInstance = CGraphicImageInstance::New();
pSlot->pInstance->SetDiffuseColor(diffuseColor.r, diffuseColor.g, diffuseColor.b, diffuseColor.a);
pSlot->pInstance->SetImagePointer(pImage);
}

pSlot->byxPlacedItemSize = byWidth;
pSlot->byyPlacedItemSize = byHeight;

if (pSlot->pCoverButton)
{
pSlot->pCoverButton->Show();
}
}
void CSlotWindow::SetCardSlot(DWORD dwIndex, DWORD dwVirtualNumber, BYTE byWidth, BYTE byHeight, const char * c_szFileName, D3DXCOLOR& diffuseColor)
{
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(c_szFileName);
TSlot * pSlot;
if (!GetSlotPointer(dwIndex, &pSlot))
return;

if (pSlot->isItem)
if (pSlot->dwItemIndex == dwVirtualNumber)
{
pSlot->dwState = 0;
pSlot->isItem = TRUE;
if (pImage && pSlot->pInstance)
{
pSlot->pInstance->SetImagePointer(pImage);
}
return;
}

ClearSlot(pSlot);
pSlot->dwState = 0;
pSlot->isItem = TRUE;
pSlot->dwItemIndex = dwVirtualNumber;

if (pImage)
{
assert(NULL == pSlot->pInstance);
pSlot->pInstance = CGraphicImageInstance::New();
pSlot->pInstance->SetImagePointer(pImage);
pSlot->pInstance->SetDiffuseColor(diffuseColor.r, diffuseColor.g, diffuseColor.b, diffuseColor.a);
}

pSlot->byxPlacedItemSize = byWidth;
pSlot->byyPlacedItemSize = byHeight;

if (pSlot->pCoverButton)
{
pSlot->pCoverButton->Show();
}
}


2. EterPythonLib/PythonSlotWindow.h

void SetSlot(DWORD dwIndex, DWORD dwVirtualNumber, BYTE byWidth, BYTE byHeight, CGraphicImage * pImage, D3DXCOLOR& diffuseColor);

void SetCardSlot(DWORD dwIndex, DWORD dwVirtualNumber, BYTE byWidth, BYTE byHeight, const char * c_szFileName, D3DXCOLOR& diffus

3. EterPythonLib/PythonWindowMangerModule.cpp
PyObject * wndMgrSetSlot(PyObject * poSelf, PyObject * poArgs)
{
UI::CWindow * pWin;
if (!PyTuple_GetWindow(poArgs, 0, &pWin))
return Py_BuildException();

int iSlotIndex;
if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))
return Py_BuildException();

int iItemIndex;
if (!PyTuple_GetInteger(poArgs, 2, &iItemIndex))
return Py_BuildException();

int iWidth;
if (!PyTuple_GetInteger(poArgs, 3, &iWidth))
return Py_BuildException();

int iHeight;
if (!PyTuple_GetInteger(poArgs, 4, &iHeight))
return Py_BuildException();

int iImageHandle;
if (!PyTuple_GetInteger(poArgs, 5, &iImageHandle))
return Py_BuildException();

D3DXCOLOR diffuseColor;
PyObject* pTuple;
if (!PyTuple_GetObject(poArgs, 6, &pTuple))
{
diffuseColor = D3DXCOLOR(1.0, 1.0, 1.0, 1.0);
//return Py_BuildException();
}
else
// get diffuse color from pTuple
{
if (PyTuple_Size(pTuple) != 4)
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 0, &diffuseColor.r))
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 1, &diffuseColor.g))
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 2, &diffuseColor.b))
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 3, &diffuseColor.a))
return Py_BuildException();
}

if (!pWin->IsType(UI::CSlotWindow::Type()))
return Py_BuildException();

UI::CSlotWindow * pSlotWin = (UI::CSlotWindow *)pWin;
pSlotWin->SetSlot(iSlotIndex, iItemIndex, iWidth, iHeight, (CGraphicImage *)iImageHandle, diffuseColor);

return Py_BuildNone();
}

PyObject * wndMgrSetCardSlot(PyObject * poSelf, PyObject * poArgs)
{
UI::CWindow * pWin;
if (!PyTuple_GetWindow(poArgs, 0, &pWin))
return Py_BuildException();

int iSlotIndex;
if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))
return Py_BuildException();

int iItemIndex;
if (!PyTuple_GetInteger(poArgs, 2, &iItemIndex))
return Py_BuildException();

int iWidth;
if (!PyTuple_GetInteger(poArgs, 3, &iWidth))
return Py_BuildException();

int iHeight;
if (!PyTuple_GetInteger(poArgs, 4, &iHeight))
return Py_BuildException();

char * c_szFileName;
if (!PyTuple_GetString(poArgs, 5, &c_szFileName))
return Py_BuildException();

D3DXCOLOR diffuseColor;
PyObject* pTuple;
if (!PyTuple_GetObject(poArgs, 6, &pTuple))
{
diffuseColor = D3DXCOLOR(1.0, 1.0, 1.0, 1.0);
//return Py_BuildException();
}
else
// get diffuse color from pTuple
{
if (PyTuple_Size(pTuple) != 4)
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 0, &diffuseColor.r))
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 1, &diffuseColor.g))
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 2, &diffuseColor.b))
return Py_BuildException();
if (!PyTuple_GetFloat(pTuple, 3, &diffuseColor.a))
return Py_BuildException();
}

if (!pWin->IsType(UI::CSlotWindow::Type()))
return Py_BuildException();

UI::CSlotWindow * pSlotWin = (UI::CSlotWindow *)pWin;
pSlotWin->SetCardSlot(iSlotIndex, iItemIndex, iWidth, iHeight, c_szFileName, diffuseColor);

return Py_BuildNone();
}

Sempre in EterPythonLib/PythonWindowMangerModule.cpp

PyObject * wndImageAppendImage(PyObject * poSelf, PyObject * poArgs)
{
UI::CWindow * pWindow;
if (!PyTuple_GetWindow(poArgs, 0, &pWindow))
return Py_BuildException();
char * szFileName;
if (!PyTuple_GetString(poArgs, 1, &szFileName))
return Py_BuildException();

((UI::CAniImageBox*)pWindow)->AppendImage(szFileName);

return Py_BuildNone();
}


PyObject * wndImageResetFrame(PyObject * poSelf, PyObject * poArgs)
{
UI::CWindow * pWindow;
if (!PyTuple_GetWindow(poArgs, 0, &pWindow))
return Py_BuildException();

((UI::CAniImageBox*)pWindow)->ResetFrame();

return Py_BuildNone();
}

{ "SetSlot", wndMgrSetSlot, METH_VARARGS },

{ "SetCardSlot", wndMgrSetCardSlot, METH_VARARGS },

{ "AppendImage", wndImageAppendImage, METH_VARARGS },

{ "ResetFrame", wndImageResetFrame, METH_VARARGS },

Dopo andate in 1. UserInterface/PythonEventManagerMoudle.cpp


PyObject * eventGetVisibleStartLine(PyObject * poSelf, PyObject * poArgs)
{
int iIndex;
if (!PyTuple_GetInteger(poArgs, 0, &iIndex))
return Py_BuildException();

return Py_BuildValue("i", CPythonEventManager::Instance().GetVisibleStartLine(iIndex));
}

PyObject * eventSetVisibleLineCount(PyObject * poSelf, PyObject * poArgs)
{
int iIndex;
if (!PyTuple_GetInteger(poArgs, 0, &iIndex))
return Py_BuildException();

int iVisibletLine;
if (!PyTuple_GetInteger(poArgs, 1, &iVisibletLine))
return Py_BuildException();

CPythonEventManager::Instance().SetVisibleLineCount(iIndex, iVisibletLine);
return Py_BuildNone();
}

{ "GetVisibleStartLine", eventGetVisibleStartLine, METH_VARARGS },

{ "SetVisibleLineCount", eventSetVisibleLineCount, METH_VARARGS },

2. UserInterface/PythonNetworkStreamCommand.cpp

else if (!strcmpi(szCmd, "ObserverTeamInfo"))
{
}

else if (!strcmpi(szCmd, "cards"))
{
if (TokenVector.size() < 2)
{
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
return;
}
if ("open" == TokenVector[1])
{
DWORD safemode = atoi(TokenVector[2].c_str());
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cards_Open", Py_BuildValue("(i)", safemode));
}
else if ("info" == TokenVector[1])
{
if (14 != TokenVector.size())
{
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
return;
}
DWORD card_in_hand_1 = atoi(TokenVector[2].c_str());
DWORD card_in_hand_1_v = atoi(TokenVector[3].c_str());
DWORD card_in_hand_2 = atoi(TokenVector[4].c_str());
DWORD card_in_hand_2_v = atoi(TokenVector[5].c_str());
DWORD card_in_hand_3 = atoi(TokenVector[6].c_str());
DWORD card_in_hand_3_v = atoi(TokenVector[7].c_str());
DWORD card_in_hand_4 = atoi(TokenVector[8].c_str());
DWORD card_in_hand_4_v = atoi(TokenVector[9].c_str());
DWORD card_in_hand_5 = atoi(TokenVector[10].c_str());
DWORD card_in_hand_5_v = atoi(TokenVector[11].c_str());
DWORD cards_left = atoi(TokenVector[12].c_str());
DWORD points = atoi(TokenVector[13].c_str());
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cards_UpdateInfo", Py_BuildValue("(iiiiiiiiiiii)", card_in_hand_1, card_in_hand_1_v, card_in_hand_2, card_in_hand_2_v,
card_in_hand_3, card_in_hand_3_v, card_in_hand_4, card_in_hand_4_v, card_in_hand_5, card_in_hand_5_v,
cards_left, points));
}
else if ("finfo" == TokenVector[1])
{
if (9 != TokenVector.size())
{
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
return;
}
DWORD hand_1 = atoi(TokenVector[2].c_str());
DWORD hand_1_v = atoi(TokenVector[3].c_str());
DWORD hand_2 = atoi(TokenVector[4].c_str());
DWORD hand_2_v = atoi(TokenVector[5].c_str());
DWORD hand_3 = atoi(TokenVector[6].c_str());
DWORD hand_3_v = atoi(TokenVector[7].c_str());
DWORD points = atoi(TokenVector[8].c_str());
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cards_FieldUpdateInfo", Py_BuildValue("(iiiiiii)", hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points));
}
else if ("reward" == TokenVector[1])
{
if (9 != TokenVector.size())
{
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
return;
}
DWORD hand_1 = atoi(TokenVector[2].c_str());
DWORD hand_1_v = atoi(TokenVector[3].c_str());
DWORD hand_2 = atoi(TokenVector[4].c_str());
DWORD hand_2_v = atoi(TokenVector[5].c_str());
DWORD hand_3 = atoi(TokenVector[6].c_str());
DWORD hand_3_v = atoi(TokenVector[7].c_str());
DWORD points = atoi(TokenVector[8].c_str());
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cards_PutReward", Py_BuildValue("(iiiiiii)", hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points));
}
else if ("icon" == TokenVector[1])
{
if (2 != TokenVector.size())
{
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
return;
}
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cards_ShowIcon", Py_BuildValue("()"));
}
}

II. Src Server

1. Src/game/char.cpp:

memset(&m_quickslot, 0, sizeof(m_quickslot));

memset(&character_cards, 0, sizeof(character_cards));
memset(&randomized_cards, 0, sizeof(randomized_cards));

2. Src/game/char.h:

#define AI_FLAG_STAYZONE (1 << 3)

#define MAX_CARDS_IN_HAND 5
#define MAX_CARDS_IN_FIELD 3

Code:
};

ESex GET_SEX(LPCHARACTER ch);

#endif

public:
struct S_CARD
{
DWORD type;
DWORD value;
};

struct CARDS_INFO
{
S_CARD cards_in_hand[MAX_CARDS_IN_HAND];
S_CARD cards_in_field[MAX_CARDS_IN_FIELD];
DWORD cards_left;
DWORD field_points;
DWORD points;
};

void Cards_open(DWORD safemode);
void Cards_clean_list();
DWORD GetEmptySpaceInHand();
void Cards_pullout();
void RandomizeCards();
bool CardWasRandomized(DWORD type, DWORD value);
void SendUpdatedInformations();
void SendReward();
void CardsDestroy(DWORD reject_index);
void CardsAccept(DWORD accept_index);
void CardsRestore(DWORD restore_index);
DWORD GetEmptySpaceInField();
DWORD GetAllCardsCount();
bool TypesAreSame();
bool ValuesAreSame();
bool CardsMatch();
DWORD GetLowestCard();
bool CheckReward();
void CheckCards();
void RestoreField();
void ResetField();
void CardsEnd();
void GetGlobalRank(char * buffer, size_t buflen);
void GetRundRank(char * buffer, size_t buflen);
protected:
CARDS_INFO character_cards;
S_CARD randomized_cards[24];

#include "stdafx.h"
#include "char.h"
#include "utils.h"
#include "log.h"
#include "db.h"
#include "dev_log.h"
#include "locale_service.h"
#include <stdlib.h>
#include <sstream>
#include "config.h"
#include "desc.h"
#include "desc_manager.h"
#include "char_manager.h"
#include "item.h"
#include "item_manager.h"
#include "buffer_manager.h"
#include "packet.h"
#include "questmanager.h"
#include "monarch.h"
#include "mob_manager.h"
#include "desc_client.h"
#include "group_text_parse_tree.h"
#include <boost/algorithm/string/predicate.hpp>
#include <cctype>
#include "p2p.h"
#include "entity.h"
#include "sectree_manager.h"

void CHARACTER::Cards_open(DWORD safemode)
{
if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsAcceOpen())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("다른 거래중(창고,교환,상점)에는 사용할 수 없습니다."));
return;
}
if (character_cards.cards_left <= 0)
{
if (GetGold() < 30000)
{
ChatPacket(CHAT_TYPE_INFO, "You dont have enough money.");
return;
}
if (CountSpecifyItem(79506) < 1)
{
ChatPacket(CHAT_TYPE_INFO, "You dont have any cardsets.");
return;
}
PointChange(POINT_GOLD, -30000, true);
RemoveSpecifyItem(79506, 1);
Cards_clean_list();
character_cards.cards_left = 24;
}
ChatPacket(CHAT_TYPE_COMMAND, "cards open %d", safemode);
SendUpdatedInformations();
}

void CHARACTER::Cards_clean_list()
{
memset(&character_cards, 0, sizeof(character_cards));
memset(&randomized_cards, 0, sizeof(randomized_cards));
}

DWORD CHARACTER::GetEmptySpaceInHand()
{
for (int i=0; i<MAX_CARDS_IN_HAND; ++i)
{
if (character_cards.cards_in_hand.type == 0)
return i;
}
return -1;
}

void CHARACTER::Cards_pullout()
{
DWORD empty_space = GetEmptySpaceInHand();
if (empty_space == -1)
{
ChatPacket(CHAT_TYPE_INFO, "You dont have space in hands.");
return;
}
if (character_cards.cards_left < 1)
{
ChatPacket(CHAT_TYPE_INFO, "You dont have cards.");
return;
}
if (GetAllCardsCount() >= 5)
{
ChatPacket(CHAT_TYPE_INFO, "You dont have space on table.");
return;
}
RandomizeCards();
SendUpdatedInformations();
}

void CHARACTER::RandomizeCards()
{
DWORD card_type = number(1, 3);
DWORD card_value = number(1, 8);
if (CardWasRandomized(card_type, card_value) != false)
{
RandomizeCards();
}
else
{
DWORD empty_space = GetEmptySpaceInHand();
character_cards.cards_in_hand[empty_space].type = card_type;
character_cards.cards_in_hand[empty_space].value = card_value;
character_cards.cards_left -= 1;
}
}

bool CHARACTER::CardWasRandomized(DWORD type, DWORD value)
{
for (int i=0; i<24; ++i)
{
if (randomized_cards.type == type && randomized_cards.value == value)
{
return true;
}
}
for (int i=0; i<24; ++i)
{
if (randomized_cards.type == 0)
{
randomized_cards.type = type;
randomized_cards.value = value;
return false;
}
}
return false;
}

void CHARACTER::SendUpdatedInformations()
{
ChatPacket(CHAT_TYPE_COMMAND, "cards info %d %d %d %d %d %d %d %d %d %d %d %d", character_cards.cards_in_hand[0].type, character_cards.cards_in_hand[0].value,
character_cards.cards_in_hand[1].type, character_cards.cards_in_hand[1].value, character_cards.cards_in_hand[2].type,
character_cards.cards_in_hand[2].value, character_cards.cards_in_hand[3].type, character_cards.cards_in_hand[3].value,
character_cards.cards_in_hand[4].type, character_cards.cards_in_hand[4].value,
character_cards.cards_left, character_cards.points);

ChatPacket(CHAT_TYPE_COMMAND, "cards finfo %d %d %d %d %d %d %d", character_cards.cards_in_field[0].type, character_cards.cards_in_field[0].value, character_cards.cards_in_field[1].type,
character_cards.cards_in_field[1].value, character_cards.cards_in_field[2].type, character_cards.cards_in_field[2].value,
character_cards.field_points);
}

void CHARACTER::SendReward()
{
ChatPacket(CHAT_TYPE_COMMAND, "cards reward %d %d %d %d %d %d %d", character_cards.cards_in_field[0].type, character_cards.cards_in_field[0].value, character_cards.cards_in_field[1].type,
character_cards.cards_in_field[1].value, character_cards.cards_in_field[2].type, character_cards.cards_in_field[2].value,
character_cards.field_points);
}

void CHARACTER::CardsDestroy(DWORD reject_index)
{
if (reject_index + 1 > MAX_CARDS_IN_HAND)
return;
if (character_cards.cards_in_hand[reject_index].type == 0)
return;
character_cards.cards_in_hand[reject_index].type = 0;
character_cards.cards_in_hand[reject_index].value = 0;
SendUpdatedInformations();
}

void CHARACTER::CardsAccept(DWORD accept_index)
{
if (accept_index + 1 > MAX_CARDS_IN_HAND)
return;
if (character_cards.cards_in_hand[accept_index].type == 0)
return;
DWORD empty_space = GetEmptySpaceInField();
if (empty_space != -1)
{
character_cards.cards_in_field[empty_space].type = character_cards.cards_in_hand[accept_index].type;
character_cards.cards_in_field[empty_space].value = character_cards.cards_in_hand[accept_index].value;
character_cards.cards_in_hand[accept_index].type = 0;
character_cards.cards_in_hand[accept_index].value = 0;
}
if (GetEmptySpaceInField() == -1)
{
if (CheckReward())
{
SendReward();
ResetField();
}
else
{
RestoreField();
}
}
SendUpdatedInformations();
}

void CHARACTER::CardsRestore(DWORD restore_index)
{
if (restore_index + 1 > MAX_CARDS_IN_FIELD)
return;
if (character_cards.cards_in_field[restore_index].type == 0)
return;
DWORD empty_space = GetEmptySpaceInHand();
character_cards.cards_in_hand[empty_space].type = character_cards.cards_in_field[restore_index].type;
character_cards.cards_in_hand[empty_space].value = character_cards.cards_in_field[restore_index].value;
character_cards.cards_in_field[restore_index].type = 0;
character_cards.cards_in_field[restore_index].value = 0;
SendUpdatedInformations();
}

DWORD CHARACTER::GetEmptySpaceInField()
{
for (int i=0; i<MAX_CARDS_IN_FIELD; ++i)
{
if (character_cards.cards_in_field.type == 0)
return i;
}
return -1;
}

DWORD CHARACTER::GetAllCardsCount()
{
DWORD count = 0;
for (int i=0; i<MAX_CARDS_IN_HAND; ++i)
{
if (character_cards.cards_in_hand.type != 0)
count += 1;
}
for (int i=0; i<MAX_CARDS_IN_FIELD; ++i)
{
if (character_cards.cards_in_field.type != 0)
count += 1;
}
return count;
}
bool CHARACTER::TypesAreSame()
{
if (character_cards.cards_in_field[0].type == character_cards.cards_in_field[1].type && character_cards.cards_in_field[1].type == character_cards.cards_in_field[2].type)
return true;
return false;
}

bool CHARACTER::ValuesAreSame()
{
if (character_cards.cards_in_field[0].value == character_cards.cards_in_field[1].value && character_cards.cards_in_field[1].value == character_cards.cards_in_field[2].value)
return true;
return false;
}

bool CHARACTER::CardsMatch()
{
if (character_cards.cards_in_field[0].value == character_cards.cards_in_field[1].value - 1 && character_cards.cards_in_field[1].value == character_cards.cards_in_field[2].value -1)
return true;
else if (character_cards.cards_in_field[0].value == character_cards.cards_in_field[2].value - 1 && character_cards.cards_in_field[2].value == character_cards.cards_in_field[1].value -1)
return true;
else if (character_cards.cards_in_field[1].value == character_cards.cards_in_field[0].value - 1 && character_cards.cards_in_field[0].value == character_cards.cards_in_field[2].value -1)
return true;
else if (character_cards.cards_in_field[0].value == character_cards.cards_in_field[1].value - 1 && character_cards.cards_in_field[2].value == character_cards.cards_in_field[0].value -1)
return true;
else if (character_cards.cards_in_field[1].value == character_cards.cards_in_field[0].value - 1 && character_cards.cards_in_field[2].value == character_cards.cards_in_field[1].value -1)
return true;
else if (character_cards.cards_in_field[1].value == character_cards.cards_in_field[2].value - 1 && character_cards.cards_in_field[2].value == character_cards.cards_in_field[0].value -1)
return true;
else
return false;
}

DWORD CHARACTER::GetLowestCard()
{
return MIN(character_cards.cards_in_field[0].value, MIN(character_cards.cards_in_field[1].value, character_cards.cards_in_field[2].value));
}
bool CHARACTER::CheckReward()
{
if (TypesAreSame() && ValuesAreSame())
{
character_cards.field_points = 150;
character_cards.points += 150;
return true;
}
else if (TypesAreSame() && CardsMatch())
{
character_cards.field_points = 100;
character_cards.points += 100;
return true;
}
else if (ValuesAreSame())
{
character_cards.field_points = GetLowestCard()*10+10;
character_cards.points += GetLowestCard()*10+10;
return true;
}
else if (CardsMatch())
{
character_cards.field_points = GetLowestCard()*10;
character_cards.points += GetLowestCard()*10;
return true;
}
else
{
RestoreField();
return false;
}
}

void CHARACTER::RestoreField()
{
for (int i=0; i<MAX_CARDS_IN_FIELD; ++i)
{
DWORD empty_space = GetEmptySpaceInHand();
character_cards.cards_in_hand[empty_space].type = character_cards.cards_in_field.type;
character_cards.cards_in_hand[empty_space].value = character_cards.cards_in_field.value;
character_cards.cards_in_field.type = 0;
character_cards.cards_in_field.value = 0;
SendUpdatedInformations();
}
}

void CHARACTER::ResetField()
{
for (int i=0; i<MAX_CARDS_IN_FIELD; ++i)
{
character_cards.cards_in_field.type = 0;
character_cards.cards_in_field.value = 0;
}
}

void CHARACTER::CardsEnd()
{
if (character_cards.points >= 400)
AutoGiveItem(71194); //Golden box
else if (character_cards.points < 400 && character_cards.points >= 250)
AutoGiveItem(71195); //Silver box
else if (character_cards.points > 0)
AutoGiveItem(71196); //Bronze box
LogManager::instance().OkayEventLog(GetPlayerID(), GetName(), character_cards.points);
Cards_clean_list();
SendUpdatedInformations();
}

void CHARACTER::GetGlobalRank(char * buffer, size_t buflen)
{
std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery("SELECT name, SUM(points) as spoints FROM log.okay_event GROUP BY pid ORDER BY spoints DESC LIMIT 10"));
if (pMsg->Get()->uiNumRows == 0)
{
return;
}

MYSQL_ROW row;
int pos = 1;
int len = 0, len2;
*buffer = '\0';
while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
{
int points = 0;
str_to_number(points, row[1]);
len2 = snprintf(buffer + len, buflen - len, "[ENTER]");

if (len2 < 0 || len2 >= (int) buflen - len)
len += (buflen - len) - 1;
else
len += len2;

len2 = snprintf(buffer + len, buflen - len, "%d. Place - %s - %d points.",
pos,
row[0],
points);
++pos;
if (len2 < 0 || len2 >= (int) buflen - len)
len += (buflen - len) - 1;
else
len += len2;
}
}

void CHARACTER::GetRundRank(char * buffer, size_t buflen)
{
std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery("SELECT name, points FROM log.okay_event ORDER BY points DESC LIMIT 10"));
if (pMsg->Get()->uiNumRows == 0)
{
return;
}

MYSQL_ROW row;
int pos = 1;
int len = 0, len2;
*buffer = '\0';
while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
{
int points = 0;
str_to_number(points, row[1]);
len2 = snprintf(buffer + len, buflen - len, "[ENTER]");

if (len2 < 0 || len2 >= (int) buflen - len)
len += (buflen - len) - 1;
else
len += len2;

len2 = snprintf(buffer + len, buflen - len, "%d. Place - %s - %d points.",
pos,
row[0],
points);
++pos;
if (len2 < 0 || len2 >= (int) buflen - len)
len += (buflen - len) - 1;
else
len += len2;
}
}

poi andate in Src/game/cmd.cpp:

ACMD(do_cube);

ACMD(do_cards);



{ "cube", do_cube, 0, POS_DEAD, GM_PLAYER },

{ "cards", do_cards, 0, POS_DEAD, GM_PLAYER },

dopo andate in Src/game/cmd_general.cpp:

ACMD(do_cards)
{
const char *line;

char arg1[256], arg2[256];

line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
switch (LOWER(arg1[0]))
{
case 'o': // open
if (isdigit(*arg2))
{
DWORD safemode;
str_to_number(safemode, arg2);
ch->Cards_open(safemode);
}
break;
case 'p': // open
ch->Cards_pullout();
break;
case 'e': // open
ch->CardsEnd();
break;
case 'd': // open
if (isdigit(*arg2))
{
DWORD destroy_index;
str_to_number(destroy_index, arg2);
ch->CardsDestroy(destroy_index);
}
break;
case 'a': // open
if (isdigit(*arg2))
{
DWORD accpet_index;
str_to_number(accpet_index, arg2);
ch->CardsAccept(accpet_index);
}
break;
case 'r': // open
if (isdigit(*arg2))
{
DWORD restore_index;
str_to_number(restore_index, arg2);
ch->CardsRestore(restore_index);
}
break;
default:
return;
}
}
andate in Src/game/log.cpp:
void LogManager::ItemLog(DWORD dwPID, DWORD x, DWORD y, DWORD dwItemID, const char * c_pszText, const char * c_pszHint, const char * c_pszIP, DWORD dwVnum)
{
m_sql.EscapeString(__escape_hint, sizeof(__escape_hint), c_pszHint, strlen(c_pszHint));

Query("INSERT DELAYED INTO log%s (type, time, who, x, y, what, how, hint, ip, vnum) VALUES('ITEM', NOW(), %u, %u, %u, %u, '%s', '%s', '%s', %u)",
get_table_postfix(), dwPID, x, y, dwItemID, c_pszText, __escape_hint, c_pszIP, dwVnum);
}

void LogManager::OkayEventLog(int dwPID, const char * c_pszText, int points)
{
Query("INSERT INTO okay_event%s (pid, name, points) VALUES(%d, '%s', %d)",
get_table_postfix(), dwPID, c_pszText, points);

}


void CharLog(LPCHARACTER ch, DWORD dw, const char * c_pszText, const char * c_pszHint);

void OkayEventLog(int dwPID, const char * c_pszText, int points);

dopo andate in Src/game/questlua_pc.cpp:
int pc_has_master_skill(lua_State* L)
{
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
bool bHasMasterSkill = false;
for (int i=0; i< SKILL_MAX_NUM; i++)
if (ch->GetSkillMasterType(i) >= SKILL_MASTER && ch->GetSkillLevel(i) >= 21)
{
bHasMasterSkill = true;
break;
}

lua_pushboolean(L, bHasMasterSkill);
return 1;
}


int pc_get_okay_global_rank(lua_State* L)
{
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (!ch)
return 0;


char szBuf[4096+1];
ch->GetGlobalRank(szBuf, sizeof(szBuf));
lua_pushstring(L, szBuf);
return 1;
}

int pc_get_okay_rund_rank(lua_State* L)
{
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (!ch)
return 0;


char szBuf[4096+1];
ch->GetRundRank(szBuf, sizeof(szBuf));
lua_pushstring(L, szBuf);
return 1;
}

{ "has_master_skill", pc_has_master_skill },

{ "get_okay_global_rank", pc_get_okay_global_rank },
{ "get_okay_rund_rank", pc_get_okay_rund_rank },

PARTE CLIENT
root/game.py

def BINARY_Highlight_Item(self, inven_type, inven_pos):

def BINARY_Cards_UpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points):
self.interface.UpdateCardsInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points)

def BINARY_Cards_FieldUpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
self.interface.UpdateCardsFieldInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)

def BINARY_Cards_PutReward(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
self.interface.CardsPutReward(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)

def BINARY_Cards_ShowIcon(self):
self.interface.CardsShowIcon()

def BINARY_Cards_Open(self, safemode):
self.interface.OpenCardsWindow(safemode)

root/interfacemodule.py:

import uiCube

import uiCards

def __MakeCubeResultWindow(self):
self.wndCubeResult = uiCube.CubeResultWindow()
self.wndCubeResult.LoadWindow()
self.wndCubeResult.Hide()

def __MakeCardsInfoWindow(self):
self.wndCardsInfo = uiCards.CardsInfoWindow()
self.wndCardsInfo.LoadWindow()
self.wndCardsInfo.Hide()

def __MakeCardsWindow(self):
self.wndCards = uiCards.CardsWindow()
self.wndCards.LoadWindow()
self.wndCards.Hide()

def __MakeCardsIconWindow(self):
self.wndCardsIcon = uiCards.IngameWindow()
self.wndCardsIcon.LoadWindow()
self.wndCardsIcon.Hide()

self.__MakeCubeResultWindow()

self.__MakeCardsInfoWindow()
self.__MakeCardsWindow()
self.__MakeCardsIconWindow()

def CloseWbWindow(self):
self.wndWeb.Close()

def OpenCardsInfoWindow(self):
self.wndCardsInfo_Open()

def OpenCardsWindow(self, safemode):
self.wndCards.Open(safemode)

def UpdateCardsInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points):
self.wndCards.UpdateCardsInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points)

def UpdateCardsFieldInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
self.wndCards.UpdateCardsFieldInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)

def CardsPutReward(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
self.wndCards.CardsPutReward(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)

def CardsShowIcon(self):
self.wndCardsIcon.Show()

del self.wndHelp

del self.wndCardsInfo
del self.wndCards
del self.wndCardsIcon

if self.wndHelp:
self.wndHelp.Destroy()

if self.wndCardsInfo:
self.wndCardsInfo.Destroy()

if self.wndCards:
self.wndCards.Destroy()

if self.wndCardsIcon:
self.wndCardsIcon.Destroy()

root/mini_game_okey_desc.txt(dovete crearlo)
[DELAY value;0]
Defeat monsters to earn cards. As soon as you've[ENTER]
collected and stacked together 24 Okey Cards, you'll[ENTER]
automatically receive an Okey Card Set and can play a[ENTER]
game. The aim of the game is to make combinations of sets[ENTER]
and runs.[ENTER]
[ENTER]
A set consists of three cards with the same number (e.g.[ENTER]
7, 7, 7). The lower the number on the cards, the fewer[ENTER]
points you'll earn for the set.[ENTER]
[ENTER]
A run consists of at least three consecutive cards (e.g.[ENTER]
6, 7, 8). The lower the number on the cards, the fewer[ENTER]
points you'll earn for the set. Runs in the same colour[ENTER]
will earn more points than multicoloured runs.[ENTER]
[ENTER]
Game Instructions[ENTER]
1. Left-click on the deck to reveal the first 5 cards.[ENTER]
2. Earn points by selecting 3 cards.[ENTER]
(NOTE: Left-click = select card, right-click =[ENTER]
permanently discard card)[ENTER]
3. The more points you earn by the end of the game, the[ENTER]
better your prize.[ENTER]
[ENTER]
Hints[ENTER]
1) You can pause your game at any time by pressing ESC.[ENTER]
Changing map or teleporting will end the current game![ENTER]
2) Once discarded, cards cannot be restored, so think[ENTER]
carefully before deciding![ENTER]
3) Cancelled games will NOT be refunded! Choose where you[ENTER]
want to play your game wisely.

root/ui.py

def SetSlotCountNew(self, slotNumber, grade, count):
wndMgr.SetSlotCountNew(self.hWnd, slotNumber, grade, count)

def SetCardSlot(self, renderingSlotNumber, CardIndex, cardIcon, diffuseColor = (1.0, 1.0, 1.0, 1.0)):
if 0 == CardIndex or None == CardIndex:
wndMgr.ClearSlot(self.hWnd, renderingSlotNumber)
return

item.SelectItem(CardIndex)
(width, height) = item.GetItemSize()

wndMgr.SetCardSlot(self.hWnd, renderingSlotNumber, CardIndex, width, height, cardIcon, diffuseColor)

class AniImageBox(Window):

class AniImageBox(Window):
def __init__(self, layer = "UI"):
Window.__init__(self, layer)
self.eventEndFrame = None

def __del__(self):
Window.__del__(self)
self.eventEndFrame = None

def RegisterWindow(self, layer):
self.hWnd = wndMgr.RegisterAniImageBox(self, layer)

def SetDelay(self, delay):
wndMgr.SetDelay(self.hWnd, delay)

def AppendImage(self, filename):
wndMgr.AppendImage(self.hWnd, filename)

def SetPercentage(self, curValue, maxValue):
wndMgr.SetRenderingRect(self.hWnd, 0.0, 0.0, -1.0 + float(curValue) / float(maxValue), 0.0)

def ResetFrame(self):
wndMgr.ResetFrame(self.hWnd)

def SetOnEndFrame(self, event):
self.eventEndFrame = event

def OnEndFrame(self):
if self.eventEndFrame:
self.eventEndFrame()

root/uicards.py(Creare e aggiungere)
import ui
import net
import mouseModule
import player
import snd
import localeInfo
import item
import grp
import uiScriptLocale
import uiToolTip
import event
import chat
import uiCommon

class CardsInfoWindow(ui.ScriptWindow):
class DescriptionBox(ui.Window):
def __init__(self):
ui.Window.__init__(self)
self.descIndex = 0
def __del__(self):
ui.Window.__del__(self)
def SetIndex(self, index):
self.descIndex = index
def OnRender(self):
event.RenderEventSet(self.descIndex)
def __init__(self):
ui.ScriptWindow.__init__(self)
self.LoadWindow()
self.descIndex=0
self.scrollPos = 0
self.safemode = 1
self.questionDialog = None

def __del__(self):
ui.ScriptWindow.__del__(self)

def LoadWindow(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/minigamerumiwaitingpage.py")
except:
import exception
exception.Abort("minigamerumiwaitingpage.LoadDialog.LoadScript")

try:
GetObject=self.GetChild
self.titleBar = GetObject("titlebar")
self.textBoard = GetObject("desc_board")
self.scrollBar = GetObject("scrollbar")
self.checkButton = GetObject("check_image")
self.checkButton2 = GetObject("confirm_check_button")
self.startButton = GetObject("game_start_button")

except:
import exception
exception.Abort("CubeWindow.LoadDialog.BindObject")

self.titleBar.SetCloseEvent(ui.__mem_func__(self.__OnCloseButtonClick))
self.scrollBar.SetPos(0.0)
self.scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))
self.checkButton.SetEvent(ui.__mem_func__(self.__OnSafeMode))
self.checkButton2.SetEvent(ui.__mem_func__(self.__OnSafeMode))
self.startButton.SetEvent(ui.__mem_func__(self.__OnStartQuestion))

def Destroy(self):
self.ClearDictionary()
self.titleBar = None
self.textBoard = None
self.descriptionBox = None
self.scrollPos = None
self.safemode = None
self.questionDialog = None

def Open(self):
self.__SetDescriptionEvent()
self.__CreateDescriptionBox()
self.scrollBar.SetPos(0.0)
self.Show()

def Close(self):
event.ClearEventSet(self.descIndex)
self.descIndex = 0
self.Hide()

def __OnStartQuestion(self):
questionDialog = uiCommon.QuestionDialog2()
questionDialog.SetText1(localeInfo.MINI_GAME_RUMI_START_QUESTION % (3000, 1))
questionDialog.SetText2(localeInfo.MINI_GAME_RUMI_START_QUESTION2)
questionDialog.SetAcceptEvent(ui.__mem_func__(self.__OnStart))
questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
questionDialog.Open()
self.questionDialog = questionDialog

def OnCloseQuestionDialog(self):
if self.questionDialog:
self.questionDialog.Close()

self.questionDialog = None

def __OnStart(self):
self.OnCloseQuestionDialog()
self.Close()
net.SendChatPacket("/cards o "+ str(self.safemode))

def __OnSafeMode(self):
if self.safemode == 0:
self.safemode = 1
self.checkButton.Show()
else:
self.checkButton.Hide()
self.safemode = 0

def OnUpdate(self):
(xposEventSet, yposEventSet) = self.textBoard.GetGlobalPosition()
event.UpdateEventSet(self.descIndex, xposEventSet+7, -(yposEventSet+7-(int(self.scrollPos) * 16)))
self.descriptionBox.SetIndex(self.descIndex)

def OnScroll(self):
import math
pos = self.scrollBar.GetPos()
self.scrollPos = math.floor(float(pos) / float(float(1) / float(event.GetLineCount(self.descIndex) - 18)) + 0.001)
event.SetVisibleStartLine(self.descIndex, int(self.scrollPos))
event.Skip(self.descIndex)

def __SetDescriptionEvent(self):
event.ClearEventSet(self.descIndex)
self.descIndex = event.RegisterEventSet(uiScriptLocale.CARDS_DESC)
event.SetRestrictedCount(self.descIndex, 100)
event.SetVisibleLineCount(self.descIndex, 18)

def __CreateDescriptionBox(self):
self.descriptionBox = self.DescriptionBox()
self.descriptionBox.Show()

def __OnCloseButtonClick(self):
self.Close()

def OnPressEscapeKey(self):
if 0 != self.eventClose:
self.eventClose()
return TRUE

class CardsWindow(ui.ScriptWindow):
CARDS_ICONS = {
1 : "d:/ymir work/ui/minigame/rumi/card/card_blue_%d.sub",
2 : "d:/ymir work/ui/minigame/rumi/card/card_red_%d.sub",
3 : "d:/ymir work/ui/minigame/rumi/card/card_yellow_%d.sub", }
def __init__(self):
ui.ScriptWindow.__init__(self)
self.safemode = 0
self.questionDialog = None

def __del__(self):
ui.ScriptWindow.__del__(self)

def LoadWindow(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/minigamerumigamepage.py")
except:
import exception
exception.Abort("minigamerumigamepage.LoadDialog.LoadScript")

try:
GetObject=self.GetChild
self.titleBar = GetObject("titlebar")
self.handSlot = GetObject("HandCardSlot")
self.fieldSlot = GetObject("FieldCardSlot")
self.deckSlot = GetObject("DeckCardSlot")
self.score_completion_effect1 = GetObject("score_completion_effect1")
self.score_completion_effect2 = GetObject("score_completion_effect2")
self.score_completion_effect3 = GetObject("score_completion_effect3")
self.score_completion_text_effect = GetObject("score_completion_text_effect")
self.deck_flush_effect = GetObject("deck_flush_effect")
self.cards_count = GetObject("card_cnt_text")
self.total_points = GetObject("total_score")
self.field_points = GetObject("score_number_text")
self.exitButton = GetObject("game_exit_button")

except:
import exception
exception.Abort("CubeWindow.LoadDialog.BindObject")

self.titleBar.SetCloseEvent(ui.__mem_func__(self.__OnCloseButtonClick))
self.handSlot.SAFE_SetButtonEvent("LEFT", "EXIST", self.SetSelectItemSlotEvent)
self.handSlot.SAFE_SetButtonEvent("RIGHT", "EXIST", self.SetUnselectItemSlotEvent)
self.fieldSlot.SAFE_SetButtonEvent("LEFT", "EXIST", self.SetSelectItemSlotEvent2)
self.score_completion_effect1.SetOnEndFrame(ui.__mem_func__(self.__OnEndFrame))
self.deckSlot.SAFE_SetButtonEvent("LEFT", "ALWAYS", self.SetPickCardFromDeck)
self.exitButton.SetEvent(ui.__mem_func__(self.__EndGame))
self.HideEffects()


def SetPickCardFromDeck(self, slotIndex):
if int(self.cards_count.GetText()) < 1:
return
net.SendChatPacket("/cards p")
def SetSelectItemSlotEvent(self, slotIndex):
net.SendChatPacket("/cards a " + str(slotIndex))
def SetSelectItemSlotEvent2(self, slotIndex):
net.SendChatPacket("/cards r " + str(slotIndex))
def SetUnselectItemSlotEvent(self, slotIndex):
if self.safemode == 1:
questionDialog = uiCommon.QuestionDialog()
questionDialog.SetText(localeInfo.MINI_GAME_RUMI_DISCARD_QUESTION)
questionDialog.SetAcceptEvent(lambda arg=TRUE: self.DestroyCard(slotIndex))
questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
questionDialog.Open()
self.questionDialog = questionDialog
else:
self.DestroyCard(slotIndex)

def __EndGame(self):
questionDialog = uiCommon.QuestionDialog2()
questionDialog.SetText1(localeInfo.MINI_GAME_RUMI_EXIT_QUESTION)
questionDialog.SetText2(localeInfo.MINI_GAME_RUMI_EXIT_QUESTION2)
questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnEndGame))
questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
questionDialog.Open()
self.questionDialog = questionDialog

def OnEndGame(self):
net.SendChatPacket("/cards e")
self.OnCloseQuestionDialog()
self.Close()
def DestroyCard(self, index):
net.SendChatPacket("/cards d " + str(index))
self.OnCloseQuestionDialog()

def OnCloseQuestionDialog(self):
if self.questionDialog:
self.questionDialog.Close()

self.questionDialog = None

def __OnEndFrame(self):
self.HideEffects()

def UpdateCardsInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points):
if (hand_1 == 0):
self.handSlot.ClearSlot(0)
elif (hand_1 != 0):
self.handSlot.SetCardSlot(0, 10, (self.CARDS_ICONS[hand_1] % (int(hand_1_v))))
if (hand_2 == 0):
self.handSlot.ClearSlot(1)
elif (hand_2 != 0):
self.handSlot.SetCardSlot(1, 10, (self.CARDS_ICONS[hand_2] % (int(hand_2_v))))
if (hand_3 == 0):
self.handSlot.ClearSlot(2)
elif (hand_3 != 0):
self.handSlot.SetCardSlot(2, 10, (self.CARDS_ICONS[hand_3] % (int(hand_3_v))))
if (hand_4 == 0):
self.handSlot.ClearSlot(3)
elif (hand_4 != 0):
self.handSlot.SetCardSlot(3, 10, (self.CARDS_ICONS[hand_4] % (int(hand_4_v))))
if (hand_5 == 0):
self.handSlot.ClearSlot(4)
elif (hand_5 != 0):
self.handSlot.SetCardSlot(4, 10, (self.CARDS_ICONS[hand_5] % (int(hand_5_v))))
self.cards_count.SetText(str(cards_left))
self.total_points.SetText(str(points))
self.UpdateDeckSlot()

def UpdateCardsFieldInfo(self, slot1, slot1_v, slot2, slot2_v, slot3, slot3_v, points):
if (slot1 == 0):
self.fieldSlot.ClearSlot(0)
elif (slot1 != 0):
self.fieldSlot.SetCardSlot(0, 10, (self.CARDS_ICONS[slot1] % (int(slot1_v))))
if (slot2 == 0):
self.fieldSlot.ClearSlot(1)
elif (slot2 != 0):
self.fieldSlot.SetCardSlot(1, 10, (self.CARDS_ICONS[slot2] % (int(slot2_v))))
if (slot3 == 0):
self.fieldSlot.ClearSlot(2)
elif (slot3 != 0):
self.fieldSlot.SetCardSlot(2, 10, (self.CARDS_ICONS[slot3] % (int(slot3_v))))
self.field_points.SetText(str(points))

def UpdateDeckSlot(self):
if int(self.cards_count.GetText()) > 16:
self.deckSlot.SetCardSlot(2, 10, "d:/ymir work/ui/minigame/rumi/deck/deck3.sub")
self.deckSlot.SetCardSlot(1, 10, "d:/ymir work/ui/minigame/rumi/deck/deck2.sub")
elif int(self.cards_count.GetText()) <= 16 and int(self.cards_count.GetText()) > 8:
self.deckSlot.ClearSlot(2)
self.deckSlot.SetCardSlot(1, 10, "d:/ymir work/ui/minigame/rumi/deck/deck2.sub")
elif int(self.cards_count.GetText()) <= 8 and int(self.cards_count.GetText()) > 0:
self.deckSlot.ClearSlot(2)
self.deckSlot.ClearSlot(1)
self.deckSlot.SetCardSlot(0, 10, "d:/ymir work/ui/minigame/rumi/deck/deck1.sub")
else:
self.deckSlot.ClearSlot(0)
self.deckSlot.ClearSlot(1)
self.deckSlot.ClearSlot(2)

def CardsPutReward(self, slot1, slot1_v, slot2, slot2_v, slot3, slot3_v, points):
self.score_completion_effect1.ResetFrame()
self.score_completion_effect1.Show()
self.score_completion_effect2.ResetFrame()
self.score_completion_effect2.Show()
self.score_completion_effect3.ResetFrame()
self.score_completion_effect3.Show()
self.score_completion_text_effect.ResetFrame()
self.score_completion_text_effect.Show()

def HideEffects(self):
self.score_completion_effect1.Hide()
self.score_completion_effect2.Hide()
self.score_completion_effect3.Hide()
self.score_completion_text_effect.Hide()
self.deck_flush_effect.Hide()
self.field_points.SetText("0")

def Destroy(self):
self.ClearDictionary()
self.titleBar = None
self.handSlot = None
self.fieldSlot = None
self.deckSlot = None
self.score_completion_effect1 = None
self.score_completion_effect2 = None
self.score_completion_effect3 = None
self.score_completion_text_effect = None
self.deck_flush_effect = None
self.cards_count = None
self.total_points = None
self.field_points = None
self.safemode = None
self.questionDialog = None

def Open(self, safemode):
self.safemode = safemode
self.Show()

def Close(self):
self.Hide()

def __OnCloseButtonClick(self):
self.Close()

def OnPressEscapeKey(self):
if 0 != self.eventClose:
self.eventClose()
return TRUE

class IngameWindow(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)

def __del__(self):
ui.ScriptWindow.__del__(self)

def LoadWindow(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/minigamewindow.py")
except:
import exception
exception.Abort("minigamewindow.LoadDialog.LoadScript")

try:
GetObject=self.GetChild
self.gameButton = GetObject("minigame_rumi_button")

except:
import exception
exception.Abort("CubeWindow.LoadDialog.BindObject")

self.gameButton.SetEvent(ui.__mem_func__(self.__OnClickGame))
def __OnClickGame(self):
self.window = CardsInfoWindow()
self.window.Open()

def Destroy(self):
self.ClearDictionary()

ora andate in root/uiscriptlocale.py:
EMPIREDESC_C = "%s/empiredesc_c.txt" % (name)

CARDS_DESC = "mini_game_okey_desc.txt"

PARTE SERVER Item_proto.sql
INSERT INTO `item_proto` VALUES ('79505', 0x3739353035, 0x4F6B65792D43617264, '18', '1', '0', '1', '237952', '4', '0', '', '1000', '1000', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `item_proto` VALUES ('79506', 0x3739353036, 0x43617264736574, '14', '1', '0', '1', '0', '4', '0', '', '1000', '1000', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `item_proto` VALUES ('71194', 0x3731313934, 0x4F6B657920476F6C64656E2D426F78, '18', '0', '0', '1', '32768', '0', '0', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `item_proto` VALUES ('71195', 0x3731313935, 0x4F6B65792053696C7665722D426F78, '18', '0', '0', '1', '32768', '0', '0', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `item_proto` VALUES ('71196', 0x3731313936, 0x4F6B65792042726F6E7A652D426F78, '18', '0', '0', '1', '32768', '0', '0', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');

okay_event.sql (​
Crea e aggiunge , poi eseguirlo in registro)
SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for okay_event
-- ----------------------------
DROP TABLE IF EXISTS `okay_event`;
CREATE TABLE `okay_event` (
`pid` int(11) DEFAULT NULL,
`name` varchar(11) DEFAULT NULL,
`points` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

RITORNIAMO NEL CLIENT IN UISCRIPT
Uiscript/minigamerumigamepage.py(CREARE E AGGIUNGERE)
import uiScriptLocale

ROOT = "d:/ymir work/ui/minigame/rumi/"

WINDOW_WIDTH = 352
WINDOW_HEIGHT = 384

CARD_IMG_WIDTH = 38#40
CARD_IMG_HEIGHT = 52#54

DECK_IMG_WIDTH = 42
DECK_IMG_HEIGHT = 56

HAND_CARD_GAP = 21
FIELD_CARD_GAP = 5

window = {
"name" : "RumiGamePage",
"style" : ("movable", "float",),

"x" : SCREEN_WIDTH / 2 - WINDOW_WIDTH / 2,
"y" : SCREEN_HEIGHT / 2 - WINDOW_HEIGHT / 2,

"width" : WINDOW_WIDTH,
"height" : WINDOW_HEIGHT,

"children" :
(
{
"name" : "board",
"type" : "board",
"style" : ("attach",),

"x" : 0,
"y" : 0,

"width" : WINDOW_WIDTH,
"height" : WINDOW_HEIGHT,

"children" :
(
{
"name" : "titlebar",
"type" : "titlebar",
"style" : ("attach",),

"x" : 0,
"y" : 0,

"width" : WINDOW_WIDTH,
"color" : "yellow",

"children" :
(
{ "name":"TitleName", "type":"text", "x":0, "y":0, "text": uiScriptLocale.MINI_GAME_RUMI_TITLE, "all_align":"center" },
),
},

{
"name" : "game_exit_button",
"type" : "button",

"x" : 133,
"y" : 349,

"text" : uiScriptLocale.MINI_GAME_RUMI_EXIT,

"default_image" : "d:/ymir work/ui/public/large_button_01.sub",
"over_image" : "d:/ymir work/ui/public/large_button_02.sub",
"down_image" : "d:/ymir work/ui/public/large_button_03.sub",
},

{
"name" : "BG",
"type" : "expanded_image",
"style" : ("attach",),

"x" : 13,
"y" : 35,

"image" : ROOT + "rumi_bg.tga",
},

{
"name" : "HandCardSlot",
"type" : "slot",

"x" : 39,
"y" : 60,

"width" : CARD_IMG_WIDTH * 5 + HAND_CARD_GAP * 4,
"height" : CARD_IMG_HEIGHT,

"slot" :
(
{"index":0, "x":0, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":1, "x":CARD_IMG_WIDTH * 1 + HAND_CARD_GAP * 1, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":2, "x":CARD_IMG_WIDTH * 2 + HAND_CARD_GAP * 2, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":3, "x":CARD_IMG_WIDTH * 3 + HAND_CARD_GAP * 3, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":4, "x":CARD_IMG_WIDTH * 4 + HAND_CARD_GAP * 4, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
),
},

{
"name" : "FieldCardSlot",
"type" : "slot",

"x" : 114,
"y" : 149,

"width" : CARD_IMG_WIDTH * 3 + FIELD_CARD_GAP * 2,
"height" : CARD_IMG_HEIGHT,

"slot" :
(
{"index":0, "x":0, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":1, "x":CARD_IMG_WIDTH * 1 + FIELD_CARD_GAP * 1, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":2, "x":CARD_IMG_WIDTH * 2 + FIELD_CARD_GAP * 2, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
),
},

{
"name" : "DeckCardSlot",
"type" : "slot",

"x" : 46,
"y" : 234,

"width" : DECK_IMG_WIDTH,
"height" : DECK_IMG_HEIGHT,

"slot" :
(
{"index":0, "x":4, "y":4, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":1, "x":2, "y":2, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
{"index":2, "x":0, "y":0, "width":CARD_IMG_WIDTH, "height":CARD_IMG_HEIGHT},
),
},

{
"name" : "score_window",
"type" : "window",
"style" : ("attach",),

"x" : 243,
"y" : 168,

"width" : 29,
"height" : 18,

"children" :
(
{
"name" : "score_number_text",
"type" : "text",

"x" : 0,
"y" : 0,
"all_align":"center"
},
),
},

{
"name" : "card_cnt_window",
"type" : "window",
"style" : ("attach",),

"x" : 112,
"y" : 273,

"width" : 24,
"height" : 18,

"children" :
(
{
"name" : "card_cnt_text",
"type" : "text",

"x" : 0,
"y" : 0,
"all_align":"center"
},
),
},

{
"name" : "total_score_window",
"type" : "window",
"style" : ("attach",),

"x" : 218,
"y" : 273,

"width" : 90,
"height" : 18,

"children" :
(
{
"name" : "total_score",
"type" : "text",

"x" : 0,
"y" : 0,

"text" : "0",
"all_align":"center"
},
),
},

{
"name" : "cross_text_window",
"type" : "window",
"style" : ("attach",),

"x" : 92,
"y" : 273,

"width" : 20,
"height" : 18,

"children" :
(
{
"name" : "cross_text",
"type" : "text",

"x" : 0,
"y" : 0,

"text" : "X",
"all_align":"center"
},
),
},

{
"name" : "total_score_text_window",
"type" : "window",
"style" : ("attach",),

"x" : 138,
"y" : 273,

"width" : 60,
"height" : 18,

"children" :
(
{
"name" : "total_score_text",
"type" : "text",

"x" : 0,
"y" : 0,

"text" : uiScriptLocale.MINI_GAME_RUMI_SCORE,
"all_align":"center",
},
),
},

{
"name" : "mouse_lbutton_img",
"type" : "expanded_image",
"style" : ("attach",),

"x" : 18,
"y" : 314,

"image" : ROOT + "mouse_lbutton.sub",
},

{
"name" : "mouse_lbutton_desc_window",
"type" : "window",
"style" : ("attach",),

"x" : 42,
"y" : 330,

"width" : 167,
"height" : 10,

"children" :
(
{
"name" : "mouse_lbutton_desc_text",
"type" : "text",

"x" : 0,
"y" : 0,

"text" : uiScriptLocale.MINI_GAME_RUMI_LBUTTON_DESC,
"text_horizontal_align" : "left",
"text_vertical_align" : "center",

"r":145/255.0,
"g":134/255.0,
"b":122/255.0,
},
),
},

{
"name" : "mouse_rbutton_img",
"type" : "expanded_image",
"style" : ("attach",),

"x" : 188,
"y" : 314,

"image" : ROOT + "mouse_rbutton.sub",
},

{
"name" : "mouse_rbutton_desc_window",
"type" : "window",
"style" : ("attach",),

"x" : 214,
"y" : 330,

"width" : 167,
"height" : 10,

"children" :
(
{
"name" : "mouse_rbutton_desc_text",
"type" : "text",

"x" : 0,
"y" : 0,

"text" : uiScriptLocale.MINI_GAME_RUMI_RBUTTON_DESC,
"text_horizontal_align" : "left",
"text_vertical_align" : "center",

"r":145/255.0,
"g":134/255.0,
"b":122/255.0,
},
),
},

{
"name" : "score_completion_effect1",
"type" : "ani_image",

"x" : 57,
"y" : 100,

"delay" : 6,

"images" :
(
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff1.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff2.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff3.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff4.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff6.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff7.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff8.sub",
),
},

{
"name" : "score_completion_effect2",
"type" : "ani_image",

"x" : 100,
"y" : 100,

"delay" : 6,

"images" :
(
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff1.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff2.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff3.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff4.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff6.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff7.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff8.sub",
),
},

{
"name" : "score_completion_effect3",
"type" : "ani_image",

"x" : 143,
"y" : 100,

"delay" : 6,

"images" :
(
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff1.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff2.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff3.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff4.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff6.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff7.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_eff8.sub",
),
},

{
"name" : "score_completion_text_effect",
"type" : "ani_image",

"x" : 91,
"y" : 133,

"delay" : 0,

"images" :
(

"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect1.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect5.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect6.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect6.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect7.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect8.sub",
"D:/Ymir Work/UI/minigame/rumi/card_completion_effect/card_completion_text_effect9.sub",
),
},

{
"name" : "deck_flush_effect",
"type" : "ani_image",
"style" : ("attach",),

"x" : 46,
"y" : 234,

"delay" : 8,

"images" :
(
ROOT + "deck/deck_flash/deck_card_flush2.sub",
ROOT + "deck/deck_flash/deck_card_flush3.sub",
ROOT + "deck/deck_flash/deck_card_flush4.sub",
ROOT + "deck/deck_flash/deck_card_flush5.sub",
ROOT + "deck/deck_flash/deck_card_flush4.sub",
ROOT + "deck/deck_flash/deck_card_flush3.sub",
ROOT + "deck/deck_flash/deck_card_flush2.sub",
ROOT + "deck/deck_flash/deck_card_flush1.sub",
),
},
),
},
),
}

Uiscript/minigamerumiwaitingpage.py(CREARE E AGGIUNGERE)
import uiScriptLocale

ROOT = "d:/ymir work/ui/game/"

WINDOW_WIDTH = 352
WINDOW_HEIGHT = 384

BOARD_WIDTH = 305
BOARD_HEIGHT = 300

window = {
"name" : "RumiWaitingPage",
"style" : ("movable",),

"x" : SCREEN_WIDTH / 2 - WINDOW_WIDTH / 2,
"y" : SCREEN_HEIGHT / 2 - WINDOW_HEIGHT / 2,

"width" : WINDOW_WIDTH,
"height" : WINDOW_HEIGHT,

"children" :
(
{
"name" : "board",
"type" : "board",
"style" : ("attach",),

"x" : 0,
"y" : 0,

"width" : WINDOW_WIDTH,
"height" : WINDOW_HEIGHT,

"children" :
(
{
"name" : "titlebar",
"type" : "titlebar",
"style" : ("attach",),

"x" : 0,
"y" : 0,

"width" : WINDOW_WIDTH,
"color" : "yellow",

"children" :
(
{ "name":"TitleName", "type":"text", "x":0, "y":0, "text": uiScriptLocale.MINI_GAME_RUMI_TITLE, "all_align":"center" },
),
},

{
"name" : "desc_board",
"type" : "bar",

"x" : 15,
"y" : 30,

"width" : BOARD_WIDTH,
"height" : BOARD_HEIGHT,

"children" :
(
{
"name" : "right_line",
"type" : "line",

"x" : BOARD_WIDTH-1,
"y" : 0,

"width" : 0,
"height" : BOARD_HEIGHT,

"color" : 0xffAAA6A1,
},

{
"name" : "bottom_line",
"type" : "line",

"x" : 0,
"y" : BOARD_HEIGHT-1,

"width" : BOARD_WIDTH,
"height" : 0,

"color" : 0xffAAA6A1,
},
{
"name" : "left_line",
"type" : "line",

"x" : 0,
"y" : 0,

"width" : 0,
"height" : BOARD_HEIGHT,

"color" : 0xff2A2521,
},
{
"name" : "top_line",
"type" : "line",

"x" : 0,
"y" : 0,

"width" : BOARD_WIDTH,
"height" : 0,

"color" : 0xff2A2521,
},

),

},

{
"name" : "scrollbar",
"type" : "scrollbar",

"x" : 29,
"y" : 30,
"size" : BOARD_HEIGHT+5,
"horizontal_align" : "right",
},

{
"name" : "game_start_button",
"type" : "button",

"x" : 40,
"y" : 40,

"text" : uiScriptLocale.MINI_GAME_RUMI_START_TEXT,

"vertical_align" : "bottom",
"horizontal_align" : "left",


"default_image" : "d:/ymir work/ui/public/large_button_01.sub",
"over_image" : "d:/ymir work/ui/public/large_button_02.sub",
"down_image" : "d:/ymir work/ui/public/large_button_03.sub",
},

{
"name" : "confirm_check_button_text_window",
"type" : "window",
"style" : ("attach",),

"x" : 275,
"y" : 348,

"width" : 29,
"height" : 18,

"children" :
(
{
"name" : "confirm_check_button_text",
"type" : "text",

"x" : 0,
"y" : 0,

"text_horizontal_align" : "right",

"text" : uiScriptLocale.MINI_GAME_RUMI_DISCARD_TEXT,
},
),
},

{
"name" : "confirm_check_button",
"type" : "button",

"x" : 285,
"y" : 344,
"default_image" : "d:/ymir work/ui/public/Parameter_Slot_07.sub",
"over_image" : "d:/ymir work/ui/public/Parameter_Slot_07.sub",
"down_image" : "d:/ymir work/ui/public/Parameter_Slot_07.sub",
},
{
"name" : "check_image",
"type" : "button",

"x" : 290,
"y" : 344,

"default_image" : "d:/ymir work/ui/public/check_image.sub",
"over_image" : "d:/ymir work/ui/public/check_image.sub",
"down_image" : "d:/ymir work/ui/public/check_image.sub",
},

),
},
),
}

Uiscript/minigamewindow.py(CREARE E AGGIUNGERE)
import uiScriptLocale

RUMI_ROOT = "d:/ymir work/ui/minigame/rumi/"

window = {
"name" : "MiniGameWindow",

"x" : SCREEN_WIDTH - 136 - 100,
"y" : 15,

"width" : 100,
"height" : 58,

"children" :
(
{
"name" : "mini_game_window",
"type" : "window",

"x" : 0,
"y" : 0,

"width" : 100,
"height" : 58,

"children" :
(
{
"name" : "minigame_rumi_button",
"type" : "button",

"x" : 0,
"y" : 0,

"default_image" : RUMI_ROOT + "rumi_button_min.sub",
"over_image" : RUMI_ROOT + "rumi_button_min.sub",
"down_image" : RUMI_ROOT + "rumi_button_min.sub",
},
),
},
),
}

PARTE SERVER QUEST
quest cards_event begin
state start begin
when login with game.get_event_flag("cards_event") != 0 begin
cmdchat("cards icon")
end
when 79505.pick with pc.count_item(79505) >= 24 begin
pc.remove_item(79505, 24)
pc.give_item2(79506)
end
when 20095.chat."All rank" begin
say(pc.get_okay_global_rank())
end
when 20095.chat."Rund rank" begin
say(pc.get_okay_rund_rank())
end
end
end

IN QUEST_FUCTION
pc.get_okay_global_rank
pc.get_okay_rund_rank

Client/locale:
71194 ETC icon/item/71194.tga
71195 ETC icon/item/71195.tga
71196 ETC icon/item/71196.tga
79505 ETC icon/item/79505.tga
79506 ETC icon/item/79506.tga

<ItemDef Vnum="79505" Name="ľąÁś°˘" LocalizedName="Okey-Card" Type="18" SubType="1" Weight="0" Size="1" AntiFlags="0" Flags="4" WearFlags="0" ImmuneFlags="0" Gold="1000" ShopBuyPrice="0" LimitType0="0" LimitValue0="0" LimitType1="0" LimitValue1="0" ApplyType0="0" ApplyValue0="0" ApplyType1="0" ApplyValue1="0" ApplyType2="0" ApplyValue2="0" Value0="0" Value1="0" Value2="0" Value3="0" Value4="0" Value5="0" Socket0="0" Socket1="0" Socket2="0" RefinedVnum="0" RefineSet="0" AlterToMagicItemPercent="0" Specular="0" GainSocketPercent="0" AddonType="0" />
<ItemDef Vnum="79506" Name="ľąÁś°˘" LocalizedName="Cardset" Type="14" SubType="1" Weight="0" Size="1" AntiFlags="0" Flags="4" WearFlags="0" ImmuneFlags="0" Gold="1000" ShopBuyPrice="0" LimitType0="0" LimitValue0="0" LimitType1="0" LimitValue1="0" ApplyType0="0" ApplyValue0="0" ApplyType1="0" ApplyValue1="0" ApplyType2="0" ApplyValue2="0" Value0="0" Value1="0" Value2="0" Value3="0" Value4="0" Value5="0" Socket0="0" Socket1="0" Socket2="0" RefinedVnum="0" RefineSet="0" AlterToMagicItemPercent="0" Specular="0" GainSocketPercent="0" AddonType="0" />
<ItemDef Vnum="71194" Name="ŔĚĆÄŔÇ ťóŔÚ" LocalizedName="Okey Golden-Box" Type="18" SubType="0" Weight="0" Size="1" AntiFlags="32768" Flags="0" WearFlags="0" ImmuneFlags="0" Gold="0" ShopBuyPrice="0" LimitType0="0" LimitValue0="0" LimitType1="0" LimitValue1="0" ApplyType0="0" ApplyValue0="0" ApplyType1="0" ApplyValue1="0" ApplyType2="0" ApplyValue2="0" Value0="0" Value1="0" Value2="0" Value3="0" Value4="0" Value5="0" Socket0="0" Socket1="0" Socket2="0" RefinedVnum="0" RefineSet="0" AlterToMagicItemPercent="0" Specular="0" GainSocketPercent="0" AddonType="0" />
<ItemDef Vnum="71195" Name="ŔĚĆÄŔÇ ťóŔÚ" LocalizedName="Okey Silver-Box" Type="18" SubType="0" Weight="0" Size="1" AntiFlags="32768" Flags="0" WearFlags="0" ImmuneFlags="0" Gold="0" ShopBuyPrice="0" LimitType0="0" LimitValue0="0" LimitType1="0" LimitValue1="0" ApplyType0="0" ApplyValue0="0" ApplyType1="0" ApplyValue1="0" ApplyType2="0" ApplyValue2="0" Value0="0" Value1="0" Value2="0" Value3="0" Value4="0" Value5="0" Socket0="0" Socket1="0" Socket2="0" RefinedVnum="0" RefineSet="0" AlterToMagicItemPercent="0" Specular="0" GainSocketPercent="0" AddonType="0" />
<ItemDef Vnum="71196" Name="ŔĚĆÄŔÇ ťóŔÚ" LocalizedName="Okey Bronze-Box" Type="18" SubType="0" Weight="0" Size="1" AntiFlags="32768" Flags="0" WearFlags="0" ImmuneFlags="0" Gold="0" ShopBuyPrice="0" LimitType0="0" LimitValue0="0" LimitType1="0" LimitValue1="0" ApplyType0="0" ApplyValue0="0" ApplyType1="0" ApplyValue1="0" ApplyType2="0" ApplyValue2="0" Value0="0" Value1="0" Value2="0" Value3="0" Value4="0" Value5="0" Socket0="0" Socket1="0" Socket2="0" RefinedVnum="0" RefineSet="0" AlterToMagicItemPercent="0" Specular="0" GainSocketPercent="0" AddonType="0" />

79505 Okey-Sammelkarte If you stapelst 24 Okey trading card, you get automatically Okey-card pack.
79506 Okey-Kartenset This map set you can start a Okey-round. That map set is automatically removed after starting the game from your inventory.
71194 Goldene Okey-Box You get a random number Okey trading cards. When the event is over, you can not get any more cards.
71195 Silberne Okey-Box You get a random number Okey trading cards. When the event is over, you can not get any more cards.
71196 Bronzene Okey-Box You get a random number Okey trading cards. When the event is over, you can not get any more cards.

MINI_GAME_RUMI_DISCARD_QUESTION Do you want destroy card?
MINI_GAME_RUMI_EXIT_QUESTION Do you want end game?
MINI_GAME_RUMI_EXIT_QUESTION2 You will recieve reward depend of points.
MINI_GAME_RUMI_START_QUESTION You need %d Yang and %d Kardsets to play.
MINI_GAME_RUMI_START_QUESTION2 Do you want to play??

MINI_GAME_RUMI_DISCARD_TEXT Secure Mode
MINI_GAME_RUMI_EXIT End
MINI_GAME_RUMI_LBUTTON_DESC Left-click to add card
MINI_GAME_RUMI_RBUTTON_DESC Right-click to discard card
MINI_GAME_RUMI_SCORE Score
MINI_GAME_RUMI_START_TEXT Start
MINI_GAME_RUMI_TITLE Metin2 Okey Card Game

- Aggiungere char_cards.cpp makefile
- Prezzo richiesto e un oggetto per giocare char_cards.cpp può impostare fin dall'inizio .
- Okay_event.sql esecuzione nel database di registrazione
- Per attivare il tipo di evento " / e cards_event 1 " nel gioco .

Download:
https://mega.nz/#!2VA1SRBL!Ck-QP-6ie4qA4FJ_Jv-76NICKtnaRTBD83a1jtX5T0Q

CHIEDO SCUSA PER LA TRADUZIONE(FATTA DA GOOGLE TRADUTTORE)
fonti 4metin.**​

Download
 
Guida fatta con i piedi.
Neanche le fonti bah.
Il file card.cpp ha un bug ;) Lascio a te scoprirlo :)
 
Per uhe spamma su inforge e su skype che vende servizi e cavolate varie e poi posta roba presi da altri siti senza dare fonti fai vedere che di tuo non hai nulla.
Spammi roba per farti vedere e poter rifilare servizi copiati dal web.

Mi tocca sconsigliarti cosi.
 
  • Mi piace
Reazioni: AlwaysOn
Stato
Discussione chiusa ad ulteriori risposte.