Graal Pastebin

New Paste
Pasted on July 5, 2011.
View the raw file

function onActionServerSide( cmd, var )
{
  if ( cmd == "setShield" )
  {
    player.shieldimg = var;  
  }
  if ( cmd == "setHead" )
  {
    player.headimg = var;  
  }
}
//#CLIENTSIDE
function onKeyPressed( code, key )
{
  if ( key == "t" || key == "T" )
  {
    showTailor();
  }
}
function showTailor()
{
  Tailor_Window.destroy();
  new GuiWindowCtrl( "Tailor_Window" )
  {
    profile = "GuiBlueWindowProfile";
    width = 370;
    height = 240;
    x = screenwidth / 2 - ( width / 2 );
    y = screenheight / 2 - ( height / 2 );
    title = canMove = canMinimize = useownprofile = canClose = visible = true;
    canResize = canMaximize = false;
    profile.transparency = .9;
    text = "Tailor for" SPC servername;
    showtop();
    new GuiShowImgCtrl( "Tailor_Doll" )
    {
      x = 70;
      y = 30;
      ani = "idle";
      temp.parts = { "headimg", "shield", "bodyimg" };
      for ( temp.a: temp.parts )
      {
        actor.( @ temp.a ) = player.( @ temp.a );
      }
      for ( temp.i = 0; temp.i < 6; temp.i ++ )
      {
        actor.colors[temp.i] = player.colors[temp.i];
      }
      actor.attr[3] = player.attr[3];
    }
    temp.left_parts = { { "Head", "headimg", "headimg" }, { "Body", "bodyimg", "bodyimg" }, { "Shield", "shield", 
 
"shieldimg" } };
    for ( temp.i = 0; temp.i <  temp.left_parts.size(); temp.i++ )
    {
      new GuiTextCtrl( "Tailor_" @ temp.left_parts[temp.i][0] @ "_Text" )
      {
        profile = "GuiBlueTextProfile";
        x = 10;
        y = 90 + ( temp.i * 30 );
        useownprofile = true;
        profile.fontstyle = "bold";
        text =  temp.left_parts[temp.i][0] @ ":";
      }
      new GuiTextEditCtrl( "Tailor_" @ temp.left_parts[temp.i][0] @ "_Edit" )
      {
        profile = "GuiBlueTextEditProfile";
        x = 55;
        y = 90 + ( temp.i * 30 );
        height = 20;
        width = 100;
        useownprofile = true;
        profile.fontstyle = "bold";
        this.var = temp.left_parts[temp.i][1];
        text = player.( @ temp.left_parts[temp.i][1] );
        thiso.catchevent( name, "onTextChanged", "onTailorFill" );
      }
    }
    temp.colors = {
    "white",
    "yellow",
    "orange",
    "pink",
    "red",
    "darkred",
    "lightgreen",
    "green",
    "darkgreen",
    "lightblue",
    "blue",
    "darkblue",
    "brown",
    "cynober",
    "purple",
    "darkpurple",
    "lightgray",
    "gray",
    "black",
    "transparent"
    };
    temp.parts = {
    "Skin",
    "Coat",
    "Sleeves",
    "Shoes",
    "Belt"
    };
    temp.player_colors = {
    player.colors[0],
    player.colors[1],
    player.colors[2],
    player.colors[3],
    player.colors[4]
    };
    for ( temp.i = 0; temp.i < temp.parts.size(); temp.i ++ )
    {
      new GuiTextCtrl( "Tailor_Text_" @ temp.parts[temp.i] )
      {
        profile = "GuiBlueTextProfile";
        x = 180;
        y = 30 + ( 30 * temp.i );
        useownprofile = true;
        profile.fontstyle = "bold";
        text = temp.parts[temp.i] @ ":";
      }
      new GuiPopUpMenuCtrl( "Tailor_PopUp_" @ temp.parts[temp.i] )
      {
        profile = "GuiBluePopUpMenuProfile";
        textprofile = "GuiBlueTextListProfile";
        scrollprofile = "GuiBlueScrollProfile";
        x = 240;
        y = 30 + ( 30 * temp.i );
        width = 100;
        height = 20;
        clearRows();
        this.var = temp.i;
        for ( temp.a: temp.colors )
        {
          addRow( 0, temp.a );
        }
        setSelectedRow( temp.player_colors[temp.i] );
        thiso.catchevent( name, "onSelect", "onTailorColors" );
      }
    }
    new GuiButtonCtrl( "Tailor_Accept" )
    {
      profile = "GuiBlueButtonProfile";
      x = 65;
      y = Tailor_Window.height - 55;
      height = 30;
      width = 70;
      text = "Accept";
    }
    new GuiButtonCtrl( "Tailor_Save" )
    {
      profile = "GuiBlueButtonProfile";
      x = 145;
      y = Tailor_Window.height - 55;
      height = 30;
      width = 70;
      text = "Save Outfit";
    }
    new GuiButtonCtrl( "Tailor_Load" )
    {
      profile = "GuiBlueButtonProfile";
      x = 225;
      y = Tailor_Window.height - 55;
      height = 30;
      width = 70;
      text = "Load Outfit";
    }
  }
}
function Tailor_Save.onAction()
{
  if ( client.outfits.size() < 9 )
  {
    showSave();
  }
  else
  {
    player.chat = "You already have 9 outfits, delete some!";
  }
}
function Tailor_Doll.onMouseDown()
{
  button = "left";
  if ( button == "left" )
  {
    if ( Tailor_Doll.dir < 3 )
    {
      Tailor_Doll.dir ++;
    }
    else
    {
      Tailor_Doll.dir = 0;
    }
  }
  else if ( button == "right" )
  {
    if ( Tailor_Doll.dir > 0 )
    {
      Tailor_Doll.dir --;
    }
    else
    {
      Tailor_Doll.dir = 3;
    }
  }
}
function Tailor_Load.onAction()
{
  if ( client.outfits.size() != -1 )
  {
    showLoad();
  }
  else
  {
    player.chat = "You do not have any outfits!";
  }
}
function showSave()
{
  TailorSave_Window.destroy();
  TailorLoad_Window.destroy();
  new GuiWindowCtrl( "TailorSave_Window" )
  {
    profile = "GuiBlueWindowProfile";
    width = 200;
    height = 200;
    x = screenwidth / 2 - ( width / 2 );
    y = screenheight / 2 - ( height / 2 );
    canClose = visible = canMove = true;
    canMinimize = canMaximize = canResize = false;
    useownprofile = true;
    profile.transparency = .9;
    showtop();
    text = "Save Outfit";
    new GuiMLTextCtrl( "TailorSave_Label" )
    {
      profile = "GuiBlueTextProfile";
      x = 10;
      y = 28;
      width = 180;
      text = "<center><b>Current Outfit</b></center>";
    }
    new GuiShowImgCtrl( "TailorSave_Doll" )
    {
      x = 75;
      y = 40;
      ani = "idle";
      actor.headimg = Tailor_Doll.actor.headimg;
      actor.bodyimg = Tailor_Doll.actor.bodyimg;
      actor.shield = Tailor_Doll.actor.shield;
      for ( temp.i = 0; temp.i < 5; temp.i ++ )
      {
        actor.colors[temp.i] = Tailor_Doll.actor.colors[temp.i];
      }
    }
    new GuiMLTextCtrl( "TailorSave_Text" )
    {
      profile = "GuiBlueTextProfile";
      width = 180;
      y = 100;
      x = 10;
      useownprofile = parsehtml = true;
      text = "<center><b>Enter the name you wish to save your current outfit as.</b></center>";
    }
    new GuiTextEditCtrl( "TailorSave_Name" )
    {
      profile = "GuiBlueTextEditProfile";
      width = 180;
      height = 20;
      x = TailorSave_Window.width / 2 - ( width / 2 );
      y = TailorSave_Window.height - 65;
      useownprofile = true;
      profile.align = "center";
      text = "Outfit" SPC client.outfits.size() + 1;
    }
    new GuiButtonCtrl( "TailorSave_Button" )
    {
      profile = "GuiBlueButtonProfile";
      width = 50;
      height = 30;
      x = TailorSave_Window.width / 2 - ( width / 2 );
      y = TailorSave_Window.height - 40;
      text = "Save";
    }
  }
}
function showLoad()
{
  TailorSave_Window.destroy();
  TailorLoad_Window.destroy();
  new GuiWindowCtrl( "TailorLoad_Window" )
  {
    profile = "GuiBlueWindowProfile";
    width = 200;
    height = 240;
    x = screenwidth / 2 - ( width / 2 );
    y = screenheight / 2 - ( height / 2 );
    canClose = visible = canMove = true;
    canMinimize = canMaximize = canResize = false;
    useownprofile = true;
    profile.transparency = .9;
    showtop();
    text = "Load Outfit";
    new GuiShowImgCtrl( "TailorLoad_Doll" )
    {
      x = 75;
      y = 30;
      ani = "idle";
      actor.headimg = player.headimg;
      actor.bodyimg = player.bodyimg;
      actor.shield = player.shieldimg;
      for ( temp.i = 0; temp.i < 5; temp.i ++ )
      {
        actor.colors[temp.i] = player.colors[temp.i];
      }
    }
    new GuiScrollCtrl( "TailorLoad_Scroll" )
    {
      profile = "GuiBlueScrollProfile";
      width = 180;
      height = 100;
      x = 10;
      y = 90;
      vScrollBar = "dynamic";
      hScrollBar = "dynamic";
      new GuiTextListCtrl( "TailorLoad_List" )
      {
        profile = "GuiBlueTextListProfile";
        x = 0;
        y = 0;
        width = 180;
        height = 100;
        clearRows();
        for ( temp.i: client.outfits )
        {
          addRow( 0, temp.i );
        }
        setSelectedRow( 0 );
      }
    }
    new GuiButtonCtrl( "TailorLoad_Load" )
    {
      profile = "GuiBlueButtonProfile";
      x = 30;
      y = TailorLoad_Window.height - 40;
      height = 30;
      width = 50;
      text = "Load";
    }
    new GuiButtonCtrl( "TailorLoad_Delete" )
    {
      profile = "GuiBlueButtonProfile";
      x = 120;
      y = TailorLoad_Window.height - 40;
      height = 30;
      width = 50;
      text = "Delete";
    }
  }
}
function TailorLoad_Delete.onAction()
{
  var = TailorLoad_List.getselectedtext();
  client.outfits.delete( client.outfits.index( var ) );
  player.chat = "Outfit" SPC var SPC "deleted!";
  showLoad();
}
function TailorLoad_List.onSelect( blah, outfit )
{
  var = client.( @ "outfit_" @ outfit );
  TailorLoad_Doll.actor.headimg = var[0];
  TailorLoad_Doll.actor.bodyimg = var[1];
  TailorLoad_Doll.actor.shield = var[2];
  for ( temp.i = 0; temp.i < 6; temp.i ++ )
  {
    TailorLoad_Doll.actor.colors[temp.i] = var[3 + temp.i];
  }
}
function TailorLoad_Load.onAction()
{
  // Head, Body, Shield, colors[0], colors[1], colors[2], colors[3], colors[4]
  triggerserver( "gui", name, "setHead", client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[0] );
  triggerserver( "gui", name, "setShield", client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[2] );
  player.bodyimg = client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[1];
  for ( temp.i = 0; temp.i < 5; temp.i ++ )
  {
    player.colors[temp.i] = client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[3 + temp.i];
  }
  player.chat = "Outfit" SPC TailorLoad_List.getselectedtext() SPC "loaded!";
  TailorLoad_Window.destroy();
}
function TailorSave_Button.onAction()
{
  if ( client.outfits.index( TailorSave_Name.text  ) == -1 )
  {
    client.outfits.add( TailorSave_Name.text );
    client.( @ "outfit_" @ TailorSave_Name.text ) = { TailorSave_Doll.actor.headimg, TailorSave_Doll.actor.bodyimg, 
 
TailorSave_Doll.actor.shield, TailorSave_Doll.actor.colors[0], TailorSave_Doll.actor.colors[1], 
 
TailorSave_Doll.actor.colors[2], TailorSave_Doll.actor.colors[3], TailorSave_Doll.actor.colors[4] };
    // Head, Body, Shield, colors[0], colors[1], colors[2], colors[3], colors[4]
    player.chat = "Outfit" SPC TailorSave_Name.text SPC "saved!";
    TailorSave_Window.destroy();
  }
  else
  {
    player.chat = "That outfit name is already taken!";
  }
}
function Tailor_Accept.onAction()
{
  player.bodyimg = Tailor_Doll.actor.bodyimg;
  triggerserver( "gui", name, "setHead", Tailor_Doll.actor.head );
  triggerserver( "gui", name, "setShield", Tailor_Doll.actor.shield );
  for ( temp.a = 0; temp.a < 5; temp.a ++ )
  {
    player.colors[temp.a] = Tailor_Doll.actor.colors[temp.a];
  }
  Tailor_Window.destroy();
  TailorSave_Window.destroy();
}
function onTailorColors()
{
  temp.var = ( params[0] ).var;
  Tailor_Doll.actor.colors[temp.var] = params[3];
}
function onTailorFill()
{
  Tailor_Doll.actor.( @ params[0].( "var" ) ) = params[1];
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435