All pastes #947941 Raw Edit

Player.cpp bg

public text v1 · immutable
·published 2008-03-18 20:25 UTC
rendered paste body
/*
* Undzwei WoW Community 
* Copyright (C) 2006-2008 U2 Team <sT@N> <http://www.undzwei.eu/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

	sHookInterface.OnCharacterCreate(this);

	load_health = m_uint32Values[UNIT_FIELD_HEALTH];
	load_mana = m_uint32Values[UNIT_FIELD_POWER1];

    SetUInt32Value(UNIT_FIELD_LEVEL, 70);
	_UpdateMaxSkillCounts();
	static const char * spells[DRUID+1] = {
		NULL,
			/*spells[WARRIOR] = */"2458,71,",
			/*spells[PALADIN] = */"7328,,",
			/*spells[HUNTER] = */"1515,6991,2641,883,982,",
			/*spells[ROGUE] = */",",
			/*spells[PRIEST] = */",",
			/*spells[6] = */NULL,
			/*spells[SHAMAN] = */"5394,3599,8071,",
			/*spells[MAGE] = */"27090,",
			/*spells[WARLOCK] = */"688,712,697,691,",
			/*spells[10] = */NULL,
			/*spells[DRUID] = */"5487,9634,6807,",
	};

	// 43: Swords
	// 45: Bows
	// 46: Guns
	// 44: Axes
	// 54: Maces
	// 118: Dual Wield
	// 55: 2H Swords
	// 136: Staves
	// 160: 2H Maces
	// 172: 2H Axes
	// 173: Daggers
	// 176: Thrown
	// 226: Crossbows
	// 228: Wands
	// 293: Plate
	// 226: Polearems
	// 413: Mail
	// 414: Leather
	// 415: Cloth
	// 433: Shield
	// 473: Fist Weapons

	static const char * skills[DRUID+1] = {
		NULL,
			/* WARRIOR */"415,414,413,293,433,43,45,46,44,54,55,136,160,172,173,176,226,473,",
			/* PALADIN */"415,414,413,293,433,54,160,43,55,172,226,",
			/* HUNTER */"415,414,413,44,173,46,45,226,473,226,136,43,176,172,55,",
			/* ROGUE */"415,414,173,176,43,45,226,54,473,",
			/* PRIEST */"415,54,173,136,228,",
			/* 6 */NULL,
			/* SHAMAN */"415,414,413,433,54,160,44,172,173,",
			/* MAGE */"415,136,228,173,43,",
			/* WARLOCK */"415,173,228,43,136,",
			/* 10 */NULL,
			/* DRUID */"415,414,136,54,160,173,473,",
	};

	vector<string> spellArr = StrSplit(string(spells[class_]), ",");
	vector<string> skillArr = StrSplit(string(skills[class_]), ",");

	for(vector<string>::iterator itr = spellArr.begin(); itr != spellArr.end(); ++itr)
	{
		uint32 id = atoi((*itr).c_str());
		if(id)
			addSpell(id);
	}

	for(vector<string>::iterator itr = skillArr.begin(); itr != skillArr.end(); ++itr)
	{
		uint32 id = atoi((*itr).c_str());
		if(id)
		{
			skilllineentry * se = dbcSkillLine.LookupEntry(id);
			switch(se->type)
			{
			case SKILL_TYPE_PROFESSION:
				break;

			case SKILL_TYPE_SECONDARY:
				break;

			case SKILL_TYPE_ARMOR:
				_AddSkillLine(id,1,1);
				break;

			case SKILL_TYPE_WEAPON:
				_AddSkillLine(id,350,350);
				break;
			}
		}
	}
	_AddSkillLine(762,300,300);

	for(SkillMap::iterator itr = m_skills.begin(); itr != m_skills.end(); ++itr)
	{
		itr->second.CurrentValue = itr->second.MaximumValue;
	}

    queue<uint32> Items;
	switch(getClass())
	{
	case WARRIOR:
		{
            Items.push(16864); // Belt of Might
            Items.push(16861); // Bracers of Might
            Items.push(16865); // Brestplate of Might
            Items.push(16863); // Gauntles of Might
            Items.push(16866); // Helm of Might
            Items.push(16867); // Legplates of Might
            Items.push(16868); // Pauldrons of Might
            Items.push(16862); // Sabatons of Might
			Items.push(19019); // Thunderfury, Blessed Blade of the Windseeker
			Items.push(17066); // Drillborer Disk
			Items.push(19334); // The Untamed Blade
			//Items.push(17075); // Vis'kag the Bloodletter
			//Items.push(19348); // Red Dragonscale Protector
			//pPlayer->addSpell(750); // Plate Mail
			//pPlayer->addSpell(674); // Dual Wield
			//Skills.push(118);
			//Skills.push(443);
			break;
		}
	case ROGUE:
		{
            Items.push(16827); // Nightslayer Belt
            Items.push(16824); // Nightslayer Boots
            Items.push(16825); // Nightslayer Bracelets
            Items.push(16820); // Nightslayer Chestpiece
            Items.push(16821); // Nightslayer Cover
            Items.push(16826); // Nightslayer Gloves
            Items.push(16822); // Nightslayer Pants
            Items.push(16823); // Nightslayer Shoulder Pads
			Items.push(21522); // Shadowsong's Sorrow
			Items.push(19019); // Thunderfury, Blessed Blade of the Windseeker
            //Items.push(31031); // Get rid of the stupid totem
			//Skills.push(43);
			//Skills.push(118);
			//pPlayer->addSpell(674);
			break;
		}
	case MAGE:
		{
            Items.push(16802); // Arcanist Belt
            Items.push(16799); // Arcanist Bindings
            Items.push(16795); // Arcanist Crown
            Items.push(16800); // Arcanist Boots
            Items.push(16801); // Arcanist Gloves
            Items.push(16796); // Arcanist Leggins
            Items.push(16797); // Arcanist Mantle
            Items.push(16798); // Arcanist Robes
			Items.push(19355); // Shadow Wing Focus Staff
			Items.push(19367); // Dragon's Touch
			break;
		}
	case WARLOCK:
		{
            Items.push(16806); // Felheart Belt
            Items.push(16804); // Felheart Bracers
            Items.push(16805); // Felheart Gloves
            Items.push(16810); // Felheart Pants
            Items.push(16809); // Felheart Robes
            Items.push(16807); // Felheart Shoulder Pads
            Items.push(16808); // Felheart Horns
            Items.push(16803); // Felheart Slippers
			Items.push(17103); // Azuresong Mageblade
			Items.push(19366); // Master Dragonslayer's Orb
			Items.push(22821); // Doomfinger
			break;
		}
	case HUNTER:
		{
            Items.push(16851); // Giantstalker's Belt
            Items.push(16849); // Giantstalker's Boots
            Items.push(16850); // Giantstalker's Bracers
            Items.push(16845); // Giantstalker's Breastplate
            Items.push(16848); // Giantstalker's Epaulets
            Items.push(16852); // Giantstalker's Gloves
            Items.push(16846); // Giantstalker's Helmet
            Items.push(16847); // Giantstalker's Leggings
			Items.push(17104);  // Spinal Reaper
			Items.push(19350); // Heartstriker
			// Nether Spike, 800 arrows ;)
			Item * item = objmgr.CreateItem(30319, this);
			item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, 8000);
			GetItemInterface()->AddItemToFreeSlot(item);
			break;
		}
	case PALADIN:
		{
            Items.push(16858); // Lawbringer Belt
            Items.push(16859); // Lawbringer Boots
            Items.push(16857); // Lawbringer Bracers
            Items.push(16853); // Lawbringer Chestguard
            Items.push(16860); // Lawbringer Gauntles
            Items.push(16854); // Lawbringer Helm
            Items.push(16855); // Lawbringer Legplates
            Items.push(16856); // Lawbringer Spaulders
			Items.push(19019); // Thunderfury, Blessed Blade of the Windseeker
			Items.push(17066); // Drillborer Disk
			Items.push(19364); // Ashkandi, Greatsword of the Brotherhood
			//Skills.push(43);
			//Skills.push(55);
			//Skills.push(433);
			//pPlayer->addSpell(750);
			break;
		}
	case SHAMAN:
		{
            Items.push(16838); // Earthfury Belt
            Items.push(16837); // Earthfury Boots
            Items.push(16840); // Earthfury Bracers
            Items.push(16841); // Earthfury Vestments
            Items.push(16844); // Earthfury Epaulets
            Items.push(16839); // Earthfury Gauntlets
            Items.push(16842); // Earthfury Helmet
            Items.push(16843); // Earthfury Legguards
			Items.push(23454); // Grand Marshal's Warhammer
            Items.push(17182); // Sulfuras, Hand of Ragnaros
			// totems
			Items.push(5175); // Earth Totem
			Items.push(5176); // Fire Totem
			Items.push(5177); // Water Totem
			Items.push(5178); // Air Totem
            //pPlayer->addSpell(199);
			//pPlayer->addSpell(8737);
			//Skills.push(160);
			break;
		}
	case PRIEST:
		{
            Items.push(16811); // Boots of Prophecy
            Items.push(16813); // Circlet of Prophecy
            Items.push(16817); // Girdle of Prophecy
            Items.push(16812); // Gloves of Prophecy
            Items.push(16814); // Pants of Prophecy
            Items.push(16816); // Mantle of Prophecy
            Items.push(16815); // Robes of Prophecy
            Items.push(16819); // Vambraces of Prophecy
			Items.push(18608); // Benediction
			Items.push(21603); // Wand of Qiraji Nobility
			//pPlayer->addSpell(227);
			//Skills.push(136);
			break;
		}
	case DRUID:
		{
            Items.push(16828); // Cenarion Belt
            Items.push(16829); // Cenarion Boots
            Items.push(16830); // Cenarion Bracers
            Items.push(16833); // Cenarion Vestments
            Items.push(16831); // Cenarion Gloves
            Items.push(16834); // Cenarion Helm
            Items.push(16835); // Cenarion Leggins
            Items.push(16836); // Cenarion Spaulders
			Items.push(21703); // Hammer of Ji'zhi
			break;
		}
	}
	// Mounts by Race
	switch(getRace())
	{
	case RACE_HUMAN:
		Items.push(12354);
		break;
	case RACE_DRAENEI:
		Items.push(29745);
		break;
	case RACE_GNOME:
		Items.push(18772);
		break;
	case RACE_DWARF:
		Items.push(18785);
		break;
	case RACE_NIGHTELF:
		Items.push(18766);
		break;
	case RACE_UNDEAD:
		Items.push(18791);
		break;
	case RACE_ORC:
		Items.push(18796);
		break;
	case RACE_TROLL:
		Items.push(18790);
		break;
	case RACE_TAUREN:
		Items.push(18793);
		break;
	case RACE_BLOODELF:
		Items.push(29223);
		break;

	}
	// Items.push(32860);		// netherdrake

	// Add Items
	while(Items.size() > 0)
	{
		Item * item = objmgr.CreateItem(Items.front(), this);
		Items.pop();		
		GetItemInterface()->AddItemToFreeSlot(item);
	}

	// ModUInt32Value(PLAYER_FIELD_COINAGE, 50000);		// 5 gold
	SetUInt32Value(PLAYER_CHARACTER_POINTS1, 61);
	SetUInt32Value(UNIT_FIELD_HEALTH, GetUInt32Value(UNIT_FIELD_MAXHEALTH));
	SetUInt32Value(UNIT_FIELD_POWER1, GetUInt32Value(UNIT_FIELD_MAXPOWER1));
    load_health = m_uint32Values[UNIT_FIELD_HEALTH];

	return true;
}