Jump to content

VegaS

Banned
  • Posts

    363
  • Joined

  • Last visited

  • Days Won

    40
  • Feedback

    0%

Posts posted by VegaS

  1. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Spoiler

    2328189c5fa30e5cd1111eacad5dd147a4d7d4.g

    Perhaps it will be useful for some people for various systems.

    Have fun.

    #	onPressKeyDict[app.DIK_F5]	= lambda : self.Print() # For test function @root/game.py
    def Print(self):
    	import app, chat
    	list = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" # Set list
    	maxStr = 10 # Set the maximum number of characters
    	k = ""
      
    	for v in xrange(maxStr): k = k + list[app.GetRandom(0, len(list) - 1)]
    	chat.AppendChat(chat.CHAT_TYPE_INFO, "Result word: %s" % str(k))

     

    • Metin2 Dev 1
    • Love 4
  2. 27 minutes ago, Jorila said:

    You are great. :)
    can you add  a "anti pvp function" for any maps? :D

    example: user @VegaS cannot attack User @martysama0134 but user @VegaS can attack a mob/stone/boss - for farmmaps

    Of course.

    Spoiler
    
    //@svn/Source/Client/UserInterface/PythonPlayerEventHandler.cpp
    //1.) Search:
    void CPythonPlayerEventHandler::OnHit(UINT uSkill, CActorInstance& rkActorVictim, BOOL isSendPacket)
    {
    //2.) Add bellow:
    	static std::string uCurrentMap = CPythonBackground::Instance().GetWarpMapName();
    	static std::string uArrayListOfMaps[] = {
    		"metin2_map_a1",
    		"metin2_map_b1",	/* loaded from atlasinfo.txt */
    		"metin2_map_c1"
    	}; 		
    	
    	for (int i=0;i<_countof(uArrayListOfMaps);i++)
    	{
    		if (rkActorVictim.IsPC() && (!uCurrentMap.compare(uArrayListOfMaps[i])))
    		{
    			TraceError("CPythonPlayerEventHandler::OnHit on map %s was blocked because players is protected.", uArrayListOfMaps[i].c_str());
    			return;
    		}
    	}
    
    //3.) And add on first line or where you want:
    #include "PythonBackground.h"

     

     

    • Love 4
  3. M2 Download Center

    This is the hidden content, please
    ( Internal )

    For who want in client-side:

    Spoiler
    
    
    //@svn/Source/Client/UserInterface/InstanceBaseBattle.cpp
    //1.) Search:
    bool CInstanceBase::NEW_UseSkill(UINT uSkill, UINT uMot, UINT uMotLoopCount, bool isMovingSkill)
    {
    //2.) Add bellow:
    #ifdef ENABLE_FEATURES_BLOCK_SKILL
    	static std::string uCurrentMap = CPythonBackground::Instance().GetWarpMapName();
    	static std::string uArrayListOfMaps[] = {
    		"metin2_map_a1",
    		"metin2_map_b1",	/* loaded from atlasinfo.txt */
    		"metin2_map_c1"
    	}; 		
    	
    	for (int i=0;i<_countof(uArrayListOfMaps);i++)
    	{
    		if (!IsGameMaster() && (!uCurrentMap.compare(uArrayListOfMaps[i])))
    		{
    			TraceError("CInstanceBase::UseSkill on map %s was blocked.", uArrayListOfMaps[i].c_str());
    			return false;
    		}
    	}
    #endif

     

    For who want in server-side:

    Spoiler
    
    
    //@svn/Server/game/src/game/char_skill.cpp
    //1.) Search:
    	if (0 == dwSkillVnum) return false;
    //2.) Add bellow:
    #ifdef ENABLE_FEATURES_BLOCK_SKILL
    	static int arrayMapIndex[] = {
    		1, 21, 41 /* loaded from map/index.txt */
    	}; 		
    	
    	for (int i=0;i<_countof(arrayMapIndex);i++)
    	{
    		if (!IsGM() && GetMapIndex() == arrayMapIndex[i])
    		{
    			ChatPacket(CHAT_TYPE_NOTICE, "CHARACTER::UseSkill on mapIndex %d was blocked.", arrayMapIndex[i]);
    			return false;
    		}
    	}
    #endif

     

     

    • Metin2 Dev 16
    • Good 3
    • Love 4
    • Love 21
  4. Debug:

    8e983898c89c43f5882807ea53565283.png

    //@svn/Server/game/common/service.h
    	#define ENABLE_LUA_FUNCTION_TIME
    
    //@svn/Server/game/src/game/questlua_global.cpp
    //1.) Search:
    	int _get_global_time(lua_State* L)
    	{
    		lua_pushnumber(L, get_global_time());
    		return 1;
    	}
    //2.) Add bellow:
    #ifdef ENABLE_LUA_FUNCTION_TIME
    	/* © Dick of VegaS™ */
    	#include <time.h>       /* time_t, struct tm, time, localtime */
    
    	int _print_datetime(lua_State* L)
    	{
    		time_t currentTime;
    		struct tm *localTime;
    		
    		time(&currentTime);
    		localTime = localtime(&currentTime);
    		CQuestManager::Instance().GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_NOTICE, "%s", asctime(localTime));
    		return 0;
    	}
    #endif
    //3.) Search:
    			{	"get_global_time",				_get_global_time				},
    //4.) Add bellow:
    #ifdef ENABLE_LUA_FUNCTION_TIME
    			{	"print_datetime",				_print_datetime					},
    #endif
    
    //@usr/home/game/share/locale/germany/quest_functions:
    print_datetime
    
    //@usr/home/game/share/locale/germany/lua_test.lua:
    quest lua_test begin
        state start begin
            when login begin
                print_datetime()
            end
        end
    end

    If u want to check only one things you can call with this example:

    	int mYear = localTime->tm_year;	
    	CQuestManager::Instance().GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_NOTICE, "Year: %d", mYear);
    tm_sec  int   seconds after the minute  0-61*
    tm_min  int  minutes after the hour  0-59
    tm_hour  int  hours since midnight  0-23
    tm_mday  int  day of the month  1-31
    tm_mon  int  months since January  0-11
    tm_year  int  years since 1900  
    tm_wday  int  days since Sunday  0-6
    tm_yday  int  days since January 1  0-365
    tm_isdst  int  Daylight Saving Time flag
    • Love 1
  5. //@svn/Source/Client/UserInterface/InstanceBaseBattle.cpp
    //1.) Search:
    bool CInstanceBase::NEW_UseSkill(UINT uSkill, UINT uMot, UINT uMotLoopCount, bool isMovingSkill)
    {
    //2.) Add bellow:
    #ifdef ENABLE_DISABLE_ATTACK_SPECIALS_MAP
    	std::string uCurrentMap = CPythonBackground::Instance().GetWarpMapName();
    
    	static const char* uArrayListOfMaps[] = {
    		"metin2_map_a1",
    		"metin2_map_b1",
    		"metin2_map_c1"
    	}; /* loaded from atlasinfo.txt */		
    	
    	for (int arg=0; arg<_countof(uArrayListOfMaps); arg++)
    	{
    		if (IsPC() && uArrayListOfMaps[arg] == uCurrentMap)
    		{
    			TraceError("CInstanceBase::Skill on map %s was blocked. Vegas have big dick oOoOoOoOo", uArrayListOfMaps[arg]);
    			return false;
    		}
    	}
    #endif

     

  6. On 11/13/2016 at 2:12 PM, B0ne said:

    the .dll at : \source\UserInterface ?? 

    Here you have a small example to understand better.

    //@svn/Source/Client/UserInterface/Userinterface.cpp:
    int GetSizeOfMyDLL(char* fileName)
    {
    	HANDLE file = CreateFileA(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    	return GetSizeOfMyDLL(file, NULL);
    }
    
    int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
    	#define SIZE_DLL 16896
    	#define NAME_DLL "bdvid32.dll"
    	HINSTANCE hGetProcIDDLL = LoadLibrary(NAME_DLL);
    
    	if (hGetProcIDDLL == NULL) 
    	{
    		MessageBox(NULL, "The client can't start without one dll, please update autopatcher.", "#System Error", MB_ICONSTOP);  
    		return 0;
    	}
    	
    	else if (GetSizeOfMyDLL(NAME_DLL) != SIZE_DLL)
    	{
    		MessageBox(NULL, "DLL has been changed, please update autopatcher.", "#System Error", MB_ICONSTOP);
    		return 0;
    	}
    }

     

    • Love 2
  7. You can not do this because of pet time that you use that system by saving time is used by data type int value what was saved on storage mysql.
    You need to make a takeover increment in real time server and decrease in all columns baseline - 1 second.
    Which means you will have to do a query directly query that look like to do a check which consists if time is > 0, then you need a query and update query as noted above.

    Or you can do an event which is running throughout the game (as long as it receives no crash or other strokes), and through that event can decrease the time of each column of the table in mysql in real time.

    • Here you have 50% of ideea what i was say, for rest you need to use your brain or leave this method.
    //@set_global_time 
    //Small checks for formate a idea about what i was want to say.
    	std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT duration FROM user.table"));	
    		
    	MYSQL_ROW row;
    	int resLine = 0;
    	
    	for(int i = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++i) {
    		str_to_number(resLine, row[0]);
    	}
    			
    	if (resLine > 0)	
    	{
    		char sqQuery[QUERY_MAX_LEN + 1];
    		snprintf(sqQuery, sizeof(sqQuery), "UPDATE user.table SET duration = duration - 1");
    		std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(sqQuery));
    	}
    • You can create and a one vector like: std::vector<int> listDuration; and save all data from storage mysql with all duration and after that to check with one special pointer each and decrease duration.

    But anyway, these methods are crap and are not recommended, can not be too familiar with the subject because I do not know how the system works very well your pet so I can't pronounce to something more better on this information.

  8. You can test with this.

    //@svn/Client/UserInterface/InstanceBaseEffect.cpp
    void CInstanceBase::UpdateTextTailLevel(DWORD level)
    {
    	if (IsPC())
    	{
    		static D3DXCOLOR s_kLevelColor = D3DXCOLOR(152.0f/255.0f, 255.0f/255.0f, 51.0f/255.0f, 1.0f);
    		char szText[256];
    		char* szName[2] = {"[VIP]", "[Player]"}; /* Name of grade */
    		char* szColor[2] = {"d2d400", "09eeee"}; /* Color of grade: http://www.color-hex.com/color/ccffff */
    
    		if (IsVIP()) {
    			sprintf(szText, "|cFF%s%s|r Lv. %d", szColor[0], szName[0], level); }
    		else {
    			sprintf(szText, "|cFF%s%s|r Lv. %d", szColor[1], szName[1], level); }
    
    		CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
    	}
    }

     

  9. On 13.11.2016 at 6:18 PM, Gmmetinero said:

    Would you also like to add a simple quest?

    Lua will hate me now but you can try with this shit:

    --[[###########################	# Quest: Counting kills   #	###########################]]
    quest mob begin
    	state start begin
    		function res() return (pc.getqf("count_kills")) end
    		function count()
    			pc.setqf("count_kills", mob.res() + 1)
    			syschat(string.format("<Debug Mode> Now you killed mob: %s. Your counters of kills mobs was increased +1.", mob_name(npc.get_race())))
    		end
    
    	when kill with not npc.is_pc() begin
    		mob.count() end
    
    	when 70001.use begin
    		say_title("#Informations")
    		say(string.format("<Debug Mode> Result of all kils: %d.", mob.res()))
            end
        end
    end

     

    • Love 2
  10. It can make the quest easier, but I prefer the more in C++.

    Mqjzg.png

    //@svn/Source/Server/game/src/game/char_battle.cpp
    //1.) Search:
    void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead)
    {
    	if (IsDead())
    		return;
    //2.) Add bellow:
    #ifdef ENABLE_COUNTING_KILLS	
    	if (pkKiller->IsPC() && !IsPC())
    	{
    		CountingKills(pkKiller, this);	
    	}
    #endif
    //3.) Search:
    int CHARACTER::GetRealAlignment() const
    {
    	return m_iRealAlignment;
    }
    //4.) Add bellow:
    #ifdef ENABLE_COUNTING_KILLS
    void CountingKills(LPCHARACTER ch, LPCHARACTER tch)
    {
    /***************** Credits: VegaS *****************/
    	int numberCount, total;
    	std::string flag = "mob.count_kills";
    
    	numberCount = ch->GetQuestFlag(flag);
    	total = numberCount += 1;
    	ch->SetQuestFlag(flag, total);
    		
    	ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Now you killed mob: %s", tch->GetName());
    	ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Total counting of kills: %d.", numberCount);
    }
    #endif
    //@svn/Source/Server/game/src/common/service.h
    //Add where you want:
    #define ENABLE_COUNTING_KILLS

     

    //Example if you want to make special function to get counting kills:
    //CPP - char.cpp / char_battle.cpp / char_item.cpp etc.
    int CHARACTER::GetCountingKills()
    {
    	int res = ch->GetQuestFlag("mob.count_kills");
    	return res;
    }
    // Header - char.h
    	public:
    		int	GetCountingKills();
    
    //How to use:
    //Part for other function on source to result chat.
    		ch->ChatPacket(CHAT_TYPE_INFO, "<Debug> Total counting of kills: %d", ch->GetCountingKills());
    //Part for result in lua.
    //svn/Source/Server/game/src/game/questlua_pc.cpp
    	luaL_reg pc_functions[] = 
    	{
    		{ "get_counting_kills",        pc_get_counting_kills },
    	};
    	int pc_get_counting_kills(lua_State * L)
    	{	
    		lua_pushnumber(L, ch->GetCountingKills());
    		return 1;
    	}
    //yourquest.lua:
    	say(string.format("<Debug> Total counting of kills: %d", pc.get_counting_kills()))

     

    • Love 3
  11. d9e27a7ccb1085d7deb6d59858b162e4.gif

    //@root/introLoading.py
    //@Mr.Big Dick
    //1.) Search:
    			self.loadingGage=self.GetChild("FullGage")
    //2.) Add bellow:
    			self.loadingInfo = self.GetChild("LoadingInfo_Text")
    //3.) Search:
    			self.loadingGage.SetPercentage(2+98*p/100, 100)
    //4.) Add bellow:
    			self.loadingInfo.SetText("Loading: %s" % (self.txtLoadingProgressDict[p]))
    //5.) Search:
    		self.errMsg.Hide()
    //6.) Add bellow:
    		self.txtLoadingProgressDict = {
    			0: "InitData",      10: "Map",      30: "Sound",
    			40: "Effect",       50: "Warrior",  60: "Assasin",
    			70: "Sura",         80: "Shaman",   90: "Skill",
    			93: "Enemy",        97: "NPC",      98: "Guild Building",
    			100: "Start game"
    		}
    //@locale/xx/loadingwindow.py
    //1.) Search:
    					"name" : "FullGage",
    //2.) And add under this section: -> https://metin2.download/picture/bH38A0dGUpV6X9BXGgcJHh1c11Sqtzgo/.png
                    {
    					"name" : "LoadingInfo_Text", "type" : "text", "x" : 190, "y" : -20, "fontname" : "Tahoma:19", "text" : "",  "vertical_align" : "center",
    				},

     

    • Love 4
  12. On 07.11.2016 at 3:31 PM, ReFresh said:

    It showing format of server time badly. When is 13:04:02 it showing 13:4:2. Can somebody tell me how to solve it?

    Search:

    ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current time on server: %d:%d:%d", mResultHour, mResultMin, mResultSec);

    Delete and replace with:

    ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current local time and date on server: %s", asctime(localTime));

    Result:

    8e983898c89c43f5882807ea53565283.png

    • Love 1
  13. 21 minutes ago, myenglishisbad said:

    didn´t work

    Or maybe i'm not understand what you say? But here is a gif with test:

    b1e7b298b5d473fa8d6c1204115205ac.gif

     

    quest drop_test begin
    	state start begin
    		when kill begin
    			if npc.get_level() - pc.get_level() > 20 then
    				syschat(string.format("<Debug Mode> QUEST name -> [Mob = %d] | [You = %d]. The limit is greater than 20.", npc.get_level(), pc.get_level()))
    				return 
    			end
    		end
    	end
    end

     

  14. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Here is a small playground for owners of servers . xD

    I made a small improvements statics for players via command.

    1b6566bf9a264c0fadcbb06d54f7f44f.png

     

    //@svn/Server/common/service.h
    #define ENABLE_ONLINE_COMMAND
    #define ENABLE_COUNTER_FAKE //@ DISABLE IF YOU NOT WANT TO HAVE FAKE PLAYER ON COMMAND
    //@svn/Server/game/src/cmd.cpp
    //1.) Search:
    	{ "messenger_auth",	do_messenger_auth,	0,			POS_DEAD,	GM_PLAYER	},
    //2.)  Add bellow:
    #ifdef ENABLE_ONLINE_COMMAND
    	{ "online",	do_online,	0,			POS_DEAD,	GM_PLAYER	},
    #endif
    //1.) Search:
    ACMD(do_messenger_auth);
    //2.) Add bellow:
    #ifdef ENABLE_ONLINE_COMMAND
    	ACMD(do_online);
    #endif
      
    //@svn/Server/game/src/cmd_general.cpp
    //1.) Add where you want:
    ACMD(do_online)
    {
    /*********************************************************************
    * date        : 2016.10.25
    * file        : cmd_general.cpp
    * author      : VegaS
    * description : Statistics server + configuration for fake
    */
    	time_t currentTime;
    	struct tm *localTime;
    	
    	time(&currentTime);
    	localTime = localtime(&currentTime);
    #define ENABLE_OFFLINE_SHOP_SYSTEM //@disable if you not have offlineShop
    #ifdef ENABLE_OFFLINE_SHOP_SYSTEM
    	std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM player.offline_shop_npc WHERE owner_id and channel = %d", g_bChannel));
    	MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
    	
    	int	mShopsOffline = 0;
    	str_to_number(mShopsOffline, row[0]);
    #endif
    	int mResultHour = localTime->tm_hour, mResultMin = localTime->tm_min, mResultSec = localTime->tm_sec;	
    	int mTotalOnline;
    	int * mEmpire;
    	int mLocal;
    
    	DESC_MANAGER::instance().GetUserCount(mTotalOnline, &mEmpire, mLocal);
    /*
    	0 = 00:00	1 = 01:00	2 = 02:00	3 = 03:00	4 = 04:00	5 = 05:00
    	6 = 06:00	7 = 07:00	8 = 08:00	9 = 09:00	10 = 10:00	11 = 11:00
    	12 = 12:00	13 = 13:00	14 = 14:00	15 = 15:00	16 = 16:00	17 = 17:00	
    	18 = 18:00	19 = 19:00	20 = 20:00	21 = 21:00	22 = 22:00	23 = 23:00		
    */
    #ifdef ENABLE_COUNTER_FAKE
        static int arrayDesc[23 + 1][2] =
         {	/* 
              First row -> Current hour | Second row -> Value added for players fake 
              Example: From 15:00 until 15:59:59 will be added on statics + 75 players online fake. Because -> { 15, 75 }
    		*/
            { 0, 190  },     { 1, 175  },    { 2, 160  },	{ 3, 140  },     { 4, 130  },    { 5, 100  },
            { 6, 80   },     { 7, 75   },    { 8, 60   },	{ 9, 55   },     { 10, 40  },    { 11, 30  },
            { 12, 50  },     { 13, 60  },    { 14, 70  },	{ 15, 75  },     { 16, 80  },    { 17, 90  },
            { 18, 105 },     { 19, 120 },    { 20, 135 },	{ 21, 155 },     { 22, 175 },    { 23, 180 }
         };
    	
        for (int i=0; i<_countof(arrayDesc); i++) {
            if (mResultHour == arrayDesc[i][0])
            {
                for (int j=1; j<=3; j++)
                    mEmpire[i] += arrayDesc[i][1] / 3;
                mTotalOnline += arrayDesc[i][1];
                break;
            }
        }
    #endif
    	if (ch->IsGM())
    	{
    		ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current time on server: %d:%d:%d", mResultHour, mResultMin, mResultSec);
    	}
    
    	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current channel: [%d]", g_bChannel);	
    	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current players online on this channel (all empire): [%d]", mTotalOnline);
    	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current players online on empire: Shinshoo - [%d] | Chunjo - [%d] | Jinno - [%d]", mEmpire[1], mEmpire[2], mEmpire[3]);
    #ifdef ENABLE_OFFLINE_SHOP
    	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current shops offline on this channel: [%d]", mShopsOffline);
    #endif
    }

     

    Download:

    Have fun ^^ (not tested full, sorry for shit code, It was quickly made fun)

    • Metin2 Dev 11
    • kekw 1
    • Good 2
    • Love 10
×
×
  • 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.