daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Aug 12th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Var Flotte As New CMyFleet(9248);
  2. Var Schiffe As CShipList = Flotte.Ships;
  3.  
  4. Var i As Integer
  5. Var j As Integer
  6. Var transfer As Integer;
  7. Var sum As Integer;
  8. Var durchschnitt As Integer;
  9. Var Schiff As CMyShip;
  10. Var ZielSchiff As CMyShip;
  11. Var ShipEnum As IEnumerator;
  12.  
  13. Flotte.Action.ActivateSRS(True);
  14.  
  15. For (Each Schiff In Flotte.Ships)
  16. {
  17.   sum = (sum + Schiff.Energy);
  18. }
  19.  
  20. durchschnitt = (sum / Flotte.Ships.Count);
  21.  
  22. WriteLine("Durchschnitt: " & CStr(durchschnitt));
  23.  
  24. i = 0;
  25. While(i < Flotte.Ships.Count)
  26. {
  27.   Schiff = Flotte.Ships.Item(i);
  28.   If(Schiff.Energy > durchschnitt)
  29.   {
  30.     j = 0;
  31.     While((Schiff.Energy > durchschnitt) AND (j < Flotte.Ships.Count))
  32.     {
  33.       ZielSchiff = Flotte.Ships.Item(j);
  34.       If((ZielSchiff.Energy < durchschnitt) AND (Schiff.ShipID <> ZielSchiff.ShipID))
  35.       {
  36.         transfer = (Schiff.Energy - durchschnitt);
  37.         //WriteLine( CStr( transfer ) & ", " & CStr( ZielSchiff.Energie ) & ", " & CStr( durchschnitt ) );
  38.         If(transfer > (durchschnitt - ZielSchiff.Energy))
  39.         {
  40.           transfer = (durchschnitt - ZielSchiff.Energy);
  41.         }
  42.         If(transfer > 0)
  43.         {
  44.           //WriteLine( "Von: " & Schiff.Name & ", Nach: " & ZielSchiff.Name );
  45.           Schiff.Action.TransferToShip(ZielSchiff.ShipID, transfer, EBeamResource.Energy);
  46.         }
  47.       }
  48.       j = j + 1;
  49.     }
  50.   }
  51.   i = i + 1;
  52. }
RAW Paste Data
Top