public static void LoadProjectiles() { string filename; int i; CheckProjectile(); for (i = 1; i <= MAX_PROJECTILES; i++) { filename = Path.Combine(Application.StartupPath, "data", "projectiles", string.Format("projectile{0}.dat", i)); ByteStream reader = new ByteStream(); ByteFile.Load(filename, ref reader); Projectiles[i].Name = reader.ReadString(); Projectiles[i].Sprite = reader.ReadInt32(); Projectiles[i].Range = reader.ReadByte(); Projectiles[i].Speed = reader.ReadInt32(); Projectiles[i].Damage = reader.ReadInt32(); //Logic Projectiles[i].OnInstantiate = reader.ReadString(); Projectiles[i].OnUpdate = reader.ReadString(); Projectiles[i].OnHitWall = reader.ReadString(); Projectiles[i].OnHitEntity = reader.ReadString(); } }
public static void LoadRecipe(int RecipeNum) { string filename; int i; CheckRecipes(); filename = Path.Combine(Application.StartupPath, "data", "recipes", string.Format("recipe{0}.dat", RecipeNum)); ByteStream reader = new ByteStream(); ByteFile.Load(filename, ref reader); Recipe[RecipeNum].Name = reader.ReadString(); Recipe[RecipeNum].RecipeType = reader.ReadByte(); Recipe[RecipeNum].MakeItemNum = reader.ReadInt32(); Recipe[RecipeNum].MakeItemAmount = reader.ReadInt32(); Recipe[RecipeNum].Ingredients = new IngredientsRec[Constants.MAX_INGREDIENT + 1]; for (i = 1; i <= Constants.MAX_INGREDIENT; i++) { Recipe[RecipeNum].Ingredients[i].ItemNum = reader.ReadInt32(); Recipe[RecipeNum].Ingredients[i].Value = reader.ReadInt32(); } Recipe[RecipeNum].CreateTime = reader.ReadByte(); }
public Task <RecivedId> Add(string body, ByteFile file, int linkId, int precedentCommentId = -1) { if (file == null) { throw new ArgumentNullException(nameof(file)); } if (String.IsNullOrWhiteSpace(body)) { throw new ArgumentException("Argument is null or whitespace", nameof(body)); } var parameters = GetApiParameterSet(); var methodParameters = new SortedSet <StringMethodParameter> { new StringMethodParameter("param1", linkId) }; if (precedentCommentId != -1) { methodParameters.Add(new StringMethodParameter("param2", precedentCommentId)); } var postParameters = new SortedSet <PostParameter> { new StringPostParameter("body", body), new BytePostParameter("embed", file) }; return(Client.CallApiMethodWithAuth <RecivedId>( new ApiMethod(ApiV1Constants.CommentsAdd, HttpMethod.Post, parameters, methodParameters, postParameters) )); }
public Task <BooleanModel> Send(string username, string body, ByteFile file) { if (file == null) { throw new ArgumentNullException(nameof(file)); } if (string.IsNullOrWhiteSpace(username)) { throw new ArgumentException("Argument is null or whitespace", nameof(username)); } if (string.IsNullOrWhiteSpace(body)) { throw new ArgumentException("Argument is null or whitespace", nameof(body)); } var parameters = GetApiParameterSet(); var methodParameters = new SortedSet <StringMethodParameter> { new StringMethodParameter("param1", username) }; var postParameters = new SortedSet <PostParameter> { new StringPostParameter("body", body), new BytePostParameter("embed", file) }; return(Client.CallApiMethodWithAuth <BooleanModel>( new ApiMethod(ApiV1Constants.PmSendMessage, HttpMethod.Post, parameters, methodParameters, postParameters) )); }
public static void SaveResource(int ResourceNum) { string filename; filename = Path.Combine(Application.StartupPath, "data", "resources", string.Format("resource{0}.dat", ResourceNum)); ByteStream writer = new ByteStream(100); writer.WriteString(Types.Resource[ResourceNum].Name); writer.WriteString(Types.Resource[ResourceNum].SuccessMessage); writer.WriteString(Types.Resource[ResourceNum].EmptyMessage); writer.WriteInt32(Types.Resource[ResourceNum].ResourceType); writer.WriteInt32(Types.Resource[ResourceNum].ResourceImage); writer.WriteInt32(Types.Resource[ResourceNum].ExhaustedImage); writer.WriteInt32(Types.Resource[ResourceNum].ExpReward); writer.WriteInt32(Types.Resource[ResourceNum].ItemReward); writer.WriteInt32(Types.Resource[ResourceNum].LvlRequired); writer.WriteInt32(Types.Resource[ResourceNum].ToolRequired); writer.WriteInt32(Types.Resource[ResourceNum].Health); writer.WriteInt32(Types.Resource[ResourceNum].RespawnTime); writer.WriteBoolean(Types.Resource[ResourceNum].Walkthrough); writer.WriteInt32(Types.Resource[ResourceNum].Animation); ByteFile.Save(filename, ref writer); }
public static void LoadAnimation(int AnimationNum) { string filename; filename = Path.Combine(Application.StartupPath, "data", "animations", string.Format("animation{0}.dat", AnimationNum)); ByteStream reader = new ByteStream(); ByteFile.Load(filename, ref reader); Types.Animation[AnimationNum].Name = reader.ReadString(); Types.Animation[AnimationNum].Sound = reader.ReadString(); var loopTo = Information.UBound(Types.Animation[AnimationNum].Sprite); for (var x = 0; x <= loopTo; x++) { Types.Animation[AnimationNum].Sprite[x] = reader.ReadInt32(); } var loopTo1 = Information.UBound(Types.Animation[AnimationNum].Frames); for (int x = 0; x <= loopTo1; x++) { Types.Animation[AnimationNum].Frames[x] = reader.ReadInt32(); } var loopTo2 = Information.UBound(Types.Animation[AnimationNum].LoopCount); for (int x = 0; x <= loopTo2; x++) { Types.Animation[AnimationNum].LoopCount[x] = reader.ReadInt32(); } var loopTo3 = Information.UBound(Types.Animation[AnimationNum].LoopTime); for (int x = 0; x <= loopTo3; x++) { Types.Animation[AnimationNum].LoopTime[x] = reader.ReadInt32(); } if (Types.Animation[AnimationNum].Name == null) { Types.Animation[AnimationNum].Name = ""; } }
public static void SaveProjectile(int ProjectileNum) { string filename; filename = Path.Combine(Application.StartupPath, "data", "projectiles", string.Format("projectile{0}.dat", ProjectileNum)); ByteStream writer = new ByteStream(100); writer.WriteString(Projectiles[ProjectileNum].Name); writer.WriteInt32(Projectiles[ProjectileNum].Sprite); writer.WriteByte(Projectiles[ProjectileNum].Range); writer.WriteInt32(Projectiles[ProjectileNum].Speed); writer.WriteInt32(Projectiles[ProjectileNum].Damage); //Logic writer.WriteString(Projectiles[ProjectileNum].OnInstantiate); writer.WriteString(Projectiles[ProjectileNum].OnUpdate); writer.WriteString(Projectiles[ProjectileNum].OnHitWall); writer.WriteString(Projectiles[ProjectileNum].OnHitEntity); ByteFile.Save(filename, ref writer); }
public static void SaveAnimation(int AnimationNum) { string filename; int x; filename = Path.Combine(Application.StartupPath, "data", "animations", string.Format("animation{0}.dat", AnimationNum)); ByteStream writer = new ByteStream(100); writer.WriteString(Types.Animation[AnimationNum].Name); writer.WriteString(Types.Animation[AnimationNum].Sound); var loopTo = Information.UBound(Types.Animation[AnimationNum].Sprite); for (x = 0; x <= loopTo; x++) { writer.WriteInt32(Types.Animation[AnimationNum].Sprite[x]); } var loopTo1 = Information.UBound(Types.Animation[AnimationNum].Frames); for (x = 0; x <= loopTo1; x++) { writer.WriteInt32(Types.Animation[AnimationNum].Frames[x]); } var loopTo2 = Information.UBound(Types.Animation[AnimationNum].LoopCount); for (x = 0; x <= loopTo2; x++) { writer.WriteInt32(Types.Animation[AnimationNum].LoopCount[x]); } var loopTo3 = Information.UBound(Types.Animation[AnimationNum].LoopTime); for (x = 0; x <= loopTo3; x++) { writer.WriteInt32(Types.Animation[AnimationNum].LoopTime[x]); } ByteFile.Save(filename, ref writer); }
public Task <RecivedId> Add(string body, ByteFile file) { if (string.IsNullOrWhiteSpace(body)) { throw new ArgumentException("Argument is null or whitespace", nameof(body)); } if (file == null) { throw new ArgumentNullException(nameof(file)); } var parameters = GetApiParameterSet(); var postParameters = new SortedSet <PostParameter> { new StringPostParameter("accountkey", Client.AccountKey), new StringPostParameter("body", body), new BytePostParameter("embed", file) }; return(Client.CallApiMethodWithAuth <RecivedId>( new ApiMethod(ApiV1Constants.EntriesAdd, HttpMethod.Post, parameters, postParameters) )); }
public static void LoadResource(int ResourceNum) { string filename; filename = Path.Combine(Application.StartupPath, "data", "resources", string.Format("resource{0}.dat", ResourceNum)); ByteStream reader = new ByteStream(); ByteFile.Load(filename, ref reader); Types.Resource[ResourceNum].Name = reader.ReadString(); Types.Resource[ResourceNum].SuccessMessage = reader.ReadString(); Types.Resource[ResourceNum].EmptyMessage = reader.ReadString(); Types.Resource[ResourceNum].ResourceType = reader.ReadInt32(); Types.Resource[ResourceNum].ResourceImage = reader.ReadInt32(); Types.Resource[ResourceNum].ExhaustedImage = reader.ReadInt32(); Types.Resource[ResourceNum].ExpReward = reader.ReadInt32(); Types.Resource[ResourceNum].ItemReward = reader.ReadInt32(); Types.Resource[ResourceNum].LvlRequired = reader.ReadInt32(); Types.Resource[ResourceNum].ToolRequired = reader.ReadInt32(); Types.Resource[ResourceNum].Health = reader.ReadInt32(); Types.Resource[ResourceNum].RespawnTime = reader.ReadInt32(); Types.Resource[ResourceNum].Walkthrough = reader.ReadBoolean(); Types.Resource[ResourceNum].Animation = reader.ReadInt32(); if (Types.Resource[ResourceNum].Name == null) { Types.Resource[ResourceNum].Name = ""; } if (Types.Resource[ResourceNum].EmptyMessage == null) { Types.Resource[ResourceNum].EmptyMessage = ""; } if (Types.Resource[ResourceNum].SuccessMessage == null) { Types.Resource[ResourceNum].SuccessMessage = ""; } }
public static void SaveRecipe(int RecipeNum) { string filename; int i; filename = Path.Combine(Application.StartupPath, "data", "recipes", string.Format("recipe{0}.dat", RecipeNum)); ByteStream writer = new ByteStream(100); writer.WriteString(Recipe[RecipeNum].Name); writer.WriteByte(Recipe[RecipeNum].RecipeType); writer.WriteInt32(Recipe[RecipeNum].MakeItemNum); writer.WriteInt32(Recipe[RecipeNum].MakeItemAmount); for (i = 1; i <= Constants.MAX_INGREDIENT; i++) { writer.WriteInt32(Recipe[RecipeNum].Ingredients[i].ItemNum); writer.WriteInt32(Recipe[RecipeNum].Ingredients[i].Value); } writer.WriteByte(Recipe[RecipeNum].CreateTime); ByteFile.Save(filename, ref writer); }
public Task <RecivedId> Add(string body, ByteFile file, int linkId, int precedentCommentId = -1) { throw new NotImplementedException(); }
public Task <BooleanModel> Send(string username, string body, ByteFile file) { throw new NotImplementedException(); }
public static void SaveQuest(int QuestNum) { string filename; int I; filename = Path.Combine(Application.StartupPath, "data", "quests", string.Format("quest{0}.dat", QuestNum)); ByteStream writer = new ByteStream(100); writer.WriteString(Quest[QuestNum].Name); writer.WriteString(Quest[QuestNum].QuestLog); writer.WriteByte(Quest[QuestNum].Repeat); writer.WriteByte(Quest[QuestNum].Cancelable); writer.WriteInt32(Quest[QuestNum].ReqCount); var loopTo = Quest[QuestNum].ReqCount; for (I = 1; I <= loopTo; I++) { writer.WriteInt32(Quest[QuestNum].Requirement[I]); writer.WriteInt32(Quest[QuestNum].RequirementIndex[I]); } writer.WriteInt32(Quest[QuestNum].QuestGiveItem); writer.WriteInt32(Quest[QuestNum].QuestGiveItemValue); writer.WriteInt32(Quest[QuestNum].QuestRemoveItem); writer.WriteInt32(Quest[QuestNum].QuestRemoveItemValue); for (I = 1; I <= 3; I++) { writer.WriteString(Quest[QuestNum].Chat[I]); } writer.WriteInt32(Quest[QuestNum].RewardCount); var loopTo1 = Quest[QuestNum].RewardCount; for (I = 1; I <= loopTo1; I++) { writer.WriteInt32(Quest[QuestNum].RewardItem[I]); writer.WriteInt32(Quest[QuestNum].RewardItemAmount[I]); } writer.WriteInt32(Quest[QuestNum].RewardExp); writer.WriteInt32(Quest[QuestNum].TaskCount); var loopTo2 = Quest[QuestNum].TaskCount; for (I = 1; I <= loopTo2; I++) { writer.WriteInt32(Quest[QuestNum].Task[I].Order); writer.WriteInt32(Quest[QuestNum].Task[I].NPC); writer.WriteInt32(Quest[QuestNum].Task[I].Item); writer.WriteInt32(Quest[QuestNum].Task[I].Map); writer.WriteInt32(Quest[QuestNum].Task[I].Resource); writer.WriteInt32(Quest[QuestNum].Task[I].Amount); writer.WriteString(Quest[QuestNum].Task[I].Speech); writer.WriteString(Quest[QuestNum].Task[I].TaskLog); writer.WriteByte(Quest[QuestNum].Task[I].QuestEnd); writer.WriteInt32(Quest[QuestNum].Task[I].TaskType); } ByteFile.Save(filename, ref writer); }
public static void LoadQuest(int QuestNum) { string FileName; int I; FileName = Path.Combine(Application.StartupPath, "data", "quests", string.Format("quest{0}.dat", QuestNum)); ByteStream reader = new ByteStream(); ByteFile.Load(FileName, ref reader); Quest[QuestNum].Name = reader.ReadString(); Quest[QuestNum].QuestLog = reader.ReadString(); Quest[QuestNum].Repeat = reader.ReadByte(); Quest[QuestNum].Cancelable = reader.ReadByte(); Quest[QuestNum].ReqCount = reader.ReadInt32(); Quest[QuestNum].Requirement = new int[Quest[QuestNum].ReqCount + 1]; Quest[QuestNum].RequirementIndex = new int[Quest[QuestNum].ReqCount + 1]; var loopTo = Quest[QuestNum].ReqCount; for (I = 1; I <= loopTo; I++) { Quest[QuestNum].Requirement[I] = reader.ReadInt32(); Quest[QuestNum].RequirementIndex[I] = reader.ReadInt32(); } Quest[QuestNum].QuestGiveItem = reader.ReadInt32(); Quest[QuestNum].QuestGiveItemValue = reader.ReadInt32(); Quest[QuestNum].QuestRemoveItem = reader.ReadInt32(); Quest[QuestNum].QuestRemoveItemValue = reader.ReadInt32(); for (I = 1; I <= 3; I++) { Quest[QuestNum].Chat[I] = reader.ReadString(); } Quest[QuestNum].RewardCount = reader.ReadInt32(); Quest[QuestNum].RewardItem = new int[Quest[QuestNum].RewardCount + 1]; Quest[QuestNum].RewardItemAmount = new int[Quest[QuestNum].RewardCount + 1]; var loopTo1 = Quest[QuestNum].RewardCount; for (I = 1; I <= loopTo1; I++) { Quest[QuestNum].RewardItem[I] = reader.ReadInt32(); Quest[QuestNum].RewardItemAmount[I] = reader.ReadInt32(); } Quest[QuestNum].RewardExp = reader.ReadInt32(); Quest[QuestNum].TaskCount = reader.ReadInt32(); Quest[QuestNum].Task = new TaskRec[Quest[QuestNum].TaskCount + 1]; var loopTo2 = Quest[QuestNum].TaskCount; for (I = 1; I <= loopTo2; I++) { Quest[QuestNum].Task[I].Order = reader.ReadInt32(); Quest[QuestNum].Task[I].NPC = reader.ReadInt32(); Quest[QuestNum].Task[I].Item = reader.ReadInt32(); Quest[QuestNum].Task[I].Map = reader.ReadInt32(); Quest[QuestNum].Task[I].Resource = reader.ReadInt32(); Quest[QuestNum].Task[I].Amount = reader.ReadInt32(); Quest[QuestNum].Task[I].Speech = reader.ReadString(); Quest[QuestNum].Task[I].TaskLog = reader.ReadString(); Quest[QuestNum].Task[I].QuestEnd = reader.ReadByte(); Quest[QuestNum].Task[I].TaskType = reader.ReadInt32(); } }
public static void SaveItem(int itemNum) { string filename; filename = Path.Combine(Application.StartupPath, "data", "items", string.Format("item{0}.dat", itemNum)); ByteStream writer = new ByteStream(100); writer.WriteString(Types.Item[itemNum].Name); writer.WriteInt32(Types.Item[itemNum].Pic); writer.WriteString(Types.Item[itemNum].Description); writer.WriteByte(Types.Item[itemNum].Type); writer.WriteByte(Types.Item[itemNum].SubType); writer.WriteInt32(Types.Item[itemNum].Data1); writer.WriteInt32(Types.Item[itemNum].Data2); writer.WriteInt32(Types.Item[itemNum].Data3); writer.WriteInt32(Types.Item[itemNum].ClassReq); writer.WriteInt32(Types.Item[itemNum].AccessReq); writer.WriteInt32(Types.Item[itemNum].LevelReq); writer.WriteByte(Types.Item[itemNum].Mastery); writer.WriteInt32(Types.Item[itemNum].Price); for (var i = 0; i <= (int)Enums.StatType.Count - 1; i++) { writer.WriteByte(Types.Item[itemNum].Add_Stat[i]); } writer.WriteByte(Types.Item[itemNum].Rarity); writer.WriteInt32(Types.Item[itemNum].Speed); writer.WriteInt32(Types.Item[itemNum].TwoHanded); writer.WriteByte(Types.Item[itemNum].BindType); for (var i = 0; i <= (int)Enums.StatType.Count - 1; i++) { writer.WriteByte(Types.Item[itemNum].Stat_Req[i]); } writer.WriteInt32(Types.Item[itemNum].Animation); writer.WriteInt32(Types.Item[itemNum].Paperdoll); // Housing writer.WriteInt32(Types.Item[itemNum].FurnitureWidth); writer.WriteInt32(Types.Item[itemNum].FurnitureHeight); for (var a = 0; a <= 3; a++) { for (var b = 0; b <= 3; b++) { writer.WriteInt32(Types.Item[itemNum].FurnitureBlocks[a, b]); writer.WriteInt32(Types.Item[itemNum].FurnitureFringe[a, b]); } } writer.WriteByte(Types.Item[itemNum].KnockBack); writer.WriteByte(Types.Item[itemNum].KnockBackTiles); writer.WriteByte(Types.Item[itemNum].Randomize); writer.WriteByte(Types.Item[itemNum].RandomMin); writer.WriteByte(Types.Item[itemNum].RandomMax); writer.WriteByte(Types.Item[itemNum].Stackable); writer.WriteByte(Types.Item[itemNum].ItemLevel); writer.WriteInt32(Types.Item[itemNum].Projectile); writer.WriteInt32(Types.Item[itemNum].Ammo); ByteFile.Save(filename, ref writer); }
public static void LoadItem(int ItemNum) { string filename; int s; filename = Path.Combine(Application.StartupPath, "data", "items", string.Format("item{0}.dat", ItemNum)); ByteStream reader = new ByteStream(); ByteFile.Load(filename, ref reader); Types.Item[ItemNum].Name = reader.ReadString(); Types.Item[ItemNum].Pic = reader.ReadInt32(); Types.Item[ItemNum].Description = reader.ReadString(); Types.Item[ItemNum].Type = reader.ReadByte(); Types.Item[ItemNum].SubType = reader.ReadByte(); Types.Item[ItemNum].Data1 = reader.ReadInt32(); Types.Item[ItemNum].Data2 = reader.ReadInt32(); Types.Item[ItemNum].Data3 = reader.ReadInt32(); Types.Item[ItemNum].ClassReq = reader.ReadInt32(); Types.Item[ItemNum].AccessReq = reader.ReadInt32(); Types.Item[ItemNum].LevelReq = reader.ReadInt32(); Types.Item[ItemNum].Mastery = reader.ReadByte(); Types.Item[ItemNum].Price = reader.ReadInt32(); for (s = 0; s <= (int)Enums.StatType.Count - 1; s++) { Types.Item[ItemNum].Add_Stat[s] = reader.ReadByte(); } Types.Item[ItemNum].Rarity = reader.ReadByte(); Types.Item[ItemNum].Speed = reader.ReadInt32(); Types.Item[ItemNum].TwoHanded = reader.ReadInt32(); Types.Item[ItemNum].BindType = reader.ReadByte(); for (s = 0; s <= (int)Enums.StatType.Count - 1; s++) { Types.Item[ItemNum].Stat_Req[s] = reader.ReadByte(); } Types.Item[ItemNum].Animation = reader.ReadInt32(); Types.Item[ItemNum].Paperdoll = reader.ReadInt32(); // Housing Types.Item[ItemNum].FurnitureWidth = reader.ReadInt32(); Types.Item[ItemNum].FurnitureHeight = reader.ReadInt32(); for (var a = 0; a <= 3; a++) { for (var b = 0; b <= 3; b++) { Types.Item[ItemNum].FurnitureBlocks[a, b] = reader.ReadInt32(); Types.Item[ItemNum].FurnitureFringe[a, b] = reader.ReadInt32(); } } Types.Item[ItemNum].KnockBack = reader.ReadByte(); Types.Item[ItemNum].KnockBackTiles = reader.ReadByte(); Types.Item[ItemNum].Randomize = reader.ReadByte(); Types.Item[ItemNum].RandomMin = reader.ReadByte(); Types.Item[ItemNum].RandomMax = reader.ReadByte(); Types.Item[ItemNum].Stackable = reader.ReadByte(); Types.Item[ItemNum].ItemLevel = reader.ReadByte(); Types.Item[ItemNum].Projectile = reader.ReadInt32(); Types.Item[ItemNum].Ammo = reader.ReadInt32(); }
public Task <RecivedId> Add(string body, ByteFile file) { throw new NotImplementedException(); }