Jump to content

Kafa

Inactive Member
  • Posts

    269
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Kafa

  1. import uiScriptLocale
    
    PATTERN_PATH			= "d:/ymir work/ui/pattern/"
    ROOT_PATH				= "d:/ymir work/ui/game/looting/"
    
    WINDOW_WIDTH			= 316
    WINDOW_HEIGHT			= 494
    
    PATTERN_WINDOW_WIDTH	= 294
    PATTERN_WINDOW_HEIGHT	= 390
    
    PATTERN_X_COUNT = (PATTERN_WINDOW_WIDTH - 32) / 16
    PATTERN_Y_COUNT = (PATTERN_WINDOW_HEIGHT - 32) / 16
    
    
    window = {
    	"name" : "LootingSystem",
    	"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_with_titlebar",
    			"style" : ("attach",),
    			
    			"x" : 0,
    			"y" : 0,
    			
    			"width" : WINDOW_WIDTH,
    			"height" : WINDOW_HEIGHT,
    			
    			"title" : uiScriptLocale.LOOTING_SYSTEM_TITLE,
    			
    			"children" :
    			(
    				## base pattern
    				{
    					"name" : "base_pattern",
    					"type" : "window",
    					"style" : ("attach", "ltr",),
    					
    					"x" : 10,
    					"y" : 32,
    					"width" : PATTERN_WINDOW_WIDTH,
    					"height" :PATTERN_WINDOW_HEIGHT,
    					
    					"children" :
    					(
    						## LeftTop 1
    						{
    							"name" : "pattern_left_top_img",
    							"type" : "image",
    							"style" : ("ltr",),
    							
    							"x" : 0,
    							"y" : 0,
    							"image" : PATTERN_PATH + "border_A_left_top.tga",
    						},
    						## RightTop 2
    						{
    							"name" : "pattern_right_top_img",
    							"type" : "image",
    							"style" : ("ltr",),
    							
    							"x" : PATTERN_WINDOW_WIDTH - 16,
    							"y" : 0,
    							"image" : PATTERN_PATH + "border_A_right_top.tga",
    						},
    						## LeftBottom 3
    						{
    							"name" : "pattern_left_bottom_img",
    							"type" : "image",
    							"style" : ("ltr",),
    							
    							"x" : 0,
    							"y" : PATTERN_WINDOW_HEIGHT - 16,
    							"image" : PATTERN_PATH + "border_A_left_bottom.tga",
    						},
    						## RightBottom 4
    						{
    							"name" : "pattern_right_bottom_img",
    							"type" : "image",
    							"style" : ("ltr",),
    							
    							"x" : PATTERN_WINDOW_WIDTH - 16,
    							"y" : PATTERN_WINDOW_HEIGHT - 16,
    							"image" : PATTERN_PATH + "border_A_right_bottom.tga",
    						},
    						## topcenterImg 5
    						{
    							"name" : "pattern_top_cetner_img",
    							"type" : "expanded_image",
    							"style" : ("ltr",),
    							
    							"x" : 16,
    							"y" : 0,
    							"image" : PATTERN_PATH + "border_A_top.tga",
    							"rect" : (0.0, 0.0, PATTERN_X_COUNT, 0),
    						},
    						## leftcenterImg 6
    						{
    							"name" : "pattern_left_center_img",
    							"type" : "expanded_image",
    							"style" : ("ltr",),
    							
    							"x" : 0,
    							"y" : 16,
    							"image" : PATTERN_PATH + "border_A_left.tga",
    							"rect" : (0.0, 0.0, 0, PATTERN_Y_COUNT),
    						},
    						## rightcenterImg 7
    						{
    							"name" : "pattern_right_center_img",
    							"type" : "expanded_image",
    							"style" : ("ltr",),
    							
    							"x" : PATTERN_WINDOW_WIDTH - 16,
    							"y" : 16,
    							"image" : PATTERN_PATH + "border_A_right.tga",
    							"rect" : (0.0, 0.0, 0, PATTERN_Y_COUNT),
    						},
    						## bottomcenterImg 8
    						{
    							"name" : "pattern_bottom_center_img",
    							"type" : "expanded_image",
    							"style" : ("ltr",),
    							
    							"x" : 16,
    							"y" : PATTERN_WINDOW_HEIGHT - 16,
    							"image" : PATTERN_PATH + "border_A_bottom.tga",
    							"rect" : (0.0, 0.0, PATTERN_X_COUNT, 0),
    						},
    						## centerImg
    						{
    							"name" : "pattern_center_img",
    							"type" : "expanded_image",
    							"style" : ("ltr",),
    							
    							"x" : 16,
    							"y" : 16,
    							"image" : PATTERN_PATH + "border_A_center.tga",
    							"rect" : (0.0, 0.0, PATTERN_X_COUNT, PATTERN_Y_COUNT),
    						},
    					),
    				},
    				
    				## object in pattern window
    				{
    					"name" : "object_area_window",
    					"type" : "window",
    					"style" : ("attach",),
    					
    					"x" : 10+5,
    					"y" : 32+5,
    					"width"		: 270,
    					"height"	: 380,
    				},
    
    				## scroll bar
    				{
    					"name" : "scroll_bar",
    					"type" : "scrollbar",
    
    					"x" : 286,
    					"y" : 36,
    					"size" : 380,
    				},
    				
    				## Init Button
    				{
    					"name" : "init_button",
    					"type" : "button",
    
    					"x" : 11,
    					"y" : 428,
    
    					"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",
    
    					"text" : uiScriptLocale.LOOTING_SYSTEM_INIT,
    				},
    				
    				## Save Button
    				{
    					"name" : "save_button",
    					"type" : "button",
    
    					"x" : 217,
    					"y" : 428,
    
    					"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",
    
    					"text" : uiScriptLocale.LOOTING_SYSTEM_SAVE,
    				},
    
    				## message
    				{
    					"name" : "message_window", "type" : "window", "x" : 18, "y" : 457, "width" : 279, "height" : 18, "style" : ("attach",),
    					"children" :
    					(
    						{ "name" : "message_bg",	"type" : "image", "style" : ("ltr", "attach", ), "x" : 0, "y" : 0, "image" : ROOT_PATH + "message_bg.sub", },
    						{ "name" : "message_text",	"type" : "text", "x":0, "y":0, "text": "", "all_align" : "center" },
    					),	
    				},
    			),
    		},
    	),	
    }

     

    Thanks buddy i added my uiscript file 😄 

    But i already tested that, now atleast the window movable  issue is fixed, but i cant click on anything still.

     

    I personally think its a issue of parent, but i couldnt fix it..

  2. Hey guys, i started trying to learn python, i have a problem i created a gui of loot filter, i created some buttons and images

    scrollbar works too, i only have the issue that nothing is clickable, i spent many hours (many) trying to fix the issue.

    i know my code is really bad.. i'm just trying to learn this, and its my first time.

     

    i'd be happy if someone can help me fixing the issue so i actually understand why nothing is clickable:

     

    LAXfjkz.gif

     

    here is my file: https://pastebin.com/hQkQQa7f

     

  3. On 7/9/2022 at 5:08 PM, Mafuyu said:

    yeah because its absolutly not necessary to extend it to dword or int because im only using 225 length, not even close to 255 so this could not be the problem

     

    edit: i now implemented your tut for 6 pages and DWORD but still have the absolute same problem:

    QPwwdOR.png

     

    edit: the problem was safebox.cpp the grids. Fixxed

    Nice bro, could u tell for others how exactly you fixed it ? 

    • Love 1
  4. 13 minutes ago, Mafuyu said:

    mm8m1h8.png

     

    any ideas? someone has the same problem? giving 2 size items in last slot will made it look like this. Same with 3 size items with only 2 slots left on one side.

    I had the same issue, check your code again with visual studio maybe there is something byte. i forget how i fixed it.

    • Good 1
  5. Thanks for the release Owsap,

     

    i've got one question tho. In official the luck of getting additional attributes is based on the dragon stone.

     

    So if you change a mythical one with 1x 100700 

    it has a very very low chance to get an additional bonus, could you maybe change that? if not still thanks. ❤️ 

  6. 		else if (strType == "drop")
    		{
    			CDropItemGroup* pkGroup;
    			bool bNew = true;
    			itertype(m_map_pkDropItemGroup) it = m_map_pkDropItemGroup.find (iMobVnum);
    			if (it == m_map_pkDropItemGroup.end())
    			{
    				pkGroup = M2_NEW CDropItemGroup(0, iMobVnum, stName);
    			}
    			else
    			{
    				bNew = false;
    				CDropItemGroup* pkGroup = it->second;
    			}
    
    			for (int k = 1; k < 256; ++k)
    			{
    				char buf[4];
    				snprintf(buf, sizeof(buf), "%d", k);
    
    				if (loader.GetTokenVector(buf, &pTok))
    				{
    					std::string& name = pTok->at(0);
    					DWORD dwVnum = 0;
    
    					if (!GetVnumByOriginalName(name.c_str(), dwVnum))
    					{
    						str_to_number(dwVnum, name.c_str());
    						if (!ITEM_MANAGER::instance().GetTable(dwVnum))
    						{
    							sys_err("ReadDropItemGroup : there is no item %s : node %s", name.c_str(), stName.c_str());
    							M2_DELETE(pkGroup);
    
    							return false;
    						}
    					}
    
    					int iCount = 0;
    					str_to_number(iCount, pTok->at(1).c_str());
    
    					if (iCount < 1)
    					{
    						sys_err("ReadMonsterDropItemGroup : there is no count for item %s : node %s", name.c_str(), stName.c_str());
    						M2_DELETE(pkGroup);
    
    						return false;
    					}
    
    					float fPercent = atof(pTok->at(2).c_str());
    
    					DWORD dwPct = (DWORD)(10000.0f * fPercent);
    
    					sys_log(0,"        name %s pct %d count %d", name.c_str(), dwPct, iCount);
    					pkGroup->AddItem(dwVnum, dwPct, iCount);
    
    #ifdef __INGAME_WIKI__
    					CommonWikiData::TWikiInfoTable* tbl;
    					if ((tbl = GetItemWikiInfo(dwVnum)) && !tbl->origin_vnum)
    						tbl->origin_vnum = iMobVnum;
    
    					auto pTableTemp = GetTable(dwVnum);
    					DWORD currVnum = dwVnum;
    					DWORD startRefineVnum = GetWikiItemStartRefineVnum(dwVnum);
    					
    					if (pTableTemp && (pTableTemp->bType == ITEM_WEAPON || pTableTemp->bType == ITEM_ARMOR) && startRefineVnum != currVnum)
    						currVnum = (startRefineVnum != 0 ? startRefineVnum : currVnum);
    					
    					CommonWikiData::TWikiItemOriginInfo origin_info;
    					origin_info.set_vnum(iMobVnum);
    					origin_info.set_is_mob(true);
    					
    					m_itemOriginMap[currVnum].push_back(origin_info);
    					CMobManager::instance().GetMobWikiInfo(iMobVnum).push_back(CommonWikiData::TWikiMobDropInfo(dwVnum, iCount));
    #endif
    
    					continue;
    				}
    
    				break;
    			}
    			if (bNew)
    				m_map_pkDropItemGroup.insert(std::map<DWORD, CDropItemGroup*>::value_type(iMobVnum, pkGroup));
    
    		}

     

     

    Error:Run-Time Check Failure #3 - The variable 'pkGroup' is being used without being initialized. At C:\Users\anil_\Documents\mainline\Srcs\Server\game\src\item_manager_read_tables.cpp:863

     

    Line 863 is: pkGroup->AddItem(dwVnum, dwPct, iCount);

    Would be nice if someone is helping, i dont understand this error. 😞😄 

     

  7. 10 minutes ago, xP3NG3Rx said:

    I don't think so that this will help you, but here it is what you asked for.

      Reveal hidden contents
    PyObject * playerGetElementByVID(PyObject* poSelf, PyObject* poArgs)
    {
    	DWORD dwVID = 0;
    	if (!PyTuple_GetUnsignedLong(poArgs, 0, &dwVID))
    		return Py_BadArgument();
    
    	CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(dwVID);
    	if (!pTargetInstance)
    		return Py_BuildValue("i", 0);
    
    	CItemData * pPendantItem = NULL;
    	const DWORD dwItemVnum = pTargetInstance->GetPart(CRaceData::PART_PENDANT);
    	if (CItemManager::Instance().GetItemDataPointer(dwItemVnum, &pPendantItem))
    	{
    		for (BYTE i = 0; i < CItemData::ITEM_APPLY_MAX_NUM; ++i)
    		{
    			CItemData::TItemApply ItemApply;
    			if (!pPendantItem->GetApply(i, &ItemApply))
    				return Py_BuildException();
    
    			switch (ItemApply.wType)
    			{
    			case CItemData::APPLY_ENCHANT_ELECT:
    				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_ELEC);
    				break;
    			case CItemData::APPLY_ENCHANT_FIRE:
    				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_FIRE);
    				break;
    			case CItemData::APPLY_ENCHANT_ICE:
    				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_ICE);
    				break;
    			case CItemData::APPLY_ENCHANT_WIND:
    				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_WIND);
    				break;
    			case CItemData::APPLY_ENCHANT_EARTH:
    				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_EARTH);
    				break;
    			case CItemData::APPLY_ENCHANT_DARK:
    				return Py_BuildValue("i", CPythonNonPlayer::RACE_FLAG_ATT_DARK);
    				break;
    			default:
    				continue;
    			}
    		}
    	}
    
    	return Py_BuildValue("i", 0);
    }
      Reveal hidden contents
    int __cdecl playerGetElementByVID(int a1, int a2)
    {
        int result; // eax
        char v3; // al
        __int16 v4[4]; // [esp+8h] [ebp-1Ch] BYREF
        int i; // [esp+10h] [ebp-14h]
        int v6; // [esp+14h] [ebp-10h] BYREF
        _WORD *v7; // [esp+18h] [ebp-Ch] BYREF
        int v9; // [esp+20h] [ebp-4h]
    
        if ( !PyTuple_GetUnsignedLong(a2, 0, &v6) )
            return Py_BadArgument();
        v9 = CPythonCharacterManager;
        if ( !(*(int (__thiscall **)(int, int))(*(_DWORD *)(CPythonCharacterManager + 4) + 8))(
                  CPythonCharacterManager + 4,
                  v6) )
            return Py_BuildValue("i", 0);
        v3 = CInstanceBase::GetPart(6);
        if ( CItemManager::GetItemDataPointer(v3, &v7) )
        {
            for ( i = 0; i < 4; ++i )
            {
                if ( CItemData::GetApply(v7, i, (int)v4) )
                {
                    switch ( v4[0] )
                    {
                        case 99:
                            result = Py_BuildValue("i", 2048);
                            break;
                        case 100:
                            result = Py_BuildValue("i", 4096);
                            break;
                        case 101:
                            result = Py_BuildValue("i", 8192);
                            break;
                        case 102:
                            result = Py_BuildValue("i", 16384);
                            break;
                        case 103:
                            result = Py_BuildValue("i", 32768);
                            break;
                        case 104:
                            result = Py_BuildValue("i", 65536);
                            break;
                        default:
                            continue;
                    }
                    return result;
                }
            }
        }
        return Py_BuildValue("i", 0);
    }

     

     

    Btw this code has been completely removed after the renewal of the pendant system. They changed the way of the system, for monsters the values are inside the mob_proto, and for players: the second parameter of the CPythonNetworkStream::SendTargetPacket function requests the data which will be loaded from the server through packet (CPythonNetworkStreamPhaseGame.cpp[CPythonNetworkStream::RecvTargetPacket] --> game.py[ShowTargetElementEnchant] --> uitarget.py[ShowElementImg]).

    This was exactly what i needed, thank you!!!!!!!!!!!!!!!!!!!!! ❤️ 

  8. Just now, Mali said:

    Bro auto hunt is new meme which you did.

    My message is not angry, I can't help with any errors you might make while installing libraries on windows.

    Ok bro.. i think i meight messed up the compilation of cpr. Could you compile it for windows and sent it to me? Only if you have time. I'm sorry.

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