Jump to content

meko

Core Developers
  • Content Count

    363
  • Joined

  • Days Won

    46

Posts posted by meko


  1. Cannot find -lcurl means you are missing libcurl: you should install it with your package manager (apt, yum, etc). Usually this package is named libcurl-dev or curl-dev. If it tells you that the package is a virtual/meta package provided by other packages then you must pick a flavour (openssl, libressl, gnutls, etc), This means on Ubuntu you likely want to install libcurl4-openssl-dev


  2. @Origami

    1. Put the hashtable.c file in Hercules/src/plugins
    2. Build the plugin
    3. Add "hashtable" to plugins_list in src/plugins.conf

  3. MF_LOADEVENT should be in uppercase. Also it might be faster to use a hash table than looping through the array (imagine having an array with 2k maps and doing a string comparison for each one of them every time someone enters the map)

    -	script	map_name	-1,{
    
    OnInit:
    	.maps = htnew(); // create a new hash table
    
    	// htput(.maps, "<map name>", "<map nick>");
    	htput(.maps, "prontera", "Prontera City, The Imperial Capital");
    	htput(.maps, "morocc", "Morroc Town, The Frontier");
    	htput(.maps, "geffen", "Geffen, The City of Magic");
    	htput(.maps, "payon", "Payon Town, The Upland Village");
    	htput(.maps, "alberta", "Alberta, The Port City");
    	htput(.maps, "izlude", "Izlude Town, The Satellite City of Prontera");
    	htput(.maps, "aldebaran", "Al De Baran, The Gate to the New World");
    	htput(.maps, "xmas", "Lutie, The City of Eternal Christmas");
    	htput(.maps, "comodo", "Comodo, The City of Fun and Celebrations");
    	htput(.maps, "yuno", "Juno, The Capital of the Commonwealth and Ancient Lore");
    	htput(.maps, "amatsu", "Amatsu, The New Land Discovered");
    	htput(.maps, "gonryun", "Gonryun, The Hermit Land");
    	htput(.maps, "umbala", "Umbala, The Lost Land");
    	htput(.maps, "niflheim", "Niffleheim, The Cold Land of Death");
    	htput(.maps, "louyang", "Louyang, The Fortress of Dragon");
    	htput(.maps, "new_1-1", "Training Ground");
    	htput(.maps, "sec_pri", "Valhalla Prison");
    	htput(.maps, "jawaii", "Jawaii, The Island of Love");
    	htput(.maps, "ayothaya", "Ayothaya, The Land of Majectic Culture");
    	htput(.maps, "einbroch", "Einbroch, The Steel City");
    	htput(.maps, "lighthalzen", "Lighthalzen, The City of Scientific Myths");
    	htput(.maps, "einbech", "Einbech, The Mining Town");
    	htput(.maps, "hugel", "Hugel, Between the Icy Moutain and Chilly Blue Sea");
    	htput(.maps, "rachel", "Rachel, The Capital City of Arunafeltz");
    	htput(.maps, "veins", "Veins, The Canyon Village");
    	htput(.maps, "mid_camp", "Rune Midgard Allied Forces Post");
    
    	.@it = htiterator(.maps); // create an iterator to loop through the table
    	for (.@map$ = htifirstkey(.@it); hticheck(.@it); .@map$ = htinextkey(.@it)) {
    		// we are only interested in the key so no need to htget() here
    		setmapflag(.@map$, MF_LOADEVENT);
    	}
    	htidelete(.@it); // we're done with the iterator: deallocate it
    	end;
    
    OnPCLoadMapEvent:
    	// check whether it's in the hash table:
    	if (.@nick$ = htget(.maps, strcharinfo(PC_MAP), "")) {
    		announce(.@nick$, bc_self);
    	}
    	end;
    }

     


  4. the documentation has not been updated yet but you must define the constant CUSTOM_SKILL_RANGES at compile time, with the syntax being:

    {from, to},
    {from, to},
    ...

    In your case since you are only adding one skill you would define it as:

    {8443, 8443},

     

    this means you would pass a -D compiler option like this:

    -DCUSTOM_SKILL_RANGES="{8443,8443},"

     

    ...which will insert it in skill_idx_ranges[]


  5. OnPCDieEvent:
        if (!(isequipped(Helm_Of_Sun)) // no helm of sun
            || agitcheck() // WoE
            || getmapflag(strcharinfo(PC_MAP), mf_pvp) // map PvP
            || getunittype(killerrid) == UNITTYPE_PC) // killed by a player
            end;
        
        addtimer(1000, strnpcinfo(NPC_NAME) + "::OnAutoRevive");
        end;
    
    OnAutoRevive:
        recovery(getcharid(CHAR_ID_ACCOUNT)); // revive the player
        end;

     


  6. Hercules has no LTS versions so the latest revision of the stable branch is always the most stable revision since we do not backport patches to older releases. Keep in mind that new bugs do appear from time to time but if you encounter some please report them so that they may be patched in the next release. If bugs are severe we also do pre-releases (denoted as vXX.XX.XX+Y) to address them in-between 2 releases


  7. Keep in mind that performing SQL queries is slow, especially when there's 200 rows of results so you should be using getunits() when possible.

    If you do not provide a map to getunits() it will search the whole server, just like the SQL query that is used in Ridleys script.


  8. this is untested but you could do something similar to:

    -	script	mapitem	FAKE_NPC,{
    end;
    
    OnCall:
    	// @mapitem <nameid> <amount>{, <map>}
    	.@nameid$ = .@atcmd_parameters$[0];
    	.@amount = atoi(.@atcmd_parameters$[1]);
    	.@map$ = strcharinfo(PC_MAP);
    
    	if (.@atcmd_parameters == 3) {
    		.@map$ == .@atcmd_parameters$[2];
    	} else if (.@atcmd_parameters != 2) {
    		dispbottom("mapitem: illegal number of arguments.");
    		dispbottom("Usage:");
    		dispbottom("@mapitem <nameid> <amount> for the current map");
    		dispbottom("@mapitem <nameid> <amount> <map> for another map");
    		end;
    	}
    
    	if (getmapinfo(MAPINFO_ID, .@map$) < 0) {
    		dispbottom(sprintf("mapitem: map `%s` not found.", .@map$));
    		end;
    	}
    
    	.@itemid = getiteminfo(.@nameid$, ITEMINFO_ID) < 0
    		? getiteminfo(atoi(.@nameid$), ITEMINFO_ID)
    		: getiteminfo(.@nameid$, ITEMINFO_ID);
    
    	if (.@itemid < 0) {
    		dispbottom(sprintf("mapitem: item `%s` does not exist.", .@nameid$));
    		end;
    	}
    
    	.@nameid$ = getiteminfo(.@itemid, ITEMINFO_AEGISNAME);
    
    	if (.@amount < 0 || .@amount > .max) {
    		dispbottom(sprintf("mapitem: trying to give %d `%s`, while the maximum allowed is %d.", .@amount, .@nameid$, .max));
    		end;
    	}
    
    	.@count = getunits(BL_PC, .@units, false, .@map$);
    
    	freeloop(true);
    	for (.@i = 0; .@i < .@count; ++.@i) {
    		if (.bound != false) {
    			getitembound(.@itemid, .@amount, .bound, .@units[.@i]);
    		} else {
    			getitem(.@itemid, .@amount, .@units[.@i]);
    		}
    	}
    	freeloop(false);
    
    	.@players = ++.@i; .@total = .@amount * .@players;
    	dispbottom(sprintf("mapitem: gave %d `%s` (%d total) to %d players on map `%s`", .@amount, .@nameid$, .@total, .@players, .@map$));
    	end;
    
    OnInit:
    	bindatcmd("itemmap", "mapitem::OnCall", 14, 99);
    	.max = 100;
    	.bound = IBT_ACCOUNT; // set to false to disable
    }

     


  9. Running with root privileges is inherently insecure and so Hercules will complain when trying to start as the root user.

    You must create a new user and run Hercules under that new user (preferably as a daemon).

     

    To run a command with sudo your user must be in the sudoers file (you can edit it with visudo) but keep in mind that Hercules will also warn you when running with sudo (since it runs as root).


  10. Hercules builds just fine on ARMv8 but the macro checking for ARM version has not been updated yet for __ARM_ARCH_8A__ so compilation will fail until a PR is merged that changes cbasetypes.h. Meanwhile you can use this git patch:

    --- a/src/common/cbasetypes.h
    +++ b/src/common/cbasetypes.h
    @@ -67,6 +67,9 @@
     #define __ARM_ARCH_VERSION__ 6
     #elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7S__) // gcc ARMv7
     #define __ARM_ARCH_VERSION__ 7
    +#elif defined(__ARM_ARCH_8A__) || defined(__ARM_ARCH_8R__) || defined(__ARM_ARCH_8M_BASE__) \
    +	|| defined(__ARM_ARCH_8M_MAIN__) // gcc ARMv8
    +#define __ARM_ARCH_VERSION__ 8
     #elif defined(_M_ARM) // MSVC
     #define __ARM_ARCH_VERSION__ _M_ARM
     #else
    -- 
    

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.