public override bool UnInstallMod(Service service, GenericMod gameMod) { try { var server = Server.GetSelectedServer(); var modIoConfiguration = ModIoBrowser.GetModIoConfigurationForCurrentGame(); var modForGame = MMod.GetModForGame(modIoConfiguration.SelectedGameId, int.Parse(gameMod.Id)); var script = GenerateScript(service, modIoConfiguration, false); var modJson = JsonConvert.SerializeObject(modForGame); var type = gameMod.GetType(); server.ServerUtilitiesService.ExecuteScript(script, 1, new[] { new JsonSerializedScriptVariable { Name = "Mod", Value = modJson, Type = type.FullNameWithAssembly() } }); return(true); } catch (Exception e) { _logger.LogException(e); return(false); } }
public void AddMod(MMod param) { param.AuthorID = CurrentUser.PlatformID; BeginDb(DAL => { DAL.AddMod(param); }); }
private static void DownloadMod(MMod mod) { var downloadUrl = mod.Modfile.Download.BinaryUrl; var fileNameSavePath = Path.Combine(TCAdmin.SDK.Utility.GetTempPath(), mod.Modfile.Filename); using (var webClient = new WebClient()) { webClient.DownloadFile(downloadUrl, fileNameSavePath); } }
public void AddMod(MMod param) { string sql = $@"SELECT 1 from Mod WHERE imgUrl = @{nameof(param.ImgUrl)}"; bool exist = Db.ExecuteScalar <int>(sql, param) == 1; if (exist) { return; } Db.Insert("Mod", param, new[] { nameof(param.ID), nameof(param.UploadDate), nameof(param.Star), nameof(param.StarCount) }); }
public override void Kill(int timeLeft) { MMod.explosionEffect(projectile, 1f); Player target = Main.player[(int)projectile.ai[0]]; float dX = target.position.X + (float)target.width * 0.5f - projectile.Center.X; float dY = target.position.Y - projectile.Center.Y; float distance = (float)System.Math.Sqrt((double)(dX * dX + dY * dY)); if (distance < 50) { for (int i = 0; i < Main.npc.Length - 1; i++) { NPC berramyr = Main.npc[i]; if (berramyr.type == mod.NPCType("Berramyr")) { target.Hurt(PlayerDeathReason.ByNPC(i), 10, projectile.direction); } } } }
public override GenericMod GetMod(string s, ModSearchType modSearchType) { var modIoConfiguration = ModIoBrowser.GetModIoConfigurationForCurrentGame(); return(MMod.GetModForGame(modIoConfiguration.SelectedGameId, int.Parse(s))); }
private void floatAround(Vector2 moveTo, Player p) { float fOne = (float)Main.rand.Next(-100, 100); float fTwo = (float)Main.rand.Next(-100, 100); float pX = p.Center.X - npc.Center.X; float pY = p.Center.Y - npc.Center.Y; float pDistance = (float)System.Math.Sqrt((double)(pX * pX + pY * pY)); if (portCoolDown > 0) { portCoolDown--; } if (pDistance < 50 && portCoolDown == 0) { MMod.explosionEffect(npc, 4f); for (int i = 0; i < 255; i++) { Player players = Main.player[i]; float dX = players.Center.X - npc.Center.X; float dY = players.Center.Y - npc.Center.Y; float playersDistance = (float)System.Math.Sqrt((double)dX * dX + dY * dY); if (playersDistance < 50) { p.Hurt(PlayerDeathReason.ByNPC(npc.whoAmI), 30, p.direction); } } int[] posNeg = { 1, -1 }; float sX = posNeg[Main.rand.Next(0, 1)]; float sY = posNeg[Main.rand.Next(0, 1)]; float tDistance = 400f; npc.position.X = p.Center.X + (tDistance * sX) + fOne; npc.position.Y = p.Center.Y + (tDistance * sY) + fTwo; didOnce = 0; portCoolDown = 180; } float moveToX = moveTo.X - npc.Center.X + fOne; float moveToY = moveTo.Y - npc.Center.Y + fTwo; float distance = (float)System.Math.Sqrt((double)(moveToX * moveToX + moveToY * moveToY)); float speed = 5f; if (pDistance > 500) { speed = 15f; } distance = speed / distance; moveToX *= distance; moveToY *= distance; if (pDistance > 500) { pX += fOne * 2; pY += fTwo * 2; pX *= distance; pY *= distance; } if (didOnce == 0 || pDistance > 500) { npc.velocity.X = moveToX; npc.velocity.Y = moveToY; if (pDistance > 500) { npc.velocity.X = pX; npc.velocity.Y = pY; } didOnce = 1; } if (mode == 4) { flammenWheel(p); } }
public void AddMod([FromBody] MMod param) => BLL.AddMod(param);