Jump to content

r00t

Premium
  • Posts

    147
  • Joined

  • Last visited

  • Days Won

    2
  • Feedback

    0%

Posts posted by r00t

  1. Hello, i share my little fix (call it system is impossible 😅) to add automatically 4 bonus to all weapons and armor subtypes... i'm just bored to see "Reinforce Item" on sale from NPCs.
    Of course you can extend to add 5 bonus, in my case i prefer add only 4 bonus and to leave "Blessing Marble" dropped from mob.
    Work with items dropped from mob, items bought from NPCs, items created with /i command. 

    In common/CommonDefine.h add

    Spoiler
    
    
    
    #define __4_BONUS_DEFAULT__



    In game/item.cpp

    Spoiler

     Inside "void CItem::AlterToMagicItem()" function find:

    
    
    
    	if (number(1, 100) <= iSecondPct)
    		PutAttribute(aiItemMagicAttributePercentLow);
    
    	if (number(1, 100) <= iThirdPct)
    		PutAttribute(aiItemMagicAttributePercentLow);

    Replace with:

    
    
    
    #ifdef __4_BONUS_DEFAULT__
    	if ((GetType() == ITEM_WEAPON) || (GetType() == ITEM_ARMOR))
    	{
    		PutAttribute(aiItemMagicAttributePercentHigh);	// Second bonus
    		PutAttribute(aiItemMagicAttributePercentHigh);	// Third bonus
    		PutAttribute(aiItemMagicAttributePercentHigh);	// Fourth bonus
    	}
    	else
    	{
    		if (number(1, 100) <= iSecondPct)
    			PutAttribute(aiItemMagicAttributePercentLow);
    
    		if (number(1, 100) <= iThirdPct)
    			PutAttribute(aiItemMagicAttributePercentLow);
    	}
    #else
    	if (number(1, 100) <= iSecondPct)
    		PutAttribute(aiItemMagicAttributePercentLow);
    
    	if (number(1, 100) <= iThirdPct)
    		PutAttribute(aiItemMagicAttributePercentLow);
    #endif

     



    In game/item_manager.cpp

    Spoiler

     Inside "LPITEM ITEM_MANAGER::CreateItem(DWORD vnum, DWORD count, DWORD id, bool bTryMagic, int iRarePct, bool bSkipSave)" function find:

    
    
    
    		if (bTryMagic)
    		{
    			if (iRarePct == -1)
    				iRarePct = table->bAlterToMagicItemPct;
    
    			if (number(1, 100) <= iRarePct)
    				item->AlterToMagicItem();
    		}

    Replace with:

    
    
    
    		if (bTryMagic)
    		{
    #ifdef __4_BONUS_DEFAULT__
    			if ((item->GetType() == ITEM_WEAPON) || (item->GetType() == ITEM_ARMOR))
    			{
    				item->AlterToMagicItem();
    			}
    			else
    			{
    #endif
    			if (iRarePct == -1)
    				iRarePct = table->bAlterToMagicItemPct;
    
    			if (number(1, 100) <= iRarePct)
    				item->AlterToMagicItem();
    #ifdef __4_BONUS_DEFAULT__
    			}
    #endif
    		}

     



    In game/questlua_game.cpp

    Spoiler

     Inside "game_drop_item" function, find:

    
    
    
    		LPITEM item = ITEM_MANAGER::instance().CreateItem(item_vnum, count);

    Replace with:

    
    
    
    #ifdef __4_BONUS_DEFAULT__
    		LPITEM item = ITEM_MANAGER::instance().CreateItem(item_vnum, count, 0, true);
    #else
    		LPITEM item = ITEM_MANAGER::instance().CreateItem(item_vnum, count);
    #endif


    Inside "game_drop_item_with_ownership" function, find:

    
    
    
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1));

    Replace with:

    
    
    
    #ifdef __4_BONUS_DEFAULT__
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1), 1, 0, true);
    #else
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1));
    #endif


    Still in "game_drop_item_with_ownership" function, find:

    
    
    
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1), (int) lua_tonumber(L, 2));

    Replace with:

    
    
    
    #ifdef __4_BONUS_DEFAULT__
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1), (int) lua_tonumber(L, 2), 0, true);
    #else
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1), (int) lua_tonumber(L, 2));
    #endif


    Inside "game_drop_item_with_ownership_and_dice" function, find:

    
    
    
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1), (int) lua_tonumber(L, 2));

    Replace with:

    
    
    
    #ifdef __4_BONUS_DEFAULT__
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1), (int) lua_tonumber(L, 2), 0, true);
    #else
    			item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1), (int) lua_tonumber(L, 2));
    #endif

     

     

    In game/shop.cpp

    Spoiler

     Inside "int CShop::Buy(LPCHARACTER ch, BYTE pos)" function, find:

    
    
    
    		item = ITEM_MANAGER::instance().CreateItem(r_item.vnum, r_item.count);

    Replace with:

    
    
    
    #ifdef __4_BONUS_DEFAULT__
    		item = ITEM_MANAGER::instance().CreateItem(r_item.vnum, r_item.count, 0, true);
    #else
    		item = ITEM_MANAGER::instance().CreateItem(r_item.vnum, r_item.count);
    #endif

     


    A good combination is to implement also this:

     

    • Metin2 Dev 2
    • Good 1
  2. 14 hours ago, Krzychu20 said:

    actually i had another special database where i store my values, anyway i make it on my own way, in server game i added if statement with item value range and if value is in range, then i do select query and set attr, like for weapon etc :D so all working on server side, and people can't do anything with that on client side

    Query? For tooltip? It's db killer...if i move mouse in-out the slot 20times for second...db do 20query! 10player do this and you have 200query...

     

    Edit:better solution is to read new attr direct on boot (so you need to change sql select on db and add new values in items structure in client/server)...now you can read all informations from cache

    • Good 1
    • Love 1
  3. Oh God... this is Metin2! More is distance between attacker and victim, less is damage. There is a system, made from GF (or Ymir or whatever you want) that remove this problem: Quiver.

    Anyway... a fast solution is: 

    #Battle.cpp
    #Search: int CalcArrowDamage(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, LPITEM pkBow, LPITEM pkArrow, bool bIgnoreDefense)
    #In this function find: int iPercent = 100 - (iGap * 5);
    #Replace with:
    iPercent = 100;

     

×
×
  • 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.