Delve for StyleHandler...

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

Delve for StyleHandler...

Postby Yemla » Thu Jan 21, 2010 8:09 pm

Code: Select all
[SpellHandlerAttribute("StyleHandler")]
public class StyleHandler : MasterlevelHandling
{
public override IList DelveInfo
{
get
{
GamePlayer player = Caster as GamePlayer;
Style style = SkillBase.GetStyleByID((int)m_spell.Value, player.CharacterClass.ID);
Style OpenStyle = SkillBase.GetStyleByID(style.OpeningRequirementValue, player.CharacterClass.ID);
ArrayList list = new ArrayList();
//Weapon Type
list.Add("Weapon Type: " + style.WeaponTypeRequirement);

//Opening
list.Add("Opening:" + style.OpeningRequirementType);

//Followup Style
list.Add("Followup Style:" + OpenStyle.Name);

//Fatigue Cost
if (style.EnduranceCost > 0)
{
if (style.EnduranceCost <= 10)
{
list.Add("Fatigue Cost: Low");
}
if (style.EnduranceCost > 10 && style.EnduranceCost <= 20)
{
list.Add("Fatigue Cost: Medium");
}
if (style.EnduranceCost > 20)
{
list.Add("Fatigue Cost: High");
}
}
//Damage
list.Add("Damage:" + style.GrowthRate);

//To Hit
if (style.BonusToHit > 0)
{
if (style.BonusToHit <= 5)
{
list.Add("To Hit: Low");
}
if (style.BonusToHit > 5 && style.BonusToHit <= 10)
{
list.Add("To Hit: Medium");
}
if (style.BonusToHit > 10 && style.BonusToHit <= 15)
{
list.Add("To Hit: High");
}
if (style.BonusToHit > 15)
{
list.Add("To Hit: Very High");
}
}

//Defense
if (style.BonusToDefense > 0)
{
if (style.BonusToDefense <= 5)
{
list.Add("Defense: Low");
}
if (style.BonusToDefense > 5 && style.BonusToDefense <= 10)
{
list.Add("Defense: Medium");
}
if (style.BonusToDefense > 10 && style.BonusToDefense <= 15)
{
list.Add("Defense: High");
}
if (style.BonusToDefense > 15)
{
list.Add("Defense: Very High");
}
}
return list;
}
}
public StyleHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { }
}
also could use more information on correct values on Bonus to hit/defense/fatigue....im 99% sure i got accurate information of it, but still could use 2nd opinion

my in-game client isnt working atm so cant test to see if it shows as a # for some of these and such but again i figured this was more useful information for someone else to mess around with or test x)

Screenshot a friend gave me mabye assist more information on adding and moveing around stuff x]
Image
Yemla
Contributor
 
Posts: 215
Joined: Sat Feb 02, 2008 3:21 am
Website: http://www.facebook.com/J.D.Snelling
Location: California

Re: Delve for StyleHandler...

Postby rdsandersjr » Thu Jan 21, 2010 9:08 pm

wow nice! you keep popping out tons of useful little features =) Thanks a ton ! Will test tonight!

*edit

one little thing that would make it look cleaner is put a space between the name and value. i.e: To Hit: Low instead of To Hit:Low ... but that is just alittle suggestion =)
Thanks,
RDSandersJR
User avatar
rdsandersjr
Support Team
 
Posts: 1089
Joined: Fri Aug 01, 2008 3:01 pm
Location: Cincinnati, Ohio

Re: Delve for StyleHandler...

Postby Graveen » Thu Jan 21, 2010 9:28 pm

was exactly thinking same ! :D
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12661
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: Delve for StyleHandler...

Postby Yemla » Fri Jan 22, 2010 5:21 am

wow nice! you keep popping out tons of useful little features =) Thanks a ton ! Will test tonight!

*edit

one little thing that would make it look cleaner is put a space between the name and value. i.e: To Hit: Low instead of To Hit:Low ... but that is just alittle suggestion =)
most had the spaces but i know what you mean x) i like them clean-cut like that too,
so i was reviewing it and im pretty sure gonna need pre-checks on Opening and Weapon type

BTW! the screenshot is from a normal style off valewalkers currently thats not handled with StyleHandler xP so the no spaces in it are alrdy coded in the SVN
Code: Select all
[SpellHandlerAttribute("StyleHandler")]
public class StyleHandler : MasterlevelHandling
{
public override IList DelveInfo
{
get
{
GamePlayer player = Caster as GamePlayer;
Style style = SkillBase.GetStyleByID((int)m_spell.Value, player.CharacterClass.ID);
Style OpenStyle = SkillBase.GetStyleByID(style.OpeningRequirementValue, player.CharacterClass.ID);
ArrayList list = new ArrayList();
//Weapon Type
list.Add("Weapon Type: " + style.WeaponTypeRequirement);

//Opening
if ((int)style.OpeningRequirementType == 1 && (int)style.AttackResultRequirement == 5)
{
list.Add("Opening: You Evade");
}
if ((int)style.OpeningRequirementType == 1 && (int)style.AttackResultRequirement == 4)
{
list.Add("Opening: You Block");
}
if ((int)style.OpeningRequirementType == 1 && (int)style.AttackResultRequirement == 3)
{
list.Add("Opening: You Parry");
}
if ((int)style.OpeningRequirementType == 2)
{
list.Add("Opening: Positional(Back)");//Current SVN entry
}
if ((int)style.OpeningRequirementType == 2 && (int)style.AttackResultRequirement == 1)
{
list.Add("Opening: Positional(Side)");//Current SVN entry
}
if ((int)style.OpeningRequirementType == 2 && (int)style.AttackResultRequirement == 2)
{
list.Add("Opening: Positional(Front)");//Current SVN entry
}
if (style.OpeningRequirementValue == OpenStyle.ID && (int)style.AttackResultRequirement == 7)
{
list.Add("Opening Style: " + OpenStyle.Name);
}
if (style.OpeningRequirementValue == 0 && (int)style.OpeningRequirementType == 0 && (int)style.AttackResultRequirement == 0)
{
list.Add("Opening: Any");//Current SVN entry
}
//Followup Style ---Def. incorrect check
if (style.OpeningRequirementValue == OpenStyle.ID)
{
list.Add("Followup Style: " + style.Name);
}

//Fatigue Cost
if (style.EnduranceCost <= 5)
{
list.Add("Fatigue Cost: Very Low");
}
if (style.EnduranceCost > 5 && style.EnduranceCost <= 10)
{
list.Add("Fatigue Cost: Low");
}
if (style.EnduranceCost > 10 && style.EnduranceCost <= 20)
{
list.Add("Fatigue Cost: Medium");
}
if (style.EnduranceCost > 20)
{
list.Add("Fatigue Cost: High");
}

//Damage
if (style.GrowthRate == 0)
{
list.Add("Damage: No Bonus");
}
if (style.GrowthRate != 0)
{
list.Add("Damage: " + style.GrowthRate);
}

//To Hit
if (style.BonusToHit == 0)
{
list.Add("To Hit: No Bonus");
}
if (style.BonusToHit <= 5 && style.BonusToHit != 0)
{
list.Add("To Hit: Low Bonus");
}
if (style.BonusToHit > 5 && style.BonusToHit <= 10)
{
list.Add("To Hit: Medium Bonus");
}
if (style.BonusToHit > 10 && style.BonusToHit <= 15)
{
list.Add("To Hit: High Bonus");
}
if (style.BonusToHit > 15)
{
list.Add("To Hit: Very High Bonus");
}

//Defense
if (style.BonusToDefense <= -5 && style.BonusToDefense != 0)
{
list.Add("Defense: Low Penalty");
}
if (style.BonusToDefense > -5 && style.BonusToDefense <= -10)
{
list.Add("Defense: Medium Penalty");
}
if (style.BonusToDefense > -10 && style.BonusToDefense <= -15)
{
list.Add("Defense: High Penalty");
}
if (style.BonusToDefense > -15)
{
list.Add("Defense: Very High Penalty");
}
if (style.BonusToDefense == 0)
{
list.Add("Defense: No Bonus");
}
if (style.BonusToDefense <= 5 && style.BonusToDefense != 0)
{
list.Add("Defense: Low Bonus");
}
if (style.BonusToDefense > 5 && style.BonusToDefense <= 10)
{
list.Add("Defense: Medium Bonus");
}
if (style.BonusToDefense > 10 && style.BonusToDefense <= 15)
{
list.Add("Defense: High Bonus");
}
if (style.BonusToDefense > 15)
{
list.Add("Defense: Very High Bonus");
}
return list;
}
}
public StyleHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { }
}
so far i found these requirements using camelotherald and DB

Evade: OpeningRequirementType = 1, AttackResultRequirement = 5

Block: OpeningRequirementType = 1, AttackResultRequirement = 4

Parry: OpeningRequirementType = 1, AttackResultRequirement = 3

Behind: OpeningRequirementType = 2

Side: OpeningRequirementType = 2, OpeningRequirementValue = 1

Front: OpeningRequirementType = 2, OpeningRequirementValue = 2

think the onlying ones im missing is Target Blocks/Target Parries , dont think theres a target evades though...

EDIT: added alot more code in there i need some things checked like opening style and Pentaly checks in defense i dont no if i go opposite or position cause its a negative....can't test it lol but just let me know

EDIT 2: gonna need a second eye on Followup i know its incorrect, and still working on a method to get Opening Style: Any correctly, like
Code: Select all
if (style.ID != OpenStyle.ID && style.OpeningRequirementValue == 0 && (int)style.OpeningRequirementType == 0 && (int)style.AttackResultRequirement == 0)
{
list.Add("Opening: Any");//Current SVN entry
}
EDIT 3: added this after the Defense check right under for the proc check
Code: Select all
#region Style Proc
//Style Proc check
foreach (DBStyleXSpell proc in style.Procs)
{
// RR4: we added all the procs to the style, now it's time to check for class ID
if (proc.ClassID != 0 && proc.ClassID != player.CharacterClass.ID) continue;
Spell spell = SkillBase.GetSpellByID(proc.SpellID);
if (spell != null)
{
list.Add("Target Effect:");
list.Add(spell.Name);
list.Add("");

//SpellType
list.Add("Function: " + spell.SpellType);
list.Add("");

//Description
list.Add(spell.Description);
list.Add("");

//Damage
if (spell.Damage != 0)
{
list.Add("Damage: " + spell.Damage);
}

//Value
if (spell.Value != 0)
{
list.Add("Value: " + spell.Value);
}

//Target
list.Add("Target: " + spell.Target);

//Range
if (spell.Range != 0)
{
list.Add("Range: " + spell.Range);
}

//Radius
if (spell.Radius != 0)
{
list.Add("Radius: " + spell.Radius);
}

//Cost
if (spell.Power != 0)
{
list.Add("Power cost: " + Spell.Power.ToString("0;0'%'"));
}

//Duration
if (Spell.Duration >= ushort.MaxValue * 1000)
list.Add("Duration: Permanent.");
else if (Spell.Duration > 60000)
list.Add(string.Format("Duration: {0}:{1} min", Spell.Duration / 60000, (Spell.Duration % 60000 / 1000).ToString("00")));
else if (Spell.Duration != 0)
list.Add("Duration: " + (Spell.Duration / 1000).ToString("0' sec';'Permanent.';'Permanent.'"));

//Frequency
if (Spell.Frequency != 0)
{
list.Add("Frequency: " + (Spell.Frequency * 0.001).ToString("0.0"));
}

//Cast
if (Spell.CastTime < 0.1)
list.Add("Casting time: Instant");
else if (Spell.CastTime > 0)
list.Add("Casting time: " + (Spell.CastTime * 0.001).ToString("0.0## sec;-0.0## sec;'instant'"));

//DamageType
if (spell.DamageType != eDamageType.Natural)
{
list.Add(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "DelveInfo.Damage", GlobalConstants.DamageTypeToName(spell.DamageType)));
}
}
}
#endregion
Yemla
Contributor
 
Posts: 215
Joined: Sat Feb 02, 2008 3:21 am
Website: http://www.facebook.com/J.D.Snelling
Location: California

Re: Delve for StyleHandler...

Postby Yemla » Sat Aug 07, 2010 10:11 pm

BUMP! wow its been awhile since i've worked on this
Code: Select all
#region Stylhandler
[SpellHandlerAttribute("StyleHandler")]
public class StyleHandler : MasterlevelHandling
{
public override bool CheckBeginCast(GameLiving selectedTarget)
{
GameSpellEffect cf = SpellHandler.FindEffectOnTarget(Caster, "CatForm");
DOL.GS.Styles.Style style = SkillBase.GetStyleByID((int)Spell.Value, (Caster as GamePlayer).CharacterClass.ID);
if (style == null) style = SkillBase.GetStyleByID((int)Spell.Value, 0);
switch (style.ID)
{
case 555: if (cf == null)
{
MessageToCaster("You must be in Cat Form to use this!", eChatType.CT_Advise);
return false;
} break;
}
return base.CheckBeginCast(selectedTarget);
}
public override IList DelveInfo
{
get
{
DOL.GS.Styles.Style style = SkillBase.GetStyleByID((int)m_spell.Value, (Caster as GamePlayer).CharacterClass.ID);
DOL.GS.Styles.Style openStyle = SkillBase.GetStyleByID(style.OpeningRequirementValue, (Caster as GamePlayer).CharacterClass.ID);
ArrayList list = new ArrayList();
//Weapon Type
list.Add("Weapon Type: " + style.WeaponTypeRequirement);

//Opening
if ((int)style.OpeningRequirementType == 1 && (int)style.AttackResultRequirement == 5)
{
list.Add("Opening: You Evade");
}
if ((int)style.OpeningRequirementType == 1 && (int)style.AttackResultRequirement == 4)
{
list.Add("Opening: You Block");
}
if ((int)style.OpeningRequirementType == 1 && (int)style.AttackResultRequirement == 3)
{
list.Add("Opening: You Parry");
}
if ((int)style.OpeningRequirementType == 2)
{
list.Add("Opening: Positional(Back)");//Current SVN entry
}
if ((int)style.OpeningRequirementType == 2 && (int)style.AttackResultRequirement == 1)
{
list.Add("Opening: Positional(Side)");//Current SVN entry
}
if ((int)style.OpeningRequirementType == 2 && (int)style.AttackResultRequirement == 2)
{
list.Add("Opening: Positional(Front)");//Current SVN entry
}
if (style.OpeningRequirementValue == openStyle.ID && (int)style.AttackResultRequirement == 7)
{
list.Add("Opening Style: " + openStyle.Name);
}
if (style.OpeningRequirementValue == 0 && (int)style.OpeningRequirementType == 0 && (int)style.AttackResultRequirement == 0)
{
list.Add("Opening: Any");//Current SVN entry
}
//Followup Style ---Def. incorrect check
if (style.OpeningRequirementValue == openStyle.ID)
{
list.Add("Followup Style: " + style.Name);
}

//Fatigue Cost
if (style.EnduranceCost <= 5)
{
list.Add("Fatigue Cost: Very Low");
}
if (style.EnduranceCost > 5 && style.EnduranceCost <= 10)
{
list.Add("Fatigue Cost: Low");
}
if (style.EnduranceCost > 10 && style.EnduranceCost <= 20)
{
list.Add("Fatigue Cost: Medium");
}
if (style.EnduranceCost > 20)
{
list.Add("Fatigue Cost: High");
}

//Damage
if (style.GrowthRate == 0)
{
list.Add("Damage: No Bonus");
}
if (style.GrowthRate != 0)
{
list.Add("Damage: " + style.GrowthRate);
}

//To Hit
if (style.BonusToHit == 0)
{
list.Add("To Hit: No Bonus");
}
if (style.BonusToHit <= 5 && style.BonusToHit != 0)
{
list.Add("To Hit: Low Bonus");
}
if (style.BonusToHit > 5 && style.BonusToHit <= 10)
{
list.Add("To Hit: Medium Bonus");
}
if (style.BonusToHit > 10 && style.BonusToHit <= 15)
{
list.Add("To Hit: High Bonus");
}
if (style.BonusToHit > 15)
{
list.Add("To Hit: Very High Bonus");
}

//Defense
if (style.BonusToDefense <= -5 && style.BonusToDefense != 0)
{
list.Add("Defense: Low Penalty");
}
if (style.BonusToDefense > -5 && style.BonusToDefense <= -10)
{
list.Add("Defense: Medium Penalty");
}
if (style.BonusToDefense > -10 && style.BonusToDefense <= -15)
{
list.Add("Defense: High Penalty");
}
if (style.BonusToDefense > -15)
{
list.Add("Defense: Very High Penalty");
}
if (style.BonusToDefense == 0)
{
list.Add("Defense: No Bonus");
}
if (style.BonusToDefense <= 5 && style.BonusToDefense != 0)
{
list.Add("Defense: Low Bonus");
}
if (style.BonusToDefense > 5 && style.BonusToDefense <= 10)
{
list.Add("Defense: Medium Bonus");
}
if (style.BonusToDefense > 10 && style.BonusToDefense <= 15)
{
list.Add("Defense: High Bonus");
}
if (style.BonusToDefense > 15)
{
list.Add("Defense: Very High Bonus");
}
#region Style Proc
//Style Proc check
foreach (DBStyleXSpell proc in style.Procs)
{
if (proc.ClassID != 0 && proc.ClassID != (Caster as GamePlayer).CharacterClass.ID) continue;
Spell spell = SkillBase.GetSpellByID(proc.SpellID);
if (spell != null)
{
list.Add("Target Effect:");
list.Add(spell.Name);
list.Add("");

//SpellType
list.Add("Function: " + spell.SpellType);
list.Add("");

//Description
list.Add(spell.Description);
list.Add("");

//Damage
if (spell.Damage != 0)
{
list.Add("Damage: " + spell.Damage);
}

//Value
if (spell.Value != 0)
{
list.Add("Value: " + spell.Value);
}

//Target
list.Add("Target: " + spell.Target);

//Range
if (spell.Range != 0)
{
list.Add("Range: " + spell.Range);
}

//Radius
if (spell.Radius != 0)
{
list.Add("Radius: " + spell.Radius);
}

//Cost
if (spell.Power != 0)
{
list.Add("Power cost: " + Spell.Power.ToString("0;0'%'"));
}

//Duration
if (Spell.Duration >= ushort.MaxValue * 1000)
list.Add("Duration: Permanent.");
else if (Spell.Duration > 60000)
list.Add(string.Format("Duration: {0}:{1} min", Spell.Duration / 60000, (Spell.Duration % 60000 / 1000).ToString("00")));
else if (Spell.Duration != 0)
list.Add("Duration: " + (Spell.Duration / 1000).ToString("0' sec';'Permanent.';'Permanent.'"));

//Frequency
if (Spell.Frequency != 0)
{
list.Add("Frequency: " + (Spell.Frequency * 0.001).ToString("0.0"));
}

//Cast
if (Spell.CastTime < 0.1)
list.Add("Casting time: Instant");
else if (Spell.CastTime > 0)
list.Add("Casting time: " + (Spell.CastTime * 0.001).ToString("0.0## sec;-0.0## sec;'instant'"));

//DamageType
if (spell.DamageType != eDamageType.Natural)
{
list.Add(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "DelveInfo.Damage", GlobalConstants.DamageTypeToName(spell.DamageType)));
}
}
}
#endregion
return list;
}
}
public StyleHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) { }
}
#endregion
Code: Select all
//Weapon Type
list.Add("Weapon Type: " + style.WeaponTypeRequirement);
Code: Select all
//Followup Style ---Def. incorrect check
if (style.OpeningRequirementValue == openStyle.ID)
{
list.Add("Followup Style: " + style.Name);
}
These too are the only things i think that need to be fixed....WeaponType list the number therefore i have to make a switch or if statement for each Number giving the correct info for what is required to use this, my navicat is down atm waiting for registration to be filled in (ehhh) so ill know more on this matter after. Same with followup style, i'd have to test it or atleast look at it ehhh more info to soon be stated...

So basically im fixing the Delve to work correctly and once thats 100% working i'll commit this, but my question is based on the CheckBeginCast, if you don't have that current spell CatForm, for style 555 on trying to use it, it will return false and unable to go throw sending that message correctly right?
Yemla
Contributor
 
Posts: 215
Joined: Sat Feb 02, 2008 3:21 am
Website: http://www.facebook.com/J.D.Snelling
Location: California

Re: Delve for StyleHandler...

Postby Graveen » Sun Aug 08, 2010 8:34 am

Totally ! i like style delve, ty Yemla !
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12661
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest