Jump to content

anton96

Inactive Member
  • Posts

    9
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by anton96

  1. On 5/20/2023 at 7:15 PM, Intel said:

    Of course it makes sense, if you edit it (otherwise just clean it).

    Also, technically, they can drop from a dog.

    	std::vector<CItemDropInfo>::iterator it = g_vec_pkCommonDropItem[bRank].begin();
    
    	while (it != g_vec_pkCommonDropItem[bRank].end())
    	{
    		const CItemDropInfo & c_rInfo = *(it++);
    
    		if(iLevel < c_rInfo.m_iLevelStart || iLevel > c_rInfo.m_iLevelEnd)
    			continue;
    
    		TItemTable * table = GetTable(c_rInfo.m_dwVnum);
    
    		if(!table)
    			continue;
    
    		int rarity = CalculateDropRarityCommonDropItem((c_rInfo.m_iPercent * iDeltaPercent) / 100, iRandRange);
    		if(rarity){
    			vec_item.emplace_back(std::make_tuple(c_rInfo.m_dwVnum, 1, rarity));
    		}
    	}
    
    
    
    uint8_t CalculateDropRarityCommonDropItem(const uint32_t pct, const uint32_t randRange)
    {
    	uint8_t rarity = 0;
    	if(pct <= 0){
    		return rarity;
    	}
    
    	const float realPct = static_cast<float>(pct)/randRange;
    	const float minimumPct = 1.0f/randRange;
    
    	if(realPct >= 1.0f)
    		rarity = 1;
    	else if(realPct < 1.0f && realPct >= 0.05f)
    		rarity = 2;
    	else if(realPct < 0.05f && realPct >= 0.0025f)
    		rarity = 3;
    	else if(realPct < 0.0025f && realPct >= 0.00125f)
    		rarity = 4;
    	else if(realPct < 0.00125 && realPct >= 0.00025f)
    		rarity = 5;
    	else if(realPct < 0.00025f && realPct > minimumPct)
    		rarity = 6;
    	
    	return rarity;
    }

    I can assure you, rarity will not be 0 and a player lv60 would see the drop if the range is that high (although it would be very very very very low)

    Should this be placed under :?

    #ifdef __SEND_TARGET_INFO__
    bool ITEM_MANAGER::CreateDropItemVector(LPCHARACTER pkChr, LPCHARACTER pkKiller, std::vector<LPITEM> & vec_item)
    {
    	if (pkChr->IsPolymorphed() || pkChr->IsPC())
    	{
    		return false;
    	}
    
    	int iLevel = pkKiller->GetLevel();
    
    	BYTE bRank = pkChr->GetMobRank();
    	LPITEM item = NULL;
    
    	std::vector<CItemDropInfo>::iterator it = g_vec_pkCommonDropItem[bRank].begin();

    Or does it go under :?

    bool ITEM_MANAGER::CreateDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, std::vector<LPITEM> & vec_item)
    {
    	int iLevel = pkKiller->GetLevel();
    
    	int iDeltaPercent, iRandRange;
    	if (!GetDropPct(pkChr, pkKiller, iDeltaPercent, iRandRange))
    		return false;
    
    	BYTE bRank = pkChr->GetMobRank();
    	LPITEM item = NULL;
    
    	// Common Drop Items
    std::vector<CItemDropInfo>::iterator it = g_vec_pkCommonDropItem[bRank].begin();

    I've gotten a bit confused as to what should calculate drop rate should replace...

  2. On 5/15/2023 at 2:25 PM, Intel said:

    I don't think your players would enjoy to be inundated by low level/useless items anyway.. but you can choose not to show the common_drop_item stuff

     

     

    do those items from common drop item actually drop? I've never seen a lvl 61 weapon drop from a dog or wolf.

    How do I choose not to show the common_drop_item stuff?

    does it make any sense to show the drops from common_drop_item in the target information system?

     

  3. if ur getting error:

    Spoiler

    cmd_gm.cpp:933:30: error: no member named 'BuildMap' in 'SECTREE_MANAGER' SECTREE_MANAGER::instance().BuildMap(mapIndex, LocaleService_GetMapPath().c_str()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ compile desc_manager.cpp compile desc_p2p.cpp 1 error generated. gmake: *** [Makefile:102: OBJDIR/cmd_gm.o] Error 1 code is ACMD(reload_regen) { std::vector<LPEVENT> regenEvent = SECTREE_MANAGER::instance().GetRegenEvent(ch->GetMapIndex()); for (std::vector<LPEVENT>::iterator it = regenEvent.begin(); it != regenEvent.end(); ++it) { event_cancel(&(*it)); } FuncPurge func(ch); func.m_bAll = true; LPSECTREE_MAP lm = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex()); lm->for_each(func); char * mapIndex; mapIndex = number_to_str(ch->GetMapIndex(), 10); SECTREE_MANAGER::instance().BuildMap(mapIndex, LocaleService_GetMapPath().c_str()); }

    add:

     

    Spoiler

    int BuildMap(const char* mapIndex, const char* mapPath);

    under
     

    Spoiler

            void        AddRegenEventToMap(long lMapIndex, LPEVENT event) { m_mapRegen[lMapIndex].push_back(event); }
            std::vector<LPEVENT>        GetRegenEvent(long lMapIndex) { return m_mapRegen[lMapIndex]; }

    in sectree_manager.h

    • Love 1
  4. On 11/13/2015 at 2:59 AM, wezt said:

    Hi, try to change crc hash to md5, it helped me.

     

      Reveal hidden contents

     

    In Common.cs

    Add this in begging of the file:

    using System.Security.Cryptography;

    and after:

            public static string GetHash(string Name)
            {
                if (Name == string.Empty)
                    return string.Empty;
    
                CRC crc = new CRC();
    
                string Hash = string.Empty;
    
                using (FileStream fileStream = File.Open(Name, FileMode.Open))
                {
                    foreach (byte b in crc.ComputeHash(fileStream))
                    {
                        Hash += b.ToString("x2").ToLower();
                    }
                }
    
                return Hash;
            }

    add:

            public static string CalculateMD5Hash(string Name)
            {
                if (Name == string.Empty)
                    return null;
    
                MD5 md5 = System.Security.Cryptography.MD5.Create();
    
                string Hash = string.Empty;
    
                try
                {
                    using (FileStream fileStream = File.Open(Name, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        foreach (byte b in md5.ComputeHash(fileStream))
                        {
                            Hash += b.ToString("x2").ToLower();
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Can't open: " + Name);
                }
    
                return Hash;
            }

    In FileChecker.cs find:

    if (!File.Exists(file.Name) || Common.GetHash(file.Name) != file.Hash)

    and replace with:

    if (!File.Exists(file.Name) || Common.CalculateMD5Hash(file.Name) != file.Hash)

    After these changes you'll have MD5 Patcher :)

    PS: Atm I'm experiencing some problems with progress bar, will add solution if I'll find it.

     

     

     

     

    Also I'd like to share php script which generate patchlist.txt (probably will be useful for someone):

      Hide contents

     

    <?php
    /*
    Usage: Upload this file to the web-server, in folder with patchlist.txt and open it in browser.
    Note: I recommend to protect this file from public usage with password (put file in folder, change output file and directory path and and use .htaccess)
    */
    function list_directory($dir) {
    	$file_list = array();
    	$stack[] = $dir;
    
    	while ($stack) {
    		$current_dir = array_pop($stack);
    		if ($dh = opendir($current_dir)) {
    			while (($file = readdir($dh)) !== false) {
    				if ($file !== '.' AND $file !== '..') {
    					$current_file = "{$current_dir}/{$file}";
    					$report = array();
    					if (is_file($current_file)) {
    						$file_list[] = "{$current_dir}/{$file}";
    					} elseif (is_dir($current_file)) {
    						$stack[] = $current_file;
    						$file_list[] = "{$current_dir}/{$file}/";
    					}
    				}
    			}
    		}
    	}
    
    	return $file_list;
    }
    
    $files = list_directory('.'); // Path to directory with files
    sort($files, SORT_NATURAL | SORT_FLAG_CASE);
    $line = "";
    foreach($files as $file)
    {
    	$hash = hash_file( 'crc32b', $file );
    	$size = filesize($file);
    
    	if($hash == "00000000" || preg_match("/patchlist/", $file))
    		continue;
    
    	$file_n = preg_replace("/^../","",$file);
    	echo $file_n . " " . $hash . " " . $size . "<br>";
    	$line .= $file_n . " " . $hash . " " . $size . "\r\n";
    }
    
    $handle = fopen("patchlist.txt", "w+"); // Path to output file
    fwrite($handle, $line);
    fclose($handle);
    ?>

     

    Best Regards

    Hi, I've done as indicated.
    After creating the patch list and using the patcher, everything downloads perfectly.

    If I close the patcher and open it up again, somehow it checks for the files and then redownloads all the files...

    anyone knows how to fix this?

  5. getting " Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\inc\configurare.php:11 Stack trace: #0 C:\xampp\htdocs\index.php(7): include_once() #1 {main} thrown in C:\xampp\htdocs\inc\configurare.php on line 11"

    any ideea why? I've done the config properly (typed down correct ip and pass like on I did when I tried different homepages) and I'm getting that error, different webpages work with same config.

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