Commit 579c823a authored by 神楽坂玲奈's avatar 神楽坂玲奈
parents 738de285 63c61e96
/expansions
/obj
/bin
/build
/replay
/deck
ygopro
## ygopro ## ygopro(server)
A script engine for "yu-gi-oh!" and sample gui 一个linux版的ygopro服务端,基于mycard代码修改。
[中文说明](https://github.com/Fluorohydride/ygopro/wiki/%E4%B8%AD%E6%96%87%E8%AF%B4%E6%98%8E) 现用于[YGOPRO 233服](http://mercury233.me/ygosrv233/)
###Keys: ###编译
* ESC: Minimize the window. * 需要以下组件
* A: Holding down this button will let the system stop at every timing. * premake4
* S: Holding down this button will let the system skip every timing. * freetype
* R: Fix the font error. * libevent
* F1~F4: Show the cards in your grave, banished zone, extra deck, xyz materials. * sqlite3
* F5~F8: Show the cards in your opponent's grave, banished zone, extra deck, xyz materials. * irrlicht1.8
* lua5.2
* libGL
* libGLU
* gcc
* 可参考 https://github.com/mycard/mycard.github.io/tree/master/server 中的脚本
###Color: ###运行
* Background: * 使用[ygopro-server-lite](https://github.com/mercury233/ygopro-server)运行
* White = your card, Grey = your opponent's card * 手动运行的参数是
* Text: * ./ygopro 0 0 0 1 F F F 8000 5 1 180
* Black = default, Blue = the owner of the xyz material is different from its controller * 端口(0为随机)
* 禁卡表编号
###Sequence: * 卡片允许
* Monster Zone: 1~5, starting from the left hand side. * 决斗模式
* Spell & Trap Zone: 1~5, starting from the left hand side. * 旧规则
* Field Zone: 6 * 不检查卡组
* Pendulum Zone: 7~8, starting from the left hand side. * 不洗切卡组
* The others: 1~n, starting from the bottom. * 初始LP
* 初始手牌数
###Deck edit page: * 每回合抽卡
* All numeric textboxs: They support >, =, <, >=, <= signs. * 每回合时间
* Card name: Search card names and texts by default, $foo will only search foo in card names, and @foo will search cards of "foo" archetype(due to translation, card name contains "foo" does not mean that card is "foo" card).
### Command-line options:
* -j: Join the host in system.conf file.
* -d: Enter the deck edit page.
* -r: Enter the replay mode page.
* -s: Enter the single mode page.
* -efoo: Load foo as the extra database.
### Directories:
* pics: .jpg card images(177*254).
* pics\thumbnail: .jpg thumbnail images(44*64).
* script: .lua script files.
* textures: Other image files.
* deck: .ydk deck files.
* replay: .yrp replay files.
* expansions: *.cdb will be loaded as extra databases.
File added
...@@ -45,7 +45,7 @@ typedef std::unordered_map<unsigned int, CardDataC>::iterator code_pointer; ...@@ -45,7 +45,7 @@ typedef std::unordered_map<unsigned int, CardDataC>::iterator code_pointer;
class ClientCard { class ClientCard {
public: public:
/* /*
irr::video::ITexture* curTexture; irr::video::ITexture* curTexture;
irr::core::matrix4 mTransform; irr::core::matrix4 mTransform;
irr::core::vector3df curPos; irr::core::vector3df curPos;
...@@ -113,7 +113,7 @@ public: ...@@ -113,7 +113,7 @@ public:
void ClearTarget(); void ClearTarget();
static bool client_card_sort(ClientCard* c1, ClientCard* c2); static bool client_card_sort(ClientCard* c1, ClientCard* c2);
static bool deck_sort_lv(code_pointer l1, code_pointer l2); static bool deck_sort_lv(code_pointer l1, code_pointer l2);
*/ */
}; };
} }
......
...@@ -47,8 +47,13 @@ inline int _wtoi(const wchar_t * s) { ...@@ -47,8 +47,13 @@ inline int _wtoi(const wchar_t * s) {
/* /*
#include <irrlicht.h> #include <irrlicht.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#endif
#include "CGUITTFont.h" #include "CGUITTFont.h"
#include "CGUIImageButton.h" #include "CGUIImageButton.h"
*/ */
......
...@@ -39,7 +39,6 @@ bool DataManager::LoadDB(const char* file) { ...@@ -39,7 +39,6 @@ bool DataManager::LoadDB(const char* file) {
cd.attribute = sqlite3_column_int(pStmt, 9); cd.attribute = sqlite3_column_int(pStmt, 9);
cd.category = sqlite3_column_int(pStmt, 10); cd.category = sqlite3_column_int(pStmt, 10);
_datas.insert(std::make_pair(cd.code, cd)); _datas.insert(std::make_pair(cd.code, cd));
/*
len = BufferIO::DecodeUTF8((const char*)sqlite3_column_text(pStmt, 12), strBuffer); len = BufferIO::DecodeUTF8((const char*)sqlite3_column_text(pStmt, 12), strBuffer);
if(len) { if(len) {
cs.name = new wchar_t[len + 1]; cs.name = new wchar_t[len + 1];
......
...@@ -36,6 +36,25 @@ unsigned char draw_count; ...@@ -36,6 +36,25 @@ unsigned char draw_count;
void Game::MainServerLoop(int bDuel_mode, int lflist) { void Game::MainServerLoop(int bDuel_mode, int lflist) {
deckManager.LoadLFList(); deckManager.LoadLFList();
dataManager.LoadDB("cards.cdb"); dataManager.LoadDB("cards.cdb");
//load expansions
DIR * dir;
struct dirent * dirp;
const char *foldername = "./expansions/";
if((dir = opendir(foldername)) != NULL) {
while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name);
if(len < 5 || strcasecmp(dirp->d_name + len - 4, ".cdb") != 0)
continue;
char *filepath = (char *)malloc(sizeof(char)*(len + strlen(foldername)));
strncpy(filepath, foldername, strlen(foldername)+1);
strncat(filepath, dirp->d_name, len);
dataManager.LoadDB(filepath);
free(filepath);
}
closedir(dir);
}
aServerPort = NetServer::StartServer(aServerPort); aServerPort = NetServer::StartServer(aServerPort);
NetServer::Initduel(bDuel_mode, lflist); NetServer::Initduel(bDuel_mode, lflist);
printf("%u\n", aServerPort); printf("%u\n", aServerPort);
......
...@@ -76,7 +76,7 @@ class Game { ...@@ -76,7 +76,7 @@ class Game {
public: public:
bool Initialize(); bool Initialize();
void MainLoop(); //void MainLoop();
void MainServerLoop(int bDuel_mode, int lflist); void MainServerLoop(int bDuel_mode, int lflist);
/* /*
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar); void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar);
...@@ -106,7 +106,7 @@ public: ...@@ -106,7 +106,7 @@ public:
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
*/ */
*/
int LocalPlayer(int player); int LocalPlayer(int player);
const wchar_t* LocalName(int local_player); const wchar_t* LocalName(int local_player);
...@@ -115,6 +115,7 @@ public: ...@@ -115,6 +115,7 @@ public:
irr::gui::IGUIElement* focus = env->getFocus(); irr::gui::IGUIElement* focus = env->getFocus();
return focus && focus->hasType(type); return focus && focus->hasType(type);
} }
*/
*/ */
Mutex gMutex; Mutex gMutex;
...@@ -162,7 +163,7 @@ public: ...@@ -162,7 +163,7 @@ public:
bool is_building; bool is_building;
bool is_siding; bool is_siding;
*/ */
*/
/* /*
ClientField dField; ClientField dField;
DeckBuilder deckBuilder; DeckBuilder deckBuilder;
......
...@@ -90,6 +90,5 @@ int main(int argc, char* argv[]) { ...@@ -90,6 +90,5 @@ int main(int argc, char* argv[]) {
#else #else
#endif //_WIN32 #endif //_WIN32
*/
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
...@@ -47,6 +47,7 @@ void NetServer::Initduel(int bDuel_mode, int lflist) ...@@ -47,6 +47,7 @@ void NetServer::Initduel(int bDuel_mode, int lflist)
if(!hash) if(!hash)
pkt->info.lflist = deckManager._lfList[0].hash; pkt->info.lflist = deckManager._lfList[0].hash;
if(lflist == -1) if(lflist == -1)
pkt->info.lflist = 0; pkt->info.lflist = 0;
duel_mode->host_info = pkt->info; duel_mode->host_info = pkt->info;
......
include "lzma" include "lzma"
project "ygopro" project "ygopro"
kind "WindowedApp" kind "ConsoleApp"
files { "gframe.cpp", "config.h", files { "gframe.cpp", "config.h",
"game.cpp", "game.h", "game.cpp", "game.h",
...@@ -16,16 +16,9 @@ project "ygopro" ...@@ -16,16 +16,9 @@ project "ygopro"
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "sqlite3", "lua" , "event"} links { "ocgcore", "clzma", "sqlite3", "lua" , "event"}
configuration "windows"
files "ygopro.rc"
excludes "CGUIButton.cpp"
includedirs { "../irrlicht/include", "../freetype/include", "../event/include", "../sqlite3" }
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
configuration {"windows", "not vs*"}
includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" }
configuration "not vs*" configuration "not vs*"
buildoptions { "-std=gnu++0x", "-fno-rtti" } buildoptions { "-std=gnu++0x", "-fno-rtti" }
configuration "not windows" configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2", "/usr/include/irrlicht", "/usr/include/freetype2" } includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2" }
excludes { "COSOperator.*" } excludes { "COSOperator.*" }
links { "event_pthreads", "GL", "dl", "pthread" } links { "event_pthreads", "dl", "pthread" }
This diff is collapsed.
Subproject commit a4839ff0aa4bf9f96cac51ef318e973d972e8748 Subproject commit 799b88b27a3c30e3e3a1534f9a7e6896ef132e6d
...@@ -15,8 +15,10 @@ solution "ygo" ...@@ -15,8 +15,10 @@ solution "ygo"
configuration "macosx" configuration "macosx"
defines { "LUA_USE_MACOSX" } defines { "LUA_USE_MACOSX" }
includedirs { "/opt/local/include" } includedirs { "/usr/local/include/*" }
libdirs { "/opt/local/lib" } libdirs { "/usr/local/lib", "/usr/X11/lib" }
buildoptions { "-stdlib=libc++" }
links {"OpenGL.framework","Cocoa.framework","IOKit.framework"}
configuration "linux" configuration "linux"
defines { "LUA_USE_LINUX" } defines { "LUA_USE_LINUX" }
......
Subproject commit 26821f9728df2ea1cc3a2c1e587979dff7934172 Subproject commit 5cd2d54d7d81391a4932611fa5eacf73bf1d9746
...@@ -373,7 +373,7 @@ ...@@ -373,7 +373,7 @@
!system 1622 [%ls]错过时点 !system 1622 [%ls]错过时点
!system 1623 投掷硬币结果: !system 1623 投掷硬币结果:
!system 1624 投掷骰子结果: !system 1624 投掷骰子结果:
#vistory reason #victory reason
!victory 0x0 投降 !victory 0x0 投降
!victory 0x1 LP变成0 !victory 0x1 LP变成0
!victory 0x2 没有卡可抽 !victory 0x2 没有卡可抽
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment