private static void ReadSkills() { //string path = Environment.CurrentDirectory+"\\TMSS\\Data\\ParallelSkills\\skills.psi"; string path = "C:\\ruo2\\TMSS\\Data\\ParallelSkills\\skills.psi"; if (!File.Exists(path)) { SkillSettings.DoTell("CS Warning - No Custom Skills file exists on path: "+path);} XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; XmlReader reader; try { reader = XmlReader.Create(path, settings); } catch (Exception e) { if( Core.Debug ) SkillSettings.SystemWrite(" -//P//- Could not create reader: "+e); else SkillSettings.SystemWrite(" -//P//- File not found, or invalid."); return; } try { reader.ReadToFollowing("ParallelSkills"); reader.ReadToFollowing("settings"); int count = Int32.Parse(reader.GetAttribute(0)); for (int i = 0; i < count; i++) { reader.ReadToFollowing("skill"); //int id = Int32.Parse(reader.GetAttribute(0)); string name = reader.GetAttribute(0); string BLARR = reader.GetAttribute(1); double sscale = Double.Parse(BLARR); double dscale = Double.Parse(reader.GetAttribute(2)); double iscale = Double.Parse(reader.GetAttribute(3)); string title = reader.GetAttribute(4); double sgain = Double.Parse(reader.GetAttribute(5)); double dgain = Double.Parse(reader.GetAttribute(6)); double igain = Double.Parse(reader.GetAttribute(7)); double gainf = Double.Parse(reader.GetAttribute(8)); SkillInfo info = new SkillInfo(0, name, sscale, dscale, iscale, title, null, sgain, dgain, igain, gainf); if (infos.Contains(info)) infos.Remove(info); infos.Add(info); } reader.Close(); } catch (Exception e){ SkillSettings.DoTell("Gar."+e);} }
void BroadcastCast(SkillInfo info) { if (!Network.isServer) return; S2C.SkillCastInfo castInfo = new S2C.SkillCastInfo(info.skillData.skillName, player.GetOwner()); if (!ServerGame.Inst.isDedicatedServer) { GetComponent<NetworkView>().RPC("RecvCast", RPCMode.All, castInfo.SerializeToBytes()); } else { GetComponent<NetworkView>().RPC("RecvCast", RPCMode.Others, castInfo.SerializeToBytes()); } }
public Skill( Skills owner, SkillInfo info, int baseValue, int cap, SkillLock skillLock ) { m_Owner = owner; m_Info = info; m_Base = (ushort)baseValue; m_Cap = (ushort)cap; m_Lock = skillLock; }
public Skill( Skills owner, SkillInfo info, GenericReader reader ) { m_Owner = owner; m_Info = info; int version = reader.ReadByte(); switch ( version ) { case 0: { m_Base = reader.ReadUShort(); m_Cap = reader.ReadUShort(); m_Lock = (SkillLock)reader.ReadByte(); break; } case 0xFF: { m_Base = 0; m_Cap = 1000; m_Lock = SkillLock.Up; break; } default: { if ( (version & 0xC0) == 0x00 ) { if ( (version & 0x1) != 0 ) m_Base = reader.ReadUShort(); if ( (version & 0x2) != 0 ) m_Cap = reader.ReadUShort(); else m_Cap = 1000; if ( (version & 0x4) != 0 ) m_Lock = (SkillLock)reader.ReadByte(); } break; } } if ( m_Lock < SkillLock.Up || m_Lock > SkillLock.Locked ) { Console.WriteLine( "Bad skill lock -> {0}.{1}", owner.Owner, m_Lock ); m_Lock = SkillLock.Up; } }
public SkillDistribution( SkillInfo skill ) { m_Skill = skill; }
public static Skill Deserialize( Skills owner, SkillInfo info, GenericReader reader ) { int version = reader.ReadByte(); ushort m_Base = 0; ushort m_Cap = 0; SkillLock m_Lock = SkillLock.Up; switch ( version ) { case 0: { m_Base = reader.ReadUShort(); m_Cap = reader.ReadUShort(); m_Lock = (SkillLock)reader.ReadByte(); break; } case 0xFF: return null; default: { if ( (version & 0xC0) == 0x00 ) { if ( (version & 0x1) != 0 ) m_Base = reader.ReadUShort(); if ( (version & 0x2) != 0 ) m_Cap = reader.ReadUShort(); else m_Cap = 1000; if ( (version & 0x4) != 0 ) m_Lock = (SkillLock)reader.ReadByte(); } break; } } return new Skill(owner, info, m_Base, m_Cap, m_Lock); }
public Skill(Skills owner, SkillInfo info, GenericReader reader) { m_Owner = owner; m_Info = info; int version = reader.ReadByte(); switch (version) { case 0: { m_Base = reader.ReadUShort(); m_Cap = reader.ReadUShort(); m_Lock = (SkillLock)reader.ReadByte(); break; } case 0xFF: { m_Base = 0; m_Cap = 1000; m_Lock = SkillLock.Up; break; } default: { if ((version & 0xC0) == 0x00) { if ((version & 0x1) != 0) { m_Base = reader.ReadUShort(); } if ((version & 0x2) != 0) { m_Cap = reader.ReadUShort(); } else { m_Cap = 1000; } if ((version & 0x4) != 0) { m_Lock = (SkillLock)reader.ReadByte(); } } break; } } if (m_Lock < SkillLock.Up || m_Lock > SkillLock.Locked) { Console.WriteLine("Bad skill lock -> {0}.{1}", owner.Owner, m_Lock); m_Lock = SkillLock.Up; } }
public Skill( Skills owner, SkillInfo info, GenericReader reader ) { m_Owner = owner; m_Info = info; int version = reader.ReadByte(); switch ( version ) { case 0: { m_Base = reader.ReadUShort(); m_Cap = reader.ReadUShort(); m_Lock = (SkillLock)reader.ReadByte(); break; } case 0xFF: { m_Base = 0; m_Cap = 1000; m_Lock = SkillLock.Up; break; } default: { if ( (version & 0xC0) == 0x00 ) { if ( (version & 0x1) != 0 ) m_Base = reader.ReadUShort(); if ( (version & 0x2) != 0 ) m_Cap = reader.ReadUShort(); else m_Cap = 1000; if ( (version & 0x4) != 0 ) m_Lock = (SkillLock)reader.ReadByte(); } break; } } }
public static void resetTable( ) { if( infos.Count > 0 ) { Console.WriteLine(" -//P//- Setting "+infos.Count+" Custom Skills."); } else { Console.WriteLine(" -//P//- No Custom Skills Found."); } SkillInfo[] info = new SkillInfo[infos.Count + SkillInfo.Table.Length]; SkillSettings.DoTell("info Length: " + info.Length + " infos Length: " + infos.Count + " Table Length: " + SkillInfo.Table.Length); try { for (int i = 0; i < info.Length; i++) { if (i < SkillInfo.Table.Length) { info[i] = SkillInfo.Table[i]; NameLocs.Add(SkillInfo.Table[i].Name, i); } else { SkillInfo thisinfo = infos[i - SkillInfo.Table.Length]; info[i] = new SkillInfo(i, thisinfo.Name, thisinfo.StrScale, thisinfo.DexScale, thisinfo.IntScale, thisinfo.Title, thisinfo.Callback, thisinfo.StrGain, thisinfo.DexGain, thisinfo.IntGain, thisinfo.GainFactor); NameLocs.Add(infos[i - SkillInfo.Table.Length].Name, i); SkillSettings.DoTell(" -//P//-Adding Custom Skill: " + info[i].Name); } } } catch (Exception e) { SkillSettings.DoTell("Exception when loading new skills. " + e); } SkillInfo.Table = info; SkillSettings.DoTell("Custom Skills load completed. Table Length: "+SkillInfo.Table.Length); }
public static void RegisterSkill ( SkillInfo si ) { SkillSettings.DoTell("-Registering new CustomSkill: "+si.Name); infos.Add( si ); }
public Skill(Skills owner, SkillInfo info, GenericReader reader) { Owner = owner; Info = info; int version = reader.ReadByte(); switch (version) { case 0: { m_Base = reader.ReadUShort(); m_Cap = reader.ReadUShort(); Lock = (SkillLock)reader.ReadByte(); break; } case 0xFF: { m_Base = 0; m_Cap = 1000; Lock = SkillLock.Up; break; } default: { if ((version & 0xC0) == 0x00) { if ((version & 0x1) != 0) { m_Base = reader.ReadUShort(); } if ((version & 0x2) != 0) { m_Cap = reader.ReadUShort(); } else { m_Cap = 1000; } if ((version & 0x4) != 0) { Lock = (SkillLock)reader.ReadByte(); } if ((version & 0x8) != 0) { VolumeLearned = reader.ReadInt(); } if ((version & 0x10) != 0) { NextGGSGain = reader.ReadDateTime(); } } break; } } if (Lock < SkillLock.Up || Lock > SkillLock.Locked) { Console.WriteLine("Bad skill lock -> {0}.{1}", owner.Owner, Lock); Lock = SkillLock.Up; } }
void TryCast(SkillInfo skill) { if (player.IsDead()) return; Vector3 worldMousePosition = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)); Vector2 direction = (worldMousePosition - player.transform.position); direction.Normalize(); C2S.CastSkill cast = new C2S.CastSkill(player.GetOwner(), skill.skillData.skillName, direction); if (Network.isServer) { Cast(cast.SerializeToBytes(), new NetworkMessageInfo()); } else { GetComponent<NetworkView>().RPC("Cast", RPCMode.Server, cast.SerializeToBytes()); } }
public static int GetIconID(this SkillInfo info) { return((int)GetIcon(info)); }
public static SkillIcon GetIcon(this SkillInfo info) { return(GetIcon((SkillName)info.SkillID)); }