Im working on a querry to add all your class spells to your spell book when you create your character. However it doesn't work as intended, any help would be apprechiated.
Here is what I've come up with so far.
I took one of each class trainer and selected all the spells they teached and tried to insert the data into the playercreateinfo_spells table and then change their EntryID to the indexid of the trainers class.
Code:
ALTER table trainer_spells CHANGE entry indexid int (11) ;
ALTER table trainer_spells CHANGE learn_spell spellid int (11) ;
I changed this so I could easily select the data and transfer it to the playercreateinfo_spells table. I will change this back later with this querry:
Code:
ALTER table trainer_spells CHANGE indexid entry int (11);
ALTER table trainer_spells CHANGE spellid learn_spell int (11);
After that I inserted all the trainers from the trainer_spells table to the playercreateinfo_spells table with this querry.
Code:
-- PALADIN
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 928 AND spellid IS NOT NULL;
-- DEATH KNIGHT
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 28474 AND spellid IS NOT NULL;
-- WARRIOR
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 16771 AND spellid IS NOT NULL;
-- PRIEST
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 4090 AND spellid IS NOT NULL;
-- ROGUE
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 4214 AND spellid IS NOT NULL;
-- DRUID
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 4218 AND spellid IS NOT NULL;
-- HUNTER
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 5115 AND spellid IS NOT NULL;
-- WARLOCK
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 5173 AND spellid IS NOT NULL;
-- SHAMAN
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 23127 AND spellid IS NOT NULL;
-- MAGE
REPLACE INTO playercreateinfo_spells (indexid, spellid)
SELECT indexid, spellid
FROM trainer_spells
WHERE indexid = 17514 AND spellid IS NOT NULL;
The last part is to change the Trainers EntryID's to the classes indexid's
I tried to do that with this query.
Code:
-- Paladin
UPDATE playercreateinfo_spells SET indexid=9 WHERE indexid=928 ;
-- Death Knight
UPDATE playercreateinfo_spells SET indexid=56 WHERE indexid=28474 ;
-- Warrior
UPDATE playercreateinfo_spells SET indexid=1 WHERE indexid=16771 ;
-- Priest
UPDATE playercreateinfo_spells SET indexid=25 WHERE indexid=4090 ;
-- Rogue
UPDATE playercreateinfo_spells SET indexid=18 WHERE indexid=4214 ;
-- Druid
UPDATE playercreateinfo_spells SET indexid=42 WHERE indexid=4218 ;
-- Hunter
UPDATE playercreateinfo_spells SET indexid=12 WHERE indexid=5115 ;
-- Warlock
UPDATE playercreateinfo_spells SET indexid=38 WHERE indexid=5173 ;
-- Shaman
UPDATE playercreateinfo_spells SET indexid=48 WHERE indexid=23127 ;
-- Mage
UPDATE playercreateinfo_spells SET indexid=34 WHERE indexid=17514 ;
The above piece of code would only give the starting spells to one of each class, but its easy to use the same thing and just change the indexid to match another race.
Everything seems to work well until I get to the last part where I change the indexid.
This is because the spellid's already exist for the real Indexid so the update gives me duplicate errors on each one of them. And of course that makes the current UPDATE statement stop running.
Anyone have any tips on how to make a succesfull data transfer?