public void ParseEntry(String[] raw) { Comment = CsvParser.String(raw[0]); Id = CsvParser.Int32(raw[1]); TargetDisplay menuWindow = CsvParser.EnumValue <TargetDisplay>(raw[2]); TargetType targets = CsvParser.EnumValue <TargetType>(raw[3]); Boolean defaultAlly = CsvParser.Boolean(raw[4]); Boolean forDead = CsvParser.Boolean(raw[5]); Boolean defaultOnDead = CsvParser.Boolean(raw[6]); Boolean defaultCamera = CsvParser.Boolean(raw[7]); Int16 animation1 = CsvParser.Int16(raw[8]); UInt16 animation2 = CsvParser.UInt16(raw[9]); Byte scriptId = CsvParser.Byte(raw[10]); Byte power = CsvParser.Byte(raw[11]); Byte elements = CsvParser.Byte(raw[12]); Byte rate = CsvParser.ByteOrMinusOne(raw[13]); Byte category = CsvParser.Byte(raw[14]); Byte statusIndex = CsvParser.Byte(raw[15]); Byte mp = CsvParser.Byte(raw[16]); Byte type = CsvParser.Byte(raw[17]); BattleCommandInfo cmd = new BattleCommandInfo(targets, defaultAlly, menuWindow, animation1, forDead, defaultCamera, defaultOnDead); BTL_REF btl = new BTL_REF(scriptId, power, elements, rate); ActionData = new AA_DATA(cmd, btl, category, statusIndex, mp, type, animation2); }
public static void CheckReactionAbility(BTL_DATA btl, AA_DATA aa) { if (!Status.checkCurStat(btl, BattleStatus.NoReaction)) { if ((btl.sa[1] & 1048576u) != 0u && btl.cur.hp != 0 && Status.checkCurStat(btl, BattleStatus.LowHP)) { if (btl.cur.hp + btl.max.hp / 2 < btl.max.hp) { POINTS cur = btl.cur; cur.hp = (UInt16)(cur.hp + (UInt16)(btl.max.hp / 2)); } else { btl.cur.hp = btl.max.hp; } } if ((btl.sa[1] & 8388608u) != 0u && aa.MP != 0) { if (btl.cur.mp + (Int16)aa.MP < btl.max.mp) { POINTS cur2 = btl.cur; cur2.mp = (Int16)(cur2.mp + (Int16)aa.MP); } else { btl.cur.mp = btl.max.mp; } } } }
public ItemActionData(AA_DATA aa) { Info = aa.Info; Ref = aa.Ref; Category = aa.Category; AddNo = aa.AddNo; MP = aa.MP; Type = aa.Type; Vfx2 = aa.Vfx2; Name = aa.Name; }
private void DrawAbilityInfo(AbilityItemHUD abilityHud, Int32 index) { PLAYER player = FF9StateSystem.Common.FF9.party.member[_currentPartyIndex]; Boolean flag = ff9abil.FF9Abil_HasAp(new Character(player)); if (flag && player.pa[index] == 0) { abilityHud.Self.SetActive(false); return; } Int32 index1 = ff9abil._FF9Abil_PaData[player.info.menu_type][index].Id; //int num1 = ff9abil._FF9Abil_PaData[player.info.menu_type][index].max_ap; if (index1 == 0) { abilityHud.Self.SetActive(false); } else { //int num2 = player.pa[index]; String str1; String str2; Boolean isShowText; if (index1 < 192) { AA_DATA aaData = FF9StateSystem.Battle.FF9Battle.aa_data[index1]; str1 = FF9TextTool.ActionAbilityName(index1); str2 = "ability_stone"; isShowText = (aaData.Type & 2) == 0; } else { //SA_DATA saData = ff9abil._FF9Abil_SaData[index1 - 192]; str1 = FF9TextTool.SupportAbilityName(index1 - 192); str2 = !ff9abil.FF9Abil_IsEnableSA(player.sa, index1) ? "skill_stone_off" : "skill_stone_on"; isShowText = true; } abilityHud.Self.SetActive(true); abilityHud.IconSprite.spriteName = str2; abilityHud.NameLabel.text = str1; if (flag) { FF9UIDataTool.DisplayAPBar(player, index1, isShowText, abilityHud.APBar); } else { FF9UIDataTool.DisplayAPBar(player, index1, isShowText, abilityHud.APBar); } } }
public void LoadAbility() { AA_DATA original = FF9StateSystem.Battle.FF9Battle.aa_data[Data.sub_no]; CMD_INFO originalInfo = original.Info; CMD_INFO newInfo = new CMD_INFO { cursor = originalInfo.cursor, def_cur = originalInfo.def_cur, sub_win = originalInfo.sub_win, vfx_no = originalInfo.vfx_no, sfx_no = originalInfo.sfx_no, dead = originalInfo.dead, def_cam = originalInfo.def_cam, def_dead = originalInfo.def_dead }; BTL_REF originalRef = original.Ref; BTL_REF newRef = new BTL_REF { prog_no = originalRef.prog_no, power = originalRef.power, attr = originalRef.attr, rate = originalRef.rate }; AA_DATA newData = new AA_DATA { Info = newInfo, Ref = newRef, Category = original.Category, AddNo = original.AddNo, MP = original.MP, Type = original.Type, Vfx2 = original.Vfx2, Name = original.Name }; Data.aa = newData; }
public void LoadAbility() { AA_DATA original = FF9StateSystem.Battle.FF9Battle.aa_data[Data.sub_no]; BattleCommandInfo originalInfo = original.Info; BattleCommandInfo newInfo = new BattleCommandInfo { Target = originalInfo.Target, DefaultAlly = originalInfo.DefaultAlly, DisplayStats = originalInfo.DisplayStats, VfxIndex = originalInfo.VfxIndex, ForDead = originalInfo.ForDead, DefaultCamera = originalInfo.DefaultCamera, DefaultOnDead = originalInfo.DefaultOnDead }; BTL_REF originalRef = original.Ref; BTL_REF newRef = new BTL_REF { ScriptId = originalRef.ScriptId, Power = originalRef.Power, Elements = originalRef.Elements, Rate = originalRef.Rate }; AA_DATA newData = new AA_DATA { Info = newInfo, Ref = newRef, Category = original.Category, AddNo = original.AddNo, MP = original.MP, Type = original.Type, Vfx2 = original.Vfx2, Name = original.Name }; Data.aa = newData; }
public static Int32 CalcDiff(KeyValuePair <Dictionary <String, String>, AA_DATA> item, IEnumerable <KeyValuePair <Dictionary <String, String>, AA_DATA> > other) { Int32 total = 0; AA_DATA x = item.Value; foreach (KeyValuePair <Dictionary <String, String>, AA_DATA> data in other) { AA_DATA y = data.Value; if (x == y) { continue; } if (x.AddNo != y.AddNo) { total++; } if (x.Category != y.Category) { total++; } if (x.MP != y.MP) { total++; } if (x.Type != y.Type) { total++; } if (x.Vfx2 != y.Vfx2) { total++; } if (x.Info.Target != y.Info.Target) { total++; } if (x.Info.Target != y.Info.Target) { total++; } if (x.Info.DefaultAlly != y.Info.DefaultAlly) { total++; } if (x.Info.DisplayStats != y.Info.DisplayStats) { total++; } if (x.Info.VfxIndex != y.Info.VfxIndex) { total++; } if (x.Info.ForDead != y.Info.ForDead) { total++; } if (x.Info.DefaultCamera != y.Info.DefaultCamera) { total++; } if (x.Info.DefaultOnDead != y.Info.DefaultOnDead) { total++; } if (x.Ref.Elements != y.Ref.Elements) { total++; } if (x.Ref.ScriptId != y.Ref.ScriptId) { total++; } if (x.Ref.Power != y.Ref.Power) { total++; } if (x.Ref.Rate != y.Ref.Rate) { total++; } } return(total); }
public static Boolean FieldCalcMain(PLAYER caster, PLAYER target, AA_DATA tbl, Byte scriptId, UInt32 cursor) { ItemActionData tbl1 = new ItemActionData(tbl); return(FieldCalcMain(caster, target, tbl1, scriptId, cursor)); }
public static void SetAttackData(ref AA_DATA pAttk, ref AA_DATA pEatk) { pEatk = pAttk; }
public void ReadBattleScene(String name) { name = "EVT_BATTLE_" + name; this.header = new SB2_HEAD(); TextAsset textAsset = AssetManager.Load <TextAsset>("BattleMap/BattleScene/" + name + "/dbfile0000.raw16", false); Byte[] bytes = textAsset.bytes; using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(bytes))) { this.header.Ver = binaryReader.ReadByte(); this.header.PatCount = binaryReader.ReadByte(); this.header.TypCount = binaryReader.ReadByte(); this.header.AtkCount = binaryReader.ReadByte(); this.header.Flags = binaryReader.ReadUInt16(); this.PatAddr = new SB2_PATTERN[(Int32)this.header.PatCount]; this.MonAddr = new SB2_MON_PARM[(Int32)this.header.TypCount]; this.atk = new AA_DATA[(Int32)this.header.AtkCount]; binaryReader.BaseStream.Seek(8L, SeekOrigin.Begin); for (Int32 i = 0; i < (Int32)this.header.PatCount; i++) { SB2_PATTERN sb2_PATTERN = this.PatAddr[i] = new SB2_PATTERN(); sb2_PATTERN.Rate = binaryReader.ReadByte(); sb2_PATTERN.MonCount = binaryReader.ReadByte(); sb2_PATTERN.Camera = binaryReader.ReadByte(); sb2_PATTERN.Pad0 = binaryReader.ReadByte(); sb2_PATTERN.AP = binaryReader.ReadUInt32(); for (Int32 j = 0; j < 4; j++) { SB2_PUT sb2_PUT = sb2_PATTERN.Put[j] = new SB2_PUT(); sb2_PUT.TypeNo = binaryReader.ReadByte(); sb2_PUT.Flags = binaryReader.ReadByte(); sb2_PUT.Pease = binaryReader.ReadByte(); sb2_PUT.Pad = binaryReader.ReadByte(); sb2_PUT.Xpos = binaryReader.ReadInt16(); sb2_PUT.Ypos = binaryReader.ReadInt16(); sb2_PUT.Zpos = binaryReader.ReadInt16(); sb2_PUT.Rot = binaryReader.ReadInt16(); } } binaryReader.BaseStream.Seek((Int64)(8 + 56 * this.header.PatCount), SeekOrigin.Begin); for (Int32 k = 0; k < (Int32)this.header.TypCount; k++) { SB2_MON_PARM sb2_MON_PARM = this.MonAddr[k] = new SB2_MON_PARM(); for (Int32 l = 0; l < 3; l++) { sb2_MON_PARM.Status[l] = (BattleStatus)binaryReader.ReadUInt32(); } sb2_MON_PARM.MaxHP = binaryReader.ReadUInt16(); sb2_MON_PARM.MaxMP = binaryReader.ReadUInt16(); sb2_MON_PARM.WinGil = binaryReader.ReadUInt16(); sb2_MON_PARM.WinExp = binaryReader.ReadUInt16(); for (Int32 m = 0; m < 4; m++) { sb2_MON_PARM.WinItems[m] = binaryReader.ReadByte(); } for (Int32 n = 0; n < 4; n++) { sb2_MON_PARM.StealItems[n] = binaryReader.ReadByte(); } sb2_MON_PARM.Radius = binaryReader.ReadUInt16(); sb2_MON_PARM.Geo = binaryReader.ReadUInt16(); for (Int32 num = 0; num < 6; num++) { sb2_MON_PARM.Mot[num] = binaryReader.ReadUInt16(); } for (Int32 num2 = 0; num2 < 2; num2++) { sb2_MON_PARM.Mesh[num2] = binaryReader.ReadUInt16(); } sb2_MON_PARM.Flags = binaryReader.ReadUInt16(); sb2_MON_PARM.AP = binaryReader.ReadUInt16(); SB2_ELEMENT sb2_ELEMENT = sb2_MON_PARM.Element = new SB2_ELEMENT(); sb2_ELEMENT.dex = binaryReader.ReadByte(); sb2_ELEMENT.str = binaryReader.ReadByte(); sb2_ELEMENT.mgc = binaryReader.ReadByte(); sb2_ELEMENT.wpr = binaryReader.ReadByte(); sb2_ELEMENT.pad = binaryReader.ReadByte(); sb2_ELEMENT.trans = binaryReader.ReadByte(); sb2_ELEMENT.cur_capa = binaryReader.ReadByte(); sb2_ELEMENT.max_capa = binaryReader.ReadByte(); for (Int32 num3 = 0; num3 < 4; num3++) { sb2_MON_PARM.Attr[num3] = binaryReader.ReadByte(); } sb2_MON_PARM.Level = binaryReader.ReadByte(); sb2_MON_PARM.Category = binaryReader.ReadByte(); sb2_MON_PARM.HitRate = binaryReader.ReadByte(); sb2_MON_PARM.P_DP = binaryReader.ReadByte(); sb2_MON_PARM.P_AV = binaryReader.ReadByte(); sb2_MON_PARM.M_DP = binaryReader.ReadByte(); sb2_MON_PARM.M_AV = binaryReader.ReadByte(); sb2_MON_PARM.Blue = binaryReader.ReadByte(); for (Int32 num4 = 0; num4 < 4; num4++) { sb2_MON_PARM.Bone[num4] = binaryReader.ReadByte(); } sb2_MON_PARM.DieSfx = binaryReader.ReadUInt16(); sb2_MON_PARM.Konran = binaryReader.ReadByte(); sb2_MON_PARM.MesCnt = binaryReader.ReadByte(); for (Int32 num5 = 0; num5 < 6; num5++) { sb2_MON_PARM.IconBone[num5] = binaryReader.ReadByte(); } for (Int32 num6 = 0; num6 < 6; num6++) { sb2_MON_PARM.IconY[num6] = binaryReader.ReadSByte(); } for (Int32 num7 = 0; num7 < 6; num7++) { sb2_MON_PARM.IconZ[num7] = binaryReader.ReadSByte(); } sb2_MON_PARM.StartSfx = binaryReader.ReadUInt16(); sb2_MON_PARM.ShadowX = binaryReader.ReadUInt16(); sb2_MON_PARM.ShadowZ = binaryReader.ReadUInt16(); sb2_MON_PARM.ShadowBone = binaryReader.ReadByte(); sb2_MON_PARM.Card = binaryReader.ReadByte(); sb2_MON_PARM.ShadowOfsX = binaryReader.ReadInt16(); sb2_MON_PARM.ShadowOfsZ = binaryReader.ReadInt16(); sb2_MON_PARM.ShadowBone2 = binaryReader.ReadByte(); sb2_MON_PARM.Pad0 = binaryReader.ReadByte(); sb2_MON_PARM.Pad1 = binaryReader.ReadUInt16(); sb2_MON_PARM.Pad2 = binaryReader.ReadUInt16(); } binaryReader.BaseStream.Seek((Int64)(8 + 56 * this.header.PatCount + 116 * this.header.TypCount), SeekOrigin.Begin); for (Int32 num8 = 0; num8 < (Int32)this.header.AtkCount; num8++) { AA_DATA aa_DATA = this.atk[num8] = new AA_DATA(); BattleCommandInfo cmd_INFO = aa_DATA.Info = new BattleCommandInfo(); UInt32 input = binaryReader.ReadUInt32(); Byte b = 0; cmd_INFO.Target = (TargetType)BitUtil.ReadBits(input, ref b, 4); cmd_INFO.DefaultAlly = BitUtil.ReadBits(input, ref b, 1) != 0; cmd_INFO.DisplayStats = (TargetDisplay)BitUtil.ReadBits(input, ref b, 3); cmd_INFO.VfxIndex = (Int16)BitUtil.ReadBits(input, ref b, 9); /*cmd_INFO.sfx_no = (Int16)*/ BitUtil.ReadBits(input, ref b, 12); cmd_INFO.ForDead = BitUtil.ReadBits(input, ref b, 1) != 0; cmd_INFO.DefaultCamera = BitUtil.ReadBits(input, ref b, 1) != 0; cmd_INFO.DefaultOnDead = BitUtil.ReadBits(input, ref b, 1) != 0; BTL_REF btl_REF = aa_DATA.Ref = new BTL_REF(); btl_REF.ScriptId = binaryReader.ReadByte(); btl_REF.Power = binaryReader.ReadByte(); btl_REF.Elements = binaryReader.ReadByte(); btl_REF.Rate = binaryReader.ReadByte(); aa_DATA.Category = binaryReader.ReadByte(); aa_DATA.AddNo = binaryReader.ReadByte(); aa_DATA.MP = binaryReader.ReadByte(); aa_DATA.Type = binaryReader.ReadByte(); aa_DATA.Vfx2 = binaryReader.ReadUInt16(); aa_DATA.Name = binaryReader.ReadUInt16().ToString(); } } }
private Boolean ManageTargetCommand() { BattleUnit btl = FF9StateSystem.Battle.FF9Battle.GetUnit(CurrentPlayerIndex); if ((Int32)_currentCommandId == 31 && (!_magicSwordCond.IsViviExist || _magicSwordCond.IsViviDead || _magicSwordCond.IsSteinerMini)) { FF9Sfx.FF9SFX_Play(101); ResetToReady(); return(false); } if (!_isTranceMenu && btl.IsUnderAnyStatus(BattleStatus.Trance)) { FF9Sfx.FF9SFX_Play(101); ResetToReady(); return(false); } if (_subMenuType == SubMenuType.Ability) { CharacterCommand command = CharacterCommands.Commands[_currentCommandId]; if (_currentSubMenuIndex >= command.Abilities.Length) { return(true); } AA_DATA aaData = FF9StateSystem.Battle.FF9Battle.aa_data[PatchAbility(command.Abilities[_currentSubMenuIndex])]; Int32 mpCost = ff9abil.FF9Abil_GetEnableSA(btl.PlayerIndex, AbilSaMpHalf) ? aaData.MP >> 1 : aaData.MP; if (btl.CurrentMp < mpCost) { FF9Sfx.FF9SFX_Play(101); DisplayAbility(); SetTargetVisibility(false); ClearModelPointer(); SetAbilityPanelVisibility(true, true); return(false); } if ((aaData.Category & 2) != 0 && btl.IsUnderAnyStatus(BattleStatus.Silence)) { FF9Sfx.FF9SFX_Play(101); DisplayAbility(); SetTargetVisibility(false); ClearModelPointer(); SetAbilityPanelVisibility(true, true); return(false); } } if ((_subMenuType == SubMenuType.Item || _subMenuType == SubMenuType.Throw) && ff9item.FF9Item_GetCount(_itemIdList[_currentSubMenuIndex]) == 0) { FF9Sfx.FF9SFX_Play(101); DisplayItem(_subMenuType == SubMenuType.Throw); SetTargetVisibility(false); ClearModelPointer(); SetItemPanelVisibility(true, true); return(false); } return(true); }
public ActionEntry(UInt16 index, AA_DATA baseItemValue) { _index = index; aaData = baseItemValue; }
private static void SerializeAllActions(String outputDirectory) { UInt16 id = 0; using (CsvWriter csv = new CsvWriter(outputDirectory + "Actions.csv")) { csv.WriteLine("# This file contains NPC actions."); csv.WriteLine("# ----------------------------------------------------------------------------------------------------------------------------------"); csv.WriteLine("# Id;cursor;def_cur;vfx_no;Vfx2;def_cam;prog_no;power;attr;rate;Category;AddNo;MP;Type"); csv.WriteLine("# UInt16;UInt8;UInt8;Int16;UInt16;UInt8;UInt8;UInt8;UInt8;UInt8;UInt8;UInt8;UInt8;UInt8"); csv.WriteLine("# ----------------------------------------------------------------------------------------------------------------------------------"); foreach (var group in Actions.GroupBy(p => p.Key)) { KeyValuePair <String, AA_DATA>[] items = group.OrderBy(v => ActionComparer.CalcDiff(v, group)).ToArray(); KeyValuePair <String, AA_DATA> baseItem = items.First(); csv.WriteEntry(new ActionEntry(id, baseItem.Value), baseItem.Key); String name = group.Key; String outputPath = outputDirectory + FF9TextTool.RemoveOpCode(name) + ".json"; using (JsonWriter writer = new JsonWriter(outputPath)) { writer.BeginComplexArray(); foreach (KeyValuePair <String, AA_DATA> pair in items) { AA_DATA action = pair.Value; writer.BeginObject(); writer.WriteUInt16("id", id); writer.WriteString("name", name); if (baseItem.Value.Info.cursor != action.Info.cursor) { writer.WriteEnum("targets", (TargetType)action.Info.cursor); } if (baseItem.Value.Info.def_cur != action.Info.def_cur) { writer.WriteBoolean("defaultAlly", action.Info.def_cur == 1); } if (baseItem.Value.Info.vfx_no != action.Info.vfx_no) { writer.WriteInt16("animationId1", action.Info.vfx_no); } if (baseItem.Value.Vfx2 != action.Vfx2) { writer.WriteUInt16("animationId2", action.Vfx2); } if (baseItem.Value.Ref.prog_no != action.Ref.prog_no) { writer.WriteByte("scriptId", action.Ref.prog_no); } if (baseItem.Value.Ref.power != action.Ref.power) { writer.WriteByte("power", action.Ref.power); } if (baseItem.Value.Ref.attr != action.Ref.attr) { writer.WriteFlags("elements", (EffectElement)action.Ref.attr); } if (baseItem.Value.Ref.rate != action.Ref.rate) { writer.WriteByte("rate", action.Ref.rate); } if (baseItem.Value.Category != action.Category) { writer.WriteByte("category", action.Category); } if (baseItem.Value.AddNo != action.AddNo) { writer.WriteByte("addNo", action.AddNo); } if (baseItem.Value.MP != action.MP) { writer.WriteByte("mp", action.MP); } if (baseItem.Value.Type != action.Type) { writer.WriteByte("type", action.Type); } writer.EndObject(); } writer.EndComplexArray(); } id++; } } }