Jump to content

Ken

Inactive Member
  • Posts

    726
  • Joined

  • Last visited

  • Days Won

    44
  • Feedback

    0%

Posts posted by Ken

  1. bool NewPlayerTable2(TPlayerTable * table, const char * name, BYTE race, BYTE shape, BYTE bEmpire)
    {
    	if (race >= MAIN_RACE_MAX_NUM)
    	{
    		sys_err("NewPlayerTable2.OUT_OF_RACE_RANGE(%d >= max(%d))\n", race, MAIN_RACE_MAX_NUM);
    		return false;
    	}
    
    	unsigned job;
    
    	if (!RaceToJob(race, &job))
    	{	
    		sys_err("NewPlayerTable2.RACE_TO_JOB_ERROR(%d)\n", race);
    		return false;
    	}
    
    	sys_log(0, "NewPlayerTable2(name=%s, race=%d, job=%d)", name, race, job); 
    
    	memset(table, 0, sizeof(TPlayerTable));
    
    	strlcpy(table->name, name, sizeof(table->name));
    
    	table->level		= 1;
    	table->job			= race;	// Á÷¾÷´ë½Å Á¾Á·À» ³Ö´Â´Ù
    	table->voice		= 0;
    	table->part_base	= shape;
    
    	table->st		= JobInitialPoints[job].st;
    	table->dx		= JobInitialPoints[job].dx;
    	table->ht		= JobInitialPoints[job].ht;
    	table->iq		= JobInitialPoints[job].iq;
    
    	table->hp		= JobInitialPoints[job].max_hp + table->ht * JobInitialPoints[job].hp_per_ht;
    	table->sp		= JobInitialPoints[job].max_sp + table->iq * JobInitialPoints[job].sp_per_iq;
    	table->stamina	= JobInitialPoints[job].max_stamina;
    
    	table->x		= CREATE_START_X(bEmpire) + number(-300, 300);
    	table->y		= CREATE_START_Y(bEmpire) + number(-300, 300);
    	table->z		= 0;
    	table->dir		= 0;
    	table->playtime = 0;
    	table->gold 	= 0;
    
    	table->skill_group = 0;
    
    	return true;
    }
    

    That will be enough for you.

    Filename : input_login.cpp

    Line : 383

    Kind Regards

    Ken

    • Love 1
  2. http://pastebin.com/tY1hNKYa

    If i have to talk about your second game log, you can't see your game file because system is gives to error.

    OBJDIR/questlua.o: In function `OBJDIR/questlua.o: In function `quest::CQuestManager::InitializeLua()':
    /usr/src/mainline_released/mainline_sg/Srcs/Server/game/src/questlua.cpp:493: undefined reference to `quest::RegisterMysqlFunctionTable()'
    quest::CQuestManager::InitializeLua()':
    /usr/src/mainline_released/mainline_sg/Srcs/Server/game/src/questlua.cpp:493: undefined reference to `quest::RegisterMysqlFunctionTable()'

    You have to define RegisterMysqlFunctionTable().

    That is true, but my game file is not there. If i compile without wolfman files then it is there, but with wolfman files it is not there. But in the logs are no errors or? I see the db but not the game :o 

    Click refresh :(   Right click and refresh

    Try to read pastebin logs.

    Kind Regards

    Ken

    Hello,

    i don't know how i can define the Mysql Function, but i compile the game new with the makefile from mainline and then it create a test and a game file. But!!! After 10 seconds the test and the game file (62 MB) get deleted :o  The game file is for 10 seconds there but then it is deleted :o Why this lol?

    questlua_mysql.cpp

    #include "stdafx.h"
    #include "db.h"
    
    namespace quest
    {
            int mysql_query(lua_State * L)
            {
                    return 0;
            }
            
            void RegisterMysqlFunctionTable()
            {
                    luaL_reg mysql_functions[] =
                    {
                            { "query", mysql_query },
                            { NULL, NULL },
                    };
                    
                    CQuestManager::instance().AddLuaFunctionTable("mysql", mysql_functions);
            }
    }

    questlua.cpp

            bool CQuestManager::InitializeLua()
            {
                    L = lua_open();
    
                    luaopen_base(L);
                    luaopen_table(L);
                    luaopen_string(L);
                    luaopen_math(L);
                    //TEMP
                    luaopen_io(L);
                    luaopen_debug(L);
    
                    RegisterAffectFunctionTable();
                    RegisterBuildingFunctionTable();
                    RegisterDungeonFunctionTable();
                    RegisterGameFunctionTable();
                    RegisterGuildFunctionTable();
                    RegisterHorseFunctionTable();
    #ifdef __PET_SYSTEM__
                    RegisterPetFunctionTable();
    #endif
                    RegisterITEMFunctionTable();
                    RegisterMarriageFunctionTable();
                    RegisterNPCFunctionTable();
                    RegisterPartyFunctionTable();
                    RegisterPCFunctionTable();
                    RegisterQuestFunctionTable();
                    RegisterTargetFunctionTable();
                    RegisterArenaFunctionTable();
                    RegisterForkedFunctionTable();
                    RegisterMonarchFunctionTable(); 
                    RegisterOXEventFunctionTable();
                    RegisterMgmtFunctionTable();
                    RegisterBattleArenaFunctionTable();
                    RegisterDanceEventFunctionTable();
                    RegisterDragonLairFunctionTable();
                    RegisterSpeedServerFunctionTable();
                    RegisterDragonSoulFunctionTable();
                    RegisterMysqlFunctionTable();
    
                    {
                            luaL_reg member_functions[] = 
                            {
                                    { "chat",			member_chat		},
                                    { "set_ready",			member_set_ready	},
                                    { "clear_ready",		member_clear_ready	},
                                    { NULL,				NULL			}
                            };
    
                            AddLuaFunctionTable("member", member_functions);
                    }
    
                    {
                            luaL_reg highscore_functions[] = 
                            {
                                    { "register",			highscore_register	},
                                    { "show",			highscore_show		},
                                    { NULL,				NULL			}
                            };
    
                            AddLuaFunctionTable("highscore", highscore_functions);
                    }
    
                    {
                            luaL_reg mob_functions[] =
                            {
                                    { "spawn",			mob_spawn		},
                                    { "spawn_group",		mob_spawn_group		},
                                    { NULL,				NULL			}
                            };
    
                            AddLuaFunctionTable("mob", mob_functions);
                    }
    
                    //
                    // global namespace functions
                    //
                    RegisterGlobalFunctionTable(L);
    
                    // LUA_INIT_ERROR_MESSAGE
                    {
                            char settingsFileName[256];
                            snprintf(settingsFileName, sizeof(settingsFileName), "%s/settings.lua", LocaleService_GetBasePath().c_str());
    
                            int settingsLoadingResult = lua_dofile(L, settingsFileName);
                            sys_log(0, "LoadSettings(%s), returns %d", settingsFileName, settingsLoadingResult);
                            if (settingsLoadingResult != 0)
                            {
                                    sys_err("LOAD_SETTINS_FAILURE(%s)", settingsFileName);
                                    return false;
                            }
                    }
    
                    {
                            char questlibFileName[256];
                            snprintf(questlibFileName, sizeof(questlibFileName), "%s/questlib.lua", LocaleService_GetQuestPath().c_str());
    
                            int questlibLoadingResult = lua_dofile(L, questlibFileName);
                            sys_log(0, "LoadQuestlib(%s), returns %d", questlibFileName, questlibLoadingResult);
                            if (questlibLoadingResult != 0)
                            {
                                    sys_err("LOAD_QUESTLIB_FAILURE(%s)", questlibFileName);
                                    return false;
                            }
                    }
    
                    if (LC_IsEurope())
                    {
                            char translateFileName[256];
                            snprintf(translateFileName, sizeof(translateFileName), "%s/translate.lua", LocaleService_GetBasePath().c_str());
    
                            int translateLoadingResult = lua_dofile(L, translateFileName);
                            sys_log(0, "LoadTranslate(%s), returns %d", translateFileName, translateLoadingResult);
                            if (translateLoadingResult != 0)
                            {
                                    sys_err("LOAD_TRANSLATE_ERROR(%s)", translateFileName);
                                    return false;
                            }
                    }
    
                    {
                            char questLocaleFileName[256];
                            if (LC_IsEurope())
                            {
                                    snprintf(questLocaleFileName, sizeof(questLocaleFileName), "%s/locale.lua", g_stQuestDir.c_str());
                            }
                            else
                            {
                                    snprintf(questLocaleFileName, sizeof(questLocaleFileName), "%s/locale_%s.lua", g_stQuestDir.c_str(), g_stLocale.c_str());
                            }
    
                            int questLocaleLoadingResult = lua_dofile(L, questLocaleFileName);
                            sys_log(0, "LoadQuestLocale(%s), returns %d", questLocaleFileName, questLocaleLoadingResult);
                            if (questLocaleLoadingResult != 0)
                            {
                                    sys_err("LoadQuestLocale(%s) FAILURE", questLocaleFileName);
                                    return false;
                            }
                    }
                    // END_OF_LUA_INIT_ERROR_MESSAGE
    
                    for (itertype(g_setQuestObjectDir) it = g_setQuestObjectDir.begin(); it != g_setQuestObjectDir.end(); ++it)
                    {
                            const string& stQuestObjectDir = *it;
                            char buf[PATH_MAX];
                            snprintf(buf, sizeof(buf), "%s/state/", stQuestObjectDir.c_str());
                            DIR * pdir = opendir(buf);
                            int iQuestIdx = 0;
    
                            if (pdir)
                            {
                                    dirent * pde;
    
                                    while ((pde = readdir(pdir)))
                                    {
                                            if (pde->d_name[0] == '.')
                                                    continue;
    
                                            snprintf(buf + 11, sizeof(buf) - 11, "%s", pde->d_name);
    
                                            RegisterQuest(pde->d_name, ++iQuestIdx);
                                            int ret = lua_dofile(L, (stQuestObjectDir + "/state/" + pde->d_name).c_str());
                                            sys_log(0, "QUEST: loading %s, returns %d", (stQuestObjectDir + "/state/" + pde->d_name).c_str(), ret);
    
                                            BuildStateIndexToName(pde->d_name);
                                    }
    
                                    closedir(pdir);
                            }
                    }
    
                    lua_setgcthreshold(L, 0);
    
                    lua_newtable(L);
                    lua_setglobal(L, "__codecache");
                    return true;
            }
    

     

    questlua.h

    #ifndef __HEADER_QUEST_LUA__
    #define __HEADER_QUEST_LUA__
    
    #include "quest.h"
    #include "buffer_manager.h"
    
    extern int test_server;
    extern int speed_server;
    
    namespace quest
    {
            extern void RegisterPCFunctionTable();
            extern void RegisterNPCFunctionTable();
            extern void RegisterTargetFunctionTable();
            extern void RegisterAffectFunctionTable();
            extern void RegisterBuildingFunctionTable();
            extern void RegisterMarriageFunctionTable();
            extern void RegisterITEMFunctionTable();
            extern void RegisterDungeonFunctionTable();
            extern void RegisterQuestFunctionTable();
            extern void RegisterPartyFunctionTable();
            extern void RegisterHorseFunctionTable();
            extern void RegisterPetFunctionTable();
            extern void RegisterGuildFunctionTable();
            extern void RegisterGameFunctionTable();
            extern void RegisterArenaFunctionTable();
            extern void RegisterGlobalFunctionTable(lua_State* L);
            extern void RegisterForkedFunctionTable();
            extern void RegisterMonarchFunctionTable(); 
            extern void RegisterOXEventFunctionTable();
            extern void RegisterMgmtFunctionTable();
            extern void RegisterBattleArenaFunctionTable();
            extern void RegisterDanceEventFunctionTable();
            extern void RegisterDragonLairFunctionTable();
            extern void RegisterSpeedServerFunctionTable();
            extern void RegisterDragonSoulFunctionTable();
            extern void RegisterMysqlFunctionTable();
    
            extern void combine_lua_string(lua_State* L, std::ostringstream &s);
            
            struct FSetWarpLocation
            {
                    long map_index; 
                    long x;
                    long y;
    
                    FSetWarpLocation (long _map_index, long _x, long _y) :
                            map_index (_map_index), x (_x), y (_y)
                    {}
                    void operator () (LPCHARACTER ch);
            };
    
            struct FSetQuestFlag
            {
                    std::string flagname;
                    int value;
    
                    void operator () (LPCHARACTER ch);
            };
    
            struct FPartyCheckFlagLt
            {
                    std::string flagname;
                    int value;
    
                    bool operator () (LPCHARACTER ch);
            };
    
            struct FPartyChat
            {
                    int iChatType;
                    const char* str;
    
                    FPartyChat(int ChatType, const char* str);
                    void operator() (LPCHARACTER ch);
            };
    
            struct FPartyClearReady
            {
                    void operator() (LPCHARACTER ch);
            };
    
            struct FSendPacket
            {
                    TEMP_BUFFER buf;
    
                    void operator() (LPENTITY ent);
            };
    
            struct FSendPacketToEmpire
            {
                    TEMP_BUFFER buf;
                    BYTE bEmpire;
    
                    void operator() (LPENTITY ent);
            };
    
            struct FWarpEmpire
            {
                    BYTE m_bEmpire;
                    long m_lMapIndexTo;
                    long m_x;
                    long m_y;
    
                    void operator() (LPENTITY ent);
            };
    
            EVENTINFO(warp_all_to_map_my_empire_event_info)
            {
                    BYTE 	m_bEmpire;
                    long	m_lMapIndexFrom;
                    long 	m_lMapIndexTo;
                    long 	m_x;
                    long	m_y;
    
                    warp_all_to_map_my_empire_event_info() 
                    : m_bEmpire( 0 )
                    , m_lMapIndexFrom( 0 )
                    , m_lMapIndexTo( 0 )
                    , m_x( 0 )
                    , m_y( 0 )
                    {
                    }
            };
    
            EVENTFUNC(warp_all_to_map_my_empire_event);
    
            struct FBuildLuaGuildWarList
            {
                    lua_State * L;
                    int m_count;
    
                    FBuildLuaGuildWarList(lua_State * L);
                    void operator() (DWORD g1, DWORD g2);
            };
    }
    #endif /*__HEADER_QUEST_LUA__*/
    
    

     

    You can see your game file for 10 seconds because it's linking by gmake. If there is any error in progress, system is going to remove this file.

    Kind Regards

    Ken

  3. The ldd utility displays all shared objects that are needed to run	the
    given program or to load the given	shared object.	Contrary to nm(1), the
    list includes ``indirect''	dependencies that are the result of needed
    shared objects which themselves depend on yet other shared	objects.

    Try to use ldd for learn library files for your game file. If there is missing library file, put the files in /usr/lib32

    ldd fileName

    Kind Regards

    Ken

    • Love 1
  4. http://pastebin.com/tY1hNKYa

    If i have to talk about your second game log, you can't see your game file because system is gives to error.

    OBJDIR/questlua.o: In function `OBJDIR/questlua.o: In function `quest::CQuestManager::InitializeLua()':
    /usr/src/mainline_released/mainline_sg/Srcs/Server/game/src/questlua.cpp:493: undefined reference to `quest::RegisterMysqlFunctionTable()'
    quest::CQuestManager::InitializeLua()':
    /usr/src/mainline_released/mainline_sg/Srcs/Server/game/src/questlua.cpp:493: undefined reference to `quest::RegisterMysqlFunctionTable()'

    You have to define RegisterMysqlFunctionTable().

    That is true, but my game file is not there. If i compile without wolfman files then it is there, but with wolfman files it is not there. But in the logs are no errors or? I see the db but not the game :o 

    Click refresh :(   Right click and refresh

    Try to read pastebin logs.

    Kind Regards

    Ken

  5. int npc_get_level(lua_State* L)
    {
            lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetLevel());
            return 1;
    }

    Wrong.

    int npc_get_level(lua_State * L)
    {
            LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
            lua_pushnumber(L, npc ? npc->GetLevel() : 0);
            return 0;
    }

    Kind Regards

    Ken

    • Love 1
  6. static bool CanMoveIntoBeltInventory(LPITEM item)
    {
            if (!item)
                    return false;
            
            bool bCanMove = false;
            
            int ariClawVnums[] = { 6019, 6029, 6039, 6049 };
            for (size_t i = 0; i < _countof(ariClawVnums); ++i)
            {
                    if (item->GetVnum() == ariClawVnums[i])
                            bCanMove = true;		
            }
            
            if (item->GetVnum() == ITEM_USE)
            {
                    switch (item->GetSubType())
                    {
                            case USE_POTION:
                            case USE_POTION_DELAY:
                            case USE_ABILITY_UP:
                                    bCanMove = true;
                                    break;
                    }
            }
            
            return bCanMove;
    }

    _countof or countof :

    template < typename T, size_t N >
    size_t countof( T ( & arr )[ N ] )
    {
            return std::extent< T[ N ] >::value;
    }

     

    Usefull codes.

    Kind Regards

    Ken

    • Love 1
  7. The key should be M(Message).

    def __PressMKey(self):
            if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
                    if (interfaceModule.IsWhisperHide == 0):
                            self.interface.HideAllWhisperButton()
                            interfaceModule.IsWhisperHide = 1			
                    else:
                            self.interface.ShowAllWhisperButton()
                            interfaceModule.IsWhisperHide = 0			

    Kind Regards

    Ken

    and attack must be with A not with space ... my point it's doesn't matter P ~ Q ~ R ... or whatever :P

    Space should be jump but it's not gonna happen :) Some dream is not gonna happen. That's golden rule in this world ;) 

    • Love 2
  8. The key should be M(Message).

    def __PressMKey(self):
            if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
                    if (interfaceModule.IsWhisperHide == 0):
                            self.interface.HideAllWhisperButton()
                            interfaceModule.IsWhisperHide = 1			
                    else:
                            self.interface.ShowAllWhisperButton()
                            interfaceModule.IsWhisperHide = 0			

    Kind Regards

    Ken

    • Love 1
  9. void CHARACTER::ChannelSwitch(int iNewChannel)
    {
            long lAddr, lMapIndex;
            WORD wPort;
            
            long x = GetX();
            long y = GetY();
            
            if (!CMapLocation::Instance().Get(x, y, lMapIndex, lAddr, wPort))
            {
                    sys_err("Can not find map location index[%ld] x[%ld] y[%ld] name[%s]", lMapIndex, x, y, GetName());
                    return;
            }
            
            if (lMapIndex >= 10000)
                    return;
            
            std::map<WORD, BYTE> ChannelsPorts;
            for (BYTE i = 0; i < 4; i++)
            {
                    for (BYTE j = 2; j < 9; j++)
                            ChannelsPorts[13 * 1000 + (i * 100) + j] = i + 1;
            }
            
            int iChannel = ChannelsPorts.find(wPort) != ChannelsPorts.end() ? ChannelsPorts[wPort] : 0;
            
            if (iChannel == 0)
            {
                    sys_err("This port is not available! (%d)", wPort);
                    return;
            }
                    
            Stop();
            Save();
            
            if (GetSectree())
            {
                    GetSectree()->RemoveEntity(this);
                    ViewCleanUp();
                    EncodeRemovePacket(this);
            }
            
            TPacketGCWarp p;
            p.bHeader 	= HEADER_GC_WARP;
            p.lX 		= x;
            p.lY 		= y;
            p.lAddr		= lAddr;
            p.wPort		= (wPort - 100 * (iChannel - 1) + 100 * (iNewChannel - 1));
            
            GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
    }

    Kind Regards

    Ken

    • Love 1
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.