Ejemplo n.º 1
0
void ShowAddAllyMenu (edict_t *ent)
{
	int i;
	int j = 0;
	edict_t *temp;

	 if (!ShowMenu(ent))
		return;
	clearmenu(ent);

	addlinetomenu(ent, "Select a player:", MENU_GREEN_CENTERED);
	addlinetomenu(ent, " ", 0);

	for_each_player(temp, i)
	{
		if (CanAlly(ent, temp, ALLY_RANGE))
		{
			//Add player to the list
			addlinetomenu(ent, va(" %s (%s)", temp->myskills.player_name, 
				GetClassString(temp->myskills.class_num)), GetClientNumber(temp));
			++j;

			// 3.65 can only display up to 10 possible allies
			// any more than this will cause the game to crash
			// FIXME: split this up into multiple menus?
			if (j >= 10)
				break;
		}
		
	}

	//Menu footer
	addlinetomenu(ent, " ", 0);
	addlinetomenu(ent, "Exit", 666);

	//Set handler
	setmenuhandler(ent, ShowAddAllyMenu_handler);

	//Set current line
	ent->client->menustorage.currentline = 4 + j;

	//Display the menu
	showmenu(ent);
}
Ejemplo n.º 2
0
    void SetTemplateTalents(Player* player, std::string& playerSpecStr)
    {
        QueryResult select = CharacterDatabase.PQuery("SELECT talentId FROM template_npc_talents WHERE playerClass = '%s' AND "
                             "playerSpec = '%s';", GetClassString(player).c_str(), playerSpecStr.c_str());

        if (!select)
        {
            return;
        }
        else
        {
            do
            {
                Field* fields = select->Fetch();
                uint32 talentId = fields[0].GetUInt32();

                player->learnSpell(talentId, false);
                player->AddTalent(talentId, player->GetActiveSpec(), true);
            }
            while (select->NextRow());
            player->SetFreeTalentPoints(0);
            player->SendTalentsInfoData(false);
        }
    }
Ejemplo n.º 3
0
void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer) 
{ 

     char entry[MAX_ENTRY_SIZE]; 
     char string[MAX_STRING_SIZE];
	 char name[20], classname[20];//3.78
     int stringlength; 
     int i, j, k; 
     int sorted[MAX_CLIENTS];
     int sortedscores[MAX_CLIENTS]; 
     int score, total, highscore=0; 
     int y;
	 //float accuracy;
	 int time_left=999, frag_left=999;
     gclient_t *cl; 
     edict_t *cl_ent; 

	 // if we are looking at the scoreboard or inventory, deactivate the scanner
	 if (ent->client->showscores || ent->client->showinventory)
	 {
		if (ent->client->pers.scanner_active)
			ent->client->pers.scanner_active = 2;
	 }
	 else
	 {
		 *string = 0;

		 // Scanner active ?
		if (ent->client->pers.scanner_active & 1)
			ShowScanner(ent,string);

		// normal quake code ...	
		gi.WriteByte (svc_layout);
		gi.WriteString (string);
		return;
	 }
	
     // sort the clients by score 
     total = 0; 
     for (i=0 ; i<game.maxclients ; i++)
	{
		cl_ent = g_edicts + 1 + i;

        //3.0 scoreboard code fix
		if (!cl_ent->client || !cl_ent->inuse || cl_ent->client->resp.spectator)
			continue;

		score = game.clients[i].resp.score;
		for (j=0 ; j<total ; j++)
		{
			if (score > sortedscores[j])
				break;
		}
		for (k=total ; k>j ; k--)
		{
			sorted[k] = sorted[k-1];
			sortedscores[k] = sortedscores[k-1];
		}
		sorted[j] = i;
		sortedscores[j] = score;
		total++;
	}
	// print level name and exit rules
	string[0] = 0;
	stringlength = strlen(string);

     // make a header for the data 
	//K03 Begin
	if (timelimit->value)
		time_left = (timelimit->value*60 - level.time);
	else
		time_left = 60*99;
	if (fraglimit->value)
		frag_left = (fraglimit->value - V_HighestFragScore());

	if (time_left < 0)
		time_left = 0;

	Com_sprintf(entry, sizeof(entry), 
		"xv 0 yv 16 string2 \"Time:%2im %2is Frags:%3i Players:%3i\" "
		"xv 0 yv 24 string2 \"Name       Lv Cl Score Frg Spr Png\" ",
		(int)(time_left/60), (int)(time_left-(int)((time_left/60)*60)),
		frag_left, total_players()); 

	 //K03 End
     j = strlen(entry); 

	 //gi.dprintf("header string length=%d\n", j);

     if (stringlength + j < MAX_ENTRY_SIZE) 
     { 
          strcpy (string + stringlength, entry); 
          stringlength += j; 
     } 

     // add the clients in sorted order 
     if (total > 24) 
          total = 24; 
     /* The screen is only so big :( */ 
	 
     for (i=0 ; i<total ; i++)
	 {
          cl = &game.clients[sorted[i]]; 
          cl_ent = g_edicts + 1 + sorted[i];

		  if (!cl_ent)
			  continue; 

          y = 34 + 8 * i; 
		
		// 3.78 truncate client's name and class string
		strcpy(name, V_TruncateString(cl->pers.netname, 11));
		strcpy(classname, V_TruncateString(GetClassString(cl_ent->myskills.class_num), 3));
		padRight(name, 10);

		Com_sprintf(entry, sizeof(entry),
			"xv 0 yv %i string \"%s %2i %s %5i %3i %3i %3i\" ",
			y, name, cl_ent->myskills.level, classname, cl->resp.score, 
			cl->resp.frags, cl_ent->myskills.streak, cl->ping); 

		j = strlen(entry);

		//gi.dprintf("player string length=%d\n", j);

		if (stringlength + j > MAX_ENTRY_SIZE)
			break; 

		strcpy (string + stringlength, entry); 
		stringlength += j; 
     } 

     gi.WriteByte (svc_layout); 
     gi.WriteString (string); 

} 
Ejemplo n.º 4
0
    void EquipFullTemplateGear(Player* player, std::string& playerSpecStr) // Merge
    {
        if (CanEquipTemplate(player, playerSpecStr) == false)
        {
            player->GetSession()->SendAreaTriggerMessage("There's no templates for %s specialization yet.", playerSpecStr.c_str());
            return;
        }

        EquipTmpGear(player, playerSpecStr);
        SetTemplateTalents(player, playerSpecStr);
        SetTemplateGlyphs(player, playerSpecStr);

        LearnPlateMailSpells(player);
        LearnWeaponSkills(player);

        player->GetSession()->SendAreaTriggerMessage("Successfuly equipped %s %s template!", playerSpecStr.c_str(), GetClassString(player).c_str());
    }
Ejemplo n.º 5
0
    void EquipTmpGear(Player* player, std::string& playerSpecStr)
    {
        if (player->getRace() == RACE_HUMAN)
        {
            for (uint8 equipmentSlot = EQUIPMENT_SLOT_START; equipmentSlot < EQUIPMENT_SLOT_END; ++equipmentSlot)
            {
                QueryResult result = CharacterDatabase.PQuery("SELECT itemEntry, enchant, socket1, socket2, socket3, bonusEnchant, prismaticEnchant "
                                     "FROM template_npc_human WHERE playerClass = '%s' AND playerSpec = '%s' AND pos = '%u';", GetClassString(player).c_str(), playerSpecStr.c_str(), equipmentSlot);

                if (!result)
                    continue;

                Field* fields = result->Fetch();
                uint32 itemEntry = fields[0].GetUInt32();
                uint32 enchant = fields[1].GetUInt32();
                uint32 socket1 = fields[2].GetUInt32();
                uint32 socket2 = fields[3].GetUInt32();
                uint32 socket3 = fields[4].GetUInt32();
                uint32 bonusEnchant = fields[5].GetUInt32();
                uint32 prismaticEnchant = fields[6].GetUInt32();

                // Equip Gear
                player->EquipNewItem(equipmentSlot, itemEntry, true);

                // Apply Enchants and Gems
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), PERM_ENCHANTMENT_SLOT, enchant);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT, socket1);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT_2, socket2);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT_3, socket3);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), BONUS_ENCHANTMENT_SLOT, bonusEnchant);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), PRISMATIC_ENCHANTMENT_SLOT, prismaticEnchant);
            }
        }
        else if (player->GetTeam() == ALLIANCE && player->getRace() != RACE_HUMAN)
        {
            for (uint8 equipmentSlot = EQUIPMENT_SLOT_START; equipmentSlot < EQUIPMENT_SLOT_END; ++equipmentSlot)
            {
                QueryResult result = CharacterDatabase.PQuery("SELECT itemEntry, enchant, socket1, socket2, socket3, bonusEnchant, prismaticEnchant "
                                     "FROM template_npc_alliance WHERE playerClass = '%s' AND playerSpec = '%s' AND pos = '%u';", GetClassString(player).c_str(), playerSpecStr.c_str(), equipmentSlot);

                if (!result)
                    continue;

                Field* fields = result->Fetch();
                uint32 itemEntry = fields[0].GetUInt32();
                uint32 enchant = fields[1].GetUInt32();
                uint32 socket1 = fields[2].GetUInt32();
                uint32 socket2 = fields[3].GetUInt32();
                uint32 socket3 = fields[4].GetUInt32();
                uint32 bonusEnchant = fields[5].GetUInt32();
                uint32 prismaticEnchant = fields[6].GetUInt32();

                // Equip Gear
                player->EquipNewItem(equipmentSlot, itemEntry, true);

                // Apply Enchants and Gems
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), PERM_ENCHANTMENT_SLOT, enchant);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT, socket1);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT_2, socket2);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT_3, socket3);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), BONUS_ENCHANTMENT_SLOT, bonusEnchant);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), PRISMATIC_ENCHANTMENT_SLOT, prismaticEnchant);
            }
        }
        else if (player->GetTeam() == HORDE)
        {
            for (uint8 equipmentSlot = EQUIPMENT_SLOT_START; equipmentSlot < EQUIPMENT_SLOT_END; ++equipmentSlot)
            {
                QueryResult result = CharacterDatabase.PQuery("SELECT itemEntry, enchant, socket1, socket2, socket3, bonusEnchant, prismaticEnchant "
                                     "FROM template_npc_horde WHERE playerClass = '%s' AND playerSpec = '%s' AND pos = '%u';", GetClassString(player).c_str(), playerSpecStr.c_str(), equipmentSlot);

                if (!result)
                    continue;

                Field* fields = result->Fetch();
                uint32 itemEntry = fields[0].GetUInt32();
                uint32 enchant = fields[1].GetUInt32();
                uint32 socket1 = fields[2].GetUInt32();
                uint32 socket2 = fields[3].GetUInt32();
                uint32 socket3 = fields[4].GetUInt32();
                uint32 bonusEnchant = fields[5].GetUInt32();
                uint32 prismaticEnchant = fields[6].GetUInt32();

                // Equip Gear
                player->EquipNewItem(equipmentSlot, itemEntry, true);

                // Apply Enchants and Gems
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), PERM_ENCHANTMENT_SLOT, enchant);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT, socket1);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT_2, socket2);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), SOCK_ENCHANTMENT_SLOT_3, socket3);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), BONUS_ENCHANTMENT_SLOT, bonusEnchant);
                ApplyBonus(player, player->GetItemByPos(INVENTORY_SLOT_BAG_0, equipmentSlot), PRISMATIC_ENCHANTMENT_SLOT, prismaticEnchant);
            }
        }
    }
Ejemplo n.º 6
0
    void SetTemplateGlyphs(Player* player, std::string& playerSpecStr)
    {
        for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
        {
            QueryResult result = CharacterDatabase.PQuery("SELECT glyph FROM template_npc_glyphs "
                                 "WHERE playerClass = '%s' AND playerSpec = '%s' AND slot = '%u';", GetClassString(player).c_str(), playerSpecStr.c_str(), slot);

            if (!result)
                continue;

            Field* fields = result->Fetch();
            uint32 glyph = fields[0].GetUInt32();

            ApplyGlyph(player, slot, glyph);
        }
        player->SendTalentsInfoData(false);
    }