internal void SetupScope(Lua lua, Quest q) { foreach(ConstructorInfo constructor in registeredTriggers) { lua.RegisterFunction(constructor.DeclaringType.Name, q, constructor); } }
public static bool AbleToRunQuest(Quest q) { int count = 0; foreach (QPlayer player in QMain.Players) { foreach (string qname in player.RunningQuests) { if (qname == q.Name) count++; } } return count == 0 || count < q.AmountOfPlayersAtATime; }
public override bool Update(Quest q) { int buffer = count; try { foreach (Item slot in player.Inventory) { if (slot != null) if (slot.name.ToLower() == item.name.ToLower()) count += slot.stack; } } catch (Exception e) { Log.Error(e.Message); } if (count >= amount) { return true; } count = buffer; return false; }
public virtual bool Update(Quest q) { return true; }
public override bool Update(Quest q) { List<NPC> npcs = TShock.Utils.GetNPCByIdOrName(name); if (npcs.Count == 1) { NPC npc = npcs[0]; for (int i = 0; i < amount; i++) { TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, x, y, 1, 1); } return true; } else { throw new FormatException("More than one or no NPCs matched to name or ID."); } }
public override bool Update(Quest q) { if (Message != null) return true; return false; }
public override bool Update(Quest q) { player.TSPlayer.SendMessage(message, color); return true; }
public override bool Update(Quest q) { if (toBeCollected.Count == 0) { return true; } return false; }
public override bool Update(Quest q) { return playerRect.Intersects(targetRect); }
public override bool Update(Quest q) { byte type; if (QTools.GetWallTypeFromName(name, out type)) { if (type < 255) { Main.tile[x, y].wall = (byte)type; } QTools.UpdateTile(x, y); return true; } else { throw new Exception("Invalid Wall Name"); } }
public override bool Update(Quest q) { byte type; if (QTools.GetTileTypeFromName(name, out type)) { if (type < 253) { Main.tile[x, y].type = (byte)type; Main.tile[x, y].active = true; Main.tile[x, y].liquid = 0; Main.tile[x, y].skipLiquid = true; Main.tile[x, y].frameNumber = 0; Main.tile[x, y].frameX = -1; Main.tile[x, y].frameY = -1; } else if (type == 253) { Main.tile[x, y].active = false; Main.tile[x, y].skipLiquid = false; Main.tile[x, y].lava = false; Main.tile[x, y].liquid = 255; Main.tile[x, y].checkingLiquid = false; } else if (type == 254) { Main.tile[x, y].active = false; Main.tile[x, y].skipLiquid = false; Main.tile[x, y].lava = true; Main.tile[x, y].liquid = 255; Main.tile[x, y].checkingLiquid = false; } if ((Main.tile[x, y].type == 53) || (Main.tile[x, y].type == 253) || (Main.tile[x, y].type == 254)) WorldGen.SquareTileFrame(x, y, false); QTools.UpdateTile(x, y); return true; } else { throw new Exception("Invalid Tile Name"); } }
public override bool Update(Quest q) { return player.TSPlayer.Teleport(x, y + 3); }
public bool NewQuest(Quest q, bool skipchecks = false) { if (skipchecks || !this.RunningQuests.Contains(q.Name)) { Thread t = new Thread(QTools.RunQuest); object parameters = new RunQuestParameters(q, this, t); t.Start(parameters); RunningQuestThreads.Add((RunQuestParameters)parameters); return true; } return false; }
public RunQuestParameters(Quest quest, QPlayer player, Thread thread) { Quest = quest; Player = player; QThread = thread; }
public override bool Update(Quest q) { TShock.Utils.Broadcast("Text has been displayed.", Color.Sienna); return true; }
public override bool Update(Quest q) { float amountofmatchedwalls = 0; float totalwallcount = 0; TShockAPI.DB.Region r = TShock.Regions.ZacksGetRegionByName(regionname); byte type; if (QTools.GetWallTypeFromName(walltype, out type)) { if (r != null) { for (int i = r.Area.X; i < (r.Area.X + r.Area.Width); i++) { for (int j = r.Area.Y; j < (r.Area.Y + r.Area.Height); j++) { if (Main.tile[i, j].active && Main.tile[i, j].wall == type) amountofmatchedwalls++; totalwallcount++; } } } } if (totalwallcount != 0) percentage = ((amountofmatchedwalls / totalwallcount) * 100); return true; }
public override bool Update(Quest q) { float amountofmatchedtiles = 0; float totaltilecount = 0; byte type; if (QTools.GetTileTypeFromName(tiletype, out type)) { for (int i = X; i < (X + Width); i++) { for (int j = Y; j < (Y + Height); j++) { if (Main.tile[i, j].active && Main.tile[i, j].type == type) amountofmatchedtiles++; totaltilecount++; } } } if (totaltilecount != 0) percentage = ((amountofmatchedtiles / totaltilecount) * 100); return true; }
public override bool Update(Quest q) { List<int> buffs = TShock.Utils.GetBuffByName(buffname); if (buffs.Count == 1) { player.TSPlayer.SetBuff(buffs[0], time*60); return true; } else { throw new FormatException("More than one or no buffs matched to the name provided."); } }
public override bool Update(Quest q) { float amountofmatchedwalls = 0; float totalwallcount = 0; byte type; if (QTools.GetWallTypeFromName(walltype, out type)) { for (int i = X; i < (X + Width); i++) { for (int j = Y; j < (Y + Height); j++) { if (Main.tile[i, j].wall == type) amountofmatchedwalls++; totalwallcount++; } } } if (totalwallcount != 0) percentage = ((amountofmatchedwalls / totalwallcount) * 100); return true; }
public override bool Update(Quest q) { func.Call(new object[]{args}); return true; }
public override bool Update(Quest q) { if (toBeKilled.Count == 0) return true; return false; }
public override bool Update(Quest q) { TShock.Users.SetUserGroup(TShock.Users.GetUserByName(player.Name), targetGroup); return true; }
public override bool Update(Quest q) { TShock.Utils.Broadcast(message, color); return true; }
public override bool Update(Quest q) { q.PauseTime += DelayTime; return true; }
public override bool Update(Quest q) { player.TSPlayer.GiveItem(item.type, item.name, item.width, item.height, item.stack, item.prefix); return true; }
public override bool Update(Quest q) { Main.tile[x, y].active = false; Main.tile[x, y].wall = 0; Main.tile[x, y].skipLiquid = true; Main.tile[x, y].liquid = 0; QTools.UpdateTile(x, y); return true; }
public override bool Update(Quest q) { List<NPC> npcs = TShock.Utils.GetNPCByIdOrName(name); if (npcs.Count == 1) { NPC npc = npcs[0]; for (int i = 0; i < amount; i++) { int sx; int sy; TShock.Utils.GetRandomClearTileWithInRange(x, y, 5, 5, out sx, out sy); int index = NPC.NewNPC(sx, sy, npc.type); Main.npc[index].SetDefaults(npc.type); Main.npc[index].netDefaults(npc.type); SetModdedMob(ref Main.npc[index]); NetMessage.SendData(23, -1, -1, "", index, 0f, 0f, 0f, 0); } return true; } else { throw new FormatException("More than one or no NPCs matched to name or ID."); } }
public override bool Update(Quest q) { Main.tile[x, y].wall = 0; QTools.UpdateTile(x, y); return true; }