MCPcopy Create free account
hub / github.com/TurningWheel/Barony / initClass

Function initClass

src/charclass.cpp:693–3692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691}
692
693void initClass(const int player)
694{
695 Item* item = nullptr;
696 Item* item2 = nullptr;
697 auto& hotbar_t = players[player]->hotbar;
698 auto& hotbar = hotbar_t.slots();
699
700 bool isLocalPlayer = players[player]->isLocalPlayer();
701
702 if ( isLocalPlayer )
703 {
704 //TODO: Dedicated gameStartStuff() function. Seriously.
705 //(same for deathStuff() and/or gameEndStuff().
706 players[player]->inventoryUI.selectSlot(0, 0);
707 players[player]->inventoryUI.selectSpell(0, 0);
708 players[player]->inventoryUI.selectChestSlot(0, 0);
709 hotbar_t.clear();
710 players[player]->paperDoll.clear();
711 }
712
713 bool curseItems = false;
714 if ( (stats[player]->playerRace == RACE_SUCCUBUS || stats[player]->playerRace == RACE_INCUBUS)
715 && stats[player]->stat_appearance == 0 )
716 {
717 curseItems = true;
718 }
719
720 //stats[player]->STR += 1;
721
722 stats[player]->type = HUMAN;
723
724 //spellList = malloc(sizeof(list_t));
725 players[player]->magic.spellList.first = nullptr;
726 players[player]->magic.spellList.last = nullptr;
727
728
729 // CLASS LOADOUTS
730 // barbarian
731 if ( client_classes[player] == CLASS_BARBARIAN )
732 {
733 initClassStats(client_classes[player], stats[player]);
734
735 if (!isLocalPlayer && multiplayer == CLIENT && intro == false) {
736 // don't do anything crazy with items on players we don't own
737 return;
738 }
739
740 // ring of strength
741 item = newItem(RING_STRENGTH, WORN, 0, 1, 0, true, nullptr);
742 if ( isLocalPlayer )
743 {
744 item2 = itemPickup(player, item);
745 useItem(item2, player);
746 free(item);
747 }
748 else
749 {
750 useItem(item, player);

Callers

nothing calls this directly

Calls 15

initClassStatsFunction · 0.85
itemPickupFunction · 0.85
useItemFunction · 0.85
equipItemFunction · 0.85
getBookFunction · 0.85
addSpellFunction · 0.85
itemIsEquippedFunction · 0.85
getSpellFromItemFunction · 0.85
autosortInventoryFunction · 0.85
isLocalPlayerMethod · 0.80
selectSlotMethod · 0.80
selectSpellMethod · 0.80

Tested by

no test coverage detected