示例#1
0
void ShowAllyInviteMenu_handler (edict_t *ent, int option)
{
	edict_t *e = ent->client->allytarget;

	if (!e || !e->inuse)
		return;

	// make sure they can still ally
	if (!CanAlly(ent, e, ALLY_RANGE))
		return;

	if (option == 1)
	{
		// notify inviter and his previous allies, if any
		gi.centerprintf(e, "Now allied with %s\n", ent->client->pers.netname);
		NotifyAllies(e, CENTERPRINT, va("Now allied with %s\n", ent->client->pers.netname));

		// notify invitee's allies
		NotifyAllies(ent, CENTERPRINT, va("Now allied with %s\n", e->client->pers.netname));

		// join allies
		AddAlly(ent, e);

		// notify invitee
		safe_cprintf(ent, PRINT_HIGH, "Ally added.\n");

		// reset wait menu variables
		AbortAllyWait(ent);
		AbortAllyWait(e);

		// close the invitation menu
		closemenu(ent);

		if (InMenu(e, 0, ShowAllyWaitMenu_handler))
			closemenu(e);
	}
	else if (option == 2)
	{
		// reset wait menu variables
		AbortAllyWait(ent);
		AbortAllyWait(e);

		// close the invitation menu
		closemenu(ent);

		if (InMenu(e, 0, ShowAllyWaitMenu_handler))
			closemenu(e);

		safe_cprintf(e, PRINT_HIGH, "%s declined your offer to ally.\n", ent->client->pers.netname);
	}
}
示例#2
0
void ShowItemMenu_handler(edict_t *ent, int option)
{
	if (option - 9999 > 0)
	{
		//Delete item menu
		ItemDeleteMenu(ent, option - 10000);
	}
	else if (option - 7777 > 0)
	{
		//Previous menu
		ShowInventoryMenu(ent, option - 7777, false);
		return;
	}
	else if (option - 4444 > 0)
	{
		//Equip/Unequip item
		V_EquipItem(ent, option - 4445);
	}
	else
	{
		//Closing menu
		closemenu(ent);
		return;
	}
}
示例#3
0
void DeleteMenu_handler(edict_t *ent, int option)
{
	if (option - 777 > 0)
	{
		int i;

		//Delete item
		memset(&ent->myskills.items[option - 778], 0, sizeof(item_t));

		//Re-apply equipment
		V_ResetAllStats(ent);
		for (i = 0; i < 3; ++i)
			V_ApplyRune(ent, &ent->myskills.items[i]);

		safe_cprintf(ent, PRINT_HIGH, "Item deleted.\n");
	}
	else if (option - 666 > 0)
	{
		//Back to main
		ShowInventoryMenu(ent, option - 666, false);
		return;
	}
	else
	{
		//Closing menu
		closemenu(ent);
		return;
	}
}
示例#4
0
void ShowSecondaryMenu_handler(edict_t *ent, int option)
{
	if (option != 666)
	{
		ShowHelpMenu(ent, option);
		return;
	}
	closemenu(ent);
}
示例#5
0
void ShowAllyMenu_handler (edict_t *ent, int option)
{
	if (option == 1)
		ShowAddAllyMenu(ent);
	else if (option == 2)
		ShowRemoveAllyMenu(ent);
	else
		closemenu(ent);
}
示例#6
0
/*
==================
DeathmatchScoreboard

Draw instead of help message.
Note that it isn't that hard to overflow the 1400 byte message limit!
==================
*/
void DeathmatchScoreboard (edict_t *ent)
{
//GHz START
	if (ent->client->menustorage.menu_active)
		closemenu(ent);
//GHz END
	DeathmatchScoreboardMessage (ent, ent->enemy);
	gi.unicast (ent, true);
}
示例#7
0
//showmenu() method to display the Main Menu in the application
void Menus :: showmenu(void)
{
	char choice;
	while(1)
	{
		clrscr();
		cout<<"\n   --Welcome to Banking System Application--\n";
		cout<<"*******************************************\n\n";
		cout<<"      Choose from Options  \n";
		cout<<"---------\n";
		cout<<"      1: Open an Account   \n";
		cout<<"      2: View an Account   \n";
		cout<<"      3:Show  all Accounts \n";
		cout<<"      4:Make a Transaction \n";
		cout<<"      5:Calculate Interest \n";
		cout<<"      6:Close an Account   \n";
		cout<<"      7:Exit             \n\n";
		cout<<"      Please select a choice : ";
		choice = getche();
		if(choice=='1')
		{
			accountTransactions objAT;
			objAT.new_account();
		}
		else if(choice == '2')
		{
			accountTransactions objAT;
			objAT.display_account();
		}
		else if(choice == '3')
		{
			dispRecords newRec;
			newRec.displayCustomers();
		}
		else if(choice == '4')
		{
			accountTransactions objAT;
			objAT.transaction();
		}
		else if(choice == '5')
		{
			accountTransactions objAT;
			objAT.showInterest();
		}
		else if(choice == '6')
		{
			closemenu();
		}
		else if(choice == '7')
		{
			cout<<"\n    Thanks for using this application.Please press any key to exit......\n";
			getch();
			break;
		}
	}
}
示例#8
0
void generalWeaponMenu_handler(edict_t *ent, int option)
{
	int WeaponIndex	= (option / 100)-10;
	int ModIndex	= (option % 100) - 1;
	
	//Are we just navigating?
	if (option == 6666)
	{
		closemenu(ent);
		return;
	}
	else if (option >= 7777)
	{
        int LastWeapon = option - 7777;
		OpenWeaponUpgradeMenu(ent, LastWeapon+1);
		return;
	}

    if (!(ent->myskills.weapons[WeaponIndex].mods[ModIndex].level < ent->myskills.weapons[WeaponIndex].mods[ModIndex].soft_max))
	{
		gi.cprintf(ent, PRINT_HIGH, "You have reached the maximum upgrade level in %s %s (%d).\n",
			GetWeaponString(WeaponIndex), GetModString(WeaponIndex,ModIndex), 
			ent->myskills.weapons[WeaponIndex].mods[ModIndex].soft_max);
		return;
	}

	if (ent->myskills.weapon_points < 1)
	{
		gi.cprintf(ent, PRINT_HIGH, "You are out of weapon points.\n");
		closemenu(ent);
		return;
	}

	ent->myskills.weapons[WeaponIndex].mods[ModIndex].current_level++;
	ent->myskills.weapons[WeaponIndex].mods[ModIndex].level++;
	ent->myskills.weapon_points--;

	gi.cprintf(ent, PRINT_HIGH, "%s %s upgraded to level %d.\n",	GetWeaponString(WeaponIndex),GetModString(WeaponIndex,ModIndex), 
		ent->myskills.weapons[WeaponIndex].mods[ModIndex].current_level);
    
    //Refresh the menu
	OpenGeneralWeaponMenu(ent, option);
}
示例#9
0
void weaponmenu_handler (edict_t *ent, int option)
{
	if ((option/100)-10 > MAX_WEAPONS)
	{
		closemenu(ent);
		return;
	}

	OpenGeneralWeaponMenu(ent, option);
}
示例#10
0
void armorymenu_handler (edict_t *ent, int option)
{
	if (option == 1)
		OpenPurchaseMenu(ent, 1, 0);
	else if (option == 2)
		OpenBuyRuneMenu(ent, 1, 0);
	else if (option == 3)
		OpenSellMenu(ent, 0);
	else
		closemenu(ent);
}
示例#11
0
void ShowAllyWaitMenu_handler (edict_t *ent, int option)
{
	edict_t *e = ent->client->allytarget;

	if (option == 666)	//ent closed the menu
	{
		closemenu(ent);
		return;
	}

	if (e)
	{
		AbortAllyWait(e);
		if (InMenu(e, 0, ShowAllyInviteMenu_handler))
			closemenu(e);
	}

	AbortAllyWait(ent);
	closemenu(ent);
}
示例#12
0
void BuyRuneMenu_handler (edict_t *ent, int option)
{
	int page_num = (option / 10);
	int page_choice = (option % 10);

	if (option == 99)
	{
		closemenu(ent);
		return;
	}

	if ((page_num == 1) && (page_choice == 1))
	{
		OpenArmoryMenu(ent);
		return;
	}
	else if ((page_num > 0) && (page_num < 5))	//5 was chosen for no real reason
	{
		if (page_choice == 2)	//next
            OpenBuyRuneMenu (ent, page_num+1, 0);
		else if (page_choice == 1)	//prev
			OpenBuyRuneMenu (ent, page_num-1, 0);
		return;
	}
	//don't cause an invalid item to be selected
	else 
	{
		int selection = (option % 1000);
		page_num = option / 1000;
		
		if ((selection > ARMORY_MAX_RUNES) || (selection < 1))
		{
			closemenu(ent);
			return;
		}

		//View it
		OpenBuyRuneConfirmMenu(ent, option);
		return;
	}
}
示例#13
0
void openTalentMenu_handler(edict_t *ent, int option)
{
	switch(option)
	{
	case 9999:	//Exit
		{
			closemenu(ent);
			return;
		}
	default: openTalentMenu(ent, option);
	}
}
示例#14
0
void ShowAddAllyMenu_handler (edict_t *ent, int option)
{
	edict_t *e;

	if (option == 666)	//ent closed the menu
	{
		closemenu(ent);
		return;
	}

	// get ally target
	e = V_getClientByNumber(option-1);

	// make sure we're still allowed to ally
	if (!CanAlly(ent, e, ALLY_RANGE))
	{
		closemenu(ent);
		return;
	}

	// open wait menu
	ShowAllyWaitMenu(ent);

	// set up ally parameters
	ent->client->allytarget = e;
	ent->client->ally_accept = true;
	ent->client->allying = true;
	ent->client->ally_time = level.time;

	// set up ally target parameters
	e->client->allytarget = ent;
	e->client->ally_accept = false;
	e->client->allying = true;
	e->client->ally_time = level.time;

	// open invitation menu
	ShowAllyInviteMenu(e);
}
示例#15
0
void SellMenu_handler (edict_t *ent, int option)
{
	//Navigating the menu?
	if (option == 666) //exit
	{
		closemenu(ent);
		return;
	}
	else if (option < 1 || option > MAX_VRXITEMS)	//exit
	{
		closemenu(ent);
		return;
	}
	else if (ent->myskills.items[option-1].itemtype == ITEM_NONE)
	{
		//refresh the menu
		OpenSellMenu(ent, option);
		return;
	}
	
	//We picked an item
	OpenSellConfirmMenu(ent, option-1);
}
示例#16
0
void ShowRemoveAllyMenu_handler (edict_t *ent, int option)
{
	edict_t *e;

	if (option == 666)	//ent closed the menu
	{
		closemenu(ent);
		return;
	}

	e = V_getClientByNumber(option-1);
	RemoveAlly(ent, e);
	closemenu(ent);

	// notify player's allies
	NotifyAllies(ent, 0, va("%s has removed %s from your team\n", ent->client->pers.netname, e->client->pers.netname));
	NotifyAllies(ent, CENTERPRINT, va("Ally removed: %s\n", e->client->pers.netname));

	// notify removed player
	gi.centerprintf(e, "No longer allied with: %s\n", ent->client->pers.netname);

	// notify player
	safe_cprintf(ent, PRINT_HIGH, "Ally removed.\n");
}
示例#17
0
void SellConfirmMenu_handler(edict_t *ent, int option)
{
	if (option - 777 > 0)
	{
		int i;
		item_t *slot = &ent->myskills.items[option - 778];
		int value = GetSellValue(slot);

		//log the sale
		WriteToLogfile(ent, va("Selling rune for %d credits. [%s]", value, slot->id));

		//Copy item to armory
		GiveRuneToArmory(slot);

		//Delete item
		memset(slot, 0, sizeof(item_t));
		gi.cprintf(ent, PRINT_HIGH, "Item Sold for %d credits.\n", value);

		//Re-apply equipment
		V_ResetAllStats(ent);
		for (i = 0; i < 3; ++i)
			V_ApplyRune(ent, &ent->myskills.items[i]);

		//refund some credits
		ent->myskills.credits += value;
		gi.cprintf(ent, PRINT_HIGH, "You now have %d credits.\n", ent->myskills.credits);
		gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/gold.wav"), 1, ATTN_NORM, 0);

		//save the player file
		SaveCharacter(ent);

	}
	else if (option - 666 > 0)
	{
		//Back to select sell item
		OpenSellMenu(ent, option - 666);
		return;
	}
	else
	{
		//Closing menu
		closemenu(ent);
		return;
	}
}
示例#18
0
void PurchaseMenu_handler (edict_t *ent, int option)
{
	int page_num = (option / 1000);
	int page_choice = (option % 1000);

	if ((page_num == 1) && (page_choice == 1))
	{
		OpenArmoryMenu(ent);
		return;
	}
	else if (page_num > 0)
	{
		if (page_choice == 2)	//next
            OpenPurchaseMenu (ent, page_num+1, 0);
		else if (page_choice == 1)	//prev
			OpenPurchaseMenu (ent, page_num-1, 0);
		return;
	}
	//don't cause an invalid item to be selected (option 99 is checked as well)
	else if ((option > ARMORY_ITEMS) || (option < 1))
	{
		closemenu(ent);
		return;
	}

	//Try to buy it
	Cmd_Armory_f(ent, option);

	/*
	This next bit of code fixes a logic error in the menu, where
	a player selects the last item in the menu.
	example:	(10 / 10) + 1 = page 2
				instead of page 1, item # 10
	*/
	page_num = option / 10;
	if (option % 10 != 0)
		page_num += 1;

	//Refresh the menu
	OpenPurchaseMenu (ent, page_num, option);
}
示例#19
0
void ShowHelpMenu_handler(edict_t *ent, int option)
{
	if (option == 666)
	{
		closemenu(ent);
		return;
	}
	else
	{
		switch(option)
		{
		case 10:	ShowBasicsMenu(ent);	return;
		case 20:	ShowCommandsMenu(ent);	return;
		case 30:	PrintCommands(ent);		return;
		case 40:	ShowRuneTypes(ent);		return;
		case 50:	ShowItemsHelpMenu(ent);	return;
		case 60:	ShowTradeHelpMenu(ent);	return;
		case 70:	ShowVoteHelpMenu(ent);	return;
		case 80:	ShowModeHelpMenu(ent);	return;
		}
	}
}
示例#20
0
void ShowInventoryMenu_handler(edict_t *ent, int option)
{
	if ((option > 0) && (option-1 < MAX_VRXITEMS) && (ent->myskills.items[option-1].itemtype != ITEM_NONE))
	{
		//Use the consumable items (health potions, holy water)
		if ((ent->myskills.items[option-1].itemtype == ITEM_POTION) || (ent->myskills.items[option-1].itemtype == ITEM_ANTIDOTE))
		{
			cmd_Drink(ent, ent->myskills.items[option-1].itemtype, option);
			return;
		}

		//View selected item
		ShowItemMenu(ent, option-1);
	}
	else if (option == 666)
	{
		closemenu(ent);
		return;
	}

	//refresh the menu
	ShowInventoryMenu(ent, option, false);
}
示例#21
0
文件: CHK.C 项目: Mikelle02/GameMaker
static void manualcheck(char skip)
  {
  static unsigned char encodedat[1510]="Put the copy protection here! ";
  unsigned char count=0;
  unsigned char lin,wor;
  unsigned int head,count2=0;
  unsigned char answer[14] = "",answeren[14]= "",temp[10] = "";
  register int i;
  char str[25];
  FILE *fp;
  
  count=(random(87)+91);
  if (skip)
    {
    gmmain();
    return;
    }
// Why chmodded?
/*  if (chmod("playgame.exe",S_IREAD|S_IWRITE))
    {
    if (errno == ENOENT) errorbox("Please run this application in the GM directory","                 (E)xit");
    else errorbox("Cannot Run PLAYGAME.EXE","     (E)xit");
    return;
    }
*/
  if ((fp = fopen ("playgame.exe","r+b")) == NULL)
    {
    errorbox("This application must be run from","the GM directory!     (E)xit");
    return;
    }
  fseek(fp,PLAYBYTE,SEEK_SET);
  count = fgetc(fp);
  count-=90;
  if ( (count<1) || (count>88) ) count=(random(87)+1);
  fseek(fp,PLAYBYTE,SEEK_SET);
  count2=(random(87)+91);
  if (fputc(count2,fp) == EOF)
    {
    errorbox("Cannot Find PLAYGAME.EXE","     (E)xit");
    fclose(fp);
    return;
    }
  fclose(fp);
  SetDate();
  count2=0;
  while ( (encodedat[count2] != count) && (count2<970) )
    {
    if (encodedat[count2] < 88)
      {                    /* eliminate possibility of head(int) bytes */
      count2+=5;
      }
    else count2++;  
    }
  if (count2>=970)
    {
    errorbox("Data Corrupted!","Reinstall from original disks.");
    return;
    }
  lin=encodedat[count2+1]-101;
  wor=encodedat[count2+2]-150;
  head=(*(unsigned int *) (&encodedat[count2+3]))/10;
  count2+=5; i=0;
  while(encodedat[count2+i]!=(count+1))
    {
    answer[i] = (encodedat[count2+i]-11-(count%57))/2;
    i++;
    }
  answer[i]=0;
  sprintf((char far *)temp,"%d",head);
  i=0;
  while (temp[i] != 0) i++;
  temp[2*i-1]=0;
  while (i != 0)
    {
    i--;
    temp[2*i]=temp[i];
    temp[2*i-1]='.';
    }
  count2 = openmenu(14,3,50,10,(char far *)encodedat);
  for (i=0;i<3;i++)
    {
    writestr(15,3,count2+15,"   Please enter the following informantion.");
    writestr(15,4,count2+14,"       OR send in your registration card");
    writestr(15,5,count2+14,"             to skip this hassle!");
    writestr(15,7,count2+15,"Count every line with text, not including");
    writestr(15,8,count2+15,"numbered headings. (\"Game-maker\" is one word).");
    sprintf(str,"Section: %s",temp);
    writestr(15,10,count2+14,str);
    sprintf(str,"Line: %d",lin);
    writestr(15,11,count2+14,str);
    sprintf(str,"Word: %d",wor);
    writestr(15,12,count2+14,str);
    qwindow(24,15,15,"Word Found: ",(char far *)answeren);
    if (stricmp((char far *)answeren,(char far *)answer) != 0)
      {
      if (i<2) 
        {
        errorbox("THAT IS INCORRECT","(R)etry");
        answeren[0]=0;
        }
      else
        {
        closemenu(14,3,50,10,(char far *)encodedat);
        errorbox("THAT IS INCORRECT","(E)xit");
        if ((fp = fopen ("playgame.exe","r+b")) == NULL)
          {
          errorbox("This application must be run from","the GM directory!     (E)xit");
          return;
          }
        fseek(fp,PLAYBYTE,SEEK_SET);
        count+=90;
        if (fputc(count,fp) == EOF)
          errorbox("Cannot Find PLAYGAME.EXE","     (E)xit");
        fclose(fp);
        SetDate();
        return;
        }
      }
    else i=3;
    }
  closemenu(14,3,50,10,(char far *)encodedat);
  gmmain();
  }
示例#22
0
/*
=================
ClientEndServerFrame

Called for each player at the end of the server frame
and right after spawning
=================
*/
void ClientEndServerFrame (edict_t *ent)
{
	float	bobtime;
	int		i, updateFrame;

	current_player = ent;
	current_client = ent->client;

	//
	// If the origin or velocity have changed since ClientThink(),
	// update the pmove values.  This will happen when the client
	// is pushed by a bmodel or kicked by an explosion.
	// 
	// If it wasn't updated here, the view position would lag a frame
	// behind the body position when pushed -- "sinking into plats"
	//
	for (i=0 ; i<3 ; i++)
	{
		current_client->ps.pmove.origin[i] = ent->s.origin[i]*8.0;
		current_client->ps.pmove.velocity[i] = ent->velocity[i]*8.0;
	}

	//
	// If the end of unit layout is displayed, don't give
	// the player any normal movement attributes
	//
	if (level.intermissiontime)
	{
		// FIXME: add view drifting here?
		current_client->ps.blend[3] = 0;
		current_client->ps.fov = 90;
		G_SetStats (ent);
		return;
	}

	AngleVectors (ent->client->v_angle, forward, right, up);

	// burn from lava, etc
	P_WorldEffects ();

	//
	// set model angles from view angles so other things in
	// the world can tell which direction you are looking
	//
	if (ent->client->v_angle[PITCH] > 180)
		ent->s.angles[PITCH] = (-360 + ent->client->v_angle[PITCH])/3;
	else
		ent->s.angles[PITCH] = ent->client->v_angle[PITCH]/3;
	//GHz START
	// monsters don't use pitch
	if (ent->mtype)
		ent->s.angles[PITCH] = 0;
	//GHz END
	ent->s.angles[YAW] = ent->client->v_angle[YAW];
	ent->s.angles[ROLL] = 0;
	ent->s.angles[ROLL] = SV_CalcRoll (ent->s.angles, ent->velocity)*4;

	//
	// calculate speed and cycle to be used for
	// all cyclic walking effects
	//
	xyspeed = sqrt(ent->velocity[0]*ent->velocity[0] + ent->velocity[1]*ent->velocity[1]);

	if (xyspeed < 5)
	{
		bobmove = 0;
		current_client->bobtime = 0;	// start at beginning of cycle again
	}
	else if (ent->groundentity)
	{	// so bobbing only cycles when on ground
		if (xyspeed > 210)
			bobmove = 0.25;
		else if (xyspeed > 100)
			bobmove = 0.125;
		else
			bobmove = 0.0625;
	}
	
	bobtime = (current_client->bobtime += bobmove);

	if (current_client->ps.pmove.pm_flags & PMF_DUCKED)
		bobtime *= 4;

	bobcycle = (int)bobtime;
	bobfracsin = fabs(sin(bobtime*M_PI));

	// detect hitting the floor
	P_FallingDamage (ent);

	// apply all the damage taken this frame
	P_DamageFeedback (ent);

	// determine the view offsets
	SV_CalcViewOffset (ent);

	// determine the gun offsets
	SV_CalcGunOffset (ent);

	// determine the full screen color blend
	// must be after viewoffset, so eye contents can be
	// accurately determined
	// FIXME: with client prediction, the contents
	// should be determined by the client
	SV_CalcBlend (ent);

	// chase cam stuff
	if (ent->client->resp.spectator)
		G_SetSpectatorStats(ent);
	else
		G_SetStats (ent);

	G_CheckChaseStats(ent);

	G_SetClientEvent (ent);

	G_SetClientEffects (ent);

	G_SetClientSound (ent);

	G_SetClientFrame (ent);

	VectorCopy (ent->velocity, ent->client->oldvelocity);
	VectorCopy (ent->client->ps.viewangles, ent->client->oldviewangles);

	// clear weapon kicks
	VectorClear (ent->client->kick_origin);
	VectorClear (ent->client->kick_angles);

	if (ent->client->pers.scanner_active & 1)
		updateFrame = SCANNER_UPDATE_FREQ;
	else
		updateFrame = 31;

	// if the scoreboard is up, update it
	//if (ent->client->showscores && !(level.framenum & 31) && !ent->client->menustorage.menu_active)
	if (((ent->client->showscores || ent->client->pers.scanner_active) && !ent->client->menustorage.menu_active && !ent->client->show_allyinfo
		&& !(level.framenum % updateFrame)) || (ent->client->pers.scanner_active & 2))
	{
		DeathmatchScoreboardMessage (ent, ent->enemy);
		gi.unicast (ent, false);
	}
	else if (ent->client->show_allyinfo && !(level.framenum%10))
	{
		ShowAllyInfo(ent);
	}
	//GHz START
	else if (!ent->client->showscores && ent->client->menustorage.menu_active)
	{
		closemenu(ent);
	}
	//GHz END

//	P_FollowWall(ent);
}
示例#23
0
void showscores(bool on)
{
    if(on) showmenu("score", false);
    else closemenu("score");
}
示例#24
0
void BuyRuneConfirmMenu_handler (edict_t *ent, int option)
{
	//Navigating the menu?
	if (option > 100)
	{
		int page_num = option / 1000;
		int selection = (option % 1000)-1;
		item_t *slot = V_FindFreeItemSlot(ent);
		int cost;

		armoryRune_t *firstItem;
		item_t *rune;

		switch(page_num)
		{
		case 1: firstItem = WeaponRunes;	break;
		case 2: firstItem = AbilityRunes;	break;
		case 3: firstItem = ComboRunes;		break;
		default: 
			gi.dprintf("Error in BuyRuneConfirmMenu_handler(). Invalid page number: %d\n", page_num);
			return;
		}

		rune = &((firstItem + selection)->rune);
		if (rune->itemtype == ITEM_NONE)
		{
			gi.cprintf(ent, PRINT_HIGH, "Sorry, someone else has purchased this rune.\n");
			closemenu(ent);
			return;
		}
		cost = getBuyValue(rune);

		//Do we have enough credits?
		if (ent->myskills.credits < cost)
		{
			gi.cprintf(ent, PRINT_HIGH, "You need %d more credits to buy this item.\n", cost - ent->myskills.credits);
		}
		//Check for free space
		else if (slot == NULL)
		{
			gi.cprintf(ent, PRINT_HIGH, "Not enough room in inventory.\n");
		}
		else
		{
			//log the purchase
			WriteToLogfile(ent, va("Buying rune for %d credits. [%s]", cost, rune->id));

			//Buy it!
			V_ItemSwap(rune, slot);
			ent->myskills.credits -= cost;
			SaveArmory();
			savePlayer(ent);
			gi.cprintf(ent, PRINT_HIGH, "Rune purchased for %d credits.\nYou have %d credits left.\n", cost, ent->myskills.credits);
			gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/gold.wav"), 1, ATTN_NORM, 0);
		}

		//done
		closemenu(ent);
		return;
	}
	else
	{
		int page_num = option / 10;
		int selection = option % 10;

		OpenBuyRuneMenu(ent, page_num, selection);
		return;
	}

}