Jump to content

Endymion

Member
  • Posts

    227
  • Joined

  • Last visited

  • Days Won

    5
  • Feedback

    0%

Posts posted by Endymion

  1. CMappedFile File;
    LPCVOID pData;
    
    if (!CEterPackManager::Instance().Get(File, szFileName, &pData))
    	return;
    
    CMemoryTextFileLoader textFileLoader;
    textFileLoader.Bind(File.Size(), pData);
    
    for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
    {
    	const std::string& c_rstLine = textFileLoader.GetLineString(i);
    	vRaceSpecular.emplace_back(atoi(c_rstLine.c_str()));
    }

     

    if (vRaceSpecular.find(GetRace()) != vRaceSpecular.cend())
    	fSpecular = 1.f;
    • Confused 1
  2. struct FCountRaceInMap
    {
    	size_t count;
    	uint32_t dwVnum;
    
    	FCountRaceInMap(uint32_t _dwVnum) : dwVnum(_dwVnum), count(0) {}
    
    	void operator() (LPENTITY ent)
    	{
    		if (!ent->IsType(ENTITY_CHARACTER))
    			return;
    
    		LPCHARACTER ch = static_cast<LPCHARACTER>(ent);
    		if (ch->IsPC())
    			return;
    
    		if (ch->GetRaceNum() == dwVnum)
    			++count;
    	}
    };
    
    size_t SECTREE_MANAGER::GetRaceCountInMap(long lMapIndex, uint32_t dwVnum) {
    	LPSECTREE_MAP sectree = SECTREE_MANAGER::instance().GetMap(lMapIndex);
    	if (!sectree)
    		return 0;
    
    	FCountRaceInMap f(dwVnum);
    	sectree->for_each(f);
    	return f.count;
    }

     

    It should work, but I didn't test.

    • Love 1
  3. 2 hours ago, TMP4 said:

    Keep in mind you can't cancel it lol. If you make a clear regen function, it will clear the map's basic regen too.

    If you want to cancel it would be better to use that map as a dungeon.

     

    didn't test but in theory it can works

    void regen_free_in_map(int32_t lMapIndex) {
    	for (auto& pRegen = regen_list; pRegen != nullptr; pRegen = pRegen->next) {
    		if (pRegen->lMapIndex == lMapIndex) {
    			if (pRegen->prev)
    				pRegen->prev->next = pRegen->next;
    			if (pRegen->next)
    				pRegen->next->prev = pRegen->prev;
    
    			event_cancel(&pRegen->event);
    			M2_DELETE(pRegen);
    		}
    	}
    }

     

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