Jump to content

  •  

Ancyker

Member Since 30 Jan 2013
Offline Last Active Dec 25 2016 03:56 AM
*****

Issues I've Posted

    UNT_FIREWALL + UNT_KAEN can cause crash when SA_LANDPROTECTOR is cast during race condi...

    Posted 28 May 2015

    skill.c
    	switch (sg->unit_id) {
    		case UNT_FIREWALL:
    		case UNT_KAEN: {
    			int count=0;
    			const int x = bl->x, y = bl->y;
    
    			if( sg->skill_id == GN_WALLOFTHORN && !map_flag_vs(bl->m) )
    				break;
    
    			//Take into account these hit more times than the timer interval can handle.
    			do
    				skill->attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0);
    			while(--src->val2 && x == bl->x && y == bl->y
    			   && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl));
    
    
    			if (src->val2<=0)
    				skill->delunit(src);
    		}
    		break;
    
    If SA_LANDPROTECTOR is cast over a UNT_FIREWALL or UNT_KAEN unit during the while statements execution, the code will pull garbage data and crash.

    The above is an assumption, as I did not test further. This was discovered by spamming firewall (and firepillar) on a player that had a Detale card.

    All mercenaries miss / hit for 0

    Posted 16 Jan 2015

    All mercenaries miss all targets all the time. The high level mercenaries even miss Porings. This bug only occurs under renewal mechanics.

    This bug breaks the ranger quest, as it uses the mercenary system.

    Worth noting that for some reason, both classic/original and renewal mechanics use the same database for mercenaries. This might be correct but seems odd to me.

    SC_VITATA_500 not working

    Posted 15 Oct 2014

    Appears to do nothing (might do the regen bit). Supposed to:
    • SP Regen +20%
    • MaxSP increased by 5%

    It is used by the Vitata500 item:
    {
    	Id: 12436
    	AegisName: "Vitata500"
    	Name: "Vitata500"
    	Type: 0
    	Buy: 100
    	Weight: 50
    	Upper: 63
    	BuyingStore: true
    	Script: <"
    		sc_start SC_VITATA_500,500000,0;
    		heal 0,200;
    	">
    },
    

    Map Zone DB Stacking Incorrectly (Siege gears not working)

    Posted 13 Oct 2014

    Maps which are not always a certain mode, such as War of Emperium castles, have the mode "Normal" -- which is fine. The problem happens when an additional mode is applied, such as GvG. In this case the GvG zone appears to be applied first, then the settings overridden with the Normal zone. So, any items disabled in a Normal zone and allowed in a WoE zone, even if explicitly allowed, will not work.

    This effectively breaks all siege gears, which are only supposed to work in PvP/GvG/WoE maps. Normally they are disabled outside of those areas:
    {
    	/* Normal zone is applied to all maps that are not pkable (where players cant fight each other)  */
    	/* However, it wont be applied to maps with its own zones (specified thru mapflag) */
    	name: "Normal" /* changing this name requires MAP_ZONE_NORMAL_NAME to also be changed in src/map/map.h file */
    	
    	disabled_skills: {
    		WM_LULLABY_DEEPSLEEP: "PLAYER"
    		WM_SIRCLEOFNATURE: "PLAYER"
    		WM_SATURDAY_NIGHT_FEVER: "PLAYER"
    		SO_ARRULLO: "PLAYER"
    		CG_HERMODE: "PLAYER"
    	}
    	
    	disabled_items: {
    		Velum_Jamadhar: true
    		Velum_Scare: true
    		Velum_Buster: true
    		Velum_Guillotine: true
    		Velum_Spear: true
    		Velum_Glaive: true
    		Velum_Bible: true
    		Velum_Encyclopedia: true
    		Velum_Claw: true
    		Velum_Arc_Wand: true
    		Velum_Damascus: true
    		Velum_Stunner: true
    		Velum_Flail: true
    		Velum_Arbalest: true
    		Velum_CrossBow: true
    		Velum_Claymore: true
    		Velum_Katzbalger: true
    		Siege_Arrow_A: true
    		Siege_Arrow_S: true
    		Siege_Greave: true
    		Siege_Boots: true
    		Siege_Shoes: true
    		Siege_Manteau: true
    		Siege_Muffler: true
    		Siege_White_Potion: true
    		Siege_Blue_Potion: true
    		Woe_Violet_Potion: true
    		Woe_White_Potion: true
    		Woe_Blue_Potion: true
    		Siege_Plate: true
    		Siege_Suits: true
    		Siege_Robe: true
    	}
    	mapflags: (
    	)
    	
    },
    
    I tried explicitly enabling them inside of GvG, but it didn't work:
    {
    	/* GvG zone is applied to all maps with a gvg mapflag */
    	name: "GvG" /* changing this name requires MAP_ZONE_GVG_NAME to also be changed in src/map/map.h file */
    	
    	disabled_skills: {
    		AL_TELEPORT: "PLAYER"
    		AL_WARP: "PLAYER"
    		WZ_ICEWALL: "PLAYER"
    		TF_BACKSLIDING: "PLAYER"
    		RG_INTIMIDATE: "PLAYER"
    		WE_CALLPARTNER: "PLAYER"
    		HP_ASSUMPTIO: "PLAYER"
    		HP_BASILICA: "PLAYER"
    		CG_MOONLIT: "PLAYER"
    		WE_CALLPARENT: "PLAYER"
    		WE_CALLBABY: "PLAYER"
    		CR_CULTIVATION: "PLAYER"
    		NJ_KIRIKAGE: "PLAYER"
    		CASH_ASSUMPTIO: "PLAYER"
    		BS_GREED: "PLAYER"
    		SC_FATALMENACE: "PLAYER"
    		SC_DIMENSIONDOOR: "PLAYER"
    	}
    	
    	disabled_items: {
    		Assumptio_5_Scroll: true
    		Greed_Scroll: true
    		Pty_Assumptio_Scroll: true
    		Velum_Jamadhar: false
    		Velum_Scare: false
    		Velum_Buster: false
    		Velum_Guillotine: false
    		Velum_Spear: false
    		Velum_Glaive: false
    		Velum_Bible: false
    		Velum_Encyclopedia: false
    		Velum_Claw: false
    		Velum_Arc_Wand: false
    		Velum_Damascus: false
    		Velum_Stunner: false
    		Velum_Flail: false
    		Velum_Arbalest: false
    		Velum_CrossBow: false
    		Velum_Claymore: false
    		Velum_Katzbalger: false
    		Siege_Arrow_A: false
    		Siege_Arrow_S: false
    		Siege_Greave: false
    		Siege_Boots: false
    		Siege_Shoes: false
    		Siege_Manteau: false
    		Siege_Muffler: false
    		Siege_White_Potion: false
    		Siege_Blue_Potion: false
    		Woe_Violet_Potion: false
    		Woe_White_Potion: false
    		Woe_Blue_Potion: false
    		Siege_Plate: false
    		Siege_Suits: false
    		Siege_Robe: false
    	}
    	/* 5 second duration increase on GvG */
    	/* knockback disabled */
    	/* GvG Mode Damage Reductions */
    	/* - weapon_damage_rate -40% */
    	/* - magic_damage_rate  -40% */
    	/* - misc_damage_rate   -40% */
    	/* - long_damage_rate   -20% */
    	/* - short_damage_rate  -20% */
    	mapflags: (
    		"invincible_time_inc	5000",
    		"noknockback",
    		"weapon_damage_rate	60",
    		"magic_damage_rate	60",
    		"misc_damage_rate	60",
    		"long_damage_rate	80",
    		"short_damage_rate	80",
    		"nocashshop",
    		"gvg_noparty",
    	)
    	
    },
    

    So the way zones stack needs changed. I understand why you'd apply @gvgon/@pvpon first, then apply the actual ("main") zone. For instance, for a PVP event which allows only certain items, I'd want my custom zone first, but for WoE, I'd want GvG to override the Normal zone.

    Suggestion Solution

    GvG and PvP zones override the zone when the zone is "Normal", and should be secondary when the zone is of any other type. In short, Normal should always be overridden by any other zone (PvP/GvG).

    Normal < PvP/GvG < All other zones

    Example:

    WoE has the zone "Normal" when WoE is not on. When WoE is started, GvG is added. The order should be Normal+GvG (Normal applied, then overridden with GvG)
    A custom PVP area has the zone "Event". When PvP is enabled, PvP is added. The order should be PvP+Event (PvP applied first, then overridden with Event)

    Random not random

    Posted 2 Sep 2014

    So, as any large server can tell you, random isn't very random (0.20% drop chance, sure):

    Posted Image

    I used to just blame this on the fact there are a lot of players and pseudorandom number generators just not being that good. I ran off to find a true random number generator and then began checking the source code to find out if it'd be possible to implement it. The most effective way would have been to just edit the function that plugs in the seed.

    Then I discovered something interesting:

    It appears the seed for the random number generator, which is set by rnd_init(), is only called once at boot time (in core.c, by main()). This means that the seed is never changed and that "random" numbers are very predictable after any decent length of up time.

    This should be modified so the seed is changed quite often (I'd say at longest every few minutes). It'd also be nice if it would be seeded with some data from /dev/urandom or /dev/random instead of the time (really?).