Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

KFGui.GUIClassSelectable


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
class GUIClassSelectable extends Object;

var Mesh showMesh;              //Mesh to show in Info
var StaticMesh myShowMesh;      //Actual staticmesh to show in info
var int cost;                   //Cost to buy
var float weight;                 //Heaviness
var class<GUIPanel> InfoPanel;  //Panel to show Info in- should actually be KFInfoPanel
var class<Inventory> relatedInventory; //For inventory sellables,
									   //the associated class.

var rotator infoDrawRotation;          //Rotation in the Info panel
var vector infoDrawOffset;             //Offset in the info panel
var float infoDrawScale;               //Generally, size
var int infoSpinRate;                  //rate our weapon spins at.  0 by default.
                                        //alex, change the damn default.

var string ItemName;            //Sale name of object
var string Description;         //Flavor text, etc.

var int PurchasedQuantity;      //Have we bought one of these?
var int OwnedQuantity;          //Amount player already has



enum eClasscat
{
	CLASS_Soldier,
	CLASS_Medic,
	CLASS_Engineer
};



//We might want different panel types for different
//categories.
function class<GUIPanel> GetPanelType(eClasscat category)
{
	return InfoPanel;
}



function bool CanButtonMe(PlayerController pc,bool buying)
{
	return CanBuyMe(pc);
}

function bool CanBuyMe(PlayerController pc)
{
	return true;
}

function string GetBuyCaption(eClasscat index)
{
	if(index == CLASS_Soldier)
		return "Sell";
	else
		return "Buy";
}

function ProcessComplete(PlayerController pc)
{


	if(PurchasedQuantity > 0)
	{
		GiveMe(pc);
		return;
	} else if(PurchasedQuantity < 0)
	{
		TakeMe(pc);
		return;
	}
}

//Hand it over to the player (once he hits complete)
function GiveMe(PlayerController pc)
{
}

//The slink giveth, the slink taketh away
function TakeMe(PlayerController pc)
{
}

//Consider ourselves bought
function BuyMe(out int score, out float oweight, pawn servUpdatePawn)
{
	score -= cost;
	oweight += weight;
	PurchasedQuantity++;
//	(KFPawn(servUpdatePawn)).setCreds(score) ;
}


//Subclasses should return true if the buyable
//should show up under the index'th list for pawn p.
//This implementation just returns whether or not the pawn
//already has an item of class relatedInventory.
function bool ShowMe(Pawn p, eClasscat index)
{
	return true;
}

//returns the combined weight of all owned items of type
function float InitOwnedQuantity(Pawn p)
{
	local Inventory inv;
	local int quant;

	//log("INITOWNEDQUANTITY",'KFMessage');

	if(p == None)
		return 0;
	for(inv = p.Inventory;inv != None;inv = inv.Inventory)
	{
		if(inv.IsA(relatedInventory.Name))
		{
			quant++;
		}
	}
	OwnedQuantity=quant;
	return weight*OwnedQuantity;
}

function bool HasMe(Pawn p)
{
	return (OwnedQuantity+PurchasedQuantity>0);
}

defaultproperties
{
     myShowMesh=StaticMesh'KillingFloorStatics.DeagleAmmo'
     InfoPanel=Class'XInterface.GUIPanel'
     infoDrawRotation=(Pitch=-5461,Yaw=-16384,Roll=32768)
     infoDrawOffset=(X=100.000000,Y=-20.000000,Z=-10.000000)
     infoDrawScale=0.700000
     infoSpinRate=20000
     ItemName="Buyable Object"
     Description="This object appears to be for sale."
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:26.000 - Creation time: Fri 13-10-2023 03:19:02.345 - Created with UnCodeX