Script Function: Q4CL

From Ultima Online: The Second Age
Jump to: navigation, search
 function int Q4CL(obj it, obj user)
 {
   obj Q4E2 = getTopmostContainer(it);
   if ((Q4E2 != NULL()) && (Q4E2 != user))
   {
     return (0x00);
   }
   int power;
   power = Q4SO(it);
   if (power <= 0x00)
   {
     return (0x00);
   }
   if (Q42M() < 0x00)
   {
     systemMessage(user, "This crystal can not be recharged.");
     return (0x00);
   }
   if (Q42M() >= Q55T)
   {
     systemMessage(user, "This crystal is already fully charged.");
     return (0x00);
   }
   int num = charges + power;
   if (num >= Q55T)
   {
     num = Q55T;
     systemMessage(user, "You completely recharge the crystal.");
   }
   else
   {
     systemMessage(user, "You recharge the crystal.");
   }
   Q43X(num);
   Q442(it);
   Q5RE();
   return (0x01);
 }