コード例 #1
0
ファイル: rodent.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}
	config, err := eqconfig.Load()
	if err != nil {
		return
	}

	ids, err := spawngroup.GetSpawnGroupIdsByNameWildcard(db, "a_rodent")
	if err != nil {
		err = fmt.Errorf("Error getting %s Ids: %s", focus, err.Error())
		return
	}
	if len(ids) < 1 {
		fmt.Println("No", focus, "were found to delete")
		return
	}

	//Exterminators
	extids, err := spawngroup.GetSpawnGroupIdsByNameWildcard(db, "exterminator_")
	if err != nil {
		err = fmt.Errorf("Error getting exterminator Ids: %s", err.Error())
		return
	}
	if len(extids) > 1 {
		for _, extid := range extids {
			ids = append(ids, extid)
		}
	}

	totalChanged, err := spawngroup.RemoveSpawnGroupAndEntryById(db, ids)
	if err != nil {
		err = fmt.Errorf("Error removing", focus, "entries: %s", err.Error())
		return
	}
	fmt.Println("Removed", totalChanged, " DB entries related to", focus, "in spawnentry and spawngroup successfully.")

	filePaths := []string{
		"felwithea/Exterminator_Valern.pl",
		"freeporteast/Exterminator_Larkey.lua",
		"freeporteast/Exterminator_Qalantir.lua",
		"freporte/Exterminator_Larkey.lua",
		"freportw/Exterminator_Qalantir.lua",
		"kaladimb/Exterminator_Vin.pl",
		"neriakb/Exterminator_Damasi.pl",
		"neriakc/Exterminator_Gilea.pl",
		"qeynos/Exterminator_Rasmon.lua",
		"qeynos2/Exterminator_Wintloag.lua",
		"rivervale/Exterminator_Sutten.lua",
	}

	delCount, err := quest.Remove(config, filePaths)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println("Deleted", delCount, focus, "related quest files")
	return
}
コード例 #2
0
ファイル: eqdb.go プロジェクト: Xackery/eqcleanup
func Load() (d *sqlx.DB, err error) {
	config, err := eqconfig.Load()
	if err != nil {
		return
	}

	if db != nil {
		d = db
		return
	}
	db, err = sqlx.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=true", config.Database.Username, config.Database.Password, config.Database.Host, config.Database.Port, config.Database.Db))
	if err != nil {
		err = fmt.Errorf("error connecting to db: %s", err.Error())
		return
	}
	d = db
	return
}
コード例 #3
0
ファイル: nexus.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}
	config, err := eqconfig.Load()
	if err != nil {
		return
	}
	ids, err := spawngroup.GetSpawnGroupIdsByNameWildcard(db, "nexus_scion")
	if err != nil {
		err = fmt.Errorf("Error getting %s Ids: %s", focus, err.Error())
		return
	}
	vids, err := spawngroup.GetSpawnGroupIdsByNameWildcard(db, "a_mystic_voice")
	for _, id := range vids {
		ids = append(ids, id)
	}

	totalChanged, err := spawngroup.RemoveSpawnGroupAndEntryById(db, ids)
	if err != nil {
		err = fmt.Errorf("Error removing", focus, "entries: %s", err.Error())
		return
	}
	fmt.Println("Removed", totalChanged, " DB entries related to", focus, "in spawnentry and spawngroup successfully.")

	filePaths := []string{
		"dreadlands/A_Mystic_Voice.lua",
		"gfaydark/A_Mystic_Voice.pl",
		"greatdivide/A_Mystic_Voice.pl",
		"northkarana/A_Mystic_Voice.lua",
		"tox/A_Mystic_Voice.pl",
		"toxxulia/A_Mystic_Voice.pl",
	}

	delCount, err := quest.Remove(config, filePaths)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println("Deleted", delCount, focus, "related quest files")
	return
}
コード例 #4
0
ファイル: eraitem.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}
	config, err := eqconfig.Load()
	if err != nil {
		return
	}

	//Mobs
	ids := []int64{
		111050, //Gellrazz Scalerunner
		25429,  //a dark spirit of nektulos
		59438,  //coldwind blackfoot
		48343,  //immug lashtail
		13138,  //frog invasion
		6251,
	}
	//#checkpoint_ten

	spawngroup.RemoveSpawnGroupAndEntryById(db, ids)

	//Items
	ids = loadIds()
	totalChanged, err := item.RemoveAllInstancesOfItems(db, ids)
	if err != nil {
		return
	}
	fmt.Println("Removed", totalChanged, " DB entries related to", focus, "in all player-accessible item locations.")

	filePaths := []string{
	//"befallen/Wraps_McGee.lua",
	}

	delCount, err := quest.Remove(config, filePaths)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println("Deleted", delCount, focus, "related quest files")
	return
}
コード例 #5
0
ファイル: priest.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}

	config, err := eqconfig.Load()
	if err != nil {
		return
	}
	ids, err := spawngroup.GetSpawnGroupIdsByNameWildcard(db, "priest_of_discord")
	if err != nil {
		err = fmt.Errorf("Error getting %s Ids: %s", focus, err.Error())
		return
	}
	if len(ids) < 1 {
		fmt.Println("No ", focus, "were found to delete")
		return
	}
	totalChanged, err := spawngroup.RemoveSpawnGroupAndEntryById(db, ids)
	if err != nil {
		err = fmt.Errorf("Error removing", focus, "entries: %s", err.Error())
		return
	}
	fmt.Println("Removed", totalChanged, " DB entries related to", focus, "in spawnentry and spawngroup successfully.")

	filePaths := []string{
		"global/Priest_of_Discord.lua",
		"kaladima/Priest_of_Discord.pl",
	}

	delCount, err := quest.Remove(config, filePaths)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println("Deleted", delCount, focus, "related quest files")
	return
}
コード例 #6
0
ファイル: soulbinder.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}
	config, err := eqconfig.Load()
	if err != nil {
		return
	}
	ids, err := spawngroup.GetSpawnGroupIdsByNameWildcard(db, focus)
	ids = append(ids, 3199)  //Add Romi to delete list
	ids = append(ids, 54932) //And priestess aelea
	if err != nil {
		err = fmt.Errorf("Error getting %s Ids: %s", focus, err.Error())
		return
	}
	if len(ids) < 1 {
		fmt.Println("No", focus, "were found to delete")
		return
	}
	totalChanged, err := spawngroup.RemoveSpawnGroupAndEntryById(db, ids)
	if err != nil {
		err = fmt.Errorf("Error removing", focus, "entries: %s", err.Error())
		return
	}
	fmt.Println("Removed", totalChanged, " DB entries related to", focus, "in spawnentry and spawngroup successfully.")

	filePaths := []string{
		"abysmal/Soulbinder_Jerlin.pl",
		"cabeast/Soulbinder_Shakar.pl",
		"commonlands/Soulbinder_Jubbl.pl",
		"crescent/Priestess_Aelea.pl",
		"ecommons/Soulbinder_Jubbl.pl",
		"everfrost/Soulbinder_Garnog.pl",
		"firiona/Soulbinder_Tardon.pl",
		"gfaydark/Soulbinder_Oakstout.pl",
		"guildlobby/High_Priest_of_Luclin.pl",
		"guildlobby/High_Priestess_of_Luclin.pl",
		"gukta/Soulbinder_Snog.pl",
		"gukta/Soulbinder_Zlippi.pl",
		"gunthak/Soulbinder_Karyin.pl",
		"iceclad/Soulbinder_Cubnitskin.pl",
		"kaladima/Soulbinder_Torvald.pl",
		"neriaka/Soulbinder_Nola_Z-Ret.pl",
		"neriaka/Soulbinder_Novalu.pl",
		"northkarana/Romi.pl",
		"northro/Soulbinder_Ragni.pl",
		"nro/Soulbinder_Ragni.pl",
		"oggok/Soulbinder_Trurg.pl",
		"overthere/Soulbinder_Kardin.pl",
		"paineel/Soulbinder_Tomas.pl",
		//"plugins/default-actions.pl", //There is a soulbinder flag here, ignoring though
		"plugins/soulbinders.pl",
		"poknowledge/Soulbinder_Jera.pl",
		"potranquility/Soulbinder_Derith.pl",
		"rathemtn/Soulbinder_Zlippi.pl",
		"shadowhaven/Soulbinder_Nansin.pl",
		"sharvahl/Soulbinder_Ghula.pl",
		"southro/Soulbinder_Silandra.pl",
		"sro/Soulbinder_Silandra.pl",
	}

	delCount, err := quest.Remove(config, filePaths)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println("Deleted", delCount, focus, "related quest files")
	return
}
コード例 #7
0
ファイル: paw.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}
	config, err := eqconfig.Load()
	if err != nil {
		return
	}

	var totalChanged int64
	var result sql.Result
	if len(lootdrops) < 1 {
		err = fmt.Errorf("lootdrops empty! Please download a newer eqcleanup")
		return
	}
	if len(lootdropentries) < 1 {
		err = fmt.Errorf("lootdropentries empty! Please download a newer eqcleanup")
		return
	}
	if len(loottables) < 1 {
		err = fmt.Errorf("loottables empty! Please download a newer eqcleanup")
		return
	}
	if len(loottableentries) < 1 {
		err = fmt.Errorf("loottablentries empty! Please download a newer eqcleanup")
		return
	}
	if len(npctypes) < 1 {
		err = fmt.Errorf("npctypes empty! Please download a newer eqcleanup")
		return
	}
	if len(spawns) < 1 {
		err = fmt.Errorf("spawns empty! Please download a newer eqcleanup")
		return
	}
	if len(spawnentries) < 1 {
		err = fmt.Errorf("spawnentries empty! Please download a newer eqcleanup")
		return
	}
	if len(spawngroups) < 1 {
		err = fmt.Errorf("spawngroups empty! Please download a newer eqcleanup")
		return
	}
	fmt.Println("Removing old data about", focus, "...")

	if totalChanged, err = loot.RemoveLootByZone(db, zonename); err != nil {
		return
	}

	if totalChanged, err = spawngroup.RemoveGridByZone(db, zonename); err != nil {
		return
	}
	fmt.Println("Removed", totalChanged, "grid related entries")

	if totalChanged, err = spawngroup.RemoveSpawnGroupAndEntryByZone(db, zonename); err != nil {
		return
	}
	fmt.Println("Removed", totalChanged, "spawn related entries")

	if totalChanged, err = npcpkg.RemoveNPCByZone(db, zonename); err != nil {
		return
	}
	fmt.Println("Removed", totalChanged, "npcs")

	if totalChanged, err = quest.RemoveAllQuestsForZone(config, zonename); err != nil {
		return
	}
	fmt.Println("Removed", totalChanged, "quest files")

	fmt.Println("Inserting new data about", focus, "...")

	//Loot
	var q string
	if q, err = injector.PrepareInsertString(&lootdrops[0], "lootdrop"); err != nil {
		return
	}

	totalChanged = 0

	for _, l := range lootdrops {
		if result, err = db.NamedExec(q, map[string]interface{}{"name": l.Name}); err != nil {
			err = fmt.Errorf("with lootdrop insert: %s", err.Error())
			return
		}
		var lastId int64

		if lastId, err = result.LastInsertId(); err != nil {
			err = fmt.Errorf("with lootdrop last insert: %s", err.Error())
			return
		}

		//now that lootdrops has changed, sync up loottables with proper lootdrop ids
		for i := range loottableentries {
			if loottableentries[i].Lootdrop_id == int(l.Id) {
				loottableentries[i].Lootdrop_id = int(lastId)
			}
		}
		for i := range lootdropentries {
			if lootdropentries[i].Lootdrop_id == int(l.Id) {
				lootdropentries[i].Lootdrop_id = int(lastId)
			}
		}
		totalChanged++
	}

	if q, err = injector.PrepareInsertString(&lootdropentries[0], "lootdrop_entries"); err != nil {
		return
	}

	for _, l := range lootdropentries {
		if result, err = db.NamedExec(q, &l); err != nil {
			err = fmt.Errorf("with lootdropentries insert: %s", err.Error())
			return
		}

		if _, err = result.LastInsertId(); err != nil {
			err = fmt.Errorf("with lootdropentries insert: %s", err.Error())
			return
		}
		totalChanged++
	}

	if q, err = injector.PrepareInsertString(&loottables[0], "loottable"); err != nil {
		return
	}

	for _, l := range loottables {
		l.Id.Valid = false
		if result, err = db.NamedExec(q, &l); err != nil {
			err = fmt.Errorf("with loottable insert: %s", err.Error())
			return
		}
		var lastId int64

		if lastId, err = result.LastInsertId(); err != nil {
			err = fmt.Errorf("with loottable lastid insert: %s", err.Error())
			return
		}

		//now that lootable has changed, sync npc ids to use proper loot table ids
		for i := range npctypes {
			if npctypes[i].Loottable_id == int(l.Id.Int64) {
				npctypes[i].Loottable_id = int(lastId)
			}
		}

		for i := range loottableentries {
			if loottableentries[i].Loottable_id == int(l.Id.Int64) {
				loottableentries[i].Loottable_id = int(lastId)
			}
		}

		totalChanged++
	}

	if q, err = injector.PrepareInsertString(&loottableentries[0], "loottable_entries"); err != nil {
		return
	}

	for _, l := range loottableentries {
		if result, err = db.NamedExec(q, &l); err != nil {
			return
		}
		if _, err = result.LastInsertId(); err != nil {
			return
		}

		totalChanged++
	}
	fmt.Println("Inserted", totalChanged, "loot related entries")

	//GRID
	if q, err = injector.PrepareInsertString(&grids[0], "grid"); err != nil {
		return
	}
	//fmt.Println(q)
	totalChanged = 0
	for _, g := range grids {
		if _, err = db.NamedExec(q, &g); err != nil {
			return
		}
		totalChanged++
	}

	if q, err = injector.PrepareInsertString(&gridentries[0], "grid_entries"); err != nil {
		return
	}

	for _, g := range gridentries {
		if _, err = db.NamedExec(q, &g); err != nil {
			return
		}
		totalChanged++
	}
	fmt.Println("Inserted", totalChanged, "grid related entries")

	//NPCS
	if len(npctypes) < 1 {
		err = fmt.Errorf("invalid number of npcs to insert")
		return
	}
	if q, err = injector.PrepareInsertString(&npctypes[0], "npc_types"); err != nil {
		return
	}
	//fmt.Println(q)
	totalChanged = 0
	for _, npctype := range npctypes {
		if _, err = db.NamedExec(q, &npctype); err != nil {
			return
		}
		totalChanged++
	}
	fmt.Println("Inserted", totalChanged, "npcs")

	//SPAWNGROUP
	if len(spawngroups) < 1 {
		err = fmt.Errorf("invalid number of npcs to insert")
		return
	}
	if q, err = injector.PrepareInsertString(&spawngroups[0], "spawngroup"); err != nil {
		return
	}

	totalChanged = 0
	for _, sg := range spawngroups {
		sg.Id.Valid = false //disable spawngroup ids

		if result, err = db.NamedExec(q, &sg); err != nil {
			return
		}
		var lastId int64

		if lastId, err = result.LastInsertId(); err != nil {
			return
		}

		//Now that spawngroup has changed, affect other records that depend on spawngroupid.
		for i := range spawnentries {
			if spawnentries[i].Spawngroupid == int(sg.Id.Int64) {
				spawnentries[i].Spawngroupid = int(lastId)
			}
		}
		for i := range spawns {
			if spawns[i].Spawngroupid == int(sg.Id.Int64) {
				spawns[i].Spawngroupid = int(lastId)
			}
		}

		totalChanged++
	}

	if q, err = injector.PrepareInsertString(&spawns[0], "spawn2"); err != nil {
		return
	}
	for _, sg := range spawns {
		if _, err = db.NamedExec(q, &sg); err != nil {
			return
		}
		totalChanged++
	}

	if q, err = injector.PrepareInsertString(&spawnentries[0], "spawnentry"); err != nil {
		return
	}
	for _, sg := range spawnentries {
		if _, err = db.NamedExec(q, &sg); err != nil {
			return
		}
		totalChanged++
	}
	fmt.Println("Inserted", totalChanged, "spawn related entries")

	return
}
コード例 #8
0
ファイル: halloween.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}
	config, err := eqconfig.Load()
	if err != nil {
		return
	}

	//Mobs
	ids := []int64{
		19151, //Laryn lycanthrope
		202373,
		202384, //wicked winnie
		202385, //a wizeened hermit
		20255,
		20255, //booberella
		20256,
		20256,
		20257,
		20257,
		20258,
		20258,
		20259,
		20259, //Eve_Hallows
		20260, //Jack Lanturn
		20261,
		20261,
		20262,
		20262,
		20263, //tricksy_treetor
		20264,
		20264,
		20265,
		20265,
		20266,
		20266,
		20267,
		20267,
		20268,
		20268,
		20269,
		20269, //an_imp
		20270,
		20270,
		20271,
		20271,
		20272,
		20272, //a_zombie
		20273,
		20273,
		20274,
		20274,
		20275,  //Mippie Digs
		20279,  //Old man draykey
		20281,  //Syxa
		20285,  //Crazy Charlie
		20288,  //lurgh
		20289,  //a_jack_o_lantern
		25436,  //grom shives
		38178,  //marta stalwart
		394263, //aragol gloomflow
		48350,
		48352,
		48353,
		48354,
		63099,
		98641,
		98643,
		98989, //lurgh
	}
	//#checkpoint_ten

	spawngroup.RemoveSpawnGroupAndEntryById(db, ids)

	//Items
	ids = []int64{
		84084, //Gummie Kobolds
		84088, //rock candy

		84091, //sand
		84092, //chunk of coal
		84093, //pocket lint
		84094, //Draykey's Codex
		84095, //Trick or treat bag

	}
	totalChanged, err := item.RemoveAllInstancesOfItems(db, ids)
	if err != nil {
		return
	}
	fmt.Println("Removed", totalChanged, " DB entries related to", focus, "in all player-accessible item locations.")

	filePaths := []string{
		"befallen/Wraps_McGee.lua",
		"commonlands/Sergeant_Ragus.pl",
		"crescent/#Aragol_Gloomflow.pl",
		"ecommons/Sergeant_Ragus.pl",
		"fieldofbone/Immug_Lashtail.pl",
		"iceclad/Nilham_the_Chef.pl",
		"kithicor/Old_Man_Draykey.pl",
		"mistmoore/Nate.pl",
		"quests/nektulos/Grom_Shives.pl",
		"quests/netherbian/Poil_Lolp.pl",
		"poknowledge/Grand_Librarian_Maelin.pl",
		"qey2hh1/Scary_Miller.lua",
		"rivervale/Laryen_Lycanthrope.pl",
		"tox/Fuzz_Selppa.pl",
		"toxxulia/Fuzz_Selppa.pl",
		"unrest/Crabby_the_Rotten.pl",
		"nektulos/#checkpoint_ten.pl", //trick or treat stop
		"unrest/Halloween_Trigger.pl", //trick or treat stop
		"unrest/Casper.pl",
		"unrest/Candy_Man.pl",
		"unrest/Evil_Brain_Eater.pl",
		"unrest/Eviler_Brain_Eater.pl",
		"unrest/Evilerer_Brain_Eater.pl",
		"unrest/Imp-ossible.pl",
		"unrest/Jack_o_Lantern.pl",
		"unrest/Not_So_Evil_Brain_Eater.pl",
		"unrest/Super_Ghoul_of_Unlimited_Power.pl",
		"unrest/Werewolf_of_DOOOOOOOM.pl",
	}

	delCount, err := quest.Remove(config, filePaths)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println("Deleted", delCount, focus, "related quest files")
	return
}
コード例 #9
0
ファイル: ldon.go プロジェクト: Xackery/eqcleanup
func Clean(args ...string) (err error) {
	db, err := eqdb.Load()
	if err != nil {
		return
	}
	config, err := eqconfig.Load()
	if err != nil {
		return
	}
	//Remove Adventure Merchants
	ids, err := spawngroup.GetSpawnGroupIdsByClass(db, 61)
	if err != nil {
		err = fmt.Errorf("Error getting %s Ids: %s", focus, err.Error())
		return
	}

	//Raid Recruiters
	rids := []int64{223, 222, 69987, 69988, 69989, 64252, 64440, 695, 6742, 6743, 983, 982, 67605, 67606, 67607, 50673, 50674, 68307, 4702, 4701, 4698}
	for _, id := range rids {
		ids = append(ids, id)
	}

	//Adventure Recruiters
	rids = []int64{219, 696, 979, 67608, 50677, 4695}
	for _, id := range rids {
		ids = append(ids, id)
	}

	//Teleporter (Magus)
	rids = []int64{38104, 70007, 6745, 216, 976, 46065, 39292, 39723, 67603, 54755, 4693}
	for _, id := range rids {
		ids = append(ids, id)
	}

	//Others
	rids = []int64{694, 6741, 6251, 224, 218, 225, 228}
	for _, id := range rids {
		ids = append(ids, id)
	}

	totalChanged, err := spawngroup.RemoveSpawnGroupAndEntryById(db, ids)
	if err != nil {
		err = fmt.Errorf("Error removing", focus, "entries: %s", err.Error())
		return
	}
	fmt.Println("Removed", totalChanged, " DB entries related to", focus, "in spawnentry and spawngroup successfully.")

	filePaths := []string{
		//Teleporter NPCs
		"abysmal/Magus_Pellen.lua",
		"butcher/Magus_Tira.lua",
		"commonlands/Magus_Zeir.pl",
		"ecommons/Magus_Zeir.lua",
		"everfrost/Magus_Delin.lua",
		"guildlobby/Magus_Alaria.lua",
		"natimbi/Magus_Releua.lua",
		"nedaria/Magus_Wenla.lua",
		"northro/Magus_Arindri.pl",
		"nro/Magus_Arindri.lua",
		"southro/Magus_Jerira.pl",
		"sro/Magus_Jerira.lua",

		//Mysterious Voices
		"akanon/player.lua",
		"cabeast/player.pl",
		"cabwest/player.pl",
		"corathus/player.pl",
		"crescent/player.pl",
		"erudnext/player.lua",
		"erudnint/player.lua",
		"felwithea/player.lua",
		"felwitheb/player.lua",
		"freeporteast/player.lua",
		"freeportwest/player.lua",
		"freporte/player.lua",
		"freportn/player.lua",
		"gfaydark/player.pl",
		//"global/global_player.lua",
		"grobb/player.lua",
		"halas/player.lua",
		"neriakb/player.pl",
		"neriakc/player.pl",
		"oggok/player.pl",
		"paineel/player.pl",
		"qey2hh1/player.lua",
		"qeynos/player.lua",
		"qeynos2/player.lua",
		"qrg/player.lua",
		"rathemtn/player.pl",
		"rivervale/player.lua",
		"sharvahl/player.pl",
	}

	delCount, err := quest.Remove(config, filePaths)
	if err != nil {
		fmt.Println(err.Error())
	}
	fmt.Println("Deleted", delCount, focus, "related quest files")
	fmt.Println("NOTICE: You still need to remove an entry in global/global_player.lua")
	return
}